From bfe9b5ea9e9fc81d3824272dd74b3b8d87bcaeb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=A0=E6=96=87=E8=BD=A9?= <12812285557@qq.com> Date: Fri, 20 May 2022 15:23:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E4=BD=8F=E7=99=BB=E5=BD=95=E5=B0=8F?= =?UTF-8?q?=E5=8C=BA=E9=97=AE=E9=A2=98=20=E5=92=8C=20=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E8=B7=B3=E8=BD=AC=E9=A1=B5=E9=9D=A2=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/provider/data_provider.dart | 1 + lib/provider/user_provider.dart | 1 - lib/ui/settings/settings_page.dart | 5 ++++- lib/utils/hive_store.dart | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/provider/data_provider.dart b/lib/provider/data_provider.dart index 9de2835..877e856 100644 --- a/lib/provider/data_provider.dart +++ b/lib/provider/data_provider.dart @@ -50,6 +50,7 @@ class DataProvider extends ChangeNotifier { _loginHistories.removeAt(_loginHistories.length - 1); } HiveStore.dataBox!.put('historyLogin', _loginHistories); + } } } diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 5588b72..b7ea307 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -36,7 +36,6 @@ class UserProvider extends ChangeNotifier { ///注销登录 logout() async { - await NetUtil().post(SAASAPI.login.logOut, showMessage: true); WebSocketUtil().closeWebSocket(); NetUtil().logout(); _isLogin = false; diff --git a/lib/ui/settings/settings_page.dart b/lib/ui/settings/settings_page.dart index a6dd007..9389cdf 100644 --- a/lib/ui/settings/settings_page.dart +++ b/lib/ui/settings/settings_page.dart @@ -1,5 +1,6 @@ // Flutter imports: // Project imports: +import 'package:aku_new_community_manager/const/saas_api.dart'; import 'package:aku_new_community_manager/new_ui/auth/other_login_page.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; @@ -10,6 +11,7 @@ import 'package:aku_new_community_manager/ui/agreements/privacy_page.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_tile.dart'; +import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -85,7 +87,8 @@ class _SettingsPageState extends State { child: AkuMaterialButton( radius: 8.w, color: AppStyle.primaryColor, - onPressed: () { + onPressed: ()async { + await NetUtil().post(SAASAPI.login.logOut, showMessage: true); userProvider.logout(); Get.offAll(() => OtherLoginPage()); }, diff --git a/lib/utils/hive_store.dart b/lib/utils/hive_store.dart index 2cc295e..8adb0d1 100644 --- a/lib/utils/hive_store.dart +++ b/lib/utils/hive_store.dart @@ -1,5 +1,6 @@ // Package imports: import 'package:aku_new_community_manager/saas_models/login/china_region_model.dart'; +import 'package:aku_new_community_manager/saas_models/login/community_model.dart'; import 'package:aku_new_community_manager/saas_models/login/history_login_model.dart'; import 'package:aku_new_community_manager/saas_models/login/picked_city_model.dart'; import 'package:flutter/foundation.dart'; @@ -21,6 +22,8 @@ class HiveStore { Hive.registerAdapter(ChinaRegionModelAdapter()); //HiveTypeId:3 Hive.registerAdapter(HistoryLoginModelAdapter()); //HiveTypeId:4 Hive.registerAdapter(PickedCityModelAdapter()); //HiveTypeId:6 + Hive.registerAdapter(CommunityModelAdapter());//HiveTypeId:7 + Hive.init(dir.path); _appBox = await Hive.openBox('app'); _dataBox = await Hive.openBox('dataBox');