Commit be51012f by 吴春元

bug 修改

parent f8c76167
...@@ -7,11 +7,11 @@ class Api { ...@@ -7,11 +7,11 @@ class Api {
// IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2212/"; // IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2212/";
///演示 ip ///演示 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.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/", static String START_URL = "special/a/",
END_URL = "__ajax=true&mobileLogin=true"; END_URL = "__ajax=true&mobileLogin=true";
......
...@@ -4,6 +4,7 @@ import 'dart:developer'; ...@@ -4,6 +4,7 @@ import 'dart:developer';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.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/dio/dio/do_utils.dart';
import 'package:special_equipment_flutter/model/app_is_open.dart'; import 'package:special_equipment_flutter/model/app_is_open.dart';
import 'package:special_equipment_flutter/model/app_roles.dart'; import 'package:special_equipment_flutter/model/app_roles.dart';
...@@ -44,6 +45,7 @@ import 'package:special_equipment_flutter/model/upload_multifile.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/user_list.dart';
import 'package:special_equipment_flutter/model/week_control_list_sy_bo.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/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/storage_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart'; import 'package:special_equipment_flutter/utils/toast_utils.dart';
...@@ -1238,12 +1240,41 @@ class HttpUtils { ...@@ -1238,12 +1240,41 @@ class HttpUtils {
'交卷中'); '交卷中');
try { try {
BaseModel entity = BaseModel.fromJson(response); BaseModel entity = BaseModel.fromJson(response);
Map<String, dynamic> resultData = entity.body; if (entity.success!) {
ExamResultBo examResultBo = ExamResultBo.fromJson(resultData); Map<String, dynamic> resultData = entity.body;
if (entity.errorCode == "-1") { ExamResultBo examResultBo = ExamResultBo.fromJson(resultData);
return examResultBo; if (entity.errorCode == "-1") {
return examResultBo;
} else {
ToastUtils.showCenter(entity.msg!);
return;
}
} else { } else {
ToastUtils.showCenter(entity.msg!); 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; return;
} }
} catch (e) { } catch (e) {
......
...@@ -162,7 +162,9 @@ class NetUtils { ...@@ -162,7 +162,9 @@ class NetUtils {
ToastUtils.showCenter(entity.msg!); ToastUtils.showCenter(entity.msg!);
} }
} else { } else {
ToastUtils.showCenter(entity.msg!); if (entity.msg != '试卷已被安全监察人员删除,请查看是否有新试卷!') {
ToastUtils.showCenter(entity.msg!);
}
} }
isLoading ? Loading.dismiss() : null; isLoading ? Loading.dismiss() : null;
return response.data; return response.data;
......
...@@ -53,6 +53,8 @@ class UserLists { ...@@ -53,6 +53,8 @@ class UserLists {
String? roleNames; String? roleNames;
bool? admin; bool? admin;
bool? isChecked = false; bool? isChecked = false;
bool? isUserSafetyDirectorChecked = true;
bool? isUserSafetyOfficerChecked = true;
UserLists copyWith({ UserLists copyWith({
String? id, String? id,
......
...@@ -82,6 +82,7 @@ class _HomePageState extends State<HomePage> ...@@ -82,6 +82,7 @@ class _HomePageState extends State<HomePage>
List<CountData>? findCountList = []; List<CountData>? findCountList = [];
ExaminePersonBo? mExaminePersonBo = ExaminePersonBo(); ExaminePersonBo? mExaminePersonBo = ExaminePersonBo();
OverseerHistoryListBo? mOverseerHistoryListBo = OverseerHistoryListBo(); OverseerHistoryListBo? mOverseerHistoryListBo = OverseerHistoryListBo();
int mOverseerHistoryCount = 0;
List<HistoryListData>? mHistoryListData = []; List<HistoryListData>? mHistoryListData = [];
//声明,后面需要销毁 //声明,后面需要销毁
...@@ -152,6 +153,7 @@ class _HomePageState extends State<HomePage> ...@@ -152,6 +153,7 @@ class _HomePageState extends State<HomePage>
if (mounted) { if (mounted) {
setState(() { setState(() {
mOverseerHistoryListBo = value; mOverseerHistoryListBo = value;
mOverseerHistoryCount = mOverseerHistoryListBo!.count!;
mHistoryListData = mOverseerHistoryListBo!.data; mHistoryListData = mOverseerHistoryListBo!.data;
}); });
} }
...@@ -489,7 +491,9 @@ class _HomePageState extends State<HomePage> ...@@ -489,7 +491,9 @@ class _HomePageState extends State<HomePage>
onTap: () { onTap: () {
Get.toNamed(RouteString.OVERSEER_HISTORY_LIST_PAGE, Get.toNamed(RouteString.OVERSEER_HISTORY_LIST_PAGE,
arguments: {})?.then((value) { arguments: {})?.then((value) {
if (value != null && value) {} if (value != null && value) {
getOverseerHistoryList();
}
}); });
}, },
child: Container( child: Container(
...@@ -524,7 +528,7 @@ class _HomePageState extends State<HomePage> ...@@ -524,7 +528,7 @@ class _HomePageState extends State<HomePage>
style: TextStyle(fontSize: 12, color: Colors.orange)), style: TextStyle(fontSize: 12, color: Colors.orange)),
TextSpan( TextSpan(
text: mOverseerHistoryListBo != null text: mOverseerHistoryListBo != null
? mOverseerHistoryListBo!.count.toString() ? mOverseerHistoryCount.toString()
: '0', : '0',
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
...@@ -544,7 +548,8 @@ class _HomePageState extends State<HomePage> ...@@ -544,7 +548,8 @@ class _HomePageState extends State<HomePage>
}), }),
] else ...[ ] else ...[
Container( 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( child: ListView.separated(
shrinkWrap: true, shrinkWrap: true,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
...@@ -562,7 +567,9 @@ class _HomePageState extends State<HomePage> ...@@ -562,7 +567,9 @@ class _HomePageState extends State<HomePage>
arguments: { arguments: {
'id': mHistoryListData![index].id, 'id': mHistoryListData![index].id,
})?.then((value) { })?.then((value) {
if (value != null && value) {} if (value != null && value) {
getOverseerHistoryList();
}
}); });
}, },
child: Card( child: Card(
...@@ -746,6 +753,7 @@ class _HomePageState extends State<HomePage> ...@@ -746,6 +753,7 @@ class _HomePageState extends State<HomePage>
mHistoryListData! mHistoryListData!
.removeAt( .removeAt(
index); index);
mOverseerHistoryCount--;
ToastUtils ToastUtils
.showCenter( .showCenter(
'删除成功'); '删除成功');
...@@ -788,7 +796,9 @@ class _HomePageState extends State<HomePage> ...@@ -788,7 +796,9 @@ class _HomePageState extends State<HomePage>
'id': mHistoryListData![index] 'id': mHistoryListData![index]
.id, .id,
})?.then((value) { })?.then((value) {
if (value != null && value) {} if (value != null && value) {
getOverseerHistoryList();
}
}); });
}, },
width: 60, width: 60,
......
...@@ -6,6 +6,7 @@ import 'package:special_equipment_flutter/common/edgeInsets_const.dart'; ...@@ -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/common/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.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/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/storage_util.dart';
import 'package:special_equipment_flutter/utils/string_utils.dart'; import 'package:special_equipment_flutter/utils/string_utils.dart';
import 'package:special_equipment_flutter/utils/time_util.dart'; import 'package:special_equipment_flutter/utils/time_util.dart';
...@@ -69,37 +70,43 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> { ...@@ -69,37 +70,43 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
appBar: AppBarCustom(text: '考核列表', height: 50), onWillPop: () async {
backgroundColor: Colors.grey[100], Get.back(result: true);
body: Column( return true; // 控制是否可以侧滑返回,true为允许,false为不允许
children: [ },
Expanded( child: Scaffold(
flex: 1, appBar: AppBarCustom(text: '考核列表', height: 50),
child: EasyRefresh( backgroundColor: Colors.grey[100],
firstRefresh: true, body: Column(
enableControlFinishRefresh: true, children: [
enableControlFinishLoad: true, Expanded(
firstRefreshWidget: const FirstRefreshWidget(), flex: 1,
emptyWidget: mHistoryListData!.isEmpty child: EasyRefresh(
? EmptyImgWidget( firstRefresh: true,
title: '暂无数据,点击刷新', enableControlFinishRefresh: true,
onTap: () { enableControlFinishLoad: true,
getOverseerHistoryList(); firstRefreshWidget: const FirstRefreshWidget(),
}) emptyWidget: mHistoryListData!.isEmpty
: null, ? EmptyImgWidget(
controller: _controller, title: '暂无数据,点击刷新',
onRefresh: () async { onTap: () {
page = 1; getOverseerHistoryList();
getOverseerHistoryList(); })
}, : null,
onLoad: () async { controller: _controller,
page++; onRefresh: () async {
getOverseerHistoryList(); page = 1;
}, getOverseerHistoryList();
child: buildBody(), },
)), onLoad: () async {
], page++;
getOverseerHistoryList();
},
child: buildBody(),
)),
],
),
), ),
); );
} }
...@@ -271,6 +278,9 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> { ...@@ -271,6 +278,9 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
setState(() { setState(() {
mHistoryListData! mHistoryListData!
.removeAt(index); .removeAt(index);
//发出通知
EventBusUtils.getInstance()
?.fire("2");
ToastUtils.showCenter('删除成功'); ToastUtils.showCenter('删除成功');
Get.back(); Get.back();
}); });
......
...@@ -54,3 +54,9 @@ String timestampToDate(int timestamp) { ...@@ -54,3 +54,9 @@ String timestampToDate(int timestamp) {
var formatter = DateFormat('yyyy-MM-dd HH:mm:ss'); var formatter = DateFormat('yyyy-MM-dd HH:mm:ss');
return formatter.format(date); 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