import 'package:zhiying_comm/util/empty_util.dart'; /// /// 用户信息类 /// class UserInfoModel { String token; String mobile; String userId; String username; List 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 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(); isTBAuth = json['isTBAuth'] ?? false; } Map toJson() { final Map data = new Map(); 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}'; } }