| | |
| | | @IBOutlet weak var btn_setting: QMUIButton! |
| | | @IBOutlet weak var btn_share: QMUIButton! |
| | | @IBOutlet weak var view_rank: GradientView! |
| | | @IBOutlet weak var image_vipBg: UIImageView! |
| | | @IBOutlet weak var label_expirtTime: UILabel! |
| | | @IBOutlet weak var label_sustainDay: UILabel! |
| | | @IBOutlet weak var label_today: UILabel! |
| | | @IBOutlet weak var image_medal: UIImageView! |
| | | |
| | | @IBOutlet weak var image_userAvatar: UIImageView! |
| | | @IBOutlet weak var label_userName: UILabel! |
| | | @IBOutlet weak var label_phone: UILabel! |
| | | @IBOutlet weak var label_vipInfo: UILabel! |
| | | @IBOutlet weak var label_totalDay: UILabel! |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | |
| | | let tap = UITapGestureRecognizer(target: self, action: #selector(rankAction)) |
| | | view_rank.isUserInteractionEnabled = true |
| | | view_rank.addGestureRecognizer(tap) |
| | | |
| | | getData() |
| | | } |
| | | |
| | | override func setUI() { |
| | |
| | | btn_share.imagePosition = .top |
| | | } |
| | | |
| | | override func setRx() { |
| | | NotificationCenter.default.rx.notification(UpdateUserProfile_Noti, object: nil).take(until: self.rx.deallocated).subscribe(onNext: { _ in |
| | | self.getData() |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | |
| | | private func getData(){ |
| | | Services.getUserDetail().subscribe(onNext: {data in |
| | | if let model = data.data{ |
| | | UserViewModel.saveAvatarInfo(model) |
| | | } |
| | | }).disposed(by: self.disposeBag) |
| | | |
| | | |
| | | Services.getUserInfo().subscribe(onNext: {data in |
| | | if let model = data.data{ |
| | | self.image_userAvatar.sd_setImage(with: URL(string: model.avatar)) |
| | | self.label_userName.text = model.nickname |
| | | self.label_phone.text = model.cellPhone.jq_blotOutPhone() |
| | | |
| | | self.label_totalDay.attributedText = AttributedStringbuilder.build().add(string: "\(model.cumulative)", withFont: UIFont.init(name: "PingFang-SC-Regular", size: 60)!, withColor: UIColor(hexString: "#152715")!).add(string: "天", withFont: .systemFont(ofSize: 16), withColor: UIColor(hexString: "#152715")!).mutableAttributedString |
| | | |
| | | self.label_sustainDay.attributedText = AttributedStringbuilder.build().add(string: "\(model.continuity)", withFont: .systemFont(ofSize: 23), withColor: UIColor(hexString: "#152715")!).add(string: "天", withFont: .systemFont(ofSize: 12), withColor: UIColor(hexString: "#152715")!).mutableAttributedString |
| | | |
| | | self.image_medal.sd_setImage(with: URL(string: model.levelIcon)) |
| | | |
| | | let timeTurple = Date.jq_formateToTime_tuple(model.today * 60) |
| | | |
| | | self.label_today.attributedText = AttributedStringbuilder.build().add(string: "\(timeTurple.hour)", withFont: .systemFont(ofSize: 23), withColor: UIColor(hexString: "#152715")!).add(string: "时", withFont: .systemFont(ofSize: 12), withColor: UIColor(hexString: "#152715")!).add(string: "\(timeTurple.minute)", withFont: .systemFont(ofSize: 23), withColor: UIColor(hexString: "#152715")!).add(string: "分", withFont: .systemFont(ofSize: 12), withColor: UIColor(hexString: "#152715")!).mutableAttributedString |
| | | |
| | | |
| | | |
| | | if model.isVip == .yes{ |
| | | self.image_vipBg.image = UIImage(named: "bg_vip") |
| | | self.label_vipInfo.text = "你已是高级会员" |
| | | self.label_expirtTime.text = model.vipExpireTime + "到期" |
| | | }else{ |
| | | self.image_vipBg.image = UIImage(named: "bg_vip_u") |
| | | self.label_vipInfo.text = "升级为高级会员,解锁全部体验" |
| | | self.label_expirtTime.text = "你还未开通会员服务" |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | @objc func rankAction(){ |
| | | let vc = WebVC() |
| | | vc.title = "爱心榜单" |