htc 2 روز پیش
والد
کامیت
4573679870
6فایلهای تغییر یافته به همراه46 افزوده شده و 13 حذف شده
  1. 2 2
      components/bindDevice/index.vue
  2. 2 2
      pagesMy/device.vue
  3. 5 2
      pagesMy/scanResult.vue
  4. 33 3
      pagesMy/wifi.vue
  5. 2 2
      pagesMy/wifiSuccess.vue
  6. 2 2
      pagesRole/addRole.vue

+ 2 - 2
components/bindDevice/index.vue

@@ -36,7 +36,7 @@
 					success: (res) => {
 						let result = JSON.parse(res.result);
 						if(res.errMsg==='scanCode:ok'){
-							that.$api.post('/device/bindAdd',{
+							that.$api.post('/device/bind',{
 								...result,
 								"type": "",
 								"userId": 0,
@@ -44,7 +44,7 @@
 							}).then(res=>{
 								if(res.data.code!==0) return that.$showToast(res.data.msg)
 								uni.navigateTo({
-									url:'/pagesMy/scanResult'
+									url:'/pagesMy/scanResult?deviceId='+res.data.data
 								})
 							})
 						}

+ 2 - 2
pagesMy/device.vue

@@ -69,7 +69,7 @@
 					success: (res) => {
 						let result = JSON.parse(res.result);
 						if(res.errMsg==='scanCode:ok'){
-							that.$api.post('/device/bindAdd',{
+							that.$api.post('/device/bind',{
 								...result,
 								"type": "",
 								"userId": 0,
@@ -77,7 +77,7 @@
 							}).then(res=>{
 								if(res.data.code!==0) return that.$showToast(res.data.msg)
 								uni.navigateTo({
-									url:'/pagesMy/scanResult'
+									url:'/pagesMy/scanResult?deviceId='+res.data.data
 								})
 							})
 						}

+ 5 - 2
pagesMy/scanResult.vue

@@ -13,13 +13,16 @@
 	export default {
 		data(){
 			return {
-				
+				deviceId:''
 			}
 		},
+		onLoad(option) {
+			this.deviceId = option.deviceId;
+		},
 		methods:{
 			addRole(){
 				uni.navigateTo({
-					url:'/pagesRole/addRole?type=1'
+					url:'/pagesRole/addRole?type=1&deviceId='+this.deviceId
 				})
 			},
 			goBack(){

+ 33 - 3
pagesMy/wifi.vue

@@ -53,6 +53,17 @@
 			this.getCurrentWifi();
 			this.dealWifi(true)
 		},
+		onShow() {
+			let sysInfo = wx.getSystemInfoSync();
+			console.log(sysInfo,'sysInfo');
+			let platform = sysInfo.platform;
+			console.log(platform,'platform');
+			if(platform == "ios"){
+				wx.onGetWifiList(res => {
+					console.log(res,'res:onShow');
+				})
+			}
+		},
 		methods:{
 			getCurrentWifi(){
 				let that = this;
@@ -79,10 +90,14 @@
 					})
 					wx.startWifi({
 						success (res) {
+							console.log(res,'res');
 							wx.getWifiList({
 								success(res2) {
+									console.log(res2,'res2');
 									wx.onGetWifiList(res3 => {
 										let temp = [];
+										console.log(res3,'res3');
+										console.log(res3.wifiList,'res3.wifiList');
 										res3.wifiList.forEach(w=>{
 											if(w.SSID){
 												let exit = temp.find(t=>t.SSID===w.SSID);
@@ -95,8 +110,14 @@
 											uni.hideLoading();
 										})
 									})
+								},
+								fail: (err2) => {
+									console.log(err2,'err2');
 								}
 							})
+						},
+						fail: (err) => {
+							console.log(err,'err');
 						}
 					})
 				}else{
@@ -106,17 +127,26 @@
 			toSet(item){
 				let that = this;
 				if(item.SSID.indexOf('Xiaozhi-')>-1){
-					uni.connectWifi({
+					uni.showLoading({
+						title:'热点连接中'
+					})
+					wx.connectWifi({
 						SSID: item.SSID,
 						password: '',
 						success: (resu) => {
-							if(resu.errCode===0){
+							console.log(resu,'resu');
+							uni.hideLoading();
+							// if(resu.errCode===0||resu.errMsg==='connectWifi:ok'){
 								setTimeout(()=>{
 									uni.navigateTo({
 										url:'/pagesMy/wifiSet'
 									})
 								},2000)
-							}
+							// }
+						},
+						fail: (err) => {
+							uni.hideLoading();
+							console.log(err,'err:connectWifi');
 						}
 					});
 				}else this.$showToast('请选择Xiaozhi开头的热点')

+ 2 - 2
pagesMy/wifiSuccess.vue

@@ -23,7 +23,7 @@
 					success: (res) => {
 						let result = JSON.parse(res.result);
 						if(res.errMsg==='scanCode:ok'){
-							that.$api.post('/device/bindAdd',{
+							that.$api.post('/device/bind',{
 								...result,
 								"type": "",
 								"userId": 0,
@@ -31,7 +31,7 @@
 							}).then(res=>{
 								if(res.data.code!==0) return that.$showToast(res.data.msg)
 								uni.navigateTo({
-									url:'/pagesMy/scanResult'
+									url:'/pagesMy/scanResult?deviceId='+res.data.data
 								})
 							})
 						}

+ 2 - 2
pagesRole/addRole.vue

@@ -90,10 +90,10 @@
 				if(option.type==1) this.backUrl = '/pages/home'
 				else if(option.type==2) this.backUrl = '/pages/role'
 			}
+			this.deviceId = option.deviceId;
 			if(option.agentId){
 				this.title = '编辑角色';
 				this.agentId = option.agentId;
-				this.deviceId = option.deviceId;
 				this.getDetail();
 			} 
 			this.getModelVoiceList();
@@ -190,7 +190,7 @@
 				if(this.agentDto.voiceText==='请选择音色') return this.$showToast('请选择音色')
 				
 				let dto = JSON.parse(JSON.stringify(this.agentDto));
-				if(this.agentId) dto.deviceId = this.deviceId;
+				if(this.deviceId) dto.deviceId = this.deviceId;
 				//默认固定值(暂时)
 				dto.asrModelId = 'ASR_FunASR';
 				dto.vadModelId = 'VAD_SileroVAD';