适配web前保存

main
hs 2025-09-23 10:31:41 +08:00
parent 0621ff1e2a
commit 545321d5e1
13 changed files with 211 additions and 51 deletions

View File

@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited. # This file should be version controlled and should not be manually edited.
version: version:
revision: "35c388afb57ef061d06a39b537336c87e0e3d1b1" revision: "d7b523b356d15fb81e7d340bbe52b47f93937323"
channel: "stable" channel: "stable"
project_type: app project_type: app
@ -13,14 +13,11 @@ project_type: app
migration: migration:
platforms: platforms:
- platform: root - platform: root
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 create_revision: d7b523b356d15fb81e7d340bbe52b47f93937323
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 base_revision: d7b523b356d15fb81e7d340bbe52b47f93937323
- platform: android - platform: web
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 create_revision: d7b523b356d15fb81e7d340bbe52b47f93937323
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 base_revision: d7b523b356d15fb81e7d340bbe52b47f93937323
- platform: ios
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
# User provided section # User provided section

View File

@ -8,7 +8,7 @@
<string>智守安全</string> <string>智守安全</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>ƒ
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
@ -85,6 +85,7 @@
<key>com.apple.developer.nfc.readersession.formats</key> <key>com.apple.developer.nfc.readersession.formats</key>
<array> <array>
<string>TAG</string> <string>TAG</string>
<string>NDEF</string>
</array> </array>
</dict> </dict>
</plist> </plist>

View File

@ -1,4 +1,3 @@
import 'dart:ffi';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:dotted_border/dotted_border.dart'; import 'package:dotted_border/dotted_border.dart';

View File

@ -25,9 +25,9 @@ class ApiService {
/// ///
// static const String basePath = "https://qaaqwh.qhdsafety.com/integrated_whb"; // static const String basePath = "https://qaaqwh.qhdsafety.com/integrated_whb";
// static const String basePath = "http://192.168.20.240:8500/integrated_whb";// static const String basePath = "http://192.168.20.240:8500/integrated_whb";//
// static const String basePath = "http://192.168.0.25:28199";// // static const String basePath = "http://192.168.0.25:28199";//
static const String basePath = "http://192.168.0.45:28199";// // static const String basePath = "http://192.168.0.45:28199";//
/// ///
static const String baseImgPath = "https://file.zcloudchina.com/YTHFile"; static const String baseImgPath = "https://file.zcloudchina.com/YTHFile";

View File

@ -4,6 +4,7 @@ import 'package:qhd_prevention/http/ApiService.dart';
import 'package:qhd_prevention/pages/app/Danger_paicha/check_record_page.dart'; import 'package:qhd_prevention/pages/app/Danger_paicha/check_record_page.dart';
import 'package:qhd_prevention/pages/app/Danger_paicha/quick_report_page.dart'; import 'package:qhd_prevention/pages/app/Danger_paicha/quick_report_page.dart';
import 'package:qhd_prevention/pages/app/danger_wait_list_page.dart'; import 'package:qhd_prevention/pages/app/danger_wait_list_page.dart';
import 'package:qhd_prevention/pages/app/gy_alarm/gy_alarm_page.dart';
import 'package:qhd_prevention/pages/badge_manager.dart'; import 'package:qhd_prevention/pages/badge_manager.dart';
import 'package:qhd_prevention/pages/home/work/risk_list_page.dart'; import 'package:qhd_prevention/pages/home/work/risk_list_page.dart';
@ -25,7 +26,8 @@ enum AppItem {
specialRecord, // specialRecord, //
supervisionRectification, // supervisionRectification, //
supervisionRecord, // supervisionRecord, //
aiAlarm, // aiAlarm, // -AI
gyAlarm // -
} }
class ApplicationPage extends StatefulWidget { class ApplicationPage extends StatefulWidget {
@ -124,6 +126,10 @@ class _ApplicationPageState extends State<ApplicationPage> {
case AppItem.aiAlarm: case AppItem.aiAlarm:
// ai // ai
pushPage(AiAlarmPage(), context); pushPage(AiAlarmPage(), context);
break;
case AppItem.gyAlarm:
pushPage(GyAlarmPage(), context);
break; break;
} }
} }
@ -164,11 +170,12 @@ class _ApplicationPageState extends State<ApplicationPage> {
{'item': AppItem.acceptedRisk, 'icon': 'assets/icon-apps/icon-zl-1.png', 'title': '已验收隐患', 'num': 0}, {'item': AppItem.acceptedRisk, 'icon': 'assets/icon-apps/icon-zl-1.png', 'title': '已验收隐患', 'num': 0},
], ],
}, },
{ {
'title': '监测预警', 'title': '监测预警',
'list': [ 'list': [
{'item': AppItem.aiAlarm, 'icon': 'assets/icon-apps/icon-pc-1.png', 'title': 'AI报警', 'num': 0}, {'item': AppItem.aiAlarm, 'icon': 'assets/icon-apps/icon-pc-1.png', 'title': 'AI报警', 'num': 0},
{'item': AppItem.gyAlarm, 'icon': 'assets/icon-apps/icon-pc-1.png', 'title': '工艺报警优化', 'num': 0},
], ],
}, },
]; ];

