Commit be51012f by 吴春元

bug 修改

parent f8c76167
......@@ -7,11 +7,11 @@ class Api {
// IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2212/";
///演示 ip
// static String URL = "http://47.92.138.92:8009/";
static String URL = "http://47.92.138.92:8009/";
// static String URL = "http://192.168.19.164:8087/";
static String URL = "http://192.168.19.165:2212/";
// static String URL = "http://192.168.19.165:2212/";
static String START_URL = "special/a/",
END_URL = "__ajax=true&mobileLogin=true";
......
......@@ -4,6 +4,7 @@ import 'dart:developer';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:get/route_manager.dart';
import 'package:special_equipment_flutter/dio/dio/do_utils.dart';
import 'package:special_equipment_flutter/model/app_is_open.dart';
import 'package:special_equipment_flutter/model/app_roles.dart';
......@@ -44,6 +45,7 @@ import 'package:special_equipment_flutter/model/upload_multifile.dart';
import 'package:special_equipment_flutter/model/user_list.dart';
import 'package:special_equipment_flutter/model/week_control_list_sy_bo.dart';
import 'package:special_equipment_flutter/ui/common/data.dart';
import 'package:special_equipment_flutter/utils/eventbus_utils.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
......@@ -1238,6 +1240,7 @@ class HttpUtils {
'交卷中');
try {
BaseModel entity = BaseModel.fromJson(response);
if (entity.success!) {
Map<String, dynamic> resultData = entity.body;
ExamResultBo examResultBo = ExamResultBo.fromJson(resultData);
if (entity.errorCode == "-1") {
......@@ -1246,6 +1249,34 @@ class HttpUtils {
ToastUtils.showCenter(entity.msg!);
return;
}
} else {
showDialog(
context: context,
barrierDismissible: false,
builder: (context) {
return AlertDialog(
title: const Text("温馨提示"),
content: Text(entity.msg!),
actionsPadding: const EdgeInsets.only(
left: 0, top: 0, bottom: 10, right: 20),
contentPadding: const EdgeInsets.only(
left: 20, top: 0, bottom: 10, right: 20),
titlePadding: const EdgeInsets.only(
left: 20, top: 20, bottom: 10, right: 20),
actions: [
TextButton(
child: const Text("确定"),
onPressed: () {
//发出通知
EventBusUtils.getInstance()?.fire("1");
Get.back();
Get.back();
})
],
);
});
return;
}
} catch (e) {
log(e.toString());
return {"message": e.toString()};
......
......@@ -162,8 +162,10 @@ class NetUtils {
ToastUtils.showCenter(entity.msg!);
}
} else {
if (entity.msg != '试卷已被安全监察人员删除,请查看是否有新试卷!') {
ToastUtils.showCenter(entity.msg!);
}
}
isLoading ? Loading.dismiss() : null;
return response.data;
} on DioError catch (e) {
......
......@@ -53,6 +53,8 @@ class UserLists {
String? roleNames;
bool? admin;
bool? isChecked = false;
bool? isUserSafetyDirectorChecked = true;
bool? isUserSafetyOfficerChecked = true;
UserLists copyWith({
String? id,
......
......@@ -108,7 +108,39 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
return Scaffold(
return WillPopScope(
onWillPop: () async {
Get.dialog(AlertDialog(
title: const Text("温馨提示"),
content: const Text("您确定要结束当前考试?"),
actionsPadding:
const EdgeInsets.only(left: 0, top: 0, bottom: 10, right: 20),
contentPadding:
const EdgeInsets.only(left: 20, top: 0, bottom: 10, right: 20),
titlePadding:
const EdgeInsets.only(left: 20, top: 20, bottom: 10, right: 20),
shape: const RoundedRectangleBorder(
// 这里设置shape属性
borderRadius: BorderRadius.all(Radius.circular(10.0))),
actions: <Widget>[
TextButton(
child: const Text("取消", style: TextStyle(fontSize: 16)),
onPressed: () {
Get.back();
},
),
TextButton(
child: const Text("确定", style: TextStyle(fontSize: 16)),
onPressed: () {
Get.back();
Get.back();
},
),
],
));
return true; // 控制是否可以侧滑返回,true为允许,false为不允许
},
child: Scaffold(
backgroundColor: Colors.grey[100],
appBar: AppBarCustom(
leading: IconButton(
......@@ -212,7 +244,8 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
color: ColorConst.blueColor,
fontWeight: FontWeight.bold)),
TextSpan(
text: " /${examQuestionList!.length}",
text:
" /${examQuestionList!.length}",
style: const TextStyle(
fontSize: 15,
color: Colors.black87)),
......@@ -224,8 +257,8 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
),
Container(
height: 380,
margin:
const EdgeInsets.only(top: 0, left: 10, right: 10),
margin: const EdgeInsets.only(
top: 0, left: 10, right: 10),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: Colors.white,
......@@ -259,7 +292,8 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
///内容区
body: Column(children: [buildExpanded()]),
));
)),
);
}
Container buildSliverToBoxAdapter(var text) {
......@@ -519,8 +553,6 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
onPressed: () {
//关闭弹窗
Get.back();
// printLog(
// "《考核-交卷》提交json数据----->${json.encode(examineQuestionsBo)}");
HttpUtils.getExamSubmit(context, examineQuestionsBo)
.then((value) {
ExamResultBo examResultBo = value;
......
......@@ -54,10 +54,43 @@ class _ExamResultPageState extends State<ExamResultPage> {
padding: EdgeInsets.zero,
),
),
body: Container(
body: Column(
children: [
Container(
width: double.infinity,
margin:
const EdgeInsets.only(left: 15, right: 15, top: 20, bottom: 0),
padding:
const EdgeInsets.only(left: 5, right: 5, top: 3, bottom: 3),
decoration: BoxDecoration(
color: Colors.orange[50],
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(5),
topRight: Radius.circular(5),
bottomLeft: Radius.circular(5),
bottomRight: Radius.circular(5))),
child: const Text.rich(
softWrap: true,
TextSpan(children: [
TextSpan(
text: "小提示:考核成绩 ",
style: TextStyle(fontSize: 14, color: Colors.orange)),
TextSpan(
text: '90',
style: TextStyle(
fontSize: 20,
color: Colors.green,
fontWeight: FontWeight.bold)),
TextSpan(
text: " 为合格",
style: TextStyle(fontSize: 14, color: Colors.orange))
])),
),
Container(
height: 300,
width: double.infinity,
margin: const EdgeInsets.only(top: 15, left: 15, right: 15, bottom: 15),
margin:
const EdgeInsets.only(top: 5, left: 15, right: 15, bottom: 15),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: Colors.white,
......@@ -65,7 +98,6 @@ class _ExamResultPageState extends State<ExamResultPage> {
),
child: Column(
children: [
const SizedBox(height: 10),
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
......@@ -84,8 +116,9 @@ class _ExamResultPageState extends State<ExamResultPage> {
Text(
examResultDataBo!.score!.round().toString(),
style: TextStyle(
color:
examResultDataBo!.score! < 90 ? Colors.red : Colors.green,
color: examResultDataBo!.score! < 90
? Colors.red
: Colors.green,
fontSize: 20,
fontWeight: FontWeight.bold),
),
......@@ -119,10 +152,11 @@ class _ExamResultPageState extends State<ExamResultPage> {
TextSpan(children: [
const TextSpan(
text: "答对 ",
style:
TextStyle(fontSize: 14, color: Colors.grey)),
style: TextStyle(
fontSize: 14, color: Colors.grey)),
TextSpan(
text: "${examResultDataBo!.correct.toString()}题",
text:
"${examResultDataBo!.correct.toString()}题",
style: const TextStyle(
fontSize: 14, color: Colors.black87)),
])),
......@@ -132,10 +166,11 @@ class _ExamResultPageState extends State<ExamResultPage> {
TextSpan(children: [
const TextSpan(
text: "答错 ",
style:
TextStyle(fontSize: 14, color: Colors.grey)),
style: TextStyle(
fontSize: 14, color: Colors.grey)),
TextSpan(
text: "${examResultDataBo!.error.toString()}题",
text:
"${examResultDataBo!.error.toString()}题",
style: const TextStyle(
fontSize: 14, color: Colors.black87)),
])),
......@@ -145,8 +180,8 @@ class _ExamResultPageState extends State<ExamResultPage> {
TextSpan(children: [
const TextSpan(
text: "总题 ",
style:
TextStyle(fontSize: 14, color: Colors.grey)),
style: TextStyle(
fontSize: 14, color: Colors.grey)),
TextSpan(
text:
"${examResultDataBo!.questionNum.toString()}题",
......@@ -186,6 +221,8 @@ class _ExamResultPageState extends State<ExamResultPage> {
],
),
),
],
),
);
}
......
......@@ -3,17 +3,13 @@ import 'package:get/get.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/exam/exam_result_bo.dart';
import 'package:special_equipment_flutter/model/exam/test_questions_bo.dart';
import 'package:special_equipment_flutter/model/exam/test_setting_bo.dart';
import 'package:special_equipment_flutter/ui/examine/test/custom/bottom_sheet.dart';
import 'package:special_equipment_flutter/ui/examine/test/custom/choice_item.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar_back.dart';
import 'package:special_equipment_flutter/widgets/custom_button.dart';
import '../../../common/route_string.dart';
///考核答题页面
class TestPage extends StatefulWidget {
var arguments = Get.arguments;
......@@ -85,7 +81,39 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
return Scaffold(
return WillPopScope(
onWillPop: () async {
Get.dialog(AlertDialog(
title: const Text("温馨提示"),
content: const Text("您确定要结束当前练习吗?"),
actionsPadding:
const EdgeInsets.only(left: 0, top: 0, bottom: 10, right: 20),
contentPadding:
const EdgeInsets.only(left: 20, top: 0, bottom: 10, right: 20),
titlePadding:
const EdgeInsets.only(left: 20, top: 20, bottom: 10, right: 20),
shape: const RoundedRectangleBorder(
// 这里设置shape属性
borderRadius: BorderRadius.all(Radius.circular(10.0))),
actions: <Widget>[
TextButton(
child: const Text("取消", style: TextStyle(fontSize: 16)),
onPressed: () {
Get.back();
},
),
TextButton(
child: const Text("确定", style: TextStyle(fontSize: 16)),
onPressed: () {
Get.back();
Get.back();
},
),
],
));
return true; // 控制是否可以侧滑返回,true为允许,false为不允许
},
child: Scaffold(
backgroundColor: Colors.white,
appBar: AppBarCustom(
leading: IconButton(
......@@ -189,7 +217,8 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin {
color: ColorConst.blueColor,
fontWeight: FontWeight.bold)),
TextSpan(
text: " /${examQuestionList!.length}",
text:
" /${examQuestionList!.length}",
style: const TextStyle(
fontSize: 15,
color: Colors.black87)),
......@@ -201,8 +230,8 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin {
),
Container(
height: 380,
margin:
const EdgeInsets.only(top: 0, left: 10, right: 10),
margin: const EdgeInsets.only(
top: 0, left: 10, right: 10),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: Colors.white,
......@@ -236,7 +265,8 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin {
///内容区
body: Column(children: [buildExpanded()]),
));
)),
);
}
Container buildSliverToBoxAdapter(var text) {
......
......@@ -82,6 +82,7 @@ class _HomePageState extends State<HomePage>
List<CountData>? findCountList = [];
ExaminePersonBo? mExaminePersonBo = ExaminePersonBo();
OverseerHistoryListBo? mOverseerHistoryListBo = OverseerHistoryListBo();
int mOverseerHistoryCount = 0;
List<HistoryListData>? mHistoryListData = [];
//声明,后面需要销毁
......@@ -152,6 +153,7 @@ class _HomePageState extends State<HomePage>
if (mounted) {
setState(() {
mOverseerHistoryListBo = value;
mOverseerHistoryCount = mOverseerHistoryListBo!.count!;
mHistoryListData = mOverseerHistoryListBo!.data;
});
}
......@@ -489,7 +491,9 @@ class _HomePageState extends State<HomePage>
onTap: () {
Get.toNamed(RouteString.OVERSEER_HISTORY_LIST_PAGE,
arguments: {})?.then((value) {
if (value != null && value) {}
if (value != null && value) {
getOverseerHistoryList();
}
});
},
child: Container(
......@@ -524,7 +528,7 @@ class _HomePageState extends State<HomePage>
style: TextStyle(fontSize: 12, color: Colors.orange)),
TextSpan(
text: mOverseerHistoryListBo != null
? mOverseerHistoryListBo!.count.toString()
? mOverseerHistoryCount.toString()
: '0',
style: const TextStyle(
fontSize: 16,
......@@ -544,7 +548,8 @@ class _HomePageState extends State<HomePage>
}),
] else ...[
Container(
margin: const EdgeInsets.only(left: 5, right: 5, top: 0, bottom: 0),
margin:
const EdgeInsets.only(left: 5, right: 5, top: 0, bottom: 30),
child: ListView.separated(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
......@@ -562,7 +567,9 @@ class _HomePageState extends State<HomePage>
arguments: {
'id': mHistoryListData![index].id,
})?.then((value) {
if (value != null && value) {}
if (value != null && value) {
getOverseerHistoryList();
}
});
},
child: Card(
......@@ -746,6 +753,7 @@ class _HomePageState extends State<HomePage>
mHistoryListData!
.removeAt(
index);
mOverseerHistoryCount--;
ToastUtils
.showCenter(
'删除成功');
......@@ -788,7 +796,9 @@ class _HomePageState extends State<HomePage>
'id': mHistoryListData![index]
.id,
})?.then((value) {
if (value != null && value) {}
if (value != null && value) {
getOverseerHistoryList();
}
});
},
width: 60,
......
......@@ -8,6 +8,7 @@ import 'package:special_equipment_flutter/model/exam/overseer_history_informatio
import 'package:special_equipment_flutter/utils/size_config.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/time_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart';
import '../../widgets/app_bar/custom_app_bar.dart';
......@@ -69,7 +70,12 @@ class _OverseerHistroyDetailsPageState
@override
Widget build(BuildContext context) {
return Scaffold(
return WillPopScope(
onWillPop: () async {
Get.back(result: true);
return true; // 控制是否可以侧滑返回,true为允许,false为不允许
},
child: Scaffold(
backgroundColor: ColorConst.grayf5Color,
appBar: AppBarCustom(
text: '监察记录详情',
......@@ -193,7 +199,7 @@ class _OverseerHistroyDetailsPageState
style: TextStyle(
fontSize: 14, color: Colors.black54)),
TextSpan(
text: timestampToDate(
text: timestampToDate2(
data != null ? data!.createDate! : 0),
style: const TextStyle(
fontSize: 14, color: Colors.black54)),
......@@ -228,7 +234,8 @@ class _OverseerHistroyDetailsPageState
ListView.separated(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
horizontal: EdgeInsetsConst.padding_horizontal),
horizontal:
EdgeInsetsConst.padding_horizontal),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return Container(
......@@ -246,7 +253,8 @@ class _OverseerHistroyDetailsPageState
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
......@@ -265,8 +273,9 @@ class _OverseerHistroyDetailsPageState
: '已完成',
style: TextStyle(
fontSize: 14,
color:
rowList![index].adopt == "0"
color: rowList![index]
.adopt ==
"0"
? ColorConst.red1BgColor
: ColorConst.greenColor,
fontWeight: FontWeight.bold)),
......@@ -319,8 +328,8 @@ class _OverseerHistroyDetailsPageState
.toString(),
style: const TextStyle(
fontSize: 16,
color:
ColorConst.greenColor,
color: ColorConst
.greenColor,
fontWeight:
FontWeight.bold)),
const TextSpan(
......@@ -380,7 +389,8 @@ class _OverseerHistroyDetailsPageState
// ),
// )
],
));
)),
);
}
Container buildTitleContainer(
......
......@@ -6,6 +6,7 @@ import 'package:special_equipment_flutter/common/edgeInsets_const.dart';
import 'package:special_equipment_flutter/common/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/exam/overseer_history_list_bo.dart';
import 'package:special_equipment_flutter/utils/eventbus_utils.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/string_utils.dart';
import 'package:special_equipment_flutter/utils/time_util.dart';
......@@ -69,7 +70,12 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
return WillPopScope(
onWillPop: () async {
Get.back(result: true);
return true; // 控制是否可以侧滑返回,true为允许,false为不允许
},
child: Scaffold(
appBar: AppBarCustom(text: '考核列表', height: 50),
backgroundColor: Colors.grey[100],
body: Column(
......@@ -101,6 +107,7 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
)),
],
),
),
);
}
......@@ -271,6 +278,9 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
setState(() {
mHistoryListData!
.removeAt(index);
//发出通知
EventBusUtils.getInstance()
?.fire("2");
ToastUtils.showCenter('删除成功');
Get.back();
});
......
......@@ -54,3 +54,9 @@ String timestampToDate(int timestamp) {
var formatter = DateFormat('yyyy-MM-dd HH:mm:ss');
return formatter.format(date);
}
String timestampToDate2(int timestamp) {
var date = DateTime.fromMillisecondsSinceEpoch(timestamp);
var formatter = DateFormat('yyyy-MM-dd');
return formatter.format(date);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment