//
|
// MeQRCodeVC.swift
|
// WanPai
|
//
|
// Created by 无故事王国 on 2024/2/26.
|
//
|
|
import UIKit
|
import JQTools
|
|
class MeQRCodeVC: BaseVC {
|
|
@IBOutlet weak var tableView: UITableView!
|
@IBOutlet weak var label_content: UILabel!
|
private let viewModel = ActivityStudentViewModel()
|
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
title = "我的二维码"
|
|
|
Services.queryProtocol(.useStore, progress: false).subscribe(onNext: {[weak self] text in
|
self?.label_content.attributedText = AttributedStringbuilder.build().add(string: (text.data ?? ""), withFont: .systemFont(ofSize: 14, weight: .medium), withColor: .black.withAlphaComponent(0.6), lineSpace: 5).mutableAttributedString
|
}).disposed(by: disposeBag)
|
}
|
|
override func setUI() {
|
viewModel.isAuth.accept(1)
|
tableView.delegate = self
|
tableView.dataSource = self
|
tableView.separatorStyle = .none
|
tableView.register(UINib(nibName: "MyQRCodeTCell", bundle: nil), forCellReuseIdentifier: "_MyQRCodeTCell")
|
viewModel.configure(tableView,needMore: false)
|
viewModel.beginRefresh()
|
}
|
}
|
|
extension MeQRCodeVC:UITableViewDelegate,UITableViewDataSource{
|
|
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
let model = viewModel.dataSource.value[indexPath.row]
|
if let qrCode = WorldCupUserInfoQRCodel(id: model.id, isStudent: model.isStudent).toJSONString(){
|
QRWithTitlePreview.show(qrCode,title: model.name)
|
}
|
}
|
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
return viewModel.dataSource.value.count
|
}
|
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
let model = viewModel.dataSource.value[indexPath.row]
|
let cell = tableView.dequeueReusableCell(withIdentifier: "_MyQRCodeTCell") as! MyQRCodeTCell
|
cell.activityDetailPartModel = model
|
return cell
|
}
|
|
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
return 90
|
}
|
}
|