增加弹窗限制条件
This commit is contained in:
@@ -32,7 +32,7 @@ class CarInfoController extends GetxController with BaseControllerMixin {
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
|
||||
if (!StorageService.to.hasShownBindVehicleDialog) {
|
||||
if (!StorageService.to.hasShownBindVehicleDialog && StorageService.to.isLoggedIn) {
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
DialogX.to.showConfirmDialog(
|
||||
title: '当前尚未绑定车辆',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -116,8 +118,12 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
||||
),
|
||||
CupertinoButton(
|
||||
onPressed: () {
|
||||
final bool isChangingToToday = tempDate.isAtSameMomentAs(today) && !selectedDate.value.isAtSameMomentAs(today);
|
||||
final bool isDateChanged = !tempDate.isAtSameMomentAs(selectedDate.value);
|
||||
final bool isChangingToToday =
|
||||
tempDate.isAtSameMomentAs(today) &&
|
||||
!selectedDate.value.isAtSameMomentAs(today);
|
||||
final bool isDateChanged = !tempDate.isAtSameMomentAs(
|
||||
selectedDate.value,
|
||||
);
|
||||
|
||||
// 更新选中的日期
|
||||
selectedDate.value = tempDate;
|
||||
@@ -144,8 +150,10 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
||||
child: CupertinoDatePicker(
|
||||
mode: CupertinoDatePickerMode.date,
|
||||
initialDateTime: selectedDate.value,
|
||||
minimumDate: today, // 最小可选日期为今天
|
||||
maximumDate: tomorrow, // 最大可选日期为明天
|
||||
minimumDate: today,
|
||||
// 最小可选日期为今天
|
||||
maximumDate: tomorrow,
|
||||
// 最大可选日期为明天
|
||||
// ---------------------
|
||||
onDateTimeChanged: (DateTime newDate) {
|
||||
tempDate = newDate;
|
||||
@@ -424,7 +432,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
||||
);
|
||||
|
||||
//打开预约列表
|
||||
Future.delayed(const Duration(milliseconds: 800), () {
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
getReservationList();
|
||||
});
|
||||
} else {
|
||||
@@ -442,8 +450,16 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
||||
// 新增预约数据列表
|
||||
List<ReservationModel> reservationList = [];
|
||||
|
||||
// --- 用于防抖的 Timer ---
|
||||
Timer? _debounce;
|
||||
|
||||
//查看预约列表
|
||||
void getReservationList() async {
|
||||
if (_debounce?.isActive ?? false) {
|
||||
return;
|
||||
}
|
||||
_debounce = Timer(const Duration(seconds: 1), () {});
|
||||
|
||||
showLoading("加载中");
|
||||
|
||||
try {
|
||||
@@ -596,7 +612,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
||||
),
|
||||
),
|
||||
),
|
||||
!reservation.hasEdit
|
||||
!reservation.hasEdit || plateNumber.isEmpty
|
||||
? SizedBox()
|
||||
: GestureDetector(
|
||||
onTap: () async {
|
||||
@@ -837,7 +853,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
||||
HttpService.to.dio.options.headers = originalHeaders;
|
||||
|
||||
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
|
||||
if (!StorageService.to.hasShownBindVehicleDialog) {
|
||||
if (!StorageService.to.hasShownBindVehicleDialog && StorageService.to.isLoggedIn) {
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
DialogX.to.showConfirmDialog(
|
||||
title: '当前尚未绑定车辆',
|
||||
@@ -864,6 +880,9 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
||||
void onClose() {
|
||||
amountController.dispose();
|
||||
plateNumberController.dispose();
|
||||
if (_debounce != null) {
|
||||
_debounce?.cancel();
|
||||
}
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user