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

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

@ -32,7 +32,7 @@ class UserProvider extends ChangeNotifier {
_isLogin = false; _isLogin = false;
_token = null; _token = null;
_userInfoModel = null; _userInfoModel = null;
_userDetailModel=null; _userDetailModel = null;
NetUtil().get(API.user.logout, showMessage: true); NetUtil().get(API.user.logout, showMessage: true);
NetUtil().dio.options.headers.remove('App-Admin-Token'); NetUtil().dio.options.headers.remove('App-Admin-Token');
HiveStore.appBox.delete('token'); HiveStore.appBox.delete('token');
@ -45,8 +45,9 @@ class UserProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future updateUserDetail()async{ Future updateUserDetail() async {
_userDetailModel=await SignFunc.getUserDetail(); _userDetailModel = await SignFunc.getUserDetail();
notifyListeners();
} }
String _token; 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/logger/logger_data.dart';
import 'package:akuCommunity/utils/network/base_list_model.dart'; import 'package:akuCommunity/utils/network/base_list_model.dart';
import 'package:akuCommunity/utils/network/base_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:dio/dio.dart';
import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/constants/api.dart';
import 'package:get/get.dart' hide Response;
import 'package:logger/logger.dart'; import 'package:logger/logger.dart';
class NetUtil { class NetUtil {
@ -142,6 +144,9 @@ class NetUtil {
} }
_parseRequestError(BaseModel model, {bool showMessage = false}) { _parseRequestError(BaseModel model, {bool showMessage = false}) {
if (!model.status&&model.message=='登录失效,请登录'){
Get.offAll(SignInPage());
}
if (!model.status || showMessage) { if (!model.status || showMessage) {
BotToast.showText(text: model.message); BotToast.showText(text: model.message);
} }

Loading…
Cancel
Save