|
@@ -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,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|