Merge remote-tracking branch 'origin/master'

master
hs 2026-06-15 16:06:27 +08:00
commit 5edff0f2e2
8 changed files with 376 additions and 22 deletions

View File

@ -1,3 +1,7 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
# This builtInKotlin flag was added automatically by Flutter migrator
android.builtInKotlin=false
# This newDsl flag was added automatically by Flutter migrator
android.newDsl=false

View File

@ -93,6 +93,16 @@ class BasicInfoApi {
data: {...data},
);
}
///
static Future<Map<String, dynamic>> getUnitServiceList(Map data) {
return HttpManager().request(
ApiService.basePath ,
'/xgfManager/project/projectPageByUser',
method: Method.post,
data: {...data},
);
}
///
static Future<Map<String, dynamic>> getFirmInfo(String id) {
return HttpManager().request(

View File

@ -30,14 +30,20 @@ class ScanPage extends StatefulWidget {
class _ScanPageState extends State<ScanPage> {
final MobileScannerController _controller = MobileScannerController();
bool _torchOn = false;
bool _hasPermission = true; //
@override
void initState() {
super.initState();
// controller
_controller.addListener(_onControllerStateChange);
}
@override
void dispose() {
_controller.removeListener(_onControllerStateChange); //
_controller.dispose();
super.dispose();
}
@ -72,6 +78,27 @@ class _ScanPageState extends State<ScanPage> {
}
//
void _onControllerStateChange() {
final error = _controller.value.error;
if (error != null && mounted) {
//
if (error.errorCode == MobileScannerErrorCode.permissionDenied) {
setState(() {
_hasPermission = false;
});
print('相机权限被拒绝');
}
} else if (_controller.value.isRunning && mounted) {
//
setState(() {
_hasPermission = true;
});
}
}
//
void goToFace(Map<String, dynamic> stuInfo) async {
print('navigate to face with $stuInfo');
@ -234,6 +261,33 @@ class _ScanPageState extends State<ScanPage> {
},
),
),
// -
if (!_hasPermission)
Container(
color: Colors.black,
child: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.camera_alt, color: Colors.white, size: 64),
SizedBox(height: 20),
Text(
'需要相机权限才能使用扫码功能',
style: TextStyle(color: Colors.white, fontSize: 16),
),
SizedBox(height: 10),
Text(
'请在设置中允许相机权限',
style: TextStyle(color: Colors.white70, fontSize: 14),
),
],
),
),
),
],
),
);

View File