View File

@ -0,0 +1,130 @@
import 'package:flutter/material.dart';
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/http/ApiService.dart';
import 'package:qhd_prevention/pages/KeyProjects/Danger/danger_list_page.dart';
import 'package:qhd_prevention/pages/KeyProjects/KeyProject/keyProject_list_page.dart';
import 'package:qhd_prevention/pages/KeyProjects/SafeCheck/safeCheck_list_page.dart';
import 'package:qhd_prevention/pages/home/SafeCheck/CheckPersonSign/safeCheck_sign_list_page.dart';
import 'package:qhd_prevention/pages/home/SafeCheck/CheckPersonSure/check_person_list_page.dart';
import 'package:qhd_prevention/pages/home/SafeCheck/DangeCheck/safeCheck_danger_list_page.dart';
import 'package:qhd_prevention/pages/home/SafeCheck/Record/defend_record_list_page.dart';
import 'package:qhd_prevention/pages/home/SafeCheck/Start/safeCheck_start_list_page.dart';
import 'package:qhd_prevention/pages/home/tap/tabList/work_tab_icon_grid.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
import 'package:qhd_prevention/tools/tools.dart';
class GyAlarmPage extends StatefulWidget {
const GyAlarmPage({super.key});
@override
State<GyAlarmPage> createState() => _GyAlarmPageState();
}
class _GyAlarmPageState extends State<GyAlarmPage> {
late List<Map<String, dynamic>> buttonInfos = [
{
"icon": "assets/icon-apps/icon-yxkj-1.png",
"title": "已检查",
"unreadCount": '0',
},
{
"icon": "assets/icon-apps/icon-yxkj-4.png",
"title": "未检查",
"unreadCount": '0',
},
{
"icon": "assets/icon-apps/icon-yxkj-2.png",
"title": "已完成",
"unreadCount":'0',
},
];
@override
void initState() {
super.initState();
// _getData();
}
// Future<void> _getData() async {
// final data = await ApiService.getSafeCheckCount();
// setState(() {
// final checkedCount = data['checkedCount']['checkedCount'] ?? '';
// final repulseAndCheckCount = data['repulseAndCheckCount']['repulseAndCheckCount'] ?? '';
// final confirmCount = data['confirmCount']['confirmCount'] ?? '';
// final repulseCount = data['repulseCount']['repulseCount'] ?? '';
//
// buttonInfos = [
// {
// "icon": "assets/icon-apps/icon-yxkj-1.png",
// "title": "安全检查\n发起",
// "unreadCount": repulseCount,
// },
// {
// "icon": "assets/icon-apps/icon-yxkj-4.png",
// "title": "检查人\n确认",
// "unreadCount": confirmCount,
// },
// {
// "icon": "assets/icon-apps/icon-yxkj-2.png",
// "title": "被检查人\n签字/申辩",
// "unreadCount":checkedCount,
// },
// {
// "icon": "assets/icon-apps/icon-yxkj-2.png",
// "title": "隐患指派\n及验收",
// "unreadCount":repulseAndCheckCount,
// },
// {
// "icon": "assets/icon-apps/icon-yxkj-2.png",
// "title": "申辩记录",
// "unreadCount":'0',
// },
//
// ];
// });
// }
void _handleItemPressed(int index) async {
//
String title = '';
switch (index) {
case 0: {
title = '安全检查发起';
// await pushPage(SafecheckStartListPage(flow: title), context);
} break;
case 1: {
title = '安全检查核实';
// await pushPage(CheckPersonListPage(flow: title), context);
} break;
case 2: {
title = '安全检查确认';
// await pushPage(SafecheckSignListPage(flow: title), context);
} break;
default:
print("按钮 $index 被点击");
}
ToastUtil.showNormal(context, '开发中');
// _getData();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppbar(title: '工艺报警优化'),
body: SafeArea(
child: Column(
children: [
ListItemFactory.createBuildSimpleSection('工艺报警优化'),
WorkTabIconGrid(
buttonInfos: buttonInfos,
onItemPressed: _handleItemPressed,
),
],
)
),
);
}
}

View File

