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

12
mixins/linkFTP.js

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

18
mixins/linkUSB.js

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

12
pages/webPage/index.vue

@ -63,7 +63,7 @@
let cgConfigInfoData = this.cgConfigInfo.data let cgConfigInfoData = this.cgConfigInfo.data
// USB // USB
this.connectUSB('NoOpen', () => { this.connectUSB('NoOpen', () => {
this.webViewToH5({
this.webViewToH5WebPage({
command: 'cgConfigQueryFeedback', command: 'cgConfigQueryFeedback',
commandType: this.cgConfigInfo.commandType, commandType: this.cgConfigInfo.commandType,
data: { data: {
@ -106,7 +106,7 @@
// USB // USB
this.connectUSB('open') this.connectUSB('open')
// //
this.usbStatus()
// this.usbStatus()
// FTp // FTp
this.closeFTPConnect() this.closeFTPConnect()
} }
@ -120,6 +120,7 @@
this.closeUSB() this.closeUSB()
} }
}, },
//
select1() { select1() {
// //
this.buglyModule = uni.requireNativePlugin('ZS-Bugly'); 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> </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