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