@ -1,15 +1,12 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:ffi';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:qhd_prevention/customWidget/bottom_picker.dart'; import 'package:qhd_prevention/customWidget/bottom_picker.dart';
import 'package:qhd_prevention/customWidget/custom_alert_dialog.dart'; import 'package:qhd_prevention/customWidget/custom_alert_dialog.dart';
import 'package:qhd_prevention/customWidget/custom_button.dart'; import 'package:qhd_prevention/customWidget/custom_button.dart';
import 'package:qhd_prevention/customWidget/department_person_picker.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart'; import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/http/ApiService.dart'; import 'package:qhd_prevention/http/ApiService.dart';
import 'package:qhd_prevention/pages/home/tap/item_list_widget.dart'; import 'package:qhd_prevention/pages/home/tap/item_list_widget.dart';
import 'package:qhd_prevention/pages/home/work_alert.dart';
import 'package:qhd_prevention/pages/my_appbar.dart'; import 'package:qhd_prevention/pages/my_appbar.dart';
import 'package:qhd_prevention/services/nfc_service.dart'; import 'package:qhd_prevention/services/nfc_service.dart';
import 'package:qhd_prevention/tools/tools.dart'; import 'package:qhd_prevention/tools/tools.dart';

View File

@ -42,12 +42,14 @@ class HomePage extends StatefulWidget {
class HomePageState extends State<HomePage> { class HomePageState extends State<HomePage> {
int _eight_work_count = 0; int _eight_work_count = 0;
int _safetyEnvironmentalInspection = 0; int _safetyEnvironmentalInspection = 0;
void startScan() { void startScan() {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (_) => ScanPage(totalList: totalList)), MaterialPageRoute(builder: (_) => ScanPage(totalList: totalList)),
); );
} }
// key // key
static const String _hiddenCacheKey = 'hidden_roll_cache'; static const String _hiddenCacheKey = 'hidden_roll_cache';
@ -67,7 +69,9 @@ class HomePageState extends State<HomePage> {
return ''; return '';
} }
} }
List totalList = []; List totalList = [];
/// ///
List<Map<String, dynamic>> buttonInfos = [ List<Map<String, dynamic>> buttonInfos = [
{ {
@ -117,7 +121,7 @@ class HomePageState extends State<HomePage> {
"title": "安全例会", "title": "安全例会",
"unreadCount": 0, "unreadCount": 0,
}, },
// {"icon": "assets/icon-apps/home-xj.png", "title": "燃气巡检", "unreadCount": 0}, {"icon": "assets/icon-apps/home-xj.png", "title": "燃气巡检", "unreadCount": 0},
]; ];
/// ///
@ -186,14 +190,12 @@ class HomePageState extends State<HomePage> {
// 使 // 使
BadgeManager().initAllModules(); BadgeManager().initAllModules();
_initialLoad(); _initialLoad();
} }
/// loading /// loading
Future<void> _initialLoad() async { Future<void> _initialLoad() async {
final result = await AuthService.checkUpdate(); final result = await AuthService.checkUpdate();
try{ try {
if (FormUtils.hasValue(result, 'pd')) { if (FormUtils.hasValue(result, 'pd')) {
Map pd = result['pd']; Map pd = result['pd'];
final versionInfo = await getAppVersion(); final versionInfo = await getAppVersion();
@ -202,27 +204,27 @@ class HomePageState extends State<HomePage> {
// //
final ok = await CustomAlertDialog.showConfirm( final ok = await CustomAlertDialog.showConfirm(
context, context,
barrierDismissible:false, barrierDismissible: false,
title: '更新通知', title: '更新通知',
content: isWifi ? '发现新版本,是否更新?为了更好的体验,请更新到最新版本。' : '发现新版本,检查到您当前使用的是移动网络,是否更新?更新时请注意流量消耗。为了更好的体验,请更新到最新版本。', content:
isWifi
? '发现新版本,是否更新?为了更好的体验,请更新到最新版本。'
: '发现新版本,检查到您当前使用的是移动网络,是否更新?更新时请注意流量消耗。为了更好的体验,请更新到最新版本。',
cancelText: pd['ISUPDATE'] == '1' ? '' : '稍后更新', cancelText: pd['ISUPDATE'] == '1' ? '' : '稍后更新',
confirmText: '立即更新' confirmText: '立即更新',
); );
if (ok) { if (ok) {
if (Platform.isIOS) { if (Platform.isIOS) {
openAppStore(); openAppStore();
}else{ } else {
final apkUrl = pd['FILEURL'] ?? ''; final apkUrl = pd['FILEURL'] ?? '';
await showUpdateConfirm(context, apkUrl: apkUrl); await showUpdateConfirm(context, apkUrl: apkUrl);
} }
} }
return; return;
} }
} }
}catch(_){} } catch (_) {}
final corppromiseData = await ApiService.checkSafeCorppromise(); final corppromiseData = await ApiService.checkSafeCorppromise();
if (corppromiseData['ISSIGN'] == 1) { if (corppromiseData['ISSIGN'] == 1) {
@ -232,7 +234,6 @@ class HomePageState extends State<HomePage> {
title: '温馨提示', title: '温馨提示',
content: '有未签署的安全承诺,点击确认前往签署', content: '有未签署的安全承诺,点击确认前往签署',
force: true, force: true,
); );
if (confirmed) { if (confirmed) {
Navigator.pushReplacement( Navigator.pushReplacement(
@ -247,6 +248,7 @@ class HomePageState extends State<HomePage> {
// + hiddenList loading // + hiddenList loading
_fetchData(); _fetchData();
_fetchHiddenList(showLoading: hiddenList.isEmpty); _fetchHiddenList(showLoading: hiddenList.isEmpty);
/// ///
final data = await ApiService.getListData(); final data = await ApiService.getListData();
if (data['result'] == 'success') { if (data['result'] == 'success') {
@ -578,7 +580,6 @@ class HomePageState extends State<HomePage> {
pushPage(HomeNfcListPage(), context); pushPage(HomeNfcListPage(), context);
break; break;
} }
}, },
); );
}).toList(), }).toList(),
@ -719,9 +720,9 @@ class HomePageState extends State<HomePage> {
onTap: () async { onTap: () async {
if (index == 1) { if (index == 1) {
LoadingDialogHelper.show(); LoadingDialogHelper.show();
bool isRest= await _getIsRest(); bool isRest = await _getIsRest();
LoadingDialogHelper.hide(); LoadingDialogHelper.hide();
if(isRest){ if (isRest) {
ToastUtil.showNormal(context, "您已经处于离岗状态中"); ToastUtil.showNormal(context, "您已经处于离岗状态中");
return; return;
} }
@ -775,17 +776,16 @@ class HomePageState extends State<HomePage> {
); );
} }
Future<bool> _getIsRest() async {
Future<bool> _getIsRest( )async {
try { try {
final raw = await ApiService.getIsRest(); final raw = await ApiService.getIsRest();
if (raw['result'] == 'success') { if (raw['result'] == 'success') {
if( raw['ISREST']=="1"){ if (raw['ISREST'] == "1") {
return true; return true;
}else{ } else {
return false; return false;
} }
}else{ } else {
return false; return false;
} }
} catch (e) { } catch (e) {
@ -794,5 +794,4 @@ class HomePageState extends State<HomePage> {
return false; return false;
} }
} }
} }

View File

@ -1623,7 +1623,7 @@ class ConfirmWithSignWidget extends StatelessWidget {
this.isShowTime = true, this.isShowTime = true,
}) : super(key: key); }) : super(key: key);
// null {} // null{}
final Map<String, dynamic>? signs; final Map<String, dynamic>? signs;
final Map<String, dynamic>? pd; final Map<String, dynamic>? pd;
final String baseImgPath; final String baseImgPath;

