|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import 'package:zhiying_comm/util/empty_util.dart';
-
- ///
- /// 用户信息类
- ///
- class UserInfoModel {
- String token;
- String mobile;
- String userId;
- String username;
- List<String> perms;
- String registerInviteCodeEnable;
- String bindPhoneEnable;
- bool isTBAuth; // 是否淘宝授权
- String captcha;
-
- // 获取模糊手机号码
- get blurMobile => !EmptyUtil.isEmpty(mobile) ? mobile.length == 11 ? '${mobile.substring(0, 3)}****${mobile.substring(7, mobile.length)}' : mobile : mobile;
-
- UserInfoModel({this.token, this.userId, this.username, this.perms, this.registerInviteCodeEnable, this.isTBAuth = false, this.bindPhoneEnable});
-
- UserInfoModel.fromJson(Map<String, dynamic> json) {
- token = json['token'];
- userId = json['user_id'];
- username = json['username'];
- mobile = json['mobile'];
- registerInviteCodeEnable = json['register_invite_code_enable'];
- bindPhoneEnable= json['bind_phone_enable'];
- perms = json['perms']?.cast<String>();
- isTBAuth = json['isTBAuth'] ?? false;
- }
-
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['token'] = this.token;
- data['user_id'] = this.userId;
- data['username'] = this.username;
- data['perms'] = this.perms;
- data['mobile'] = this.mobile;
- data['register_invite_code_enable'] = this.registerInviteCodeEnable;
- data['bind_phone_enable'] = this.bindPhoneEnable;
- data['isTBAuth'] = this.isTBAuth;
- return data;
- }
-
- @override
- String toString() {
- return 'LoginUser{token: $token, userId: $userId, username: $username, perms: $perms, registerInviteCodeEnable: $registerInviteCodeEnable}';
- }
- }
|