Browse Source

修改

master
刘灿 8 months ago
parent
commit
49b5d0d779
  1. 24
      mixins/linkBEL.js
  2. 12
      mixins/linkFTP.js
  3. 18
      mixins/linkUSB.js
  4. 12
      pages/webPage/index.vue
  5. 2
      unpackage/dist/build/app-plus/app-service.js
  6. 2
      unpackage/dist/build/app-plus/app-view.js
  7. 8
      unpackage/dist/dev/app-plus/app-service.js

24
mixins/linkBEL.js

@ -53,7 +53,7 @@ export default {
message: '初始化成功'
}
}
that.webViewToH5(data)
that.webViewToH5Bel(data)
that.startBluetoothDevicesDiscovery()
},
fail(res) {
@ -66,7 +66,7 @@ export default {
message: '初始化失败'
}
}
that.webViewToH5(data)
that.webViewToH5Bel(data)
setTimeout(() => {
that.openBluetoothAdapter()
}, 5000)
@ -85,7 +85,7 @@ export default {
message: '设备搜索中'
}
}
that.webViewToH5(data)
that.webViewToH5Bel(data)
uni.startBluetoothDevicesDiscovery({
success(res) {
console.log(res)
@ -123,7 +123,7 @@ export default {
message: '已连接'
}
}
that.webViewToH5(data)
that.webViewToH5Bel(data)
that.belStatus()
},
fail: function(err) {
@ -136,7 +136,7 @@ export default {
message: '连接失败'
}
}
that.webViewToH5(data)
that.webViewToH5Bel(data)
setTimeout(() => {
that.openBluetoothAdapter()
}, 5000)
@ -167,7 +167,7 @@ export default {
message: '连接失败'
}
}
that.webViewToH5(data)
that.webViewToH5Bel(data)
} else {
var data = {
command: 'belConnectFeedback',
@ -177,7 +177,7 @@ export default {
message: '已连接'
}
}
that.webViewToH5(data)
that.webViewToH5Bel(data)
}
},
fail(err) {
@ -212,7 +212,7 @@ export default {
message: '发送内容成功'
}
}
that.webViewToH5(data)
that.webViewToH5Bel(data)
},
fail: (err) => {
console.error('发送内容失败', err)
@ -224,7 +224,7 @@ export default {
message: '发送内容失败'
}
}
that.webViewToH5(data)
that.webViewToH5Bel(data)
}
})
},
@ -252,7 +252,7 @@ export default {
}
clearInterval(that.setInterTimeBEL)
uni.stopBluetoothDevicesDiscovery();
that.webViewToH5(data)
that.webViewToH5Bel(data)
},
fail(err) {
console.log('关闭蓝牙适配器失败: ', err);
@ -260,10 +260,10 @@ export default {
});
},
// uniapp 传参给 vue页面---刘灿测试
webViewToH5(res) {
webViewToH5Bel(res) {
let currentWebview = this.$scope.$getAppWebview();
let wv = currentWebview.children()[0];
console.log('uniapp 传参给 vue页面');
console.log('BEL-uniapp 传参给 vue页面');
wv.evalJS(`getVueMessage(${JSON.stringify(res)})`);
},
}

12
mixins/linkFTP.js

