眼科检查信息系统V3.0安卓版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

152 lines
4.9 KiB

<template>
<view class="webViewClass" style="height: 50vh;">
<!-- http://192.168.0.35:8001/wz_qg/ftpCs -->
<!-- "http://192.168.0.35:8001/ykjc/login -->
<web-view ref="webViewRef" @message="messageData" src="http://192.168.0.35:8001/ykjc/login"
:fullscreen="true"></web-view>
</view>
</template>
<script>
import linkUSB from '@/mixins/linkUSB.js'
import linkFTP from '@/mixins/linkFTP.js'
import linkBEL from '@/mixins/linkBEL.js'
export default {
mixins: [linkUSB, linkFTP, linkBEL],
data() {
return {
cgConfigInfo: '',
buglyModule: ''
}
},
mounted() {
this.select1()
console.log('cgConfigInfo', uni.getStorageSync('cgConfigInfo'));
this.cgConfigInfo = uni.getStorageSync('cgConfigInfo') ? JSON.parse(uni.getStorageSync('cgConfigInfo')) :
''
// cgConfigSet // 参数配置--FTP所需参数
if (this.cgConfigInfo.command === 'cgConfigSet') {
this.linkSet()
}
},
methods: {
// uniapp vue页面传参给UNI ---刘灿测试
messageData(e) {
console.log('接收的VUE参数', e.detail.data[0]) // 接收的参数
let vueDetail = e.detail.data[0]
// vue发送过来的:配置项参数
// cgConfigSet // 参数配置--FTP所需参数
if (vueDetail.command === 'cgConfigSet') {
this.cgConfigInfo = vueDetail
uni.setStorageSync('cgConfigInfo', JSON.stringify(vueDetail))
var data = {
command: 'cgConfigSetFeedback',
data: {
state: 0,
message: ''
}
}
this.linkSet()
}
// vue发送过来的:已保存成功 删除一个文件指令 --- FTP模式下触发
if (vueDetail.command === 'deleteOneFile' && this.cgConfigInfo.commandType === 'FTP') {
this.deleteAppDownLoadFile(vueDetail.data)
// 获取FTP服务器目录前调用这个方法---处理闪退现象
this.ftpDeleteServerFiles(vueDetail.data)
}
// vue发送过来的:扫码获取患者成功 删除文件夹下所有文件指令 --- FTP模式下触发
if (vueDetail.command === 'deleteAllFile' && this.cgConfigInfo.commandType === 'FTP') {
this.ftpDeleteServerFilesWithoutDirectory()
}
// vue发送过来的:获取配置信息
if (vueDetail.command === 'cgConfigQuery') {
let cgConfigInfoData = this.cgConfigInfo.data
// 初始化USB
this.connectUSB('NoOpen', () => {
this.webViewToH5({
command: 'cgConfigQueryFeedback',
commandType: this.cgConfigInfo.commandType,
data: {
status: 0,
system: plus.os.name, // 获取系统
comPorts: this.usbDevicesComPortsList, // 串口名称数组
portName: cgConfigInfoData ? cgConfigInfoData.portName : '', // 串口名称
baudRate: cgConfigInfoData ? cgConfigInfoData.baudRate : '', // 波特率
parity: cgConfigInfoData ? cgConfigInfoData.parity : '', // 校验位
dataBits: cgConfigInfoData ? cgConfigInfoData.dataBits : '', // 数据位
stopBits: cgConfigInfoData ? cgConfigInfoData.stopBits : '', // 停止位
inspectionDir: cgConfigInfoData ? cgConfigInfoData.inspectionDir :
'', // 常规检查监视目录
ftpHostName: cgConfigInfoData ? cgConfigInfoData.ftpHostName :
'', // ftp主机名
ftpUserName: cgConfigInfoData ? cgConfigInfoData.ftpUserName :
'', // ftp用户名
ftpPassWord: cgConfigInfoData ? cgConfigInfoData.ftpPassWord : '', // ftp密码
}
})
})
}
// vue发送过来的:蓝牙连接
if (vueDetail.command === 'belConnect') {
console.log('vue发送过来的:蓝牙连接');
this.checkAndOpenGPS()
}
// vue发送过来的:蓝牙数据
if (vueDetail.command === 'sendBelData') {
this.writeBLECharacteristicValue(vueDetail.data.belvalue)
}
if (vueDetail.command === 'belClose') {
console.log('vue发送过来的:蓝牙断开');
this.closeBluetoothAdapter('belClose')
}
},
linkSet() {
// 串口连接
if (this.cgConfigInfo.commandType === 'USB') {
// 连接USB
this.connectUSB('open')
// 循环检测
this.usbStatus()
// 断开FTp
this.closeFTPConnect()
}
// ftp连接
else if (this.cgConfigInfo.commandType === 'FTP') {
// 连接FTP
this.connectFtpServer()
// 循环检测
this.ftpSendNoOp()
// 断开USB
this.closeUSB()
}
},
select1() {
// 推荐这种方法
this.buglyModule = uni.requireNativePlugin('ZS-Bugly');
console.log('buglyModule', this.buglyModule);
if (this.buglyModule) {
// 无需指定版本号
this.buglyModule.initBuglyNoVersion('e6c8c40ced', (res) => {
// uni.showToast({
// icon: 'none',
// title: JSON.stringify(res)
// });
// this.buglyModule.gotoNativePage();
console.log('res', res);
});
} else {
uni.showToast({
icon: 'none',
title: '加载Bugly插件失败'
});
}
},
}
}
</script>
<style>
.webViewClass {
position: fixed;
}
</style>