From 7d56f6e20ab87cf6bb78cb5e6d02df0a15f5ed7a Mon Sep 17 00:00:00 2001 From: zuoxiao <zuoxiao> Date: 星期五, 11 四月 2025 15:40:53 +0800 Subject: [PATCH] 优化灌溉计划页面,添加分页功能和加载更多数据的逻辑;更新样式以提升用户体验,确保在切换标签时只加载必要的数据。 --- pages/waterIntake/waterIntake.wxml | 161 ++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 126 insertions(+), 35 deletions(-) diff --git a/pages/waterIntake/waterIntake.wxml b/pages/waterIntake/waterIntake.wxml index e433296..65c35d8 100644 --- a/pages/waterIntake/waterIntake.wxml +++ b/pages/waterIntake/waterIntake.wxml @@ -1,50 +1,28 @@ <view class="container"> - <!-- 椤堕儴 Tabs --> - <view class="tabs"> - <view class="tab" bindtap="switchTab" data-tab="0" id="tab0"> - 甯哥敤鍙栨按鍙� - <view class="indicator" wx:if="{{currentTab === 0}}"></view> - </view> - <view class="tab" bindtap="switchTab" data-tab="1" id="tab1"> - 鎵�鏈夊彇姘村彛 - <view class="indicator" wx:if="{{currentTab === 1}}"></view> - </view> - </view> - - <!-- 甯哥敤鍙栨按鍙� --> - <scroll-view class="list-container" wx:if="{{currentTab === 0}}" scroll-y="true" refresher-enabled="true" refresher-threshold="50" bindrefresherrefresh="onPullDownRefresh_common" refresher-triggered="{{isRefreshing_common}}"> - <block wx:for="{{commonWaterPoints}}" wx:key="index"> - <view class="item"> - <view class="item-left"> - <text>{{item.intakeNum}}</text> - <image class="item-img" src="{{item.isOnLine ? '/images/wifi_no.svg' : '/images/wifi_off.svg'}}" /> - </view> - <text class="item-button" bindtap="choseCard" data-item="{{item}}">寮�闃�</text> - </view> - </block> - <view wx:if="{{commonWaterPoints.length === 0}}" class="noMore-View"> - <image class="noMore-img" src="/images/no_more.svg" /> - <text class="noMore-text">娌℃湁鏁版嵁</text> - </view> - </scroll-view> - - <!-- 鎵�鏈夊彇姘村彛 --> - <view class="all-waterIntake" wx:if="{{currentTab === 1}}"> + <view class="all-waterIntake" wx:if="{{currentTab === 0}}"> <view class="search-container"> - <input class="search-input" placeholder="璇疯緭鍏ュ彇姘村彛缂栫爜鍚庣偣鍑绘悳绱�" bindinput="onInput" /> + <input class="search-input" value="{{inputValue}}" placeholder="璇疯緭鍏ュ彇姘村彛缂栫爜鍚庣偣鍑绘悳绱�" bindinput="onInput" /> <t-button class="search-button" theme="primary" size="large" icon="search" shape="square" aria-label="鎼滅储" bindtap="onSearch" style="background-color: #1890FF; border: none; height: 80rpx;"></t-button> </view> - <scroll-view class="list-container" scroll-y="true" refresher-enabled="true" refresher-threshold="50" bindrefresherrefresh="onPullDownRefresh_all" refresher-triggered="{{isRefreshing_all}}"> + <view class="search-results" wx:if="{{allWaterPoints.length > 0}}" bindtap="closeSearch"> <block wx:for="{{allWaterPoints}}" wx:key="index"> + <view class="result-item" bindtap="choseCard" data-item="{{item}}"> + <text>{{item.intakeNum}}</text> + </view> + </block> + </view> + <scroll-view class="list-container" scroll-y="true" refresher-enabled="true" refresher-threshold="50" bindrefresherrefresh="onPullDownRefresh_common" refresher-triggered="{{isRefreshing_common}}"> + <block wx:for="{{commonWaterPoints}}" wx:key="index"> <view class="item"> <view class="item-left"> - <text>{{item.intakeNum}}</text> + <image class="item-img-left" src="/images/valve.svg" /> + <text class="water-intake-name">{{item.intakeNum}}</text> <image class="item-img" src="{{item.isOnLine ? '/images/wifi_no.svg' : '/images/wifi_off.svg'}}" /> </view> <text class="item-button" bindtap="choseCard" data-item="{{item}}">寮�闃�</text> </view> </block> - <view wx:if="{{allWaterPoints.length === 0}}" class="noMore-View"> + <view wx:if="{{commonWaterPoints.length === 0}}" class="noMore-View"> <image class="noMore-img" src="/images/no_more.svg" /> <text class="noMore-text">娌℃湁鏁版嵁</text> </view> @@ -54,4 +32,117 @@ <t-dialog class="dialog" visible="{{showConfirm}}" content="纭鎵撳紑{{choseItem.intakeNum}}鍚楋紵" confirm-btn="{{ { content: '纭', variant: 'base', theme: 'danger' } }}" close-on-overlay-click="false" cancel-btn="鍙栨秷" bind:confirm="confirmDialog" bind:cancel="closeDialog" /> <t-dialog class="error-dialog" title="寮�闃�閿欒" visible="{{showErrorDialog}}" content="{{errorData}}" confirm-btn="{{ confirmBtn }}" bind:confirm="closeErrorDialog" /> + + <t-dialog visible="{{showForceConfirm}}" content="褰撳墠铏氭嫙鍗¤鍗犵敤锛屾槸鍚﹀己鍒跺紑闃�锛�" confirm-btn="{{ { content: '寮哄埗寮�闃�', variant: 'base', theme: 'danger' } }}" cancel-btn="鍙栨秷" bind:confirm="confirmForceDialog" bind:cancel="cancelDialog" /> +<!-- 榛戣壊钂欏眰 --> +<view class="overlay" wx:if="{{showDialog}}" bindtap="closeDialog"></view> + <!-- 閫夋嫨鐏屾簤妯″紡 --> + <view class="dialog" wx:if="{{showDialog}}"> + <image class="close" src="/images/close.svg" bindtap="handleClost"></image> + <view class="dialog-content" wx:if="{{dialog_mode}}"> + <view class="dialog-title">璇烽�夋嫨寮�鍏抽榾鏂瑰紡</view> + <button bindtap="postOpenValva">鎵嬪姩寮�闃�鎵嬪姩鍏抽榾</button> + <button bindtap="handleSetDuration">寮�闃�鍚庡畾鏃堕暱鑷姩鍏抽榾</button> + <button bindtap="handleSetWaterVolume">寮�闃�鍚庡畾姘撮噺鑷姩鍏抽榾</button> + </view> + <view class="dialog-content" wx:if="{{dialog_time}}"> + <view class="dialog-title"> + <image class="dialog-title-img" bind:tap="dialogBack" src="/images/back.svg"></image> + <text class="dialog-title-text">寮�闃�鍚庡畾鏃堕暱鑷姩鍏抽榾</text> + </view> + <view> + <view class="row"> + <view class="choseitem{{activeIndex === 0 ? 'active' : ''}}" bindtap="handleTimeWrapperTap" data-index="0"> + <view class="chose-wrapper"> + <text class="chose-number">{{irrigateProfile[0].defaultValue}}</text> + <text class="chose-label">{{irrigateProfile[0].unitText}}</text> + </view> + </view> + <view class="choseitem{{activeIndex === 1 ? 'active' : ''}}" bindtap="handleTimeWrapperTap" data-index="1"> + <view class="chose-wrapper"> + <text class="chose-number">{{irrigateProfile[1].defaultValue}}</text> + <text class="chose-label">{{irrigateProfile[1].unitText}}</text> + </view> + </view> + </view> + <view class="row"> + <view class="choseitem{{activeIndex === 2 ? 'active' : ''}}" bindtap="handleTimeWrapperTap" data-index="2"> + <view class="chose-wrapper"> + <text class="chose-number">{{irrigateProfile[2].defaultValue}}</text> + <text class="chose-label">{{irrigateProfile[2].unitText}}</text> + </view> + </view> + <view class="choseitem{{activeIndex === 3 ? 'active' : ''}}" bindtap="handleTimeWrapperTap" data-index="3"> + <view class="chose-wrapper"> + <text class="chose-number">{{irrigateProfile[3].defaultValue}}</text> + <text class="chose-label">{{irrigateProfile[3].unitText}}</text> + </view> + </view> + </view> + <view> + <t-input label="" value="{{costiomTime}}" placeholder="鎴栧湪姝よ緭鍏ヨ嚜瀹氫箟鏃堕棿" type="number" bind:change="onTimeInputChange"> + </t-input> + <t-radio-group bind:change="onGroupOpenTimeTypeChange" wx:if="{{group_time}}" default-value="0" borderless t-class="box"> + <t-radio block="{{false}}" label="鍒嗛挓" value="0" /> + <t-radio block="{{false}}" label="灏忔椂" value="1" /> + </t-radio-group> + <t-radio-group bind:change="onGroupOpenTimeChange" value="{{radioValue}}" default-value="0" borderless t-class="box"> + <t-radio block="{{false}}" label="鐜板湪寮�闃�" value="0" /> + <t-radio block="{{false}}" label="璁″垝寮�闃�鏃堕棿" value="1" /> + </t-radio-group> + <text class="open-time" wx:if="{{isShowOpenTime}}">{{openTimeText}}</text> + <button bindtap="btnOpenOnTime">寮�闃�</button> + </view> + </view> + </view> + <view class="dialog-content" wx:if="{{dialog_water}}"> + <view class="dialog-title"> + <image class="dialog-title-img" bind:tap="dialogBack" src="/images/back.svg"/> + <text class="dialog-title-text">寮�闃�鍚庡畾姘撮噺鑷姩鍏抽榾</text> + </view> + <view> + <view class="row"> + <view class="choseitem{{activeIndex === 0 ? 'active' : ''}}" bindtap="handleWaterWrapperTap" data-index="0"> + <view class="chose-wrapper"> + <text class="chose-number">{{irrigateProfile[0].defaultValue}}</text> + <text class="chose-label">{{irrigateProfile[0].unitText}}</text> + </view> + </view> + <view class="choseitem{{activeIndex === 1 ? 'active' : ''}}" bindtap="handleWaterWrapperTap" data-index="1"> + <view class="chose-wrapper"> + <text class="chose-number">{{irrigateProfile[1].defaultValue}}</text> + <text class="chose-label">{{irrigateProfile[1].unitText}}</text> + </view> + </view> + </view> + <view class="row"> + <view class="choseitem{{activeIndex === 2 ? 'active' : ''}}" bindtap="handleWaterWrapperTap" data-index="2"> + <view class="chose-wrapper"> + <text class="chose-number">{{irrigateProfile[2].defaultValue}}</text> + <text class="chose-label">{{irrigateProfile[2].unitText}}</text> + </view> + </view> + <view class="choseitem{{activeIndex === 3 ? 'active' : ''}}" bindtap="handleWaterWrapperTap" data-index="3"> + <view class="chose-wrapper"> + <text class="chose-number">{{irrigateProfile[3].defaultValue}}</text> + <text class="chose-label">{{irrigateProfile[3].unitText}}</text> + </view> + </view> + </view> + <view> + <t-input label="" value="{{costiomWater}}" suffix="绔嬫柟绫�" align="right" type="number" placeholder="鎴栧湪姝よ緭鍏ヨ嚜瀹氫箟姘撮噺" bind:change="onWaterInputChange"> + </t-input> + <t-radio-group bind:change="onGroupOpenTimeChange" value="{{radioValue}}" default-value="0" borderless t-class="box"> + <t-radio block="{{false}}" label="鐜板湪寮�闃�" value="0" /> + <t-radio block="{{false}}" label="璁″垝寮�闃�鏃堕棿" value="1" /> + </t-radio-group> + <text class="open-time" wx:if="{{isShowOpenTime}}">{{openTimeText}}</text> + <button bindtap="btnOpenOnWater">寮�闃�</button> + </view> + </view> + </view> + </view> + <!-- 骞存湀鏃ユ椂鍒� --> + <t-date-time-picker title="閫夋嫨鏃ユ湡鍜屾椂闂�" visible="{{datetimeVisible}}" mode="minute" value="{{datetime}}" format="YYYY-MM-DD HH:mm" bindchange="onConfirm" bindpick="onColumnChange" bindcancel="hidePicker" start="{{dateStartTime}}" end="{{dateEndTime}}"/> + </view> -- Gitblit v1.8.0