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/home/home.js | 173 ++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 108 insertions(+), 65 deletions(-)
diff --git a/pages/home/home.js b/pages/home/home.js
index cbba07e..f9fe2fa 100644
--- a/pages/home/home.js
+++ b/pages/home/home.js
@@ -31,6 +31,9 @@
showForceConfirm: false, //鏄惁寮哄埗寮�闃�
lastIntakeName: "",
isLogin: false, //鏄惁宸茬粡鐧诲綍
+ showInfoDialog: false,
+ showTipDialog: false,
+ options: '',
},
openValve: function (e) {
@@ -44,7 +47,6 @@
icon: 'error'
})
}
-
},
calculateScrollViewHeight: function () {
wx.createSelectorQuery().selectAll('.list-item').boundingClientRect((rects) => {
@@ -55,7 +57,7 @@
}).exec();
},
startPullDownRefresh() {
- if(this.data.isLogin){
+ if (this.data.isLogin) {
if (!this.data.isWXRefreshing) {
var self = this;
console.log(this.data.isRefreshing);
@@ -64,14 +66,12 @@
});
this.getOpenList();
}
- }else{
+ } else {
wx.showToast({
title: '璇峰厛鐧诲綍',
icon: 'error'
})
}
-
-
},
//鑾峰彇鐢ㄦ埛鏁版嵁
getUserData() {
@@ -89,19 +89,13 @@
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
*/
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({
+ options: options,
+ isLogin: true,
})
- this.getOpenList();
}
},
@@ -115,6 +109,9 @@
const app = getApp();
storage.getItem('sessionId').then((data) => {
app.globalData.sessionId = data;
+ this.setData({
+ isLogin: true
+ })
if (app.globalData.sessionId) {
this.getOpenList();
this.getUserDataBySession();
@@ -126,6 +123,14 @@
} else {
//鏈湴娌℃湁缂撳瓨寰俊鐧诲綍
this.wxLogin();
+ }
+ if (this.data.options.param) {
+ this.setData({
+
+ showTipDialog: true,
+ tipData: "寮�闃�鍛戒护涓嬪彂鎴愬姛锛岀◢鍚庤鍒锋柊蹇�熷叧闃�鍒楄〃鏌ョ湅鎵ц缁撴灉銆�"
+ })
+ this.getOpenList();
}
},
wxLogin() {
@@ -255,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
});
},
/**
@@ -296,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
})
@@ -324,32 +332,44 @@
* 鑾峰彇涓哄叧闃�璁板綍
*/
getOpenList() {
- const app = getApp();
- const params = {
- url: 'wx/valve/get',
- data: {
- operator: app.globalData.sessionId
- }
- };
- get(params).then(data => {
- this.setData({
- listData: data.content,
- isRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
- isWXRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
- })
- this.updateDisplayText();
- }).catch(err => {
- // 閿欒鍥炶皟
- this.setData({
- isRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
- isWXRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
- })
+ if (this.data.isLogin) {
+ const app = getApp();
+ const params = {
+ url: 'wx/valve/get',
+ data: {
+ operator: app.globalData.sessionId
+ }
+ };
+ get(params).then(data => {
+ this.setData({
+ listData: data.content,
+ isRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
+ isWXRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
+ })
+ this.updateDisplayText();
+ }).catch(err => {
+ // 閿欒鍥炶皟
+ this.setData({
+ isRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
+ isWXRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
+ })
+ wx.showToast({
+ title: err.msg,
+ icon: 'error',
+ duration: 3000
+ })
+ });
+ } else {
wx.showToast({
- title: err.msg,
- icon: 'error',
- duration: 3000
+ title: '璇峰厛鐧诲綍',
+ icon: 'error'
})
- });
+ this.setData({
+ isRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
+ isWXRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
+ })
+ }
+
},
/**
* 纭鍏抽棴鍥炶皟
@@ -403,25 +423,36 @@
* 鎵爜寮�闃�
*/
scenCode() {
- const that = this;
- wx.scanCode({
- success(res) {
- console.log(res.result); // 褰撲笖浠呭綋鎵爜涓洪潪寰俊浜岀淮鐮佹椂锛屼細杩斿洖result
- if (res.result.startsWith("content://")) {
- let jsonStr = res.result.replace("content://", "")
- try {
- that.saveData(jsonStr)
- } catch (error) {
- console.error('Error parsing JSON:', error);
+ if (this.data.isLogin) {
+ const that = this;
+ wx.scanCode({
+ success(res) {
+ console.log(res.result); // 褰撲笖浠呭綋鎵爜涓洪潪寰俊浜岀淮鐮佹椂锛屼細杩斿洖result
+ if (res.result.startsWith("content://")) {
+ let jsonStr = res.result.replace("content://", "")
+ try {
+ that.saveData(jsonStr)
+ } catch (error) {
+ console.error('Error parsing JSON:', error);
+ }
+ } else {
+ wx.navigateTo({
+ url: '/pages/openCard/openCard?intakeName=' + res.result,
+ })
+ // that.postOppenValva()
}
- } else {
- that.postOppenValva(res.result)
+ },
+ fail(err) {
+ console.error(err);
}
- },
- fail(err) {
- console.error(err);
- }
- })
+ })
+ } else {
+ wx.showToast({
+ title: '璇峰厛鐧诲綍',
+ icon: 'error'
+ })
+ }
+
},
confirmForceDialog() {
console.log("confirmForceDialog");
@@ -569,8 +600,8 @@
unbind() {
//娓呯┖鏁版嵁
this.setData({
- userPhone: "璇风櫥褰�",
- userName: "鏈櫥褰�",
+ userPhone: "鏈櫥褰�",
+ userName: "璇风櫥褰�",
listData: []
})
wx.showLoading({
@@ -594,7 +625,7 @@
userPhone: "璇风櫥褰�",
userName: "鏈櫥褰�",
listData: [],
- isLogin:false
+ isLogin: false
})
app.globalData.sessionId = "";
app.globalData.clientId = ""
@@ -611,5 +642,17 @@
// 澶勭悊閿欒鍝嶅簲
console.error('璇锋眰澶辫触:', error);
});
+ },
+ //鐐瑰嚮鎻愮ず鎸夐挳
+ infoShow() {
+ this.setData({
+ showInfoDialog: true
+ })
+ },
+ //鎻愮ず绐楃‘璁ゆ寜閽�
+ confirmBtnInfoDialog() {
+ this.setData({
+ showInfoDialog: false
+ })
}
})
\ No newline at end of file
--
Gitblit v1.8.0