CNLiveHelpFeedBackViewController.swift
3.22 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
//
// CNLiveHelpFeedBackViewController.swift
// metaCode
//
// Created by open on 2023/6/7.
//
import Foundation
class CNLiveHelpFeedBackViewController : CNLiveBaseViewController, UICollectionViewDelegate, UICollectionViewDataSource {
let kCNLiveHelpFeedBackViewCellKey = "kCNLiveHelpFeedBackViewCellKey"
lazy var collectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout.init()
layout.itemSize = CGSize(width: (KSreenWidth - 45)/2, height: 60)
layout.sectionInset = .init(top: 5, left: 15, bottom: 5, right: 15)
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.delegate = self
collectionView.dataSource = self
collectionView.backgroundColor = .clear
collectionView.register(MineFeedBackListCollectViewCell.self, forCellWithReuseIdentifier: kCNLiveHelpFeedBackViewCellKey)
return collectionView
}()
lazy var dataArray: NSMutableArray = {
let dataArray = NSMutableArray()
dataArray.add(["image":"mine_add_feed_back_list","name":"反馈"])
dataArray.add(["image":"mine_add_custom_service_list","name":"客服"])
return dataArray
}()
override func viewWillAppear(_ animated: Bool) {
navigationBarHidden = false
}
override func viewDidLoad() {
super.viewDidLoad()
titleName = "帮助与反馈"
view.addSubview(collectionView)
collectionView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(get_system_nav_height())
make.left.bottom.right.equalToSuperview()
}
}
}
extension CNLiveHelpFeedBackViewController {
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return dataArray.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let item = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveHelpFeedBackViewCellKey, for: indexPath) as! MineFeedBackListCollectViewCell
let dict = dataArray[indexPath.row] as! Dictionary<String, Any>
item.setupWithDataSource(dict: dict)
return item
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
return CGSize.init(width: KSreenWidth, height: 20)
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if indexPath.row == 0 {
self.navigationController?.pushViewController(CNLiveTypeFeedBackViewController.init(show_type: .feedback), animated: true)
}
if indexPath.row == 1 {
AlertTool.systemActionSheet(title: nil, message: nil, actionTitles: ["呼叫 010-65832485"]) { index in
if index == 1 {
let url: NSURL = NSURL(string: "TEL://010-65832485")!
UIApplication.shared.open(url as URL)
}
}
}
}
}