From ddbd8c7ea87b66d5a9c4362ce284d12a4ae970d1 Mon Sep 17 00:00:00 2001 From: zuoxiao <470321431@qq.com> Date: 星期五, 01 十一月 2024 14:24:50 +0800 Subject: [PATCH] 1绑定相关。2首页修改开关阀提示。3.问题反馈相关功能 --- pages/feedback/feedback.js | 248 +++++++++++++++++++++++++----- pages/home/home.js | 46 +++-- pages/home/home.json | 1 pages/wxbind/wxbind.json | 6 pages/feedback/feedback.wxml | 24 ++- pages/feedback/feedback.wxss | 35 ++++ app.json | 9 + app.js | 2 pages/feedback/feedback.json | 3 api/config.js | 4 pages/wxbind/wxbind.js | 36 +++- pages/openCard/openCard.js | 8 pages/waterIntake/waterIntake.json | 1 pages/waterIntake/waterIntake.js | 2 pages/home/home.wxml | 15 + pages/wxbind/wxbind.wxml | 1 pages/wxbind/wxbind.wxss | 7 17 files changed, 346 insertions(+), 102 deletions(-) diff --git a/api/config.js b/api/config.js index d4251f5..ccba7c8 100644 --- a/api/config.js +++ b/api/config.js @@ -9,8 +9,8 @@ // BASEURL = 'https://irrigate.dayuyanjiuyuan.top/' // BASEURL = 'https://d4x9787456.vicp.fun/' // BASEURL = 'http://127.0.0.1:8087/' - // BASEURL = 'http://192.168.40.166:8087/' - BASEURL = 'http://192.168.10.52:8087/' + BASEURL = 'http://192.168.40.166:8087/' + // BASEURL = 'http://192.168.10.52:8087/' break default: BASEURL = '' diff --git a/app.js b/app.js index 7cdd3e2..2799a89 100644 --- a/app.js +++ b/app.js @@ -16,7 +16,7 @@ globalData: { sessionId:2024102118013700009, clientId:"", - tag:'test', + tag:'ym', userInfo: null, userId:"", userCode:"", diff --git a/app.json b/app.json index fd923d6..7a67abd 100644 --- a/app.json +++ b/app.json @@ -22,7 +22,14 @@ "navigationBarBackgroundColor": "#1890FF" }, "componentFramework": "glass-easel", - "sitemapLocation": "sitemap.json" + "sitemapLocation": "sitemap.json", + "permission": { + "scope": { + "userLocation": { + "desc": "涓轰簡鏇村ソ鐨勪负鎮ㄦ湇鍔★紝灏嗚幏鍙栨偍鐨勪綅缃俊鎭�" + } + } + } } \ No newline at end of file diff --git a/pages/feedback/feedback.js b/pages/feedback/feedback.js index cec1120..3e08801 100644 --- a/pages/feedback/feedback.js +++ b/pages/feedback/feedback.js @@ -1,6 +1,10 @@ const audio = wx.createInnerAudioContext() const recorderManager = wx.getRecorderManager() const { + get, + post +} = require('../../api/request.js'); +const { BASEURL } = require('../../api/config') const app = getApp() @@ -23,14 +27,18 @@ height: 160, }, originFiles: [], - feedBackList: Array(19).fill({ - createTime: "2023-05-06 12:36:25", - responseTime: "2023-05-07 12:36:25" - }), - contentValue: '', //鍙嶉璇︽儏 - accSavePath: '', //涓婁紶鐨勯煶棰戞枃浠舵帴鍙h繑鍥炵殑鍦板潃 - photoSavePath: [] //涓婁紶鐨勭収鐗囨枃浠惰繑鍥炵殑鍦板潃 + contentValue: '', //鍙嶉璇︽儏 + accSavePath: [], //涓婁紶鐨勯煶棰戞枃浠舵帴鍙h繑鍥炵殑鍦板潃 + photoSavePath: [], //涓婁紶鐨勭収鐗囨枃浠惰繑鍥炵殑鍦板潃 + phoneNumber: "", + lat: "", + lng: "", + loading: false, + hasMore: true, + pageCurr: 1, + pageSize: 20, + listData: [], //宸叉彁闂鍒楄〃 }, onLoad() { @@ -94,6 +102,22 @@ recorderManager.onError((err) => { console.log('褰曢煶閿欒', err); }); + wx.getLocation({ + type: 'wgs84', // 杩斿洖鍙互鐢ㄤ簬 `wx.openLocation` 鐨勭粡绾害 + success: (res) => { + console.log('鑾峰彇浣嶇疆鎴愬姛', res); + this.setData({ + lat: res.latitude, + lng: res.longitude, + }); + }, + fail: function (err) { + console.error('鑾峰彇浣嶇疆澶辫触', err); + } + }); + }, + onReady() { + this.getList(); }, //涓婁紶闊抽鏂囦欢 upACC(tempFilePath) { @@ -106,8 +130,16 @@ 'tag': app.globalData.tag, 'appId': app.globalData.AppID, }, - success: function (res) { //鍚庡彴杩斿洖缁欏墠绔瘑鍒悗鐨勬枃瀛� + success: (res) => { //鍚庡彴杩斿洖缁欏墠绔瘑鍒悗鐨勬枃瀛� console.log('褰曢煶涓婁紶鎴愬姛', res); + let jsonData = JSON.parse(res.data) + let audioObj = { + webPath: jsonData.content.webPath, + id: jsonData.content.id + }; + this.setData({ + accSavePath: [audioObj] + }) }, fail: (err) => { // 澶勭悊涓婁紶澶辫触鐨勯�昏緫 @@ -115,6 +147,7 @@ } }) }, + //鍒犻櫎鍥剧墖 handleRemove(e) { console.log("handleRemove"); const { @@ -132,7 +165,7 @@ }); originFiles.splice(index, 1); this.setData({ - originFiles, + originFiles: originFiles, }); }, @@ -158,7 +191,7 @@ return { ...item, status: 'loading', - uploadTask: this.onUploadPhoto(e.detail.files[0].url) + uploadTask: this.onUploadPhoto(item.url) }; // 淇濈暀鎵�鏈夊叾浠栧瓧娈碉紝骞舵坊鍔� displayText 瀛楁 }); // 鏇存柊鍒楄〃鏁版嵁 @@ -174,7 +207,7 @@ */ onUploadPhoto(imgPath) { const uploadTask = wx.uploadFile({ - url: BASEURL + "wx/webFile/upPhone", // 浠呬负绀轰緥锛岄潪鐪熷疄鐨勬帴鍙e湴鍧� + url: BASEURL + "wx/webFile/upPhoto", // 浠呬负绀轰緥锛岄潪鐪熷疄鐨勬帴鍙e湴鍧� filePath: imgPath, name: 'file', header: { @@ -183,6 +216,26 @@ }, success: (res) => { console.log('鍥剧墖涓婁紶鎴愬姛', res); + let jsonData = JSON.parse(res.data) + // 鏇存柊鍥剧墖涓婁紶鎴愬姛鐘舵�� + const updatedFiles = this.data.originFiles.map((file) => { + console.log('鍥剧墖涓婁紶鎴愬姛銆嬨�媢pdatedFiles', file + "++++++++++" + imgPath); + if (file.url === imgPath) { + return { + ...file, + status: undefined, // 涓婁紶鎴愬姛鐘舵�� + uploadTask: undefined, // 娓呯悊涓婁紶浠诲姟 + webPath: jsonData.content.webPath, + id: jsonData.content.id + }; + } + return file; + }); + // 灏嗗垱寤虹殑瀵硅薄娣诲姞鍒癷mages鏁扮粍涓� + this.setData({ + originFiles: updatedFiles, + }) + }, fail: (err) => { // 澶勭悊涓婁紶澶辫触鐨勯�昏緫 @@ -342,47 +395,60 @@ }); }, onPullDownRefresh() { - this.setData({ - isRefreshing: false - }); + this.getList(true); }, - feelBack() { + //涓婁紶闂 + feelBackPost() { wx.showLoading({ title: '姝e湪鎻愪氦...', // 鍔犺浇鎻愮ず鏂囧瓧 mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false }); + this.data.originFiles.map((file) => { + let imageObj = { + webPath: file.webPath, + id: file.id + }; + this.setData({ + photoSavePath: [...this.data.photoSavePath, imageObj] + }) + }) const app = getApp(); const data = { - content: this.data.contentValue, //鍙栨按鍙D - image: this.data.vcId, //铏氭嫙鍗D - operator: app.globalData.sessionId, //鎿嶄綔鍛� - forceOpen: !!isforce // 浣跨敤閫昏緫闈炴搷浣滅 !! 鏉ョ‘淇� isForce 鏄竷灏斿�� + images: this.data.photoSavePath, + audios: this.data.accSavePath, + content: this.data.contentValue, + lng: this.data.lng, + lat: this.data.lat, + clientId: app.globalData.clientId, + phone: this.data.phoneNumber }; post({ - url: "operation/feedback/add", + url: "wx/issue/addIssueReport", data: data }).then(response => { - // 澶勭悊鎴愬姛鍝嶅簲 console.log('璇锋眰鎴愬姛:', response); // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢� wx.hideLoading(); //瀹屾垚鍚庡洖鍒伴椤� - wx.reLaunch({ - url: '/pages/home/home?param=true' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓 - }); + wx.showToast({ + title: '鎻愪氦鎴愬姛', + icon: 'success', + duration: 2000, + success() {} + }) + setTimeout(() => { + wx.navigateBack({ + delta: 1 + }); + }, 2000); }).catch(error => { // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢� wx.hideLoading(); // 澶勭悊閿欒鍝嶅簲 console.error('璇锋眰澶辫触:', error); - // if (error.code === "10005") { - // this.setData({ - // showDialog: false, - // showForceConfirm: true - // }) - // } else { + this.setData({ showErrorDialog: true, errorData: error.msg @@ -396,19 +462,19 @@ voiceTime: 0, }) }, + //鎻愪氦 submit() { - if (this.data.contentValue !== "" || this.data.photoSavePath.length>0 || this.data.accSavePath !== "") { - wx.showToast({ - title: '鎻愪氦鎴愬姛', - icon: 'success', - duration: 2000, - success() {} - }) - setTimeout(() => { - wx.navigateBack({ - delta: 1 - }); - }, 2000); + if (this.data.contentValue !== "" || this.data.photoSavePath.length > 0 || this.data.accSavePath !== "") { + if (this.data.phoneNumber !== "" && this.data.phoneNumber.length !== 11) { + wx.showToast({ + title: '鑱旂郴鐢佃瘽閿欒', + icon: 'error', + duration: 2000, + success() {} + }) + } else { + this.feelBackPost(); + } } else { wx.showToast({ title: '璇疯緭鍏ヤ竴椤瑰弽棣堝唴瀹�', @@ -418,6 +484,104 @@ }) } + }, + //鐩戝惉鎵嬫満鍙风殑杈撳叆 + phoneInput(e) { + this.setData({ + phoneNumber: e.detail.value + }); + }, + //鐩戝惉 + contentInput(e) { + this.setData({ + contentValue: e.detail.value + }); + }, + //鑾峰彇宸叉彁闂鍒楄〃 + getList(isRefresh) { + if (isRefresh) { + this.setData({ + isRefreshing: false, + pageCurr: 1, + }); + } + const app = getApp(); + const params = { + url: 'wx/issue/getIssueReports', + data: { + clientId: app.globalData.clientId + } + }; + get(params).then(data => { + const updatedList = data.content.obj.map(item => { + if (item.replyTime === "" || item.replyTime === null) { + item.replyTime = "鏈洖澶�" + } + return item; + }); + this.setData({ + listData: [...this.data.listData, ...updatedList], + isRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚 + isWXRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚 + loading: false, + hasMore: this.data.pageCurr < data.content.pageTotal + }) + this.updateDisplayText(); + }).catch(err => { + // 閿欒鍥炶皟 + this.setData({ + isRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚 + isWXRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚 + loading: false + }) + wx.showToast({ + title: err.msg, + icon: 'error', + duration: 3000 + }) + }); + }, + //鍔犺浇鏇村 + loadMore() { + if (this.data.hasMore && !this.data.loading) { + this.setData({ + loading: true, + pageCurr: this.data.pageCurr + 1 + }) + this.getList(); + } + }, + onDelete(e) { + const item = e.currentTarget.dataset.item; + const that = this; + wx.showLoading({ + title: '姝e湪寮哄埗鍒犻櫎璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧 + mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false + }); + that.setData({ + lastIntakeName: intakeName + }) + const data = { + vcNum: item.vcNum, //鍙栨按鍙D + rtuAddr: item.rtuAddr, //闃�鎺у櫒鍦板潃 + }; + post({ + url: "wx/issue/deleteIssueReport", + data: data, + timeout: 180000 + }).then(response => { + // 澶勭悊鎴愬姛鍝嶅簲 + console.log('璇锋眰鎴愬姛:', response); + // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢� + wx.hideLoading(); + //閲嶆柊鑾峰彇鍒楄〃鍒锋柊鏁版嵁 + this.getList(); + }).catch(error => { + // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢� + wx.hideLoading(); + // 澶勭悊閿欒鍝嶅簲 + console.error('璇锋眰澶辫触:', error); + }); } }); \ No newline at end of file diff --git a/pages/feedback/feedback.json b/pages/feedback/feedback.json index 4a37d45..9d0fbcb 100644 --- a/pages/feedback/feedback.json +++ b/pages/feedback/feedback.json @@ -1,7 +1,8 @@ { "component": true, "usingComponents": { - "t-upload": "tdesign-miniprogram/upload/upload" + "t-upload": "tdesign-miniprogram/upload/upload", + "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell" }, "navigationBarTitleText": "闂鍙嶉", "navigationBarTextStyle": "white" diff --git a/pages/feedback/feedback.wxml b/pages/feedback/feedback.wxml index ea9581b..0e1c773 100644 --- a/pages/feedback/feedback.wxml +++ b/pages/feedback/feedback.wxml @@ -1,6 +1,6 @@ <view class="container"> <!-- 椤堕儴 Tabs --> - <!-- <view class="tabs"> + <view class="tabs"> <view class="tab" bindtap="switchTab" data-tab="0" id="tab0"> 闂鍙嶉 <view class="indicator" wx:if="{{currentTab === 0}}"></view> @@ -9,11 +9,11 @@ 宸叉彁闂 <view class="indicator" wx:if="{{currentTab === 1}}"></view> </view> - </view> --> + </view> <view class="container-feedBack" wx:if="{{currentTab === 0}}"> <view class="container-item"> <text class="fb-text">鍙嶉璇︽儏锛�</text> - <textarea class="input-class" value="{{contentValue}}" /> + <textarea class="input-class" bindinput="contentInput" /> </view> <view class="divider"></view> <view class="container-item"> @@ -39,27 +39,35 @@ </view> <!-- 褰曢煶涓� --> <view wx:if="{{isShowVoiceMask}}" class="voice_starting">褰曢煶涓瓄{contDownTime}}绉�</view> + <view class="container-phone"> + <text class="fb-text">鎵嬫満鍙凤細</text> + <input class="input-phone" type="number" placeholder="鑱旂郴鐢佃瘽锛堥�夊~锛�" bindinput="phoneInput" maxlength="11" /> + </view> <button class="fb-submit" bind:tap="submit">鎻愪氦</button> </view> - <!-- <scroll-view class="container-scroll" wx:if="{{currentTab === 1}}" scroll-y="true" refresher-enabled="true" refresher-threshold="50" bindrefresherrefresh="onPullDownRefresh" refresher-triggered="{{isRefreshing}}"> - <block wx:for="{{feedBackList}}" wx:key="index"> + <scroll-view class="container-scroll" wx:if="{{currentTab === 1}}" scroll-y="true" refresher-enabled="true" refresher-threshold="50" bindrefresherrefresh="onPullDownRefresh" refresher-triggered="{{isRefreshing}}" bindscrolltolower="loadMore"> + <block wx:for="{{listData}}" wx:key="index"> + <t-swipe-cell style="width: 100%;" class="swipe-cell-base"> <view class="item"> <view class="item-data"> <text>鎻愰棶鏃堕棿锛�</text> - <text>{{item.createTime}}</text> + <text>{{item.reportTime}}</text> </view> <view class="item-data"> <text>鍝嶅簲鏃堕棿锛�</text> - <text>{{item.responseTime}}</text> + <text>{{item.replyTime}}</text> </view> </view> + <view slot="right" class="delete-btn" bind:tap="onDelete" data-item="{{item}}">鍒犻櫎</view> + </t-swipe-cell> </block> <view wx:if="{{feedBackList.length === 0}}" class="noMore-View"> <image class="noMore-img" src="/images/no_more.svg" /> <text class="noMore-text">娌℃湁鏁版嵁</text> </view> - </scroll-view> --> + <view wx:if="{{loading}}" class="loading">鍔犺浇涓�...</view> <!-- 鍔犺浇鎸囩ず鍣� --> + </scroll-view> </view> \ No newline at end of file diff --git a/pages/feedback/feedback.wxss b/pages/feedback/feedback.wxss index 9bc4a3e..3bee960 100644 --- a/pages/feedback/feedback.wxss +++ b/pages/feedback/feedback.wxss @@ -102,7 +102,7 @@ background-color: #1890FF; font-size: 35rpx; color: white; - margin-top: 200rpx; + margin-top: 100rpx; } .voice_img { @@ -244,8 +244,39 @@ display: flex; flex-direction: column; flex-grow: 1; + margin-bottom: 10rpx; } .item-data text { font-size: 30rpx; -} \ No newline at end of file +} + +.container-phone { + display: flex; + align-items: center; /* 鍨傜洿灞呬腑 */ + margin-bottom: 10px; /* 鍙�夛細涓哄鍣ㄦ坊鍔犱竴浜涘簳閮ㄩ棿璺� */ + margin-top: 30rpx; +} + +.fb-text { + flex: 0 0 auto; /* 涓嶆墿灞曚篃涓嶆敹缂╋紝鑷姩瀹藉害 */ + margin-right: 10px; /* 鍙�夛細涓烘枃鏈拰杈撳叆妗嗕箣闂存坊鍔犱竴浜涢棿璺� */ +} + +.input-phone { + flex: 1 1 auto; /* 鎵╁睍浠ュ~鍏呭墿浣欑┖闂达紝浣嗘渶灏忓搴︿负鑷姩 */ + border: 1px solid #ccc; /* 鍙�夛細涓鸿緭鍏ユ娣诲姞杈规 */ + padding: 5px; /* 鍙�夛細涓鸿緭鍏ユ娣诲姞鍐呰竟璺� */ + border-radius: 4px; /* 鍙�夛細涓鸿緭鍏ユ娣诲姞鍦嗚 */ + border: 2rpx solid #000000; +} + +.delete-btn { + display: flex; + align-items: center; + justify-content: center; + width: 120rpx; + height: 100%; + color: white; + background-color: #e34d59; +} diff --git a/pages/home/home.js b/pages/home/home.js index 879e346..f9fe2fa 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -32,7 +32,8 @@ lastIntakeName: "", isLogin: false, //鏄惁宸茬粡鐧诲綍 showInfoDialog: false, - + showTipDialog: false, + options: '', }, openValve: function (e) { @@ -88,23 +89,15 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { - // 浣跨敤 wx.nextTick 绛夊緟椤甸潰娓叉煋瀹屾垚 - wx.nextTick(() => { - this.calculateScrollViewHeight(); - }); //褰撳紑闃�鎴愬姛鍚庤皟鐢ㄥ埛鏂� console.log("onLoad锛�" + options.param); if (options.param) { - wx.showToast({ - title: '寮�闃�鎴愬姛', - icon: 'success', - duration: 3000 - }) this.setData({ - isLogin: true + options: options, + isLogin: true, }) - this.getOpenList(); } + }, /** @@ -130,6 +123,14 @@ } else { //鏈湴娌℃湁缂撳瓨寰俊鐧诲綍 this.wxLogin(); + } + if (this.data.options.param) { + this.setData({ + + showTipDialog: true, + tipData: "寮�闃�鍛戒护涓嬪彂鎴愬姛锛岀◢鍚庤鍒锋柊蹇�熷叧闃�鍒楄〃鏌ョ湅鎵ц缁撴灉銆�" + }) + this.getOpenList(); } }, wxLogin() { @@ -259,13 +260,15 @@ this.setData({ showConfirm: false, showErrorDialog: false, - showForceConfirm: false + showForceConfirm: false, + showTipDialog: false }); }, cancelDialog() { this.setData({ showForceConfirm: false, - showConfirm: false + showConfirm: false, + showTipDialog: false }); }, /** @@ -300,14 +303,15 @@ wx.hideLoading(); this.getOpenList(); if (response.content.data.success) { - wx.showToast({ - title: '鍏抽榾鎴愬姛', - icon: 'success', - duration: 3000 + this.setData({ + isLogin: true, + showTipDialog: true, + tipData: "鍏抽榾鍛戒护涓嬪彂鎴愬姛锛岀◢鍚庤鍒锋柊蹇�熷叧闃�鍒楄〃鏌ョ湅鎵ц缁撴灉銆�" }) + this.getOpenList(); } else { wx.showToast({ - title: '鍏抽榾澶辫触', + title: '鍛戒护鎵ц澶辫触', icon: 'error', duration: 3000 }) @@ -596,8 +600,8 @@ unbind() { //娓呯┖鏁版嵁 this.setData({ - userPhone: "璇风櫥褰�", - userName: "鏈櫥褰�", + userPhone: "鏈櫥褰�", + userName: "璇风櫥褰�", listData: [] }) wx.showLoading({ diff --git a/pages/home/home.json b/pages/home/home.json index 2b845e1..beab603 100644 --- a/pages/home/home.json +++ b/pages/home/home.json @@ -2,7 +2,6 @@ "component": true, "usingComponents": { "t-avatar": "tdesign-miniprogram/avatar/avatar", - "t-switch": "tdesign-miniprogram/switch/switch", "t-dialog": "tdesign-miniprogram/dialog/dialog", "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell", "t-button": "tdesign-miniprogram/button/button" diff --git a/pages/home/home.wxml b/pages/home/home.wxml index bc7edff..c43351d 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -67,7 +67,7 @@ <image class="item-img" src="{{item.isOnLine ? '/images/wifi_no.svg' : '/images/wifi_off.svg'}}" /> </view> <view> - <!-- <t-switch class="switch" data-item="{{item}}" bindchange="handleChange" value="{{true}}" label="{{['寮�', '鍏�']}}" slot="note" /> --> + <text class="item-button" bind:tap="handleChange" data-item="{{item}}">鍏抽榾</text> </view> </view> @@ -90,11 +90,16 @@ <!-- 閫傞厤skyline锛屽鍔爐ype="list" --> <scroll-view slot="content" type="list" scroll-y class="long-content"> <view class="content-container"> - 1.缃戠粶绛変笉鍙姉鍔涘洜绱犲彲鑳藉鑷磋澶囩姸鎬佹樉绀哄欢杩熸垨閿欒銆� - 2.褰撴彁绀烘偍鎿嶄綔澶辫触鍚庢偍鍙◢鍚庡皾璇曢噸鏂版搷浣溿�� - 3.鍦ㄥ畾鏃舵垨瀹氶噺寮�闃�鐨勯绾﹀紡寮�闃�杩囩▼涓紝绯荤粺浠呮樉绀哄彇娑堢姸鎬併�傚綋鐢ㄦ埛鐐瑰嚮鍙栨秷鏃讹紝绋嬪簭浼氬皾璇曟墽琛屽彇娑堟搷浣滐紝浣嗗彲鑳藉洜缃戠粶绛変笉鍙姉鍔涘洜绱犺�屽け璐ャ�� - 4.鎴戜滑璇氭寶鍦伴個璇锋偍閫氳繃鎰忚鍙嶉娓犻亾鎻愬嚭瀹濊吹鐨勫缓璁垨鎰忚銆� + <text class="content-container"> + 1.缃戠粶绛変笉鍙姉鍔涘洜绱犲彲鑳藉鑷磋澶囩姸鎬佹樉绀哄欢杩熸垨閿欒銆� + 2.褰撴彁绀烘偍鎿嶄綔澶辫触鍚庢偍鍙◢鍚庡皾璇曢噸鏂版搷浣溿�� + 3.鍦ㄥ畾鏃舵垨瀹氶噺寮�闃�鐨勯绾﹀紡寮�闃�杩囩▼涓紝绯荤粺浠呮樉绀哄彇娑堢姸鎬併�傚綋鐢ㄦ埛鐐瑰嚮鍙栨秷鏃讹紝绋嬪簭浼氬皾璇曟墽琛屽彇娑堟搷浣滐紝浣嗗彲鑳藉洜缃戠粶绛変笉鍙姉鍔涘洜绱犺�屽け璐ャ�� + 4.鎴戜滑璇氭寶鍦伴個璇锋偍閫氳繃鎰忚鍙嶉娓犻亾鎻愬嚭瀹濊吹鐨勫缓璁垨鎰忚銆� + </text> + </view> </scroll-view> </t-dialog> + <t-dialog class="dialog" title="閫氱煡缁撴灉" visible="{{showTipDialog}}" content="{{tipData}}" confirm-btn="{{ confirmBtn }}" bind:confirm="cancelDialog" /> + </view> \ No newline at end of file diff --git a/pages/openCard/openCard.js b/pages/openCard/openCard.js index 7d989d7..6a6e8f6 100644 --- a/pages/openCard/openCard.js +++ b/pages/openCard/openCard.js @@ -54,12 +54,12 @@ this.setData({ vcId: item.id, }) - if (this.data.intakeName === "") { - // 閫夋嫨铏氭嫙鍗″悗 - this.initDialogData(); - } else { + if (this.data.intakeName) { //鎵爜寮�闃�閫昏緫 this.postOpenValva(false); + } else { + // 閫夋嫨铏氭嫙鍗″悗 + this.initDialogData(); } } diff --git a/pages/waterIntake/waterIntake.js b/pages/waterIntake/waterIntake.js index 103b2a0..7824332 100644 --- a/pages/waterIntake/waterIntake.js +++ b/pages/waterIntake/waterIntake.js @@ -224,7 +224,7 @@ get({ url: 'wx/intake/used_intakes', data: { - operator: getApp().globalData.sessionId + operatorId: getApp().globalData.sessionId } }) .then((data) => { diff --git a/pages/waterIntake/waterIntake.json b/pages/waterIntake/waterIntake.json index 5d12b46..da2a7a6 100644 --- a/pages/waterIntake/waterIntake.json +++ b/pages/waterIntake/waterIntake.json @@ -2,7 +2,6 @@ "component": true, "usingComponents": { "t-avatar": "tdesign-miniprogram/avatar/avatar", - "t-switch": "tdesign-miniprogram/switch/switch", "t-button": "tdesign-miniprogram/button/button", "t-dialog": "tdesign-miniprogram/dialog/dialog" }, diff --git a/pages/wxbind/wxbind.js b/pages/wxbind/wxbind.js index 5a1ecb9..cff139a 100644 --- a/pages/wxbind/wxbind.js +++ b/pages/wxbind/wxbind.js @@ -15,7 +15,13 @@ phoneCode: '', codeSent: false, countdown: 60, - isButtonEnabled: false + isButtonEnabled: false, + showErrorDialog: false, + errorData: "", + errorDialogTitle: "閿欒鎻愮ず", + confirmBtn: { + content: '纭' + } }, onLoad(options) { @@ -62,11 +68,7 @@ } // 鍦ㄨ繖閲屽鐞嗗彂閫侀獙璇佺爜鐨勯�昏緫锛屽彲浠ヨ皟鐢ㄥ悗鍙版帴鍙e疄鐜� this.postCode(); - this.setData({ - codeSent: true, - }); - // 鍚姩鍊掕鏃� - this.startCountdown(); + }, //鍊掕鏃� startCountdown: function () { @@ -109,8 +111,17 @@ icon: 'success', duration: 2000, }); + this.setData({ + codeSent: true, + }); + // 鍚姩鍊掕鏃� + this.startCountdown(); }) .catch((error) => { + this.setData({ + showErrorDialog: true, + errorData: error.msg + }) console.error('Failed to add item:', error); }); }, @@ -143,10 +154,10 @@ }; post(params) .then((data) => { - getApp().globalData.sessionId = data.content.sessionId - storage.setItem("sessionId", data.content.sessionId) - getApp().globalData.clientId = data.content.clientId - storage.setItem("clientId", data.content.clientId) + getApp().globalData.sessionId = String(data.content.sessionId) + storage.setItem("sessionId", String(data.content.sessionId)) + getApp().globalData.clientId = String(data.content.clientId) + storage.setItem("clientId", String(data.content.clientId)) this.bindSuccess(); }) .catch((error) => { @@ -157,5 +168,10 @@ }); console.error('Failed to add item:', error); }); + }, + closeDialog() { + this.setData({ + showErrorDialog: false + }) } }) \ No newline at end of file diff --git a/pages/wxbind/wxbind.json b/pages/wxbind/wxbind.json index 48c9a4a..7918811 100644 --- a/pages/wxbind/wxbind.json +++ b/pages/wxbind/wxbind.json @@ -1,4 +1,8 @@ -{ +{ "component": true, + "usingComponents": { + "t-dialog": "tdesign-miniprogram/dialog/dialog", + "t-button": "tdesign-miniprogram/button/button" + }, "navigationBarTitleText": "鍐滄埛缁戝畾", "navigationBarTextStyle": "white" } \ No newline at end of file diff --git a/pages/wxbind/wxbind.wxml b/pages/wxbind/wxbind.wxml index ca09c58..73687aa 100644 --- a/pages/wxbind/wxbind.wxml +++ b/pages/wxbind/wxbind.wxml @@ -11,4 +11,5 @@ </view> </view> <button class="button {{isButtonEnabled ? 'button-active' : 'button-disabled'}}" bindtap="bind">缁戝畾寰俊</button> + <t-dialog class="error-dialog" visible="{{showErrorDialog}}" content="{{errorData}}" confirm-btn="{{ confirmBtn }}" bind:confirm="closeDialog" /> </view> \ No newline at end of file diff --git a/pages/wxbind/wxbind.wxss b/pages/wxbind/wxbind.wxss index 1485222..56d21ec 100644 --- a/pages/wxbind/wxbind.wxss +++ b/pages/wxbind/wxbind.wxss @@ -130,4 +130,9 @@ width: 38%; font-size: 28rpx; margin-left: 15rpx; -} \ No newline at end of file +} + +.error-dialog { + --td-dialog-title-color: red; + --td-dialog-title-font-size: 40rpx; +} -- Gitblit v1.8.0