Przeglądaj źródła

所有模板相关列表的标签UI修改

zhongbaojian 5 lat temu
rodzic
commit
c5934b0d75

+ 4 - 8
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 */; };
@@ -508,6 +506,7 @@
 		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 */; };
@@ -587,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>"; };
@@ -1329,6 +1326,7 @@
 		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>"; };
@@ -1923,8 +1921,7 @@
 		43929DC02254E6A200958E18 /* Collection */ = {
 			isa = PBXGroup;
 			children = (
-				4364B452225AE6EB004A6869 /* WSSProfileCollectionCell.swift */,
-				4364B453225AE6EB004A6869 /* WSSProfileCollectionCell.xib */,
+				A8F68A3F2387C0DF005ABB8B /* WSSDownloadRecordCollectionViewCell.swift */,
 				43929DC12254E6B800958E18 /* WSSProfileCollectionViewController.swift */,
 				4364B46E225B2E68004A6869 /* WSSProfileMyTemplateViewController.swift */,
 			);
@@ -3194,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 */,
@@ -3499,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 */,
@@ -3566,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 */,

+ 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
     }

+ 12 - 11
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
@@ -210,8 +211,8 @@ private extension WSSProfileMyTemplateViewController {
                 }
                 self.timeline = listModel.timeline
                 self.collectionView.reloadData()
-                
-                if self.dataArray.count == 0 && self.isEditingMode == true{
+
+                if self.dataArray.count == 0 && self.isEditingMode == true {
                     self.switchNavigationBarMode(false)
                 }
             }
@@ -291,7 +292,7 @@ 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 {
             // 下载模板模式,只有在下载模板列表可以勾选
@@ -302,7 +303,7 @@ extension WSSProfileMyTemplateViewController: UICollectionViewDataSource {
         }
 
         if let model = dataArray.safeObject(atIndex: indexPath.item) {
-            cell.dataModel = model
+            cell.model = model
         }
 
         return cell

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

@@ -25,7 +25,12 @@ class WSSTemplateCollectionCell: WSSBaseCollectionCell {
                 nameLabel.text = m.name
 
                 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()
         }
     }
 
@@ -55,6 +60,10 @@ class WSSTemplateCollectionCell: WSSBaseCollectionCell {
         return WSSTemplateCollectionCell.templateCoverHeight()
     }
 
+    func modelDidChange() {
+        //
+    }
+
     // MARK: - private
 
     private let kTagHeight: CGFloat = 16.0
@@ -82,6 +91,27 @@ class WSSTemplateCollectionCell: WSSBaseCollectionCell {
         return tagView
     }()
 
+    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 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) {
         super.init(frame: frame)
     }
@@ -119,5 +149,36 @@ class WSSTemplateCollectionCell: WSSBaseCollectionCell {
             make.top.equalTo(coverImageView.snp.top).offset(4.0)
             make.height.equalTo(self.kTagHeight)
         }
+
+        // 时间+片段
+        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)
     }
 }