add 登陆失效

hmxc
张萌 4 years ago
parent a82fc92958
commit ef909e6486

@ -3,6 +3,7 @@ import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/utils/hive_store.dart';
import 'package:akuCommunity/utils/logger/logger_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
@ -35,6 +36,8 @@ class _SplashPageState extends State<SplashPage> {
@override
Widget build(BuildContext context) {
ScreenUtil.init(context,
designSize: Size(750, 1334), allowFontScaling: true);
return Scaffold(
body: SizedBox(
height: 80,

@ -60,8 +60,6 @@ class _TabNavigatorState extends State<TabNavigator> {
@override
Widget build(BuildContext context) {
ScreenUtil.init(context,
designSize: Size(750, 1334), allowFontScaling: true);
//
List<BottomNavigationBarItem> _bottomNav = <BottomNavigationBarItem>[
_buildBottomBar(

@ -32,7 +32,7 @@ class UserProvider extends ChangeNotifier {
_isLogin = false;
_token = null;
_userInfoModel = null;
_userDetailModel=null;
_userDetailModel = null;
NetUtil().get(API.user.logout, showMessage: true);
NetUtil().dio.options.headers.remove('App-Admin-Token');
HiveStore.appBox.delete('token');
@ -45,8 +45,9 @@ class UserProvider extends ChangeNotifier {
notifyListeners();
}
Future updateUserDetail()async{
_userDetailModel=await SignFunc.getUserDetail();
Future updateUserDetail() async {
_userDetailModel = await SignFunc.getUserDetail();
notifyListeners();
}
String _token;

@ -1,3 +1,4 @@
import 'package:akuCommunity/pages/sign/sign_in_page.dart';
import 'package:akuCommunity/utils/logger/logger_data.dart';
import 'package:akuCommunity/utils/network/base_list_model.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
@ -5,6 +6,7 @@ import 'package:bot_toast/bot_toast.dart';
import 'package:dio/dio.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:get/get.dart' hide Response;
import 'package:logger/logger.dart';
class NetUtil {
@ -142,6 +144,9 @@ class NetUtil {
}
_parseRequestError(BaseModel model, {bool showMessage = false}) {
if (!model.status&&model.message=='登录失效,请登录'){
Get.offAll(SignInPage());
}
if (!model.status || showMessage) {
BotToast.showText(text: model.message);
}

Loading…
Cancel
Save