@ -44,7 +44,7 @@ export default {
message: 'FTP已连接'
}
}
this.webViewToH5(data)
this.webViewToH5Ftp(data)
red.data ? this.ftpLoopServerPath() : ''
}) : ''
} else {
@ -56,7 +56,7 @@ export default {
message: 'FTP已掉线'
}
}
this.webViewToH5(data)
this.webViewToH5Ftp(data)
this.connectFtpServer()
}
})
@ -84,7 +84,7 @@ export default {
message: 'FTP已连接'
}
}
this.webViewToH5(data)
this.webViewToH5Ftp(data)
// 获取FTP服务器目录前调用这个方法---处理闪退现象
FTP.ftpChangeWorkingDirectory("/", red => {
@ -100,7 +100,7 @@ export default {
message: 'FTP连接失败'
}
}
this.webViewToH5(data)
this.webViewToH5Ftp(data)
}
})
},
@ -169,7 +169,7 @@ export default {
fileName: dataParams.fileName
}
}
this.webViewToH5(data)
this.webViewToH5Ftp(data)
this.readerFileFlag = false
};
reader.readAsText(file); // 根据文件类型选择读取方式,例如:readAsText
@ -243,7 +243,7 @@ export default {
})
},
// uniapp 传参给 vue页面---刘灿测试
webViewToH5(res) {
webViewToH5Ftp(res) {
let currentWebview = this.$scope.$getAppWebview();
let wv = currentWebview.children()[0];
console.log('uniapp 传参给 vue页面');

18
mixins/linkUSB.js

@ -35,7 +35,7 @@ export default {
message: 'USB已插入'
}
}
this.webViewToH5(data)
this.webViewToH5USB(data)
} else if (res.type == "onUsbDeviceDetached") { //usb断开
console.log('USB已拔出');
var data = {
@ -45,7 +45,7 @@ export default {
message: 'USB已拔出'
}
}
this.webViewToH5(data)
this.webViewToH5USB(data)
} else if (res.type === 'startUpdateValue') {
console.log('正在接受数据中,请稍等...');
} else if (res.type == "onNewData") { //数据回调
@ -66,7 +66,7 @@ export default {
message: JSON.stringify(this.hexCharCodeToStr(hex))
}
}
this.webViewToH5(data)
this.webViewToH5USB(data)
} else if (res.type == "onRunError") {
//点击关闭USB
var data = {
@ -76,7 +76,7 @@ export default {
message: 'USBRunError'
}
}
this.webViewToH5(data)
this.webViewToH5USB(data)
}
});
//UsbSerial.setReceiveTime(type,time) 参数:
@ -129,7 +129,7 @@ export default {
message: 'USB已打开'
}
}
this.webViewToH5(data)
this.webViewToH5USB(data)
}
});
} else {
@ -140,7 +140,7 @@ export default {
message: 'USB未授权'
}
}
this.webViewToH5(data)
this.webViewToH5USB(data)
}
});
},
@ -156,7 +156,7 @@ export default {
message: 'USB已关闭'
}
}
this.webViewToH5(data)
this.webViewToH5USB(data)
// uni.showToast({
// title: "usb已断开"
// })
@ -180,10 +180,10 @@ export default {
return resultStr.join("")
},
// uniapp 传参给 vue页面---刘灿测试
webViewToH5(res) {
webViewToH5USB(res) {
let currentWebview = this.$scope.$getAppWebview();
let wv = currentWebview.children()[0];
console.log('uniapp 传参给 vue页面');
console.log('USB uniapp 传参给 vue页面');
wv.evalJS(`getVueMessage(${JSON.stringify(res)})`);
},
}

12
pages/webPage/index.vue

@ -63,7 +63,7 @@
let cgConfigInfoData = this.cgConfigInfo.data
// USB
this.connectUSB('NoOpen', () => {
this.webViewToH5({
this.webViewToH5WebPage({
command: 'cgConfigQueryFeedback',
commandType: this.cgConfigInfo.commandType,
data: {
@ -106,7 +106,7 @@
// USB
this.connectUSB('open')
//
this.usbStatus()
// this.usbStatus()
// FTp
this.closeFTPConnect()
}
@ -120,6 +120,7 @@
this.closeUSB()
}
},
//
select1() {
//
this.buglyModule = uni.requireNativePlugin('ZS-Bugly');
@ -141,6 +142,13 @@
});
}
},
// uniapp vue---
webViewToH5WebPage(res) {
let currentWebview = this.$scope.$getAppWebview();
let wv = currentWebview.children()[0];
console.log('webPage uniapp 传参给 vue页面');
wv.evalJS(`getVueMessage(${JSON.stringify(res)})`);
},
}
}
</script>

2
unpackage/dist/build/app-plus/app-service.js

File diff suppressed because one or more lines are too long

2
unpackage/dist/build/app-plus/app-view.js

File diff suppressed because one or more lines are too long

8
unpackage/dist/dev/app-plus/app-service.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save