Compare commits

...

2 Commits

Author SHA1 Message Date
hs 6d737adce3 Merge remote-tracking branch 'origin/main' 2025-09-18 15:40:05 +08:00
hs 2618fceec4 。。。 2025-09-18 15:40:01 +08:00
16 changed files with 216 additions and 134 deletions

View File

@ -184,14 +184,14 @@ U6Hzm1ninpWeE+awIDAQAB
); );
} }
static Future<Map<String, dynamic>> getUpdateInfo() { static Future<Map<String, dynamic>> getUpdateInfo() {
return HttpManager().request( return HttpManager().request(
projectManagerUrl, basePath,
'/projectDetails/findUpdate?code=cloud&type=APP', '/app/versionmanager/getVersion',
method: Method.post, method: Method.post,
data: {}, data: {
'FILETYPE':Platform.pathSeparator
},
); );
} }
@ -533,14 +533,10 @@ U6Hzm1ninpWeE+awIDAQAB
); );
} }
/// ///
static Future<Map<String, dynamic>> getUserFace( static Future<Map<String, dynamic>> getStudyUserFace(
String imagePath, String imagePath,
String studentId, Map data
String VIDEOCOURSEWARE_ID,
String CURRICULUM_ID,
String CHAPTER_ID,
String CLASS_ID,
) async { ) async {
final file = File(imagePath); final file = File(imagePath);
if (!await file.exists()) { if (!await file.exists()) {
@ -550,17 +546,53 @@ U6Hzm1ninpWeE+awIDAQAB
return HttpManager().uploadFaceImage( return HttpManager().uploadFaceImage(
baseUrl: baseFacePath, baseUrl: baseFacePath,
path: '/app/user/compareFaceV2',
fromData: {
...data,
'USER_ID': SessionService.instance.loginUserId,
'CORPINFO_ID': SessionService.instance.corpinfoId,
'FFILE': await MultipartFile.fromFile(file.path, filename: fileName),
},
);
}
static Future<Map<String, dynamic>> getUpdataUserFace(
String imagePath,
Map data
) async {
final file = File(imagePath);
if (!await file.exists()) {
throw ApiException('file_not_found', '图片不存在:$imagePath');
}
final fileName = file.path.split(Platform.pathSeparator).last;
return HttpManager().uploadFaceImage(
baseUrl: basePath,
path: '/app/user/editUserFaceV2',
fromData: {
...data,
'USER_ID': SessionService.instance.loginUserId,
'CORPINFO_ID': SessionService.instance.corpinfoId,
'FFILE': await MultipartFile.fromFile(file.path, filename: fileName),
},
);
}
static Future<Map<String, dynamic>> getScanUserFace(
String imagePath,
Map data
) async {
final file = File(imagePath);
if (!await file.exists()) {
throw ApiException('file_not_found', '图片不存在:$imagePath');
}
final fileName = file.path.split(Platform.pathSeparator).last;
return HttpManager().uploadFaceImage(
baseUrl: basePath,
path: '/app/user/compareFaceForH5V2', path: '/app/user/compareFaceForH5V2',
fromData: { fromData: {
...data,
'USER_ID': SessionService.instance.loginUserId, 'USER_ID': SessionService.instance.loginUserId,
'STUDENT_ID': studentId,
'CORPINFO_ID': SessionService.instance.corpinfoId, 'CORPINFO_ID': SessionService.instance.corpinfoId,
"CLASS_ID":CLASS_ID,
"VIDEOCOURSEWARE_ID": VIDEOCOURSEWARE_ID,
"CURRICULUM_ID": CURRICULUM_ID,
"CHAPTER_ID": CHAPTER_ID,
'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName),
}, },
); );

View File

@ -14,7 +14,9 @@ import 'package:qhd_prevention/tools/tools.dart';
class ScanPage extends StatefulWidget { class ScanPage extends StatefulWidget {
// const ScanPage({Key? key}) : super(key: key,); // const ScanPage({Key? key}) : super(key: key,);
const ScanPage({super.key, required this.totalList}); const ScanPage({super.key, required this.totalList});
final List totalList; final List totalList;
@override @override
State<ScanPage> createState() => _ScanPageState(); State<ScanPage> createState() => _ScanPageState();
} }
@ -99,9 +101,9 @@ class _ScanPageState extends State<ScanPage> {
} catch (e, st) { } catch (e, st) {
// //
print('handleScanResult error: $e\n$st'); print('handleScanResult error: $e\n$st');
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(
SnackBar(content: Text('扫码处理失败: ${e.toString()}')), context,
); ).showSnackBar(SnackBar(content: Text('扫码处理失败: ${e.toString()}')));
} }
} }
@ -109,10 +111,17 @@ class _ScanPageState extends State<ScanPage> {
void goToFace(Map<String, dynamic> stuInfo) async { void goToFace(Map<String, dynamic> stuInfo) async {
print('navigate to face with $stuInfo'); print('navigate to face with $stuInfo');
final passed = await pushPage<bool>( final passed = await pushPage<bool>(
FaceRecognitionPage(studentId: stuInfo['STUDENT_ID'], FaceRecognitionPage(
VIDEOCOURSEWARE_ID: stuInfo['VIDEOCOURSEWARE_ID'],CURRICULUM_ID: stuInfo['CURRICULUM_ID'], studentId: stuInfo['STUDENT_ID'],
CHAPTER_ID: stuInfo['CHAPTER_ID'],CLASS_ID: stuInfo['CLASS_ID'], data: {
mode: FaceMode.auto), 'VIDEOCOURSEWARE_ID': stuInfo['VIDEOCOURSEWARE_ID'],
'CURRICULUM_ID': stuInfo['CURRICULUM_ID'],
'CHAPTER_ID': stuInfo['CHAPTER_ID'],
'CLASS_ID': stuInfo['CLASS_ID'],
'STUDENT_ID':stuInfo['STUDENT_ID'],
},
mode: FaceMode.scan,
),
context, context,
); );
if (passed == true) { if (passed == true) {
@ -127,8 +136,8 @@ class _ScanPageState extends State<ScanPage> {
// //
void goToList({required String listId, required String listName}) { void goToList({required String listId, required String listName}) {
print('navigate to list: $listId, name: $listName'); print('navigate to list: $listId, name: $listName');
Navigator.pop(context,Animation); Navigator.pop(context, Animation);
pushPage(RiskListPage(1, listId,""), context); pushPage(RiskListPage(1, listId, ""), context);
} }
@override @override
@ -175,15 +184,20 @@ class _ScanPageState extends State<ScanPage> {
// //
// 1. // 1.
Positioned( Positioned(
left: 0, right: 0, top: 0, left: 0,
height: top, // right: 0,
top: 0,
height: top,
//
child: Container(color: Colors.black54), child: Container(color: Colors.black54),
), ),
// 2. // 2.
Positioned( Positioned(
left: 0, right: 0, left: 0,
top: top + scanSize, // right: 0,
top: top + scanSize,
//
bottom: 0, bottom: 0,
child: Container(color: Colors.black54), child: Container(color: Colors.black54),
), ),
@ -192,8 +206,10 @@ class _ScanPageState extends State<ScanPage> {
Positioned( Positioned(
left: 0, left: 0,
top: top, top: top,
width: left, // width: left,
height: scanSize, // //
height: scanSize,
//
child: Container(color: Colors.black54), child: Container(color: Colors.black54),
), ),
@ -202,7 +218,8 @@ class _ScanPageState extends State<ScanPage> {
left: left + scanSize, left: left + scanSize,
top: top, top: top,
right: 0, right: 0,
height: scanSize, // height: scanSize,
//
child: Container(color: Colors.black54), child: Container(color: Colors.black54),
), ),
@ -239,11 +256,15 @@ class _ScanPageState extends State<ScanPage> {
child: IconButton( child: IconButton(
iconSize: 32, iconSize: 32,
color: Colors.white, color: Colors.white,
icon: Icon(_torchOn ? Icons.flashlight_off_outlined : Icons.flashlight_on_outlined), icon: Icon(
_torchOn
? Icons.flashlight_off_outlined
: Icons.flashlight_on_outlined,
),
onPressed: () { onPressed: () {
_controller.toggleTorch(); _controller.toggleTorch();
setState(() { setState(() {
_torchOn = !_torchOn; _torchOn = !_torchOn;
}); });
}, },
), ),
@ -273,5 +294,4 @@ class _ScanPageState extends State<ScanPage> {
), ),
); );
} }
} }

View File

@ -17,28 +17,18 @@ import 'package:qhd_prevention/tools/tools.dart';
const MethodChannel _platformChan = MethodChannel('qhd_prevention/permissions'); const MethodChannel _platformChan = MethodChannel('qhd_prevention/permissions');
/// ///
enum FaceMode { auto, manual } enum FaceMode { setUpdata, study, scan }
class FaceRecognitionPage extends StatefulWidget { class FaceRecognitionPage extends StatefulWidget {
final String studentId; final String studentId;
final Map data;
final String VIDEOCOURSEWARE_ID;
final String CURRICULUM_ID;
final String CHAPTER_ID;
final String CLASS_ID;
final FaceMode mode; final FaceMode mode;
const FaceRecognitionPage({ const FaceRecognitionPage({
Key? key, Key? key,
required this.studentId, required this.studentId,
required this.data,
required this.VIDEOCOURSEWARE_ID, this.mode = FaceMode.study,
required this.CURRICULUM_ID,
required this.CHAPTER_ID,
required this.CLASS_ID,
this.mode = FaceMode.auto,
}) : super(key: key); }) : super(key: key);
@override @override
@ -55,7 +45,7 @@ class _FaceRecognitionPageState extends State<FaceRecognitionPage>
static const Duration _interval = Duration(seconds: 2); static const Duration _interval = Duration(seconds: 2);
String _errMsg = ''; String _errMsg = '';
bool get _isManualMode => widget.mode == FaceMode.manual; bool get _isManualMode => widget.mode == FaceMode.setUpdata;
bool _isInitializing = false; bool _isInitializing = false;
bool _isTaking = false; bool _isTaking = false;
@ -271,9 +261,18 @@ class _FaceRecognitionPageState extends State<FaceRecognitionPage>
} catch (_) {} } catch (_) {}
final XFile pic = await _cameraController!.takePicture(); final XFile pic = await _cameraController!.takePicture();
final res = await ApiService.getUserFace(pic.path, widget.studentId, var res = {};
widget.VIDEOCOURSEWARE_ID,widget.CURRICULUM_ID,widget.CHAPTER_ID,widget.CLASS_ID,); switch(widget.mode) {
case FaceMode.study:
res = await ApiService.getStudyUserFace(pic.path, widget.data);
break;
case FaceMode.setUpdata:
res = await ApiService.getUpdataUserFace(pic.path, widget.data);
break;
case FaceMode.scan:
res = await ApiService.getScanUserFace(pic.path, widget.data);
break;
}
if (res['result'] == 'success') { if (res['result'] == 'success') {
_onSuccess(); _onSuccess();
} else { } else {
@ -335,7 +334,7 @@ class _FaceRecognitionPageState extends State<FaceRecognitionPage>
void _onSuccess() { void _onSuccess() {
_timer?.cancel(); _timer?.cancel();
if (widget.mode == FaceMode.manual) { if (widget.mode == FaceMode.setUpdata) {
ToastUtil.showSuccess(context, '已更新人脸信息'); ToastUtil.showSuccess(context, '已更新人脸信息');
Future.delayed(const Duration(milliseconds: 800), () { Future.delayed(const Duration(milliseconds: 800), () {
if (mounted) Navigator.of(context).pop(true); if (mounted) Navigator.of(context).pop(true);

View File

@ -236,7 +236,7 @@ class _StudyDetailPageState extends State<StudyDetailPage>
} }
} catch (_) {} } catch (_) {}
await _navigateFaceIfNeeded(() async { await _navigateFaceIfNeeded(data,() async {
if ((data['IS_VIDEO'] ?? 0) == 1) { if ((data['IS_VIDEO'] ?? 0) == 1) {
// //
if (data['VIDEOFILES'] != null) { if (data['VIDEOFILES'] != null) {
@ -289,7 +289,7 @@ class _StudyDetailPageState extends State<StudyDetailPage>
}); });
} }
Future<void> _navigateFaceIfNeeded(FutureOr<void> Function() onPass) async { Future<void> _navigateFaceIfNeeded(Map data, FutureOr<void> Function() onPass) async {
if (!_isFace) { if (!_isFace) {
await onPass(); await onPass();
return; return;
@ -303,13 +303,16 @@ class _StudyDetailPageState extends State<StudyDetailPage>
await _exitTopRouteAndWait(); await _exitTopRouteAndWait();
await _lockPortrait(); await _lockPortrait();
final passed = await pushPage<bool>( final passed = await pushPage<bool>(
FaceRecognitionPage( FaceRecognitionPage (
studentId: widget.studentId, studentId: widget.studentId,
VIDEOCOURSEWARE_ID: "", data: {
CURRICULUM_ID: "", 'CLASS_ID': widget.studyData['CLASS_ID'],
CHAPTER_ID: "", 'STUDENT_ID': widget.studyData['STUDENT_ID'],
CLASS_ID: "", 'CURRICULUM_ID': data['CURRICULUM_ID'],
mode: FaceMode.auto, 'CHAPTER_ID': data['CHAPTER_ID'],
'VIDEOCOURSEWARE_ID': data['VIDEOCOURSEWARE_ID']
},
mode: FaceMode.study,
), ),
context, context,
); );
@ -332,17 +335,17 @@ class _StudyDetailPageState extends State<StudyDetailPage>
if (ok) { if (ok) {
await _exitTopRouteAndWait(); await _exitTopRouteAndWait();
await _lockPortrait(); await _lockPortrait();
await pushPage( await pushPage(FaceRecognitionPage (
const FaceRecognitionPage( studentId: widget.studentId,
studentId: '', data: {
VIDEOCOURSEWARE_ID: '', 'CLASS_ID': widget.studyData['CLASS_ID'],
CURRICULUM_ID: '', 'STUDENT_ID': widget.studyData['STUDENT_ID'],
CHAPTER_ID: '', 'CURRICULUM_ID': data['CURRICULUM_ID'],
CLASS_ID: '', 'CHAPTER_ID': data['CHAPTER_ID'],
mode: FaceMode.manual, 'VIDEOCOURSEWARE_ID': data['VIDEOCOURSEWARE_ID']
), },
context, mode: FaceMode.study,
); ), context);
await _restoreDefaultOrientations(); await _restoreDefaultOrientations();
} }
} }
@ -695,13 +698,16 @@ class _StudyDetailPageState extends State<StudyDetailPage>
await _lockPortrait(); await _lockPortrait();
final passed = await pushPage<bool>( final passed = await pushPage<bool>(
FaceRecognitionPage( FaceRecognitionPage (
studentId: widget.studentId, studentId: widget.studentId,
VIDEOCOURSEWARE_ID: "", data: {
CURRICULUM_ID: "", 'CLASS_ID': widget.studyData['CLASS_ID'],
CHAPTER_ID: "", 'STUDENT_ID': widget.studyData['STUDENT_ID'],
CLASS_ID: "", 'CURRICULUM_ID': _currentVideoData?['CURRICULUM_ID'],
mode: FaceMode.auto, 'CHAPTER_ID': _currentVideoData?['CHAPTER_ID'],
'VIDEOCOURSEWARE_ID': _currentVideoData?['VIDEOCOURSEWARE_ID']
},
mode: FaceMode.study,
), ),
context, context,
); );

View File

@ -76,7 +76,7 @@ class ItemListWidget {
onChanged: onChanged, onChanged: onChanged,
onSubmitted: onFieldSubmitted, onSubmitted: onFieldSubmitted,
keyboardType: actualKeyboardType, keyboardType: actualKeyboardType,
maxLength: showMaxLength?120:null, maxLength: showMaxLength ? 120 : null,
style: TextStyle(fontSize: fontSize), style: TextStyle(fontSize: fontSize),
maxLines: 1, maxLines: 1,
// //
@ -146,6 +146,7 @@ class ItemListWidget {
bool isRequired = true, bool isRequired = true,
String hintText = '请输入', String hintText = '请输入',
ValueChanged<String>? onChanged, ValueChanged<String>? onChanged,
bool showMaxLength = false,
}) { }) {
return Container( return Container(
// padding线 // padding线
@ -179,6 +180,7 @@ class ItemListWidget {
maxLines: null, maxLines: null,
expands: true, expands: true,
onChanged: onChanged, onChanged: onChanged,
maxLength: showMaxLength ? 120 : null,
// //
textAlignVertical: TextAlignVertical.top, textAlignVertical: TextAlignVertical.top,
style: TextStyle(fontSize: fontSize), style: TextStyle(fontSize: fontSize),

View File

@ -187,7 +187,6 @@ class _HotworkSafeFuncSureState extends State<HotworkSafeFuncSure> {
/// 1 0 /// 1 0
Future<void> _submit(String status) async { Future<void> _submit(String status) async {
if (imagePaths.isEmpty) { if (imagePaths.isEmpty) {
ToastUtil.showNormal(context, '请签字'); ToastUtil.showNormal(context, '请签字');
return; return;
@ -208,19 +207,19 @@ class _HotworkSafeFuncSureState extends State<HotworkSafeFuncSure> {
title: '作废原因', title: '作废原因',
hintText: '请输入作废原因', hintText: '请输入作废原因',
cancelText: '取消', cancelText: '取消',
confirmText: '确定' confirmText: '确定',
); );
// //
if (reasonText == null) { if (reasonText == null) {
// //
return; return;
} }
// //
if (reasonText.isEmpty) { if (reasonText.isEmpty) {
ToastUtil.showNormal(context, '请填写作废原因'); ToastUtil.showNormal(context, '请填写作废原因');
return; return;
} }
} }
final Map<String, dynamic> formData = {}; final Map<String, dynamic> formData = {};
// //
@ -377,11 +376,11 @@ if (reasonText.isEmpty) {
), ),
], ],
), ),
ItemListWidget.singleLineTitleText( ItemListWidget.multiLineTitleTextField(
label: '其他安全措施:', label: '其他安全措施:',
showMaxLength:true, showMaxLength: true,
isEditable: true, isEditable: true,
isRequired: true,
hintText: '请输入其他安全措施', hintText: '请输入其他安全措施',
controller: _otherController, controller: _otherController,
), ),

View File

@ -430,11 +430,11 @@ if (reasonText.isEmpty) {
), ),
], ],
), ),
ItemListWidget.singleLineTitleText( ItemListWidget.multiLineTitleTextField(
label: '其他安全措施:', label: '其他安全措施:',
showMaxLength:true, showMaxLength: true,
isEditable: true, isEditable: true,
isRequired: true,
hintText: '请输入其他安全措施', hintText: '请输入其他安全措施',
controller: _otherController, controller: _otherController,
), ),

View File

@ -389,11 +389,11 @@ if (reasonText.isEmpty) {
), ),
], ],
), ),
ItemListWidget.singleLineTitleText( ItemListWidget.multiLineTitleTextField(
label: '其他安全措施:', label: '其他安全措施:',
showMaxLength:true, showMaxLength: true,
isEditable: true, isEditable: true,
isRequired: true,
hintText: '请输入其他安全措施', hintText: '请输入其他安全措施',
controller: _otherController, controller: _otherController,
), ),

View File

@ -388,11 +388,11 @@ if (reasonText.isEmpty) {
), ),
], ],
), ),
ItemListWidget.singleLineTitleText( ItemListWidget.multiLineTitleTextField(
label: '其他安全措施:', label: '其他安全措施:',
showMaxLength:true, showMaxLength: true,
isEditable: true, isEditable: true,
isRequired: true,
hintText: '请输入其他安全措施', hintText: '请输入其他安全措施',
controller: _otherController, controller: _otherController,
), ),

View File

@ -376,11 +376,11 @@ if (reasonText.isEmpty) {
), ),
], ],
), ),
ItemListWidget.singleLineTitleText( ItemListWidget.multiLineTitleTextField(
label: '其他安全措施:', label: '其他安全措施:',
showMaxLength: true,
isEditable: true, isEditable: true,
showMaxLength:true, isRequired: true,
hintText: '请输入其他安全措施', hintText: '请输入其他安全措施',
controller: _otherController, controller: _otherController,
), ),

View File

@ -378,11 +378,11 @@ if (reasonText.isEmpty) {
), ),
], ],
), ),
ItemListWidget.singleLineTitleText( ItemListWidget.multiLineTitleTextField(
label: '其他安全措施:', label: '其他安全措施:',
showMaxLength:true, showMaxLength: true,
isEditable: true, isEditable: true,
isRequired: true,
hintText: '请输入其他安全措施', hintText: '请输入其他安全措施',
controller: _otherController, controller: _otherController,
), ),

View File

@ -391,11 +391,11 @@ if (reasonText.isEmpty) {
), ),
], ],
), ),
ItemListWidget.singleLineTitleText( ItemListWidget.multiLineTitleTextField(
label: '其他安全措施:', label: '其他安全措施:',
showMaxLength:true, showMaxLength: true,
isEditable: true, isEditable: true,
isRequired: true,
hintText: '请输入其他安全措施', hintText: '请输入其他安全措施',
controller: _otherController, controller: _otherController,
), ),

