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/wxbind/wxbind.js |   36 ++++++++++++++++++++++++++----------
 1 files changed, 26 insertions(+), 10 deletions(-)

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

--
Gitblit v1.8.0