Commit c7a2c67d by York

样式 历史问题调整 增加提示性语言

parent e9d7e7c9
...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
class Api { class Api {
static var IS_DEBUG = true; static var IS_DEBUG = true;
// static String URL = static String URL =
// IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2222/"; IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2222/";
///演示 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.165:2222/";
static String URL = "http://192.168.19.215:8181/"; // static String URL = "http://192.168.19.215:8181/";
static String START_URL = "special/a/", static String START_URL = "special/a/",
END_URL = "__ajax=true&mobileLogin=true"; END_URL = "__ajax=true&mobileLogin=true";
......
...@@ -1311,11 +1311,12 @@ class HttpUtils { ...@@ -1311,11 +1311,12 @@ class HttpUtils {
} }
///获取练习题库 ///获取练习题库
static Future getTestQuestions( static Future getTestQuestions(BuildContext context, typeId, positionType,
BuildContext context, typeId, questionNum, dxNum, pdNum) async { questionNum, dxNum, pdNum) async {
Map<String, dynamic> params = { Map<String, dynamic> params = {
'user.id': StorageUtil.getInstance().getUserId(), 'user.id': StorageUtil.getInstance().getUserId(),
'type.id': typeId, 'type.id': typeId,
'positionType': positionType,
'questionNum': questionNum, 'questionNum': questionNum,
'dxNum': dxNum, 'dxNum': dxNum,
'pdNum': pdNum 'pdNum': pdNum
......
class RoleList {
String? id;
String? name;
}
...@@ -87,7 +87,7 @@ class _ExamResultPageState extends State<ExamResultPage> { ...@@ -87,7 +87,7 @@ class _ExamResultPageState extends State<ExamResultPage> {
])), ])),
), ),
Container( Container(
height: 300, height: 350,
width: double.infinity, width: double.infinity,
margin: margin:
const EdgeInsets.only(top: 5, left: 15, right: 15, bottom: 15), const EdgeInsets.only(top: 5, left: 15, right: 15, bottom: 15),
...@@ -98,28 +98,34 @@ class _ExamResultPageState extends State<ExamResultPage> { ...@@ -98,28 +98,34 @@ class _ExamResultPageState extends State<ExamResultPage> {
), ),
child: Column( child: Column(
children: [ children: [
const Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Container(
height: 40,
),
const Text(
'—————— ', '—————— ',
style: TextStyle(color: ColorConst.grayf5Color), style: TextStyle(color: ColorConst.grayf5Color),
), ),
Text('本次考核成绩'), const Text(
Text( '本次考核成绩',
style: TextStyle(fontSize: 16),
),
const Text(
' ——————', ' ——————',
style: TextStyle(color: ColorConst.grayf5Color), style: TextStyle(color: ColorConst.grayf5Color),
) )
], ],
), ),
const SizedBox(height: 10), // const SizedBox(height: 10),
Text( Text(
examResultDataBo!.score!.round().toString(), examResultDataBo!.score!.round().toString(),
style: TextStyle( style: TextStyle(
color: examResultDataBo!.score! >= 90 color: examResultDataBo!.score! >= 90
? Colors.green ? Colors.green
: Colors.red, : Colors.red,
fontSize: 20, fontSize: 50,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
......
...@@ -37,11 +37,13 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin { ...@@ -37,11 +37,13 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin {
List<ExamQuestionTestList>? examQuestionDList = []; //选择题 List<ExamQuestionTestList>? examQuestionDList = []; //选择题
List<ExamQuestionTestList>? examQuestionPList = []; //判断题 List<ExamQuestionTestList>? examQuestionPList = []; //判断题
TestSubmitBo? mTestSubmitBo; TestSubmitBo? mTestSubmitBo;
var positionType = '';
@override @override
void initState() { void initState() {
super.initState(); super.initState();
mTestSubmitBo = widget.arguments['mTestSubmitBo']; mTestSubmitBo = widget.arguments['mTestSubmitBo'];
positionType = widget.arguments['positionType'];
getQuestionsData(); getQuestionsData();
_controller = AnimationController( _controller = AnimationController(
...@@ -57,7 +59,7 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin { ...@@ -57,7 +59,7 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin {
///获取考核试卷 ///获取考核试卷
void getQuestionsData() { void getQuestionsData() {
HttpUtils.getTestQuestions( HttpUtils.getTestQuestions(
context, mTestSubmitBo!.mEquiList!.id, "0", "0", "0") context, mTestSubmitBo!.mEquiList!.id, positionType, "0", "0", "0")
.then((value) { .then((value) {
TestQuestionsBo listBo = value; TestQuestionsBo listBo = value;
if (mounted) { if (mounted) {
......
...@@ -6,15 +6,19 @@ import 'package:special_equipment_flutter/dio/http_utils.dart'; ...@@ -6,15 +6,19 @@ import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/exam/eq_question_bo.dart'; import 'package:special_equipment_flutter/model/exam/eq_question_bo.dart';
import 'package:special_equipment_flutter/model/exam/equipment_list_bo.dart'; import 'package:special_equipment_flutter/model/exam/equipment_list_bo.dart';
import 'package:special_equipment_flutter/model/exam/test_setting_bo.dart'; import 'package:special_equipment_flutter/model/exam/test_setting_bo.dart';
import 'package:special_equipment_flutter/model/role_bo.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';
import 'package:special_equipment_flutter/widgets/custom_button.dart'; import 'package:special_equipment_flutter/widgets/custom_button.dart';
import 'package:special_equipment_flutter/widgets/custom_textfield.dart'; import 'package:special_equipment_flutter/widgets/custom_textfield.dart';
import 'package:special_equipment_flutter/widgets/tip.dart';
///测试练习设置 ///测试练习设置
class TestSettingPage extends StatefulWidget { class TestSettingPage extends StatefulWidget {
TestSettingPage({super.key}); TestSettingPage({super.key});
var arguments = Get.arguments;
@override @override
State<TestSettingPage> createState() => _TestSettingPageState(); State<TestSettingPage> createState() => _TestSettingPageState();
} }
...@@ -22,6 +26,8 @@ class TestSettingPage extends StatefulWidget { ...@@ -22,6 +26,8 @@ class TestSettingPage extends StatefulWidget {
class _TestSettingPageState extends State<TestSettingPage> { class _TestSettingPageState extends State<TestSettingPage> {
TextEditingController? equipmentText = TextEditingController(); TextEditingController? equipmentText = TextEditingController();
FocusNode? equipmentFocusNode = FocusNode(); FocusNode? equipmentFocusNode = FocusNode();
TextEditingController? roleText = TextEditingController();
FocusNode? roleFocusNode = FocusNode();
TextEditingController? singleText = TextEditingController(); TextEditingController? singleText = TextEditingController();
FocusNode? singleZJFocusNode = FocusNode(); FocusNode? singleZJFocusNode = FocusNode();
TextEditingController? judgmentText = TextEditingController(); TextEditingController? judgmentText = TextEditingController();
...@@ -29,12 +35,54 @@ class _TestSettingPageState extends State<TestSettingPage> { ...@@ -29,12 +35,54 @@ class _TestSettingPageState extends State<TestSettingPage> {
int allQuestions = 0; int allQuestions = 0;
EquiList? mEquiList; EquiList? mEquiList;
DataEq? mDataEq; DataEq? mDataEq;
var unitType = '1';
List<UserData>? roleUserLists = [];
var roleId = '', roleName = '';
@override @override
void initState() { void initState() {
super.initState(); super.initState();
// getFindQuestionNum(); // getFindQuestionNum();
// getFindEqQuestionNum(true); // getFindEqQuestionNum(true);
unitType = widget.arguments['unitType'];
String roles = widget.arguments['roles'];
var roleLists = roles.split(',');
if (roleLists.contains('主要负责人')) {
roleLists.remove('主要负责人');
}
for (var name in roleLists) {
UserData mUserData = UserData();
mUserData.roleName = name;
///使用单位
if (unitType == '1') {
if (name == '安全员') {
mUserData.roleId = '2';
}
if (name == '安全总监') {
mUserData.roleId = '1';
}
}
///生产单位
if (unitType == '2') {
if (name == '质量安全员') {
mUserData.roleId = '2';
}
if (name == '质量安全总监') {
mUserData.roleId = '1';
}
}
roleUserLists!.add(mUserData);
}
if (roleUserLists!.length == 1) {
roleId = roleUserLists![0].roleId!;
// roleName = roleUserLists![0].roleName!;
roleText!.text = roleUserLists![0].roleName!;
}
getEquipmentList(); getEquipmentList();
} }
...@@ -113,7 +161,7 @@ class _TestSettingPageState extends State<TestSettingPage> { ...@@ -113,7 +161,7 @@ class _TestSettingPageState extends State<TestSettingPage> {
children: [ children: [
Image.asset('assets/home/rigister_bg.png'), Image.asset('assets/home/rigister_bg.png'),
Container( Container(
height: 230, height: 280,
margin: margin:
const EdgeInsets.only(left: 15, top: 130, right: 15, bottom: 0), const EdgeInsets.only(left: 15, top: 130, right: 15, bottom: 0),
decoration: const BoxDecoration( decoration: const BoxDecoration(
...@@ -174,96 +222,152 @@ class _TestSettingPageState extends State<TestSettingPage> { ...@@ -174,96 +222,152 @@ class _TestSettingPageState extends State<TestSettingPage> {
} }
}); });
}), }),
const SizedBox(height: 10),
Row(children: [
const Icon(Icons.touch_app,
color: ColorConst.orangeColor, size: 15),
Text('身份${unitType == "1" ? "-(使用单位)" : "-(生产单位)"}',
style: const TextStyle(fontSize: 14))
]),
const SizedBox(height: 5),
CustomTextField(
enabled: true,
readOnly: true,
hintText: '请选择身份',
controller: roleText,
focusNode: roleFocusNode,
onTop: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
contentPadding: EdgeInsets.all(0.0),
titlePadding: const EdgeInsets.only(
left: 20, right: 20, top: 20, bottom: 10),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text('请选择您的身份'),
InkWell(
onTap: () {
Get.back();
},
child: const Icon(
Icons.clear,
size: 30,
color: Colors.grey,
),
)
],
),
content: SingleChildScrollView(
physics: const NeverScrollableScrollPhysics(),
child: Column(
children: [
buildListContent(),
Container(
height: 10,
)
],
),
),
);
});
// showDialog(
// context: context,
// builder: (context) {
// return AlertDialog(
// titlePadding: const EdgeInsets.only(
// left: 20, right: 20, top: 20, bottom: 0),
// title: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// const Text('请选择您的身份'),
// InkWell(
// onTap: () {
// Get.back();
// },
// child: const Icon(
// Icons.clear,
// size: 30,
// color: Colors.grey,
// ),
// )
// ],
// ),
// content: StatefulBuilder(
// builder: (context, StateSetter setState) {
// return ListView.builder(
// shrinkWrap: true,
// itemCount: roleUserLists!.length,
// itemBuilder: (context, index) {
// return ListTile(
// title: Text(roleUserLists![index].roleName!),
// onTap: () {
// setState(() {
// roleText!.text =
// roleUserLists![index].roleName!;
// roleId = roleUserLists![index].roleId!;
// Navigator.pop(context); // 关闭弹窗
// });
// },
// );
// },
// );
// },
// ),
// );
// },
// );
// Get.toNamed(RouteString.EQUIPMENT_LIST_PAGE, arguments: {
// 'officeId': StorageUtil.getInstance().getOfficeId()
// })?.then((map) {
// if (map != null) {
// mEquiList = map;
// setState(() {
// equipmentText!.text = mEquiList!.name!;
// // getFindEqQuestionNum(false);
// });
// }
// });
}),
// const Tip('小提示:【安全员、安全总监】身份可进行测试练习', marginLeft: 5),
const Tip('小提示:【安全员、安全总监】可进行测试练习',
marginLeft: 5, marginTop: 5, marginRight: 10),
const SizedBox(height: 20), const SizedBox(height: 20),
// const Row(children: [
// Icon(Icons.drive_file_rename_outline_rounded,
// color: ColorConst.orangeColor, size: 15),
// Text('设置题数', style: TextStyle(fontSize: 14))
// ]),
// const SizedBox(height: 10),
// Container(
// padding:
// const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Row(children: [
// const Text('单选题数', style: TextStyle(fontSize: 14)),
// SizedBox(
// width: 40,
// height: 30,
// child: TextFormField(
// textAlign: TextAlign.center,
// inputFormatters: [
// FilteringTextInputFormatter.digitsOnly,
// LengthLimitingTextInputFormatter(3),
// // 设置输入长度限制
// ],
// focusNode: singleZJFocusNode,
// controller: singleText,
// onChanged: (num) {
// setState(() {
// if (mDataEq != null &&
// int.parse(num) > mDataEq!.dxNum!) {
// ToastUtils.showCenter('题库只有${mDataEq!.dxNum}道单选题');
// setState(() {
// singleText!.text = mDataEq!.dxNum.toString();
// });
// }
// allQuestions = (singleText!.text.isNotEmpty
// ? int.parse(singleText!.text)
// : 0) +
// (judgmentText!.text.isNotEmpty
// ? int.parse(judgmentText!.text)
// : 0);
// });
// },
// ),
// )
// ]),
// Row(children: [
// const Text('判断题数', style: TextStyle(fontSize: 14)),
// SizedBox(
// width: 40,
// height: 30,
// child: TextFormField(
// textAlign: TextAlign.center,
// inputFormatters: [
// FilteringTextInputFormatter.digitsOnly,
// LengthLimitingTextInputFormatter(3),
// ],
// focusNode: judgmentZJFocusNode,
// controller: judgmentText,
// onChanged: (num) {
// setState(() {
// if (mDataEq != null &&
// int.parse(num) > mDataEq!.pdNum!) {
// ToastUtils.showCenter('题库只有${mDataEq!.pdNum}道判断题');
// setState(() {
// judgmentText!.text = mDataEq!.pdNum.toString();
// });
// }
// allQuestions = (judgmentText!.text.isNotEmpty
// ? int.parse(judgmentText!.text)
// : 0) +
// (singleText!.text.isNotEmpty
// ? int.parse(singleText!.text)
// : 0);
// });
// },
// ),
// )
// ]),
// Text('总题数: ${allQuestions.toString()}',
// style: const TextStyle(color: Colors.grey, fontSize: 14)),
// ],
// ),
// ),
], ],
), ),
); );
} }
Widget buildListContent() {
List<InkWell> textList = [];
for (var item in roleUserLists!) {
textList.add(InkWell(
onTap: () {
setState(() {
roleText!.text = item.roleName!;
roleId = item.roleId!;
Navigator.pop(context); // 关闭弹窗
});
},
child: Container(
width: double.infinity,
padding:
const EdgeInsets.only(left: 10, top: 10, right: 10, bottom: 10),
child: Text(item.roleName!, textAlign: TextAlign.center),
),
));
}
return Column(
mainAxisSize: MainAxisSize.min,
children: textList,
);
}
Container buildTopTitle(BuildContext context) { Container buildTopTitle(BuildContext context) {
return Container( return Container(
margin: const EdgeInsets.only(top: 50), margin: const EdgeInsets.only(top: 50),
...@@ -314,7 +418,7 @@ class _TestSettingPageState extends State<TestSettingPage> { ...@@ -314,7 +418,7 @@ class _TestSettingPageState extends State<TestSettingPage> {
///交卷 ///交卷
Container buildSubmit() { Container buildSubmit() {
return Container( return Container(
margin: const EdgeInsets.only(top: 40, bottom: 0), // margin: const EdgeInsets.only(top: 10, bottom: 0),
padding: const EdgeInsets.only(left: 20, right: 20, top: 15, bottom: 0), padding: const EdgeInsets.only(left: 20, right: 20, top: 15, bottom: 0),
width: double.infinity, width: double.infinity,
decoration: const BoxDecoration( decoration: const BoxDecoration(
...@@ -327,6 +431,10 @@ class _TestSettingPageState extends State<TestSettingPage> { ...@@ -327,6 +431,10 @@ class _TestSettingPageState extends State<TestSettingPage> {
ToastUtils.showCenter('请选择设备类型'); ToastUtils.showCenter('请选择设备类型');
return; return;
} }
if (roleText!.text.isEmpty) {
ToastUtils.showCenter('请选择身份');
return;
}
// if (allQuestions == 0) { // if (allQuestions == 0) {
// ToastUtils.showCenter('总题数不能为 0'); // ToastUtils.showCenter('总题数不能为 0');
// return; // return;
...@@ -338,8 +446,10 @@ class _TestSettingPageState extends State<TestSettingPage> { ...@@ -338,8 +446,10 @@ class _TestSettingPageState extends State<TestSettingPage> {
// mTestSubmitBo.pdQuestionsNum = judgmentText!.text.isNotEmpty // mTestSubmitBo.pdQuestionsNum = judgmentText!.text.isNotEmpty
// ? int.parse(judgmentText!.text) // ? int.parse(judgmentText!.text)
// : 0; // : 0;
Get.offNamed(RouteString.TEST_PAGE, Get.offNamed(RouteString.TEST_PAGE, arguments: {
arguments: {'mTestSubmitBo': mTestSubmitBo})?.then((value) { 'mTestSubmitBo': mTestSubmitBo,
'positionType': roleId
})?.then((value) {
if (value != null && value) {} if (value != null && value) {}
}); });
}, },
......
...@@ -18,6 +18,7 @@ import 'package:special_equipment_flutter/utils/sp_account_utils.dart'; ...@@ -18,6 +18,7 @@ import 'package:special_equipment_flutter/utils/sp_account_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';
import 'package:special_equipment_flutter/widgets/custom_button.dart'; import 'package:special_equipment_flutter/widgets/custom_button.dart';
import 'package:special_equipment_flutter/widgets/tip.dart';
import '../../dio/api.dart'; import '../../dio/api.dart';
...@@ -240,159 +241,201 @@ class EditTextState extends State<EditTextWidget> ...@@ -240,159 +241,201 @@ class EditTextState extends State<EditTextWidget>
], ],
), ),
), ),
GestureDetector( InkWell(
onTap: () { onTap: () {
// List<UserBo> userList = // List<UserBo> userList =
// StorageUtil.getInstance().getUserList(); // StorageUtil.getInstance().getUserList();
setState(() { setState(() {
if (listAccount.isNotEmpty) { if (listAccount.isNotEmpty) {
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (context) {
return AlertDialog( return AlertDialog(
titlePadding: const EdgeInsets.only( contentPadding: EdgeInsets.all(0.0),
left: 20, titlePadding: const EdgeInsets.only(
right: 20, left: 20,
top: 10, right: 20,
bottom: 10), top: 20,
title: Row( bottom: 10),
mainAxisAlignment: title: Row(
MainAxisAlignment.spaceBetween, mainAxisAlignment:
children: [ MainAxisAlignment.spaceBetween,
const Text('历史登录账号、密码'), children: [
InkWell( const Text('历史登录账号、密码'),
onTap: () { InkWell(
Get.back();
},
child: const Icon(
Icons.clear,
size: 30,
color: Colors.grey,
),
)
],
),
actions: <Widget>[
ListView.separated(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: listAccount.length,
itemBuilder: (BuildContext context,
int index) {
return InkWell(
splashColor:
ColorConst.themeBgColor,
onTap: () { onTap: () {
setState(() { Get.back();
phoneController.value =
phoneController.value
.copyWith(
text: listAccount[
index]
.account);
passController.value =
passController.value
.copyWith(
text: listAccount[
index]
.password);
Get.back();
});
}, },
child: Padding( child: const Icon(
padding: Icons.clear,
const EdgeInsets.only( size: 30,
left: 10), color: Colors.grey,
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Row(
children: [
Icon(
Icons.person,
size: 25,
color: Colors.grey,
),
Text(
listAccount[index]
.account!,
style: const TextStyle(
fontSize: 16,
color: ColorConst
.blueColor),
),
],
),
InkWell(
onTap: () {
setState(() {
showDialog(
context:
context,
builder:
(context) {
return AlertDialog(
content: Text(
"您确定要清除【${listAccount[index].account}】这个历史纪录账号吗?"),
actions: [
TextButton(
child: const Text(
"取消"),
onPressed:
() {
Navigator.of(context)
.pop();
},
),
TextButton(
child: const Text(
"确定"),
onPressed:
() {
ToastUtils.showCenter("已清除【${listAccount[index].account}】的历史账号");
SPAccountUtil.delUser(listAccount[index],
index);
debugPrint(jsonEncode(listAccount));
listAccount.remove(listAccount[index]);
Get.back();
Get.back();
})
],
);
});
});
},
child: const Padding(
padding:
EdgeInsets.all(
13.0),
child: Icon(
Icons.clear,
size: 18,
color: Colors.grey,
),
),
)
],
),
), ),
); )
}, ],
separatorBuilder: ),
(BuildContext context, content: SingleChildScrollView(
int index) { physics:
return Container( const NeverScrollableScrollPhysics(),
height: 1, child: Column(
color: Colors.grey[100], children: [
); buildListContent(),
}, Container(
) height: 10,
], )
); ],
}, ),
); ),
);
});
// showDialog(
// context: context,
// builder: (BuildContext context) {
// return AlertDialog(
// titlePadding: const EdgeInsets.only(
// left: 20,
// right: 20,
// top: 10,
// bottom: 10),
// title: Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// const Text('历史登录账号、密码'),
// InkWell(
// onTap: () {
// Get.back();
// },
// child: const Icon(
// Icons.clear,
// size: 30,
// color: Colors.grey,
// ),
// )
// ],
// ),
// actions: <Widget>[
// ListView.separated(
// scrollDirection: Axis.vertical,
// shrinkWrap: true,
// itemCount: listAccount.length,
// itemBuilder: (BuildContext context,
// int index) {
// return InkWell(
// splashColor:
// ColorConst.themeBgColor,
// onTap: () {
// setState(() {
// phoneController.value =
// phoneController.value
// .copyWith(
// text: listAccount[
// index]
// .account);
// passController.value =
// passController.value
// .copyWith(
// text: listAccount[
// index]
// .password);
// Get.back();
// });
// },
// child: Padding(
// padding:
// const EdgeInsets.only(
// left: 10),
// child: Row(
// mainAxisAlignment:
// MainAxisAlignment
// .spaceBetween,
// children: [
// Row(
// children: [
// const Icon(
// Icons.person,
// size: 20,
// color: Colors.grey,
// ),
// Text(
// listAccount[index]
// .account!,
// style: const TextStyle(
// fontSize: 16,
// color: ColorConst
// .blueColor),
// ),
// ],
// ),
// InkWell(
// onTap: () {
// setState(() {
// showDialog(
// context:
// context,
// builder:
// (context) {
// return AlertDialog(
// content: Text(
// "您确定要清除【${listAccount[index].account}】这个历史纪录账号吗?"),
// actions: [
// TextButton(
// child: const Text(
// "取消"),
// onPressed:
// () {
// Navigator.of(context)
// .pop();
// },
// ),
// TextButton(
// child: const Text(
// "确定"),
// onPressed:
// () {
// ToastUtils.showCenter("已清除【${listAccount[index].account}】的历史账号");
// SPAccountUtil.delUser(listAccount[index],
// index);
// debugPrint(jsonEncode(listAccount));
// listAccount.remove(listAccount[index]);
// Get.back();
// Get.back();
// })
// ],
// );
// });
// });
// },
// child: const Padding(
// padding:
// EdgeInsets.all(
// 13.0),
// child: Icon(
// Icons.clear,
// size: 18,
// color: Colors.grey,
// ),
// ),
// )
// ],
// ),
// ),
// );
// },
// separatorBuilder:
// (BuildContext context,
// int index) {
// return Container(
// height: 1,
// color: Colors.grey[100],
// );
// },
// )
// ],
// );
// },
// );
} else { } else {
ToastUtils.showCenter('暂无历史登录账号'); ToastUtils.showCenter('暂无历史登录账号');
} }
...@@ -400,6 +443,7 @@ class EditTextState extends State<EditTextWidget> ...@@ -400,6 +443,7 @@ class EditTextState extends State<EditTextWidget>
}, },
child: Container( child: Container(
margin: const EdgeInsets.only(bottom: 3), margin: const EdgeInsets.only(bottom: 3),
padding: const EdgeInsets.all(10),
child: const Text( child: const Text(
'历史登录账号>', '历史登录账号>',
style: TextStyle(color: ColorConst.blueColor), style: TextStyle(color: ColorConst.blueColor),
...@@ -415,11 +459,14 @@ class EditTextState extends State<EditTextWidget> ...@@ -415,11 +459,14 @@ class EditTextState extends State<EditTextWidget>
if (Platform.isIOS) ...[ if (Platform.isIOS) ...[
if (isOpen == '1') ...[ if (isOpen == '1') ...[
const SizedBox(height: 15), //密码和登录按钮间距 const SizedBox(height: 15), //密码和登录按钮间距
buildRigister() buildRigister(),
const Tip('初次使用,请先完成单位账号注册',
marginTop: 0, width: 280),
] ]
] else ...[ ] else ...[
const SizedBox(height: 15), //密码和登录按钮间距 const SizedBox(height: 15), //密码和登录按钮间距
buildRigister() buildRigister(),
const Tip('初次使用,请先完成单位账号注册', marginTop: 0, width: 280),
] ]
], ],
)), )),
...@@ -440,6 +487,95 @@ class EditTextState extends State<EditTextWidget> ...@@ -440,6 +487,95 @@ class EditTextState extends State<EditTextWidget>
)); ));
} }
Widget buildListContent() {
List<InkWell> textList = [];
for (int index = 0; index < listAccount.length; index++) {
textList.add(InkWell(
splashColor: ColorConst.themeBgColor,
onTap: () {
setState(() {
phoneController.value = phoneController.value
.copyWith(text: listAccount[index].account);
passController.value = passController.value
.copyWith(text: listAccount[index].password);
Get.back();
});
},
child: Container(
width: double.infinity,
padding:
const EdgeInsets.only(left: 20, top: 0, right: 10, bottom: 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
const Icon(
Icons.person,
size: 20,
color: Colors.grey,
),
Text(
listAccount[index].account!,
style: const TextStyle(
fontSize: 16, color: ColorConst.blueColor),
),
],
),
InkWell(
onTap: () {
setState(() {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Text(
"您确定要清除【${listAccount[index].account}】这个历史纪录账号吗?"),
actions: [
TextButton(
child: const Text("取消"),
onPressed: () {
Navigator.of(context).pop();
},
),
TextButton(
child: const Text("确定"),
onPressed: () {
ToastUtils.showCenter(
"已清除【${listAccount[index].account}】的历史账号");
SPAccountUtil.delUser(
listAccount[index], index);
debugPrint(jsonEncode(listAccount));
listAccount.remove(listAccount[index]);
Get.back();
Get.back();
})
],
);
});
});
},
child: const Padding(
padding: EdgeInsets.all(13.0),
child: Icon(
Icons.clear,
size: 18,
color: Colors.grey,
),
),
)
],
),
),
));
}
return Column(
mainAxisSize: MainAxisSize.min,
children: textList,
);
}
List<UserBo> listAccount = []; List<UserBo> listAccount = [];
///获取历史用户 ///获取历史用户
...@@ -508,7 +644,7 @@ class EditTextState extends State<EditTextWidget> ...@@ -508,7 +644,7 @@ class EditTextState extends State<EditTextWidget>
Widget buildTitle() { Widget buildTitle() {
return const Text( return const Text(
'晋特助手', '晋特助手',
style: TextStyle( style: TextStyle(
fontSize: 25, fontSize: 25,
color: ColorConst.blueColor, color: ColorConst.blueColor,
......
...@@ -40,6 +40,7 @@ import 'package:special_equipment_flutter/widgets/custom_button.dart'; ...@@ -40,6 +40,7 @@ import 'package:special_equipment_flutter/widgets/custom_button.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart'; import 'package:special_equipment_flutter/widgets/divider_custom.dart';
import 'package:special_equipment_flutter/widgets/easy_refresh_header1.dart'; import 'package:special_equipment_flutter/widgets/easy_refresh_header1.dart';
import 'package:special_equipment_flutter/widgets/emptyI_img_widget.dart'; import 'package:special_equipment_flutter/widgets/emptyI_img_widget.dart';
import 'package:special_equipment_flutter/widgets/tip.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../../common/color_const.dart'; import '../../common/color_const.dart';
...@@ -170,6 +171,7 @@ class _HomePageState extends State<HomePage> ...@@ -170,6 +171,7 @@ class _HomePageState extends State<HomePage>
BannerListBo mBannerListBo = value; BannerListBo mBannerListBo = value;
if (mounted) { if (mounted) {
setState(() { setState(() {
bannerList!.clear();
List<Data>? mList = mBannerListBo.data; List<Data>? mList = mBannerListBo.data;
for (var item in mList!) { for (var item in mList!) {
if (item.advertisPosition == "0") { if (item.advertisPosition == "0") {
...@@ -367,6 +369,11 @@ class _HomePageState extends State<HomePage> ...@@ -367,6 +369,11 @@ class _HomePageState extends State<HomePage>
header: TaurusHeaders(), header: TaurusHeaders(),
onRefresh: () async { onRefresh: () async {
setState(() { setState(() {
// Future.delayed(const Duration(seconds: 2), () {
// // 延迟执行的代码
// getBannerList();
// });
getBannerList();
getCount(); getCount();
getDeviceData(); getDeviceData();
...@@ -975,25 +982,7 @@ class _HomePageState extends State<HomePage> ...@@ -975,25 +982,7 @@ class _HomePageState extends State<HomePage>
// buildTitle(Icons.equalizer, '考核练习'), // buildTitle(Icons.equalizer, '考核练习'),
// buildSliverGridExamination() // buildSliverGridExamination()
if (name == '考核练习') ...[ if (name == '考核练习') ...[
Container( const Tip('小提示:【安全监察人】向各单位开启监督抽查【考核】'),
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(left: 10, right: 10, top: 10),
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(
softWrap: true,
'小提示:【安全监察人】会对各单位监督抽查【考核】.',
style: TextStyle(color: Colors.orange, fontSize: 13),
),
),
] ]
], ],
))); )));
...@@ -1656,8 +1645,10 @@ class _HomePageState extends State<HomePage> ...@@ -1656,8 +1645,10 @@ class _HomePageState extends State<HomePage>
// if (value != null && value) {} // if (value != null && value) {}
// }); // });
Get.toNamed(RouteString.TEST_SETTING_PAGE, arguments: {}) Get.toNamed(RouteString.TEST_SETTING_PAGE, arguments: {
?.then((value) { 'roles': roleNamesText(unitId),
'unitType': unitId
})?.then((value) {
if (value != null && value) {} if (value != null && value) {}
}); });
break; break;
...@@ -1886,12 +1877,16 @@ class _HomePageState extends State<HomePage> ...@@ -1886,12 +1877,16 @@ class _HomePageState extends State<HomePage>
centerTitle: true, centerTitle: true,
background: Stack( background: Stack(
children: [ children: [
// Image.asset('assets/home/top_bg_icon.png', if (bannerList!.isEmpty) ...[
// width: MediaQuery.of(context).size.width, fit: BoxFit.fill), Image.asset('assets/banner/banner0.png',
CardSwiper( width: MediaQuery.of(context).size.width,
bannerList: bannerList, height: MediaQuery.of(context).size.height,
), fit: BoxFit.fill)
] else ...[
CardSwiper(
bannerList: bannerList,
)
],
Positioned( Positioned(
bottom: SizeConfig.isIpad()! ? 190 : 5, bottom: SizeConfig.isIpad()! ? 190 : 5,
// left: SizeConfig.isIpad()! // left: SizeConfig.isIpad()!
......
...@@ -41,7 +41,7 @@ class EquipmentPersonnelTable extends StatelessWidget { ...@@ -41,7 +41,7 @@ class EquipmentPersonnelTable extends StatelessWidget {
), ),
child: Column( child: Column(
children: [ children: [
buildTitle(Icons.compare, '设备人员对比'), buildTitle(Icons.compare, '设备人员对比表格'),
Container( Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(left: 5, right: 5, top: 5), margin: const EdgeInsets.only(left: 5, right: 5, top: 5),
...@@ -57,7 +57,7 @@ class EquipmentPersonnelTable extends StatelessWidget { ...@@ -57,7 +57,7 @@ class EquipmentPersonnelTable extends StatelessWidget {
), ),
child: const Text( child: const Text(
softWrap: true, softWrap: true,
'设备人员对比表格,是对比每个设备是否配备了相关负责人员,请在【用户设置】内配置相关负责人员.', '小提示:对比每个设备是否配备了相关负责人员,请在【用户设置】内配置相关负责人员.',
style: TextStyle(color: Colors.orange, fontSize: 13), style: TextStyle(color: Colors.orange, fontSize: 13),
), ),
), ),
......
...@@ -12,6 +12,7 @@ import 'package:special_equipment_flutter/utils/toast_utils.dart'; ...@@ -12,6 +12,7 @@ import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/custom_button.dart'; import 'package:special_equipment_flutter/widgets/custom_button.dart';
import 'package:special_equipment_flutter/widgets/custom_textfield.dart'; import 'package:special_equipment_flutter/widgets/custom_textfield.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart'; import 'package:special_equipment_flutter/widgets/divider_custom.dart';
import 'package:special_equipment_flutter/widgets/tip.dart';
///公司账号注册 ///公司账号注册
class RegisterPage2 extends StatefulWidget { class RegisterPage2 extends StatefulWidget {
...@@ -118,24 +119,11 @@ class _RegisterPage2State extends State<RegisterPage2> { ...@@ -118,24 +119,11 @@ class _RegisterPage2State extends State<RegisterPage2> {
onChanged: (text) { onChanged: (text) {
if (text.length >= 6) {} if (text.length >= 6) {}
}), }),
Container( const Tip(
width: 1080, '登录名仅支持字母+数字组合、纯字母、6-20位',
margin: const EdgeInsets.only(left: 5, right: 5, top: 5), marginTop: 5,
padding: marginLeft: 5,
const EdgeInsets.only(left: 5, right: 5, top: 3, bottom: 3), marginRight: 5,
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(
softWrap: true,
'登录名仅支持字母+数字组合、纯字母、6-20位',
style: TextStyle(color: Colors.orange, fontSize: 12),
),
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
...@@ -157,23 +145,11 @@ class _RegisterPage2State extends State<RegisterPage2> { ...@@ -157,23 +145,11 @@ class _RegisterPage2State extends State<RegisterPage2> {
controller: passwordText, controller: passwordText,
focusNode: passwordFocusNode, focusNode: passwordFocusNode,
isNoChinese: true), isNoChinese: true),
Container( const Tip(
margin: const EdgeInsets.only(left: 5, right: 5, top: 5), '密码至少包含以下 5 种类别:大写字母、小写字母、数字、特殊符号( @#*. )、8-20位',
padding: marginTop: 5,
const EdgeInsets.only(left: 5, right: 5, top: 3, bottom: 3), marginLeft: 5,
decoration: BoxDecoration( marginRight: 5,
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(
softWrap: true,
'密码至少包含以下 5 种类别:大写字母、小写字母、数字、特殊符号( @#*. )、8-20位',
style: TextStyle(color: Colors.orange, fontSize: 12),
),
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
Container( Container(
...@@ -194,6 +170,8 @@ class _RegisterPage2State extends State<RegisterPage2> { ...@@ -194,6 +170,8 @@ class _RegisterPage2State extends State<RegisterPage2> {
controller: okPasswordText, controller: okPasswordText,
focusNode: okPasswordFocusNode, focusNode: okPasswordFocusNode,
isNoChinese: true), isNoChinese: true),
const Tip('请填写简易的【登录名和密码】,避免忘记',
marginTop: 5, marginLeft: 5, marginRight: 5),
const SizedBox(height: 8), const SizedBox(height: 8),
Container( Container(
margin: const EdgeInsets.only(left: 5, right: 5), margin: const EdgeInsets.only(left: 5, right: 5),
......
...@@ -17,6 +17,7 @@ import 'package:special_equipment_flutter/utils/toast_utils.dart'; ...@@ -17,6 +17,7 @@ import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/emptyI_img_widget.dart'; import 'package:special_equipment_flutter/widgets/emptyI_img_widget.dart';
import 'package:special_equipment_flutter/widgets/first_refresh_widget.dart'; import 'package:special_equipment_flutter/widgets/first_refresh_widget.dart';
import 'package:special_equipment_flutter/widgets/number_to_chinese.dart'; import 'package:special_equipment_flutter/widgets/number_to_chinese.dart';
import 'package:special_equipment_flutter/widgets/tip.dart';
import '../../../../common/color_const.dart'; import '../../../../common/color_const.dart';
import '../../../../widgets/custom_button.dart'; import '../../../../widgets/custom_button.dart';
...@@ -142,31 +143,17 @@ class _InspectListSyPageState extends State<InspectListSyPage> ...@@ -142,31 +143,17 @@ class _InspectListSyPageState extends State<InspectListSyPage>
backgroundColor: Colors.grey[100], backgroundColor: Colors.grey[100],
body: Column( body: Column(
children: [ children: [
Container( Tip(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(left: 10, right: 10, top: 10),
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: Text(
softWrap: true,
type == '1' type == '1'
? '小提示:当天新建的设备和用户,会在第二天生成【日管控】任务.' ? '小提示:当天新建的设备和用户,会在第二天生成【日管控】任务'
: type == '2' : type == '2'
? '小提示:【周排查】可在 每周四-周日 完成任务.' ? '小提示:周排查【每周四-周日】完成排查任务'
: type == '3' : type == '3'
? '小提示:【月调度】可在 每月25日-月底 完成任务.' ? '小提示:月调度【每月25日-月底】完成调度任务'
: '', : '',
style: const TextStyle(color: Colors.orange, fontSize: 14), marginTop: 5,
), marginLeft: 10,
), marginRight: 10),
Expanded( Expanded(
flex: 1, flex: 1,
child: EasyRefresh( child: EasyRefresh(
......
...@@ -11,6 +11,7 @@ import 'package:special_equipment_flutter/utils/string_utils.dart'; ...@@ -11,6 +11,7 @@ import 'package:special_equipment_flutter/utils/string_utils.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart'; import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/custom_button.dart'; import 'package:special_equipment_flutter/widgets/custom_button.dart';
import 'package:special_equipment_flutter/widgets/custom_textfield.dart'; import 'package:special_equipment_flutter/widgets/custom_textfield.dart';
import 'package:special_equipment_flutter/widgets/tip.dart';
import '../../../model/user_list.dart'; import '../../../model/user_list.dart';
...@@ -287,6 +288,8 @@ class _UserSettingsPageState extends State<UserSettingsPage> { ...@@ -287,6 +288,8 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
controller: okPasswordText, controller: okPasswordText,
focusNode: okPasswordFocusNode, focusNode: okPasswordFocusNode,
isNoChinese: true), isNoChinese: true),
const Tip('请填写简易的【登录名和密码】,避免忘记',
marginTop: 5, marginLeft: 5, marginRight: 5),
const SizedBox(height: 8), const SizedBox(height: 8),
const Row(children: [ const Row(children: [
Icon(Icons.drive_file_rename_outline_rounded, Icon(Icons.drive_file_rename_outline_rounded,
......
import 'package:flutter/material.dart';
///分割线
class Tip extends StatelessWidget {
final String? text;
final double? marginTop, marginBottom, marginLeft, marginRight;
final MaterialColor? color;
final double? width;
const Tip(this.text,
{super.key,
this.width=double.infinity,
this.color = Colors.orange,
this.marginTop = 10,
this.marginBottom = 0,
this.marginLeft = 10,
this.marginRight = 10});
@override
Widget build(BuildContext context) {
return Container(
width: width!,
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(
top: marginTop!,
bottom: marginBottom!,
left: marginLeft!,
right: marginRight!),
// margin: const EdgeInsets.only(left: 5, right: 10, top: 10),
padding: const EdgeInsets.only(left: 5, right: 5, top: 3, bottom: 3),
decoration: BoxDecoration(
color: Colors.orange[50],
borderRadius: const BorderRadius.all(Radius.circular(5)),
),
child: Text(
softWrap: true,
text!,
style: TextStyle(color: color!, fontSize: 13),
),
);
}
}
...@@ -138,7 +138,8 @@ flutter: ...@@ -138,7 +138,8 @@ flutter:
- assets/examine/no_pass_icon.png - assets/examine/no_pass_icon.png
- assets/examine/examine_gary_icon.png - assets/examine/examine_gary_icon.png
- assets/examine/history_icon.png - assets/examine/history_icon.png
- assets/name.pdf - assets/banner/banner0.png
- assets/banner/banner1.png
......
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