View File

@ -376,11 +376,11 @@ if (reasonText.isEmpty) {
), ),
], ],
), ),
ItemListWidget.singleLineTitleText( ItemListWidget.multiLineTitleTextField(
label: '其他安全措施:', label: '其他安全措施:',
showMaxLength:true, showMaxLength: true,
isEditable: true, isEditable: true,
isRequired: true,
hintText: '请输入其他安全措施', hintText: '请输入其他安全措施',
controller: _otherController, controller: _otherController,
), ),

View File

@ -5,6 +5,8 @@ import 'package:fluttertoast/fluttertoast.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart'; import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/pages/mine/mine_set_pwd_page.dart'; import 'package:qhd_prevention/pages/mine/mine_set_pwd_page.dart';
import 'package:qhd_prevention/services/auth_service.dart'; import 'package:qhd_prevention/services/auth_service.dart';
import 'package:qhd_prevention/tools/tools.dart';
import 'package:qhd_prevention/tools/update/update_dialogs.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../tools/tools.dart'; import '../tools/tools.dart';
import 'main_tab.dart'; import 'main_tab.dart';
@ -97,19 +99,25 @@ class _LoginPageState extends State<LoginPage> {
try{ try{
final result = await AuthService.checkUpdate(); final result = await AuthService.checkUpdate();
if (FormUtils.hasValue(result, 'pd')) { if (FormUtils.hasValue(result, 'pd')) {
//
Map pd = result['pd']; Map pd = result['pd'];
CustomAlertDialog.showConfirm( final versionInfo = await getAppVersion();
context, bool isWifi = await checkNetworkWifi();
title: '更新通知', if (versionInfo.versionName != pd['VERSION']) {
cancelText: '', //
confirmText: '我知道了', final ok = await CustomAlertDialog.showConfirm(
content: pd['UPLOAD_CONTENT'] ?? '', context,
onConfirm: () { title: '更新通知',
ToastUtil.showNormal(context, '更新去吧!'); content: isWifi ? '发现新版本,是否更新?为了更好的体验,请更新到最新版本。' : '发现新版本,检查到您当前使用的是移动网络,是否更新?更新时请注意流量消耗。为了更好的体验,请更新到最新版本。',
}, cancelText: pd['ISUPDATE'] == '1' ? '' : '稍后更新',
); confirmText: '立即更新'
return; );
if (ok) {
// await showUpdateConfirmDialog(context, apkUrl: apkUrl);
}
return;
}
} }
}catch(_) {} }catch(_) {}

View File

@ -26,6 +26,7 @@ class _MineSetPageState extends State<MineSetPage> {
final result = await AuthService.checkUpdate(); final result = await AuthService.checkUpdate();
LoadingDialogHelper.hide(); LoadingDialogHelper.hide();
if (FormUtils.hasValue(result, 'pd')) { if (FormUtils.hasValue(result, 'pd')) {
// //
Map pd = result['pd']; Map pd = result['pd'];
CustomAlertDialog.showConfirm( CustomAlertDialog.showConfirm(
@ -68,10 +69,8 @@ class _MineSetPageState extends State<MineSetPage> {
child: _setItemWidget("更新人脸信息"), child: _setItemWidget("更新人脸信息"),
onTap: () { onTap: () {
pushPage( pushPage(
const FaceRecognitionPage(studentId: '', const FaceRecognitionPage(studentId: '',data: {},
VIDEOCOURSEWARE_ID: '',CURRICULUM_ID: '', mode: FaceMode.setUpdata),
CHAPTER_ID: '',CLASS_ID: '',
mode: FaceMode.manual),
context, context,
); );
}, },

View File

@ -7,6 +7,7 @@ import 'package:flutter/services.dart';
import 'dart:io'; import 'dart:io';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
int getRandomWithNum(int min, int max) { int getRandomWithNum(int min, int max) {
if (max < min) { if (max < min) {
@ -594,3 +595,19 @@ class CameraPermissionHelper {
} }
} }
Future<bool> checkNetworkWifi() async {
final connectivityResult = await Connectivity().checkConnectivity();
if (connectivityResult == ConnectivityResult.mobile) {
print("当前是移动网络(可能是 2G/3G/4G/5G");
} else if (connectivityResult == ConnectivityResult.wifi) {
return true;
print("当前是 WiFi");
} else if (connectivityResult == ConnectivityResult.ethernet) {
print("当前是有线网络");
} else if (connectivityResult == ConnectivityResult.none) {
print("当前无网络连接");
}
return false;
}