|
|
|
@ -8,7 +8,6 @@ import 'package:akuCommunity/constants/api.dart';
|
|
|
|
|
import 'package:akuCommunity/model/user/user_detail_model.dart';
|
|
|
|
|
import 'package:akuCommunity/model/user/user_info_model.dart';
|
|
|
|
|
import 'package:akuCommunity/pages/sign/sign_func.dart';
|
|
|
|
|
import 'package:akuCommunity/utils/bee_parse.dart';
|
|
|
|
|
import 'package:akuCommunity/utils/hive_store.dart';
|
|
|
|
|
import 'package:akuCommunity/utils/network/base_model.dart';
|
|
|
|
|
import 'package:akuCommunity/utils/network/net_util.dart';
|
|
|
|
@ -27,14 +26,13 @@ class UserProvider extends ChangeNotifier {
|
|
|
|
|
HiveStore.appBox.put('login', true);
|
|
|
|
|
await updateProfile();
|
|
|
|
|
await updateUserDetail();
|
|
|
|
|
await setCurrentHouse((_userDetailModel?.estateNames?.isEmpty ?? true)
|
|
|
|
|
? ''
|
|
|
|
|
: _userDetailModel?.estateNames?.first);
|
|
|
|
|
await appProvider.updateHouses(await HouseFunc.houses);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logout() {
|
|
|
|
|
final appProvider = Provider.of<AppProvider>(Get.context, listen: false);
|
|
|
|
|
appProvider.setCurrentHouse(null);
|
|
|
|
|
_isLogin = false;
|
|
|
|
|
_token = null;
|
|
|
|
|
_userInfoModel = null;
|
|
|
|
@ -133,13 +131,4 @@ class UserProvider extends ChangeNotifier {
|
|
|
|
|
await updateProfile();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///设置默认房屋
|
|
|
|
|
String _currentHouse;
|
|
|
|
|
int get currentHouseId => BeeParse.getEstateNameId(_currentHouse);
|
|
|
|
|
String get currentHouse => BeeParse.getEstateName(_currentHouse);
|
|
|
|
|
setCurrentHouse(String house) {
|
|
|
|
|
_currentHouse = house;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|