|
|
@ -2,6 +2,7 @@
|
|
|
|
import 'dart:io';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
|
|
// Flutter imports:
|
|
|
|
// Flutter imports:
|
|
|
|
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
|
|
// Project imports:
|
|
|
|
// Project imports:
|
|
|
@ -24,13 +25,9 @@ class UserProvider extends ChangeNotifier {
|
|
|
|
///登陆
|
|
|
|
///登陆
|
|
|
|
Future setLogin(int token) async {
|
|
|
|
Future setLogin(int token) async {
|
|
|
|
_isLogin = true;
|
|
|
|
_isLogin = true;
|
|
|
|
NetUtil()
|
|
|
|
NetUtil().auth(token);
|
|
|
|
.dio
|
|
|
|
await HiveStore.appBox.put('token', token);
|
|
|
|
.options
|
|
|
|
await HiveStore.appBox.put('login', true);
|
|
|
|
.headers
|
|
|
|
|
|
|
|
.putIfAbsent('butlerApp-admin-token', () => token);
|
|
|
|
|
|
|
|
HiveStore.appBox.put('token', token);
|
|
|
|
|
|
|
|
HiveStore.appBox.put('login', true);
|
|
|
|
|
|
|
|
_profileModel = await updateProfile();
|
|
|
|
_profileModel = await updateProfile();
|
|
|
|
_infoModel = await updateUserInfo();
|
|
|
|
_infoModel = await updateUserInfo();
|
|
|
|
// await setCurrentHouse((_userDetailModel?.estateNames?.isEmpty ?? true)
|
|
|
|
// await setCurrentHouse((_userDetailModel?.estateNames?.isEmpty ?? true)
|
|
|
@ -62,9 +59,12 @@ class UserProvider extends ChangeNotifier {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///注销登录
|
|
|
|
///注销登录
|
|
|
|
logout() {
|
|
|
|
logout() async {
|
|
|
|
|
|
|
|
await NetUtil().get(API.auth.logout, showMessage: true);
|
|
|
|
|
|
|
|
NetUtil().logout();
|
|
|
|
_isLogin = false;
|
|
|
|
_isLogin = false;
|
|
|
|
HiveStore.appBox.delete('token');
|
|
|
|
await HiveStore.appBox.delete('token');
|
|
|
|
|
|
|
|
await HiveStore.appBox.put('login', false);
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|