From 50433e86b718fab0d94ea1410724b29b5f53fa0a Mon Sep 17 00:00:00 2001
From: zuoxiao <zuoxiao>
Date: 星期三, 09 四月 2025 15:11:26 +0800
Subject: [PATCH] 更新SVG图标样式,优化灌溉计划和取水口页面逻辑,添加状态处理和信息提示功能;调整界面样式,提升用户体验。
---
pages/waterIntake/waterIntake.js | 163 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 146 insertions(+), 17 deletions(-)
diff --git a/pages/waterIntake/waterIntake.js b/pages/waterIntake/waterIntake.js
index 5ac5cb2..9305679 100644
--- a/pages/waterIntake/waterIntake.js
+++ b/pages/waterIntake/waterIntake.js
@@ -47,8 +47,6 @@
openTime: "", //璁″垝寮�娉电殑寮�濮嬫椂闂�
openTimeText: "",
isShowOpenTime: "false",
- isOpenTiming: false, //鏄惁鏄鍒掑紑闃�鏃堕棿鏍峰紡鐨勫紑闃�
- postMinutes: 0, //瀹氱亴婧夋椂闀跨殑鏃堕棿
showForceConfirm: false,
showErrorDialog: false, //閿欒鎻愮ず
errorData: "",
@@ -136,7 +134,6 @@
data: data,
timeout: 180000
}).then(response => {
-
// 澶勭悊鎴愬姛鍝嶅簲
console.log('璇锋眰鎴愬姛:', response);
// 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
@@ -145,7 +142,6 @@
wx.reLaunch({
url: '/pages/home/home?param=true' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓
});
-
}).catch(error => {
// 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
wx.hideLoading();
@@ -156,10 +152,18 @@
forceIntakeId: intakeId,
showForceConfirm: true
})
+ } else if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) {
+ // 澶勭悊瓒呮椂閿欒
+ this.setData({
+ showErrorDialog: true,
+ errorData: "閫氫俊瓒呮椂锛岃绋嶅悗鍐嶈瘯",
+ errorDialogTitle: "寮�闃�閿欒"
+ })
} else {
this.setData({
showErrorDialog: true,
- errorData: error.msg
+ errorData: error.msg,
+ errorDialogTitle: "寮�闃�閿欒"
})
}
});
@@ -507,14 +511,14 @@
});
const data = {
intakeId: this.data.choseItem.intakeId, //鍙栨按鍙D
- // vcId: app.globalData.vcId, //铏氭嫙鍗D
minutes: this.data.postMinutes, //鍒嗛挓
operator: app.globalData.clientId, //鎿嶄綔鍛�
plannedOpenTime: this.data.openTime
};
post({
url: "wx/valve/planed_open_timed_close",
- data: data
+ data: data,
+ timeout: 180000
}).then(response => {
// 澶勭悊鎴愬姛鍝嶅簲
console.log('璇锋眰鎴愬姛:', response);
@@ -529,10 +533,20 @@
wx.hideLoading();
// 澶勭悊閿欒鍝嶅簲
console.error('璇锋眰澶辫触:', error);
- this.setData({
- showErrorDialog: true,
- errorData: error.msg
- })
+ if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) {
+ // 澶勭悊瓒呮椂閿欒
+ this.setData({
+ showErrorDialog: true,
+ errorData: "閫氫俊瓒呮椂锛岃绋嶅悗鍐嶈瘯",
+ errorDialogTitle: "寮�闃�閿欒"
+ })
+ } else {
+ this.setData({
+ showErrorDialog: true,
+ errorData: error.msg,
+ errorDialogTitle: "寮�闃�閿欒"
+ })
+ }
});
},
//瀹氭椂鍏抽榾寮忓紑闃�
@@ -544,13 +558,13 @@
});
const data = {
intakeId: this.data.choseItem.intakeId, //鍙栨按鍙D
- // vcId: app.globalData.vcId, //铏氭嫙鍗D
minutes: this.data.postMinutes, //鍒嗛挓
operator: app.globalData.clientId //鎿嶄綔鍛�
};
post({
url: "wx/valve/timed_close",
- data: data
+ data: data,
+ timeout: 180000
}).then(response => {
// 澶勭悊鎴愬姛鍝嶅簲
console.log('璇锋眰鎴愬姛:', response);
@@ -565,10 +579,20 @@
wx.hideLoading();
// 澶勭悊閿欒鍝嶅簲
console.error('璇锋眰澶辫触:', error);
- this.setData({
- showErrorDialog: true,
- errorData: error.msg
- })
+ if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) {
+ // 澶勭悊瓒呮椂閿欒
+ this.setData({
+ showErrorDialog: true,
+ errorData: "閫氫俊瓒呮椂锛岃绋嶅悗鍐嶈瘯",
+ errorDialogTitle: "寮�闃�閿欒"
+ })
+ } else {
+ this.setData({
+ showErrorDialog: true,
+ errorData: error.msg,
+ errorDialogTitle: "寮�闃�閿欒"
+ })
+ }
});
},
// 閫氳繃灏忔椂杞崲鎴愬垎閽�
@@ -626,5 +650,110 @@
isOpenTiming: false,
radioValue: "0"
})
+ }, // 瀹氶噺寮�娉垫寜閽�
+ btnOpenOnWater() {
+ if (this.data.waterAmount > 0) {
+ if (this.data.isOpenTiming) {
+ this.quantifyOpenTime();
+ } else {
+ this.quantifyOpen();
+ }
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '璇烽�夋嫨鎴栬緭鍏ョ亴婧夋椂闂达紒',
+ })
+ }
+ },//瀹氶噺寮�闃�寮忚鍒掑紑闃�
+ quantifyOpenTime() {
+ const app = getApp();
+ wx.showLoading({
+ title: '姝e湪閫氫俊璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+ mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+ });
+ const data = {
+ intakeId: this.data.choseItem.intakeId, //鍙栨按鍙D
+ waterAmount: this.data.waterAmount, //姘撮噺
+ operator: app.globalData.clientId, //鎿嶄綔鍛�
+ plannedOpenTime: this.data.openTime
+ };
+ post({
+ url: "wx/valve/planed_open_quantify_close",
+ data: data,
+ timeout: 180000
+ }).then(response => {
+ // 澶勭悊鎴愬姛鍝嶅簲
+ console.log('璇锋眰鎴愬姛:', response);
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ //瀹屾垚鍚庡洖鍒伴椤�
+ wx.reLaunch({
+ url: '/pages/home/home?param=2' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓
+ });
+ }).catch(error => {
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ // 澶勭悊閿欒鍝嶅簲
+ console.error('璇锋眰澶辫触:', error);
+ if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) {
+ // 澶勭悊瓒呮椂閿欒
+ this.setData({
+ showErrorDialog: true,
+ errorData: "閫氫俊瓒呮椂锛岃绋嶅悗鍐嶈瘯",
+ errorDialogTitle: "寮�闃�閿欒"
+ })
+ } else {
+ this.setData({
+ showErrorDialog: true,
+ errorData: error.msg,
+ errorDialogTitle: "寮�闃�閿欒"
+ })
+ }
+ });
+ },//瀹氶噺寮�闃�
+ quantifyOpen() {
+ const app = getApp();
+ wx.showLoading({
+ title: '姝e湪寮�闃�璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+ mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+ });
+ const data = {
+ intakeId: this.data.choseItem.intakeId, //鍙栨按鍙D
+ waterAmount: this.data.waterAmount, //姘撮噺
+ operator: app.globalData.clientId //鎿嶄綔鍛�
+ };
+ post({
+ url: "wx/valve/quantify_close",
+ data: data,
+ timeout: 180000
+ }).then(response => {
+ // 澶勭悊鎴愬姛鍝嶅簲
+ console.log('璇锋眰鎴愬姛:', response);
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ //瀹屾垚鍚庡洖鍒伴椤�
+ wx.reLaunch({
+ url: '/pages/home/home?param=1' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓
+ });
+ }).catch(error => {
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ // 澶勭悊閿欒鍝嶅簲
+ console.error('璇锋眰澶辫触:', error);
+ if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) {
+ // 澶勭悊瓒呮椂閿欒
+ this.setData({
+ showErrorDialog: true,
+ errorData: "閫氫俊瓒呮椂锛岃绋嶅悗鍐嶈瘯",
+ errorDialogTitle: "寮�闃�閿欒"
+ })
+ } else {
+ this.setData({
+ showErrorDialog: true,
+ errorData: error.msg,
+ errorDialogTitle: "寮�闃�閿欒"
+ })
+ }
+ });
},
})
\ No newline at end of file
--
Gitblit v1.8.0