基础库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

50 lines
1.6 KiB

  1. import 'package:zhiying_comm/util/empty_util.dart';
  2. ///
  3. /// 用户信息类
  4. ///
  5. class UserInfoModel {
  6. String token;
  7. String mobile;
  8. String userId;
  9. String username;
  10. List<String> perms;
  11. String registerInviteCodeEnable;
  12. String bindPhoneEnable;
  13. bool isTBAuth; // 是否淘宝授权
  14. // 获取模糊手机号码
  15. get blurMobile => !EmptyUtil.isEmpty(mobile) ? mobile.length == 11 ? '${mobile.substring(0, 3)}****${mobile.substring(7, mobile.length)}' : mobile : mobile;
  16. UserInfoModel({this.token, this.userId, this.username, this.perms, this.registerInviteCodeEnable, this.isTBAuth = false, this.bindPhoneEnable});
  17. UserInfoModel.fromJson(Map<String, dynamic> json) {
  18. token = json['token'];
  19. userId = json['user_id'];
  20. username = json['username'];
  21. mobile = json['mobile'];
  22. registerInviteCodeEnable = json['register_invite_code_enable'];
  23. bindPhoneEnable= json['bind_phone_enable'];
  24. perms = json['perms']?.cast<String>();
  25. isTBAuth = json['isTBAuth'] ?? false;
  26. }
  27. Map<String, dynamic> toJson() {
  28. final Map<String, dynamic> data = new Map<String, dynamic>();
  29. data['token'] = this.token;
  30. data['user_id'] = this.userId;
  31. data['username'] = this.username;
  32. data['perms'] = this.perms;
  33. data['mobile'] = this.mobile;
  34. data['register_invite_code_enable'] = this.registerInviteCodeEnable;
  35. data['bind_phone_enable'] = this.bindPhoneEnable;
  36. data['isTBAuth'] = this.isTBAuth;
  37. return data;
  38. }
  39. @override
  40. String toString() {
  41. return 'LoginUser{token: $token, userId: $userId, username: $username, perms: $perms, registerInviteCodeEnable: $registerInviteCodeEnable}';
  42. }
  43. }