11 Commits

Author SHA1 Message Date
e59b89c225 Merge branch 'dev_feature' into dev
ui调整
# Conflicts:
#	ln_jq_app/lib/pages/b_page/reservation/controller.dart
#	ln_jq_app/lib/pages/b_page/site/controller.dart
#	ln_jq_app/lib/pages/b_page/site/view.dart
#	ln_jq_app/lib/pages/c_page/mine/view.dart
#	ln_jq_app/lib/pages/c_page/reservation/controller.dart
#	ln_jq_app/lib/pages/c_page/reservation/view.dart
#	ln_jq_app/lib/pages/login/view.dart
2026-01-29 11:45:17 +08:00
5722e3ace0 ios build 2026-01-16 15:00:45 +08:00
d41b21654a 改用账号推送 2026-01-16 14:35:11 +08:00
2eb059defd 定时器黄字2位小数 2026-01-16 13:35:38 +08:00
fbcc85af2a 站点增加消息入口 2026-01-16 13:06:35 +08:00
9a97b56505 定时器显示调整 2026-01-15 17:55:07 +08:00
8302d7c179 优化问题修改 2026-01-15 16:28:59 +08:00
e7a9e4483a 优化定时器 弹窗 2026-01-15 13:29:02 +08:00
9b64fdfa52 优化定时器 2026-01-15 13:24:02 +08:00
d8f335eb4e 优化 2026-01-15 09:30:47 +08:00
d1b7a9eb76 v1.2.2 version 2026-01-14 13:21:54 +08:00
21 changed files with 274 additions and 79 deletions

View File

@@ -1,3 +1,6 @@
import java.util.Properties
import java.io.FileInputStream
plugins { plugins {
id("com.android.application") id("com.android.application")
id("kotlin-android") id("kotlin-android")
@@ -5,6 +8,14 @@ plugins {
id("dev.flutter.flutter-gradle-plugin") id("dev.flutter.flutter-gradle-plugin")
} }
val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystorePropertiesFile.inputStream().use { input ->
keystoreProperties.load(input.reader(Charsets.UTF_8))
}
}
android { android {
namespace = "com.lnkj.ln_jq_app" namespace = "com.lnkj.ln_jq_app"
compileSdk = flutter.compileSdkVersion compileSdk = flutter.compileSdkVersion
@@ -26,15 +37,30 @@ android {
// For more information, see: https://flutter.dev/to/review-gradle-config. // For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion targetSdk = flutter.targetSdkVersion
versionCode = 4 versionCode = 5
versionName = "1.2.1" versionName = "1.2.2"
}
signingConfigs {
create("release") {
keyAlias = keystoreProperties["keyAlias"] as String?
keyPassword = keystoreProperties["keyPassword"] as String?
val storeFilePath = keystoreProperties["storeFile"] as String?
storeFile = if (storeFilePath != null) file(storeFilePath) else null
storePassword = keystoreProperties["storePassword"] as String?
}
} }
buildTypes { buildTypes {
release { getByName("release") {
// TODO: Add your own signing config for the release build. // 使用上面定义的 release 签名
// Signing with the debug keys for now, so `flutter run --release` works. signingConfig = signingConfigs.getByName("release")
signingConfig = signingConfigs.getByName("debug")
// 修复混淆规则引用语法
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
} }
} }
} }

View File

