no message
This commit is contained in:
parent
dc53062556
commit
0cb3d69201
|
|
@ -72,7 +72,7 @@ class _TheLoginState extends ConsumerState<TheLogin> with CommonMixin {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
Future.delayed(Duration(seconds: 3), () => sysProtocol(context));
|
Future.delayed(Duration(seconds: 2), () => sysProtocol(context));
|
||||||
Future(() {
|
Future(() {
|
||||||
// 延迟更新 Provider
|
// 延迟更新 Provider
|
||||||
ref.read(userTokenProvider.notifier).clean(); // 进入登录页先清空信息
|
ref.read(userTokenProvider.notifier).clean(); // 进入登录页先清空信息
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import 'package:marking_app/pages/homework_correction/index.dart';
|
||||||
import 'package:marking_app/pages/reports/index.dart';
|
import 'package:marking_app/pages/reports/index.dart';
|
||||||
import 'package:marking_app/provider/do_marking_provider.dart';
|
import 'package:marking_app/provider/do_marking_provider.dart';
|
||||||
import 'package:marking_app/provider/upload_file_provider.dart';
|
import 'package:marking_app/provider/upload_file_provider.dart';
|
||||||
import 'package:marking_app/routes/RouterManager.dart';
|
|
||||||
import 'package:marking_app/utils/app_upgrade/UpdateDialog.dart';
|
import 'package:marking_app/utils/app_upgrade/UpdateDialog.dart';
|
||||||
import 'package:marking_app/utils/app_upgrade/model/UpdateAppEvent.dart';
|
import 'package:marking_app/utils/app_upgrade/model/UpdateAppEvent.dart';
|
||||||
import 'package:marking_app/common/model/sys/system_version.dart';
|
import 'package:marking_app/common/model/sys/system_version.dart';
|
||||||
|
|
@ -29,7 +28,6 @@ import 'package:marking_app/pages/marking/index.dart';
|
||||||
import 'package:marking_app/provider/user_provider.dart';
|
import 'package:marking_app/provider/user_provider.dart';
|
||||||
import 'package:marking_app/utils/index.dart';
|
import 'package:marking_app/utils/index.dart';
|
||||||
import 'package:marking_app/utils/request/rest_client.dart';
|
import 'package:marking_app/utils/request/rest_client.dart';
|
||||||
import 'package:marking_app/utils/sys_protocol.dart';
|
|
||||||
import 'package:package_info/package_info.dart';
|
import 'package:package_info/package_info.dart';
|
||||||
|
|
||||||
class TheMainPage extends StatefulHookConsumerWidget {
|
class TheMainPage extends StatefulHookConsumerWidget {
|
||||||
|
|
@ -63,7 +61,6 @@ class TheMainPageState extends ConsumerState<TheMainPage> with CommonMixin {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_pageController = PageController(initialPage: tabIndex);
|
_pageController = PageController(initialPage: tabIndex);
|
||||||
Future.delayed(Duration(seconds: 1), () => sysProtocol(context));
|
|
||||||
_otherFocusNode = FocusNode();
|
_otherFocusNode = FocusNode();
|
||||||
// 由于本项目必须登录才能浏览,所以APP升级校验在登录后
|
// 由于本项目必须登录才能浏览,所以APP升级校验在登录后
|
||||||
_userListener = ref.read(userProvider.notifier).addListener((state) {
|
_userListener = ref.read(userProvider.notifier).addListener((state) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -41,6 +41,7 @@ class FastData {
|
||||||
static const String _INPUT_KEYBOARD_GUIDE_PAGE_WORK = "APP:MARKING:GUIDE_PAGE:WORK";
|
static const String _INPUT_KEYBOARD_GUIDE_PAGE_WORK = "APP:MARKING:GUIDE_PAGE:WORK";
|
||||||
// 系统协议确认
|
// 系统协议确认
|
||||||
static const String _SYS_PROTOCOL = "APP:SYS:PROTOCOL";
|
static const String _SYS_PROTOCOL = "APP:SYS:PROTOCOL";
|
||||||
|
static const String _SYS_PROTOCOL_SHOW = "APP:SYS:PROTOCOL_SHOW";
|
||||||
|
|
||||||
static SharedPreferences? _prefs;
|
static SharedPreferences? _prefs;
|
||||||
|
|
||||||
|
|
@ -286,4 +287,19 @@ class FastData {
|
||||||
SharedPreferences thePrefs = await getSharedInstance();
|
SharedPreferences thePrefs = await getSharedInstance();
|
||||||
thePrefs.remove(_SYS_PROTOCOL);
|
thePrefs.remove(_SYS_PROTOCOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> setSysProtocolShow(bool val) async {
|
||||||
|
SharedPreferences thePrefs = await getSharedInstance();
|
||||||
|
return await thePrefs.setBool(_SYS_PROTOCOL_SHOW, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool?> getSysProtocolShow([SharedPreferences? thePrefs]) async {
|
||||||
|
if (thePrefs == null) thePrefs = await getSharedInstance();
|
||||||
|
return thePrefs.getBool(_SYS_PROTOCOL_SHOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cleanSysProtocolShow() async {
|
||||||
|
SharedPreferences thePrefs = await getSharedInstance();
|
||||||
|
thePrefs.remove(_SYS_PROTOCOL_SHOW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ class Protocol extends Dialog {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|
@ -122,17 +123,25 @@ class Protocol extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 系统协议
|
/// 系统协议
|
||||||
void sysProtocol(BuildContext context) async {
|
Future<void> sysProtocol(BuildContext context) async {
|
||||||
bool? _sysProtocol = await FastData.getInstance().getSysProtocol();
|
bool? _sysProtocol = await FastData.getInstance().getSysProtocol();
|
||||||
if (_sysProtocol == null || !_sysProtocol) {
|
if (_sysProtocol == null || !_sysProtocol) {
|
||||||
print('进来这里....');
|
print('进来这里....');
|
||||||
|
bool? _sysProtocolShow = await FastData.getInstance().getSysProtocolShow();
|
||||||
showDialog(
|
if (_sysProtocolShow != true) {
|
||||||
|
try {
|
||||||
|
await FastData.getInstance().setSysProtocolShow(true);
|
||||||
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
builder: (ctx) {
|
// useRootNavigator: false,
|
||||||
return Protocol(ctx);
|
builder: (ctx) => Protocol(ctx),
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
} catch (e) {
|
||||||
|
FastData.getInstance().cleanSysProtocol();
|
||||||
|
} finally {
|
||||||
|
FastData.getInstance().cleanSysProtocolShow();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue