浏览代码

音乐改版 UI 开发完毕

100Years 1 月之前
父节点
当前提交
762f81c692

+ 14 - 2
AIEmoji.xcodeproj/project.pbxproj

@@ -134,6 +134,7 @@
 		A87587182D81814500286A66 /* TSAIThinkingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A87587172D81812C00286A66 /* TSAIThinkingView.swift */; };
 		A88508882DBCD944000FBCEC /* MemoryLeakChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = A88508872DBCD940000FBCEC /* MemoryLeakChecker.swift */; };
 		A885088D2DBCE7BE000FBCEC /* TSPTPHistoryVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A885088C2DBCE7BC000FBCEC /* TSPTPHistoryVC.swift */; };
+		A88508B62DBF142B000FBCEC /* TSGennertatorSelectStyleVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A88508B52DBF142A000FBCEC /* TSGennertatorSelectStyleVC.swift */; };
 		A899D34A2D827A0E00AB9C1C /* TSChatThinkingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A899D3492D8279FB00AB9C1C /* TSChatThinkingModel.swift */; };
 		A89EA64B2D59A588000EB181 /* MessageKit in Frameworks */ = {isa = PBXBuildFile; productRef = A89EA64A2D59A588000EB181 /* MessageKit */; };
 		A89EA6542D59A9F4000EB181 /* TSTextLayoutSizeCalculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = A89EA64F2D59A9F4000EB181 /* TSTextLayoutSizeCalculator.swift */; };
@@ -405,6 +406,7 @@
 		A87587172D81812C00286A66 /* TSAIThinkingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSAIThinkingView.swift; sourceTree = "<group>"; };
 		A88508872DBCD940000FBCEC /* MemoryLeakChecker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryLeakChecker.swift; sourceTree = "<group>"; };
 		A885088C2DBCE7BC000FBCEC /* TSPTPHistoryVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSPTPHistoryVC.swift; sourceTree = "<group>"; };
+		A88508B52DBF142A000FBCEC /* TSGennertatorSelectStyleVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSGennertatorSelectStyleVC.swift; sourceTree = "<group>"; };
 		A899D3492D8279FB00AB9C1C /* TSChatThinkingModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSChatThinkingModel.swift; sourceTree = "<group>"; };
 		A89EA64C2D59A9F4000EB181 /* CustomMessageFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomMessageFlowLayout.swift; sourceTree = "<group>"; };
 		A89EA64E2D59A9F4000EB181 /* TSLayoutSizeCalculator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSLayoutSizeCalculator.swift; sourceTree = "<group>"; };
@@ -1026,6 +1028,7 @@
 		A80EDDDC2D6EB17D003CD332 /* TSPTPGeneratorVC */ = {
 			isa = PBXGroup;
 			children = (
+				A88508B42DBF1408000FBCEC /* TSGennertatorSelectStyleVC */,
 				A885088B2DBCE7B8000FBCEC /* TSPTPHistoryVC */,
 				A8F413492DA75863001E715A /* TSUploadPhotoPrivacyAlertVC */,
 				A8BA76502DA515F9000B6707 /* TSPTPImageHintVC */,
@@ -1270,6 +1273,14 @@
 			path = TSPTPHistoryVC;
 			sourceTree = "<group>";
 		};
+		A88508B42DBF1408000FBCEC /* TSGennertatorSelectStyleVC */ = {
+			isa = PBXGroup;
+			children = (
+				A88508B52DBF142A000FBCEC /* TSGennertatorSelectStyleVC.swift */,
+			);
+			path = TSGennertatorSelectStyleVC;
+			sourceTree = "<group>";
+		};
 		A899D3482D8279E500AB9C1C /* CHatMessageModel */ = {
 			isa = PBXGroup;
 			children = (
@@ -2218,6 +2229,7 @@
 				A89EA6CF2D6430F3000EB181 /* TSChatViewController+Keyboard.swift in Sources */,
 				A8F7754E2D39E59100AA6E93 /* TSActionInfoModel.swift in Sources */,
 				A8F776452D3DE8A800AA6E93 /* TSSmallIconBrowseVC.swift in Sources */,
+				A88508B62DBF142B000FBCEC /* TSGennertatorSelectStyleVC.swift in Sources */,
 				A80E72632D40925000C64288 /* TSDiyKeyboardVM.swift in Sources */,
 				A8F775432D39346400AA6E93 /* TSSetingModel.swift in Sources */,
 				A89EA6BA2D5DDE5B000EB181 /* TSPageNullView.swift in Sources */,
@@ -2402,7 +2414,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2;
+				CURRENT_PROJECT_VERSION = 4;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
@@ -2441,7 +2453,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2;
+				CURRENT_PROJECT_VERSION = 4;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;

二进制
AIEmoji/Assets.xcassets/PTP/ptp_selected_border.imageset/ptp_selected_border@2x.png


二进制
AIEmoji/Assets.xcassets/PTP/ptp_selected_border.imageset/ptp_selected_border@3x.png


二进制
AIEmoji/Assets.xcassets/PTP/style/ptp_style_hot.imageset/ptp_style_hot@2x.png


二进制
AIEmoji/Assets.xcassets/PTP/style/ptp_style_hot.imageset/ptp_style_hot@3x.png


二进制
AIEmoji/Assets.xcassets/PTP/style/ptp_style_max.imageset/ptp_style_max@2x.png


二进制
AIEmoji/Assets.xcassets/PTP/style/ptp_style_max.imageset/ptp_style_max@3x.png


二进制
AIEmoji/Assets.xcassets/PTP/style/ptp_style_new.imageset/ptp_style_new@2x.png


二进制
AIEmoji/Assets.xcassets/PTP/style/ptp_style_new.imageset/ptp_style_new@3x.png


+ 20 - 0
AIEmoji/Business/TSGenmojiVC/TSGenmojiVC/View/TSGenmojiColSectionView.swift

@@ -6,6 +6,26 @@
 //
 
 class TSGenmojiColSectionView: TSBaseCollectionnReusableView {
+//    var data: Any?{
+//        didSet{
+//            leftLab.text = componentReuseViewModel.sectionModel.name
+//            leftSubLab.text = componentReuseViewModel.sectionModel.subText
+//            switch componentReuseViewModel.sectionModel.style {
+//            case .ptpPicHistory:
+//                moreView.isHidden = false
+//                delBtn.isHidden = true
+//            case .history,.textPicHistory:
+//                delBtn.isHidden = false
+//                moreView.isHidden = true
+//            default:
+//                delBtn.isHidden = true
+//                moreView.isHidden = true
+//            }
+//        }
+//    }
+//    weak var delegate: (any TSSmalCoacopods.TSSimpleCollectionViewDelegate)?
+//    var indexPath: IndexPath?
+    
     
     static let reuseIdentifier = "TSHomeCollectionReusableView"
     lazy var leftLab: UILabel = {

+ 233 - 0
AIEmoji/Business/TSPTPGeneratorVC/TSGennertatorSelectStyleVC/TSGennertatorSelectStyleVC.swift

@@ -0,0 +1,233 @@
+//
+//  TSGennertatorSelectStyleVC.swift
+//  AIEmoji
+//
+//  Created by 100Years on 2025/4/27.
+//
+
+class TSGennertatorSelectStyleVC: TSBaseVC {
+
+    lazy var bottomView: UIView = {
+        let bottomView = UIView()
+        bottomView.backgroundColor = .popupColor
+        return bottomView
+    }()
+    
+
+    lazy var xBtn: TSUIExpandedTouchButton = {
+        let xBtn = TSUIExpandedTouchButton()
+        xBtn.setUpButton(image: UIImage(named: "close_gray")) { [weak self]  in
+            guard let self = self else { return }
+            self.dismiss(animated: true)
+        }
+        return xBtn
+    }()
+    
+    var selectedValueBlock:((IndexPath,TSGenerateStyleModel)->Void)?
+    
+    var dataArray: [TSGenerateStyleModel] = [TSGenerateStyleModel](){
+        didSet{
+            styleCollectionView.reloadData()
+            if dataArray.count > 0 {
+                self.styleCollectionView.selectItem(at: self.currentIndexPath, animated: false, scrollPosition: .centeredVertically)
+            }
+        }
+    }
+    
+    lazy var layout: UICollectionViewFlowLayout = {
+        let w = (k_ScreenWidth-32.0-30.0-2.0)/4.0
+        let layout = UICollectionViewFlowLayout()
+        layout.scrollDirection = .vertical
+        layout.itemSize = CGSize(width: w, height: 110)
+        layout.minimumInteritemSpacing = 0.0
+        layout.minimumLineSpacing = 10.0
+        layout.sectionInset = UIEdgeInsets(top: 0, left: 16, bottom: k_Height_safeAreaInsetsBottom(), right: 16)
+        return layout
+    }()
+    
+    
+    lazy var styleCollectionView: UICollectionView = {
+        let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
+        collectionView.delegate = self
+        collectionView.dataSource = self
+        collectionView.showsVerticalScrollIndicator = false
+        collectionView.showsHorizontalScrollIndicator = false
+        collectionView.backgroundColor = .clear
+        collectionView.register(TSGennertatorSelectStyleCell.self, forCellWithReuseIdentifier: TSGennertatorSelectStyleCell.cellID)
+        if #available(iOS 11.0, *) {
+            collectionView.contentInsetAdjustmentBehavior = .never
+        }
+        return collectionView
+    }()
+
+    var currentIndexPath:IndexPath = IndexPath(item: 0, section: 0)
+    
+    override func createView() {
+        self.view.backgroundColor = .clear
+        self.contentView.backgroundColor = .clear
+        setNavBarViewHidden(true)
+        
+        contentView.addSubview(bottomView)
+        bottomView.snp.makeConstraints { make in
+            make.bottom.leading.trailing.bottom.equalTo(0)
+            make.top.equalTo(104+k_Nav_Height)
+        }
+        setContentView()
+        
+        kDelayMainShort {
+            self.bottomView.cornersRound(radius: 20, corner: [.topLeft,.topRight])
+        }
+    }
+    
+    func setContentView(){
+        
+        let titleLabel = UILabel.createLabel(text: "Select Style".localized,font: .font(size: 16,weight: .medium),textColor: .white)
+        bottomView.addSubview(titleLabel)
+        titleLabel.snp.makeConstraints { make in
+            make.leading.equalTo(16)
+            make.top.equalTo(24)
+        }
+        
+        bottomView.addSubview(xBtn)
+        xBtn.snp.makeConstraints { make in
+            make.top.equalTo(8)
+            make.trailing.equalTo(-8)
+            make.width.height.equalTo(24)
+        }
+        
+        bottomView.addSubview(styleCollectionView)
+        styleCollectionView.snp.makeConstraints { make in
+            make.top.equalTo(56)
+            make.leading.trailing.equalTo(0)
+            make.bottom.equalTo(0)
+        }
+        
+    }
+    
+    override func dealThings() {
+        addPullDownClosePage()
+    }
+}
+
+extension TSGennertatorSelectStyleVC: UICollectionViewDataSource ,UICollectionViewDelegate {
+    
+    public func numberOfSections(in collectionView: UICollectionView) -> Int {
+        return 1
+    }
+    
+    public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+        return dataArray.count
+    }
+    
+    public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+        
+        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: TSGennertatorSelectStyleCell.cellID, for: indexPath)
+        if let cell = cell as? TSGennertatorSelectStyleCell,let itemModel = dataArray.safeObj(At: indexPath.item){
+            cell.itemModel = itemModel
+        }
+        return cell
+    }
+
+    public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+        if let model = dataArray.safeObj(At: indexPath.item){
+            currentIndexPath = indexPath
+            self.styleCollectionView.selectItem(at: self.currentIndexPath, animated: true, scrollPosition: .centeredVertically)
+            selectedValueBlock?(indexPath,model)
+        }
+    }
+}
+
+class TSGennertatorSelectStyleCell: TSBaseCollectionCell {
+    
+    static let cellID = "TSGennertatorSelectStyleCell"
+
+    override var isSelected: Bool{
+        didSet{
+            boardImageView.isHidden = isSelected ? false : true
+        }
+    }
+    
+    var itemModel:TSGenerateStyleModel = TSGenerateStyleModel(){
+        didSet{
+            imageView.image = UIImage(named: itemModel.imageName)
+            
+            let hotImageNamed = getHotImageNamed(specialStyle: itemModel.specialStyle)
+            if hotImageNamed.count > 0 {
+                hotImageView.image = UIImage(named: hotImageNamed)
+                hotImageView.isHidden = false
+            }else{
+                hotImageView.isHidden = true
+            }
+            textLabel.text = itemModel.imageText.localized
+        }
+    }
+    
+    func getHotImageNamed(specialStyle:Int)->String{
+        if specialStyle == 1 {
+            return "ptp_style_hot"
+        }else if specialStyle == 2 {
+            return "ptp_style_new"
+        }else if specialStyle == 3 {
+            return "ptp_style_max"
+        }
+        return ""
+    }
+    
+    lazy var imageView: UIImageView = {
+        let imageView = UIImageView()
+        imageView.cornerRadius = kDesignScale*16.0
+        return imageView
+    }()
+    
+    lazy var hotImageView: UIImageView = {
+        let hotImageView = UIImageView.createImageView(imageName: "ptp_style_hot")
+        hotImageView.isHidden = true
+        return hotImageView
+    }()
+    
+    lazy var boardImageView: UIImageView = {
+        let boardImageView = UIImageView.createImageView(imageName: "ptp_selected_border")
+        boardImageView.isHidden = true
+        return boardImageView
+    }()
+
+    
+    lazy var textLabel: UILabel = {
+        let textLabel = UILabel.createLabel(font: .font(size: 14),textColor: .white,textAlignment: .center,numberOfLines: 0)
+        textLabel.adjustsFontSizeToFitWidth = true
+        return textLabel
+    }()
+    
+    override func creatUI() {
+        //cell 100*110
+   
+        
+        bgContentView.addSubview(boardImageView)
+        boardImageView.snp.makeConstraints { make in
+            make.top.centerX.equalToSuperview()
+            make.width.height.equalTo(contentView.width)
+        }
+        
+        bgContentView.addSubview(imageView)
+        imageView.snp.makeConstraints { make in
+            make.top.equalTo(4*kDesignScale)
+            make.centerX.equalToSuperview()
+            make.width.height.equalTo(contentView.width-8*kDesignScale)
+        }
+        
+        imageView.addSubview(hotImageView)
+        hotImageView.snp.makeConstraints { make in
+            make.leading.equalTo(0)
+            make.top.equalTo(0.0)
+            make.width.height.equalTo(36)
+        }
+        
+        bgContentView.addSubview(textLabel)
+        textLabel.snp.makeConstraints { make in
+            make.top.equalTo(imageView.snp.bottom).offset(0)
+            make.leading.trailing.bottom.equalToSuperview()
+        }
+    }
+    
+}
+

+ 12 - 1
AIEmoji/Business/TSPTPGeneratorVC/TSPTPInputVC/TSPTPInputVC.swift

@@ -400,7 +400,18 @@ extension TSPTPInputVC {
             make.width.equalTo(k_ScreenWidth)
         }
         
-        let selectStyleTitleView = TSTitleView.creatTitleView(title: "Select Style".localized)
+        let selectStyleTitleView = TSTitleMoreView()
+        selectStyleTitleView.setTitle(title: "Select Style".localized) { [weak self]  in
+            guard let self = self else { return }
+            let selectStyleVC = TSGennertatorSelectStyleVC()
+            selectStyleVC.currentIndexPath = IndexPath(item: viewModel.selectedStyleIndex, section: 0)
+            selectStyleVC.dataArray = viewModel.ptpStyleModels
+            selectStyleVC.selectedValueBlock = { [weak self] indexPath ,model in
+                guard let self = self else { return }
+                selectStyleView.collectionView(selectStyleView.styleCollectionView, didSelectItemAt: indexPath)
+            }
+            kPresentModalVC(target: self, modelVC: selectStyleVC,transitionStyle: .coverVertical)
+        }
         cusStackView.addSubviewToStack(selectStyleTitleView)
         selectStyleTitleView.snp.makeConstraints { make in
             make.height.equalTo(selectStyleTitleView.viewH)

+ 9 - 8
AIEmoji/Business/TSPTPGeneratorVC/TSPTPInputVC/View/TSPTPSelectStyleView.swift

@@ -19,13 +19,14 @@ class TSPTPSelectStyleView : TSBaseView{
         }
     }
     
