diff --git a/android/gradle.properties b/android/gradle.properties index 24863d2..475a628 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,7 @@ org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true -android.enableJetifier=true \ No newline at end of file +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 diff --git a/lib/pages/home/unit/unit_service_list_page.dart b/lib/pages/home/unit/unit_service_list_page.dart new file mode 100644 index 0000000..86226b6 --- /dev/null +++ b/lib/pages/home/unit/unit_service_list_page.dart @@ -0,0 +1,205 @@ +import 'dart:convert'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.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 { + // Data and state variables + List list = []; + int currentPage = 1; + int rows = 10; + int totalPage = 1; + bool isLoading = false; + + List> flowList = []; + final GlobalKey _scaffoldKey = GlobalKey(); + 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 _fetchData() async { + // if (isLoading) return; + // setState(() => isLoading = true); + // + // try { + // + // final data = { + // 'pageIndex': currentPage, + // 'pageSize': rows, + // 'eqUserId': SessionService.instance.accountId + // }; + // final response = await BasicInfoApi.getFirmListByUser(data); + // setState(() { + // if (currentPage == 1) { + // list = response['data']; + // } else { + // list.addAll(response['data']); + // } + // Map page = response['page']; + // totalPage = page['totalPage'] ?? 1; + // isLoading = false; + // }); + // } catch (e) { + // print('Error fetching data: $e'); + // setState(() => isLoading = false); + // } + } + + //查看 + void _goToDetail(Map item) async { + await pushPage( + UnitJoinDetailPage(firmId: item['id'],), + context, + ); + _fetchData(); + } + + + + + Widget _buildListItem(Map 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['corpinfoName'] ?? ''}', + 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['corpinfoName'] ?? ''}", + maxLines: 5, + overflow: TextOverflow.ellipsis, + ), + + const SizedBox(height: 8), + Text( + "项目类型: ${statusInfo['${item['status']}'] ?? ''}", + 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()), + ); + } +} diff --git a/lib/pages/home/unit/unit_tab_page.dart b/lib/pages/home/unit/unit_tab_page.dart index 5cf0c50..ed7aca7 100644 --- a/lib/pages/home/unit/unit_tab_page.dart +++ b/lib/pages/home/unit/unit_tab_page.dart @@ -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 { final title = _masterButtons[index]['title'] as String; switch (title) { case '服务单位管理': - ToastUtil.showNormal(context, '您还没有参与项目'); + // ToastUtil.showNormal(context, '您还没有参与项目'); + pushPage(UnitServiceListPage(), context); break; case '就职单位管理': pushPage(UnitJoinListPage(), context); diff --git a/lib/pages/user/login_page.dart b/lib/pages/user/login_page.dart index c44933a..72c4c48 100644 --- a/lib/pages/user/login_page.dart +++ b/lib/pages/user/login_page.dart @@ -402,7 +402,8 @@ class _LoginPageState extends State { 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 { 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, );