@ -0,0 +1,215 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:qhd_prevention/customWidget/toast_util.dart';
import 'package:qhd_prevention/pages/home/unit/unit_join_detail_page.dart';
import 'package:qhd_prevention/pages/home/unit/unit_quit_apply_page.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
import 'package:qhd_prevention/services/SessionService.dart';
import 'package:qhd_prevention/services/StorageService.dart';
import 'package:qhd_prevention/tools/tools.dart';
import 'package:qhd_prevention/customWidget/custom_button.dart';
import 'package:qhd_prevention/http/ApiService.dart';
class UnitServiceListPage extends StatefulWidget {
const UnitServiceListPage({Key? key}) : super(key: key);
@override
_UnitServiceListPageState createState() => _UnitServiceListPageState();
}
class _UnitServiceListPageState extends State<UnitServiceListPage> {
// Data and state variables
List<dynamic> list = [];
int currentPage = 1;
int rows = 20;
int totalPage = 1;
bool isLoading = false;
List<Map<String, dynamic>> flowList = [];
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
final ScrollController _scrollController = ScrollController();
final employmentFlag = {'0': '离职', '1': '在职', '3': '未入职'};
final statusInfo = {
'1': '待审批',
'2': '通过',
'3': '驳回',
};
@override
void initState() {
super.initState();
_fetchData();
_scrollController.addListener(_onScroll);
}
@override
void dispose() {
_scrollController.dispose();
super.dispose();
}
void _onScroll() {
if (_scrollController.position.pixels >=
_scrollController.position.maxScrollExtent &&
!isLoading) {
if (currentPage < totalPage) {
currentPage++;
_fetchData();
}
}
}
String formatDate(String dateTimeStr) {
if (dateTimeStr == null || dateTimeStr.isEmpty) {
return '';
}
// DateTime
DateTime dateTime = DateTime.parse(dateTimeStr);
final time = dateTime == null ? '' : '${dateTime.year}${dateTime.month}${dateTime.day}';
//
return time;
}
Future<void> _fetchData() async {
if (isLoading) return;
setState(() => isLoading = true);
try {
final data = {
'pageIndex': currentPage,
'pageSize': rows,
"eqProjectStatus":4,
"searchType":5,
// 'eqUserId': SessionService.instance.accountId
};
// LoadingDialogHelper.show();
final response = await BasicInfoApi.getUnitServiceList(data);
// LoadingDialogHelper.hide();
if (response['success']) {
setState(() {
if (currentPage == 1) {
list = response['data'];
} else {
list.addAll(response['data']);
}
Map<String, dynamic> page = response['page'];
totalPage = page['totalPage'] ?? 1;
isLoading = false;
});
}else {
ToastUtil.showNormal(context, '获取列表失败');
setState(() => isLoading = false);
}
} catch (e) {
print('Error fetching data: $e');
setState(() => isLoading = false);
}
}
//
void _goToDetail(Map<String, dynamic> item) async {
// await pushPage(
// UnitJoinDetailPage(firmId: item['id'],),
// context,
// );
// _fetchData();
}
Widget _buildListItem(Map<String, dynamic> item) {
return Card(
color: Colors.white,
margin: const EdgeInsets.all(8.0),
child: InkWell(
onTap: () => _goToDetail(item),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'服务单位名称:${item['companyName'] ?? ''}',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
],
),
const SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"所属公司: ${item['corpinfoName'] ?? ''}",
maxLines: 5,
overflow: TextOverflow.ellipsis,
),
],
),
const SizedBox(height: 8),
Text(
"项目名称: ${item['projectName'] ?? ''}",
maxLines: 5,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 8),
Text(
"项目类型: ${item['qualificationsTypeName']??''}",
maxLines: 5,
overflow: TextOverflow.ellipsis,
),
],
),
),
),
);
}
Widget _buildListContent() {
if (isLoading && list.isEmpty) {
//
return Center(child: CircularProgressIndicator());
} else if (list.isEmpty) {
//
return NoDataWidget.show();
} else {
//
return ListView.builder(
padding: EdgeInsets.zero,
controller: _scrollController,
itemCount: list.length + (isLoading ? 1 : 0),
itemBuilder: (context, index) {
if (index >= list.length) {
//
return Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: Center(child: CircularProgressIndicator()),
);
}
return _buildListItem(list[index]);
},
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar: MyAppbar(title: '服务单位', actions: []),
body: SafeArea(child: _buildListContent()),
);
}
}

View File

