From c768d20f2256ba40ebf6bc1be984c667d6bc7a11 Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期五, 27 十二月 2024 14:52:59 +0800
Subject: [PATCH] 添加分享功能
---
pages/wxbind/wxbind.js | 38 +++++++++++++++++++++++++++-----------
1 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/pages/wxbind/wxbind.js b/pages/wxbind/wxbind.js
index 5a1ecb9..fd28be7 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 () {
@@ -93,7 +95,7 @@
icon: 'success'
});
// 璺宠浆鍒� TabBar 椤甸潰
- wx.navigateTo({
+ wx.redirectTo({
url: '/pages/home/home' // 杩欓噷濉啓浣犳兂瑕佽烦杞殑 TabBar 椤甸潰璺緞
});
},
@@ -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
--
Gitblit v1.8.0