From ad9c163fefcfdd15463926f7713c4af81c01cd87 Mon Sep 17 00:00:00 2001
From: zuoxiao <zuoxiao>
Date: 星期四, 27 三月 2025 13:50:58 +0800
Subject: [PATCH] 更新创建灌溉计划页面,添加API通信模块,优化项目选择器和时间选择功能;增强用户体验,修复轮灌组显示逻辑,调整样式和配置文件。
---
pages/irrigation/irrigation.js | 220 +++--
pages/home/home.js | 18
images/stop-icon.svg | 1
images/group-icon.svg | 5
images/info.svg | 1
images/duration-icon.svg | 5
images/time-icon.svg | 5
miniprogram_npm/dayjs/index.js | 4
pages/createIrrigation/createIrrigation.json | 13
pages/createIrrigation/createIrrigation.wxml | 91 +
README.md | 109 +++
images/add-icon.svg | 4
pages/createIrrigation/createIrrigation.wxss | 100 ++
api/config.js | 87 +-
images/progress-icon.svg | 6
pages/irrigation/irrigation.wxml | 137 ++-
pages/irrigation/irrigation.wxss | 507 ++++++--------
pages/createIrrigation/createIrrigation.js | 740 ++++++++++++--------
images/execute-icon.svg | 4
images/hourglass.svg | 1
images/publish-icon.svg | 1
21 files changed, 1,229 insertions(+), 830 deletions(-)
diff --git a/README.md b/README.md
index f0e4329..9bbf418 100644
--- a/README.md
+++ b/README.md
@@ -71,6 +71,115 @@
4. **浜戝紑鍙�**锛氶」鐩彲鑳戒娇鐢ㄤ簡寰俊灏忕▼搴忎簯寮�鍙戝姛鑳斤紝鐢ㄤ簬鏁版嵁瀛樺偍鍜屼簯鍑芥暟銆�
+## API閫氫俊妯″潡
+
+API鐩綍鍖呭惈浜嗛」鐩腑鎵�鏈変笌鍚庣閫氫俊鐩稿叧鐨勬枃浠讹紝鎻愪緵浜嗙粺涓�鐨勭綉缁滆姹傚鐞嗘満鍒躲��
+
+### 鏂囦欢缁撴瀯
+
+- **request.js**: 缃戠粶璇锋眰鏍稿績妯″潡锛屽皝瑁呬簡寰俊灏忕▼搴忕殑`wx.request`鎺ュ彛
+ - `request()`: 鍩虹璇锋眰鍑芥暟锛屽鐞嗚姹傞厤缃�佽姹傚ご璁剧疆鍜屽搷搴斿鐞�
+ - `get()`: GET璇锋眰绠�鍖栨柟娉�
+ - `post()`: POST璇锋眰绠�鍖栨柟娉�
+ - 鑷姩澶勭悊token楠岃瘉銆侀敊璇鐞嗗拰loading鐘舵��
+
+- **config.js**: 閰嶇疆鏂囦欢锛屽畾涔堿PI鍩虹URL鍜岀幆澧冮厤缃�
+ - 鏀寔澶氶」鐩幆澧冿細鍢夊唱鍏�(JYG)銆佹皯鍕�(MQ)銆佹祴璇曠幆澧�(TEST)
+ - `setBaseUrl()`: 鍔ㄦ�佸垏鎹㈤」鐩幆澧冪殑鍑芥暟
+
+- **env.js**: 鐜鍙橀噺閰嶇疆锛屽畾涔夊綋鍓嶈繍琛岀幆澧冿紙鐢熶骇/娴嬭瘯锛�
+
+- **statusCode.js**: HTTP鐘舵�佺爜甯搁噺瀹氫箟锛岀敤浜庣粺涓�澶勭悊鍝嶅簲鐘舵��
+
+### 浣跨敤鏂规硶
+
+1. **GET璇锋眰**锛�
+ ```javascript
+ const { get } = require('../../api/request')
+
+ // 鑾峰彇椤圭洰鍒楄〃
+ get({
+ url: '/wx/irrigation/getSimpleProjects',
+ isShowLoding: true
+ }).then(res => {
+ if (res.success) {
+ // 澶勭悊鎴愬姛鍝嶅簲
+ console.log(res.content)
+ } else {
+ wx.showToast({
+ title: res.msg || '璇锋眰澶辫触',
+ icon: 'none'
+ })
+ }
+ }).catch(err => {
+ console.error('璇锋眰澶辫触锛�', err)
+ wx.showToast({
+ title: '璇锋眰澶辫触',
+ icon: 'none'
+ })
+ })
+ ```
+
+2. **POST璇锋眰**锛�
+ ```javascript
+ const { post } = require('../../api/request')
+
+ // 鑾峰彇杞亴缁勫垪琛�
+ post({
+ url: '/wx/irrigation/getSimpleGroups',
+ data: {
+ projectId: '2025032017240700001',
+ planName: '2025032501',
+ startupMode: 1,
+ operatorId: 2024090516595200300,
+ schedules: [
+ {
+ groupId: 2025032017371700000,
+ duration: 5
+ }
+ ]
+ },
+ isShowLoding: true
+ }).then(res => {
+ if (res.success) {
+ // 澶勭悊鎴愬姛鍝嶅簲
+ console.log(res.content)
+ } else {
+ wx.showToast({
+ title: res.msg || '璇锋眰澶辫触',
+ icon: 'none'
+ })
+ }
+ }).catch(err => {
+ console.error('璇锋眰澶辫触锛�', err)
+ wx.showToast({
+ title: '璇锋眰澶辫触',
+ icon: 'none'
+ })
+ })
+ ```
+
+3. **鍒囨崲椤圭洰鐜**锛�
+ ```javascript
+ const { setBaseUrl } = require('../../api/config')
+
+ // 鍒囨崲鍒版皯鍕ら」鐩�
+ setBaseUrl('MQ')
+
+ // 鍒囨崲鍒板槈宄叧椤圭洰
+ setBaseUrl('JYG')
+
+ // 鍒囨崲鍒版祴璇曠幆澧�
+ setBaseUrl('TEST')
+ ```
+
+鎵�鏈夌綉缁滆姹備細鑷姩澶勭悊锛�
+- token 璁よ瘉锛堥�氳繃璇锋眰澶� Authorization锛�
+- 椤圭洰鏍囪瘑锛堥�氳繃璇锋眰澶� tag锛�
+- 搴旂敤鏍囪瘑锛堥�氳繃璇锋眰澶� appId锛�
+- 閿欒澶勭悊鍜屽搷搴旇В鏋�
+- 鍔犺浇鐘舵�佹樉绀猴紙閫氳繃 isShowLoding 鍙傛暟鎺у埗锛�
+
## 浠g爜椋庢牸鍜岃鑼�
1. **鏂囦欢鍛藉悕**锛�
diff --git a/api/config.js b/api/config.js
index 3ee8e03..cbdd7ae 100644
--- a/api/config.js
+++ b/api/config.js
@@ -2,64 +2,65 @@
let BASEURL
const PROJECT_URLS = {
- JYG: 'https://irrigate.dayuyanjiuyuan.top/', // 鍢夊唱鍏抽」鐩�
- MQ: 'https://shifanqu1.dayuyanjiuyuan.top/' , // 姘戝嫟椤圭洰
- TEST:'https://no253541tf71.vicp.fun/'// test椤圭洰
-// TEST:'http://192.168.40.182:8087/'// test椤圭洰
-// MQ: 'https://no253541tf71.vicp.fun/' // 姘戝嫟椤圭洰
+ JYG: 'https://irrigate.dayuyanjiuyuan.top/', // 鍢夊唱鍏抽」鐩�
+ MQ: 'https://shifanqu1.dayuyanjiuyuan.top/', // 姘戝嫟椤圭洰
+ // TEST:'https://no253541tf71.vicp.fun/'// test椤圭洰
+ // TEST:'http://192.168.40.182:8087/'// test椤圭洰
+ // MQ: 'https://no253541tf71.vicp.fun/' // 姘戝嫟椤圭洰
+ TEST: 'http://192.168.40.166:54321/'
}
// 灏濊瘯浠庢湰鍦板瓨鍌ㄨ幏鍙栧凡閫夋嫨鐨勯」鐩�
let selectedProject = 'JYG'; // 榛樿涓哄槈宄叧椤圭洰
try {
- // 灏濊瘯浠庢湰鍦板瓨鍌ㄨ幏鍙栧凡閫夋嫨鐨勯」鐩�
- if (typeof wx !== 'undefined') {
- try {
- const selectedProjectFromStorage = wx.getStorageSync('selectedProject');
- if (selectedProjectFromStorage) {
- selectedProject = selectedProjectFromStorage;
- console.log('浠庢湰鍦板瓨鍌ㄥ姞杞介」鐩缃�:', selectedProject);
- }
- } catch (e) {
- console.error('浠庢湰鍦板瓨鍌ㄨ幏鍙栭」鐩け璐�:', e);
+ // 灏濊瘯浠庢湰鍦板瓨鍌ㄨ幏鍙栧凡閫夋嫨鐨勯」鐩�
+ if (typeof wx !== 'undefined') {
+ try {
+ const selectedProjectFromStorage = wx.getStorageSync('selectedProject');
+ if (selectedProjectFromStorage) {
+ selectedProject = selectedProjectFromStorage;
+ console.log('浠庢湰鍦板瓨鍌ㄥ姞杞介」鐩缃�:', selectedProject);
+ }
+ } catch (e) {
+ console.error('浠庢湰鍦板瓨鍌ㄨ幏鍙栭」鐩け璐�:', e);
+ }
}
- }
-
- // 濡傛灉鍏ㄥ眬搴旂敤宸插垵濮嬪寲锛屼篃灏濊瘯浠庡叏灞�鍙橀噺鑾峰彇
- const app = getApp();
- if (app && app.globalData && app.globalData.selectedProject) {
- selectedProject = app.globalData.selectedProject;
- console.log('浠庡叏灞�鍙橀噺鍔犺浇椤圭洰璁剧疆:', selectedProject);
- }
+
+ // 濡傛灉鍏ㄥ眬搴旂敤宸插垵濮嬪寲锛屼篃灏濊瘯浠庡叏灞�鍙橀噺鑾峰彇
+ const app = getApp();
+ if (app && app.globalData && app.globalData.selectedProject) {
+ selectedProject = app.globalData.selectedProject;
+ console.log('浠庡叏灞�鍙橀噺鍔犺浇椤圭洰璁剧疆:', selectedProject);
+ }
} catch (e) {
- console.error('鑾峰彇宸查�夋嫨椤圭洰澶辫触:', e);
+ console.error('鑾峰彇宸查�夋嫨椤圭洰澶辫触:', e);
}
switch (ENV) {
- case 'production':
- BASEURL = PROJECT_URLS[selectedProject] || PROJECT_URLS.JYG;
- break;
- case 'test':
- // BASEURL 灏嗘牴鎹敤鎴烽�夋嫨鐨勯」鐩姩鎬佽缃�
- BASEURL = PROJECT_URLS[selectedProject] || PROJECT_URLS.JYG;
- break;
- default:
- BASEURL = PROJECT_URLS[selectedProject] || PROJECT_URLS.JYG;
- break;
+ case 'production':
+ BASEURL = PROJECT_URLS[selectedProject] || PROJECT_URLS.JYG;
+ break;
+ case 'test':
+ // BASEURL 灏嗘牴鎹敤鎴烽�夋嫨鐨勯」鐩姩鎬佽缃�
+ BASEURL = PROJECT_URLS[selectedProject] || PROJECT_URLS.JYG;
+ break;
+ default:
+ BASEURL = PROJECT_URLS[selectedProject] || PROJECT_URLS.JYG;
+ break;
}
// 瀵煎嚭鍔ㄦ�佽缃� BASEURL 鐨勫嚱鏁�
function setBaseUrl(project) {
- if (PROJECT_URLS[project]) {
- BASEURL = PROJECT_URLS[project];
- console.log('鍔ㄦ�佽缃� BASEURL:', BASEURL);
- return true;
- }
- return false;
+ if (PROJECT_URLS[project]) {
+ BASEURL = PROJECT_URLS[project];
+ console.log('鍔ㄦ�佽缃� BASEURL:', BASEURL);
+ return true;
+ }
+ return false;
}
module.exports = {
- BASEURL,// 椤圭洰鎺ュ彛鍦板潃锛屾敮鎸佸鍩熷悕
- PROJECT_URLS,
- setBaseUrl
+ BASEURL,// 椤圭洰鎺ュ彛鍦板潃锛屾敮鎸佸鍩熷悕
+ PROJECT_URLS,
+ setBaseUrl
}
\ No newline at end of file
diff --git a/images/add-icon.svg b/images/add-icon.svg
new file mode 100644
index 0000000..e455619
--- /dev/null
+++ b/images/add-icon.svg
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M19 13H13V19H11V13H5V11H11V5H13V11H19V13Z" fill="#FFFFFF"/>
+</svg>
\ No newline at end of file
diff --git a/images/duration-icon.svg b/images/duration-icon.svg
new file mode 100644
index 0000000..94a3878
--- /dev/null
+++ b/images/duration-icon.svg
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20Z" fill="#666666"/>
+ <path d="M12 6V12L16.5 14.25L17.25 13.02L13.5 10.75V6H12Z" fill="#666666"/>
+</svg>
\ No newline at end of file
diff --git a/images/execute-icon.svg b/images/execute-icon.svg
new file mode 100644
index 0000000..11a6052
--- /dev/null
+++ b/images/execute-icon.svg
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M8 5V19L19 12L8 5Z" fill="#FFFFFF"/>
+</svg>
\ No newline at end of file
diff --git a/images/group-icon.svg b/images/group-icon.svg
new file mode 100644
index 0000000..e782f62
--- /dev/null
+++ b/images/group-icon.svg
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20Z" fill="#666666"/>
+ <path d="M12 6C8.69 6 6 8.69 6 12C6 15.31 8.69 18 12 18C15.31 18 18 15.31 18 12C18 8.69 15.31 6 12 6ZM12 16C9.79 16 8 14.21 8 12C8 9.79 9.79 8 12 8C14.21 8 16 9.79 16 12C16 14.21 14.21 16 12 16Z" fill="#666666"/>
+</svg>
\ No newline at end of file
diff --git a/images/hourglass.svg b/images/hourglass.svg
new file mode 100644
index 0000000..bf8625d
--- /dev/null
+++ b/images/hourglass.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 4H41" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M7 44H41" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M11 44C13.6667 30.6611 18 23.9944 24 24C30 24.0056 34.3333 30.6722 37 44H11Z" fill="none" stroke="#333" stroke-width="4" stroke-linejoin="round"/><path d="M37 4C34.3333 17.3389 30 24.0056 24 24C18 23.9944 13.6667 17.3278 11 4H37Z" fill="none" stroke="#333" stroke-width="4" stroke-linejoin="round"/><path d="M21 15H27" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M19 38H29" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>
\ No newline at end of file
diff --git a/images/info.svg b/images/info.svg
new file mode 100644
index 0000000..a5e7511
--- /dev/null
+++ b/images/info.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M24 44C29.5228 44 34.5228 41.7614 38.1421 38.1421C41.7614 34.5228 44 29.5228 44 24C44 18.4772 41.7614 13.4772 38.1421 9.85786C34.5228 6.23858 29.5228 4 24 4C18.4772 4 13.4772 6.23858 9.85786 9.85786C6.23858 13.4772 4 18.4772 4 24C4 29.5228 6.23858 34.5228 9.85786 38.1421C13.4772 41.7614 18.4772 44 24 44Z" fill="none" stroke="#333" stroke-width="4" stroke-linejoin="round"/><path fill-rule="evenodd" clip-rule="evenodd" d="M24 11C25.3807 11 26.5 12.1193 26.5 13.5C26.5 14.8807 25.3807 16 24 16C22.6193 16 21.5 14.8807 21.5 13.5C21.5 12.1193 22.6193 11 24 11Z" fill="#333"/><path d="M24.5 34V20H23.5H22.5" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M21 34H28" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>
\ No newline at end of file
diff --git a/images/progress-icon.svg b/images/progress-icon.svg
new file mode 100644
index 0000000..d151a12
--- /dev/null
+++ b/images/progress-icon.svg
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20Z" fill="#666666"/>
+ <path d="M12 6V12L16.5 14.25L17.25 13.02L13.5 10.75V6H12Z" fill="#666666"/>
+ <path d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20Z" fill="#666666" fill-opacity="0.3"/>
+</svg>
\ No newline at end of file
diff --git a/images/publish-icon.svg b/images/publish-icon.svg
new file mode 100644
index 0000000..c8b1c06
--- /dev/null
+++ b/images/publish-icon.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M42 6L4 20.1383L24 24.0083L29.0052 44L42 6Z" stroke="#fff" stroke-width="4" stroke-linejoin="round"/><path d="M24.0083 24.0084L29.6651 18.3516" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>
\ No newline at end of file
diff --git a/images/stop-icon.svg b/images/stop-icon.svg
new file mode 100644
index 0000000..ab446c4
--- /dev/null
+++ b/images/stop-icon.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 8C13.8406 8.37652 13.2062 8.79103 12.6 9.24051C11.5625 10.0097 10.6074 10.8814 9.75 11.8402C6.79377 15.1463 5 19.4891 5 24.2455C5 34.6033 13.5066 43 24 43C34.4934 43 43 34.6033 43 24.2455C43 19.4891 41.2062 15.1463 38.25 11.8402C37.3926 10.8814 36.4375 10.0097 35.4 9.24051C34.7938 8.79103 34.1594 8.37652 33.5 8" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M24 4V24" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>
\ No newline at end of file
diff --git a/images/time-icon.svg b/images/time-icon.svg
new file mode 100644
index 0000000..8ecaf72
--- /dev/null
+++ b/images/time-icon.svg
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20Z" fill="#666666"/>
+ <path d="M12.5 7H11V13L16.25 16.15L17 14.92L12.5 12.25V7Z" fill="#666666"/>
+</svg>
\ No newline at end of file
diff --git a/miniprogram_npm/dayjs/index.js b/miniprogram_npm/dayjs/index.js
index 5abb536..b1dd640 100644
--- a/miniprogram_npm/dayjs/index.js
+++ b/miniprogram_npm/dayjs/index.js
@@ -4,10 +4,10 @@
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
-__DEFINE__(1742351136645, function(require, module, exports) {
+__DEFINE__(1742956904314, function(require, module, exports) {
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
-return __REQUIRE__(1742351136645);
+return __REQUIRE__(1742956904314);
})()
//miniprogram-npm-outsideDeps=[]
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/pages/createIrrigation/createIrrigation.js b/pages/createIrrigation/createIrrigation.js
index ce7e83b..6a03e17 100644
--- a/pages/createIrrigation/createIrrigation.js
+++ b/pages/createIrrigation/createIrrigation.js
@@ -1,334 +1,450 @@
const app = getApp();
+const { get, post } = require('../../api/request');
+const dayjs = require('dayjs');
Page({
- /**
- * 椤甸潰鐨勫垵濮嬫暟鎹�
- */
- data: {
- // 琛ㄥ崟鏁版嵁
- planCode: '', // 璁″垝缂栧彿
- startTime: '', // 鐏屾簤寮�濮嬫椂闂�
- pickerValue: '', // 鏃堕棿閫夋嫨鍣ㄧ殑鍊�
- timePickerVisible: false, // 鏃堕棿閫夋嫨鍣ㄦ槸鍚﹀彲瑙�
- // 椤圭洰閫夋嫨鍣ㄧ浉鍏�
- projectPickerVisible: false,
- projectPickerValue: [],
- selectedProject: null,
- projectOptions: [],
- totalDuration: 0, // 娣诲姞鎬荤亴婧夋椂闂�
- // 娴嬭瘯鏁版嵁
- projectList: [
- {
- id: 1,
- name: '娴嬭瘯椤圭洰涓�',
- groups: [
- {
- id: 101,
- name: '杞亴缁凙',
- duration: 30,
- selected: false
- },
- {
- id: 102,
- name: '杞亴缁凚',
- duration: 45,
- selected: false
- },
- {
- id: 103,
- name: '杞亴缁凜',
- duration: 60,
- selected: false
- }
- ]
- },
- {
- id: 2,
- name: '娴嬭瘯椤圭洰浜�',
- groups: [
- {
- id: 201,
- name: '杞亴缁�1',
- duration: 40,
- selected: false
- },
- {
- id: 202,
- name: '杞亴缁�2',
- duration: 50,
- selected: false
- }
- ]
- },
- {
- id: 3,
- name: '娴嬭瘯椤圭洰涓�',
- groups: [
- {
- id: 301,
- name: '涓滃尯杞亴缁�',
- duration: 35,
- selected: false
- },
- {
- id: 302,
- name: '瑗垮尯杞亴缁�',
- duration: 55,
- selected: false
- },
- {
- id: 303,
- name: '鍗楀尯杞亴缁�',
- duration: 25,
- selected: false
- }
- ]
- }
- ]
- },
+ /**
+ * 椤甸潰鐨勫垵濮嬫暟鎹�
+ */
+ data: {
+ // 琛ㄥ崟鏁版嵁
+ planCode: '', // 璁″垝缂栧彿
+ startTime: '', // 鐏屾簤寮�濮嬫椂闂�
+ pickerValue: '', // 鏃堕棿閫夋嫨鍣ㄧ殑鍊�
+ timePickerVisible: false, // 鏃堕棿閫夋嫨鍣ㄦ槸鍚﹀彲瑙�
+ timeInfoVisible: false, // 鏃堕棿鎻愮ず寮圭獥鏄惁鍙
+ // 椤圭洰閫夋嫨鍣ㄧ浉鍏�
+ projectPickerVisible: false,
+ projectPickerValue: [],
+ selectedProject: null,
+ projectOptions: [],
+ totalDuration: 0, // 娣诲姞鎬荤亴婧夋椂闂�
+ // 椤圭洰鍒楄〃
+ projectList: [],
+ // 鏃堕棿閫夋嫨鍣ㄩ�夐」
+ timeOptions: [],
+ // 杞亴缁勫垪琛ㄥ埛鏂扮姸鎬�
+ isRefreshing: false
+ },
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
- */
- onLoad: function (options) {
- // 鍒濆鍖栭」鐩�夋嫨鍣ㄩ�夐」
- const projectOptions = this.data.projectList.map(project => ({
- label: project.name,
- value: project.id
- }));
-
- this.setData({
- projectOptions: projectOptions // 鐩存帴浣跨敤涓�缁存暟缁勶紝涓嶉渶瑕佸寘瑁呮垚浜岀淮鏁扮粍
- });
- },
+ /**
+ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
+ */
+ onLoad: function (options) {
+ // 鐢熸垚璁″垝缂栧彿
+ this.generatePlanCode();
+ // 璁剧疆鏃堕棿閫夋嫨鍣ㄧ殑鍒濆鍊�
+ const now = dayjs();
+ this.setData({
+ pickerValue: now.add(8.5, 'hour').format('YYYY-MM-DD HH:mm')
+ });
+ // 鑾峰彇椤圭洰鍒楄〃
+ this.fetchProjects();
+ },
- /**
- * 鑾峰彇椤圭洰鍜岃疆鐏岀粍鏁版嵁
- */
- fetchProjectsAndGroups: function () {
- // 杩欓噷鍙互娣诲姞API璇锋眰閫昏緫锛岃幏鍙栫湡瀹炴暟鎹�
- // wx.request({
- // url: 'your-api-url',
- // success: (res) => {
- // this.setData({
- // projectList: res.data
- // });
- // }
- // });
- },
+ /**
+ * 鐢熸垚璁″垝缂栧彿
+ */
+ generatePlanCode: function () {
+ const now = dayjs();
+ const dateStr = now.format('YYYYMMDD');
+ const randomNum = Math.floor(Math.random() * 10000).toString().padStart(4, '0');
+ const planCode = `${dateStr}${randomNum}`;
+ this.setData({ planCode });
+ },
- /**
- * 澶勭悊璁″垝缂栧彿杈撳叆
- */
- onPlanCodeInput: function (e) {
- this.setData({
- planCode: e.detail.value
- });
- },
+ /**
+ * 鑾峰彇椤圭洰鍒楄〃
+ */
+ fetchProjects: function () {
+ return get({
+ url: '/wx/irrigation/getSimpleProjects',
+ isShowLoding: true
+ }).then(res => {
+ if (res.success) {
+ const projectList = res.content.obj.map(project => ({
+ id: project.projectId,
+ name: project.projectName,
+ groupCount: project.groupCount,
+ groups: []
+ }));
- /**
- * 鏄剧ず鏃堕棿閫夋嫨鍣�
- */
- showTimePicker: function () {
- this.setData({
- timePickerVisible: true
- });
- },
+ const projectOptions = projectList.map(project => ({
+ label: project.name,
+ value: project.id
+ }));
- /**
- * 鏃堕棿閫夋嫨鍣ㄧ‘璁ゅ洖璋�
- */
- onTimePickerConfirm: function (e) {
- const { value } = e.detail;
- this.setData({
- timePickerVisible: false,
- startTime: value
- });
- },
+ this.setData({
+ projectList,
+ projectOptions
+ });
+ } else {
+ wx.showToast({
+ title: res.msg || '鑾峰彇椤圭洰鍒楄〃澶辫触',
+ icon: 'none'
+ });
+ return Promise.reject(new Error(res.msg || '鑾峰彇椤圭洰鍒楄〃澶辫触'));
+ }
+ }).catch(err => {
+ console.error('鑾峰彇椤圭洰鍒楄〃澶辫触锛�', err);
+ wx.showToast({
+ title: '鑾峰彇椤圭洰鍒楄〃澶辫触',
+ icon: 'none'
+ });
+ return Promise.reject(err);
+ });
+ },
- /**
- * 鏃堕棿閫夋嫨鍣ㄥ彇娑堝洖璋�
- */
- onTimePickerCancel: function () {
- this.setData({
- timePickerVisible: false
- });
- },
+ /**
+ * 鑾峰彇杞亴缁勫垪琛�
+ */
+ fetchGroups: function (projectId) {
+ return get({
+ url: '/wx/irrigation/getSimpleGroups',
+ data: {
+ projectId: projectId,
+ },
+ isShowLoding: true
+ }).then(res => {
+ if (res.success) {
+ console.log('杞亴缁勬暟鎹細', res.content.obj);
- /**
- * 鍒囨崲椤圭洰灞曞紑/鎶樺彔鐘舵��
- */
- toggleProject: function (e) {
- const index = e.currentTarget.dataset.index;
- const currentValue = this.data.projectList[index].expanded;
-
- // 鍒涘缓鏂扮殑椤圭洰鍒楄〃锛屽厛灏嗘墍鏈夐」鐩涓烘姌鍙犵姸鎬�
- const newProjectList = this.data.projectList.map((item, idx) => {
- return {
- ...item,
- expanded: false
- };
- });
-
- // 濡傛灉褰撳墠鐐瑰嚮鐨勯」鐩凡缁忔槸灞曞紑鐘舵�侊紝鍒欎繚鎸佹墍鏈夐」鐩姌鍙�
- // 鍚﹀垯锛屽皢褰撳墠鐐瑰嚮鐨勯」鐩涓哄睍寮�鐘舵��
- if (!currentValue) {
- newProjectList[index].expanded = true;
- }
-
- this.setData({
- projectList: newProjectList
- });
- },
+ // 鏇存柊閫変腑椤圭洰鐨勮疆鐏岀粍淇℃伅
+ const projectList = this.data.projectList.map(project => {
+ if (project.id === projectId) {
+ return {
+ ...project,
+ groups: res.content.obj.map(group => ({
+ id: group.groupId,
+ name: group.groupCode,
+ duration: group.defaultDuration || 0,
+ selected: false,
+ intakeCount: group.intakeCount
+ }))
+ };
+ }
+ return project;
+ });
- /**
- * 鍒囨崲杞亴缁勯�変腑鐘舵��
- */
- toggleGroupSelection: function (e) {
- const projectIndex = e.currentTarget.dataset.projectIndex;
- const groupIndex = e.currentTarget.dataset.groupIndex;
- const key = `projectList[${projectIndex}].groups[${groupIndex}].selected`;
- const currentValue = this.data.projectList[projectIndex].groups[groupIndex].selected;
-
- this.setData({
- [key]: !currentValue
- });
-
- // 鏇存柊椤圭洰鎬绘椂闀�
- this.updateProjectTotalDuration(projectIndex);
- },
+ // 鏇存柊閫変腑鐨勯」鐩�
+ const selectedProject = projectList.find(project => project.id === projectId);
+ console.log('鏇存柊鍚庣殑閫変腑椤圭洰锛�', selectedProject);
- /**
- * 澶勭悊鏃堕暱杈撳叆
- */
- onDurationInput: function (e) {
- const { groupIndex } = e.currentTarget.dataset;
- const duration = parseInt(e.detail.value) || 0;
-
- const selectedProject = { ...this.data.selectedProject };
- selectedProject.groups[groupIndex].duration = duration;
-
- this.setData({
- selectedProject
- }, () => {
- // 杈撳叆鏃堕暱鍚庨噸鏂拌绠楁�绘椂闂�
- this.calculateTotalDuration();
- });
- },
+ this.setData({
+ projectList,
+ selectedProject
+ }, () => {
+ // 璁$畻鎬绘椂闂�
+ this.calculateTotalDuration();
+ });
+ } else {
+ wx.showToast({
+ title: res.msg || '鑾峰彇杞亴缁勫垪琛ㄥけ璐�',
+ icon: 'none'
+ });
+ return Promise.reject(new Error(res.msg || '鑾峰彇杞亴缁勫垪琛ㄥけ璐�'));
+ }
+ }).catch(err => {
+ console.error('鑾峰彇杞亴缁勫垪琛ㄥけ璐ワ細', err);
+ wx.showToast({
+ title: '鑾峰彇杞亴缁勫垪琛ㄥけ璐�',
+ icon: 'none'
+ });
+ return Promise.reject(err);
+ });
+ },
- /**
- * 璁$畻骞舵洿鏂伴」鐩�绘椂闀�
- */
- updateProjectTotalDuration: function (projectIndex) {
- const project = this.data.projectList[projectIndex];
- let totalDuration = 0;
-
- // 璁$畻鎵�鏈夐�変腑鐨勮疆鐏岀粍鐨勬椂闀挎�诲拰
- project.groups.forEach(group => {
- if (group.selected) {
- totalDuration += parseInt(group.duration) || 0;
- }
- });
-
- // 鏇存柊椤圭洰鎬绘椂闀�
- const totalDurationKey = `projectList[${projectIndex}].totalDuration`;
- this.setData({
- [totalDurationKey]: totalDuration
- });
- },
+ /**
+ * 鏄剧ず鏃堕棿閫夋嫨鍣�
+ */
+ showTimePicker: function () {
+ // 濡傛灉娌℃湁閫夋嫨鏃堕棿锛屼娇鐢ㄥ綋鍓嶆椂闂�
+ if (!this.data.pickerValue) {
+ const now = dayjs();
+ this.setData({
+ pickerValue: now.format('YYYY-MM-DD HH:mm')
+ });
+ }
- /**
- * 闃绘浜嬩欢鍐掓场
- */
- stopPropagation: function () {
- // 闃绘浜嬩欢鍐掓场锛岄槻姝㈢偣鍑昏緭鍏ユ鏃惰Е鍙戠埗鍏冪礌鐨勭偣鍑讳簨浠�
- },
+ this.setData({
+ timePickerVisible: true
+ });
+ },
- /**
- * 璺宠浆鍒拌疆鐏岀粍璇︽儏椤�
- */
- navigateToGroupDetail: function (e) {
- const { groupIndex } = e.currentTarget.dataset;
- // TODO: 瀹炵幇璺宠浆閫昏緫
- },
+ /**
+ * 鏃堕棿閫夋嫨鍣ㄧ‘璁ゅ洖璋�
+ */
+ onTimePickerConfirm: function (e) {
+ const { value } = e.detail;
+ this.setData({
+ timePickerVisible: false,
+ startTime: value
+ });
+ },
- /**
- * 纭鎸夐挳鐐瑰嚮浜嬩欢
- */
- onConfirm: function () {
- const { planCode, startTime, selectedProject } = this.data;
-
- if (!planCode) {
- wx.showToast({
- title: '璇疯緭鍏ヨ鍒掔紪鍙�',
- icon: 'none'
- });
- return;
- }
-
- if (!startTime) {
- wx.showToast({
- title: '璇烽�夋嫨鐏屾簤寮�濮嬫椂闂�',
- icon: 'none'
- });
- return;
- }
-
- if (!selectedProject) {
- wx.showToast({
- title: '璇烽�夋嫨椤圭洰',
- icon: 'none'
- });
- return;
- }
+ /**
+ * 鏃堕棿閫夋嫨鍣ㄥ彇娑堝洖璋�
+ */
+ onTimePickerCancel: function () {
+ this.setData({
+ timePickerVisible: false
+ });
+ },
- // TODO: 瀹炵幇纭閫昏緫
- console.log('鎻愪氦鏁版嵁锛�', {
- planCode,
- startTime,
- project: selectedProject
- });
- },
+ /**
+ * 鍒囨崲椤圭洰灞曞紑/鎶樺彔鐘舵��
+ */
+ toggleProject: function (e) {
+ const index = e.currentTarget.dataset.index;
+ const currentValue = this.data.projectList[index].expanded;
- // 鏄剧ず椤圭洰閫夋嫨鍣�
- showProjectPicker() {
- this.setData({
- projectPickerVisible: true
- });
- },
+ // 鍒涘缓鏂扮殑椤圭洰鍒楄〃锛屽厛灏嗘墍鏈夐」鐩涓烘姌鍙犵姸鎬�
+ const newProjectList = this.data.projectList.map((item, idx) => {
+ return {
+ ...item,
+ expanded: false
+ };
+ });
- // 椤圭洰閫夋嫨鍣ㄧ‘璁�
- onProjectPickerConfirm(e) {
- const { value } = e.detail;
- const selectedProject = this.data.projectList.find(project => project.id === value[0]);
-
- this.setData({
- projectPickerVisible: false,
- selectedProject: selectedProject,
- projectPickerValue: value
- }, () => {
- // 閫夋嫨椤圭洰鍚庤绠楁�绘椂闂�
- this.calculateTotalDuration();
- });
- },
+ // 濡傛灉褰撳墠鐐瑰嚮鐨勯」鐩凡缁忔槸灞曞紑鐘舵�侊紝鍒欎繚鎸佹墍鏈夐」鐩姌鍙�
+ // 鍚﹀垯锛屽皢褰撳墠鐐瑰嚮鐨勯」鐩涓哄睍寮�鐘舵��
+ if (!currentValue) {
+ newProjectList[index].expanded = true;
+ }
- // 椤圭洰閫夋嫨鍣ㄥ彇娑�
- onProjectPickerCancel() {
- this.setData({
- projectPickerVisible: false
- });
- },
+ this.setData({
+ projectList: newProjectList
+ });
+ },
- // 璁$畻鎬荤亴婧夋椂闂�
- calculateTotalDuration() {
- if (!this.data.selectedProject) return;
-
- const totalDuration = this.data.selectedProject.groups.reduce((sum, group) => {
- return sum + (parseInt(group.duration) || 0);
- }, 0);
-
- this.setData({
- totalDuration
- });
- },
+ /**
+ * 鍒囨崲杞亴缁勯�変腑鐘舵��
+ */
+ toggleGroupSelection: function (e) {
+ const projectIndex = e.currentTarget.dataset.projectIndex;
+ const groupIndex = e.currentTarget.dataset.groupIndex;
+ const key = `projectList[${projectIndex}].groups[${groupIndex}].selected`;
+ const currentValue = this.data.projectList[projectIndex].groups[groupIndex].selected;
+
+ this.setData({
+ [key]: !currentValue
+ });
+
+ // 鏇存柊椤圭洰鎬绘椂闀�
+ this.updateProjectTotalDuration(projectIndex);
+ },
+
+ /**
+ * 澶勭悊鏃堕暱杈撳叆
+ */
+ onDurationInput: function (e) {
+ const { groupIndex } = e.currentTarget.dataset;
+ const duration = parseInt(e.detail.value) || 0;
+
+ const selectedProject = { ...this.data.selectedProject };
+ selectedProject.groups[groupIndex].duration = duration;
+
+ this.setData({
+ selectedProject
+ }, () => {
+ // 杈撳叆鏃堕暱鍚庨噸鏂拌绠楁�绘椂闂�
+ this.calculateTotalDuration();
+ });
+ },
+
+ /**
+ * 璁$畻骞舵洿鏂伴」鐩�绘椂闀�
+ */
+ updateProjectTotalDuration: function (projectIndex) {
+ const project = this.data.projectList[projectIndex];
+ let totalDuration = 0;
+
+ // 璁$畻鎵�鏈夐�変腑鐨勮疆鐏岀粍鐨勬椂闀挎�诲拰
+ project.groups.forEach(group => {
+ if (group.selected) {
+ totalDuration += parseInt(group.duration) || 0;
+ }
+ });
+
+ // 鏇存柊椤圭洰鎬绘椂闀�
+ const totalDurationKey = `projectList[${projectIndex}].totalDuration`;
+ this.setData({
+ [totalDurationKey]: totalDuration
+ });
+ },
+
+ /**
+ * 闃绘浜嬩欢鍐掓场
+ */
+ stopPropagation: function (e) {
+ if (e && e.stopPropagation) {
+ e.stopPropagation();
+ }
+ return false;
+ },
+
+ /**
+ * 璺宠浆鍒拌疆鐏岀粍璇︽儏椤�
+ */
+ navigateToGroupDetail: function (e) {
+ const { groupIndex } = e.currentTarget.dataset;
+ // TODO: 瀹炵幇璺宠浆閫昏緫
+ },
+
+ /**
+ * 纭鎸夐挳鐐瑰嚮浜嬩欢
+ */
+ onConfirm: function () {
+ const { planCode, startTime, selectedProject } = this.data;
+
+ if (!planCode) {
+ wx.showToast({
+ title: '璇疯緭鍏ヨ鍒掔紪鍙�',
+ icon: 'none'
+ });
+ return;
+ }
+
+ if (!selectedProject) {
+ wx.showToast({
+ title: '璇烽�夋嫨椤圭洰',
+ icon: 'none'
+ });
+ return;
+ }
+
+ // 鏋勫缓涓婃姤鏁版嵁
+ const schedules = selectedProject.groups.map(group => ({
+ groupId: group.id,
+ duration: parseInt(group.duration) || 0
+ }));
+
+ const requestData = {
+ projectId: selectedProject.id,
+ planName: planCode,
+ startupMode: startTime ? 2 : 1,
+ operatorId: app.globalData.clientId,
+ schedules: schedules
+ };
+
+ // 濡傛灉鏈夊紑濮嬫椂闂达紝娣诲姞鍒拌姹傛暟鎹腑
+ if (startTime) {
+ requestData.planStartTime = startTime;
+ }
+
+ // 鍙戦�佽姹�
+ post({
+ url: '/wx/plan/createPlan',
+ data: requestData,
+ isShowLoding: true
+ }).then(res => {
+ if (res.success) {
+ wx.showToast({
+ title: '鍒涘缓鎴愬姛',
+ icon: 'success'
+ });
+ // 杩斿洖涓婁竴椤�
+ setTimeout(() => {
+ wx.navigateBack();
+ }, 1500);
+ } else {
+ wx.showToast({
+ title: res.msg || '鍒涘缓澶辫触',
+ icon: 'none'
+ });
+ }
+ }).catch(err => {
+ console.error('鍒涘缓璁″垝澶辫触锛�', err);
+ wx.showToast({
+ title: '鍒涘缓澶辫触',
+ icon: 'none'
+ });
+ });
+ },
+
+ // 鏄剧ず椤圭洰閫夋嫨鍣�
+ showProjectPicker() {
+ this.setData({
+ projectPickerVisible: true
+ });
+ },
+
+ // 椤圭洰閫夋嫨鍣ㄧ‘璁�
+ onProjectPickerConfirm(e) {
+ const { value } = e.detail;
+ console.log('閫夋嫨鐨勯」鐩甀D锛�', value[0]); // 娣诲姞鏃ュ織鏌ョ湅鏁版嵁
+ const selectedProject = this.data.projectList.find(project => project.id === value[0]);
+ console.log('鎵惧埌鐨勯」鐩細', selectedProject); // 娣诲姞鏃ュ織鏌ョ湅鏁版嵁
+
+ this.setData({
+ projectPickerVisible: false,
+ selectedProject: selectedProject,
+ projectPickerValue: value
+ }, () => {
+ // 閫夋嫨椤圭洰鍚庤幏鍙栬疆鐏岀粍鍒楄〃
+ if (selectedProject) {
+ this.fetchGroups(selectedProject.id);
+ }
+ });
+ },
+
+ // 椤圭洰閫夋嫨鍣ㄥ彇娑�
+ onProjectPickerCancel() {
+ this.setData({
+ projectPickerVisible: false
+ });
+ },
+
+ /**
+ * 璁$畻鎬荤亴婧夋椂闂�
+ */
+ calculateTotalDuration: function () {
+ if (!this.data.selectedProject) return;
+
+ const totalDuration = this.data.selectedProject.groups.reduce((sum, group) => {
+ return sum + (parseInt(group.duration) || 0);
+ }, 0);
+
+ this.setData({
+ totalDuration
+ });
+ },
+
+ /**
+ * 杞亴缁勫垪琛ㄤ笅鎷夊埛鏂�
+ */
+ onGroupListRefresh: function () {
+ if (!this.data.selectedProject) {
+ this.setData({ isRefreshing: false });
+ return;
+ }
+
+ this.setData({ isRefreshing: true });
+
+ this.fetchGroups(this.data.selectedProject.id)
+ .then(() => {
+ this.setData({ isRefreshing: false });
+ })
+ .catch(() => {
+ this.setData({ isRefreshing: false });
+ });
+ },
+
+ /**
+ * 鏄剧ず鏃堕棿鎻愮ず寮圭獥
+ */
+ showTimeInfo: function () {
+ this.setData({
+ timeInfoVisible: true
+ });
+ },
+
+ /**
+ * 鍏抽棴鏃堕棿鎻愮ず寮圭獥
+ */
+ onTimeInfoConfirm: function () {
+ this.setData({
+ timeInfoVisible: false
+ });
+ },
});
\ No newline at end of file
diff --git a/pages/createIrrigation/createIrrigation.json b/pages/createIrrigation/createIrrigation.json
index e853ee7..fd558c8 100644
--- a/pages/createIrrigation/createIrrigation.json
+++ b/pages/createIrrigation/createIrrigation.json
@@ -1,8 +1,15 @@
{
- "navigationBarTitleText": "鏂板缓鐏屾簤璁″垝",
+ "navigationBarTitleText": "鍒涘缓鐏屾簤璁″垝",
"usingComponents": {
"t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker",
"t-picker": "tdesign-miniprogram/picker/picker",
- "t-picker-item": "tdesign-miniprogram/picker-item/picker-item"
- }
+ "t-picker-item": "tdesign-miniprogram/picker-item/picker-item",
+ "t-input": "tdesign-miniprogram/input/input",
+ "t-button": "tdesign-miniprogram/button/button",
+ "t-dialog": "tdesign-miniprogram/dialog/dialog",
+ "t-toast": "tdesign-miniprogram/toast/toast"
+ },
+ "enablePullDownRefresh": false,
+ "backgroundColor": "#f5f5f5",
+ "backgroundTextStyle": "dark"
}
\ No newline at end of file
diff --git a/pages/createIrrigation/createIrrigation.wxml b/pages/createIrrigation/createIrrigation.wxml
index d4cac7e..f220fd1 100644
--- a/pages/createIrrigation/createIrrigation.wxml
+++ b/pages/createIrrigation/createIrrigation.wxml
@@ -8,13 +8,31 @@
</view>
<!-- 鐏屾簤寮�濮嬫椂闂� -->
- <view class="form-item" bindtap="showTimePicker">
- <view class="form-label">鐏屾簤寮�濮嬫椂闂�</view>
- <view class="form-input time-input">
+ <view class="form-item">
+ <view class="form-label">
+ 鐏屾簤寮�濮嬫椂闂�(閫夊~)
+ <image
+ class="info-icon"
+ src="/images/info.svg"
+ mode="aspectFit"
+ bindtap="showTimeInfo"
+ ></image>
+ </view>
+ <view class="form-input time-input" bindtap="showTimePicker">
<view class="time-text {{startTime ? '' : 'placeholder'}}">{{startTime || '璇烽�夋嫨鐏屾簤寮�濮嬫椂闂�'}}</view>
<image class="arrow-icon" src="/images/arrow-right.svg" mode="aspectFit"></image>
</view>
</view>
+
+ <!-- 鏃堕棿鎻愮ず寮圭獥 -->
+ <t-dialog
+ visible="{{timeInfoVisible}}"
+ title="鏃堕棿璁剧疆璇存槑"
+ content="鈥� 璁剧疆涓ゅ皬鏃跺悗鐨勭亴婧夋椂闂达細\n鍦ㄦ澶勯�夋嫨鍏蜂綋鐨勫紑濮嬫椂闂碶n\n鈥� 璁剧疆涓ゅ皬鏃跺唴鐨勭亴婧夋椂闂达細\n鍒涘缓瀹屾垚鍚庣偣鍑诲彂甯冨嵆鍙珛鍗冲紑濮嬬亴婧�"
+ confirmBtn="鎴戠煡閬撲簡"
+ bind:confirm="onTimeInfoConfirm"
+ bind:cancel="onTimeInfoConfirm"
+ />
<!-- 閫夋嫨椤圭洰 -->
<view class="form-item" bindtap="showProjectPicker">
@@ -36,26 +54,39 @@
</view>
</view>
</view>
- <scroll-view scroll-y="true" class="group-list">
- <block wx:for="{{selectedProject.groups}}" wx:key="id" wx:for-item="group" wx:for-index="groupIndex">
- <view class="group-item {{group.selected ? 'selected' : ''}}" bindtap="navigateToGroupDetail" data-group-index="{{groupIndex}}">
- <view class="group-info">
- <view class="group-name">{{group.name}}</view>
+ <scroll-view
+ scroll-y="true"
+ class="group-list"
+ refresher-enabled="{{true}}"
+ refresher-triggered="{{isRefreshing}}"
+ bindrefresherrefresh="onGroupListRefresh"
+ >
+ <block wx:if="{{selectedProject.groups && selectedProject.groups.length > 0}}">
+ <block wx:for="{{selectedProject.groups}}" wx:key="id" wx:for-item="group" wx:for-index="groupIndex">
+ <view class="group-item {{group.selected ? 'selected' : ''}}" bindtap="navigateToGroupDetail" data-group-index="{{groupIndex}}">
+ <view class="group-info">
+ <view class="group-name">{{group.name || '鏈懡鍚嶈疆鐏岀粍'}}({{group.intakeCount}}涓彇姘村彛)</view>
+ </view>
+ <view class="group-duration">
+ <input
+ class="duration-input"
+ type="number"
+ value="{{group.duration}}"
+ bindinput="onDurationInput"
+ data-group-index="{{groupIndex}}"
+ placeholder="0"
+ catchtap="stopPropagation"
+ />
+ <text class="duration-unit">鍒嗛挓</text>
+ </view>
</view>
- <view class="group-duration">
- <input
- class="duration-input"
- type="number"
- value="{{group.duration}}"
- bindinput="onDurationInput"
- data-group-index="{{groupIndex}}"
- placeholder="0"
- catchtap="stopPropagation"
- />
- <text class="duration-unit">鍒嗛挓</text>
- </view>
- </view>
+ </block>
</block>
+ <view wx:else class="empty-container">
+ <image class="empty-image" src="/images/empty.png" mode="aspectFit"></image>
+ <view class="empty-text">鏆傛棤杞亴缁勬暟鎹�</view>
+ <view class="empty-text">璇峰埛鏂版垨绋嶅悗鍐嶈瘯</view>
+ </view>
</scroll-view>
</view>
@@ -70,21 +101,29 @@
visible="{{timePickerVisible}}"
mode="{{['date', 'minute']}}"
value="{{pickerValue}}"
+ start="{{pickerValue}}"
format="YYYY-MM-DD HH:mm"
bindconfirm="onTimePickerConfirm"
bindcancel="onTimePickerCancel"
+ catchtouchmove="stopPropagation"
+ z-index="{{1000}}"
/>
<!-- 椤圭洰閫夋嫨鍣ㄥ脊绐� -->
<t-picker
- title="閫夋嫨椤圭洰"
visible="{{projectPickerVisible}}"
- value="{{projectPickerValue}}"
+ title="閫夋嫨椤圭洰"
cancelBtn="鍙栨秷"
confirmBtn="纭"
- bindconfirm="onProjectPickerConfirm"
- bindcancel="onProjectPickerCancel"
+ bind:confirm="onProjectPickerConfirm"
+ bind:cancel="onProjectPickerCancel"
+ bind:touchmove="stopPropagation"
+ bind:touchstart="stopPropagation"
+ bind:touchend="stopPropagation"
+ z-index="{{1000}}"
>
- <t-picker-item options="{{projectOptions}}" />
+ <t-picker-item options="{{projectOptions}}" value="{{projectPickerValue}}" />
</t-picker>
+
+
</view>
\ No newline at end of file
diff --git a/pages/createIrrigation/createIrrigation.wxss b/pages/createIrrigation/createIrrigation.wxss
index 3872378..b4df43e 100644
--- a/pages/createIrrigation/createIrrigation.wxss
+++ b/pages/createIrrigation/createIrrigation.wxss
@@ -8,6 +8,44 @@
box-sizing: border-box;
}
+/* 閫夋嫨鍣ㄥ鍣ㄦ牱寮� */
+.picker-container {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ z-index: 9999;
+ pointer-events: none;
+}
+
+/* 钂欏眰鏍峰紡 */
+.picker-mask {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background-color: rgba(0, 0, 0, 0.5);
+ pointer-events: auto;
+}
+
+.picker-container .t-date-time-picker,
+.picker-container .t-picker {
+ pointer-events: auto;
+}
+
+/* 褰撻�夋嫨鍣ㄦ樉绀烘椂 */
+.t-date-time-picker[visible],
+.t-picker[visible] {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 100%;
+ background-color: #fff;
+ border-radius: 24rpx 24rpx 0 0;
+}
+
/* 琛ㄥ崟椤规牱寮� */
.form-item {
display: flex;
@@ -21,11 +59,17 @@
}
.form-label {
+ display: flex;
+ align-items: center;
font-size: 28rpx;
color: #333;
- font-weight: 500;
- width: 200rpx; /* 鍥哄畾鏍囩瀹藉害 */
- flex-shrink: 0; /* 闃叉鏍囩瀹藉害琚帇缂� */
+ margin-bottom: 16rpx;
+}
+
+.info-icon {
+ width: 32rpx;
+ height: 32rpx;
+ margin-left: 8rpx;
}
.form-input {
@@ -361,4 +405,54 @@
font-size: 32rpx;
color: #1890FF;
font-weight: 500;
+}
+
+.empty-container {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 40rpx 0;
+}
+
+.empty-image {
+ width: 200rpx;
+ height: 200rpx;
+ margin-bottom: 20rpx;
+}
+
+.empty-text {
+ color: #999;
+ font-size: 30rpx;
+}
+
+.empty-tip {
+ font-size: 28rpx;
+ color: #999;
+}
+
+.dialog-content {
+ padding: 20rpx 0;
+}
+
+.dialog-section {
+ margin-bottom: 24rpx;
+}
+
+.dialog-section:last-child {
+ margin-bottom: 0;
+}
+
+.dialog-title {
+ font-size: 28rpx;
+ color: #333;
+ font-weight: 500;
+ margin-bottom: 8rpx;
+}
+
+.dialog-desc {
+ font-size: 26rpx;
+ color: #666;
+ line-height: 1.6;
+ padding-left: 20rpx;
}
\ No newline at end of file
diff --git a/pages/home/home.js b/pages/home/home.js
index 944db7c..e990d66 100644
--- a/pages/home/home.js
+++ b/pages/home/home.js
@@ -260,22 +260,12 @@
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
*/
onReady() {
- if (this.data.options.param === "1") {
- this.setData({
- showTipDialog: true,
- tipData: "寮�闃�鍛戒护涓嬪彂鎴愬姛锛屽洜寮�闃�闇�瑕佹椂闂达紝绾�20-60绉掑悗鍙埛鏂板揩閫熷叧闃�鍒楄〃鏌ョ湅鎵ц缁撴灉銆�"
- })
- setTimeout(() => {
- this.getOpenList();
- }, 20000)
-
- } else if (this.data.options.param === "2") {
- this.setData({
- showTipDialog: true,
- tipData: "棰勭害寮�闃�鍛戒护涓嬪彂鎴愬姛锛屽綋鍒拌揪棰勭害鏃堕棿骞朵笖鎴愬姛寮�闃�鍚庡揩閫熷叧闃�鍒楄〃浼氭樉绀烘湭鍏抽榾璁板綍"
- })
+ // 妫�鏌ユ槸鍚︽湁options鍜宲aram
+ if (this.data.options && this.data.options.param) {
+ if (this.data.options.param === "1" || this.data.options.param === "2") {
this.getOpenList();
}
+ }
},
/**
diff --git a/pages/irrigation/irrigation.js b/pages/irrigation/irrigation.js
index e906d7e..248efcc 100644
--- a/pages/irrigation/irrigation.js
+++ b/pages/irrigation/irrigation.js
@@ -1,4 +1,7 @@
// pages/irrigation/irrigation.js
+const { get, post } = require('../../api/request');
+const app = getApp();
+
Page({
/**
* 椤甸潰鐨勫垵濮嬫暟鎹�
@@ -9,14 +12,22 @@
completedList: [], // 宸插畬鎴愮殑杞亴鍒楄〃
currentList: [], // 褰撳墠鏄剧ず鐨勫垪琛�
isRefreshing: false, // 鏄惁姝e湪鍒锋柊
- isWXRefreshing: false // 寰俊鍘熺敓涓嬫媺鍒锋柊鐘舵��
+ isWXRefreshing: false, // 寰俊鍘熺敓涓嬫媺鍒锋柊鐘舵��
+ projectId: null // Added to store projectId
},
/**
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
*/
onLoad: function (options) {
+ // 鑾峰彇椤圭洰ID
+ if (options.projectId) {
+ this.setData({
+ projectId: options.projectId
+ });
+ }
this.loadIrrigationData();
+ this.loadCompletedIrrigationData();
},
/**
@@ -24,100 +35,97 @@
*/
onShow: function () {
this.loadIrrigationData();
+ this.loadCompletedIrrigationData();
},
/**
* 鍔犺浇杞亴鏁版嵁
*/
loadIrrigationData: function () {
- // 杩欓噷搴旇璋冪敤API鑾峰彇鏁版嵁
- // 妯℃嫙鏁版嵁
- const mockData = {
- activeList: [
- {
- id: '1',
- title: 'LG-2023-001',
- status: '鏈彂甯�',
- irrigationTime: '2023-05-20 08:00 - 17:00'
- },
- {
- id: '2',
- title: 'LG-2023-002',
- status: '宸插彂甯�',
- irrigationTime: '2023-05-22 09:00 - 18:00'
- },
- {
- id: '2',
- title: 'LG-2023-002',
- status: '宸插彂甯�',
- irrigationTime: '2023-05-22 09:00 - 18:00'
- }, {
- id: '2',
- title: 'LG-2023-002',
- status: '宸插彂甯�',
- irrigationTime: '2023-05-22 09:00 - 18:00'
- }, {
- id: '2',
- title: 'LG-2023-002',
- status: '宸插彂甯�',
- irrigationTime: '2023-05-22 09:00 - 18:00'
- },
- {
- id: '3',
- title: 'LG-2023-003',
- status: '鎵ц涓�',
- irrigationTime: '2023-05-18 07:30 - 16:30',
- irrigatedTime: '3灏忔椂25鍒嗛挓',
- irrigatedGroups: '1缁勩��2缁勩��3缁�'
- }, {
- id: '2',
- title: 'LG-2023-002',
- status: '宸插彂甯�',
- irrigationTime: '2023-05-22 09:00 - 18:00'
- },
- {
- id: '3',
- title: 'LG-2023-003',
- status: '鎵ц涓�',
- irrigationTime: '2023-05-18 07:30 - 16:30',
- irrigatedTime: '3灏忔椂25鍒嗛挓',
- irrigatedGroups: '1缁勩��2缁勩��3缁�'
- }, {
- id: '2',
- title: 'LG-2023-002',
- status: '宸插彂甯�',
- irrigationTime: '2023-05-22 09:00 - 18:00'
- },
- {
- id: '3',
- title: 'LG-2023-003',
- status: '鎵ц涓�',
- irrigationTime: '2023-05-18 07:30 - 16:30',
- irrigatedTime: '3灏忔椂25鍒嗛挓',
- irrigatedGroups: '1缁勩��2缁勩��3缁�'
- }
-
- ]
- // completedList: [
- // {
- // id: '4',
- // title: 'LG-2023-004',
- // status: '宸插畬鎴�',
- // irrigationTime: '2023-05-10 10:00 - 19:00'
- // }
- // ]
- };
+ get({
+ url: '/wx/plan/getNotCompletePlans'
+ }).then(res => {
+ if (res.success) {
+ const activeList = res.content.map(item => ({
+ id: item.planId,
+ title: item.planName,
+ projectName: item.projectName || '鏈垎閰嶉」鐩�',
+ status: item.planState,
+ planStartTime: item.planStartTime,
+ planStopTime: item.planStopTime,
+ duration: item.duration,
+ startupMode: item.startupMode
+ }));
- // 妯℃嫙缃戠粶璇锋眰寤惰繜
- setTimeout(() => {
- this.setData({
- activeList: mockData.activeList || [],
- completedList: mockData.completedList || [],
- currentList: this.data.currentTab === 0 ? mockData.activeList || [] : mockData.completedList || [],
- isRefreshing: false, // 缁撴潫鍒锋柊鐘舵��
- isWXRefreshing: false // 缁撴潫寰俊鍘熺敓涓嬫媺鍒锋柊鐘舵��
+ console.log('杞亴璁″垝鏁版嵁锛�', activeList);
+
+ this.setData({
+ activeList: activeList,
+ currentList: this.data.currentTab === 0 ? activeList : this.data.completedList,
+ isRefreshing: false,
+ isWXRefreshing: false
+ });
+ } else {
+ wx.showToast({
+ title: res.msg || '鍔犺浇澶辫触',
+ icon: 'none'
+ });
+ }
+ }).catch(err => {
+ wx.showToast({
+ title: '鍔犺浇澶辫触',
+ icon: 'none'
});
- }, 1000);
+ this.setData({
+ isRefreshing: false,
+ isWXRefreshing: false
+ });
+ });
+ },
+
+ /**
+ * 鍔犺浇宸插畬鎴愮殑杞亴鏁版嵁
+ */
+ loadCompletedIrrigationData: function () {
+ get({
+ url: '/wx/plan/getCompletedPlans'
+ }).then(res => {
+ if (res.success) {
+ const completedList = res.content.map(item => ({
+ id: item.planId,
+ title: item.planName,
+ projectName: item.projectName || '鏈垎閰嶉」鐩�',
+ status: item.planState,
+ planStartTime: item.planStartTime,
+ planStopTime: item.planStopTime,
+ duration: item.duration,
+ startupMode: item.startupMode
+ }));
+
+ console.log('宸插畬鎴愯疆鐏岃鍒掓暟鎹細', completedList);
+
+ this.setData({
+ completedList: completedList,
+ currentList: this.data.currentTab === 1 ? completedList : this.data.activeList,
+ isRefreshing: false,
+ isWXRefreshing: false
+ });
+ } else {
+ wx.showToast({
+ title: res.msg || '鍔犺浇澶辫触',
+ icon: 'none'
+ });
+ }
+ }).catch(err => {
+ wx.showToast({
+ title: '鍔犺浇澶辫触',
+ icon: 'none'
+ });
+ this.setData({
+ isRefreshing: false,
+ isWXRefreshing: false
+ });
+ });
},
/**
@@ -161,13 +169,35 @@
content: '纭畾瑕佸彂甯冭杞亴璁″垝鍚楋紵',
success: (res) => {
if (res.confirm) {
- // 杩欓噷搴旇璋冪敤API鍙戝竷杞亴璁″垝
- wx.showToast({
- title: '鍙戝竷鎴愬姛',
- icon: 'success'
+ // 璋冪敤鍙戝竷鎺ュ彛
+ post({
+ url: '/wx/plan/publishPlan',
+ data: {
+ planId: id,
+ operatorId: app.globalData.clientId
+ },
+ isShowLoding: true
+ }).then(res => {
+ if (res.success) {
+ wx.showToast({
+ title: '鍙戝竷鎴愬姛',
+ icon: 'success'
+ });
+ // 鍒锋柊鏁版嵁
+ this.loadIrrigationData();
+ } else {
+ wx.showToast({
+ title: res.msg || '鍙戝竷澶辫触',
+ icon: 'none'
+ });
+ }
+ }).catch(err => {
+ console.error('鍙戝竷澶辫触锛�', err);
+ wx.showToast({
+ title: '鍙戝竷澶辫触',
+ icon: 'none'
+ });
});
- // 鍒锋柊鏁版嵁
- this.loadIrrigationData();
}
}
});
@@ -222,7 +252,7 @@
*/
onAddIrrigation: function () {
wx.navigateTo({
- url: '/pages/createIrrigation/createIrrigation'
+ url: '/pages/createIrrigation/createIrrigation?projectId=' + this.data.projectId
});
},
@@ -243,6 +273,7 @@
isRefreshing: true
});
this.loadIrrigationData();
+ this.loadCompletedIrrigationData();
}
},
@@ -254,5 +285,6 @@
isWXRefreshing: true
});
this.loadIrrigationData();
+ this.loadCompletedIrrigationData();
}
})
\ No newline at end of file
diff --git a/pages/irrigation/irrigation.wxml b/pages/irrigation/irrigation.wxml
index 067fe45..b5af43c 100644
--- a/pages/irrigation/irrigation.wxml
+++ b/pages/irrigation/irrigation.wxml
@@ -18,54 +18,98 @@
</view>
<view class="scroll-bg">
<block wx:if="{{currentList.length > 0}}">
- <!-- 缁熶竴鏄剧ず鎵�鏈夊垪琛ㄩ」锛屼笉鍐嶆寜鐘舵�佸垎缁� -->
<view class="list-item" wx:for="{{currentList}}" wx:key="id" bindtap="onItemTap" data-id="{{item.id}}" data-status="{{item.status}}">
- <view class="item-header">
- <view class="info-row title-row">
- <view class="info-label">缂栧彿锛�</view>
- <view class="info-value">{{item.title}}</view>
- </view>
- <!-- 鏍规嵁鐘舵�佹樉绀轰笉鍚岀殑鍥炬爣 -->
- <view class="item-status">
- <block wx:if="{{item.status === '宸插彂甯�'}}">
- <image class="status-icon" src="/images/published-icon.svg" mode="aspectFit"></image>
- </block>
- <block wx:elif="{{item.status === '鎵ц涓�'}}">
- <image class="status-icon" src="/images/progress.svg" mode="aspectFit"></image>
- </block>
- <block wx:elif="{{item.status === '鏈彂甯�'}}">
- <text>{{item.status}}</text>
- </block>
- </view>
+ <!-- 鐘舵�佹爣绛� -->
+ <view class="status-tag {{item.status === '1' ? 'draft' : item.status === '2' ? 'published' : item.status === '3' ? 'executing' : 'completed'}}">
+ {{item.status === '1' ? '鑽夌' : item.status === '2' ? '鏈墽琛�' : item.status === '3' ? '鎵ц涓�' : '宸插畬鎴�'}}
</view>
- <view class="item-info">
- <view class="info-row">
- <view class="info-label">鐏屾簤鏃堕棿锛�</view>
- <view class="info-value">{{item.irrigationTime}}</view>
+
+ <!-- 涓昏鍐呭鍖� -->
+ <view class="item-content">
+ <!-- 鏍囬鍖哄煙 -->
+ <view class="item-header">
+ <view class="title-section">
+ <view class="plan-title">{{item.title}}</view>
+ <view class="project-name">{{item.projectName}}</view>
+ </view>
</view>
- <!-- 浠呭湪鎵ц涓姸鎬佹樉绀洪澶栦俊鎭� -->
- <block wx:if="{{item.status === '鎵ц涓�'}}">
- <view class="info-row irrigated-row">
- <view class="info-label">宸茬亴婧夋椂闂达細</view>
- <view class="info-value-time">{{item.irrigatedTime}}</view>
+
+ <!-- 淇℃伅鍖哄煙 -->
+ <view class="info-section">
+ <!-- 鑽夌鐘舵��(1)鏃舵í鍚戞帓鍒楋紝鍏朵粬鐘舵�佺旱鍚戞帓鍒� -->
+ <view class="info-grid {{item.status === '1' ? '' : 'vertical-layout'}} {{currentTab === 1 ? 'history-grid' : ''}}">
+ <view class="info-item">
+ <view class="info-icon">
+ <image src="/images/time-icon.svg" mode="aspectFit"></image>
+ </view>
+ <view class="info-content">
+ <view class="info-label">鐏屾簤鏃堕棿</view>
+ <view class="info-value">{{(item.planStartTime ? item.planStartTime : '鎵嬪姩鍙戝竷') + (item.planStopTime ? ' - ' + item.planStopTime : '')}}</view>
+ </view>
+ </view>
+ <view class="info-item">
+ <view class="info-icon duration-icon">
+ <image src="/images/hourglass.svg" mode="aspectFit"></image>
+ </view>
+ <view class="info-content">
+ <view class="info-label">鐏屾簤鏃堕暱</view>
+ <view class="info-value">{{item.duration}}鍒嗛挓</view>
+ </view>
+ </view>
</view>
- <view class="info-row irrigated-row">
- <view class="info-label">宸茬亴婧夎疆缁勶細</view>
- <view class="info-value-time">{{item.irrigatedGroups}}</view>
- </view>
- </block>
- </view>
- <view class="item-actions" catchtap="stopPropagation">
- <!-- 鏍规嵁鐘舵�佹樉绀轰笉鍚岀殑鎸夐挳 -->
- <block wx:if="{{item.status === '鏈彂甯�'}}">
- <button class="action-button publish-button" hover-class="publish-button-hover" bindtap="onPublish" data-id="{{item.id}}">鍙戝竷</button>
- </block>
- <block wx:if="{{item.status === '鎵ц涓�' || item.status === '宸插彂甯�'}}">
- <button class="action-button stop-button" hover-class="stop-button-hover" bindtap="onStop" data-id="{{item.id}}">缁堟</button>
- </block>
- <block wx:if="{{item.status === '宸插彂甯�'}}">
- <button class="action-button execute-button" hover-class="execute-button-hover" bindtap="onExecute" data-id="{{item.id}}">绔嬪嵆鎵ц</button>
- </block>
+
+ <!-- 鎵ц涓姸鎬侀澶栦俊鎭� -->
+ <block wx:if="{{item.status === '3'}}">
+ <view class="executing-info">
+ <view class="info-item">
+ <view class="info-icon">
+ <image src="/images/progress-icon.svg" mode="aspectFit"></image>
+ </view>
+ <view class="info-content">
+ <view class="info-label">宸茬亴婧夋椂闂�</view>
+ <view class="info-value">{{item.irrigatedTime}}</view>
+ </view>
+ </view>
+ <view class="info-item">
+ <view class="info-icon">
+ <image src="/images/group-icon.svg" mode="aspectFit"></image>
+ </view>
+ <view class="info-content">
+ <view class="info-label">宸茬亴婧夎疆缁�</view>
+ <view class="info-value">{{item.irrigatedGroups}}</view>
+ </view>
+ </view>
+ </view>
+ </block>
+ </view>
+
+ <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
+ <view class="action-section" catchtap="stopPropagation" wx:if="{{item.status !== '4'}}">
+ <block wx:if="{{item.status === '1'}}">
+ <view class="action-buttons">
+ <button class="action-button publish-button" hover-class="publish-button-hover" bindtap="onPublish" data-id="{{item.id}}">
+ <image src="/images/publish-icon.svg" mode="aspectFit"></image>
+ <text>鍙戝竷</text>
+ </button>
+ </view>
+ </block>
+ <block wx:if="{{item.status === '2'}}">
+ <view class="action-buttons">
+ <button class="action-button stop-button" hover-class="stop-button-hover" bindtap="onStop" data-id="{{item.id}}">
+ <image src="/images/stop-icon.svg" mode="aspectFit"></image>
+ <text>缁堟</text>
+ </button>
+ </view>
+ </block>
+ <block wx:if="{{item.status === '3'}}">
+ <view class="action-buttons">
+ <button class="action-button stop-button" hover-class="stop-button-hover" bindtap="onStop" data-id="{{item.id}}">
+ <image src="/images/stop-icon.svg" mode="aspectFit"></image>
+ <text>缁堟</text>
+ </button>
+ </view>
+ </block>
+ </view>
</view>
</view>
</block>
@@ -81,6 +125,9 @@
<!-- 搴曢儴鏂板缓鎸夐挳 -->
<view class="bottom-button">
- <button class="add-button" hover-class="add-button-hover" bindtap="onAddIrrigation">鍒涘缓鐏屾簤璁″垝</button>
+ <button class="add-button" hover-class="add-button-hover" bindtap="onAddIrrigation">
+ <image src="/images/add-icon.svg" mode="aspectFit"></image>
+ <text>鍒涘缓鐏屾簤璁″垝</text>
+ </button>
</view>
</view>
\ No newline at end of file
diff --git a/pages/irrigation/irrigation.wxss b/pages/irrigation/irrigation.wxss
index bf95b18..690a85d 100644
--- a/pages/irrigation/irrigation.wxss
+++ b/pages/irrigation/irrigation.wxss
@@ -3,44 +3,34 @@
flex-direction: column;
height: 100vh;
background-color: #f5f5f5;
- padding: 20rpx;
- box-sizing: border-box;
+ overflow: hidden;
}
-/* 椤堕儴鏍囩椤垫牱寮� */
+/* 鏍囩椤垫牱寮� */
.tabs {
display: flex;
background-color: #fff;
- border-radius: 12rpx;
- margin-bottom: 20rpx;
- overflow: hidden;
- box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+ padding: 20rpx 0;
+ width: 100%;
+ flex-shrink: 0; /* 闃叉琚帇缂� */
+ box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.05);
+ border-bottom: 1rpx solid #eaeaea;
position: relative;
+ z-index: 10;
}
.tab {
flex: 1;
text-align: center;
- padding: 30rpx 0;
font-size: 28rpx;
color: #666;
position: relative;
- transition: all 0.2s ease;
-}
-
-.tab-hover {
- opacity: 0.8;
- background-color: rgba(0, 0, 0, 0.03);
-}
-
-.tab:active {
- opacity: 0.8;
- background-color: rgba(0, 0, 0, 0.03);
+ padding: 20rpx 0;
}
.tab.active {
- color: rgba(45, 139, 247, 1);
- font-weight: bold;
+ color: #0052d9;
+ font-weight: 500;
}
.tab.active::after {
@@ -49,243 +39,234 @@
bottom: 0;
left: 50%;
transform: translateX(-50%);
- width: 50vw;
- height: 6rpx;
- background-color: rgba(45, 139, 247, 1);
- border-radius: 3rpx;
+ width: 40rpx;
+ height: 4rpx;
+ background-color: #0052d9;
+ border-radius: 2rpx;
}
-/* 鍒锋柊鎸夐挳鍜屽垎闅旂嚎 */
-.refresh-header {
- display: flex;
- justify-content: flex-end;
- padding: 10rpx 20rpx;
-}
-
-.refresh-button {
- font-size: 28rpx;
- color: #fff;
- background-color: rgba(45, 139, 247, 1);
- border: none;
- border-radius: 5px;
- padding: 10rpx 20rpx;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.refresh-button:active {
- background-color: #1a6fc7;
-}
-
-.divider {
- height: 1rpx;
- background-color: #e0e0e0;
- margin: 10rpx 0;
-}
-
-/* 涓嬫媺鍒锋柊鍔ㄧ敾 */
-.refresh-view {
- text-align: center;
- padding: 30rpx;
- display: flex;
- justify-content: center;
- align-items: center;
-}
-
-.dot {
- width: 20rpx;
- height: 20rpx;
- background-color: rgba(45, 139, 247, 1);
- border-radius: 50%;
- margin: 0 5px;
- animation: blink 1.4s infinite both;
-}
-
-.dot:nth-child(2) {
- animation-delay: 0.2s;
-}
-
-.dot:nth-child(3) {
- animation-delay: 0.4s;
-}
-
-@keyframes blink {
- 0%, 80%, 100% {
- opacity: 0;
- }
- 40% {
- opacity: 1;
- }
-}
-
-/* scroll-view鏍峰紡 */
+/* 鍒楄〃瀹瑰櫒鏍峰紡 */
.scroll-view {
flex: 1;
- overflow-y: auto;
- margin-bottom: 20rpx;
- height: calc(100vh - 180rpx); /* 鍑忓幓椤堕儴鏍囩椤靛拰搴曢儴鎸夐挳鐨勯珮搴� */
+ overflow: hidden;
+ padding-bottom: 140rpx; /* 澧炲姞搴曢儴鍐呰竟璺濓紝涓烘寜閽暀鍑烘洿澶氱┖闂� */
+ background-color: #f5f5f5; /* 纭繚鑳屾櫙鑹蹭笌tabs涓嶅悓 */
+ margin-top: 10rpx; /* 涓庨《閮╰ab淇濇寔涓�鐐硅窛绂� */
}
.scroll-bg {
- padding: 10rpx 0;
- height: 100%;
- display: flex;
- flex-direction: column;
-}
-
-/* 涓棿鍒楄〃鏍峰紡 */
-.irrigation-list {
- flex: 1;
- background-color: transparent;
- margin-bottom: 20rpx;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- padding: 0;
-}
-
-.list-title {
- font-size: 28rpx;
- font-weight: bold;
- color: #333;
padding: 20rpx;
- background-color: #f8f8f8;
- border-bottom: 1rpx solid #eee;
+ padding-bottom: 40rpx; /* 娣诲姞搴曢儴鍐呰竟璺濓紝闃叉鏈�鍚庝竴椤硅閬尅 */
}
+/* 鍒楄〃椤规牱寮� */
.list-item {
- padding: 30rpx;
- padding-bottom: 90rpx;
- position: relative;
background-color: #fff;
- border-radius: 12rpx;
- margin-bottom: 16rpx;
- box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+ border-radius: 16rpx;
+ margin-bottom: 20rpx;
+ position: relative;
+ overflow: hidden;
+ box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
}
-.item-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 10rpx;
- margin-top: 10rpx;
-}
-
-.item-title {
- font-size: 28rpx;
- font-weight: bold;
- color: #333;
-}
-
-.item-status {
- font-size: 24rpx;
- color: #999;
- padding: 4rpx 12rpx;
+/* 鐘舵�佹爣绛炬牱寮� */
+.status-tag {
+ position: absolute;
+ top: 20rpx;
+ right: 20rpx;
+ padding: 4rpx 16rpx;
border-radius: 20rpx;
-
- display: flex;
- align-items: center;
-}
-
-.status-icon {
- width: 70rpx;
- height: 70rpx;
-
-}
-
-.status-active {
+ font-size: 24rpx;
color: #fff;
- background-color: rgba(45, 139, 247, 1);
}
-.status-draft {
- color: #fff;
+.status-tag.draft {
+ background-color: #ff9d00;
+}
+
+.status-tag.published {
+ background-color: #0052d9;
+}
+
+.status-tag.executing {
+ background-color: #00a870;
+}
+
+.status-tag.completed {
background-color: #999;
}
-.status-published {
- display: flex;
- align-items: center;
- justify-content: center;
- color: #00AD45;
- background-color: rgba(0, 173, 69, 0.1);
+/* 鍐呭鍖哄煙鏍峰紡 */
+.item-content {
+ padding: 30rpx;
}
-.status-published-icon {
- width: 34rpx;
- height: 34rpx;
- margin-right: 6rpx;
+/* 鏍囬鍖哄煙鏍峰紡 */
+.title-section {
+ margin-bottom: 30rpx;
}
-.item-info {
- font-size: 24rpx;
- color: #666;
- margin-right: 160rpx;
-}
-
-.info-row {
- display: flex;
- margin-bottom: 8rpx;
- align-items: flex-end; /* 娣诲姞搴曢儴瀵归綈 */
-}
-
-/* 缂栧彿琛屾牱寮� - 浣滀负鏍囬绐佸嚭鏄剧ず */
-.title-row {
- margin-bottom: 10rpx;
-}
-
-.title-row .info-label,
-.title-row .info-value {
- font-size: 26rpx;
- font-weight: bold;
+.plan-title {
+ font-size: 32rpx;
+ font-weight: 500;
color: #333;
+ margin-bottom: 8rpx;
+}
+
+.project-name {
+ font-size: 26rpx;
+ color: #666;
+}
+
+/* 淇℃伅鍖哄煙鏍峰紡 */
+.info-section {
+ margin-bottom: 30rpx;
+}
+
+/* 淇℃伅缃戞牸 */
+.info-grid {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ width: 100%;
+ margin-top: 12rpx;
+}
+
+.info-item {
+ display: flex;
+ align-items: flex-start;
+ /* 妯悜甯冨眬鏃跺崰鎹竴鍗婂搴� */
+ width: 48%;
+}
+
+/* 绾靛悜甯冨眬鐨勪俊鎭綉鏍� */
+.vertical-layout {
+ flex-direction: column;
+ gap: 16rpx;
+}
+
+.vertical-layout .info-item {
+ width: 100%;
+ margin-bottom: 16rpx;
+}
+
+/* 鍘嗗彶鍒楄〃鐗瑰畾鏍峰紡 */
+.history-grid {
+ flex-direction: column;
+ gap: 20rpx;
+}
+
+.info-icon {
+ width: 40rpx;
+ height: 40rpx;
+ margin-right: 16rpx;
+}
+
+.info-icon.duration-icon {
+ width: 35rpx;
+ height: 35rpx;
+ margin-right: 16rpx;
+}
+
+.info-icon image {
+ width: 100%;
+ height: 100%;
+}
+
+.info-content {
+ flex: 1;
}
.info-label {
+ font-size: 24rpx;
color: #999;
- width: 150rpx;
- margin-right: 10rpx; /* 娣诲姞鍙充晶闂磋窛 */
+ margin-bottom: 4rpx;
}
-/* 涓哄凡鐏屾簤鏃堕棿鍜岃疆缁勬坊鍔犵壒娈婃牱寮� */
-.info-row.irrigated-row {
- margin-top: 12rpx;
- margin-bottom: 12rpx;
- align-items: center !important; /* 寮哄埗鍨傜洿灞呬腑瀵归綈 */
- display: flex;
- justify-content: flex-start; /* 姘村钩鏂瑰悜璧风偣瀵归綈 */
- height: 50rpx; /* 鍥哄畾琛岄珮 */
+.info-value {
+ font-size: 28rpx;
+ color: #333;
}
-.info-row.irrigated-row .info-label {
+/* 鎵ц涓姸鎬侀澶栦俊鎭牱寮� */
+.executing-info {
+ margin-top: 20rpx;
+ padding-top: 20rpx;
+ border-top: 1rpx solid #f5f5f5;
+}
+
+/* 鎿嶄綔鎸夐挳鍖哄煙鏍峰紡 */
+.action-section {
display: flex;
+ justify-content: flex-end;
+ gap: 20rpx;
+ padding-top: 20rpx;
+ border-top: 1rpx solid #f5f5f5;
+ width: 100%;
+ position: relative;
+ z-index: 1;
+}
+
+.action-buttons {
+ display: flex;
+ justify-content: flex-end;
+ gap: 20rpx;
+ width: 100%;
+}
+
+.action-button {
+ display: inline-flex;
align-items: center;
- height: 100%; /* 浣跨敤鐧惧垎姣旈珮搴� */
+ justify-content: center;
+ gap: 8rpx;
+ padding: 12rpx 24rpx;
+ border-radius: 8rpx;
+ font-size: 28rpx;
+ line-height: 1;
+ min-width: 160rpx;
+ height: 60rpx;
+ margin: 0;
+ background-color: #1890FF;
+ color: #fff;
+ border: none;
+ position: relative;
+ z-index: 2;
}
-.info-value-time {
- font-size: 30rpx;
- font-weight: bold;
- color: rgb(42, 130, 228);
- display: flex;
- align-items: center;
- height: 100%; /* 浣跨敤涓巌nfo-label鐩稿悓鐨勯珮搴� */
+.action-button::after {
+ display: none;
}
-/* 绌哄垪琛ㄥ鍣� */
+.action-button image {
+ width: 32rpx;
+ height: 32rpx;
+ display: block;
+}
+
+.action-button text {
+ color: #fff;
+ display: block;
+}
+
+.publish-button {
+ background-color: #1890FF !important;
+}
+
+.stop-button {
+ background-color: #ff4d4f !important;
+}
+
+.execute-button {
+ background-color: #1890FF !important;
+}
+
+/* 绌虹姸鎬佹牱寮� */
.empty-list {
- flex: 1;
display: flex;
flex-direction: column;
- justify-content: center;
align-items: center;
- background-color: #fff;
- border-radius: 12rpx;
- box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
- width: 100%;
- height: calc(100vh - 250rpx); /* 鍑忓幓椤堕儴鏍囩椤点�佸簳閮ㄦ寜閽拰鍐呰竟璺濈殑楂樺害 */
- min-height: 500rpx;
+ justify-content: center;
+ padding: 100rpx 0;
}
.empty-icon {
@@ -301,96 +282,46 @@
/* 搴曢儴鎸夐挳鏍峰紡 */
.bottom-button {
- padding: 20rpx 0;
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ padding: 20rpx;
+ background-color: #fff;
+ box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.05);
+ z-index: 100;
}
.add-button {
- background-color: rgba(45, 139, 247, 1);
- color: #fff;
- font-size: 32rpx;
- border-radius: 12rpx;
- width: 100%;
- transition: all 0.2s ease;
-}
-
-.add-button-hover {
- background-color: rgba(35, 110, 200, 1);
- transform: scale(0.98);
-}
-
-.add-button:active {
- background-color: rgba(35, 110, 200, 1);
- transform: scale(0.98);
-}
-
-/* 鍒楄〃椤规搷浣滄寜閽� */
-.item-actions {
display: flex;
- justify-content: flex-end;
align-items: center;
- position: absolute;
- bottom: 20rpx;
- right: 30rpx;
- z-index: 2;
+ justify-content: center;
+ background-color: #1890FF;
+ color: #fff;
+ border-radius: 8rpx;
+ font-size: 30rpx;
+ padding: 5rpx 0;
}
-.action-button {
- font-size: 24rpx;
- padding: 6rpx 20rpx;
- margin-left: 16rpx;
- border-radius: 30rpx;
- background-color: #fff;
- line-height: 1.5;
- min-height: auto;
- box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.1);
- transition: all 0.2s ease;
+.add-button image {
+ width: 36rpx;
+ height: 36rpx;
+ margin-right: 8rpx;
}
-.action-button-hover {
- transform: scale(0.95);
- box-shadow: 0 1rpx 3rpx rgba(0, 0, 0, 0.1);
-}
-
-.action-button:active {
- transform: scale(0.95);
- box-shadow: 0 1rpx 3rpx rgba(0, 0, 0, 0.1);
-}
-
-.publish-button {
- color: rgba(45, 139, 247, 1);
- border: 1rpx solid rgba(45, 139, 247, 1);
-}
-
+/* 鎸夐挳鐐瑰嚮鏁堟灉 */
.publish-button-hover {
- background-color: rgba(45, 139, 247, 0.1);
-}
-
-.publish-button:active {
- background-color: rgba(45, 139, 247, 0.1);
-}
-
-.stop-button {
- color: #f56c6c;
- border: 1rpx solid #f56c6c;
+ opacity: 0.8 !important;
}
.stop-button-hover {
- background-color: rgba(245, 108, 108, 0.1);
-}
-
-.stop-button:active {
- background-color: rgba(245, 108, 108, 0.1);
-}
-
-.execute-button {
- color: rgba(45, 139, 247, 1);
- border: 1rpx solid rgba(45, 139, 247, 1);
+ opacity: 0.8 !important;
}
.execute-button-hover {
- background-color: rgba(45, 139, 247, 0.1);
+ opacity: 0.8 !important;
}
-.execute-button:active {
- background-color: rgba(45, 139, 247, 0.1);
+.add-button-hover {
+ opacity: 0.8;
}
\ No newline at end of file
--
Gitblit v1.8.0