younger_times
2023-07-31 9add6fe63070124dea74f596e646eaae2f52ef17
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
//
//  ProfileVC.swift
//  WanPai
//
//  Created by 无故事王国 on 2023/6/28.
//
 
import UIKit
import QMUIKit
import JQTools
 
class ProfileVC: BaseVC {
    @IBOutlet weak var btn_userProfile: UIButton!
    @IBOutlet weak var label_username: UILabel!
    @IBOutlet weak var label_contact: UILabel!
    @IBOutlet weak var label_gender: UILabel!
    @IBOutlet weak var label_birthday: UILabel!
    @IBOutlet weak var label_address: UILabel!
    @IBOutlet weak var label_vipDutime: UILabel!
 
    private var profileImg:UIImage?
 
    override func viewDidLoad() {
        super.viewDidLoad()
 
        title = "个人信息"
        Services.userDetails().subscribe(onNext: {[weak self] data in
            if let model = data.data{
                self?.label_username.text = model.userName
                self?.label_contact.text = model.userPhone
                self?.label_gender.text = model.sex == .man ? "男":"女"
                self?.label_birthday.text = model.birthday
                self?.label_address.text = model.address
                self?.label_vipDutime.text = model.memberLifespan
                self?.btn_userProfile.sd_setImage(with: URL(string: model.userImage), for: .normal,placeholderImage: UIImage(named: "btn_userProfile"))
            }
 
        }).disposed(by: disposeBag)
    }
 
    @IBAction func logoutAction(_ sender: UIButton) {
        CommonAlertView.show(title: "退出登录", content: "是否退出当前账号?") { status in
            if status{
                UserViewModel.clearToken()
                let loginVC = LoginVC()
                loginVC.modalPresentationStyle = .fullScreen
                self.present(loginVC, animated: true)
            }
        }
    }
 
    @IBAction func updateProfileAction(_ sender: UIButton) {
        JQ_ImagePickerTool.getSharedInstance().singleImage({ image in
            self.profileImg = image
        }, clipSize: CGSize(width: JQ_ScreenW, height: JQ_ScreenW))
    }
 
 
    @IBAction func dismissAccountAction(_ sender: UIButton) {
 
    }
}