@@ -0,0 +1,61 @@
# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
# 忽略 Google Play Core 相关的缺失警告(解决你目前的报错)
-dontwarn com.google.android.play.core.**
# Flutter 基础规则
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
-dontwarn com.huawei.android.os.BuildEx$VERSION
-dontwarn com.huawei.hianalytics.process.HiAnalyticsConfig$Builder
-dontwarn com.huawei.hianalytics.process.HiAnalyticsConfig
-dontwarn com.huawei.hianalytics.process.HiAnalyticsInstance$Builder
-dontwarn com.huawei.hianalytics.process.HiAnalyticsInstance
-dontwarn com.huawei.hianalytics.process.HiAnalyticsManager
-dontwarn com.huawei.hianalytics.util.HiAnalyticTools
-dontwarn com.huawei.hms.availableupdate.UpdateAdapterMgr
-dontwarn com.huawei.libcore.io.ExternalStorageFile
-dontwarn com.huawei.libcore.io.ExternalStorageFileInputStream
-dontwarn com.huawei.libcore.io.ExternalStorageFileOutputStream
-dontwarn com.huawei.libcore.io.ExternalStorageRandomAccessFile
-dontwarn org.android.netutil.PingEntry
-dontwarn org.android.netutil.PingResponse
-dontwarn org.android.netutil.PingTask
-dontwarn org.bouncycastle.crypto.BlockCipher
-dontwarn org.bouncycastle.crypto.engines.AESEngine
-dontwarn org.bouncycastle.crypto.prng.SP800SecureRandom
-dontwarn org.bouncycastle.crypto.prng.SP800SecureRandomBuilder
-keepclasseswithmembernames class ** {
native <methods>;
}
-keepattributes Signature
-keep class sun.misc.Unsafe { *; }
-keep class com.taobao.** {*;}
-keep class com.alibaba.** {*;}
-keep class com.alipay.** {*;}
-keep class com.ut.** {*;}
-keep class com.ta.** {*;}
-keep class anet.**{*;}
-keep class anetwork.**{*;}
-keep class org.android.spdy.**{*;}
-keep class org.android.agoo.**{*;}
-keep class android.os.**{*;}
-keep class org.json.**{*;}
-dontwarn com.taobao.**
-dontwarn com.alibaba.**
-dontwarn com.alipay.**
-dontwarn anet.**
-dontwarn org.android.spdy.**
-dontwarn org.android.agoo.**
-dontwarn anetwork.**
-dontwarn com.ut.**
-dontwarn com.ta.**

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -29,7 +29,7 @@ class LoginUtil {
} }
static ui.Image getAssImg(String imgName){ static ui.Image getAssImg(String imgName){
return ui.Image(image: ui.AssetImage('assets/images/$imgName.png')); return ui.Image(image: ui.AssetImage('assets/images/$imgName.png'),fit: ui.BoxFit.cover,);
} }
} }

View File

