Ver código fonte

feat: 腾讯服务器环境切换

Damon 9 meses atrás
pai
commit
e397d5ed21
1 arquivos alterados com 24 adições e 18 exclusões
  1. 24 18
      src/pages/public/uuidt.vue

+ 24 - 18
src/pages/public/uuidt.vue

@@ -45,6 +45,7 @@ export default {
       }).then((res) => {
         if (res.code === 0) {
           this.openId = res.data.openid;
+          this.deviceBindInfo(true);
         }
       });
     },
@@ -60,7 +61,10 @@ export default {
         });
         return;
       }
+      this.deviceBindInfo(false);
+    },
 
+    deviceBindInfo(isInit) {
       deviceBindInfo({
         state: this.state,
         openId: this.openId,
@@ -73,24 +77,26 @@ export default {
               url: `/pages/public/remote?state=${this.state}&openId=${this.openId}`,
             });
           } else {
-            deviceBind({
-              deviceMac: this.inputValue,
-              state: this.state,
-              openId: this.openId,
-            }).then((res) => {
-              if (res.code === 0) {
-                uni.redirectTo({
-                  url: `/pages/public/remote?state=${this.state}&openId=${this.openId}`,
-                });
-              } else {
-                uni.showToast({
-                  title: res.message,
-                  icon: "none",
-                  mask: true,
-                  duration: 2000,
-                });
-              }
-            });
+            if (!isInit) {
+              deviceBind({
+                deviceMac: this.inputValue,
+                state: this.state,
+                openId: this.openId,
+              }).then((res) => {
+                if (res.code === 0) {
+                  uni.redirectTo({
+                    url: `/pages/public/remote?state=${this.state}&openId=${this.openId}`,
+                  });
+                } else {
+                  uni.showToast({
+                    title: res.message,
+                    icon: "none",
+                    mask: true,
+                    duration: 2000,
+                  });
+                }
+              });
+            }
           }
         }
       });