//
|
// TreeTeskEnergyExchangeVC.swift
|
// XQMuse
|
//
|
// Created by 无故事王国 on 2024/9/11.
|
//
|
|
import UIKit
|
import JQTools
|
|
class TreeTeskEnergyExchangeVC: BaseVC {
|
|
@IBOutlet weak var tableView: UITableView!
|
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
title = "礼品兑换"
|
}
|
|
override func setUI() {
|
|
let btn = UIButton(type: .custom)
|
btn.setTitle("兑换记录", for: .normal)
|
btn.setTitleColor(.black.withAlphaComponent(0.55), for: .normal)
|
btn.titleLabel?.font = .systemFont(ofSize: 14, weight: .medium)
|
btn.addTarget(self, action: #selector(exchangeRecordAction), for: .touchUpInside)
|
|
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: btn)
|
|
tableView.delegate = self
|
tableView.dataSource = self
|
tableView.separatorStyle = .none
|
tableView.register(UINib(nibName: "TreeTeskEnergyTCell", bundle: nil), forCellReuseIdentifier: "_TreeTeskEnergyTCell")
|
}
|
|
@objc func exchangeRecordAction(){
|
let vc = TreeTeskEnergyExchangeRecordVC()
|
push(vc: vc)
|
}
|
}
|
|
extension TreeTeskEnergyExchangeVC:UITableViewDataSource & UITableViewDelegate{
|
|
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
let attribute = AttributedStringbuilder.build().add(string: "是否确认使用X能量值兑换当前礼品?\n兑换后系统将自动扣除能量值", withFont: .systemFont(ofSize: 14, weight: .medium), withColor: .black.withAlphaComponent(0.59), indent: 0, lineSpace: 6).mutableAttributedString
|
|
CommonAlertView.show(title: "提示", attribute: attribute, isSingle: false, cancelStr: "再想想", completeStr: "确认") { state in
|
|
if state{
|
TreeTeskExchangeSuccessView.show()
|
}
|
|
}
|
}
|
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
let cell = tableView.dequeueReusableCell(withIdentifier: "_TreeTeskEnergyTCell") as! TreeTeskEnergyTCell
|
cell.isExchanged(indexPath.row == 0)
|
return cell
|
}
|
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
return 11
|
}
|
|
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
return 91
|
}
|
}
|