View File

@ -261,7 +261,7 @@ if (reasonText.isEmpty) {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: MyAppbar(title: '作业人意见'), appBar: MyAppbar(title: '吊装作业人意见'),
body: SafeArea( body: SafeArea(
child: SingleChildScrollView( child: SingleChildScrollView(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
@ -285,7 +285,7 @@ if (reasonText.isEmpty) {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
ListItemFactory.headerTitle('作业人'), ListItemFactory.headerTitle('吊装作业人'),
CustomButton( CustomButton(
text: '新增手写签字', text: '新增手写签字',
height: 36, height: 36,

View File

@ -1,5 +1,3 @@
import 'dart:ffi';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'h_colors.dart'; import 'h_colors.dart';

View File

@ -1,4 +1,3 @@
import 'dart:ffi';
import 'dart:ui'; import 'dart:ui';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';

View File

@ -0,0 +1,33 @@
// lib/utils/platform_utils.dart
import 'package:flutter/foundation.dart' show kIsWeb, defaultTargetPlatform, TargetPlatform;
/// web dart:io
class PlatformUtils {
///
static bool get isWeb => kIsWeb;
/// iOS web false
static bool get isIOS => !kIsWeb && defaultTargetPlatform == TargetPlatform.iOS;
/// Android web false
static bool get isAndroid => !kIsWeb && defaultTargetPlatform == TargetPlatform.android;
/// web 'web'
static String get operatingSystem {
if (kIsWeb) return 'web';
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 'android';
case TargetPlatform.iOS:
return 'ios';
case TargetPlatform.macOS:
return 'macos';
case TargetPlatform.linux:
return 'linux';
case TargetPlatform.windows:
return 'windows';
case TargetPlatform.fuchsia:
return 'fuchsia';
}
}
}