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,12 +1240,41 @@ class HttpUtils {
'交卷中');
try {
BaseModel entity = BaseModel.fromJson(response);
Map<String, dynamic> resultData = entity.body;
ExamResultBo examResultBo = ExamResultBo.fromJson(resultData);
if (entity.errorCode == "-1") {
return examResultBo;
if (entity.success!) {
Map<String, dynamic> resultData = entity.body;
ExamResultBo examResultBo = ExamResultBo.fromJson(resultData);
if (entity.errorCode == "-1") {
return examResultBo;
} else {
ToastUtils.showCenter(entity.msg!);
return;
}
} 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;
}
} catch (e) {
......
......@@ -162,7 +162,9 @@ class NetUtils {
ToastUtils.showCenter(entity.msg!);
}
} else {
ToastUtils.showCenter(entity.msg!);
if (entity.msg != '试卷已被安全监察人员删除,请查看是否有新试卷!') {
ToastUtils.showCenter(entity.msg!);
}
}
isLoading ? Loading.dismiss() : null;
return response.data;
......
......@@ -53,6 +53,8 @@ class UserLists {
String? roleNames;
bool? admin;
bool? isChecked = false;
bool? isUserSafetyDirectorChecked = true;
bool? isUserSafetyOfficerChecked = true;
UserLists copyWith({
String? id,
......
......@@ -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,
......
......@@ -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,37 +70,43 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBarCustom(text: '考核列表', height: 50),
backgroundColor: Colors.grey[100],
body: Column(
children: [
Expanded(
flex: 1,
child: EasyRefresh(
firstRefresh: true,
enableControlFinishRefresh: true,
enableControlFinishLoad: true,
firstRefreshWidget: const FirstRefreshWidget(),
emptyWidget: mHistoryListData!.isEmpty
? EmptyImgWidget(
title: '暂无数据,点击刷新',
onTap: () {
getOverseerHistoryList();
})
: null,
controller: _controller,
onRefresh: () async {
page = 1;
getOverseerHistoryList();
},
onLoad: () async {
page++;
getOverseerHistoryList();
},
child: buildBody(),
)),
],
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(
children: [
Expanded(
flex: 1,
child: EasyRefresh(
firstRefresh: true,
enableControlFinishRefresh: true,
enableControlFinishLoad: true,
firstRefreshWidget: const FirstRefreshWidget(),
emptyWidget: mHistoryListData!.isEmpty
? EmptyImgWidget(
title: '暂无数据,点击刷新',
onTap: () {
getOverseerHistoryList();
})
: null,
controller: _controller,
onRefresh: () async {
page = 1;
getOverseerHistoryList();
},
onLoad: () async {
page++;
getOverseerHistoryList();
},
child: buildBody(),
)),
],
),
),
);
}
......@@ -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