|
@@ -12,6 +12,7 @@ import UIKit
|
|
class MVBannerCell: UICollectionViewCell {
|
|
class MVBannerCell: UICollectionViewCell {
|
|
// 做同款
|
|
// 做同款
|
|
var reCreateBtnClicHandle: ((_ sender: UIButton, _ videoInfo: PQVideoListModel?) -> Void)?
|
|
var reCreateBtnClicHandle: ((_ sender: UIButton, _ videoInfo: PQVideoListModel?) -> Void)?
|
|
|
|
+ var sharedBtnClicHandle: ((_ type:Int) -> Void)?
|
|
let musicWidth: CGFloat = (9.0 / 16.0 * (cScreenHeigth - (cDevice_iPhoneStatusBarHei + 45 + 60 + (cDefaultMargin * 2 + cSafeAreaHeight) + cDefaultMargin * 3 + 15))) - 15 - (16 + cDefaultMargin) * 2 - (10 + 106 + 10)
|
|
let musicWidth: CGFloat = (9.0 / 16.0 * (cScreenHeigth - (cDevice_iPhoneStatusBarHei + 45 + 60 + (cDefaultMargin * 2 + cSafeAreaHeight) + cDefaultMargin * 3 + 15))) - 15 - (16 + cDefaultMargin) * 2 - (10 + 106 + 10)
|
|
// 封面
|
|
// 封面
|
|
lazy var converView: UIImageView = {
|
|
lazy var converView: UIImageView = {
|
|
@@ -121,7 +122,37 @@ class MVBannerCell: UICollectionViewCell {
|
|
typeLab.textColor = UIColor.white
|
|
typeLab.textColor = UIColor.white
|
|
return typeLab
|
|
return typeLab
|
|
}()
|
|
}()
|
|
|
|
+
|
|
|
|
+ lazy var usageAmountL:MVBannerUsageView = {
|
|
|
|
+ let v = MVBannerUsageView()
|
|
|
|
+ return v
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ lazy var friendIV:UIButton = {
|
|
|
|
+// let iv = UIImageView(image: UIImage(named: "b_pyq"))
|
|
|
|
+ let iv = UIButton(type: .custom)
|
|
|
|
+ iv.setImage(UIImage(named: "b_pyq"), for: .normal)
|
|
|
|
+ iv.tag = 2201
|
|
|
|
+ iv.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
|
|
|
|
+ // iv.layer.backgroundColor = UIColor.black.cgColor
|
|
|
|
+// iv.layer.cornerRadius = 22
|
|
|
|
+// iv.alpha = 0.3
|
|
|
|
+ return iv
|
|
|
|
+ }()
|
|
|
|
|
|
|
|
+ lazy var wxIV:UIButton = {
|
|
|
|
+// let iv = UIImageView(image: UIImage(named: "b_wx"))
|
|
|
|
+ let iv = UIButton(type: .custom)
|
|
|
|
+ iv.setImage(UIImage(named: "b_wx"), for: .normal)
|
|
|
|
+ iv.tag = 2202
|
|
|
|
+ iv.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
|
|
|
|
+// iv.layer.backgroundColor = UIColor.black.cgColor
|
|
|
|
+// iv.layer.cornerRadius = 22
|
|
|
|
+// iv.alpha = 0.3
|
|
|
|
+ return iv
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+
|
|
override func prepareForReuse() {
|
|
override func prepareForReuse() {
|
|
musicNameLab.stop()
|
|
musicNameLab.stop()
|
|
}
|
|
}
|
|
@@ -145,11 +176,14 @@ class MVBannerCell: UICollectionViewCell {
|
|
contentView.addSubview(bottmMaskView)
|
|
contentView.addSubview(bottmMaskView)
|
|
contentView.addSubview(pauseView)
|
|
contentView.addSubview(pauseView)
|
|
bottmMaskView.addSubview(progressView)
|
|
bottmMaskView.addSubview(progressView)
|
|
- bottmMaskView.addSubview(typeImage)
|
|
|
|
|
|
+// bottmMaskView.addSubview(typeImage)
|
|
|
|
+// bottmMaskView.addSubview(typeLab)
|
|
bottmMaskView.addSubview(titleLabel)
|
|
bottmMaskView.addSubview(titleLabel)
|
|
|
|
+ bottmMaskView.addSubview(usageAmountL)
|
|
|
|
+ bottmMaskView.addSubview(friendIV)
|
|
|
|
+ bottmMaskView.addSubview(wxIV)
|
|
|
|
+
|
|
|
|
|
|
-
|
|
|
|
- bottmMaskView.addSubview(typeLab)
|
|
|
|
bottmMaskView.addSubview(reCreateBtn)
|
|
bottmMaskView.addSubview(reCreateBtn)
|
|
bottmMaskView.addSubview(musicContenView)
|
|
bottmMaskView.addSubview(musicContenView)
|
|
musicContenView.addSubview(musicBgView)
|
|
musicContenView.addSubview(musicBgView)
|
|
@@ -176,11 +210,13 @@ class MVBannerCell: UICollectionViewCell {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- if videoData?.categoryImage != nil {
|
|
|
|
- typeImage.setNetImage(url: "\(videoData?.categoryImage ?? "")", placeholder: UIImage(named: "categary_icon")!)
|
|
|
|
- } else {
|
|
|
|
- typeImage.image = UIImage(named: "categary_icon")
|
|
|
|
- }
|
|
|
|
|
|
+// if videoData?.categoryImage != nil {
|
|
|
|
+// typeImage.setNetImage(url: "\(videoData?.categoryImage ?? "")", placeholder: UIImage(named: "categary_icon")!)
|
|
|
|
+// } else {
|
|
|
|
+// typeImage.image = UIImage(named: "categary_icon")
|
|
|
|
+// }
|
|
|
|
+ usageAmountL.amount = videoData?.reCreateVideoData?.reProduceCount ?? 0
|
|
|
|
+
|
|
let coverImg = (videoData?.videoCoverSnapshotPath != nil && (videoData?.videoCoverSnapshotPath?.count ?? 0) > 0) ? videoData?.videoCoverSnapshotPath ?? "" : (videoData?.coverImg?["coverImgPath"] as? String ?? "")
|
|
let coverImg = (videoData?.videoCoverSnapshotPath != nil && (videoData?.videoCoverSnapshotPath?.count ?? 0) > 0) ? videoData?.videoCoverSnapshotPath ?? "" : (videoData?.coverImg?["coverImgPath"] as? String ?? "")
|
|
BFLog(message: "coverImg url is \(coverImg)")
|
|
BFLog(message: "coverImg url is \(coverImg)")
|
|
netImage(url: coverImg, mainView: converView)
|
|
netImage(url: coverImg, mainView: converView)
|
|
@@ -255,29 +291,52 @@ class MVBannerCell: UICollectionViewCell {
|
|
make.right.top.height.equalToSuperview()
|
|
make.right.top.height.equalToSuperview()
|
|
}
|
|
}
|
|
|
|
|
|
- if(videoData?.title?.count ?? 0 > 0){
|
|
|
|
- typeImage.snp.remakeConstraints { make in
|
|
|
|
- make.left.equalTo(musicContenView.snp_left)
|
|
|
|
- make.height.width.equalTo(18)
|
|
|
|
- make.bottom.equalTo(titleLabel.snp_top).offset(-8)
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- typeImage.snp.remakeConstraints { make in
|
|
|
|
- make.left.equalTo(musicContenView.snp_left)
|
|
|
|
- make.height.width.equalTo(18)
|
|
|
|
- make.bottom.equalTo(musicContenView.snp_top).offset(-cDefaultMargin)
|
|
|
|
- }
|
|
|
|
|
|
+// if(videoData?.title?.count ?? 0 > 0){
|
|
|
|
+// typeImage.snp.remakeConstraints { make in
|
|
|
|
+// make.left.equalTo(musicContenView.snp_left)
|
|
|
|
+// make.height.width.equalTo(18)
|
|
|
|
+// make.bottom.equalTo(titleLabel.snp_top).offset(-8)
|
|
|
|
+// }
|
|
|
|
+// }else{
|
|
|
|
+// typeImage.snp.remakeConstraints { make in
|
|
|
|
+// make.left.equalTo(musicContenView.snp_left)
|
|
|
|
+// make.height.width.equalTo(18)
|
|
|
|
+// make.bottom.equalTo(musicContenView.snp_top).offset(-cDefaultMargin)
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// typeLab.snp.remakeConstraints { make in
|
|
|
|
+// make.left.equalTo(typeImage.snp_right).offset(5)
|
|
|
|
+// make.centerY.equalTo(typeImage)
|
|
|
|
+// make.right.equalTo(musicContenView)
|
|
|
|
+// }
|
|
|
|
+ wxIV.snp.makeConstraints { make in
|
|
|
|
+ make.right.equalTo(-12)
|
|
|
|
+ make.bottom.equalTo(titleLabel.snp_top).offset(-9)
|
|
|
|
+ make.width.height.equalTo(44)
|
|
}
|
|
}
|
|
-
|
|
|
|
- typeLab.snp.remakeConstraints { make in
|
|
|
|
- make.left.equalTo(typeImage.snp_right).offset(5)
|
|
|
|
- make.centerY.equalTo(typeImage)
|
|
|
|
- make.right.equalTo(musicContenView)
|
|
|
|
|
|
+ friendIV.snp.makeConstraints { make in
|
|
|
|
+ make.right.equalTo(wxIV.snp_left).offset(-8)
|
|
|
|
+ make.width.height.bottom.equalTo(wxIV)
|
|
|
|
+ }
|
|
|
|
+ usageAmountL.snp.remakeConstraints { make in
|
|
|
|
+ make.left.equalTo(12)
|
|
|
|
+ make.height.equalTo(26)
|
|
|
|
+ make.bottom.equalTo(titleLabel.snp_top).offset(-13)
|
|
|
|
+ make.right.lessThanOrEqualTo(friendIV.snp_left).offset(-8)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@objc func btnClick(sender: UIButton) {
|
|
@objc func btnClick(sender: UIButton) {
|
|
- if reCreateBtnClicHandle != nil {
|
|
|
|
|
|
+ if sender.tag == 2201 {
|
|
|
|
+ // 分享朋友圈
|
|
|
|
+// cShowHUB(superView: nil, msg: "分享朋友圈")
|
|
|
|
+ sharedBtnClicHandle?(1)
|
|
|
|
+ }else if sender.tag == 2202 {
|
|
|
|
+ // 分享给微信好友
|
|
|
|
+// cShowHUB(superView: nil, msg: "分享微信好友")
|
|
|
|
+ sharedBtnClicHandle?(2)
|
|
|
|
+ }else if reCreateBtnClicHandle != nil {
|
|
reCreateBtnClicHandle!(sender, videoData)
|
|
reCreateBtnClicHandle!(sender, videoData)
|
|
}
|
|
}
|
|
}
|
|
}
|