@@ -31,12 +31,19 @@ void main() async {
runApp( runApp(
GetxApp( GetxApp(
// 设计稿尺寸 单位dp
designSize: const Size(390, 844), designSize: const Size(390, 844),
// Getx Log
enableLog: true, enableLog: true,
// 默认的跳转动画
defaultTransition: Transition.rightToLeft, defaultTransition: Transition.rightToLeft,
// 主题模式
themeMode: GlobalService.to.themeMode, themeMode: GlobalService.to.themeMode,
// 主题
theme: AppTheme.light, theme: AppTheme.light,
// Dark主题
darkTheme: AppTheme.light, darkTheme: AppTheme.light,
// AppTitle
title: '小羚羚', title: '小羚羚',
// 将入口改为启动页 // 将入口改为启动页
home: const WelcomePage(), home: const WelcomePage(),

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:getx_scaffold/common/index.dart'; import 'package:getx_scaffold/common/index.dart';
import 'package:getx_scaffold/getx_scaffold.dart'; import 'package:getx_scaffold/getx_scaffold.dart';
import 'package:ln_jq_app/common/login_util.dart';
import 'package:ln_jq_app/pages/b_page/base_widgets/controller.dart'; import 'package:ln_jq_app/pages/b_page/base_widgets/controller.dart';
import 'package:ln_jq_app/pages/b_page/reservation/view.dart'; import 'package:ln_jq_app/pages/b_page/reservation/view.dart';
import 'package:ln_jq_app/pages/b_page/site/view.dart'; import 'package:ln_jq_app/pages/b_page/site/view.dart';
@@ -9,14 +10,16 @@ class B_BaseWidgetsPage extends GetView<B_BaseWidgetsController> {
B_BaseWidgetsPage({super.key}); B_BaseWidgetsPage({super.key});
final PageController _pageController = PageController(); final PageController _pageController = PageController();
// 主视图 // 主视图
Widget _buildView() { Widget _buildView() {
return PageView( return PageView(
controller: _pageController, controller: _pageController,
physics: const NeverScrollableScrollPhysics(), // 禁止滑动
onPageChanged: (index) { onPageChanged: (index) {
jumpTabAndPage(index); jumpTabAndPage(index);
}, },
children: _buildPages(), // 页面的列表 children: _buildPages(),
); );
} }
@@ -25,33 +28,59 @@ class B_BaseWidgetsPage extends GetView<B_BaseWidgetsController> {
controller.updateUi(); // 更新 UI controller.updateUi(); // 更新 UI
_pageController.jumpToPage(controller.pageIndex); _pageController.jumpToPage(controller.pageIndex);
} }
// 对应的页面 // 对应的页面
List<Widget> _buildPages() { List<Widget> _buildPages() {
return [ return [SitePage(), ReservationPage()];
SitePage(),
ReservationPage(),
];
} }
//导航栏 // 自定义导航栏 (悬浮胶囊样式)
Widget _buildNavigationBar() { Widget _buildNavigationBar() {
return NavigationX( return SafeArea(
currentIndex: controller.pageIndex, // 当前选中的tab索引 child: Container(
onTap: (index) { height: 50.h,
jumpTabAndPage(index); margin: const EdgeInsets.fromLTRB(24, 0, 24, 10), // 悬浮边距
}, // 切换tab事件 decoration: BoxDecoration(
items: [ color: Color.fromRGBO(240, 244, 247, 1), // 浅灰色背景
NavigationItemModel( borderRadius: BorderRadius.circular(30),
label: '加氢预约', boxShadow: [
icon: AntdIcon.orderedlist, BoxShadow(
selectedIcon: AntdIcon.calendar_fill, color: Colors.black.withOpacity(0.05),
), blurRadius: 10,
NavigationItemModel( offset: const Offset(0, 5),
label: '站点信息',
icon: AntdIcon.car,
selectedIcon: AntdIcon.car_fill,
), ),
], ],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_buildNavItem(0, "ic_h2_select@2x", "ic_h2@2x"),
_buildNavItem(1, "ic_h2_my@2x", "ic_h2_my_select@2x"),
],
),
),
);
}
// 构建单个导航项
Widget _buildNavItem(int index, String icon, String selectedIcon) {
bool isSelected = controller.pageIndex == index;
return GestureDetector(
onTap: () => jumpTabAndPage(index),
behavior: HitTestBehavior.opaque,
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
padding: EdgeInsets.symmetric(horizontal: 50.w, vertical: 8),
decoration: BoxDecoration(
color: isSelected ? const Color(0xFF006633) : Colors.transparent, // 选中时的深绿色背景
borderRadius: BorderRadius.circular(20),
),
child: SizedBox(
height: 24,
width: 24,
child: LoginUtil.getAssImg(isSelected ? selectedIcon : icon),
),
),
); );
} }

View File

@@ -173,6 +173,10 @@ class HistoryPage extends GetView<HistoryController> {
text = '未加氢'; text = '未加氢';
color = Colors.red; color = Colors.red;
break; break;
case ReservationStatus.cancel:
text = '已取消';
color = Colors.red;
break;
default: default:
text = '未知状态'; text = '未知状态';
color = Colors.grey; color = Colors.grey;

View File

@@ -332,7 +332,8 @@ class ReservationPage extends GetView<ReservationController> {
controller.jobTipStr, controller.jobTipStr,
style: TextStyle(color: Colors.yellow[800], fontSize: 14), style: TextStyle(color: Colors.yellow[800], fontSize: 14),
), ),
Icon(AntdIcon.question_circle, size: 14, color: Colors.yellow[800]), SizedBox(width: 2.w),
Icon(AntdIcon.info_circle, size: 14, color: Colors.yellow[800]),
], ],
), ),
), ),

View File

