空试题 检验
This commit is contained in:
parent
ef2684ca5d
commit
0d2b3d6934
|
|
@ -23,19 +23,7 @@ class UpgradeLogic extends GetxController with RequestToolMixin {
|
||||||
// super.onInit();
|
// super.onInit();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Future<void> getAppUpgrade(BuildContext context) async {
|
Future<UpdateAppEvent?> getUpdateAppEvent() async {
|
||||||
if (!const bool.fromEnvironment('dart.vm.product')) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
showUpgrade.value = true;
|
|
||||||
|
|
||||||
final names = [
|
|
||||||
UserStore.to.userDetailInfo.value?.name,
|
|
||||||
UserStore.to.userDetailInfo.value?.account,
|
|
||||||
].whereType<String>().where((name) => name.isNotEmpty).toList();
|
|
||||||
|
|
||||||
if (names.contains('AppleTester')) return;
|
|
||||||
|
|
||||||
// 获取设备信息
|
// 获取设备信息
|
||||||
String deviceInfo;
|
String deviceInfo;
|
||||||
int deviceType;
|
int deviceType;
|
||||||
|
|
@ -49,12 +37,12 @@ class UpgradeLogic extends GetxController with RequestToolMixin {
|
||||||
deviceInfo = "windows";
|
deviceInfo = "windows";
|
||||||
deviceType = 3;
|
deviceType = 3;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppVersion? result = await getClient()
|
AppVersion? result = await getClient().getLastAppVersion('making_school_asignment_app', deviceType);
|
||||||
.getLastAppVersion('making_school_asignment_app', deviceType);
|
if (result == null) return null;
|
||||||
if (result != null) {
|
|
||||||
//获取当前版本
|
//获取当前版本
|
||||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||||
//获取当前版本
|
//获取当前版本
|
||||||
|
|
@ -67,11 +55,75 @@ class UpgradeLogic extends GetxController with RequestToolMixin {
|
||||||
'downloadPath': Platform.isWindows ? '' : result.appFileUrl,
|
'downloadPath': Platform.isWindows ? '' : result.appFileUrl,
|
||||||
'version': result.version,
|
'version': result.version,
|
||||||
'systemType': deviceType,
|
'systemType': deviceType,
|
||||||
'description': result.description ?? 'APP新版本更新'
|
'description': result.description ?? 'APP新版本更新',
|
||||||
};
|
};
|
||||||
UpdateAppEvent updateAppEvent = UpdateAppEvent.fromJson(
|
return UpdateAppEvent.fromJson(json, localVersion, deviceInfo, appName, packageName, typeName: 'systemType');
|
||||||
json, localVersion, deviceInfo, appName, packageName,
|
}
|
||||||
typeName: 'systemType');
|
|
||||||
|
Future<void> getAppUpgrade(BuildContext context) async {
|
||||||
|
if (!const bool.fromEnvironment('dart.vm.product')) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
showUpgrade.value = true;
|
||||||
|
|
||||||
|
final names = [
|
||||||
|
UserStore.to.userDetailInfo.value?.name,
|
||||||
|
UserStore.to.userDetailInfo.value?.account,
|
||||||
|
].whereType<String>().where((name) => name.isNotEmpty).toList();
|
||||||
|
if (names.contains('AppleTester')) return;
|
||||||
|
|
||||||
|
UpdateAppEvent? updateAppEvent = await getUpdateAppEvent();
|
||||||
|
if (updateAppEvent != null && updateAppEvent.upgrade) {
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
||||||
|
AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo;
|
||||||
|
Permission storagePermission;
|
||||||
|
if (androidInfo.version.sdkInt >= 33) {
|
||||||
|
storagePermission = Permission.manageExternalStorage;
|
||||||
|
} else {
|
||||||
|
storagePermission = Permission.storage;
|
||||||
|
}
|
||||||
|
await PermissionDescribeUtil.instance.toLaunchPermissionRequest(
|
||||||
|
Get.context ?? context,
|
||||||
|
title: '储存权限请求',
|
||||||
|
describe: "为了提供更好的服务,需要获取到存储权限用于保存APP升级文件APK,进行升级",
|
||||||
|
permissions: [storagePermission],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
await UpdateDialog.showUpdateDialog(
|
||||||
|
Get.context ?? context,
|
||||||
|
updateAppEvent,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
// 获取设备信息
|
||||||
|
String deviceInfo;
|
||||||
|
int deviceType;
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
deviceInfo = "android";
|
||||||
|
deviceType = 1;
|
||||||
|
} else if (Platform.isIOS) {
|
||||||
|
deviceInfo = "ios";
|
||||||
|
deviceType = 2;
|
||||||
|
} else if (Platform.isWindows) {
|
||||||
|
deviceInfo = "windows";
|
||||||
|
deviceType = 3;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
//获取当前版本
|
||||||
|
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||||
|
//获取当前版本
|
||||||
|
String localVersion = packageInfo.version;
|
||||||
|
String appName = packageInfo.appName; //应用名称
|
||||||
|
String packageName = packageInfo.packageName; //包名称
|
||||||
|
// String buildNumber = packageInfo.buildNumber; //小版本号
|
||||||
|
|
||||||
|
Map json = {'downloadPath': Platform.isWindows ? '' : result.appFileUrl, 'version': result.version, 'systemType': deviceType, 'description': result.description ?? 'APP新版本更新'};
|
||||||
|
UpdateAppEvent updateAppEvent = UpdateAppEvent.fromJson(json, localVersion, deviceInfo, appName, packageName, typeName: 'systemType');
|
||||||
if (updateAppEvent.upgrade) {
|
if (updateAppEvent.upgrade) {
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
||||||
|
|
@ -96,6 +148,7 @@ class UpgradeLogic extends GetxController with RequestToolMixin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
} finally {
|
} finally {
|
||||||
showUpgrade.value = false;
|
showUpgrade.value = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import 'package:functional_widget_annotation/functional_widget_annotation.dart';
|
||||||
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_result.dart';
|
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_result.dart';
|
||||||
import 'package:making_school_asignment_app/common/job/marking_models/do_test_questions_image_info.dart';
|
import 'package:making_school_asignment_app/common/job/marking_models/do_test_questions_image_info.dart';
|
||||||
import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart';
|
import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart';
|
||||||
|
import 'package:making_school_asignment_app/common/utils/toast_utils.dart';
|
||||||
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
|
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
|
||||||
import 'package:percent_indicator/linear_percent_indicator.dart';
|
import 'package:percent_indicator/linear_percent_indicator.dart';
|
||||||
|
|
||||||
|
|
@ -100,7 +101,7 @@ Widget $questionNumberScrollView({
|
||||||
});
|
});
|
||||||
var listenVal = sateData.slide.listen((e) {
|
var listenVal = sateData.slide.listen((e) {
|
||||||
if (sateData.panQuestView != null && sateData.panQuestView == true && e != scrollControllerNum.offset) {
|
if (sateData.panQuestView != null && sateData.panQuestView == true && e != scrollControllerNum.offset) {
|
||||||
print("进来了试题题号视图");
|
// print("进来了试题题号视图");
|
||||||
scrollControllerNum.jumpTo(e);
|
scrollControllerNum.jumpTo(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -166,7 +167,7 @@ Widget $scoringQuestionsView(BuildContext context, HomeworkReviewState sateData,
|
||||||
// 校验是否自动提交 对于已经批阅过的试题 不重复自动提交
|
// 校验是否自动提交 对于已经批阅过的试题 不重复自动提交
|
||||||
var annotateTime = logic.state.data.value?.annotateTime;
|
var annotateTime = logic.state.data.value?.annotateTime;
|
||||||
if (annotateTime == null) {
|
if (annotateTime == null) {
|
||||||
var noRatingGiven = studentQuestions!.firstWhereOrNull((e) => e.studentScore == null);
|
var noRatingGiven = studentQuestions!.firstWhereOrNull((e) => e.useTime != 0 && e.studentScore == null);
|
||||||
if (noRatingGiven == null) logic.submit(context);
|
if (noRatingGiven == null) logic.submit(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -187,12 +188,11 @@ Widget $scoringQuestionsView(BuildContext context, HomeworkReviewState sateData,
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
var padinVal = item.correctRate > 0 ? EdgeInsets.only(top: 6.4.h) : EdgeInsets.symmetric(vertical: 2.h);
|
var padinVal = item.correctRate > 0 ? EdgeInsets.only(top: 6.4.h) : EdgeInsets.symmetric(vertical: 2.h);
|
||||||
|
Color buttonColor = item.useTime == 0 ? Colors.grey : const Color.fromRGBO(237, 237, 237, 1); // 当前题没有作答背景色置灰
|
||||||
return Container(
|
return Container(
|
||||||
height: item.height! * scaleRatio * initScale,
|
height: item.height! * scaleRatio * initScale,
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
child: item.useTime == 0
|
child: Stack(
|
||||||
? Container()
|
|
||||||
: Stack(
|
|
||||||
alignment: const FractionalOffset(0, 0),
|
alignment: const FractionalOffset(0, 0),
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
|
|
@ -204,7 +204,7 @@ Widget $scoringQuestionsView(BuildContext context, HomeworkReviewState sateData,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色
|
backgroundColor: buttonColor, // 设置背景色
|
||||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|
@ -216,6 +216,10 @@ Widget $scoringQuestionsView(BuildContext context, HomeworkReviewState sateData,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () => easyThrottle('scoring_homework_questions', () {
|
onPressed: () => easyThrottle('scoring_homework_questions', () {
|
||||||
|
if (item.useTime == 0) {
|
||||||
|
ToastUtils.showInfo("当前第${item.questionNo}题,学生未作答无需批阅此题");
|
||||||
|
return;
|
||||||
|
}
|
||||||
studentScore.value = studentScore.value == 2 ? null : 2;
|
studentScore.value = studentScore.value == 2 ? null : 2;
|
||||||
}, duration: const Duration(milliseconds: 222)),
|
}, duration: const Duration(milliseconds: 222)),
|
||||||
),
|
),
|
||||||
|
|
@ -226,7 +230,7 @@ Widget $scoringQuestionsView(BuildContext context, HomeworkReviewState sateData,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色
|
backgroundColor: buttonColor, // 设置背景色
|
||||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|
@ -238,6 +242,10 @@ Widget $scoringQuestionsView(BuildContext context, HomeworkReviewState sateData,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () => easyThrottle('scoring_homework_questions', () {
|
onPressed: () => easyThrottle('scoring_homework_questions', () {
|
||||||
|
if (item.useTime == 0) {
|
||||||
|
ToastUtils.showInfo("当前第${item.questionNo}题,学生未作答无需批阅此题");
|
||||||
|
return;
|
||||||
|
}
|
||||||
studentScore.value = studentScore.value == 1 ? null : 1;
|
studentScore.value = studentScore.value == 1 ? null : 1;
|
||||||
}, duration: const Duration(milliseconds: 222)),
|
}, duration: const Duration(milliseconds: 222)),
|
||||||
),
|
),
|
||||||
|
|
@ -248,7 +256,7 @@ Widget $scoringQuestionsView(BuildContext context, HomeworkReviewState sateData,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色
|
backgroundColor: buttonColor, // 设置背景色
|
||||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|
@ -260,6 +268,10 @@ Widget $scoringQuestionsView(BuildContext context, HomeworkReviewState sateData,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () => easyThrottle('scoring_homework_questions', () {
|
onPressed: () => easyThrottle('scoring_homework_questions', () {
|
||||||
|
if (item.useTime == 0) {
|
||||||
|
ToastUtils.showInfo("当前第${item.questionNo}题,学生未作答无需批阅此题");
|
||||||
|
return;
|
||||||
|
}
|
||||||
studentScore.value = studentScore.value == 0 ? null : 0;
|
studentScore.value = studentScore.value == 0 ? null : 0;
|
||||||
}, duration: const Duration(milliseconds: 222)),
|
}, duration: const Duration(milliseconds: 222)),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,8 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin,EventBusM
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
if ((state.data.value?.studentQuestions.isEmpty ?? true) || (state.studentQuestions.value?.isEmpty ?? true)) return;
|
if ((state.data.value?.studentQuestions.isEmpty ?? true) || (state.studentQuestions.value?.isEmpty ?? true)) return;
|
||||||
var studentQuestions = state.studentQuestions.value!;
|
var studentQuestions = state.studentQuestions.value!.where((e) => e.useTime != null && e.useTime! > 0).toList();
|
||||||
|
// 跳过学生未作答的题
|
||||||
var noRatingElement = studentQuestions.firstWhereOrNull((e) => e.studentScore == null);
|
var noRatingElement = studentQuestions.firstWhereOrNull((e) => e.studentScore == null);
|
||||||
if (noRatingElement != null) {
|
if (noRatingElement != null) {
|
||||||
ToastUtils.showInfo('${noRatingElement.questionNo}题请评分');
|
ToastUtils.showInfo('${noRatingElement.questionNo}题请评分');
|
||||||
|
|
@ -355,6 +356,7 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin,EventBusM
|
||||||
state.param.value = newParams;
|
state.param.value = newParams;
|
||||||
});
|
});
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
|
print("批阅提交报错 $_");
|
||||||
} finally {
|
} finally {
|
||||||
state.submitLoading.value = false;
|
state.submitLoading.value = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dart';
|
import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dart';
|
||||||
import 'package:making_school_asignment_app/common/store/user_store.dart';
|
import 'package:making_school_asignment_app/common/store/user_store.dart';
|
||||||
|
import 'package:making_school_asignment_app/common/utils/app_upgrade/model/UpdateAppEvent.dart';
|
||||||
import 'package:making_school_asignment_app/common/utils/app_upgrade/upgradeLogic.dart';
|
import 'package:making_school_asignment_app/common/utils/app_upgrade/upgradeLogic.dart';
|
||||||
import 'package:making_school_asignment_app/common/utils/storage.dart';
|
import 'package:making_school_asignment_app/common/utils/storage.dart';
|
||||||
import 'package:making_school_asignment_app/common/utils/toast_utils.dart';
|
import 'package:making_school_asignment_app/common/utils/toast_utils.dart';
|
||||||
|
|
@ -63,9 +64,9 @@ class LoginLogic extends GetxController with RequestToolMixin {
|
||||||
|
|
||||||
void toMsg(msg, [bool error = true]) {
|
void toMsg(msg, [bool error = true]) {
|
||||||
if (error) {
|
if (error) {
|
||||||
ToastUtils.showError(msg);
|
WidgetsBinding.instance.addPostFrameCallback((_) => ToastUtils.showError(msg));
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.showInfo(msg);
|
WidgetsBinding.instance.addPostFrameCallback((_) => ToastUtils.showInfo(msg));
|
||||||
}
|
}
|
||||||
state.canLogin.value = true;
|
state.canLogin.value = true;
|
||||||
}
|
}
|
||||||
|
|
@ -85,9 +86,13 @@ class LoginLogic extends GetxController with RequestToolMixin {
|
||||||
try {
|
try {
|
||||||
/// 检查升级APP
|
/// 检查升级APP
|
||||||
if (userName != 'AppleTester' && const bool.fromEnvironment('dart.vm.product')) {
|
if (userName != 'AppleTester' && const bool.fromEnvironment('dart.vm.product')) {
|
||||||
|
UpdateAppEvent? updateAppEvent = await upgradeLogic.getUpdateAppEvent();
|
||||||
|
var upgrade = updateAppEvent?.upgrade ?? false;
|
||||||
|
if (upgrade) {
|
||||||
upgradeLogic.getAppUpgrade(Get.context ?? context);
|
upgradeLogic.getAppUpgrade(Get.context ?? context);
|
||||||
return toMsg('请在升级APP后再次登陆', false);
|
return toMsg('请在升级APP后再次登陆', false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
await getClient().toLogin(userName, userPwd);
|
await getClient().toLogin(userName, userPwd);
|
||||||
String? nameidentifier = UserStore.to.userInfo.value?.nameidentifier;
|
String? nameidentifier = UserStore.to.userInfo.value?.nameidentifier;
|
||||||
if (nameidentifier == null) {
|
if (nameidentifier == null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue