4 Komitmen 530ceaf8ff ... 5e49cd2f44

Pembuat SHA1 Pesan Tanggal
  zhongbaojian 5e49cd2f44 Merge branch 'develop' of http://svn.ouj.com:3000/duowan_iOS/SuperShow into develop 5 tahun lalu
  zhongbaojian c5934b0d75 所有模板相关列表的标签UI修改 5 tahun lalu
  zhongbaojian 834f8cac96 模板列表项标签UI修改 5 tahun lalu
  zhongbaojian 074d392161 修改下载记录删除交互 5 tahun lalu

+ 19 - 15
SuperShow.xcodeproj/project.pbxproj

@@ -8,8 +8,6 @@
 
 /* Begin PBXBuildFile section */
 		4306934F22CEFAFB0015F1FD /* OJAPremultipliedOpacityFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4306934E22CEFAFB0015F1FD /* OJAPremultipliedOpacityFilter.m */; };
-		4364B454225AE6EB004A6869 /* WSSProfileCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4364B452225AE6EB004A6869 /* WSSProfileCollectionCell.swift */; };
-		4364B455225AE6EB004A6869 /* WSSProfileCollectionCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4364B453225AE6EB004A6869 /* WSSProfileCollectionCell.xib */; };
 		4364B458225AE8FB004A6869 /* WSSTagButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4364B457225AE8FB004A6869 /* WSSTagButton.swift */; };
 		4364B46F225B2E68004A6869 /* WSSProfileMyTemplateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4364B46E225B2E68004A6869 /* WSSProfileMyTemplateViewController.swift */; };
 		4364B472225B311A004A6869 /* WSSProfileMembershipViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4364B471225B311A004A6869 /* WSSProfileMembershipViewController.swift */; };
@@ -506,6 +504,9 @@
 		A8ECB1D72305410300D0882B /* WSSCoolVoiceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8ECB1D62305410300D0882B /* WSSCoolVoiceViewController.swift */; };
 		A8ED3AE322C06DEB003384BE /* WSSTemplateEditCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8ED3AE222C06DEB003384BE /* WSSTemplateEditCollectionView.swift */; };
 		A8F68658236C0649007C1427 /* WSSAddSutitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F68657236C0649007C1427 /* WSSAddSutitleView.swift */; };
+		A8F68A3B2387895B005ABB8B /* WSSTemplateTagView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F68A3A2387895B005ABB8B /* WSSTemplateTagView.swift */; };
+		A8F68A3D2387896B005ABB8B /* WSSTemplateTagView.xib in Resources */ = {isa = PBXBuildFile; fileRef = A8F68A3C2387896B005ABB8B /* WSSTemplateTagView.xib */; };
+		A8F68A402387C0DF005ABB8B /* WSSDownloadRecordCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F68A3F2387C0DF005ABB8B /* WSSDownloadRecordCollectionViewCell.swift */; };
 		A8F7F7C42354204C003A38BF /* WSSCreativeTemplateEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F7F7C32354204C003A38BF /* WSSCreativeTemplateEditViewController.swift */; };
 		A8F7F7C923542900003A38BF /* WSSVideoInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F7F7C823542900003A38BF /* WSSVideoInfoModel.swift */; };
 		A8F7F7CB235455A4003A38BF /* WSSSpotVideoInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F7F7CA235455A4003A38BF /* WSSSpotVideoInfoModel.swift */; };
