Explorar el Código

扫码配网跳转

htc hace 4 días
padre
commit
d04d615e2d
Se han modificado 4 ficheros con 17 adiciones y 23 borrados
  1. 3 7
      components/bindDevice/index.vue
  2. 3 4
      pagesMy/device.vue
  3. 11 7
      pagesMy/wifiSet.vue
  4. 0 5
      pagesMy/wifiSuccess.vue

+ 3 - 7
components/bindDevice/index.vue

@@ -43,13 +43,9 @@
 								"agentId": ""
 							}).then(res=>{
 								if(res.data.code!==0) return that.$showToast(res.data.msg)
-								that.$showToast('绑定成功')
-								setTimeout(()=>{
-									that.show = false;
-									uni.reLaunch({
-										url:'/pages/home'
-									})
-								},1500)
+								uni.navigateTo({
+									url:'/pagesMy/scanResult'
+								})
 							})
 						}
 					}

+ 3 - 4
pagesMy/device.vue

@@ -76,10 +76,9 @@
 								"agentId": ""
 							}).then(res=>{
 								if(res.data.code!==0) return that.$showToast(res.data.msg)
-								that.$showToast('绑定成功')
-								setTimeout(()=>{
-									this.getList();
-								},1500)
+								uni.navigateTo({
+									url:'/pagesMy/scanResult'
+								})
 							})
 						}
 					}

+ 11 - 7
pagesMy/wifiSet.vue

@@ -99,7 +99,10 @@
 						password:this.wifiPwd
 					},
 					success:res2=>{
-						if(res2.errMsg!=='request:ok') return that.$showToast('设备联网失败')
+						if(res2.errMsg!=='request:ok'){
+							that.show = true;
+							return
+						}
 						wx.request({
 							url:'http://192.168.4.1/reboot',
 							method:'POST',
@@ -107,12 +110,9 @@
 								if(res3.errMsg!=='request:ok') return that.$showToast('设备重启失败')
 								that.flag = true;
 								uni.hideLoading();
-								that.$showToast('联网成功,设备即将重启')
-								setTimeout(()=>{
-									uni.reLaunch({
-										url:'/pages/home'
-									})
-								},1500)
+								uni.navigateTo({
+									url:'/pagesMy/wifiSuccess'
+								})
 							},
 							fail:err3=>{
 								that.flag = true;
@@ -131,6 +131,10 @@
 			},
 			toCode(item){
 				this.wifiSSID = item.ssid;
+			},
+			toTryAgain(){
+				this.show = false;
+				this.toConnectWiFi();
 			}
 		}
 	}

+ 0 - 5
pagesMy/wifiSuccess.vue

@@ -18,11 +18,6 @@
 		},
 		methods:{
 			scanDevice(){
-				uni.navigateTo({
-					url:'/pagesMy/scanResult'
-				})
-				return
-				
 				uni.scanCode({
 					success: (res) => {
 						let result = JSON.parse(res.result);