初始化逻辑优化

pull/1/head
张萌 3 years ago
parent 75f26e708a
commit 763f268d49

@ -72,6 +72,9 @@ class _User {
}
class _Login {
///app退
String get logOut => '/app/user/quit';
///
String get allCommunity => '/app/login/findAllCommunity';

@ -107,8 +107,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
UserTool.appProvider.pickedCityAndCommunity!.communityModel!
.id);
if (response.data['success']) {
await UserTool.userProvider.setLogin(response.data['data']);
await UserTool.dataProvider.addHistories();
await UserTool.userProvider.setLogin(response.data['data']);
} else {
BotToast.showText(text: response.data['message']);
}

@ -90,6 +90,7 @@ class _SetNickNamePageState extends State<SetNickNamePage> {
var result = await SignFunc.setNickName(_nickController.text);
if (result) {
await UserTool.userProvider.updateUserInfo();
await SignFunc.checkNameAndAccount();
}
},
text: '确定'),

@ -93,6 +93,7 @@ class _SetPsdPageState extends State<SetPsdPage> {
await SignFunc.settingPsd(_psdController.text);
if (result) {
await UserTool.userProvider.updateUserInfo();
await SignFunc.checkNameAndAccount();
}
}
: null,

@ -37,6 +37,7 @@ class UserProvider extends ChangeNotifier {
userId: _userInfoModel!.id,
clockRemind: false,
todayClocked: false);
SignFunc.checkNameAndAccount();
}
}
@ -58,7 +59,7 @@ class UserProvider extends ChangeNotifier {
_token = null;
_userInfoModel = null;
_myHouses = [];
NetUtil().get(API.user.logout, showMessage: true);
NetUtil().get(SAASAPI.login.logOut, showMessage: true);
NetUtil().dio!.options.headers.remove('app-login-token');
HiveStore.appBox!.delete('token');
HiveStore.appBox!.delete('login');
@ -73,7 +74,6 @@ class UserProvider extends ChangeNotifier {
BotToast.showText(text: '获取用户信息失败');
}
if (_userInfoModel != null && !kIsWeb && !Platform.isMacOS) {}
SignFunc.checkNameAndAccount();
notifyListeners();
}
@ -129,6 +129,7 @@ class UserProvider extends ChangeNotifier {
showMessage: true,
);
if (baseModel.success) {
await updateUserInfo();
notifyListeners();
}
}
@ -141,6 +142,7 @@ class UserProvider extends ChangeNotifier {
showMessage: true,
);
if (baseModel.success) {
await updateUserInfo();
notifyListeners();
}
}
@ -170,6 +172,7 @@ class UserProvider extends ChangeNotifier {
if (model.success) {
await updateUserInfo();
}
notifyListeners();
}
///

Loading…
Cancel
Save