@ -0,0 +1,18 @@ |
|||
{ |
|||
"version" : "1.0", |
|||
"configurations" : [ |
|||
{ |
|||
"playground" : "custom", |
|||
"type" : "uni-app:app-android" |
|||
}, |
|||
{ |
|||
"app-plus" : { |
|||
"launchtype" : "local" |
|||
}, |
|||
"mp-weixin" : { |
|||
"launchtype" : "local" |
|||
}, |
|||
"type" : "uniCloud" |
|||
} |
|||
] |
|||
} |
@ -0,0 +1,17 @@ |
|||
<script> |
|||
export default { |
|||
onLaunch: function() { |
|||
console.log('App Launch') |
|||
}, |
|||
onShow: function() { |
|||
console.log('App Show') |
|||
}, |
|||
onHide: function() { |
|||
console.log('App Hide') |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
/*每个页面公共css */ |
|||
</style> |
@ -0,0 +1,20 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8" /> |
|||
<script> |
|||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || |
|||
CSS.supports('top: constant(a)')) |
|||
document.write( |
|||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + |
|||
(coverSupport ? ', viewport-fit=cover' : '') + '" />') |
|||
</script> |
|||
<title></title> |
|||
<!--preload-links--> |
|||
<!--app-context--> |
|||
</head> |
|||
<body> |
|||
<div id="app"><!--app-html--></div> |
|||
<script type="module" src="/main.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,22 @@ |
|||
import App from './App' |
|||
|
|||
// #ifndef VUE3
|
|||
import Vue from 'vue' |
|||
import './uni.promisify.adaptor' |
|||
Vue.config.productionTip = false |
|||
App.mpType = 'app' |
|||
const app = new Vue({ |
|||
...App |
|||
}) |
|||
app.$mount() |
|||
// #endif
|
|||
|
|||
// #ifdef VUE3
|
|||
import { createSSRApp } from 'vue' |
|||
export function createApp() { |
|||
const app = createSSRApp(App) |
|||
return { |
|||
app |
|||
} |
|||
} |
|||
// #endif
|
@ -0,0 +1,133 @@ |
|||
{ |
|||
"name" : "HUIMU眼科检查信息系统", |
|||
"appid" : "__UNI__030605A", |
|||
"description" : "", |
|||
"versionName" : "1.0.0", |
|||
"versionCode" : "100", |
|||
"transformPx" : false, |
|||
/* 5+App特有相关 */ |
|||
"app-plus" : { |
|||
"usingComponents" : true, |
|||
"nvueStyleCompiler" : "uni-app", |
|||
"compilerVersion" : 3, |
|||
"splashscreen" : { |
|||
"alwaysShowBeforeRender" : true, |
|||
"waiting" : true, |
|||
"autoclose" : true, |
|||
"delay" : 0 |
|||
}, |
|||
/* 模块配置 */ |
|||
"modules" : { |
|||
"bluetooth" : {}, |
|||
"Bluetooth" : {} |
|||
}, |
|||
/* 应用发布信息 */ |
|||
"distribute" : { |
|||
/* android打包配置 */ |
|||
"android" : { |
|||
"permissions" : [ |
|||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", |
|||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", |
|||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", |
|||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", |
|||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", |
|||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", |
|||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", |
|||
"<uses-permission android:name=\"android.permission.CAMERA\"/>", |
|||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", |
|||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", |
|||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", |
|||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", |
|||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", |
|||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>", |
|||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", |
|||
"<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>", // 读取外部存储 |
|||
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>", // 写入外部存储 |
|||
"<uses-permission android:name=\"android.permission.BLUETOOTH\"/>", |
|||
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>", |
|||
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", |
|||
"<uses-permission android:name=\"android.permission.BLUETOOTH_SCAN\"/>", |
|||
"<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\"/>", |
|||
"<uses-permission android:name=\"android.permission.ACCESS_BACKGROUND_LOCATION\"/>", |
|||
"<uses-permission android:name=\"android.permission.USB_PERMISSION\"/>", |
|||
"<uses-permission android:name=\"android.permission.MANAGE_USB\"/>" |
|||
] |
|||
}, |
|||
/* ios打包配置 */ |
|||
"ios" : { |
|||
"dSYMs" : false |
|||
}, |
|||
/* SDK配置 */ |
|||
"sdkConfigs" : { |
|||
"ad" : {} |
|||
} |
|||
}, |
|||
"nativePlugins" : { |
|||
"zhimiFTP" : { |
|||
"__plugin_info__" : { |
|||
"name" : "zhimiFTP", |
|||
"description" : "FTP插件", |
|||
"platforms" : "Android", |
|||
"url" : "", |
|||
"android_package_name" : "", |
|||
"ios_bundle_id" : "", |
|||
"isCloud" : false, |
|||
"bought" : -1, |
|||
"pid" : "", |
|||
"parameters" : {} |
|||
} |
|||
}, |
|||
"Zhimi-UsbSerial" : { |
|||
"__plugin_info__" : { |
|||
"name" : "Usb通讯插件", |
|||
"description" : "Usb通讯插件", |
|||
"platforms" : "Android", |
|||
"url" : "", |
|||
"android_package_name" : "", |
|||
"ios_bundle_id" : "", |
|||
"isCloud" : false, |
|||
"bought" : -1, |
|||
"pid" : "", |
|||
"parameters" : {} |
|||
} |
|||
}, |
|||
"ZS-Bugly" : { |
|||
"__plugin_info__" : { |
|||
"name" : "ZS-Bugly", |
|||
"description" : "捕获系统错误", |
|||
"platforms" : "Android", |
|||
"url" : "", |
|||
"android_package_name" : "", |
|||
"ios_bundle_id" : "", |
|||
"isCloud" : false, |
|||
"bought" : -1, |
|||
"pid" : "", |
|||
"parameters" : {} |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
/* 快应用特有相关 */ |
|||
"quickapp" : {}, |
|||
/* 小程序特有相关 */ |
|||
"mp-weixin" : { |
|||
"appid" : "", |
|||
"setting" : { |
|||
"urlCheck" : false |
|||
}, |
|||
"usingComponents" : true |
|||
}, |
|||
"mp-alipay" : { |
|||
"usingComponents" : true |
|||
}, |
|||
"mp-baidu" : { |
|||
"usingComponents" : true |
|||
}, |
|||
"mp-toutiao" : { |
|||
"usingComponents" : true |
|||
}, |
|||
"uniStatistics" : { |
|||
"enable" : false |
|||
}, |
|||
"vueVersion" : "2" |
|||
} |
@ -0,0 +1,270 @@ |
|||
export default { |
|||
data() { |
|||
return { |
|||
onBluetoothDeviceFoundcustom: '', |
|||
deviceId: '', |
|||
stringToSend: '$D50504010300#', // D50604010000
|
|||
setInterTimeBEL: null |
|||
} |
|||
}, |
|||
onLoad() {}, |
|||
methods: { |
|||
// 打开GPS定位!!!打开GPS定位新买的荣耀才能触发uni.onBluetoothDeviceFound监听!!!!
|
|||
checkAndOpenGPS() { |
|||
var Context = plus.android.importClass("android.content.Context"); |
|||
var LocationManager = plus.android.importClass("android.location.LocationManager"); |
|||
var main = plus.android.runtimeMainActivity(); |
|||
|
|||
// 获取系统的 LocationManager 服务
|
|||
var locationManager = main.getSystemService(Context.LOCATION_SERVICE); |
|||
|
|||
// 检查 GPS 是否开启
|
|||
var isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); |
|||
var isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); // 检查网络定位服务
|
|||
// 位置服务已开启,不进行任何操作
|
|||
if (isGPSEnabled || isNetworkEnabled) { |
|||
console.log("位置服务已开启"); |
|||
this.openBluetoothAdapter() |
|||
} else { |
|||
console.log("位置服务未开启,跳转到设置页面"); |
|||
// 位置服务未开启,引导用户打开 GPS 设置页面
|
|||
var Intent = plus.android.importClass("android.content.Intent"); |
|||
var Settings = plus.android.importClass("android.provider.Settings"); |
|||
var intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); |
|||
main.startActivity(intent); |
|||
|
|||
// 提示用户手动开启 GPS
|
|||
plus.nativeUI.alert("请手动开启GPS!"); |
|||
} |
|||
}, |
|||
// 初始化蓝牙
|
|||
openBluetoothAdapter() { |
|||
let that = this |
|||
that.closeBluetoothAdapter() |
|||
console.log('初始化蓝牙'); |
|||
uni.openBluetoothAdapter({ |
|||
success(res) { |
|||
console.log(res) |
|||
var data = { |
|||
command: 'belConnectFeedback', |
|||
commandType: 'BEL', |
|||
data: { |
|||
state: 0, |
|||
message: '初始化成功' |
|||
} |
|||
} |
|||
that.webViewToH5(data) |
|||
that.startBluetoothDevicesDiscovery() |
|||
}, |
|||
fail(res) { |
|||
console.log('初始化蓝牙失败', res) |
|||
var data = { |
|||
command: 'belConnectFeedback', |
|||
commandType: 'BEL', |
|||
data: { |
|||
state: 0, |
|||
message: '初始化失败' |
|||
} |
|||
} |
|||
that.webViewToH5(data) |
|||
setTimeout(() => { |
|||
that.openBluetoothAdapter() |
|||
}, 5000) |
|||
} |
|||
}) |
|||
}, |
|||
// 开始搜索蓝牙设备
|
|||
startBluetoothDevicesDiscovery() { |
|||
let that = this |
|||
console.log('开始搜索蓝牙设备'); |
|||
var data = { |
|||
command: 'belConnectFeedback', |
|||
commandType: 'BEL', |
|||
data: { |
|||
state: 0, |
|||
message: '设备搜索中' |
|||
} |
|||
} |
|||
that.webViewToH5(data) |
|||
uni.startBluetoothDevicesDiscovery({ |
|||
success(res) { |
|||
console.log(res) |
|||
that.onBluetoothDeviceFound() |
|||
} |
|||
}) |
|||
}, |
|||
// 监听设备发现
|
|||
onBluetoothDeviceFound() { |
|||
let that = this |
|||
this.onBluetoothDeviceFoundcustom = uni.onBluetoothDeviceFound((res) => { |
|||
console.log('监听设备发现', res.devices[0]); |
|||
if (res.devices[0].name === 'ACP60205') { |
|||
console.log('hello,厉害,找到啦,啦啦啦~~~'); |
|||
// 连接成功后,停止设备搜索
|
|||
uni.stopBluetoothDevicesDiscovery(); |
|||
that.deviceId = res.devices[0].deviceId; // 获取设备ID
|
|||
that.createBLEConnection() |
|||
} |
|||
}) |
|||
}, |
|||
// 连接到设备
|
|||
createBLEConnection() { |
|||
let that = this |
|||
console.log('连接到设备that.deviceId', that.deviceId); |
|||
uni.createBLEConnection({ |
|||
deviceId: that.deviceId, |
|||
success: function() { |
|||
console.log('连接成功') |
|||
var data = { |
|||
command: 'belConnectFeedback', |
|||
commandType: 'BEL', |
|||
data: { |
|||
state: 0, |
|||
message: '已连接' |
|||
} |
|||
} |
|||
that.webViewToH5(data) |
|||
that.belStatus() |
|||
}, |
|||
fail: function(err) { |
|||
console.error('连接失败', err) |
|||
var data = { |
|||
command: 'belConnectFeedback', |
|||
commandType: 'BEL', |
|||
data: { |
|||
state: 0, |
|||
message: '连接失败' |
|||
} |
|||
} |
|||
that.webViewToH5(data) |
|||
setTimeout(() => { |
|||
that.openBluetoothAdapter() |
|||
}, 5000) |
|||
} |
|||
}) |
|||
}, |
|||
// 检测BEL是否连接状态
|
|||
belStatus() { |
|||
clearInterval(this.setInterTimeBEL) |
|||
this.setInterTimeBEL = setInterval(() => { |
|||
this.getConnectedBluetoothDevices() |
|||
}, 5000) |
|||
}, |
|||
// 检查设备连接状态
|
|||
getConnectedBluetoothDevices() { |
|||
let that = this |
|||
uni.getConnectedBluetoothDevices({ |
|||
success(res) { |
|||
console.log('当前已连接的设备:', res.devices); |
|||
if (res.devices.length <= 0) { |
|||
that.openBluetoothAdapter() |
|||
clearInterval(that.setInterTimeBEL) |
|||
var data = { |
|||
command: 'belConnectFeedback', |
|||
commandType: 'BEL', |
|||
data: { |
|||
state: 0, |
|||
message: '连接失败' |
|||
} |
|||
} |
|||
that.webViewToH5(data) |
|||
} else { |
|||
var data = { |
|||
command: 'belConnectFeedback', |
|||
commandType: 'BEL', |
|||
data: { |
|||
state: 0, |
|||
message: '已连接' |
|||
} |
|||
} |
|||
that.webViewToH5(data) |
|||
} |
|||
}, |
|||
fail(err) { |
|||
console.log('获取已连接设备失败:', err) |
|||
that.openBluetoothAdapter() |
|||
} |
|||
}) |
|||
}, |
|||
// 发送蓝牙内容
|
|||
writeBLECharacteristicValue(belvalue) { |
|||
console.log('发送蓝牙内容',belvalue); |
|||
let that = this |
|||
// 要发送的字符串
|
|||
// $D50504030231#
|
|||
// D5---5米距离
|
|||
// 06---
|
|||
const dataToSend = that.stringToByteArray(belvalue) |
|||
console.log(' dataToSend.buffer', dataToSend.buffer) |
|||
uni.writeBLECharacteristicValue({ |
|||
deviceId: that.deviceId, // 设备ID
|
|||
serviceId: '0000ffe0-0000-1000-8000-00805f9b34fb', // 服务ID
|
|||
characteristicId: '0000ffe1-0000-1000-8000-00805f9b34fb', // 特征ID
|
|||
value: dataToSend.buffer, |
|||
writeType: 'write', |
|||
success: () => { |
|||
console.log('发送内容成功') |
|||
var data = { |
|||
command: 'sendBelDataFeedback', |
|||
commandType: 'BEL', |
|||
data: { |
|||
state: 0, |
|||
message: '发送内容成功' |
|||
} |
|||
} |
|||
that.webViewToH5(data) |
|||
}, |
|||
fail: (err) => { |
|||
console.error('发送内容失败', err) |
|||
var data = { |
|||
command: 'sendBelDataFeedback', |
|||
commandType: 'BEL', |
|||
data: { |
|||
state: 0, |
|||
message: '发送内容失败' |
|||
} |
|||
} |
|||
that.webViewToH5(data) |
|||
} |
|||
}) |
|||
}, |
|||
// 处理发送的内容
|
|||
stringToByteArray(str) { |
|||
const byteArray = new Uint8Array(str.length); |
|||
for (let i = 0; i < str.length; i++) { |
|||
byteArray[i] = str.charCodeAt(i) |
|||
} |
|||
return byteArray; |
|||
}, |
|||
// 断开蓝牙
|
|||
closeBluetoothAdapter(title) { |
|||
let that = this |
|||
uni.closeBluetoothAdapter({ |
|||
success() { |
|||
console.log('蓝牙适配器关闭成功'); |
|||
var data = { |
|||
command: title === 'belClose' ? 'belCloseFeedback' : 'belConnectFeedback', |
|||
commandType: 'BEL', |
|||
data: { |
|||
state: 0, |
|||
message: title === 'belClose' ? '已断开' : '未连接' |
|||
} |
|||
} |
|||
clearInterval(that.setInterTimeBEL) |
|||
uni.stopBluetoothDevicesDiscovery(); |
|||
that.webViewToH5(data) |
|||
}, |
|||
fail(err) { |
|||
console.log('关闭蓝牙适配器失败: ', err); |
|||
} |
|||
}); |
|||
}, |
|||
// uniapp 传参给 vue页面---刘灿测试
|
|||
webViewToH5(res) { |
|||
let currentWebview = this.$scope.$getAppWebview(); |
|||
let wv = currentWebview.children()[0]; |
|||
console.log('uniapp 传参给 vue页面'); |
|||
wv.evalJS(`getVueMessage(${JSON.stringify(res)})`); |
|||
}, |
|||
} |
|||
} |
@ -0,0 +1,253 @@ |
|||
var FTP = uni.requireNativePlugin('Zhimi-FTP-Module'); |
|||
export default { |
|||
data() { |
|||
return { |
|||
remoteUrl: '', |
|||
androidFileDocPath: plus.io.convertLocalFileSystemURL('_doc'), |
|||
ftpLogicDeceteName: '/sda1/logicDelete', |
|||
count: 0, |
|||
isConnect: false, |
|||
setInterTimeFTP: null, |
|||
readerFileFlag:false |
|||
} |
|||
}, |
|||
onShow() { |
|||
// console.log('showshowshow');
|
|||
}, |
|||
onHide() { |
|||
// console.log('hidehidehide');
|
|||
}, |
|||
onLoad() {}, |
|||
destroyed() { |
|||
console.log('销毁页面'); |
|||
clearInterval(this.setInterTimeFTP) |
|||
}, |
|||
methods: { |
|||
// 流程:
|
|||
// ftp连接 ---> 获取ftp目录文件夹名和文件名 ---> 下载文件夹中的文件到安卓机 ---> 临时地址转url传输给H5展示
|
|||
// ---> H5页面关联确认完,在安卓机中找到关联确认后的文件上传到FTP的另外一个文件夹(新建文件夹) ---> 删除安卓机临时文件 ---> 删除FTP之前文件夹中关联确认后的文件
|
|||
|
|||
// 测试是否掉线的方法
|
|||
ftpSendNoOp() { |
|||
clearInterval(this.setInterTimeFTP) |
|||
this.setInterTimeFTP = setInterval(() => { |
|||
FTP.ftpSendNoOp(res => { |
|||
if (res.data === true) { |
|||
console.log('测试是否掉线回调-未掉线',res); |
|||
console.log('readerFileFlag',this.readerFileFlag); |
|||
!this.readerFileFlag ? FTP.ftpChangeWorkingDirectory("/", red => { |
|||
console.log('下载前调用这个方法', red) |
|||
var data = { |
|||
command: 'ftpStatusChanged', |
|||
data: { |
|||
state: 0, |
|||
message: 'FTP已连接' |
|||
} |
|||
} |
|||
this.webViewToH5(data) |
|||
red.data ? this.ftpLoopServerPath() : '' |
|||
}) : '' |
|||
} else { |
|||
console.log('测试是否掉线回调-已掉线', res); |
|||
var data = { |
|||
command: 'ftpStatusChanged', |
|||
data: { |
|||
state: 0, |
|||
message: 'FTP已掉线' |
|||
} |
|||
} |
|||
this.webViewToH5(data) |
|||
this.connectFtpServer() |
|||
} |
|||
}) |
|||
}, 5000) |
|||
}, |
|||
// FTP连接
|
|||
connectFtpServer() { |
|||
//(“服务地址”, 端口, “用户名”,”密码“, 回调 )
|
|||
//回调
|
|||
//成功 {type : "connect", data : {data : "相应状态码:200 连接是否成功:true 连接是否有效:true}}
|
|||
//失败 {type : "connect", data : {"error" : "失败原因"}}
|
|||
// "192.168.50.1", 21, "hmgc", "hmgc"
|
|||
// "192.168.50.131", 21, "hmftp", "hmftp"
|
|||
let cgConfigInfoData = this.cgConfigInfo.data |
|||
console.log('cgConfigInfoData',cgConfigInfoData); |
|||
// '192.168.50.1', 21, 'hmgc', 'hmgc', "UTF-8"
|
|||
// cgConfigInfoData.ftpHostName, 21, cgConfigInfoData.ftpUserName, cgConfigInfoData.ftpPassWord,
|
|||
FTP.connectFtpServer( '192.168.50.1', 21, 'hmgc', 'hmgc', "UTF-8", res => { |
|||
console.log('FTP连接', res) |
|||
if (res.type === 'connect' && res.data.connect === true) { |
|||
var data = { |
|||
command: 'ftpStatusChanged', |
|||
data: { |
|||
state: 0, |
|||
message: 'FTP已连接' |
|||
} |
|||
} |
|||
this.webViewToH5(data) |
|||
|
|||
// 获取FTP服务器目录前调用这个方法---处理闪退现象
|
|||
FTP.ftpChangeWorkingDirectory("/", red => { |
|||
console.log('下载前调用这个方法', red) |
|||
red.data ? this.ftpLoopServerPath() : '' |
|||
}) |
|||
} else if (res.type === 'connect' && res.data.connect === false) { |
|||
// this.isConnect = false
|
|||
var data = { |
|||
command: 'ftpStatusChanged', |
|||
data: { |
|||
state: 0, |
|||
message: 'FTP连接失败' |
|||
} |
|||
} |
|||
this.webViewToH5(data) |
|||
} |
|||
}) |
|||
}, |
|||
// 获取FTP服务器目录
|
|||
ftpLoopServerPath() { |
|||
let name = this.cgConfigInfo.data.inspectionDir |
|||
console.log('name',name); |
|||
|
|||
// 阀值--循环时控制暂时不走获取FTP服务器目录
|
|||
this.readerFileFlag = true |
|||
// 1是文件夹 0是文件
|
|||
//("获取服务器目录下文件,空白为根目录", 回调)
|
|||
//回调
|
|||
//成功 {type : getFileInfo, data : [{name : "地址", size : 文件大小单位字节, time : “修改时间”}]}
|
|||
//失败 {type : "error", data : "失败原因"}
|
|||
FTP.ftpLoopServerPath(name, res => { |
|||
console.log('获取FTP服务器目录res', res); |
|||
if(res.type === 'getFileInfo' && res.data.length > 0) { |
|||
let newData = res.data.sort((a, b) => new Date(b.time) - new Date(a.time)) |
|||
console.log('newData时间排序',newData) |
|||
// 下载前调用这个方法---处理闪退现象
|
|||
FTP.ftpChangeWorkingDirectory("/", red => { |
|||
console.log('下载前调用这个方法', red) |
|||
red.data ? this.ftpDownloadSingleFile(newData[0]) : '' |
|||
}) |
|||
} else { |
|||
this.readerFileFlag = false |
|||
} |
|||
}) |
|||
}, |
|||
// FTP-单个文件下载至安卓机
|
|||
ftpDownloadSingleFile(data) { |
|||
//("要下载到本地文件夹的绝对路径", "要下载的服务器上文件的绝对路径", 回调)
|
|||
//回调
|
|||
//{type : download, data : {status : true/false, name : "下载的文件名", errpr : "失败原因"}}
|
|||
// var inputFile = plus.io.convertLocalFileSystemURL('/static')
|
|||
console.log('androidFileDocPath', this.androidFileDocPath) |
|||
// '/sda1/deviceNewFile/20240918/20240918logo.png'
|
|||
FTP.ftpDownloadSingleFile(this.androidFileDocPath, data.name, res => { |
|||
console.log('单个文件下载至安卓机--成功', res) |
|||
if (res.type === 'download' && res.data.status) { |
|||
this.readerFile(data) |
|||
} else { |
|||
this.readerFileFlag = false |
|||
} |
|||
}) |
|||
}, |
|||
// 获取安卓机临时文件中的内容
|
|||
readerFile(dataParams) { |
|||
let tempFilePath = this.androidFileDocPath + dataParams.fileName |
|||
console.log('获取安卓机临时文件中的内容', tempFilePath); |
|||
// console.log('获取安卓机临时文件中的内容1',plus.io.resolveLocalFileSystemURL);
|
|||
plus.io.resolveLocalFileSystemURL(tempFilePath, (entry) => { |
|||
console.log("文件条目:", entry); |
|||
entry.file((file) => { |
|||
console.log('file', file); |
|||
var reader = new plus.io.FileReader() |
|||
reader.onloadend = (res) => { |
|||
console.log("文件内容:", res.target.result); // 输出文件内容
|
|||
var data = { |
|||
command: 'examineData', |
|||
commandType:'FTP', |
|||
data: { |
|||
state: 0, |
|||
message: JSON.stringify(res.target.result), |
|||
fileName: dataParams.fileName |
|||
} |
|||
} |
|||
this.webViewToH5(data) |
|||
this.readerFileFlag = false |
|||
}; |
|||
reader.readAsText(file); // 根据文件类型选择读取方式,例如:readAsText
|
|||
}, (error) => { |
|||
console.error("读取文件失败:", error); |
|||
this.readerFileFlag = false |
|||
}); |
|||
}, (error) => { |
|||
console.error("获取文件路径失败:", error); |
|||
this.readerFileFlag = false |
|||
}) |
|||
}, |
|||
// 删除安卓机下载下来的文件
|
|||
deleteAppDownLoadFile(data) { |
|||
console.log(' 删除安卓机下载下来的文件--data', data); |
|||
// 获取安卓机路径地址
|
|||
var deleteAppFileName = this.androidFileDocPath + data.fileName |
|||
plus.io.resolveLocalFileSystemURL(deleteAppFileName, (entry) => { |
|||
// 调用 remove 方法删除文件
|
|||
entry.remove(() => { |
|||
console.log('文件删除成功'); |
|||
}, (error) => { |
|||
console.log('文件删除失败: ' + error.message); |
|||
}); |
|||
}, (error) => { |
|||
console.log('无法解析文件路径: ' + error.message); |
|||
}) |
|||
}, |
|||
// 删除FTP服务器文件
|
|||
ftpDeleteServerFiles(data) { |
|||
//("要删除的文件夹或文件地址", 回调)
|
|||
//回调
|
|||
//{type : delete, data : {msg : "删除文件/删除文件夹(ps:先删除文件夹里面的文件再删文件夹)", data : "文件名", status : true/false, error : "失败原因"}}
|
|||
let name = this.cgConfigInfo.data.inspectionDir + '/' + data.fileName |
|||
console.log('删除FTP服务器文件',name); |
|||
data && data.fileName ? FTP.ftpDeleteServerFiles(name, res => { |
|||
console.log('FTP服务器文件删除成功', name,res) |
|||
// setTimeout(() => {
|
|||
// this.ftpUploadFile(data)
|
|||
// }, 3000)
|
|||
}) : '' |
|||
}, |
|||
// 删除FTPS文件夹下面文件保留文件夹
|
|||
ftpDeleteServerFilesWithoutDirectory() { |
|||
//同上,不会删除指定文件夹
|
|||
FTP.ftpDeleteServerFilesWithoutDirectory(this.cgConfigInfo.data.inspectionDir, res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTP-上传文件至FTP
|
|||
// ftpUploadFile(data) {
|
|||
// var inputFile = plus.io.convertLocalFileSystemURL('/static/logo.png')
|
|||
// console.log('inputFile文件', inputFile);
|
|||
// FTP.ftpUploadFile(inputFile, '/sda1/deviceNewFile', res => {
|
|||
// console.log('文件-上传成功', res)
|
|||
// if (res.data.msg === '上传完成') {
|
|||
// console.log('00000000000000000000');
|
|||
// this.ftpLoopServerPath()
|
|||
// console.log(this.count++);
|
|||
// }
|
|||
// })
|
|||
// },
|
|||
// FTP断开连接
|
|||
closeFTPConnect() { |
|||
console.log('FTP断开连接!!!!'); |
|||
//失败有回调,成功没有回调
|
|||
FTP.closeFTPConnect(res => { |
|||
console.log('FTP断开连接',res) |
|||
clearInterval(this.setInterTimeFTP) |
|||
// this.isConnect = false
|
|||
}) |
|||
}, |
|||
// uniapp 传参给 vue页面---刘灿测试
|
|||
webViewToH5(res) { |
|||
let currentWebview = this.$scope.$getAppWebview(); |
|||
let wv = currentWebview.children()[0]; |
|||
console.log('uniapp 传参给 vue页面'); |
|||
wv.evalJS(`getVueMessage(${JSON.stringify(res)})`); |
|||
}, |
|||
} |
|||
} |
@ -0,0 +1,190 @@ |
|||
var UsbSerial = uni.requireNativePlugin('Zhimi-UsbSerial'); |
|||
export default { |
|||
data() { |
|||
return { |
|||
setInterTimeUSB: null, |
|||
vendorId: '', |
|||
port: '', |
|||
usbDevicesComPortsList: [] // 串口名称数组
|
|||
} |
|||
}, |
|||
destroyed() { |
|||
console.log('销毁页面'); |
|||
clearInterval(this.setInterTimeUSB) |
|||
}, |
|||
methods: { |
|||
// 检测USB是否连接状态
|
|||
usbStatus() { |
|||
clearInterval(this.setInterTimeUSB) |
|||
this.setInterTimeUSB = setInterval(() => { |
|||
this.connectUSB('open') |
|||
}, 5000) |
|||
}, |
|||
// 设置USB数据回调
|
|||
connectUSB(flag, callback) { |
|||
console.log('UsbSerial', UsbSerial) |
|||
//设置数据回调
|
|||
UsbSerial.setDataCallback((res) => { |
|||
console.log('设置USB数据回调-res', res) |
|||
if (res.type == "onUsbDeviceAttached") { //usb插上
|
|||
console.log('USB已插入'); |
|||
var data = { |
|||
command: 'comStatusChanged', |
|||
data: { |
|||
state: 0, |
|||
message: 'USB已插入' |
|||
} |
|||
} |
|||
this.webViewToH5(data) |
|||
} else if (res.type == "onUsbDeviceDetached") { //usb断开
|
|||
console.log('USB已拔出'); |
|||
var data = { |
|||
command: 'comStatusChanged', |
|||
data: { |
|||
state: 0, |
|||
message: 'USB已拔出' |
|||
} |
|||
} |
|||
this.webViewToH5(data) |
|||
} else if (res.type === 'startUpdateValue') { |
|||
console.log('正在接受数据中,请稍等...'); |
|||
} else if (res.type == "onNewData") { //数据回调
|
|||
var data = res.data.data; //字节数组
|
|||
var str = res.data.string; //字符串
|
|||
var hex = res.data.hex; //十六进制
|
|||
// console.log('字节数组',data)
|
|||
// console.log('字符串',str)
|
|||
console.log('hex', hex) |
|||
// 68656c6c6f20776f726c64---hello world
|
|||
console.log('this.hexCharCodeToStr(hex)', JSON.stringify(this.hexCharCodeToStr(hex))); |
|||
|
|||
var data = { |
|||
command: 'examineData', |
|||
commandType: 'USB', |
|||
data: { |
|||
state: 0, |
|||
message: JSON.stringify(this.hexCharCodeToStr(hex)) |
|||
} |
|||
} |
|||
this.webViewToH5(data) |
|||
} else if (res.type == "onRunError") { |
|||
//点击关闭USB
|
|||
var data = { |
|||
command: 'comStatusChanged', |
|||
data: { |
|||
state: 0, |
|||
message: 'USBRunError' |
|||
} |
|||
} |
|||
this.webViewToH5(data) |
|||
} |
|||
}); |
|||
//UsbSerial.setReceiveTime(type,time) 参数:
|
|||
// type (0 1 2)0直接返回,字节太长会被分包; 1固定间隔time返回拼接的数据; 2拼接数据,没接收到数据间隔time后返回
|
|||
// time (毫秒)
|
|||
UsbSerial.setReceiveTime(2, 500) |
|||
//获取usb列表
|
|||
UsbSerial.getUsbDevices((usbDevices) => { |
|||
console.log('获取usb列表-usbDevices', usbDevices) |
|||
//选择usb列表
|
|||
if (usbDevices.length > 0) { |
|||
this.usbDevicesComPortsList = usbDevices.map(item => item.device.vendorId) |
|||
if (flag === 'NoOpen') { |
|||
callback() |
|||
} else { |
|||
// console.log('this.cgConfigInfo.data.portName',this.cgConfigInfo.data.portName);
|
|||
// console.log('usbDevices[0].device.vendorId',usbDevices[0].device.vendorId);
|
|||
let usbDevice = usbDevices.filter(item => item.device.vendorId == this.cgConfigInfo.data.portName) |
|||
console.log('usbDevice',usbDevice); |
|||
if (usbDevice.length > 0) { |
|||
this.vendorId = usbDevice[0].device.vendorId |
|||
this.port = usbDevice[0].ports[0] |
|||
this.openUSB() |
|||
} |
|||
} |
|||
} else { |
|||
this.usbDevicesComPortsList = [] |
|||
flag === 'NoOpen' ? callback() : '' |
|||
} |
|||
}); |
|||
}, |
|||
// 打开USB
|
|||
openUSB() { |
|||
let vueDetailData = this.cgConfigInfo.data |
|||
console.log('打开USB', this.vendorId) |
|||
//检查授权Usb权限
|
|||
UsbSerial.grantUsbPermission(this.vendorId, (res) => { |
|||
console.log('检查授权Usb权限', res) |
|||
if (res == true) { |
|||
//打开usb连接
|
|||
UsbSerial.open(this.vendorId, this.port, (ret) => { |
|||
console.log('打开usb连接', ret) |
|||
if (ret == true) { |
|||
//设置参数
|
|||
UsbSerial.setParameters(vueDetailData.baudRate, vueDetailData.dataBits, vueDetailData.stopBits, vueDetailData.parity) |
|||
var data = { |
|||
command: 'comStatusChanged', |
|||
data: { |
|||
state: 0, |
|||
message: 'USB已打开' |
|||
} |
|||
} |
|||
this.webViewToH5(data) |
|||
} |
|||
}); |
|||
} else { |
|||
var data = { |
|||
command: 'comStatusChanged', |
|||
data: { |
|||
state: 0, |
|||
message: 'USB未授权' |
|||
} |
|||
} |
|||
this.webViewToH5(data) |
|||
} |
|||
}); |
|||
}, |
|||
//关闭usb
|
|||
closeUSB() { |
|||
console.log('关闭usb') |
|||
UsbSerial.close() |
|||
clearInterval(this.setInterTimeUSB) |
|||
var data = { |
|||
command: 'comStatusChanged', |
|||
data: { |
|||
state: 0, |
|||
message: 'USB已关闭' |
|||
} |
|||
} |
|||
this.webViewToH5(data) |
|||
// uni.showToast({
|
|||
// title: "usb已断开"
|
|||
// })
|
|||
}, |
|||
// 将16进制的内容转成我们看得懂的字符串内容
|
|||
hexCharCodeToStr(hexCharCodeStr) { |
|||
var trimedStr = hexCharCodeStr.trim() |
|||
var rawStr = trimedStr.substr(0, 2).toLowerCase() === "0x" ? trimedStr.substr(2) : trimedStr |
|||
var len = rawStr.length; |
|||
// console.log(len)
|
|||
if (len % 2 !== 0) { |
|||
alert("存在非法字符!") |
|||
return "" |
|||
} |
|||
var curCharCode |
|||
var resultStr = [] |
|||
for (var i = 0; i < len; i = i + 2) { |
|||
curCharCode = parseInt(rawStr.substr(i, 2), 16) |
|||
resultStr.push(String.fromCharCode(curCharCode)) |
|||
} |
|||
return resultStr.join("") |
|||
}, |
|||
// uniapp 传参给 vue页面---刘灿测试
|
|||
webViewToH5(res) { |
|||
let currentWebview = this.$scope.$getAppWebview(); |
|||
let wv = currentWebview.children()[0]; |
|||
console.log('uniapp 传参给 vue页面'); |
|||
wv.evalJS(`getVueMessage(${JSON.stringify(res)})`); |
|||
}, |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
export default { |
|||
data() { |
|||
return { |
|||
} |
|||
}, |
|||
methods: { |
|||
// 将16进制的内容转成我们看得懂的字符串内容
|
|||
hexCharCodeToStr(hexCharCodeStr) { |
|||
var trimedStr = hexCharCodeStr.trim() |
|||
var rawStr = trimedStr.substr(0, 2).toLowerCase() === "0x" ? trimedStr.substr(2) : trimedStr |
|||
var len = rawStr.length; |
|||
console.log(len) |
|||
if (len % 2 !== 0) { |
|||
alert("存在非法字符!") |
|||
return "" |
|||
} |
|||
var curCharCode |
|||
var resultStr = [] |
|||
for (var i = 0; i < len; i = i + 2) { |
|||
curCharCode = parseInt(rawStr.substr(i, 2), 16) |
|||
resultStr.push(String.fromCharCode(curCharCode)) |
|||
} |
|||
return resultStr.join("") |
|||
}, |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
{ |
|||
"name": "ZS-Bugly", |
|||
"id": "ZS-Bugly", |
|||
"version": "1.3.0", |
|||
"description": "捕获系统错误", |
|||
"_dp_type": "nativeplugin", |
|||
"_dp_nativeplugin": { |
|||
"android": { |
|||
"plugins": [{ |
|||
"type": "module", |
|||
"name": "ZS-Bugly", |
|||
"class": "com.example.bugly.buglyModule" |
|||
}], |
|||
"integrateType": "aar", |
|||
"minSdkVersion": 16 |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,24 @@ |
|||
{ |
|||
"name": "Usb通讯插件", |
|||
"id": "Zhimi-UsbSerial", |
|||
"version": "1.0", |
|||
"description": "Usb通讯插件", |
|||
"_dp_type":"nativeplugin", |
|||
"_dp_nativeplugin":{ |
|||
"android": { |
|||
"plugins": [ |
|||
{ |
|||
"type": "module", |
|||
"name": "Zhimi-UsbSerial", |
|||
"class": "com.zhimi.usbserial.UsbSerialModule" |
|||
} |
|||
], |
|||
"hooksClass": "com.zhimi.usbserial.UsbSerialAppProxy", |
|||
"integrateType": "aar", |
|||
"dependencies": [ |
|||
"com.github.mik3y:usb-serial-for-android:3.4.3" |
|||
], |
|||
"minSdkVersion": "21" |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
{ |
|||
"name": "zhimiFTP", |
|||
"id": "zhimiFTP", |
|||
"version": "1.0.0", |
|||
"description": "FTP插件", |
|||
"_dp_type": "nativeplugin", |
|||
"_dp_nativeplugin": { |
|||
"android": { |
|||
"plugins": [ |
|||
{ |
|||
"type": "module", |
|||
"name": "Zhimi-FTP-Module", |
|||
"class": "com.example.zhimiftp.zhimiFTPModule" |
|||
} |
|||
], |
|||
"integrateType": "aar", |
|||
"minSdkVersion": "21", |
|||
"dependencies": [ |
|||
"commons-net:commons-net:3.8.0" |
|||
] |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,45 @@ |
|||
{ |
|||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages |
|||
{ |
|||
"path" : "pages/webPage/index", // USB常规检查 |
|||
"style" : |
|||
{ |
|||
"navigationBarTitleText": "", |
|||
"enablePullDownRefresh": false |
|||
} |
|||
} |
|||
// { |
|||
// "path": "pages/ftpCgjc/index", // ftp常规检查 |
|||
// "style": { |
|||
// "navigationBarTitleText": "uni-app" |
|||
// } |
|||
// } |
|||
// { |
|||
// "path": "pages/belShili/index", // 蓝牙视力屏幕通讯 |
|||
// "style": { |
|||
// "navigationBarTitleText": "uni-app" |
|||
// } |
|||
// } |
|||
// { |
|||
// "path" : "pages/usbCgjc/index", // USB常规检查 |
|||
// "style" : |
|||
// { |
|||
// "navigationBarTitleText": "", |
|||
// "enablePullDownRefresh": false |
|||
// } |
|||
// } |
|||
// { |
|||
// "path": "pages/zhimiOK/index", |
|||
// "style": { |
|||
// "navigationBarTitleText": "uni-app" |
|||
// } |
|||
// } |
|||
], |
|||
"globalStyle": { |
|||
"navigationBarTextStyle": "black", |
|||
"navigationBarTitleText": "uni-app", |
|||
"navigationBarBackgroundColor": "#F8F8F8", |
|||
"backgroundColor": "#F8F8F8" |
|||
}, |
|||
"uniIdRouter": {} |
|||
} |
@ -0,0 +1,231 @@ |
|||
<template> |
|||
<view> |
|||
<view class="title" @click="openBluetoothAdapter" style="margin-bottom: 10px;">初始化蓝牙</view> |
|||
<input class="classInput" type="" :value="stringToSend" @input="stringToSendInputHandle" /> |
|||
<view class="title" @click="writeBLECharacteristicValue" style="margin-top: 10px;">触发执行</view> |
|||
<view class="title" @click="closeBluetoothAdapter" style="color: red;margin-top:40px;">断开蓝牙</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
onBluetoothDeviceFoundcustom: '', |
|||
deviceId: '', |
|||
stringToSend: '$D50504010300#', // D50604010000 |
|||
setInterTimeBEL: null |
|||
} |
|||
}, |
|||
onLoad() { |
|||
}, |
|||
methods: { |
|||
// // 输入框改变时触发 |
|||
// stringToSendInputHandle(e) { |
|||
// console.log('输入框改变时触发', e); |
|||
// this.stringToSend = e.target.value |
|||
// }, |
|||
// 打开GPS定位!!!打开GPS定位新买的荣耀才能触发uni.onBluetoothDeviceFound监听!!!! |
|||
checkAndOpenGPS() { |
|||
var Context = plus.android.importClass("android.content.Context"); |
|||
var LocationManager = plus.android.importClass("android.location.LocationManager"); |
|||
var main = plus.android.runtimeMainActivity(); |
|||
|
|||
// 获取系统的 LocationManager 服务 |
|||
var locationManager = main.getSystemService(Context.LOCATION_SERVICE); |
|||
|
|||
// 检查 GPS 是否开启 |
|||
var isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); |
|||
var isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); // 检查网络定位服务 |
|||
// 位置服务已开启,不进行任何操作 |
|||
if (isGPSEnabled || isNetworkEnabled) { |
|||
console.log("位置服务已开启"); |
|||
this.openBluetoothAdapter() |
|||
} else { |
|||
console.log("位置服务未开启,跳转到设置页面"); |
|||
// 位置服务未开启,引导用户打开 GPS 设置页面 |
|||
var Intent = plus.android.importClass("android.content.Intent"); |
|||
var Settings = plus.android.importClass("android.provider.Settings"); |
|||
var intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); |
|||
main.startActivity(intent); |
|||
|
|||
// 提示用户手动开启 GPS |
|||
plus.nativeUI.alert("请手动开启GPS!"); |
|||
} |
|||
}, |
|||
// 初始化蓝牙 |
|||
openBluetoothAdapter() { |
|||
let that = this |
|||
that.closeBluetoothAdapter() |
|||
console.log('初始化蓝牙'); |
|||
uni.openBluetoothAdapter({ |
|||
success(res) { |
|||
console.log(res) |
|||
that.startBluetoothDevicesDiscovery() |
|||
}, |
|||
fail(res) { |
|||
console.log('初始化蓝牙失败', res) |
|||
setTimeout(() => { |
|||
that.openBluetoothAdapter() |
|||
}, 5000) |
|||
} |
|||
}) |
|||
}, |
|||
// 开始搜索蓝牙设备 |
|||
startBluetoothDevicesDiscovery() { |
|||
console.log('开始搜索蓝牙设备'); |
|||
let that = this |
|||
uni.startBluetoothDevicesDiscovery({ |
|||
success(res) { |
|||
console.log(res) |
|||
that.onBluetoothDeviceFound() |
|||
} |
|||
}) |
|||
}, |
|||
// 监听设备发现 |
|||
onBluetoothDeviceFound() { |
|||
let that = this |
|||
this.onBluetoothDeviceFoundcustom = uni.onBluetoothDeviceFound((res) => { |
|||
console.log('监听设备发现', res.devices[0]); |
|||
if (res.devices[0].name === 'ACP60205') { |
|||
console.log('hello,厉害,找到啦,啦啦啦~~~'); |
|||
// 连接成功后,停止设备搜索 |
|||
uni.stopBluetoothDevicesDiscovery(); |
|||
that.deviceId = res.devices[0].deviceId; // 获取设备ID |
|||
that.createBLEConnection() |
|||
// setTimeout(()=>{this.getBLEDeviceServices()},3000) |
|||
} |
|||
}) |
|||
}, |
|||
// 获取服务列表 + 获取特征列表 |
|||
getBLEDeviceServices() { |
|||
let that = this |
|||
uni.getBLEDeviceServices({ |
|||
deviceId: that.deviceId, |
|||
success: (res) => { |
|||
console.log('服务列表', res.services); |
|||
res.services.forEach(service => { |
|||
uni.getBLEDeviceCharacteristics({ |
|||
deviceId: that.deviceId, |
|||
serviceId: service.uuid, |
|||
success: function(charRes) { |
|||
console.log('特征列表', charRes.characteristics); |
|||
}, |
|||
fail: function(err) { |
|||
console.error('获取特征失败', err) |
|||
} |
|||
}); |
|||
}); |
|||
}, |
|||
fail: function(err) { |
|||
console.error('获取服务失败', err) |
|||
} |
|||
}) |
|||
|
|||
}, |
|||
// 连接到设备 |
|||
createBLEConnection() { |
|||
let that = this |
|||
console.log('连接到设备that.deviceId', that.deviceId); |
|||
uni.createBLEConnection({ |
|||
deviceId: that.deviceId, |
|||
success: function() { |
|||
console.log('连接成功') |
|||
that.belStatus() |
|||
}, |
|||
fail: function(err) { |
|||
console.error('连接失败', err) |
|||
setTimeout(() => { |
|||
that.openBluetoothAdapter() |
|||
}, 5000) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
// 检测BEL是否连接状态 |
|||
belStatus() { |
|||
clearInterval(this.setInterTimeBEL) |
|||
this.setInterTimeBEL = setInterval(() => { |
|||
this.getConnectedBluetoothDevices() |
|||
}, 5000) |
|||
}, |
|||
// 检查设备连接状态 |
|||
getConnectedBluetoothDevices() { |
|||
let that = this |
|||
uni.getConnectedBluetoothDevices({ |
|||
success(res) { |
|||
console.log('当前已连接的设备:', res.devices); |
|||
if (res.devices.length <= 0) { |
|||
that.openBluetoothAdapter() |
|||
clearInterval(that.setInterTimeBEL) |
|||
} |
|||
}, |
|||
fail(err) { |
|||
console.log('获取已连接设备失败:', err) |
|||
that.openBluetoothAdapter() |
|||
} |
|||
}) |
|||
}, |
|||
// 发送蓝牙内容 |
|||
writeBLECharacteristicValue() { |
|||
let that = this |
|||
// 要发送的字符串 |
|||
// $D50504030231# |
|||
// D5---5米距离 |
|||
// 06--- |
|||
const dataToSend = that.stringToByteArray(that.stringToSend) |
|||
console.log(' dataToSend.buffer', dataToSend.buffer) |
|||
uni.writeBLECharacteristicValue({ |
|||
deviceId: that.deviceId, // 设备ID |
|||
serviceId: '0000ffe0-0000-1000-8000-00805f9b34fb', // 服务ID |
|||
characteristicId: '0000ffe1-0000-1000-8000-00805f9b34fb', // 特征ID |
|||
value: dataToSend.buffer, |
|||
writeType: 'write', |
|||
success: () => { |
|||
console.log('发送内容成功') |
|||
}, |
|||
fail: (err) => { |
|||
console.error('发送内容失败', err) |
|||
} |
|||
}) |
|||
}, |
|||
// 处理发送的内容 |
|||
stringToByteArray(str) { |
|||
const byteArray = new Uint8Array(str.length); |
|||
for (let i = 0; i < str.length; i++) { |
|||
byteArray[i] = str.charCodeAt(i) |
|||
} |
|||
return byteArray; |
|||
}, |
|||
// 断开蓝牙 |
|||
closeBluetoothAdapter(title) { |
|||
let that = this |
|||
uni.closeBluetoothAdapter({ |
|||
success() { |
|||
console.log('蓝牙适配器关闭成功'); |
|||
}, |
|||
fail(err) { |
|||
console.log('关闭蓝牙适配器失败: ', err); |
|||
} |
|||
}); |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.title { |
|||
font-size: 36rpx; |
|||
color: #8f8f94; |
|||
text-align: center; |
|||
} |
|||
|
|||
.classInput { |
|||
border: 1px solid #ccc; |
|||
height: 80rpx; |
|||
width: 300px; |
|||
text-align: center; |
|||
margin: auto; |
|||
|
|||
} |
|||
</style> |
@ -0,0 +1,333 @@ |
|||
<template> |
|||
<view class="content" style="margin-left: 200px;"> |
|||
<view>连接状态:{{isConnect ? '已连接' : '未连接'}}</view> |
|||
<view>循环次数: {{count}}</view> |
|||
<button type="primary" @click="connectFtpServer()">FTP连接</button> |
|||
<button type="primary" @click="ftpUploadFiles()">FTP上传文件夹</button> |
|||
<button type="primary" @click="ftpCreatNewDirectory()">FTP新建文件夹</button> |
|||
<button type="primary" @click="ftpUploadFile()">FTP上传文件</button> |
|||
<button type="primary" @click="ftpDownloadSingleFile()">FTP单个文件下载</button> |
|||
<button type="primary" @click="ftpLoopServerPath()">获取目录</button> |
|||
<button type="primary" @click="ftpDeleteServerFiles()">删除文件</button> |
|||
<button type="primary" @click="ftpDeleteServerFilesWithoutDirectory()">删除文件夹下面文件保留文件夹</button> |
|||
<button type="primary" @click="closeFTPConnect()">FTP断开连接</button> |
|||
<button type="primary" @click="closeSetTime()">刘灿-FTP暂停循环</button> |
|||
<button type="primary" @click="turnUrl()">刘灿-FTP本地文件转URL</button> |
|||
<button type="primary" @click="deleteAppDownLoadFile()">刘灿-删除安卓机目录文件</button> |
|||
|
|||
<button type="primary" style="margin-top: 16px;" @click="connectFtpsServer()">FTPS连接</button> |
|||
<button type="primary" @click="ftpsUploadFiles()">FTPS上传文件夹</button> |
|||
<button type="primary" @click="ftpsCreatNewDirectory()">FTPS新建文件夹</button> |
|||
<button type="primary" @click="ftpsUploadFile()">FTPS上传文件</button> |
|||
<button type="primary" @click="ftpsDownloadSingleFile()">FTPS单个文件下载</button> |
|||
<button type="primary" @click="ftpsLoopServerPath()">ftps获取目录</button> |
|||
<button type="primary" @click="ftpsDeleteServerFiles()">ftps删除文件</button> |
|||
<button type="primary" @click="ftpsDeleteServerFilesWithoutDirectory()">ftps删除文件夹下面文件保留文件夹</button> |
|||
<button type="primary" @click="closeFTPSConnect()">FTPS断开连接</button> |
|||
<view class="webViewClass" style="height: 50vh;"> |
|||
<web-view ref="webViewRef" @message="messageData" src="http://192.168.0.35:8001/wz_qg/ftpCs" |
|||
:fullscreen="false" :webview-styles="webviewStyles"></web-view> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
var FTP = uni.requireNativePlugin('Zhimi-FTP-Module'); |
|||
export default { |
|||
data() { |
|||
return { |
|||
title: 'Hello', |
|||
remoteUrl: '', |
|||
webviewStyles: { |
|||
width: '300px', |
|||
height: '500px', |
|||
left: '0px', |
|||
top: '200px' |
|||
// top: '100px' |
|||
}, |
|||
androidFileDocPath: plus.io.convertLocalFileSystemURL('_doc'), |
|||
ftpLogicDeceteName: '/sda1/logicDelete', |
|||
count:0, |
|||
isConnect:false, |
|||
setInterTimeFTP:null |
|||
} |
|||
}, |
|||
onShow() { |
|||
console.log('showshowshow'); |
|||
// this.ftpLoopServerPath() |
|||
}, |
|||
onHide() { |
|||
console.log('hidehidehide'); |
|||
}, |
|||
onLoad() { |
|||
this.connectFtpServer() |
|||
}, |
|||
methods: { |
|||
// 流程: |
|||
// ftp连接 ---> 获取ftp目录文件夹名和文件名 ---> 下载文件夹中的文件到安卓机 ---> 临时地址转url传输给H5展示 |
|||
// ---> H5页面关联确认完,在安卓机中找到关联确认后的文件上传到FTP的另外一个文件夹(新建文件夹) ---> 删除安卓机临时文件 ---> 删除FTP之前文件夹中关联确认后的文件 |
|||
// FTP连接 |
|||
connectFtpServer() { |
|||
//(“服务地址”, 端口, “用户名”,”密码“, 回调 ) |
|||
//回调 |
|||
//成功 {type : "connect", data : {data : "相应状态码:200 连接是否成功:true 连接是否有效:true}} |
|||
//失败 {type : "connect", data : {"error" : "失败原因"}} |
|||
// "192.168.50.1", 21, "hmgc", "hmgc" |
|||
// "192.168.50.131", 21, "hmftp", "hmftp" |
|||
FTP.connectFtpServer("192.168.50.131", 21, "hmftp", "hmftp", "gbk", res => { |
|||
console.log('FTP连接',res) |
|||
clearInterval(this.setInterTimeFTP) |
|||
this.ftpSendNoOp() |
|||
if(res.type==='connect' && res.data.connect === true) { |
|||
this.isConnect = true |
|||
} else if(res.type==='connect' && res.data.connect === false){ |
|||
this.isConnect = false |
|||
} |
|||
}) |
|||
}, |
|||
// 获取FTP服务器目录 |
|||
ftpLoopServerPath(name,index,text) { |
|||
// 1是文件夹 0是文件 |
|||
//("获取服务器目录下文件,空白为根目录", 回调) |
|||
//回调 |
|||
//成功 {type : getFileInfo, data : [{name : "地址", size : 文件大小单位字节, time : “修改时间”}]} |
|||
//失败 {type : "error", data : "失败原因"} |
|||
let pathName = name ? name : '/sda1/deviceNewFile' |
|||
console.log('pathName', pathName); |
|||
FTP.ftpLoopServerPath(pathName,res=>{ |
|||
console.log('获取FTP服务器目录res',res); |
|||
res.data.length > 0 ? this.ftpChangeWorkingDirectory(res.data[0]) : '' |
|||
}) |
|||
}, |
|||
// 下载前调用这个方法 |
|||
ftpChangeWorkingDirectory(data) { |
|||
FTP.ftpChangeWorkingDirectory("/",res=>{ |
|||
console.log('下载前调用这个方法',res) |
|||
res.data ? this.ftpDownloadSingleFile(data) : '' |
|||
}) |
|||
}, |
|||
// FTP-单个文件下载至安卓机 |
|||
ftpDownloadSingleFile(data) { |
|||
//("要下载到本地文件夹的绝对路径", "要下载的服务器上文件的绝对路径", 回调) |
|||
//回调 |
|||
//{type : download, data : {status : true/false, name : "下载的文件名", errpr : "失败原因"}} |
|||
// var inputFile = plus.io.convertLocalFileSystemURL('/static') |
|||
console.log('androidFileDocPath',this.androidFileDocPath) |
|||
// '/sda1/deviceNewFile/20240918/20240918logo.png' |
|||
FTP.ftpDownloadSingleFile(this.androidFileDocPath, data.name, res => { |
|||
console.log('单个文件下载至安卓机--成功', res) |
|||
if(res.type === 'download') { |
|||
this.turnUrl(data) |
|||
} |
|||
|
|||
}) |
|||
}, |
|||
// 获取本地文件路径并转换为远程URL---刘灿测试 |
|||
turnUrl(data) { |
|||
var androidFileNamePath = this.androidFileDocPath + data.fileName |
|||
console.log('androidFileNamePath', androidFileNamePath); |
|||
plus.io.resolveLocalFileSystemURL(androidFileNamePath, (entry) => { |
|||
this.remoteUrl = entry.toRemoteURL(); |
|||
console.log('Remote URL:', this.remoteUrl); |
|||
this.webViewToH5({ |
|||
type: 'getUrlInfo', |
|||
url: this.remoteUrl, |
|||
data:data |
|||
}) |
|||
}, function(e) { |
|||
console.log('文件路径解析失败', e); |
|||
}) |
|||
}, |
|||
// uniapp 传参给 vue页面---刘灿测试 |
|||
webViewToH5(res) { |
|||
let currentWebview = this.$scope.$getAppWebview(); |
|||
let wv = currentWebview.children()[0]; |
|||
console.log('uniapp 传参给 vue页面'); |
|||
wv.evalJS(`getVueMessage(${JSON.stringify(res)})`); |
|||
}, |
|||
// uniapp vue页面传参给UNI ---刘灿测试 |
|||
messageData(e) { |
|||
console.log('接收的VUE参数', e.detail.data[0]) // 接收的参数 |
|||
let vueDetail = e.detail.data[0] |
|||
if(vueDetail.type === 'getCgjcSuccess') { |
|||
setTimeout(()=>{ |
|||
this.deleteAppDownLoadFile(vueDetail.data) |
|||
this.ftpDeleteServerFiles(vueDetail.data) |
|||
},2000) |
|||
} |
|||
}, |
|||
// 删除安卓机下载下来的文件---刘灿测试 |
|||
deleteAppDownLoadFile(data) { |
|||
console.log(' 删除安卓机下载下来的文件--data',data); |
|||
// 获取安卓机路径地址 |
|||
var deleteAppFileName = this.androidFileDocPath + data.fileName |
|||
plus.io.resolveLocalFileSystemURL(deleteAppFileName, (entry)=> { |
|||
// 调用 remove 方法删除文件 |
|||
entry.remove(() => { |
|||
console.log('文件删除成功'); |
|||
}, (error) => { |
|||
console.log('文件删除失败: ' + error.message); |
|||
}); |
|||
}, (error) => { |
|||
console.log('无法解析文件路径: ' + error.message); |
|||
}) |
|||
}, |
|||
// 删除FTP服务器文件 |
|||
ftpDeleteServerFiles(data) { |
|||
//("要删除的文件夹或文件地址", 回调) |
|||
//回调 |
|||
//{type : delete, data : {msg : "删除文件/删除文件夹(ps:先删除文件夹里面的文件再删文件夹)", data : "文件名", status : true/false, error : "失败原因"}} |
|||
FTP.ftpDeleteServerFiles(data.name, res => { |
|||
console.log('FTP服务器文件删除成功', res) |
|||
setTimeout(()=>{ |
|||
this.ftpUploadFile(data) |
|||
},3000) |
|||
}) |
|||
}, |
|||
// FTP-上传文件至FTP |
|||
ftpUploadFile(data) { |
|||
var inputFile = plus.io.convertLocalFileSystemURL('/static/logo.png') |
|||
console.log('inputFile文件', inputFile); |
|||
FTP.ftpUploadFile(inputFile, '/sda1/deviceNewFile', res => { |
|||
console.log('文件-上传成功',res) |
|||
if(res.data.msg==='上传完成') { |
|||
console.log('00000000000000000000'); |
|||
this.ftpLoopServerPath() |
|||
console.log(this.count++); |
|||
} |
|||
}) |
|||
}, |
|||
// FTP断开连接 |
|||
closeFTPConnect() { |
|||
console.log('点到了!!!!'); |
|||
//失败有回调,成功没有回调 |
|||
FTP.closeFTPConnect(res => { |
|||
console.log(res) |
|||
this.isConnect = false |
|||
}) |
|||
}, |
|||
// 测试是否掉线的方法 |
|||
ftpSendNoOp(callback) { |
|||
this.setInterTimeFTP = setInterval(()=>{ |
|||
FTP.ftpSendNoOp(res=>{ |
|||
if(res.data === true) { |
|||
// console.log('测试是否掉线回调-未掉线',res); |
|||
this.isConnect = true |
|||
// callback(res.data) |
|||
} else { |
|||
console.log('测试是否掉线回调-已掉线',res); |
|||
this.isConnect = false |
|||
this.connectFtpServer() |
|||
// callback(res.data) |
|||
} |
|||
}) |
|||
},5000) |
|||
}, |
|||
|
|||
// ----------ftps---------- |
|||
|
|||
// FTPS连接 |
|||
connectFtpsServer() { |
|||
FTP.connectFtpsServer("192.168.0.8", 21, "hmftp", "hmftp", "gbk", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS上传文件夹至服务器 |
|||
ftpsUploadFiles() { |
|||
var inputFile = plus.io.convertLocalFileSystemURL('/static') |
|||
console.log('inputFile文件夹', inputFile); |
|||
FTP.ftpsUploadFile(inputFile, "/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS上传文件 |
|||
ftpsUploadFile() { |
|||
var inputFile = plus.io.convertLocalFileSystemURL('/static/ceshi.txt') |
|||
FTP.ftpsUploadFile(inputFile, "/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS新建文件夹 |
|||
ftpsCreatNewDirectory() { |
|||
FTP.ftpsCreatNewDirectory("/sda1", "newDirectory", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS单个文件下载 |
|||
ftpsDownloadSingleFile() { |
|||
var outputFile = plus.io.convertLocalFileSystemURL('_doc') |
|||
console.log('outputFile', outputFile); |
|||
FTP.ftpsDownloadSingleFile(outputFile, "/sda1/ceshi.txt", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 获取FTPS服务器目录 |
|||
ftpsLoopServerPath() { |
|||
FTP.ftpsLoopServerPath("/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 删除FTPS服务器文件 |
|||
ftpsDeleteServerFiles() { |
|||
//("要删除的文件夹或文件地址", 回调) |
|||
//回调 |
|||
//{type : delete, data : {msg : "删除文件/删除文件夹(ps:先删除文件夹里面的文件再删文件夹)", data : "文件名", status : true/false, error : "失败原因"}} |
|||
FTP.ftpsDeleteServerFiles('/sda1/ceshi.txt', res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 删除FTPS文件夹下面文件保留文件夹 |
|||
ftpsDeleteServerFilesWithoutDirectory() { |
|||
//同上,不会删除指定文件夹 |
|||
FTP.ftpsDeleteServerFilesWithoutDirectory("/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS断开连接 |
|||
closeFTPSConnect() { |
|||
console.log('点到了!!!!'); |
|||
FTP.closeFTPSConnect(res => { |
|||
console.log('点到了进来了!!!!'); |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 测试是否掉线的方法 |
|||
ftpsSendNoOp() { |
|||
FTP.ftpsSendNoOp(e=>{ |
|||
}) |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.content { |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
|
|||
.logo { |
|||
height: 200rpx; |
|||
width: 200rpx; |
|||
margin-top: 200rpx; |
|||
margin-left: auto; |
|||
margin-right: auto; |
|||
margin-bottom: 50rpx; |
|||
} |
|||
|
|||
.text-area { |
|||
display: flex; |
|||
justify-content: center; |
|||
} |
|||
|
|||
.title { |
|||
font-size: 36rpx; |
|||
color: #8f8f94; |
|||
} |
|||
|
|||
.webViewClass { |
|||
position: fixed; |
|||
} |
|||
</style> |
@ -0,0 +1,405 @@ |
|||
<template> |
|||
<view class="content" style="margin-left: 200px;"> |
|||
<!-- <button type="primary" @click="hq()">唤起app</button> --> |
|||
<button type="primary" @click="connectFtpServer()">FTP连接</button> |
|||
<button type="primary" @click="ftpUploadFiles()">FTP上传文件夹</button> |
|||
<button type="primary" @click="ftpCreatNewDirectory()">FTP新建文件夹</button> |
|||
<button type="primary" @click="ftpUploadFile()">FTP上传文件</button> |
|||
<button type="primary" @click="ftpDownloadSingleFile()">FTP单个文件下载</button> |
|||
<button type="primary" @click="ftpLoopServerPath()">获取目录</button> |
|||
<button type="primary" @click="ftpDeleteServerFiles()">删除文件</button> |
|||
<button type="primary" @click="ftpDeleteServerFilesWithoutDirectory()">删除文件夹下面文件保留文件夹</button> |
|||
<button type="primary" @click="closeFTPConnect()">FTP断开连接</button> |
|||
<button type="primary" @click="closeSetTime()">刘灿-FTP暂停循环</button> |
|||
<button type="primary" @click="turnUrl()">刘灿-FTP本地文件转URL</button> |
|||
<button type="primary" @click="deleteAppDownLoadFile()">刘灿-删除安卓机目录文件</button> |
|||
|
|||
<button type="primary" style="margin-top: 16px;" @click="connectFtpsServer()">FTPS连接</button> |
|||
<button type="primary" @click="ftpsUploadFiles()">FTPS上传文件夹</button> |
|||
<button type="primary" @click="ftpsCreatNewDirectory()">FTPS新建文件夹</button> |
|||
<button type="primary" @click="ftpsUploadFile()">FTPS上传文件</button> |
|||
<button type="primary" @click="ftpsDownloadSingleFile()">FTPS单个文件下载</button> |
|||
<button type="primary" @click="ftpsLoopServerPath()">ftps获取目录</button> |
|||
<button type="primary" @click="ftpsDeleteServerFiles()">ftps删除文件</button> |
|||
<button type="primary" @click="ftpsDeleteServerFilesWithoutDirectory()">ftps删除文件夹下面文件保留文件夹</button> |
|||
<button type="primary" @click="closeFTPSConnect()">FTPS断开连接</button> |
|||
<view class="webViewClass" style="height: 50vh;"> |
|||
<web-view ref="webViewRef" @message="messageData" src="http://192.168.0.35:8001/wz_qg/ftpCs" |
|||
:fullscreen="false" :webview-styles="webviewStyles"></web-view> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
var FTP = uni.requireNativePlugin('Zhimi-FTP-Module'); |
|||
export default { |
|||
data() { |
|||
return { |
|||
title: 'Hello', |
|||
setInterTime: null, |
|||
remoteUrl: '', |
|||
webviewStyles: { |
|||
width: '300px', |
|||
height: '500px', |
|||
left: '0px', |
|||
top: '200px' |
|||
// top: '100px' |
|||
}, |
|||
androidFileDocPath: '', |
|||
ftpLogicDeceteName: '/sda1/logicDelete', |
|||
currentfolderList:[], |
|||
flag:true, |
|||
loopI:0 |
|||
} |
|||
}, |
|||
onLoad() { |
|||
// console.log(plus.io.convertLocalFileSystemURL('ceshi')); |
|||
}, |
|||
methods: { |
|||
// hq() { |
|||
// plus.runtime.launchApplication({ |
|||
// packageName: 'com.baidu.BaiduMap' |
|||
// }, function() { |
|||
// console.log('唤醒支付宝成功'); |
|||
// }, function(e) { |
|||
// console.error('唤醒支付宝失败: ' + e.message); |
|||
// }) |
|||
// }, |
|||
// 流程: |
|||
// ftp连接 ---> 获取ftp目录文件夹名和文件名 ---> 下载文件夹中的文件到安卓机 ---> 临时地址转url传输给H5展示 |
|||
// ---> H5页面关联确认完,在安卓机中找到关联确认后的文件上传到FTP的另外一个文件夹(新建文件夹) ---> 删除安卓机临时文件 ---> 删除FTP之前文件夹中关联确认后的文件 |
|||
// FTP连接 |
|||
connectFtpServer() { |
|||
//(“服务地址”, 端口, “用户名”,”密码“, 回调 ) |
|||
//回调 |
|||
//成功 {type : "connect", data : {data : "相应状态码:200 连接是否成功:true 连接是否有效:true}} |
|||
//失败 {type : "connect", data : {"error" : "失败原因"}} |
|||
// "192.168.50.1", 21, "hmgc", "hmgc" |
|||
// "192.168.50.131", 21, "hmftp", "hmftp" |
|||
FTP.connectFtpServer("192.168.50.1", 21, "hmgc", "hmgc", "gbk", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 获取FTP服务器目录 |
|||
ftpLoopServerPath(name,index,text) { |
|||
// 1是文件夹 0是文件 |
|||
//("获取服务器目录下文件,空白为根目录", 回调) |
|||
//回调 |
|||
//成功 {type : getFileInfo, data : [{name : "地址", size : 文件大小单位字节, time : “修改时间”}]} |
|||
//失败 {type : "error", data : "失败原因"} |
|||
let pathName = name ? name : '/sda1/deviceNewFile' |
|||
console.log('pathName', pathName); |
|||
if(text==='不走循环') { |
|||
FTP.ftpLoopServerPath(pathName,res=>{ |
|||
this.webViewToH5(res) |
|||
}) |
|||
} else { |
|||
FTP.ftpLoopServerPath(pathName, res => { |
|||
console.log('res', res) |
|||
|
|||
if(res.data.length > 0 && res.data[0].type===1) { |
|||
console.log('type=1',res.data); |
|||
this.currentfolderList = res.data |
|||
} else if(res.data.length > 0 && res.data[0].type ===0) { |
|||
this.flag = true |
|||
this.loopI++; |
|||
} else if (res.data.length <=0) { |
|||
this.currentfolderList.splice(index,1) |
|||
console.log('空文件夹',this.currentfolderList); |
|||
this.flag = true |
|||
} |
|||
}) |
|||
|
|||
setTimeout(()=>{ |
|||
while (this.flag === true && this.loopI <= this.currentfolderList.length -1) { |
|||
this.flag = false |
|||
this.ftpLoopServerPath(this.currentfolderList[this.loopI].name,this.loopI) |
|||
console.log('结果',this.currentfolderList); |
|||
} |
|||
},150) |
|||
|
|||
if(this.loopI == this.currentfolderList.length -1) { |
|||
this.webViewToH5({ |
|||
type:'getFileInfo', |
|||
data:this.currentfolderList |
|||
}) |
|||
} |
|||
} |
|||
|
|||
}, |
|||
// uniapp 传参给 vue页面---刘灿测试 |
|||
webViewToH5(res) { |
|||
let currentWebview = this.$scope.$getAppWebview(); |
|||
let wv = currentWebview.children()[0]; |
|||
console.log('uniapp 传参给 vue页面'); |
|||
wv.evalJS(`getVueMessage(${JSON.stringify(res)})`); |
|||
this.currentfolderList = [] |
|||
this.loopI = 0 |
|||
}, |
|||
// uniapp vue页面传参给UNI ---刘灿测试 |
|||
messageData(e) { |
|||
console.log('接收的VUE参数', e.detail.data[0]) // 接收的参数 |
|||
let vueDetail = e.detail.data[0] |
|||
if (vueDetail.type === 'getFileInfo') { |
|||
console.log('vueDetail.data', vueDetail.data); |
|||
this.ftpLoopServerPath(vueDetail.data.name,'','不走循环') |
|||
} else if (vueDetail.type === 'getUrlInfo') { |
|||
this.ftpDownloadSingleFile(vueDetail.data) |
|||
} else if (vueDetail.type === 'sendCorrelationConfirm') { |
|||
// 判断logicDelete逻辑删除备份的文件夹中是否有此文件夹 |
|||
this.isHaveCurrentFileFolder(vueDetail.data) |
|||
} |
|||
}, |
|||
// FTP-单个文件下载至安卓机 |
|||
ftpDownloadSingleFile(data) { |
|||
//("要下载到本地文件夹的绝对路径", "要下载的服务器上文件的绝对路径", 回调) |
|||
//回调 |
|||
//{type : download, data : {status : true/false, name : "下载的文件名", errpr : "失败原因"}} |
|||
// var inputFile = plus.io.convertLocalFileSystemURL('/static') |
|||
this.androidFileDocPath = plus.io.convertLocalFileSystemURL('_doc') |
|||
console.log(this.androidFileDocPath) |
|||
// '/sda1/deviceNewFile/20240918/20240918logo.png' |
|||
FTP.ftpDownloadSingleFile(this.androidFileDocPath, data.name, res => { |
|||
console.log('单个文件下载至安卓机--成功', res) |
|||
this.turnUrl(data) |
|||
}) |
|||
}, |
|||
// 获取本地文件路径并转换为远程URL---刘灿测试 |
|||
turnUrl(data) { |
|||
var androidFileNamePath = this.androidFileDocPath + data.fileName |
|||
console.log('androidFileNamePath', androidFileNamePath); |
|||
plus.io.resolveLocalFileSystemURL(androidFileNamePath, (entry) => { |
|||
this.remoteUrl = entry.toRemoteURL(); |
|||
console.log('Remote URL:', this.remoteUrl); |
|||
this.webViewToH5({ |
|||
type: 'getUrlInfo', |
|||
url: this.remoteUrl |
|||
}) |
|||
}, function(e) { |
|||
console.log('文件路径解析失败', e); |
|||
}) |
|||
}, |
|||
// 判断logicDelete逻辑删除备份的文件夹中是否有此文件夹 |
|||
isHaveCurrentFileFolder(data) { |
|||
let nameArr = data.name.split("/") |
|||
let folderName = nameArr[nameArr.length - 2] |
|||
// 获取FTP服务器目录 |
|||
FTP.ftpLoopServerPath(this.ftpLogicDeceteName, res => { |
|||
let index = res.data.findIndex(item => item.fileName == folderName) |
|||
console.log('判断logicDelete逻辑删除备份的文件夹中是否有此文件夹', index); |
|||
if (index === -1) { |
|||
this.ftpCreatNewDirectory(data, folderName) |
|||
} else { |
|||
this.ftpUploadFile(data, folderName) |
|||
} |
|||
}) |
|||
}, |
|||
// FTP-新建文件夹至FTP |
|||
ftpCreatNewDirectory(data, folderName) { |
|||
FTP.ftpCreatNewDirectory(this.ftpLogicDeceteName, folderName, res => { |
|||
// 上传文件至服务器 |
|||
this.ftpUploadFile(data,folderName) |
|||
console.log('新建文件夹成功',res) |
|||
}) |
|||
// let index = 0 |
|||
// 循环暴击测试 |
|||
// setInterval(() => { |
|||
// let fileIndexName = `2024${index++}` |
|||
// FTP.ftpCreatNewDirectory('/sda1/deviceNewFile', fileIndexName, res => { |
|||
// var inputFile = plus.io.convertLocalFileSystemURL('/static/logo.png') |
|||
// // 上传文件至服务器 |
|||
// FTP.ftpUploadFile(inputFile, `/sda1/deviceNewFile/${fileIndexName}`, |
|||
// res => { |
|||
// console.log('获取安卓手机文件夹中的文件---刘灿测试', '文件-上传成功'); |
|||
// console.log(res) |
|||
// }) |
|||
// }) |
|||
// }, 2000) |
|||
|
|||
}, |
|||
// FTP-上传文件夹至服务器FTP |
|||
ftpUploadFiles() { |
|||
//(“要上传的本地文件绝对路径”, “服务器文件夹名(/htdocs/fileName)”, 回调) |
|||
//回调 |
|||
//{type : "upload", data : {path : "本地上传文件地址", status : true/false, msg : "上传完成", error : "失败原因"}} |
|||
// /storage/emulated/0/Download/downladed_rom |
|||
var inputFile = plus.io.convertLocalFileSystemURL('/static') |
|||
FTP.ftpUploadFile(inputFile, "/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTP-上传文件至FTP |
|||
ftpUploadFile(data, folderName) { |
|||
// var inputFile = plus.io.convertLocalFileSystemURL('/static/ceshi.txt') |
|||
// console.log('inputFile文件', inputFile); |
|||
// //同上 |
|||
// FTP.ftpUploadFile(inputFile, `/sda1/deviceNewFile/${ftpFwqName}`, res => { |
|||
// console.log(ftpFwqName, '文件-上传成功'); |
|||
// console.log(res) |
|||
// }) |
|||
|
|||
// 获取安卓手机文件夹中的文件并上传至ftp服务器---刘灿测试 |
|||
var detailFileName = this.androidFileDocPath + data.fileName |
|||
FTP.ftpUploadFile(detailFileName, `${this.ftpLogicDeceteName}/${folderName}`, res => { |
|||
console.log('获取安卓手机文件夹中的文件---刘灿测试', '文件-上传成功'); |
|||
console.log(res) |
|||
this.deleteAppDownLoadFile(data.fileName) |
|||
this.ftpDeleteServerFiles(data.name,folderName) |
|||
}) |
|||
}, |
|||
// 删除安卓机下载下来的文件---刘灿测试 |
|||
deleteAppDownLoadFile(fileName) { |
|||
// 获取安卓机路径地址 |
|||
var deleteAppFileName = this.androidFileDocPath + fileName |
|||
plus.io.resolveLocalFileSystemURL(deleteAppFileName, function(entry) { |
|||
// 调用 remove 方法删除文件 |
|||
entry.remove(() => { |
|||
console.log('文件删除成功'); |
|||
}, (error) => { |
|||
console.log('文件删除失败: ' + error.message); |
|||
}); |
|||
}, (error) => { |
|||
console.log('无法解析文件路径: ' + error.message); |
|||
}) |
|||
}, |
|||
// 删除FTP服务器文件 |
|||
ftpDeleteServerFiles(name,folderName) { |
|||
//("要删除的文件夹或文件地址", 回调) |
|||
//回调 |
|||
//{type : delete, data : {msg : "删除文件/删除文件夹(ps:先删除文件夹里面的文件再删文件夹)", data : "文件名", status : true/false, error : "失败原因"}} |
|||
FTP.ftpDeleteServerFiles(name, res => { |
|||
console.log('FTP服务器文件删除成功', res) |
|||
}) |
|||
// this.ftpLoopServerPath() |
|||
setTimeout(()=>{ |
|||
console.log('删除后获取目录-路径',`/sda1/deviceNewFile/${folderName}`); |
|||
FTP.ftpLoopServerPath(`/sda1/deviceNewFile/${folderName}`,res=>{ |
|||
console.log('删除后获取目录',res); |
|||
this.webViewToH5(res) |
|||
}) |
|||
},2000) |
|||
}, |
|||
// 删除FTP文件夹下面文件保留文件夹 |
|||
ftpDeleteServerFilesWithoutDirectory() { |
|||
//同上,不会删除指定文件夹 |
|||
FTP.ftpDeleteServerFilesWithoutDirectory("/sda1/deviceNewFile", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 关闭循环---刘灿测试 |
|||
closeSetTime() { |
|||
console.log('停止循环'); |
|||
clearInterval(this.setInterTime) |
|||
}, |
|||
|
|||
// FTP断开连接 |
|||
closeFTPConnect() { |
|||
console.log('点到了!!!!'); |
|||
//失败有回调,成功没有回调 |
|||
FTP.closeFTPConnect(res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
|
|||
// ----------ftps---------- |
|||
|
|||
// FTPS连接 |
|||
connectFtpsServer() { |
|||
FTP.connectFtpsServer("192.168.0.8", 21, "hmftp", "hmftp", "gbk", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS上传文件夹至服务器 |
|||
ftpsUploadFiles() { |
|||
var inputFile = plus.io.convertLocalFileSystemURL('/static') |
|||
console.log('inputFile文件夹', inputFile); |
|||
FTP.ftpsUploadFile(inputFile, "/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS上传文件 |
|||
ftpsUploadFile() { |
|||
var inputFile = plus.io.convertLocalFileSystemURL('/static/ceshi.txt') |
|||
FTP.ftpsUploadFile(inputFile, "/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS新建文件夹 |
|||
ftpsCreatNewDirectory() { |
|||
FTP.ftpsCreatNewDirectory("/sda1", "newDirectory", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS单个文件下载 |
|||
ftpsDownloadSingleFile() { |
|||
var outputFile = plus.io.convertLocalFileSystemURL('_doc') |
|||
console.log('outputFile', outputFile); |
|||
FTP.ftpsDownloadSingleFile(outputFile, "/sda1/ceshi.txt", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 获取FTPS服务器目录 |
|||
ftpsLoopServerPath() { |
|||
FTP.ftpsLoopServerPath("/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 删除FTPS服务器文件 |
|||
ftpsDeleteServerFiles() { |
|||
//("要删除的文件夹或文件地址", 回调) |
|||
//回调 |
|||
//{type : delete, data : {msg : "删除文件/删除文件夹(ps:先删除文件夹里面的文件再删文件夹)", data : "文件名", status : true/false, error : "失败原因"}} |
|||
FTP.ftpsDeleteServerFiles('/sda1/ceshi.txt', res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 删除FTPS文件夹下面文件保留文件夹 |
|||
ftpsDeleteServerFilesWithoutDirectory() { |
|||
//同上,不会删除指定文件夹 |
|||
FTP.ftpsDeleteServerFilesWithoutDirectory("/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS断开连接 |
|||
closeFTPSConnect() { |
|||
console.log('点到了!!!!'); |
|||
FTP.closeFTPSConnect(res => { |
|||
console.log('点到了进来了!!!!'); |
|||
console.log(res) |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.content { |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
|
|||
.logo { |
|||
height: 200rpx; |
|||
width: 200rpx; |
|||
margin-top: 200rpx; |
|||
margin-left: auto; |
|||
margin-right: auto; |
|||
margin-bottom: 50rpx; |
|||
} |
|||
|
|||
.text-area { |
|||
display: flex; |
|||
justify-content: center; |
|||
} |
|||
|
|||
.title { |
|||
font-size: 36rpx; |
|||
color: #8f8f94; |
|||
} |
|||
|
|||
.webViewClass { |
|||
position: fixed; |
|||
} |
|||
</style> |
@ -0,0 +1,33 @@ |
|||
<template> |
|||
<view class="content"> |
|||
<button type="primary" @click="connectUSB()">初始化</button> |
|||
<button type="primary" @click="openUSB()" style="margin-top: 10px;">打开usb</button> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import linkUSB from '@/mixins/linkUSB.js' |
|||
export default { |
|||
mixins: [linkUSB], |
|||
data() { |
|||
return { |
|||
|
|||
} |
|||
}, |
|||
mounted() { |
|||
this.connectUSB() |
|||
}, |
|||
methods: { |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.content { |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
</style> |
@ -0,0 +1,152 @@ |
|||
<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> |
@ -0,0 +1,225 @@ |
|||
<template> |
|||
<view class="content"> |
|||
<button type="primary" @click="connectFtpServer()">FTP连接</button> |
|||
<button type="primary" @click="ftpUploadFiles()">FTP上传文件夹</button> |
|||
<button type="primary" @click="ftpCreatNewDirectory()">FTP新建文件夹</button> |
|||
<button type="primary" @click="ftpUploadFile()">FTP上传文件</button> |
|||
<button type="primary" @click="ftpDownloadSingleFile()">FTP单个文件下载</button> |
|||
<button type="primary" @click="ftpLoopServerPath()">获取目录</button> |
|||
<button type="primary" @click="ftpDeleteServerFiles()">删除文件</button> |
|||
<button type="primary" @click="ftpDeleteServerFilesWithoutDirectory()">删除文件夹下面文件保留文件夹</button> |
|||
<button type="primary" @click="closeFTPConnect()">FTP断开连接</button> |
|||
|
|||
<button type="primary" style="margin-top: 16px;" @click="connectFtpsServer()">FTPS连接</button> |
|||
<button type="primary" @click="ftpsUploadFiles()">FTPS上传文件夹</button> |
|||
<button type="primary" @click="ftpsCreatNewDirectory()">FTPS新建文件夹</button> |
|||
<button type="primary" @click="ftpsUploadFile()">FTPS上传文件</button> |
|||
<button type="primary" @click="ftpsDownloadSingleFile()">FTPS单个文件下载</button> |
|||
<button type="primary" @click="ftpsLoopServerPath()">ftps获取目录</button> |
|||
<button type="primary" @click="ftpsDeleteServerFiles()">ftps删除文件</button> |
|||
<button type="primary" @click="ftpsDeleteServerFilesWithoutDirectory()">ftps删除文件夹下面文件保留文件夹</button> |
|||
<button type="primary" @click="closeFTPSConnect()">FTPS断开连接</button> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
var FTP = uni.requireNativePlugin('Zhimi-FTP-Module'); |
|||
export default { |
|||
data() { |
|||
return { |
|||
title: 'Hello', |
|||
} |
|||
}, |
|||
onLoad() { |
|||
// console.log(plus.io.convertLocalFileSystemURL('ceshi')); |
|||
}, |
|||
methods: { |
|||
// FTP连接 |
|||
connectFtpServer() { |
|||
//(“服务地址”, 端口, “用户名”,”密码“, 回调 ) |
|||
//回调 |
|||
//成功 {type : "connect", data : {data : "相应状态码:200 连接是否成功:true 连接是否有效:true}} |
|||
//失败 {type : "connect", data : {"error" : "失败原因"}} |
|||
// "192.168.50.1", 21, "hmgc", "hmgc" |
|||
// "192.168.50.131", 21, "hmftp", "hmftp" |
|||
FTP.connectFtpServer("192.168.50.1", 21, "hmgc", "hmgc", "gbk", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTP-上传文件夹至服务器FTP |
|||
ftpUploadFiles(ftpFwqName) { |
|||
//(“要上传的本地文件绝对路径”, “服务器文件夹名(/htdocs/fileName)”, 回调) |
|||
//回调 |
|||
//{type : "upload", data : {path : "本地上传文件地址", status : true/false, msg : "上传完成", error : "失败原因"}} |
|||
// /storage/emulated/0/Download/downladed_rom |
|||
var inputFile = plus.io.convertLocalFileSystemURL('/static') |
|||
console.log('inputFile文件夹', inputFile); |
|||
FTP.ftpUploadFile(inputFile, '/sda1/DDwifi', res => { |
|||
console.log(ftpFwqName, '文件夹-上传成功'); |
|||
console.log(res) |
|||
// 下载至安卓手机 |
|||
// this.ftpDownloadSingleFile(ftpFwqName) |
|||
}) |
|||
}, |
|||
// FTP-上传文件至FTP |
|||
ftpUploadFile() { |
|||
var inputFile = plus.io.convertLocalFileSystemURL('/static/logo.png') |
|||
console.log('inputFile文件', inputFile); |
|||
//同上 |
|||
FTP.ftpUploadFile(inputFile, '/sda1/deviceNewFile/20240919', res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTP-新建文件夹至FTP |
|||
ftpCreatNewDirectory() { |
|||
let ftpFwq = 0 |
|||
FTP.ftpCreatNewDirectory("/sda1/DDwifi", 'newDirectory', res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTP-单个文件下载至安卓机 |
|||
ftpDownloadSingleFile(ftpFwqName) { |
|||
//("要下载到本地文件夹的绝对路径", "要下载的服务器上文件的绝对路径", 回调) |
|||
//回调 |
|||
//{type : download, data : {status : true/false, name : "下载的文件名", errpr : "失败原因"}} |
|||
// var inputFile = plus.io.convertLocalFileSystemURL('/static') |
|||
var outputFile = plus.io.convertLocalFileSystemURL('_doc') |
|||
console.log(outputFile); |
|||
FTP.ftpDownloadSingleFile(outputFile, '/sda1/logicDelete/logo.png', res => { |
|||
// console.log(ftpFwqName,下载成功); |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 获取FTP服务器目录 |
|||
ftpLoopServerPath() { |
|||
//("获取服务器目录下文件,空白为根目录", 回调) |
|||
//回调 |
|||
//成功 {type : getFileInfo, data : [{name : "地址", size : 文件大小单位字节, time : “修改时间”}]} |
|||
//失败 {type : "error", data : "失败原因"} |
|||
FTP.ftpLoopServerPath("/sda1/DDwifi", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 删除FTP服务器文件 |
|||
ftpDeleteServerFiles() { |
|||
//("要删除的文件夹或文件地址", 回调) |
|||
//回调 |
|||
//{type : delete, data : {msg : "删除文件/删除文件夹(ps:先删除文件夹里面的文件再删文件夹)", data : "文件名", status : true/false, error : "失败原因"}} |
|||
FTP.ftpDeleteServerFiles('/sda1/DDwifi/logo.png', res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 删除FTP文件夹下面文件保留文件夹 |
|||
ftpDeleteServerFilesWithoutDirectory() { |
|||
//同上,不会删除指定文件夹 |
|||
FTP.ftpDeleteServerFilesWithoutDirectory("/sda1/DDwifi", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTP断开连接 |
|||
closeFTPConnect() { |
|||
console.log('点到了!!!!'); |
|||
//失败有回调,成功没有回调 |
|||
FTP.closeFTPConnect(res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
|
|||
// ----------ftps---------- |
|||
|
|||
// FTPS连接 |
|||
connectFtpsServer() { |
|||
FTP.connectFtpsServer("192.168.0.8", 21, "hmftp", "hmftp", "gbk", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS上传文件夹至服务器 |
|||
ftpsUploadFiles() { |
|||
var inputFile = plus.io.convertLocalFileSystemURL('/static') |
|||
console.log('inputFile文件夹', inputFile); |
|||
FTP.ftpsUploadFile(inputFile, "/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS上传文件 |
|||
ftpsUploadFile() { |
|||
var inputFile = plus.io.convertLocalFileSystemURL('/static/ceshi.txt') |
|||
FTP.ftpsUploadFile(inputFile, "/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS新建文件夹 |
|||
ftpsCreatNewDirectory() { |
|||
FTP.ftpsCreatNewDirectory("/sda1", "newDirectory", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS单个文件下载 |
|||
ftpsDownloadSingleFile() { |
|||
var outputFile = plus.io.convertLocalFileSystemURL('_doc') |
|||
console.log('outputFile', outputFile); |
|||
FTP.ftpsDownloadSingleFile(outputFile, "/sda1/ceshi.txt", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 获取FTPS服务器目录 |
|||
ftpsLoopServerPath() { |
|||
FTP.ftpsLoopServerPath("/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 删除FTPS服务器文件 |
|||
ftpsDeleteServerFiles() { |
|||
//("要删除的文件夹或文件地址", 回调) |
|||
//回调 |
|||
//{type : delete, data : {msg : "删除文件/删除文件夹(ps:先删除文件夹里面的文件再删文件夹)", data : "文件名", status : true/false, error : "失败原因"}} |
|||
FTP.ftpsDeleteServerFiles('/sda1/ceshi.txt', res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// 删除FTPS文件夹下面文件保留文件夹 |
|||
ftpsDeleteServerFilesWithoutDirectory() { |
|||
//同上,不会删除指定文件夹 |
|||
FTP.ftpsDeleteServerFilesWithoutDirectory("/sda1", res => { |
|||
console.log(res) |
|||
}) |
|||
}, |
|||
// FTPS断开连接 |
|||
closeFTPSConnect() { |
|||
console.log('点到了!!!!'); |
|||
FTP.closeFTPSConnect(res => { |
|||
console.log('点到了进来了!!!!'); |
|||
console.log(res) |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.content { |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
|
|||
.logo { |
|||
height: 200rpx; |
|||
width: 200rpx; |
|||
margin-top: 200rpx; |
|||
margin-left: auto; |
|||
margin-right: auto; |
|||
margin-bottom: 50rpx; |
|||
} |
|||
|
|||
.text-area { |
|||
display: flex; |
|||
justify-content: center; |
|||
} |
|||
|
|||
.title { |
|||
font-size: 36rpx; |
|||
color: #8f8f94; |
|||
} |
|||
</style> |
@ -0,0 +1 @@ |
|||
1 |
After Width: | Height: | Size: 3.9 KiB |
@ -0,0 +1,10 @@ |
|||
uni.addInterceptor({ |
|||
returnValue (res) { |
|||
if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) { |
|||
return res; |
|||
} |
|||
return new Promise((resolve, reject) => { |
|||
res.then((res) => res[0] ? reject(res[0]) : resolve(res[1])); |
|||
}); |
|||
}, |
|||
}); |
@ -0,0 +1,76 @@ |
|||
/** |
|||
* 这里是uni-app内置的常用样式变量 |
|||
* |
|||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 |
|||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App |
|||
* |
|||
*/ |
|||
|
|||
/** |
|||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 |
|||
* |
|||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 |
|||
*/ |
|||
|
|||
/* 颜色变量 */ |
|||
|
|||
/* 行为相关颜色 */ |
|||
$uni-color-primary: #007aff; |
|||
$uni-color-success: #4cd964; |
|||
$uni-color-warning: #f0ad4e; |
|||
$uni-color-error: #dd524d; |
|||
|
|||
/* 文字基本颜色 */ |
|||
$uni-text-color:#333;//基本色 |
|||
$uni-text-color-inverse:#fff;//反色 |
|||
$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 |
|||
$uni-text-color-placeholder: #808080; |
|||
$uni-text-color-disable:#c0c0c0; |
|||
|
|||
/* 背景颜色 */ |
|||
$uni-bg-color:#ffffff; |
|||
$uni-bg-color-grey:#f8f8f8; |
|||
$uni-bg-color-hover:#f1f1f1;//点击状态颜色 |
|||
$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 |
|||
|
|||
/* 边框颜色 */ |
|||
$uni-border-color:#c8c7cc; |
|||
|
|||
/* 尺寸变量 */ |
|||
|
|||
/* 文字尺寸 */ |
|||
$uni-font-size-sm:12px; |
|||
$uni-font-size-base:14px; |
|||
$uni-font-size-lg:16px; |
|||
|
|||
/* 图片尺寸 */ |
|||
$uni-img-size-sm:20px; |
|||
$uni-img-size-base:26px; |
|||
$uni-img-size-lg:40px; |
|||
|
|||
/* Border Radius */ |
|||
$uni-border-radius-sm: 2px; |
|||
$uni-border-radius-base: 3px; |
|||
$uni-border-radius-lg: 6px; |
|||
$uni-border-radius-circle: 50%; |
|||
|
|||
/* 水平间距 */ |
|||
$uni-spacing-row-sm: 5px; |
|||
$uni-spacing-row-base: 10px; |
|||
$uni-spacing-row-lg: 15px; |
|||
|
|||
/* 垂直间距 */ |
|||
$uni-spacing-col-sm: 4px; |
|||
$uni-spacing-col-base: 8px; |
|||
$uni-spacing-col-lg: 12px; |
|||
|
|||
/* 透明度 */ |
|||
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 |
|||
|
|||
/* 文章场景相关 */ |
|||
$uni-color-title: #2C405A; // 文章标题颜色 |
|||
$uni-font-size-title:20px; |
|||
$uni-color-subtitle: #555555; // 二级标题颜色 |
|||
$uni-font-size-subtitle:26px; |
|||
$uni-color-paragraph: #3F536E; // 文章段落颜色 |
|||
$uni-font-size-paragraph:15px; |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 2.0 KiB |
@ -0,0 +1,25 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh-CN"> |
|||
|
|||
<head> |
|||
<meta charset="UTF-8" /> |
|||
<script> |
|||
var __UniViewStartTime__ = Date.now(); |
|||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || |
|||
CSS.supports('top: constant(a)')) |
|||
document.write( |
|||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + |
|||
(coverSupport ? ', viewport-fit=cover' : '') + '" />') |
|||
</script> |
|||
<title>View</title> |
|||
<link rel="stylesheet" href="view.css" /> |
|||
</head> |
|||
|
|||
<body> |
|||
<div id="app"></div> |
|||
<script src="__uniappes6.js"></script> |
|||
<script src="view.umd.min.js"></script> |
|||
<script src="app-view.js"></script> |
|||
</body> |
|||
|
|||
</html> |
@ -0,0 +1,8 @@ |
|||
|
|||
var isReady=false;var onReadyCallbacks=[]; |
|||
var isServiceReady=false;var onServiceReadyCallbacks=[]; |
|||
var __uniConfig = {"pages":["pages/webPage/index"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"HUIMU眼科检查信息系统","compilerVersion":"3.8.12","entryPagePath":"pages/webPage/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; |
|||
var __uniRoutes = [{"path":"/pages/webPage/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"","enablePullDownRefresh":false}}]; |
|||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
|||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
|||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); |
@ -0,0 +1 @@ |
|||
(function(e){function r(r){for(var n,l,i=r[0],p=r[1],a=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in p)Object.prototype.hasOwnProperty.call(p,n)&&(e[n]=p[n]);f&&f(r);while(s.length)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var p=t[i];0!==o[p]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={"app-config":0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e["default"]}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this["webpackJsonp"]=this["webpackJsonp"]||[],p=i.push.bind(i);i.push=r,i=i.slice();for(var a=0;a<i.length;a++)r(i[a]);var f=p;t()})([]); |
@ -0,0 +1 @@ |
|||
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__030605A","name":"HUIMU眼科检查信息系统","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"bluetooth":{},"Bluetooth":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"autoclose":true,"delay":0,"target":"id:1","waiting":true},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>","<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>","<uses-permission android:name=\"android.permission.BLUETOOTH\"/>","<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>","<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>","<uses-permission android:name=\"android.permission.BLUETOOTH_SCAN\"/>","<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\"/>","<uses-permission android:name=\"android.permission.ACCESS_BACKGROUND_LOCATION\"/>","<uses-permission android:name=\"android.permission.USB_PERMISSION\"/>","<uses-permission android:name=\"android.permission.MANAGE_USB\"/>"],"packagename":"uni.UNI030605A","aliasname":"","password":"","keystore":"html5plus://test","custompermissions":true},"apple":{"dSYMs":false,"plistcmds":["Add :UIFileSharingEnabled bool true"],"devices":"universal"},"plugins":{"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}},"debug":true,"syncDebug":true,"orientation":"portrait-primary"},"nativePlugins":{"zhimiFTP":{},"Zhimi-UsbSerial":{},"ZS-Bugly":{}},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.8.12","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html","adid":"127892240008"}} |
@ -0,0 +1,18 @@ |
|||
{ |
|||
"name": "ZS-Bugly", |
|||
"id": "ZS-Bugly", |
|||
"version": "1.3.0", |
|||
"description": "捕获系统错误", |
|||
"_dp_type": "nativeplugin", |
|||
"_dp_nativeplugin": { |
|||
"android": { |
|||
"plugins": [{ |
|||
"type": "module", |
|||
"name": "ZS-Bugly", |
|||
"class": "com.example.bugly.buglyModule" |
|||
}], |
|||
"integrateType": "aar", |
|||
"minSdkVersion": 16 |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,24 @@ |
|||
{ |
|||
"name": "Usb通讯插件", |
|||
"id": "Zhimi-UsbSerial", |
|||
"version": "1.0", |
|||
"description": "Usb通讯插件", |
|||
"_dp_type":"nativeplugin", |
|||
"_dp_nativeplugin":{ |
|||
"android": { |
|||
"plugins": [ |
|||
{ |
|||
"type": "module", |
|||
"name": "Zhimi-UsbSerial", |
|||
"class": "com.zhimi.usbserial.UsbSerialModule" |
|||
} |
|||
], |
|||
"hooksClass": "com.zhimi.usbserial.UsbSerialAppProxy", |
|||
"integrateType": "aar", |
|||
"dependencies": [ |
|||
"com.github.mik3y:usb-serial-for-android:3.4.3" |
|||
], |
|||
"minSdkVersion": "21" |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
{ |
|||
"name": "zhimiFTP", |
|||
"id": "zhimiFTP", |
|||
"version": "1.0.0", |
|||
"description": "FTP插件", |
|||
"_dp_type": "nativeplugin", |
|||
"_dp_nativeplugin": { |
|||
"android": { |
|||
"plugins": [ |
|||
{ |
|||
"type": "module", |
|||
"name": "Zhimi-FTP-Module", |
|||
"class": "com.example.zhimiftp.zhimiFTPModule" |
|||
} |
|||
], |
|||
"integrateType": "aar", |
|||
"minSdkVersion": "21", |
|||
"dependencies": [ |
|||
"commons-net:commons-net:3.8.0" |
|||
] |
|||
} |
|||
} |
|||
} |
@ -0,0 +1 @@ |
|||
1 |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 2.0 KiB |
@ -0,0 +1,25 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh-CN"> |
|||
|
|||
<head> |
|||
<meta charset="UTF-8" /> |
|||
<script> |
|||
var __UniViewStartTime__ = Date.now(); |
|||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || |
|||
CSS.supports('top: constant(a)')) |
|||
document.write( |
|||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + |
|||
(coverSupport ? ', viewport-fit=cover' : '') + '" />') |
|||
</script> |
|||
<title>View</title> |
|||
<link rel="stylesheet" href="view.css" /> |
|||
</head> |
|||
|
|||
<body> |
|||
<div id="app"></div> |
|||
<script src="__uniappes6.js"></script> |
|||
<script src="view.umd.min.js"></script> |
|||
<script src="app-view.js"></script> |
|||
</body> |
|||
|
|||
</html> |
@ -0,0 +1,8 @@ |
|||
|
|||
var isReady=false;var onReadyCallbacks=[]; |
|||
var isServiceReady=false;var onServiceReadyCallbacks=[]; |
|||
var __uniConfig = {"pages":["pages/webPage/index"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"HUIMU眼科检查信息系统","compilerVersion":"3.8.12","entryPagePath":"pages/webPage/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; |
|||
var __uniRoutes = [{"path":"/pages/webPage/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"","enablePullDownRefresh":false}}]; |
|||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
|||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
|||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); |
@ -0,0 +1 @@ |
|||
(function(e){function r(r){for(var n,l,i=r[0],p=r[1],a=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in p)Object.prototype.hasOwnProperty.call(p,n)&&(e[n]=p[n]);f&&f(r);while(s.length)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var p=t[i];0!==o[p]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={"app-config":0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e["default"]}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this["webpackJsonp"]=this["webpackJsonp"]||[],p=i.push.bind(i);i.push=r,i=i.slice();for(var a=0;a<i.length;a++)r(i[a]);var f=p;t()})([]); |
@ -0,0 +1 @@ |
|||
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__030605A","name":"HUIMU眼科检查信息系统","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"bluetooth":{},"Bluetooth":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>","<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>","<uses-permission android:name=\"android.permission.BLUETOOTH\"/>","<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>","<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>","<uses-permission android:name=\"android.permission.BLUETOOTH_SCAN\"/>","<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\"/>","<uses-permission android:name=\"android.permission.ACCESS_BACKGROUND_LOCATION\"/>","<uses-permission android:name=\"android.permission.USB_PERMISSION\"/>","<uses-permission android:name=\"android.permission.MANAGE_USB\"/>"]},"apple":{"dSYMs":false},"plugins":{"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"nativePlugins":{"zhimiFTP":{"__plugin_info__":{"name":"zhimiFTP","description":"FTP插件","platforms":"Android","url":"","android_package_name":"","ios_bundle_id":"","isCloud":false,"bought":-1,"pid":"","parameters":{}}},"Zhimi-UsbSerial":{"__plugin_info__":{"name":"Usb通讯插件","description":"Usb通讯插件","platforms":"Android","url":"","android_package_name":"","ios_bundle_id":"","isCloud":false,"bought":-1,"pid":"","parameters":{}}},"ZS-Bugly":{"__plugin_info__":{"name":"ZS-Bugly","description":"捕获系统错误","platforms":"Android","url":"","android_package_name":"","ios_bundle_id":"","isCloud":false,"bought":-1,"pid":"","parameters":{}}}},"uniStatistics":{"enable":false},"allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.8.12","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html"}} |
@ -0,0 +1 @@ |
|||
1 |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 2.0 KiB |
@ -0,0 +1,25 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh-CN"> |
|||
|
|||
<head> |
|||
<meta charset="UTF-8" /> |
|||
<script> |
|||
var __UniViewStartTime__ = Date.now(); |
|||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || |
|||
CSS.supports('top: constant(a)')) |
|||
document.write( |
|||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + |
|||
(coverSupport ? ', viewport-fit=cover' : '') + '" />') |
|||
</script> |
|||
<title>View</title> |
|||
<link rel="stylesheet" href="view.css" /> |
|||
</head> |
|||
|
|||
<body> |
|||
<div id="app"></div> |
|||
<script src="__uniappes6.js"></script> |
|||
<script src="view.umd.min.js"></script> |
|||
<script src="app-view.js"></script> |
|||
</body> |
|||
|
|||
</html> |
@ -0,0 +1,8 @@ |
|||
|
|||
var isReady=false;var onReadyCallbacks=[]; |
|||
var isServiceReady=false;var onServiceReadyCallbacks=[]; |
|||
var __uniConfig = {"pages":["pages/webPage/index"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"HUIMU眼科检查信息系统","compilerVersion":"3.8.12","entryPagePath":"pages/webPage/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; |
|||
var __uniRoutes = [{"path":"/pages/webPage/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"","enablePullDownRefresh":false}}]; |
|||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
|||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); |
|||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}}); |