CNLiveShopDetailBtnsCell.swift
3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//
// CNLiveShopDetailBtnsCell.swift
// metaCode
//
// Created by zx on 2023/11/3.
//
import Foundation
class CNLiveShopDetailBtnsCell: UICollectionViewCell {
//shopDetailModel
var _shopDetailModel : CNLiveShopDetailModel?
var shopDetailModel : CNLiveShopDetailModel? {
get{
_shopDetailModel
}
set{
_shopDetailModel = newValue!
}
}
override init(frame: CGRect) {
super.init(frame: frame)
self.backgroundColor = .clear
self.setUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUI(){
self.backgroundColor = .white
var titlesArr:Array<String> = []
if DSUserInfoManager.shared.dsUserInfo.type != "3" {
titlesArr = [ "商品管理", "订单管理", "交易记录"]
// titlesArr = ["发布动态", "商品管理", "订单管理", "交易记录"]
}else{
//健康餐桌 不处理
}
//替换icon
let icons = ["DS_WB_SPGL", "DS_WB_DDGL", "DS_WB_JYJL"]
// let icons = ["ds_Up_Btn", "ds_Up_Btn", "ds_Up_Btn", "ds_Up_Btn"]
if titlesArr.count > 0 {
for i in 0..<titlesArr.count {
let titleStr = titlesArr[i]
let iconStr = icons[i]
//icon
let imgWH = 45
let imgGap = (Int(KSreenWidth)-4*imgWH)/5
let iconBtn = UIButton(type: .custom)
iconBtn.frame = CGRect(x: imgGap*(i+1)+imgWH*i, y: 10, width: imgWH, height: imgWH)
iconBtn.setBackgroundImage(UIImage(named: iconStr), for: .normal)
iconBtn.addTarget(self, action: #selector(iconBtnAction(_:)), for: .touchUpInside)
iconBtn.tag = i+100
iconBtn.layer.cornerRadius = 11.5
self.contentView.addSubview(iconBtn)
let titleLbl = UILabel(frame: CGRect(x: iconBtn.left-5, y: iconBtn.bottom+5, width: iconBtn.width+10, height: 17))
titleLbl.text = titleStr
titleLbl.textAlignment = .center
titleLbl.font = Font_12
titleLbl.textColor = HexColor("#4A4A4A")
self.contentView.addSubview(titleLbl)
}
}
}
@objc func iconBtnAction(_ sender: UIButton){
let tag = sender.tag
///push VC
if tag == 100 {
//商品管理
navigationViewController().pushViewController(CNLiveShopProductManagerController.init(), animated: pushAnimated)
// currentViewController()?.navigationController?.pushViewController(CNLiveShopProductManagerController.init(), animated: pushAnimated)
}else if tag == 101 {
//订单管理
navigationViewController().pushViewController(CNLiveShopOrderViewController.init(), animated: pushAnimated)
// currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: pushAnimated)
}else if tag == 102 {
//交易记录
navigationViewController().pushViewController(CNLiveShopTransViewController.init(), animated: pushAnimated)
// currentViewController()?.navigationController?.pushViewController(CNLiveShopTransViewController.init(), animated: pushAnimated)
}
// if tag == 100 {
// //发布动态
// }else if tag == 101 {
// //商品管理
// let webVC = CNWebViewController()
// webVC.url = URL(string:"https://www.baidu.com")
// currentViewController()?.navigationController?.pushViewController(webVC, animated: pushAnimated)
//
// }else if tag == 102 {
// //订单管理
// }else if tag == 103 {
// //交易记录
// }
}
}