基础库
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.
 
 
 
 
 

51 rivejä
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. String captcha;
  15. // 获取模糊手机号码
  16. get blurMobile => !EmptyUtil.isEmpty(mobile) ? mobile.length == 11 ? '${mobile.substring(0, 3)}****${mobile.substring(7, mobile.length)}' : mobile : mobile;
  17. UserInfoModel({this.token, this.userId, this.username, this.perms, this.registerInviteCodeEnable, this.isTBAuth = false, this.bindPhoneEnable});
  18. UserInfoModel.fromJson(Map<String, dynamic> json) {
  19. token = json['token'];
  20. userId = json['user_id'];
  21. username = json['username'];
  22. mobile = json['mobile'];
  23. registerInviteCodeEnable = json['register_invite_code_enable'];
  24. bindPhoneEnable= json['bind_phone_enable'];
  25. perms = json['perms']?.cast<String>();
  26. isTBAuth = json['isTBAuth'] ?? false;
  27. }
  28. Map<String, dynamic> toJson() {
  29. final Map<String, dynamic> data = new Map<String, dynamic>();
  30. data['token'] = this.token;
  31. data['user_id'] = this.userId;
  32. data['username'] = this.username;
  33. data['perms'] = this.perms;
  34. data['mobile'] = this.mobile;
  35. data['register_invite_code_enable'] = this.registerInviteCodeEnable;
  36. data['bind_phone_enable'] = this.bindPhoneEnable;
  37. data['isTBAuth'] = this.isTBAuth;
  38. return data;
  39. }
  40. @override
  41. String toString() {
  42. return 'LoginUser{token: $token, userId: $userId, username: $username, perms: $perms, registerInviteCodeEnable: $registerInviteCodeEnable}';
  43. }
  44. }