-    var clickHandle:((TSGenerateStyleModel)->Void)?
+    var clickHandle:((IndexPath,TSGenerateStyleModel)->Void)?
     lazy var layout: UICollectionViewFlowLayout = {
         let layout = UICollectionViewFlowLayout()
         layout.scrollDirection = .horizontal
-        layout.itemSize = CGSize(width: 110, height: 110)
+        let w = (k_ScreenWidth-32.0-30.0-2.0)/4.0
+        layout.itemSize = CGSize(width: w, height: 110)
         layout.minimumInteritemSpacing = 0.0
-        layout.minimumLineSpacing = 12.0
+        layout.minimumLineSpacing = 10.0
         layout.sectionInset = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 16)
         return layout
     }()
@@ -38,7 +39,7 @@ class TSPTPSelectStyleView : TSBaseView{
         collectionView.showsVerticalScrollIndicator = false
         collectionView.showsHorizontalScrollIndicator = false
         collectionView.backgroundColor = .clear
-        collectionView.register(TSPTPSelectStyleCCell.self, forCellWithReuseIdentifier: TSPTPSelectStyleCCell.cellID)
+        collectionView.register(TSGennertatorSelectStyleCell.self, forCellWithReuseIdentifier: TSGennertatorSelectStyleCell.cellID)
         if #available(iOS 11.0, *) {
             collectionView.contentInsetAdjustmentBehavior = .never
         }
@@ -46,7 +47,7 @@ class TSPTPSelectStyleView : TSBaseView{
     }()
 
     var currentIndexPath:IndexPath = IndexPath(item: 0, section: 0)
-    
+
     override func creatUI() {
         currentIndexPath = IndexPath(item: 0, section: 0)
         addSubview(styleCollectionView)
@@ -72,8 +73,8 @@ extension TSPTPSelectStyleView: UICollectionViewDataSource ,UICollectionViewDele
     
     public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         
-        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: TSPTPSelectStyleCCell.cellID, for: indexPath)
-        if let cell = cell as? TSPTPSelectStyleCCell,let itemModel = dataArray.safeObj(At: indexPath.item){
+        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: TSGennertatorSelectStyleCell.cellID, for: indexPath)
+        if let cell = cell as? TSGennertatorSelectStyleCell,let itemModel = dataArray.safeObj(At: indexPath.item){
             cell.itemModel = itemModel
         }
         return cell
@@ -83,7 +84,7 @@ extension TSPTPSelectStyleView: UICollectionViewDataSource ,UICollectionViewDele
         if let model = dataArray.safeObj(At: indexPath.item){
             currentIndexPath = indexPath
             self.styleCollectionView.selectItem(at: self.currentIndexPath, animated: true, scrollPosition: .centeredHorizontally)
-            clickHandle?(model)
+            clickHandle?(indexPath,model)
         }
     }
 }

+ 45 - 0
AIEmoji/Business/TSTextGeneralPictureVC/TSTTPInputVC/View/TSTitleView.swift

@@ -47,5 +47,50 @@ extension TSTitleView {
         titleView.leftSubLab.text = subTitle
         return titleView
     }
+}
+class TSTitleMoreView: TSTitleView {
+    
+    lazy var moreView: UIView = {
+        let moreView = UIView()
+        moreView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(clickMoreView)))
+        
+        let label = UILabel.createLabel(text: "More".localized,font: .font(size: 12),textColor: .white.withAlphaComponent(0.4))
+        moreView.addSubview(label)
+        label.snp.makeConstraints { make in
+            make.leading.top.bottom.equalTo(0)
+        }
+        
+        let imageView = UIImageView.createImageView(imageName: "gray_right_arrow")
+        
+        moreView.addSubview(imageView)
+        imageView.snp.makeConstraints { make in
+            make.trailing.top.bottom.equalTo(0)
+            make.leading.equalTo(label.snp.trailing)
+        }
+        
+        return moreView
+    }()
+
+    override func creatUI() {
+        super.creatUI()
+
+        contentView.addSubview(moreView)
+        moreView.snp.makeConstraints { make in
+            make.trailing.equalTo(-16)
+            make.centerY.equalTo(titleLab)
+        }
+        
+    }
+    
+    @objc private func clickMoreView() {
+        clickMoreBlock?()
+    }
+    
+    var clickMoreBlock:(()->Void)?
+    func setTitle(title:String,clickMoreBlock:(()->Void)?) {
+        titleLab.text = title
+        self.clickMoreBlock = clickMoreBlock
+    }
+    
     
 }