@@ -585,8 +586,6 @@
 		3B172E929B3111534E717093 /* Pods-SuperShow.debug-test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SuperShow.debug-test.xcconfig"; path = "Pods/Target Support Files/Pods-SuperShow/Pods-SuperShow.debug-test.xcconfig"; sourceTree = "<group>"; };
 		4306934D22CEFAFB0015F1FD /* OJAPremultipliedOpacityFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OJAPremultipliedOpacityFilter.h; sourceTree = "<group>"; };
 		4306934E22CEFAFB0015F1FD /* OJAPremultipliedOpacityFilter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OJAPremultipliedOpacityFilter.m; sourceTree = "<group>"; };
-		4364B452225AE6EB004A6869 /* WSSProfileCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSProfileCollectionCell.swift; sourceTree = "<group>"; };
-		4364B453225AE6EB004A6869 /* WSSProfileCollectionCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WSSProfileCollectionCell.xib; sourceTree = "<group>"; };
 		4364B457225AE8FB004A6869 /* WSSTagButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSTagButton.swift; sourceTree = "<group>"; };
 		4364B46E225B2E68004A6869 /* WSSProfileMyTemplateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSProfileMyTemplateViewController.swift; sourceTree = "<group>"; };
 		4364B471225B311A004A6869 /* WSSProfileMembershipViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSProfileMembershipViewController.swift; sourceTree = "<group>"; };
@@ -1325,6 +1324,9 @@
 		A8ECB1D62305410300D0882B /* WSSCoolVoiceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSCoolVoiceViewController.swift; sourceTree = "<group>"; };
 		A8ED3AE222C06DEB003384BE /* WSSTemplateEditCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSTemplateEditCollectionView.swift; sourceTree = "<group>"; };
 		A8F68657236C0649007C1427 /* WSSAddSutitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSAddSutitleView.swift; sourceTree = "<group>"; };
+		A8F68A3A2387895B005ABB8B /* WSSTemplateTagView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSTemplateTagView.swift; sourceTree = "<group>"; };
+		A8F68A3C2387896B005ABB8B /* WSSTemplateTagView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WSSTemplateTagView.xib; sourceTree = "<group>"; };
+		A8F68A3F2387C0DF005ABB8B /* WSSDownloadRecordCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSDownloadRecordCollectionViewCell.swift; sourceTree = "<group>"; };
 		A8F7F7C32354204C003A38BF /* WSSCreativeTemplateEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSCreativeTemplateEditViewController.swift; sourceTree = "<group>"; };
 		A8F7F7C823542900003A38BF /* WSSVideoInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSVideoInfoModel.swift; sourceTree = "<group>"; };
 		A8F7F7CA235455A4003A38BF /* WSSSpotVideoInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSSpotVideoInfoModel.swift; sourceTree = "<group>"; };
@@ -1422,9 +1424,9 @@
 		4364B456225AE8EC004A6869 /* Common */ = {
 			isa = PBXGroup;
 			children = (
-				4364B457225AE8FB004A6869 /* WSSTagButton.swift */,
 				A8BE47102385218A000B6EF9 /* SVProgressHUD+WSSExtension.h */,
 				A8BE47112385218A000B6EF9 /* SVProgressHUD+WSSExtension.m */,
+				4364B457225AE8FB004A6869 /* WSSTagButton.swift */,
 			);
 			path = Common;
 			sourceTree = "<group>";
@@ -1919,8 +1921,7 @@
 		43929DC02254E6A200958E18 /* Collection */ = {
 			isa = PBXGroup;
 			children = (
-				4364B452225AE6EB004A6869 /* WSSProfileCollectionCell.swift */,
-				4364B453225AE6EB004A6869 /* WSSProfileCollectionCell.xib */,
+				A8F68A3F2387C0DF005ABB8B /* WSSDownloadRecordCollectionViewCell.swift */,
 				43929DC12254E6B800958E18 /* WSSProfileCollectionViewController.swift */,
 				4364B46E225B2E68004A6869 /* WSSProfileMyTemplateViewController.swift */,
 			);
@@ -1935,6 +1936,8 @@
 				A8F7F7D323547B16003A38BF /* WSSCreativeSubVideoCell.swift */,
 				A8F7F7D023546B55003A38BF /* WSSSubVideoCollectionCell.swift */,
 				439345F22256096E00C192A6 /* WSSTemplateCollectionCell.swift */,
+				A8F68A3A2387895B005ABB8B /* WSSTemplateTagView.swift */,
+				A8F68A3C2387896B005ABB8B /* WSSTemplateTagView.xib */,
 				439345F12256096E00C192A6 /* WSSTemplateTypeTableCell.swift */,
 				A887618F22E15CF500C03BF4 /* WSSTrasnitionSelectAlert.swift */,
 				A89D51982355D0E00039E06C /* WSSVideoCropView.swift */,
@@ -2865,8 +2868,8 @@
 			isa = PBXGroup;
 			children = (
 				A8CA0A4A227157CF007E7584 /* IJKMediaFramework.framework */,
-				A8CA0A4C227157CF007E7584 /* IJKMediaFrameworkWithSSL.framework */,
 				A8CA0A4E227157CF007E7584 /* IJKMediaFrameworkTests.xctest */,
+				A8CA0A4C227157CF007E7584 /* IJKMediaFrameworkWithSSL.framework */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -3188,7 +3191,6 @@
 				43AE1C61222FC75C00CF8312 /* WSSPasterCell.xib in Resources */,
 				43AE274C2231164300CF8312 /* WSSPasterView.xib in Resources */,
 				43929DB22254652E00958E18 /* WSSProfileCell.xib in Resources */,
-				4364B455225AE6EB004A6869 /* WSSProfileCollectionCell.xib in Resources */,
 				43929DAE22545F3000958E18 /* WSSProfileHeaderView.xib in Resources */,
 				4364B47E225B33AC004A6869 /* WSSProfileMembershipBuyCell.xib in Resources */,
 				4364B486225B4A74004A6869 /* WSSProfileMembershipBuyItemView.xib in Resources */,
@@ -3201,6 +3203,7 @@
 				A8409726226DC594008F3E47 /* WSSShareCollectionCell.xib in Resources */,
 				43FE16E82243B66C008BB996 /* WSSShootEditSubtitleCell.xib in Resources */,
 				A8A2C9A022E1ED9900214122 /* WSSTemplateSpotEditTransitonButtonView.xib in Resources */,
+				A8F68A3D2387896B005ABB8B /* WSSTemplateTagView.xib in Resources */,
 				A8A39FAE22A60AB0001D2C84 /* WSSTemplateTipsAlertView.xib in Resources */,
 				A8287DD222A519AA00A127FC /* WSSWifiChangeAlertView.xib in Resources */,
 				438E5A8C22520BDB0017FCFD /* WebViewJsBridge.js in Resources */,
@@ -3410,6 +3413,7 @@
 				438E5A8E22520CD10017FCFD /* OJSVendorMacro.swift in Sources */,
 				A8FA6851230CE94400AC75E8 /* PcmPlayer.m in Sources */,
 				438E4CA122201AEA007B9CD9 /* R.generated.swift in Sources */,
+				A8BE47122385218A000B6EF9 /* SVProgressHUD+WSSExtension.m in Sources */,
 				438E4DE122201F9F007B9CD9 /* SetImageExtension.swift in Sources */,
 				438E5A952252134D0017FCFD /* ShareInfo.m in Sources */,
 				438E5A962252134D0017FCFD /* ShareTool.m in Sources */,
@@ -3427,7 +3431,6 @@
 				A8B3833422B73A8A0059CB2F /* WSSAPIPaster.swift in Sources */,
 				439345E12255FB5200C192A6 /* WSSAPIProfileRequest.swift in Sources */,
 				43B62A0222646CD400B6CA30 /* WSSAPIRelateMusic.swift in Sources */,
-				A8BE47122385218A000B6EF9 /* SVProgressHUD+WSSExtension.m in Sources */,
 				439345E82256094E00C192A6 /* WSSAPISearch.swift in Sources */,
 				43B62A0122646CD400B6CA30 /* WSSAPISelectMusic.swift in Sources */,
 				A8C43B1C2293954D00D80E0F /* WSSAPISpecialEffects.swift in Sources */,
@@ -3492,6 +3495,7 @@
 				A8C43B592294290D00D80E0F /* WSSDBBaseBean.swift in Sources */,
 				A8C43B5A2294290D00D80E0F /* WSSDBManager.swift in Sources */,
 				A836C82022817DB80062BDCF /* WSSDanceEffectCollectionCell.swift in Sources */,
+				A8F68A402387C0DF005ABB8B /* WSSDownloadRecordCollectionViewCell.swift in Sources */,
 				A830179A231F948300149AF6 /* WSSEditColorFilterView.swift in Sources */,
 				438E5BD4224632B30082BD24 /* WSSEditCutBottomView.swift in Sources */,
 				4390315A224902EB0099D6F3 /* WSSEditCutCenterPinView.swift in Sources */,
@@ -3559,7 +3563,6 @@
 				A8C17BA122A0CF3100959787 /* WSSPopupView.swift in Sources */,
 				43929DBB2254B96800958E18 /* WSSProfileAboutViewController.swift in Sources */,
 				43929DB12254652E00958E18 /* WSSProfileCell.swift in Sources */,
-				4364B454225AE6EB004A6869 /* WSSProfileCollectionCell.swift in Sources */,
 				43929DC22254E6B800958E18 /* WSSProfileCollectionViewController.swift in Sources */,
 				43929DBF2254BDFD00958E18 /* WSSProfileFeedbackViewController.swift in Sources */,
 				43929DAC22545F0000958E18 /* WSSProfileHeaderView.swift in Sources */,
@@ -3654,6 +3657,7 @@
 				A8E9CF90235182CC00CA985C /* WSSTemplateSpotResourcePickerController.swift in Sources */,
 				A8E9CF8E2351812F00CA985C /* WSSTemplateSpotSelectedModel.swift in Sources */,
 				A8D6E9AA22DF19700000FB24 /* WSSTemplateSpotViewController.swift in Sources */,
+				A8F68A3B2387895B005ABB8B /* WSSTemplateTagView.swift in Sources */,
 				A8A39FAF22A60AB1001D2C84 /* WSSTemplateTipsAlert.swift in Sources */,
 				439345EF2256095B00C192A6 /* WSSTemplateTypeModel.swift in Sources */,
 				439345F32256096E00C192A6 /* WSSTemplateTypeTableCell.swift in Sources */,
@@ -3853,7 +3857,7 @@
 				CODE_SIGN_ENTITLEMENTS = SuperShow/SuperShow.entitlements;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1114;
+				CURRENT_PROJECT_VERSION = 1117;
 				DEVELOPMENT_TEAM = 6DTLD5LADX;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -4016,7 +4020,7 @@
 				CODE_SIGN_ENTITLEMENTS = SuperShow/SuperShow.entitlements;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1114;
+				CURRENT_PROJECT_VERSION = 1117;
 				DEVELOPMENT_TEAM = 6DTLD5LADX;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -4234,7 +4238,7 @@
 				CODE_SIGN_ENTITLEMENTS = SuperShow/SuperShow.entitlements;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1114;
+				CURRENT_PROJECT_VERSION = 1117;
 				DEVELOPMENT_TEAM = 6DTLD5LADX;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -4458,7 +4462,7 @@
 				CODE_SIGN_ENTITLEMENTS = SuperShow/SuperShow.entitlements;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1114;
+				CURRENT_PROJECT_VERSION = 1117;
 				DEVELOPMENT_TEAM = 6DTLD5LADX;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (

+ 3 - 1
SuperShow/Model/WSSCommonModel.swift

@@ -58,9 +58,11 @@ class WSSCommonTemplateModel: HandyJSON {
 
     /// 首页推荐页 大家都在玩(正方形缩略图)
     var thumbnail: String?
-    
+
     /// 视频播放时长
     var duration: TimeInterval = 0
+    /// 片段个数
+    var fragment: Int = 0
 
     required init() {}
 }

+ 66 - 0
SuperShow/UI/Profile/Collection/WSSDownloadRecordCollectionViewCell.swift

@@ -0,0 +1,66 @@
+//
+//  WSSDownloadRecordCollectionViewCell.swift
+//  SuperShow
+//
+//  Created by zhongbaojian on 2019/11/22.
+//  Copyright © 2019 duowan. All rights reserved.
+//
+
+import UIKit
+
+class WSSDownloadRecordCollectionViewCell: WSSSearchResultCollectionCell {
+    var checkEventHandle: WSSEmptyClosure?
+    /// 勾选按钮,默认隐藏
+    private lazy var checkButton: UIButton = {
+        let button: UIButton = UIButton(type: .custom)
+        button.contentHorizontalAlignment = .left
+        button.contentVerticalAlignment = .top
+        button.setImage(R.image.profile_ic_check_0(), for: .normal)
+        button.setImage(R.image.profile_ic_check_1(), for: .selected)
+        button.setImage(R.image.profile_ic_check_1(), for: .highlighted)
+        button.isHidden = true
+        button.isSelected = false
+        button.addCallback { [weak self] sender in
+            if let model = self?.model {
+                model.selected = !model.selected
+                sender?.isSelected = model.selected
+            }
+            self?.checkEventHandle?()
+        }
+        
+
+        return button
+    }()
+
+    var isShowCheck: Bool = false {
+        didSet {
+            checkButton.isHidden = !isShowCheck
+        }
+    }
+
+    override class func otherEdgeWidth() -> CGFloat {
+        return 0.0
+    }
+
+    override func currentCoverHeight() -> CGFloat {
+        return WSSDownloadRecordCollectionViewCell.templateCoverHeight()
+    }
+
+    override func setupSubViews() {
+        super.setupSubViews()
+
+        contentView.addSubview(checkButton)
+        checkButton.snp.makeConstraints { make in
+            make.left.equalToSuperview().offset(8.0)
+            make.top.equalToSuperview().offset(8.0)
+            make.right.equalToSuperview().offset(-8.0)
+            make.bottom.equalToSuperview().offset(-8.0)
+        }
+    }
+
+    override func modelDidChange() {
+        super.modelDidChange()
+
+        checkButton.isSelected = model?.selected ?? false
+    }
+}

+ 0 - 159
SuperShow/UI/Profile/Collection/WSSProfileCollectionCell.swift

@@ -1,159 +0,0 @@
-//
-//  WSSProfileCollectionCell.swift
-//  SuperShow
-//
-//  Created by luxiaoming on 2019/4/8.
-//  Copyright © 2019 duowan. All rights reserved.
-//
-
-import OJASwiftKit
-import UIKit
-
-private let kItemWidth: CGFloat = floor((kOJSScreenWidth - 16 * 3) / 2)
-private let kItemHeight: CGFloat = floor(kItemWidth / 9.0 * 16.0 + 8 + 16 + 4)
-
-class WSSProfileCollectionCell: UICollectionViewCell {
-    static let kStaticSize: CGSize = CGSize(width: kItemWidth, height: kItemHeight)
-    private let kTagHeight: CGFloat = 16.0
-    private let kTagWidth: CGFloat = 32.0
-    private let kTagSpace: CGFloat = 8.0
-
-    var checkEventHandle: WSSEmptyClosure?
-
-    @IBOutlet var coverImageView: UIImageView! {
-        didSet {
-            coverImageView.contentMode = .scaleAspectFill
-            coverImageView.clipsToBounds = true
-        }
-    }
-
-    @IBOutlet var titleLabel: UILabel! {
-        didSet {
-            titleLabel.font = OJAFont.font12
-            titleLabel.textColor = OJATextColor.colorWhite
-            titleLabel.text = nil
-        }
-    }
-
-    @IBOutlet var vipLabel: UILabel! {
-        didSet {
-            vipLabel.text = "VIP"
-            vipLabel.font = OJAFont.font11
-            vipLabel.textColor = OJATextColor.colorWhite
-            vipLabel.textAlignment = .center
-            vipLabel.backgroundColor = OJSColor(hexRGBValue: 0xFF1E50)
-            vipLabel.layer.cornerRadius = kTagHeight * 0.5
-            vipLabel.clipsToBounds = true
-        }
-    }
-
-    @IBOutlet var priceLabel: UILabel! {
-        didSet {
-            priceLabel.text = "¥0.00"
-            priceLabel.font = OJAFont.font11
-            priceLabel.textColor = OJATextColor.colorWhite
-            priceLabel.textAlignment = .center
-            priceLabel.backgroundColor = OJSColor(hexRGBValue: 0x501EFF)
-            priceLabel.layer.cornerRadius = kTagHeight * 0.5
-            priceLabel.clipsToBounds = true
-        }
-    }
-
-    @IBOutlet var stackViewWidth: NSLayoutConstraint!
-
-    /// 勾选按钮,默认隐藏
-    @IBOutlet weak var checkButton: UIButton!
-    var isShowCheck: Bool = false {
-        didSet {
-            checkButton.isHidden = !isShowCheck
-        }
-    }
-
-    var dataModel: WSSCommonTemplateModel? {
-        didSet {
-            self.setup(withTemplate: dataModel)
-        }
-    }
-
-    override func awakeFromNib() {
-        super.awakeFromNib()
-    }
-
-    private func setup(withTemplate model: WSSCommonTemplateModel?) {
-        guard let model = model else { return }
-        if model.isPublish {
-            coverImageView.ojs_setImage(withUrl: model.cover)
-        } else {
-            coverImageView.image = R.image.template_unavailable()
-        }
-
-        titleLabel.text = model.name
-
-        var priceWidth: CGFloat = 0.0
-
-        // feeType 如果是buy,则可VIP、单独购买;如果是feeType为vip,则只能是VIP
-        switch model.feeType {
-        case .free:
-            // 免费
-            vipLabel.isHidden = true
-            priceLabel.isHidden = true
-
-        case .buy:
-            // 购买
-            vipLabel.isHidden = false
-            if model.price > 0 {
-                priceLabel.isHidden = false
-                let priceStr = String.covertPrice(model.price)
-                priceLabel.text = priceStr
-                priceWidth = priceStr.width(forFixedHeight: kTagHeight, font: priceLabel.font) + kTagHeight
-                if priceWidth < kTagWidth {
-                    priceWidth = kTagWidth
-                }
-                priceLabel.width = priceWidth
-
-            } else {
-                priceLabel.isHidden = true
-                priceLabel.text = ""
-            }
-
-        case .vip:
-            // VIP
-            vipLabel.isHidden = false
-            priceLabel.isHidden = true
-
-        case .limitFree:
-            vipLabel.isHidden = true
-            priceLabel.isHidden = false
-            let priceStr = "限免"
-            priceLabel.text = priceStr
-            priceWidth = priceStr.width(forFixedHeight: kTagHeight, font: priceLabel.font) + kTagHeight
-            if priceWidth < kTagWidth {
-                priceWidth = kTagWidth
-            }
-            priceLabel.width = priceWidth
-        }
-
-        var stackWidth: CGFloat = 0.0
-        if !vipLabel.isHidden {
-            stackWidth += kTagWidth
-        }
-        if !priceLabel.isHidden {
-            stackWidth += priceWidth
-        }
-        if !vipLabel.isHidden && !priceLabel.isHidden {
-            stackWidth += kTagSpace
-        }
-        stackViewWidth.constant = stackWidth
-
-        checkButton.isSelected = model.selected
-    }
-
-    @IBAction func checkButtonClick(_ sender: UIButton) {
-        if let model = self.dataModel {
-            model.selected = !model.selected
-            sender.isSelected = model.selected
-
-            checkEventHandle?()
-        }
-    }
-}

+ 0 - 114
SuperShow/UI/Profile/Collection/WSSProfileCollectionCell.xib

@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
-    <device id="retina6_1" orientation="portrait" appearance="light"/>
-    <dependencies>
-        <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15509"/>
-        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-    </dependencies>
-    <objects>
-        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
-        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-        <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="WSSProfileCollectionCell" customModule="SuperShow" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="151" height="364"/>
-            <autoresizingMask key="autoresizingMask"/>
-            <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
-                <rect key="frame" x="0.0" y="0.0" width="151" height="364"/>
-                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                <subviews>
-                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="I8U-WJ-fdG">
-                        <rect key="frame" x="0.0" y="0.0" width="151" height="268.5"/>
-                        <constraints>
-                            <constraint firstAttribute="width" secondItem="I8U-WJ-fdG" secondAttribute="height" multiplier="9:16" id="H14-Tg-9J8"/>
-                        </constraints>
-                    </imageView>
-                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="corner_mask" translatesAutoresizingMaskIntoConstraints="NO" id="ixL-Zi-wt2">
-                        <rect key="frame" x="0.0" y="0.0" width="151" height="268.5"/>
-                    </imageView>
-                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="msM-QL-QnS">
-                        <rect key="frame" x="0.0" y="276.5" width="151" height="83.5"/>
-                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                        <nil key="textColor"/>
-                        <nil key="highlightedColor"/>
-                    </label>
-                    <stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="tqc-xB-Z0v">
-                        <rect key="frame" x="75" y="4" width="72" height="16"/>
-                        <subviews>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="VIP" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3PK-dM-4Sq">
-                                <rect key="frame" x="0.0" y="0.0" width="32" height="16"/>
-                                <color key="backgroundColor" red="1" green="0.1176470588" blue="0.31372549020000001" alpha="1" colorSpace="calibratedRGB"/>
-                                <constraints>
-                                    <constraint firstAttribute="width" constant="32" id="XGf-3K-lZG"/>
-                                </constraints>
-                                <fontDescription key="fontDescription" type="system" pointSize="11"/>
-                                <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                                <nil key="highlightedColor"/>
-                            </label>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="--" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="x8Q-wo-lht">
-                                <rect key="frame" x="40" y="0.0" width="32" height="16"/>
-                                <color key="backgroundColor" red="0.31372549020000001" green="0.1176470588" blue="1" alpha="1" colorSpace="calibratedRGB"/>
-                                <constraints>
-                                    <constraint firstAttribute="width" constant="32" id="jAf-q5-vnk"/>
-                                </constraints>
-                                <fontDescription key="fontDescription" type="system" pointSize="11"/>
-                                <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                                <nil key="highlightedColor"/>
-                            </label>
-                        </subviews>
-                        <constraints>
-                            <constraint firstAttribute="width" constant="72" id="Nyo-43-JcQ"/>
-                            <constraint firstAttribute="height" constant="16" id="wta-EC-UWX"/>
-                        </constraints>
-                        <viewLayoutGuide key="safeArea" id="F6L-K7-Cs9"/>
-                    </stackView>
-                    <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Kgc-g3-AEn">
-                        <rect key="frame" x="8" y="8" width="40" height="45"/>
-                        <constraints>
-                            <constraint firstAttribute="height" constant="45" id="0xM-eu-8Hn"/>
-                            <constraint firstAttribute="width" constant="40" id="JF8-ik-efi"/>
-                        </constraints>
-                        <state key="normal" image="profile_ic_check_0"/>
-                        <state key="selected" image="profile_ic_check_1"/>
-                        <connections>
-                            <action selector="checkButtonClick:" destination="gTV-IL-0wX" eventType="touchUpInside" id="egq-8n-ego"/>
-                        </connections>
-                    </button>
-                </subviews>
-            </view>
-            <constraints>
-                <constraint firstItem="ixL-Zi-wt2" firstAttribute="bottom" secondItem="I8U-WJ-fdG" secondAttribute="bottom" id="1vT-fd-FEN"/>
-                <constraint firstAttribute="trailing" secondItem="I8U-WJ-fdG" secondAttribute="trailing" id="3zd-In-rM5"/>
-                <constraint firstItem="ixL-Zi-wt2" firstAttribute="trailing" secondItem="I8U-WJ-fdG" secondAttribute="trailing" id="4EJ-q9-PS7"/>
-                <constraint firstItem="Kgc-g3-AEn" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="8" id="7Ke-Tb-Rpg"/>
-                <constraint firstAttribute="trailing" secondItem="msM-QL-QnS" secondAttribute="trailing" id="NEd-F3-WCH"/>
-                <constraint firstItem="Kgc-g3-AEn" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="8" id="OrM-x5-Qsf"/>
-                <constraint firstAttribute="trailing" secondItem="tqc-xB-Z0v" secondAttribute="trailing" constant="4" id="Oy4-jf-HB0"/>
-                <constraint firstItem="tqc-xB-Z0v" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="4" id="Q2S-uN-QdS"/>
-                <constraint firstItem="ixL-Zi-wt2" firstAttribute="top" secondItem="I8U-WJ-fdG" secondAttribute="top" id="Roc-18-8B8"/>
-                <constraint firstItem="msM-QL-QnS" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="TFA-Z3-TRD"/>
-                <constraint firstItem="ixL-Zi-wt2" firstAttribute="leading" secondItem="I8U-WJ-fdG" secondAttribute="leading" id="VGf-I1-p0m"/>
-                <constraint firstItem="I8U-WJ-fdG" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="cAq-vH-WG9"/>
-                <constraint firstItem="msM-QL-QnS" firstAttribute="top" secondItem="I8U-WJ-fdG" secondAttribute="bottom" constant="8" id="fRv-7u-G0m"/>
-                <constraint firstItem="I8U-WJ-fdG" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="hgp-3Z-C5k"/>
-                <constraint firstAttribute="bottom" secondItem="msM-QL-QnS" secondAttribute="bottom" constant="4" id="ss3-Yh-FDX"/>
-            </constraints>
-            <viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/>
-            <size key="customSize" width="151" height="364"/>
-            <connections>
-                <outlet property="checkButton" destination="Kgc-g3-AEn" id="jFW-K0-VQu"/>
-                <outlet property="coverImageView" destination="I8U-WJ-fdG" id="ZdN-Kw-eL1"/>
-                <outlet property="priceLabel" destination="x8Q-wo-lht" id="Qun-VC-rfT"/>
-                <outlet property="stackViewWidth" destination="Nyo-43-JcQ" id="Pzy-pp-Q75"/>
-                <outlet property="titleLabel" destination="msM-QL-QnS" id="rfB-PD-HWq"/>
-                <outlet property="vipLabel" destination="3PK-dM-4Sq" id="xy6-mf-vpR"/>
-            </connections>
-            <point key="canvasLocation" x="-271.73913043478262" y="134.59821428571428"/>
-        </collectionViewCell>
-    </objects>
-    <resources>
-        <image name="corner_mask" width="9" height="9"/>
-        <image name="profile_ic_check_0" width="16" height="16"/>
-        <image name="profile_ic_check_1" width="16" height="16"/>
-    </resources>
-</document>

+ 10 - 9
SuperShow/UI/Profile/Collection/WSSProfileCollectionViewController.swift

@@ -13,16 +13,17 @@ private let kItemSpacing: CGFloat = 16
 
 class WSSProfileCollectionViewController: MTViewController {
     fileprivate lazy var collectionView: UICollectionView = {
-        let layout = UICollectionViewFlowLayout()
-        layout.minimumInteritemSpacing = kItemSpacing
-        layout.minimumLineSpacing = kItemSpacing
-        layout.itemSize = WSSProfileCollectionCell.kStaticSize
-        layout.sectionInset = UIEdgeInsets(top: 20, left: kItemSpacing, bottom: 20, right: kItemSpacing)
-        let collectionView: UICollectionView = UICollectionView(frame: self.view.bounds, collectionViewLayout: layout)
+        let flowLayout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
+        flowLayout.itemSize = WSSSearchResultCollectionCell.calculateItemSize()
+        flowLayout.minimumLineSpacing = 16.0
+        flowLayout.minimumInteritemSpacing = 16.0
+        flowLayout.sectionInset = UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0)
+        
+        let collectionView: UICollectionView = UICollectionView(frame: self.view.bounds, collectionViewLayout: flowLayout)
         collectionView.backgroundColor = UIColor.clear
         collectionView.delegate = self
         collectionView.dataSource = self
-        collectionView.ojs_registerCell(nib: WSSProfileCollectionCell.self)
+        collectionView.ojs_registerCell(class: WSSSearchResultCollectionCell.self)
 
         collectionView.mj_header = WSSRefreshHeader(refreshingBlock: { [weak self] in
             self?.timeline = 0
@@ -185,10 +186,10 @@ extension WSSProfileCollectionViewController: UICollectionViewDataSource {
     }
 
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
-        let cell = collectionView.ojs_dequeueReusableCell(withClass: WSSProfileCollectionCell.self, for: indexPath)
+        let cell = collectionView.ojs_dequeueReusableCell(withClass: WSSSearchResultCollectionCell.self, for: indexPath)
 
         if let model = dataArray.safeObject(atIndex: indexPath.item) {
-            cell.dataModel = model
+            cell.model = model
         }
         return cell
     }

+ 52 - 23
SuperShow/UI/Profile/Collection/WSSProfileMyTemplateViewController.swift

@@ -15,16 +15,17 @@ class WSSProfileMyTemplateViewController: MTViewController {
     fileprivate var mode: Bool = true // true-下载模板,false-已购模板
 
     fileprivate lazy var collectionView: UICollectionView = {
-        let layout = UICollectionViewFlowLayout()
-        layout.minimumInteritemSpacing = kItemSpacing
-        layout.minimumLineSpacing = kItemSpacing
-        layout.itemSize = WSSProfileCollectionCell.kStaticSize
-        layout.sectionInset = UIEdgeInsets(top: 20, left: kItemSpacing, bottom: 20, right: kItemSpacing)
-        let collectionView: UICollectionView = UICollectionView(frame: self.view.bounds, collectionViewLayout: layout)
+        let flowLayout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
+        flowLayout.itemSize = WSSSearchResultCollectionCell.calculateItemSize()
+        flowLayout.minimumLineSpacing = 16.0
+        flowLayout.minimumInteritemSpacing = 16.0
+        flowLayout.sectionInset = UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0)
+
+        let collectionView: UICollectionView = UICollectionView(frame: self.view.bounds, collectionViewLayout: flowLayout)
         collectionView.backgroundColor = UIColor.clear
         collectionView.delegate = self
         collectionView.dataSource = self
-        collectionView.ojs_registerCell(nib: WSSProfileCollectionCell.self)
+        collectionView.ojs_registerCell(class: WSSDownloadRecordCollectionViewCell.self)
 
         collectionView.mj_header = WSSRefreshHeader(refreshingBlock: { [weak self] in
             self?.timeline = 0
@@ -51,6 +52,7 @@ class WSSProfileMyTemplateViewController: MTViewController {
 
     fileprivate var dataArray = [WSSCommonTemplateModel]()
     fileprivate var timeline: Int64 = 0
+    fileprivate var isEditingMode: Bool = false
 
     convenience init() {
         self.init(nibName: nil, bundle: nil)
@@ -106,46 +108,57 @@ private extension WSSProfileMyTemplateViewController {
     }
 
     func setupNavigationBar() {
+        if mode == false {
+            // 已购模板
+            setupOnlyBackNavigationBar()
+            return
+        }
+
         ojs_navBarView?.leftOneButton.contentHorizontalAlignment = .left
         ojs_navBarView?.rightOneButton.contentHorizontalAlignment = .right
 
         ojs_navBarView?.leftOneButton.width = 50.0
         ojs_navBarView?.leftOneButton.left = OJAStyle.LRCommonMargin
+        ojs_navBarView?.leftOneButton.titleLabel?.font = OJAFont.font16
+        ojs_navBarView?.leftOneButton.setTitleColor(OJAStyle.mainColor, for: .normal)
 
+        ojs_navBarView?.rightOneButton.titleLabel?.font = OJAFont.font16
         ojs_navBarView?.rightOneButton.width = 50.0
         ojs_navBarView?.rightOneButton.right = kOJSScreenWidth - OJAStyle.LRCommonMargin
+        ojs_navBarView?.rightOneButton.setTitleColor(OJAStyle.mainColor, for: .normal)
 
         switchNavigationBarMode(false)
     }
 
     func switchNavigationBarMode(_ mode: Bool) {
+        ojs_navBarView?.viewType = .type1_1
+
         if mode {
             // 编辑状态
-            ojs_navBarView?.viewType = .type1_1
-
-            ojs_navBarView?.leftOneButton.titleLabel?.font = OJAFont.font16
             ojs_navBarView?.leftOneButton.setTitle("全选", for: .normal)
             ojs_navBarView?.leftOneButton.setImage(nil, for: .normal)
-            ojs_navBarView?.leftOneButton.setTitleColor(OJAStyle.mainColor, for: .normal)
             ojs_navBarView?.leftOneButton.addCallback({ [weak self] _ in
                 self?.checkAllItem(true)
             })
 
-            ojs_navBarView?.rightOneButton.titleLabel?.font = OJAFont.font16
             ojs_navBarView?.rightOneButton.setTitle("完成", for: .normal)
-            ojs_navBarView?.rightOneButton.setTitleColor(OJAStyle.mainColor, for: .normal)
             ojs_navBarView?.rightOneButton.addCallback({ [weak self] _ in
+                self?.enterEditing(false)
                 self?.checkAllItem(false)
             })
 
         } else {
             // 普通状态
-            ojs_navBarView?.viewType = .type1_0
             ojs_navBarView?.leftOneButton.setImage(R.image.nav_back(), for: UIControl.State.normal)
             ojs_navBarView?.leftOneButton.setTitle(nil, for: .normal)
             ojs_navBarView?.leftOneButton.addCallback { [unowned self] _ in
                 self.exitPage()
             }
+
+            ojs_navBarView?.rightOneButton.setTitle("管理", for: .normal)
+            ojs_navBarView?.rightOneButton.addCallback({ [weak self] _ in
+                self?.enterEditing(true)
+            })
         }
 
         bringOJSNavBarViewToFront()
@@ -198,6 +211,10 @@ private extension WSSProfileMyTemplateViewController {
                 }
                 self.timeline = listModel.timeline
                 self.collectionView.reloadData()
+
+                if self.dataArray.count == 0 && self.isEditingMode == true {
+                    self.switchNavigationBarMode(false)
+                }
             }
 
             if self.dataArray.count > 0 {
@@ -216,6 +233,16 @@ private extension WSSProfileMyTemplateViewController {
         })
     }
 
+    func enterEditing(_ flag: Bool) {
+        isEditingMode = flag
+
+        switchNavigationBarMode(flag)
+        if flag {
+            collectionView.reloadData()
+            refreshSelectedInfo()
+        }
+    }
+
     func checkAllItem(_ flag: Bool) {
         dataArray.forEach({ $0.selected = flag })
 
@@ -228,8 +255,6 @@ private extension WSSProfileMyTemplateViewController {
 
         bottomActionView.changeCount(selectedModels.count)
         bottomActionView.isHidden = selectedModels.count == 0
-
-        switchNavigationBarMode(selectedModels.count > 0)
     }
 
     func deleteRecord() {
@@ -237,14 +262,18 @@ private extension WSSProfileMyTemplateViewController {
         if selectedModels.count > 0 {
             let ids = selectedModels.map({ $0.templateId })
 
+            WSSHub.showHub("请稍后...")
             OJARequest<WSSAPITemplateRequest, OJABaseResponseBean>.sendRequest(.deleteDownloadRecord(templateIds: ids, isAll: false), callback: { _, _, err in
-                if err == nil {
-                    self.timeline = 0
-                    self.loadNetworkData()
+                WSSHub.dismissHub()
 
+                showHud(withOnlyText: "删除成功")
+
+                if err == nil {
                     self.bottomActionView.changeCount(0)
                     self.bottomActionView.isHidden = true
-                    self.switchNavigationBarMode(false)
+
+                    self.timeline = 0
+                    self.loadNetworkData()
 
                     WSSUserTool.shared.refreshUserInfo {
                         //
@@ -263,18 +292,18 @@ extension WSSProfileMyTemplateViewController: UICollectionViewDataSource {
     }
 
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
-        let cell = collectionView.ojs_dequeueReusableCell(withClass: WSSProfileCollectionCell.self, for: indexPath)
+        let cell = collectionView.ojs_dequeueReusableCell(withClass: WSSDownloadRecordCollectionViewCell.self, for: indexPath)
 
         if mode == true {
             // 下载模板模式,只有在下载模板列表可以勾选
-            cell.isShowCheck = true
+            cell.isShowCheck = isEditingMode
             cell.checkEventHandle = { [weak self] in
                 self?.refreshSelectedInfo()
             }
         }
 
         if let model = dataArray.safeObject(atIndex: indexPath.item) {
-            cell.dataModel = model
+            cell.model = model
         }
 
         return cell

+ 62 - 80
SuperShow/UI/Template/Views/WSSTemplateCollectionCell.swift

@@ -19,54 +19,13 @@ class WSSTemplateCollectionCell: WSSBaseCollectionCell {
                 coverImageView.ojs_setImage(withUrl: m.cover, placeholder: R.image.home_template_cover_placeholder())
                 nameLabel.text = m.name
 
-                priceTagLabel.backgroundColor = OJSColor(hexRGBValue: 0x501EFF)
-                // feeType 如果是buy,则可VIP、单独购买;如果是feeType为vip,则只能是VIP
-                switch m.feeType {
-                case .free:
-                    // 免费
-                    vipTagLabel.isHidden = true
-                    priceTagLabel.isHidden = true
-
-                case .buy:
-                    // 购买
-                    vipTagLabel.isHidden = false
-                    if m.price > 0 {
-                        priceTagLabel.isHidden = false
-                        let priceStr = String.covertPrice(m.price)
-                        priceTagLabel.text = priceStr
-
-                    } else {
-                        priceTagLabel.isHidden = true
-                        priceTagLabel.text = ""
-                    }
-
-                case .vip:
-                    // VIP
-                    vipTagLabel.isHidden = false
-                    priceTagLabel.isHidden = true
-
-                case .limitFree:
-                    vipTagLabel.isHidden = true
-                    priceTagLabel.isHidden = false
-                    let priceStr = "限免"
-                    priceTagLabel.text = priceStr
-                    priceTagLabel.backgroundColor = OJSColor(hexRGBValue: 0x3388FF)
-                }
-
-                var stackWidth: CGFloat = 0.0
-                if !vipTagLabel.isHidden {
-                    stackWidth += kTagWidth
-                }
-                if !priceTagLabel.isHidden {
-                    stackWidth += kTagWidth
-                }
-                if !vipTagLabel.isHidden && !priceTagLabel.isHidden {
-                    stackWidth += kTagSpace
-                }
-                stackView.snp.updateConstraints { make in
-                    make.width.equalTo(stackWidth)
-                }
+                self.tagView.setupFeeType(m.feeType, price: m.price)
+
+                self.durationLabel.text = String(format: "%.fs", m.duration)
+                self.fragmentCountLabel.text = String(format: "%d个片段", m.fragment)
             }
+
+            self.modelDidChange()
         }
     }
 
@@ -96,6 +55,10 @@ class WSSTemplateCollectionCell: WSSBaseCollectionCell {
         return WSSTemplateCollectionCell.templateCoverHeight()
     }
 
+    func modelDidChange() {
+        //
+    }
+
     // MARK: - private
 
     private let kTagHeight: CGFloat = 16.0
@@ -118,42 +81,30 @@ class WSSTemplateCollectionCell: WSSBaseCollectionCell {
         return label
     }()
 
-    private lazy var priceTagLabel: UILabel = {
-        let label: UILabel = UILabel()
-        label.bounds = CGRect(x: 0, y: 0, width: self.kTagWidth, height: self.kTagHeight)
-        label.text = "¥0.00"
-        label.font = OJAFont.font9
-        label.textColor = OJATextColor.colorWhite
-        label.textAlignment = .center
-        label.backgroundColor = OJSColor(hexRGBValue: 0x501EFF)
-        label.layer.cornerRadius = self.kTagHeight * 0.5
-        label.clipsToBounds = true
-
-        return label
+    private lazy var tagView: WSSTemplateTagView = {
+        let tagView: WSSTemplateTagView = WSSTemplateTagView.ojs_loadFromNib()
+        return tagView
     }()
 
-    private lazy var vipTagLabel: UILabel = {
-        let label: UILabel = UILabel()
-        label.bounds = CGRect(x: 0, y: 0, width: self.kTagWidth, height: self.kTagHeight)
-        label.text = "VIP"
-        label.font = OJAFont.font9
-        label.textColor = OJATextColor.colorWhite
-        label.textAlignment = .center
-        label.backgroundColor = OJSColor(hexRGBValue: 0xFF1E50)
-        label.layer.cornerRadius = self.kTagHeight * 0.5
-        label.clipsToBounds = true
+    private var durationLabel: UILabel = {
+        let label: UILabel = UILabel(frame: CGRect(x: 0, y: 0, width: 22, height: 20.0))
+        label.textColor = OJAStyle.whiteColor
+        label.font = OJAFont.font10
+        label.textAlignment = .right
+        label.text = "--"
 
         return label
     }()
 
-    private lazy var stackView: UIStackView = {
-        let stackView: UIStackView = UIStackView(arrangedSubviews: [self.vipTagLabel, self.priceTagLabel])
-        stackView.axis = .horizontal
-        stackView.alignment = .fill
-        stackView.distribution = .fillEqually
-        stackView.spacing = self.kTagSpace
-
-        return stackView
+    private var fragmentCountLabel: UILabel = {
+        let label: UILabel = UILabel(frame: CGRect(x: 0, y: 0, width: 41, height: 20.0))
+        label.textColor = OJATextColor.colorC
+        label.font = OJAFont.font9
+        label.textAlignment = .left
+        label.text = "--"
+        label.adjustsFontSizeToFitWidth = true
+        label.minimumScaleFactor = 0.5
+        return label
     }()
 
     override init(frame: CGRect) {
@@ -186,12 +137,43 @@ class WSSTemplateCollectionCell: WSSBaseCollectionCell {
             make.top.equalTo(self.coverImageView.snp.bottom).offset(8.0)
         }
 
-        contentView.addSubview(stackView)
-        stackView.snp.makeConstraints { make in
+        contentView.addSubview(tagView)
+        tagView.snp.makeConstraints { make in
+            make.left.equalTo(coverImageView.snp.left).offset(4.0)
             make.right.equalTo(coverImageView.snp.right).offset(-4.0)
             make.top.equalTo(coverImageView.snp.top).offset(4.0)
             make.height.equalTo(self.kTagHeight)
-            make.width.equalTo(self.kTagWidth * 2.0 + self.kTagSpace)
         }
+
+        // 时间+片段
+        let infoH: CGFloat = 20.0
+        let infoW: CGFloat = 80.0
+        let infoContainer: WSSGradientView = WSSGradientView(frame: CGRect(x: 0, y: 0, width: infoW, height: infoH))
+        infoContainer.gradientStartColor = OJSColor(r: 0, g: 0, b: 0, a: 0.6)
+        infoContainer.gradientEndColor = OJSColor(r: 0, g: 0, b: 0, a: 0.6)
+        infoContainer.showCorner = true
+        infoContainer.cornerRadius = infoH * 0.5
+        contentView.addSubview(infoContainer)
+        infoContainer.snp.makeConstraints { make in
+            make.left.equalTo(coverImageView.snp.left).offset(4.0)
+            make.bottom.equalTo(coverImageView.snp.bottom).offset(-4.0)
+            make.size.equalTo(CGSize(width: infoW, height: infoH))
+        }
+
+        durationLabel.left = 2.0
+        durationLabel.height = infoH
+        infoContainer.addSubview(durationLabel)
+
+        let dotLabel: UILabel = UILabel()
+        dotLabel.frame = CGRect(origin: CGPoint(x: durationLabel.right, y: 0), size: CGSize(width: 10.0, height: infoH))
+        dotLabel.text = "·"
+        dotLabel.textAlignment = .center
+        dotLabel.textColor = OJATextColor.color9
+        dotLabel.font = OJAFont.font16
+        infoContainer.addSubview(dotLabel)
+
+        fragmentCountLabel.left = dotLabel.right
+        fragmentCountLabel.height = infoH
+        infoContainer.addSubview(fragmentCountLabel)
     }
 }

+ 61 - 0
SuperShow/UI/Template/Views/WSSTemplateTagView.swift

@@ -0,0 +1,61 @@
+//
+//  WSSTemplateTagView.swift
+//  SuperShow
+//
+//  Created by zhongbaojian on 2019/11/22.
+//  Copyright © 2019 duowan. All rights reserved.
+//
+
+import UIKit
+
+class WSSTemplateTagView: UIView {
+    // MARK: - Public
+
+    override class func awakeFromNib() {
+        super.awakeFromNib()
+    }
+
+    func setupFeeType(_ feeType: WSSTemplateFeeType, price: Int64) {
+        // feeType 如果是buy,则可VIP、单独购买;如果是feeType为vip,则只能是VIP
+        switch feeType {
+        case .free:
+            // 免费
+            vipTagImageView.isHidden = true
+            priceTagView.isHidden = true
+            exemptionTagView.isHidden = true
+
+        case .buy:
+            // 购买
+            vipTagImageView.isHidden = false
+            if price > 0 {
+                priceTagView.isHidden = false
+                priceTagLabel.text = String.covertPrice(price)
+            } else {
+                priceTagView.isHidden = true
+                priceTagLabel.text = ""
+            }
+            exemptionTagView.isHidden = true
+
+        case .vip:
+            // VIP
+            vipTagImageView.isHidden = false
+            priceTagView.isHidden = true
+            exemptionTagView.isHidden = true
+
+        case .limitFree:
+            vipTagImageView.isHidden = true
+            priceTagView.isHidden = true
+            exemptionTagView.isHidden = false
+        }
+    }
+
+    // MARK: - Private
+
+    @IBOutlet weak var vipTagImageView: UIImageView!
+
+    @IBOutlet weak var priceTagView: WSSCornerGradientView!
+    @IBOutlet weak var priceTagLabel: UILabel!
+
+    @IBOutlet weak var exemptionTagView: WSSCornerGradientView!
+    @IBOutlet weak var exemptionTagLabel: UILabel!
+}

+ 124 - 0
SuperShow/UI/Template/Views/WSSTemplateTagView.xib

@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina6_1" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15509"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="WSSTemplateTagView" customModule="SuperShow" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="414" height="60"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="auc-RD-YjH">
+                    <rect key="frame" x="288.5" y="22" width="125.5" height="16"/>
+                    <subviews>
+                        <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="home_ic_vip" translatesAutoresizingMaskIntoConstraints="NO" id="p8V-zZ-IJd">
+                            <rect key="frame" x="0.0" y="0.0" width="41.5" height="16"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="41.5" id="MTP-HT-eXj"/>
+                            </constraints>
+                        </imageView>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2Lp-sz-dOJ" customClass="WSSCornerGradientView" customModule="SuperShow" customModuleProvider="target">
+                            <rect key="frame" x="49.5" y="0.0" width="35" height="16"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="--" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="ADv-z3-ZKZ">
+                                    <rect key="frame" x="0.0" y="0.0" width="35" height="16"/>
+                                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="11"/>
+                                    <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
+                            <constraints>
+                                <constraint firstItem="ADv-z3-ZKZ" firstAttribute="top" secondItem="2Lp-sz-dOJ" secondAttribute="top" id="BdR-hm-Etd"/>
+                                <constraint firstItem="ADv-z3-ZKZ" firstAttribute="leading" secondItem="2Lp-sz-dOJ" secondAttribute="leading" id="KvK-ZG-baN"/>
+                                <constraint firstAttribute="width" constant="35" id="eKy-6e-Zsl"/>
+                                <constraint firstAttribute="trailing" secondItem="ADv-z3-ZKZ" secondAttribute="trailing" id="g5i-Co-Yb3"/>
+                                <constraint firstAttribute="bottom" secondItem="ADv-z3-ZKZ" secondAttribute="bottom" id="oXI-uc-GHL"/>
+                            </constraints>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="gradientStartColor">
+                                    <color key="value" red="1" green="0.4549019608" blue="0.090196078430000007" alpha="1" colorSpace="calibratedRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="color" keyPath="gradientEndColor">
+                                    <color key="value" red="0.92941176469999998" green="0.71764705880000002" blue="0.22352941179999999" alpha="1" colorSpace="calibratedRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="8"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="boolean" keyPath="showTopLeftCorner" value="YES"/>
+                                <userDefinedRuntimeAttribute type="boolean" keyPath="showTopRightCorner" value="YES"/>
+                                <userDefinedRuntimeAttribute type="boolean" keyPath="showBottomLeftCorner" value="YES"/>
+                                <userDefinedRuntimeAttribute type="boolean" keyPath="showBottomRightCorner" value="YES"/>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HBw-4M-XtY" customClass="WSSCornerGradientView" customModule="SuperShow" customModuleProvider="target">
+                            <rect key="frame" x="92.5" y="0.0" width="33" height="16"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="限免" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="mqf-0w-KPL">
+                                    <rect key="frame" x="0.0" y="0.0" width="33" height="16"/>
+                                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="10"/>
+                                    <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
+                            <constraints>
+                                <constraint firstItem="mqf-0w-KPL" firstAttribute="top" secondItem="HBw-4M-XtY" secondAttribute="top" id="7Lj-E6-uAO"/>
+                                <constraint firstAttribute="trailing" secondItem="mqf-0w-KPL" secondAttribute="trailing" id="9Yf-xj-3Ib"/>
+                                <constraint firstAttribute="width" constant="33" id="nBN-7b-jGL"/>
+                                <constraint firstAttribute="bottom" secondItem="mqf-0w-KPL" secondAttribute="bottom" id="tEr-oB-fXn"/>
+                                <constraint firstItem="mqf-0w-KPL" firstAttribute="leading" secondItem="HBw-4M-XtY" secondAttribute="leading" id="wpW-yt-6Xh"/>
+                            </constraints>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="color" keyPath="gradientStartColor">
+                                    <color key="value" red="0.4549019608" green="0.24313725489999999" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="color" keyPath="gradientEndColor">
+                                    <color key="value" red="0.32156862749999998" green="0.70588235290000001" blue="0.94509803920000002" alpha="1" colorSpace="calibratedRGB"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="8"/>
+                                </userDefinedRuntimeAttribute>
+                                <userDefinedRuntimeAttribute type="boolean" keyPath="showTopLeftCorner" value="YES"/>
+                                <userDefinedRuntimeAttribute type="boolean" keyPath="showTopRightCorner" value="YES"/>
+                                <userDefinedRuntimeAttribute type="boolean" keyPath="showBottomLeftCorner" value="YES"/>
+                                <userDefinedRuntimeAttribute type="boolean" keyPath="showBottomRightCorner" value="YES"/>
+                            </userDefinedRuntimeAttributes>
+                        </view>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="16" id="yz3-CM-HWt"/>
+                    </constraints>
+                </stackView>
+            </subviews>
+            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+            <constraints>
+                <constraint firstItem="auc-RD-YjH" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="0Y0-Ph-ZRp"/>
+                <constraint firstAttribute="trailing" secondItem="auc-RD-YjH" secondAttribute="trailing" id="dp1-r0-e9F"/>
+            </constraints>
+            <nil key="simulatedTopBarMetrics"/>
+            <nil key="simulatedBottomBarMetrics"/>
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+            <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
+            <connections>
+                <outlet property="exemptionTagLabel" destination="mqf-0w-KPL" id="0W3-ok-5s5"/>
+                <outlet property="exemptionTagView" destination="HBw-4M-XtY" id="XUH-Me-nBX"/>
+                <outlet property="priceTagLabel" destination="ADv-z3-ZKZ" id="rdZ-9I-taC"/>
+                <outlet property="priceTagView" destination="2Lp-sz-dOJ" id="UJE-lp-tOA"/>
+                <outlet property="vipTagImageView" destination="p8V-zZ-IJd" id="Pan-rD-sf9"/>
+            </connections>
+            <point key="canvasLocation" x="66.666666666666671" y="72.991071428571431"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="home_ic_vip" width="41.5" height="16"/>
+    </resources>
+</document>