import 'package:zhiying_comm/util/empty_util.dart'; /// /// 用户信息类 /// class UserInfoModel { String token; String mobile; String userId; String username; List perms; String registerInviteCodeEnable; // 获取模糊手机号码 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}); UserInfoModel.fromJson(Map json) { token = json['token']; userId = json['user_id']; username = json['username']; mobile = json['mobile']; perms = json['perms']?.cast(); registerInviteCodeEnable = json['register_invite_code_enable']; } 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; return data; } @override String toString() { return 'LoginUser{token: $token, userId: $userId, username: $username, perms: $perms, registerInviteCodeEnable: $registerInviteCodeEnable}'; } }