@ -6,6 +6,7 @@ import 'package:qhd_prevention/customWidget/work_tab_icon_grid.dart';
import 'package:qhd_prevention/http/ApiService.dart';
import 'package:qhd_prevention/customWidget/IconBadgeButton.dart';
import 'package:qhd_prevention/pages/home/unit/unit_join_list_page.dart';
import 'package:qhd_prevention/pages/home/unit/unit_service_list_page.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
import 'package:qhd_prevention/tools/tools.dart';
import 'package:qhd_prevention/common/route_aware_state.dart';
@ -144,7 +145,8 @@ class _UnitTabPageState extends RouteAwareState<UnitTabPage> {
final title = _masterButtons[index]['title'] as String;
switch (title) {
case '服务单位管理':
ToastUtil.showNormal(context, '您还没有参与项目');
// ToastUtil.showNormal(context, '您还没有参与项目');
pushPage(UnitServiceListPage(), context);
break;
case '就职单位管理':
pushPage(UnitJoinListPage(), context);

View File

@ -195,10 +195,7 @@ class MinePageState extends State<MinePage> {
//
Future<void> _getUserInfo() async {
setState(() {
name = SessionService.instance.userData?.name ?? "登录/注册";
phone = SessionService.instance.userData?.phone ?? "";
});
// final accountId =
// SessionService.instance.accountId ??
// SessionService.instance.userData?.id ??
@ -214,6 +211,24 @@ class MinePageState extends State<MinePage> {
// phone = SessionService.instance.userData?.phone ?? "";
// });
// }
final res = await BasicInfoApi.getUserMessage(
'${SessionService.instance.accountId}',
);
if (res['success']) {
final data = res['data'];
setState(() {
name = data['name'] ?? "登录/注册";
phone = data['username'] ?? "";
});
}else{
setState(() {
name = SessionService.instance.userData?.name ?? "登录/注册";
phone = SessionService.instance.userData?.phone ?? "";
});
}
}
Future<void> _logout() async {
@ -354,6 +369,7 @@ class MinePageState extends State<MinePage> {
FullUserinfoPage(isEidt: false, isChooseFirm: true),
context,
);
_getUserInfo();
break;
case 'changePwd':
await pushPage(MineSetPwdPage('0'), context);
@ -364,7 +380,9 @@ class MinePageState extends State<MinePage> {
context,
);
if (result == null) return;
pushPage(OnboardingFullPage(scanData: result), context);
await pushPage(OnboardingFullPage(scanData: result), context);
_getUserInfo();
break;
case 'face':
pushPage(
@ -395,6 +413,7 @@ class MinePageState extends State<MinePage> {
_logout();
break;
default:
break;
}
}

View File

@ -252,7 +252,7 @@ class _FullUserinfoPageState extends State<FullUserinfoPage> {
_birthText = idInfo.birth ?? '';
}
if (idPhotos.length < 2 && !_isChange) {
if (_idCardImgList.length < 2 && _isChange) {
ToastUtil.showNormal(context, '请上传2张身份证照片');
return;
}
@ -547,33 +547,81 @@ class _FullUserinfoPageState extends State<FullUserinfoPage> {
onTap: () {},
),
const Divider(),
if (_isEdit || _idCardImgList.isNotEmpty)
if (!_isEdit&&_idCardImgList.isNotEmpty)//_isEdit||_idCardImgList.isNotEmpty
RepairedPhotoSection(
title: '身份证照片',
isRequired: _isEdit,
isRequired: false,
maxCount: 2,
initialMediaPaths: _idCardImgList
.map(
(item) => ApiService.baseImgPath + item,
)
.toList(),
isEdit: _isEdit,
horizontalPadding: _isEdit ? 12 : 0,
isEdit: false,
horizontalPadding: false ? 12 : 0,
inlineImageWidth: 60,
onChanged: (files) {
idPhotos = files.map((file) => file.path).toList();
// idPhotos = files.map((file) => file.path).toList();
},
onMediaRemovedForIndex: (index) async {
final deleFile = _idCardImgList[index];
final deleId = _idCartImgIds[index];
if (deleFile.contains(UploadFileType.idCardPhoto.path)) {
_idCardImgList.removeAt(index);
_idCartImgIds.removeAt(index);
_idCardImgRemoveList.add(deleId);
}
// final deleFile = _idCardImgList[index];
// final deleId = _idCartImgIds[index];
// if (deleFile.contains(UploadFileType.idCardPhoto.path)) {
// _idCardImgList.removeAt(index);
// _idCartImgIds.removeAt(index);
// _idCardImgRemoveList.add(deleId);
// }
},
onAiIdentify: () {},
),
if (_isEdit )
RepairedPhotoSection(
title: '身份证照片',
isRequired: true,
maxCount: 2,
followInitialUpdates:true,
initialMediaPaths: _idCardImgList
.map(
(item) => ApiService.baseImgPath + item,
)
.toList(),
isEdit: true,
horizontalPadding: true ? 12 : 0,
inlineImageWidth: 60,
onChanged: (files) {
// idPhotos = files.map((file) => file.path).toList();
},
onMediaAdded: (value) {
setState(() {
idPhotos.add(value);
_idCardImgList.add(value);
});
},
onMediaRemovedForIndex: (index) async {
final deleFile = _idCardImgList[index];
try{
final deleId = _idCartImgIds[index];
if (deleFile.contains(UploadFileType.idCardPhoto.path)) {
setState(() {
_idCardImgList.removeAt(index);
_idCartImgIds.removeAt(index);
_idCardImgRemoveList.add(deleId);
});
}
}catch(e){
setState(() {
_idCardImgList.removeAt(index);
//
idPhotos.removeWhere((path) => path == deleFile);
});
debugPrint('$e');
}
},
onAiIdentify: () {},
),
if (_isEdit)
ItemListWidget.itemContainer(
const Text(

View File

@ -402,7 +402,8 @@ class _LoginPageState extends State<LoginPage> {
const WebViewPage(
name: "用户服务协议",
url:
'http://47.92.102.56:7811/file/xieyi/zsyhxy.htm',
'https://qaaq.qhdsafety.com/help/gwj/gwj-zsyhxy.htm',
// 'http://47.92.102.56:7811/file/xieyi/zsyhxy.htm',
),
context,
);
@ -428,7 +429,8 @@ class _LoginPageState extends State<LoginPage> {
const WebViewPage(
name: "隐私政策",
url:
'http://47.92.102.56:7811/file/xieyi/zsysq.htm',
'https://qaaq.qhdsafety.com/help/gwj/gwj-zsysq.htm',
// 'http://47.92.102.56:7811/file/xieyi/zsysq.htm',
),
context,
);