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

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