@@ -12,11 +12,13 @@ enum ReservationStatus {
completed, // 完成 ( addStatus: 1) completed, // 完成 ( addStatus: 1)
rejected, // 拒绝 ( -1) rejected, // 拒绝 ( -1)
unadded, // 未加 ( 2) unadded, // 未加 ( 2)
cancel, // 取消预约
unknown, // 未知状态 unknown, // 未知状态
} }
class ReservationModel { class ReservationModel {
final String id; final String id;
final String stationId;
final String plateNumber; final String plateNumber;
String amount; String amount;
final String time; final String time;
@@ -40,6 +42,7 @@ class ReservationModel {
ReservationModel({ ReservationModel({
required this.id, required this.id,
required this.stationId,
required this.plateNumber, required this.plateNumber,
required this.amount, required this.amount,
required this.time, required this.time,
@@ -80,6 +83,9 @@ class ReservationModel {
case 2: case 2:
currentStatus = ReservationStatus.unadded; currentStatus = ReservationStatus.unadded;
break; break;
case 6:
currentStatus = ReservationStatus.cancel;
break;
default: default:
currentStatus = ReservationStatus.unknown; currentStatus = ReservationStatus.unknown;
} }
@@ -97,6 +103,7 @@ class ReservationModel {
return ReservationModel( return ReservationModel(
// 原始字段用于UI兼容 // 原始字段用于UI兼容
id: json['id']?.toString() ?? '', id: json['id']?.toString() ?? '',
stationId: json['stationId']?.toString() ?? '',
plateNumber: json['plateNumber']?.toString() ?? '未知车牌', plateNumber: json['plateNumber']?.toString() ?? '未知车牌',
amount: '${json['hydAmount']?.toString() ?? '0'}kg', amount: '${json['hydAmount']?.toString() ?? '0'}kg',
time: timeRange, time: timeRange,
@@ -138,14 +145,23 @@ class SiteController extends GetxController with BaseControllerMixin {
final TextEditingController searchController = TextEditingController(); final TextEditingController searchController = TextEditingController();
bool isNotice = false; bool isNotice = false;
@override
bool get listenLifecycleEvent => true;
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
renderData(); renderData();
_msgNotice(); msgNotice();
startAutoRefresh(); startAutoRefresh();
} }
@override
void onPaused() {
stopAutoRefresh();
super.onPaused();
}
@override @override
void onClose() { void onClose() {
stopAutoRefresh(); stopAutoRefresh();
@@ -153,7 +169,7 @@ class SiteController extends GetxController with BaseControllerMixin {
super.onClose(); super.onClose();
} }
Future<void> _msgNotice() async { Future<void> msgNotice() async {
final Map<String, dynamic> requestData = { final Map<String, dynamic> requestData = {
'appFlag': 1, 'appFlag': 1,
'isRead': 1, 'isRead': 1,
@@ -169,6 +185,7 @@ class SiteController extends GetxController with BaseControllerMixin {
if (result.code == 0 && result.data != null) { if (result.code == 0 && result.data != null) {
String total = result.data["total"].toString(); String total = result.data["total"].toString();
isNotice = int.parse(total) > 0; isNotice = int.parse(total) > 0;
updateUi();
} }
} }
} }
@@ -183,7 +200,7 @@ class SiteController extends GetxController with BaseControllerMixin {
}); });
} }
/// 【6. 新增】停止定时器的方法 ///停止定时器的方法
void stopAutoRefresh() { void stopAutoRefresh() {
// 如果定时器存在并且是激活状态,就取消它 // 如果定时器存在并且是激活状态,就取消它
_refreshTimer?.cancel(); _refreshTimer?.cancel();
@@ -205,6 +222,7 @@ class SiteController extends GetxController with BaseControllerMixin {
'pageNum': 1, 'pageNum': 1,
'pageSize': 50, // 暂时不考虑分页一次获取30条 'pageSize': 50, // 暂时不考虑分页一次获取30条
'keyword': searchText, // 加氢站名称、手机号 'keyword': searchText, // 加氢站名称、手机号
'stationId': StorageService.to.userId
}, },
); );

View File

@@ -78,7 +78,7 @@ class SitePage extends GetView<SiteController> {
], ],
), ),
SizedBox(height: 35.h,), SizedBox(height: 35.h),
//第三部分 //第三部分
Container( Container(
padding: const EdgeInsets.all(15), padding: const EdgeInsets.all(15),
@@ -127,6 +127,7 @@ class SitePage extends GetView<SiteController> {
], ],
), ),
), ),
SizedBox(height: 35.h),
], ],
), ),
), ),
@@ -142,10 +143,7 @@ class SitePage extends GetView<SiteController> {
borderRadius: BorderRadius.vertical(bottom: Radius.circular(20)), borderRadius: BorderRadius.vertical(bottom: Radius.circular(20)),
), ),
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: MediaQuery top: MediaQuery.of(context).padding.top + 10,
.of(context)
.padding
.top + 10,
left: 20, left: 20,
right: 20, right: 20,
bottom: 25, bottom: 25,
@@ -204,8 +202,7 @@ class SitePage extends GetView<SiteController> {
const SizedBox(height: 25), const SizedBox(height: 25),
Row( Row(
children: [ children: [
_buildStatBox( _buildStatBox("剩余氢量", "remaining quantity", controller.leftHydrogen, "kg"),
"剩余氢量", "remaining quantity", controller.leftHydrogen, "kg"),
SizedBox(width: 4.w), SizedBox(width: 4.w),
_buildStatBox( _buildStatBox(
"今日加氢量", "今日加氢量",
@@ -367,15 +364,17 @@ class SitePage extends GetView<SiteController> {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Icon(Icons.inventory_2_outlined, size: 80, color: Colors.grey[300]), LoginUtil.getAssImg("ic_no_data@2x"),
const SizedBox(height: 16), SizedBox(height: 16.h),
const Text( Text(
'暂无预约数据', style: TextStyle(fontSize: 16, color: Colors.black54)), '暂无订单',
const SizedBox(height: 8), style: TextStyle(
const Text( fontSize: 16.sp,
'点击右上角刷新按钮获取最新数据', color: Colors.black54,
style: TextStyle(fontSize: 14, color: Colors.grey), fontWeight: FontWeight.w600,
), ),
),
const SizedBox(height: 8),
], ],
), ),
); );
@@ -546,7 +545,8 @@ class SitePage extends GetView<SiteController> {
} }
/// 通用小按钮 /// 通用小按钮
Widget _buildSmallButton(String text, { Widget _buildSmallButton(
String text, {
required bool isOutline, required bool isOutline,
required VoidCallback onTap, required VoidCallback onTap,
}) { }) {
@@ -601,6 +601,11 @@ class SitePage extends GetView<SiteController> {
textColor = const Color(0xFFFF7D7D); // 红色 textColor = const Color(0xFFFF7D7D); // 红色
bgColor = const Color(0xFFFFEEEE); bgColor = const Color(0xFFFFEEEE);
break; break;
case ReservationStatus.cancel:
text = '已取消';
textColor = const Color(0xFFFF7D7D); // 红色
bgColor = const Color(0xFFFFEEEE);
break;
default: default:
text = "未知"; text = "未知";
textColor = Colors.grey; textColor = Colors.grey;
@@ -690,6 +695,10 @@ class SitePage extends GetView<SiteController> {
text = '未加氢'; text = '未加氢';
color = Colors.red; color = Colors.red;
break; break;
case ReservationStatus.cancel:
text = '已取消';
color = Colors.red;
break;
default: default:
text = '未知状态'; text = '未知状态';
color = Colors.grey; color = Colors.grey;
@@ -716,7 +725,8 @@ class SitePage extends GetView<SiteController> {
} }
/// 构建信息详情行 /// 构建信息详情行
Widget _buildDetailRow(IconData icon, Widget _buildDetailRow(
IconData icon,
String label, String label,
String value, { String value, {
Color valueColor = Colors.black87, Color valueColor = Colors.black87,

View File

@@ -63,6 +63,7 @@ class CarInfoController extends GetxController with BaseControllerMixin {
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示 // 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
if (!StorageService.to.hasShownBindVehicleDialog && if (!StorageService.to.hasShownBindVehicleDialog &&
StorageService.to.isLoggedIn && StorageService.to.isLoggedIn &&
StorageService.to.loginChannel == LoginChannel.driver &&
!StorageService.to.hasVehicleInfo) { !StorageService.to.hasVehicleInfo) {
Future.delayed(const Duration(milliseconds: 500), () { Future.delayed(const Duration(milliseconds: 500), () {
DialogX.to.showConfirmDialog( DialogX.to.showConfirmDialog(

View File

@@ -19,6 +19,10 @@ class MessageController extends GetxController {
_loadData(isRefresh: true); _loadData(isRefresh: true);
} }
void onRefresh() => _loadData(isRefresh: true);
void onLoading() => _loadData(isRefresh: false);
Future<void> _loadData({bool isRefresh = false}) async { Future<void> _loadData({bool isRefresh = false}) async {
final int targetPage = isRefresh ? 1 : _pageNum + 1; final int targetPage = isRefresh ? 1 : _pageNum + 1;
@@ -100,9 +104,7 @@ class MessageController extends GetxController {
} }
} }
void onRefresh() => _loadData(isRefresh: true);
void onLoading() => _loadData(isRefresh: false);
// 标记全部已读 // 标记全部已读
void markAllRead() async { void markAllRead() async {

View File

@@ -57,7 +57,7 @@ class MineController extends GetxController with BaseControllerMixin {
_fetchAccidentCount(), // 请求2事故数 _fetchAccidentCount(), // 请求2事故数
_fetchBreakRulesCount(), // 请求3违章数 _fetchBreakRulesCount(), // 请求3违章数
_rating(), // 司机评分 _rating(), // 司机评分
_msgNotice(), // 红点消息 msgNotice(), // 红点消息
]); ]);
await renderViolation(); await renderViolation();
@@ -69,7 +69,7 @@ class MineController extends GetxController with BaseControllerMixin {
} }
} }
Future<void> _msgNotice() async { Future<void> msgNotice() async {
final Map<String, dynamic> requestData = { final Map<String, dynamic> requestData = {
'appFlag': 1, 'appFlag': 1,
'isRead': 1, 'isRead': 1,
@@ -85,6 +85,7 @@ class MineController extends GetxController with BaseControllerMixin {
if (result.code == 0 && result.data != null) { if (result.code == 0 && result.data != null) {
String total = result.data["total"].toString(); String total = result.data["total"].toString();
isNotice = int.parse(total) > 0; isNotice = int.parse(total) > 0;
updateUi();
} }
} }
} }

View File

@@ -335,12 +335,12 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
final startTimeStr = final startTimeStr =
'$dateStr ${_formatTimeOfDay(startTime.value)}:00'; // Use helper directly '$dateStr ${_formatTimeOfDay(startTime.value)}:00'; // Use helper directly
if (lastSuccessfulReservation != null && /*if (lastSuccessfulReservation != null &&
lastSuccessfulReservation!.id == selectedStationId.value && lastSuccessfulReservation!.id == selectedStationId.value &&
lastSuccessfulReservation!.startTime == startTimeStr) { lastSuccessfulReservation!.startTime == startTimeStr) {
showToast("请勿重复提交相同时间段的预约,可在“查看预约”中修改"); showToast("请勿重复提交相同时间段的预约,可在“查看预约”中修改");
return; return;
} }*/
final reservationEndDateTime = DateTime( final reservationEndDateTime = DateTime(
selectedDate.value.year, selectedDate.value.year,
@@ -401,6 +401,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
lastSuccessfulReservation = ReservationModel( lastSuccessfulReservation = ReservationModel(
id: selectedStationId.value!, id: selectedStationId.value!,
stationId: '',
hydAmount: ampuntStr, hydAmount: ampuntStr,
startTime: startTimeStr, startTime: startTimeStr,
endTime: endTimeStr, endTime: endTimeStr,
@@ -540,6 +541,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
//用来管理查看预约的弹窗 //用来管理查看预约的弹窗
Worker? _sheetWorker; Worker? _sheetWorker;
bool init = false; bool init = false;
Timer? _refreshTimer;
@override @override
bool get listenLifecycleEvent => true; bool get listenLifecycleEvent => true;
@@ -549,6 +551,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
super.onInit(); super.onInit();
getUserBindCarInfo(); getUserBindCarInfo();
getSiteList(); getSiteList();
startAutoRefresh();
_msgNotice(); _msgNotice();
if (!init) { if (!init) {
@@ -580,9 +583,26 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
} }
@override @override
void dispose() { void onPaused() {
_sheetWorker?.dispose(); stopAutoRefresh();
super.dispose(); super.onPaused();
}
void startAutoRefresh() {
// 先停止已存在的定时器,防止重复启动
stopAutoRefresh();
// 创建一个每1分钟执行一次的周期性定时器
_refreshTimer = Timer.periodic(const Duration(minutes: 1), (timer) {
getSiteList();
});
}
///停止定时器的方法
void stopAutoRefresh() {
// 如果定时器存在并且是激活状态,就取消它
_refreshTimer?.cancel();
_refreshTimer = null; // 置为null方便判断
} }
void _setupListener() { void _setupListener() {
@@ -684,8 +704,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
} }
updateUi(); updateUi();
} catch (e) { } catch (e) {}
}
renderSliderTheme(); renderSliderTheme();
} }
@@ -779,6 +798,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示 // 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
if (!StorageService.to.hasShownBindVehicleDialog && if (!StorageService.to.hasShownBindVehicleDialog &&
StorageService.to.isLoggedIn && StorageService.to.isLoggedIn &&
StorageService.to.loginChannel == LoginChannel.driver &&
!StorageService.to.hasVehicleInfo) { !StorageService.to.hasVehicleInfo) {
Future.delayed(const Duration(milliseconds: 500), () { Future.delayed(const Duration(milliseconds: 500), () {
DialogX.to.showConfirmDialog( DialogX.to.showConfirmDialog(
@@ -809,6 +829,8 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
if (_debounce != null) { if (_debounce != null) {
_debounce?.cancel(); _debounce?.cancel();
} }
_sheetWorker?.dispose();
stopAutoRefresh();
super.onClose(); super.onClose();
} }
} }

View File

@@ -132,7 +132,6 @@ class ReservationEditController extends GetxController with BaseControllerMixin
TimeSlot tempSlot = availableSlots[initialItem]; TimeSlot tempSlot = availableSlots[initialItem];
Get.bottomSheet( Get.bottomSheet(
Container( Container(
height: 300, height: 300,
@@ -228,6 +227,7 @@ class ReservationEditController extends GetxController with BaseControllerMixin
'appointment/orderAddHyd/saveOrUpdate', 'appointment/orderAddHyd/saveOrUpdate',
data: { data: {
'id': reservation.id, 'id': reservation.id,
'stationId': reservation.stationId,
'startTime': startTimeStr, 'startTime': startTimeStr,
'endTime': endTimeStr, 'endTime': endTimeStr,
'hydAmount': amountStr, 'hydAmount': amountStr,

View File

@@ -7,6 +7,7 @@ import 'package:getx_scaffold/getx_scaffold.dart';
import 'package:ln_jq_app/common/styles/theme.dart'; import 'package:ln_jq_app/common/styles/theme.dart';
import 'package:ln_jq_app/pages/b_page/base_widgets/view.dart'; import 'package:ln_jq_app/pages/b_page/base_widgets/view.dart';
import 'package:ln_jq_app/pages/c_page/base_widgets/view.dart'; import 'package:ln_jq_app/pages/c_page/base_widgets/view.dart';
import 'package:ln_jq_app/pages/c_page/message/view.dart';
import 'package:ln_jq_app/pages/login/view.dart'; import 'package:ln_jq_app/pages/login/view.dart';
import '../../storage_service.dart'; import '../../storage_service.dart';
@@ -156,6 +157,7 @@ class HomeController extends GetxController with BaseControllerMixin {
Future<void> _onNotificationOpened(Map<dynamic, dynamic> message) async { Future<void> _onNotificationOpened(Map<dynamic, dynamic> message) async {
Logger.d('onNotificationOpened ====> $message'); Logger.d('onNotificationOpened ====> $message');
await Get.to(() => const MessagePage());
} }
Future<void> _onNotificationRemoved(Map<dynamic, dynamic> message) async { Future<void> _onNotificationRemoved(Map<dynamic, dynamic> message) async {

View File

@@ -495,14 +495,25 @@ class _LoginPageState extends State<LoginPage> with SingleTickerProviderStateMix
phone: result.data['phone'], phone: result.data['phone'],
); );
// 成功后自动获取车辆信息 // 成功后自动获取车辆信息
try {
var carInfo = await HttpService.to.get( var carInfo = await HttpService.to.get(
"appointment/driver/getTruckInfoByDriver?phone=${result.data['phone']}", "appointment/driver/getTruckInfoByDriver?phone=${result.data['phone']}",
); );
if (carInfo != null) { if (carInfo != null) {
var carResult = BaseModel.fromJson(carInfo.data); var carInforesult = BaseModel.fromJson(carInfo.data);
if (carResult.data != null) if (carInforesult.data != null) {
await StorageService.to.saveVehicleInfo(VehicleInfo.fromJson(carResult.data)); final vehicle = VehicleInfo.fromJson(
carInforesult.data as Map<String, dynamic>,
);
//保存使用
await StorageService.to.saveVehicleInfo(vehicle);
} }
}
} catch (e) {
Logger.d("暂时不处理 查询车辆信息失败的情况");
}
dismissLoading(); dismissLoading();
Get.offAll(() => BaseWidgetsPage()); Get.offAll(() => BaseWidgetsPage());
} else { } else {

View File

@@ -142,7 +142,7 @@ class StorageService extends GetxService {
void delAlias() async { void delAlias() async {
String phoen = StorageService.to.phone ?? ""; String phoen = StorageService.to.phone ?? "";
var result = await _aliyunPush.removeAlias(phoen); var result = await await _aliyunPush.unbindAccount();
var code = result['code']; var code = result['code'];
if (code == kAliyunPushSuccessCode) { if (code == kAliyunPushSuccessCode) {
Logger.d('删除别名$phoen成功'); Logger.d('删除别名$phoen成功');

View File

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.2.1+4 version: 1.2.2+5
environment: environment:
sdk: ^3.9.0 sdk: ^3.9.0