{ | { | ||||
"pages": [ | "pages": [ | ||||
"pages/index/index", | "pages/index/index", | ||||
"pages/wifiList/wifiList" | |||||
"pages/serverConfig/serverConfig", | |||||
"pages/wifiList/wifiList", | |||||
"pages/funcList/funcList" | |||||
], | ], | ||||
"window": { | "window": { | ||||
"navigationBarBackgroundColor": "#0082FE", | "navigationBarBackgroundColor": "#0082FE", |
// pages/funcList/funcList.js | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
}, | |||||
wifiConfig() { | |||||
wx.navigateTo({ | |||||
url: '../wifiList/wifiList', | |||||
}) | |||||
}, | |||||
serverConfig() { | |||||
wx.navigateTo({ | |||||
url: '../serverConfig/serverConfig', | |||||
}) | |||||
}, | |||||
}) |
{ | |||||
"usingComponents": {} | |||||
} |
<!--pages/funcList/funcList.wxml--> | |||||
<wxs module="utils"> | |||||
module.exports.max = function(n1, n2) { | |||||
return Math.max(n1, n2) | |||||
} | |||||
module.exports.len = function(arr) { | |||||
arr = arr || [] | |||||
return arr.length | |||||
} | |||||
</wxs> | |||||
<view class="container"> | |||||
<view class="header"> | |||||
<button bindtap="wifiConfig" style="font-size: 32rpx;line-height:100rpx;width: 100%;">配置wifi</button> | |||||
<button bindtap="serverConfig" style="font-size: 32rpx;line-height:100rpx;width: 100%;">配置云服务器</button> | |||||
</view> | |||||
</view> | |||||
/* pages/funcList/funcList.wxss */ | |||||
page { | |||||
background: #f0f0f0; | |||||
color: #333; | |||||
} | |||||
.container{ | |||||
padding-bottom: 200rpx; | |||||
} | |||||
.header{ | |||||
width: 100%; | |||||
} | |||||
.container button{ | |||||
padding-top: 0; | |||||
padding-bottom: 0; | |||||
border: 1px solid #ddd; | |||||
} |
Page({ | Page({ | ||||
data: { | data: { | ||||
showWriteInput: false, | showWriteInput: false, | ||||
devices: [ | |||||
// { | |||||
// deviceId: "02:03:04:05:06:07", | |||||
// name: "elink", | |||||
// localName: "elink", | |||||
// mac: "02:03:04:05:06:07", | |||||
// RSSI: -69, | |||||
// advertisServiceUUIDs:[ | |||||
// "FFE0","FFC0" | |||||
// ], | |||||
// analyzeDataText:"0102003241123413" | |||||
// } | |||||
], | |||||
devices: [], | |||||
connected: false, | connected: false, | ||||
chs: [], | chs: [], | ||||
cmd: '', | cmd: '', | ||||
historyList: [], | historyList: [], | ||||
}, | }, | ||||
onLoad: function () { | onLoad: function () { | ||||
var that=this; | |||||
wx.getSystemInfo({ | |||||
success: function(res) { | |||||
if (res.platform === 'devtools') { | |||||
let devices = [{ | |||||
deviceId: "02:03:04:05:06:07", | |||||
name: "elink", | |||||
localName: "elink", | |||||
mac: "02:03:04:05:06:07", | |||||
RSSI: -69, | |||||
advertisServiceUUIDs:[ "FFE0","FFC0" ], | |||||
analyzeDataText:"0102003241123413" | |||||
}] | |||||
that.setData({ | |||||
devices: devices | |||||
}) | |||||
} | |||||
} | |||||
}) | |||||
let historyList = [] | let historyList = [] | ||||
historyList = wx.getStorageSync('historyList') | historyList = wx.getStorageSync('historyList') | ||||
this.setData({ | this.setData({ | ||||
toConnectWifi() { | toConnectWifi() { | ||||
this.offBLECharacteristicValueChange() | this.offBLECharacteristicValueChange() | ||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: '../wifiList/wifiList', | |||||
// url: '../wifiList/wifiList', | |||||
url: '../funcList/funcList', | |||||
}) | }) | ||||
}, | }, | ||||
title: '请打开蓝牙', | title: '请打开蓝牙', | ||||
icon: "none" | icon: "none" | ||||
}) | }) | ||||
wx.onBluetoothAdapterStateChange( (res)=> { | |||||
wx.onBluetoothAdapterStateChange(function (res) { | |||||
console.log('onBluetoothAdapterStateChange', res) | console.log('onBluetoothAdapterStateChange', res) | ||||
if (res.available) { | if (res.available) { | ||||
this.startBluetoothDevicesDiscovery() | this.startBluetoothDevicesDiscovery() | ||||
this._discoveryStarted = true | this._discoveryStarted = true | ||||
wx.startBluetoothDevicesDiscovery({ | wx.startBluetoothDevicesDiscovery({ | ||||
allowDuplicatesKey: true, | allowDuplicatesKey: true, | ||||
interval: 1000,//上报设备的间隔 | |||||
services: [ | services: [ | ||||
"FFE0", | "FFE0", | ||||
], | ], | ||||
const data = {} | const data = {} | ||||
// console.log(device) | // console.log(device) | ||||
// console.log(ab2hex(device.advertisData)) | // console.log(ab2hex(device.advertisData)) | ||||
let buff = device.advertisData.slice(-6) | |||||
device.mac = new Uint8Array(buff) // 保存广播数据中的mac地址,这是由于iOS不直接返回mac地址 | |||||
let tempMac = Array.from(device.mac) | |||||
tempMac.reverse() | |||||
device.macAddr = ab2hex(tempMac, ':').toUpperCase() | |||||
device.analyzeDataText = ab2hex(device.advertisData).replace(/,/g, '').toUpperCase() | |||||
let buff = device.advertisData.slice(-6) | |||||
device.mac = new Uint8Array(buff) // 保存广播数据中的mac地址,这是由于iOS不直接返回mac地址 | |||||
let tempMac = Array.from(device.mac) | |||||
tempMac.reverse() | |||||
device.macAddr = ab2hex(tempMac, ':').toUpperCase() | |||||
if (idx === -1) { | if (idx === -1) { | ||||
data[`devices[${foundDevices.length}]`] = device | data[`devices[${foundDevices.length}]`] = device | ||||
} else { | } else { | ||||
} | } | ||||
this.setData(data) | this.setData(data) | ||||
}) | }) | ||||
// 按RSSI值排序 | |||||
this.data.devices.sort((a,b)=>{ | |||||
return b.RSSI - a.RSSI | |||||
}) | |||||
}) | }) | ||||
}, | }, | ||||
// 连接低功耗蓝牙设备 | // 连接低功耗蓝牙设备 | ||||
this.toConnectWifi() | this.toConnectWifi() | ||||
},500) | },500) | ||||
} else if (bleData.status == 1) { | } else if (bleData.status == 1) { | ||||
console.log('A7-----^') | |||||
let payload = bleData.data //对应协议中的payload数据,可以自行解析该数据 | |||||
// console.log(ab2hex(payload, ' ')) | |||||
// console.log(ab2hex(bleData.completeData, ' ')) | |||||
const idx = inArray(this.data.chs, 'uuid', characteristic.characteristicId) | |||||
const data = {} | |||||
if (idx === -1) { | |||||
data[`chs[${this.data.chs.length}]`] = { | |||||
uuid: characteristic.characteristicId, | |||||
value: ab2hex(bleData.completeData, ' ') | |||||
} | |||||
} else { | |||||
data[`chs[${idx}]`] = { | |||||
uuid: characteristic.characteristicId, | |||||
value: ab2hex(bleData.completeData, ' ') | |||||
} | |||||
} | |||||
this.setData(data) | |||||
} else if (bleData.status == 2) { | } else if (bleData.status == 2) { | ||||
console.log('A6-----^') | console.log('A6-----^') | ||||
} | } | ||||
wx.closeBluetoothAdapter() | wx.closeBluetoothAdapter() | ||||
this._discoveryStarted = false | this._discoveryStarted = false | ||||
}, | }, | ||||
// 打开指令输入框 | |||||
showWriteInputView() { | |||||
this.setData({ | |||||
showWriteInput: true | |||||
}) | |||||
}, | |||||
// 关闭指令输入框 | |||||
hideWriteInputView() { | |||||
this.setData({ | |||||
showWriteInput: false | |||||
}) | |||||
}, | |||||
// 指令下发 | |||||
submitCmd(e, cmd) { | |||||
let arr = [] | |||||
let temp = [] | |||||
if (!cmd) { | |||||
cmd = this.data.cmd | |||||
} | |||||
console.log(cmd) | |||||
if(!cmd || !this.data.connected){ | |||||
return | |||||
} | |||||
if(cmd.indexOf(",") == -1){ | |||||
temp = cmd.split(" ") | |||||
} else { | |||||
temp = cmd.split(",") | |||||
} | |||||
let tempCmd = temp.join(' ') | |||||
for(let i = 0; i < temp.length; i++){ | |||||
arr[i] = parseInt(temp[i],16) | |||||
} | |||||
// let arr = [ | |||||
// 0xA6, | |||||
// 0x01, | |||||
// 0x28, | |||||
// 0x29, | |||||
// 0x6A, | |||||
// //A6 01 28 29 6A | |||||
// ] | |||||
if(arr[0] == 0xA6){ | |||||
let len = arr[1] | |||||
let payload = arr.slice(2, 2 + len) | |||||
plugin.sendDataOfA6(payload) | |||||
// let buff = new Uint8Array(arr).buffer | |||||
// this.writeBLECharacteristicValue(buff, this.uuid3, this._deviceId, this._serviceId) | |||||
} else if(arr[0] == 0xA7) { | |||||
let len = arr[3] | |||||
let payload = arr.slice(4, 4 + len) | |||||
plugin.sendDataOfA7(payload) | |||||
} | |||||
let historyList = wx.getStorageSync('historyList') || [] | |||||
let idx = historyList.findIndex(item => item.cmd == tempCmd) | |||||
if (idx < 0) { | |||||
historyList.push({cmd: tempCmd}) | |||||
} | |||||
this.setData({ | |||||
historyList | |||||
}) | |||||
wx.setStorage({ | |||||
data: historyList, | |||||
key: 'historyList', | |||||
}) | |||||
wx.showToast({ | |||||
title: '已发送', | |||||
icon: 'none' | |||||
}) | |||||
}, | |||||
history_delete(e) { | |||||
let index = e.currentTarget.dataset.index | |||||
this.data.historyList.splice(index, 1) | |||||
this.setData({ | |||||
historyList: this.data.historyList | |||||
}) | |||||
wx.setStorage({ | |||||
data: this.data.historyList, | |||||
key: 'historyList', | |||||
}) | |||||
}, | |||||
history_copy(e) { | |||||
let index = e.currentTarget.dataset.index | |||||
wx.setClipboardData({ | |||||
data: this.data.historyList[index].cmd | |||||
}) | |||||
}, | |||||
history_send(e) { | |||||
let index = e.currentTarget.dataset.index | |||||
let cmd = this.data.historyList[index].cmd | |||||
this.submitCmd(null, cmd) | |||||
}, | |||||
}); | }); |
<wxs module="utils"> | |||||
module.exports.max = function(n1, n2) { | |||||
return Math.max(n1, n2) | |||||
} | |||||
module.exports.len = function(arr) { | |||||
arr = arr || [] | |||||
return arr.length | |||||
} | |||||
</wxs> | |||||
<view class="container"> | |||||
<view class="header"> | |||||
<button bindtap="openBluetoothAdapter" style="font-size: 32rpx;line-height:100rpx;width: 100%;">开始扫描</button> | |||||
<button bindtap="stopBluetoothDevicesDiscovery" style="font-size: 32rpx;line-height:100rpx;width: 100%;">停止扫描</button> | |||||
<button bindtap="closeBluetoothAdapter" style="font-size: 32rpx;line-height:100rpx;width: 100%;">结束流程</button> | |||||
</view> | |||||
<view class="devices_summary">已发现 {{devices.length}} 个外围设备:</view> | |||||
<scroll-view class="device_list" scroll-y scroll-with-animation> | |||||
<view wx:for="{{devices}}" wx:key="index" | |||||
data-device-id="{{item.deviceId}}" | |||||
data-name="{{item.name || item.localName}}" | |||||
data-mac="{{item.mac}}" | |||||
data-index="{{index}}" | |||||
bindtap="createBLEConnection" | |||||
class="device_item" | |||||
hover-class="device_item_hover"> | |||||
<view style="font-size: 32rpx;"> | |||||
<text style="color:#000;font-weight:bold">{{item.name}}</text> | |||||
<text style="font-size:26rpx">(信号强度: {{item.RSSI}}dBm)</text> | |||||
</view> | |||||
<view style="font-size: 26rpx">mac地址: {{item.macAddr || item.deviceId}}</view> | |||||
<!-- <view style="font-size: 10px">Service数量: {{utils.len(item.advertisServiceUUIDs)}}</view> --> | |||||
<view style="font-size: 26rpx">广播数据:{{item.analyzeDataText}}</view> | |||||
</view> | |||||
</scroll-view> | |||||
</view> | |||||
<wxs module="utils"> | |||||
module.exports.max = function(n1, n2) { | |||||
return Math.max(n1, n2) | |||||
} | |||||
module.exports.len = function(arr) { | |||||
arr = arr || [] | |||||
return arr.length | |||||
} | |||||
</wxs> | |||||
<view class="container"> | |||||
<view class="header"> | |||||
<button bindtap="openBluetoothAdapter" style="font-size: 32rpx;line-height:100rpx;width: 100%;">开始扫描</button> | |||||
<button bindtap="stopBluetoothDevicesDiscovery" style="font-size: 32rpx;line-height:100rpx;width: 100%;">停止扫描</button> | |||||
<button bindtap="closeBluetoothAdapter" style="font-size: 32rpx;line-height:100rpx;width: 100%;">结束流程</button> | |||||
</view> | |||||
<view class="devices_summary">已发现 {{devices.length}} 个外围设备:</view> | |||||
<scroll-view class="device_list" scroll-y scroll-with-animation> | |||||
<view wx:for="{{devices}}" wx:key="index" | |||||
data-device-id="{{item.deviceId}}" | |||||
data-name="{{item.name || item.localName}}" | |||||
data-mac="{{item.mac}}" | |||||
data-index="{{index}}" | |||||
bindtap="createBLEConnection" | |||||
class="device_item" | |||||
hover-class="device_item_hover"> | |||||
<view style="font-size: 32rpx;"> | |||||
<text style="color:#000;font-weight:bold">{{item.name}}</text> | |||||
<text style="font-size:26rpx">(信号强度: {{item.RSSI}}dBm)</text> | |||||
</view> | |||||
<view style="font-size: 26rpx">mac地址: {{item.macAddr || item.deviceId}}</view> | |||||
<!-- <view style="font-size: 10px">Service数量: {{utils.len(item.advertisServiceUUIDs)}}</view> --> | |||||
<view style="font-size: 26rpx">广播数据:{{item.analyzeDataText}}</view> | |||||
</view> | |||||
</scroll-view> | |||||
</view> | |||||
page { | |||||
background: #f0f0f0; | |||||
color: #333; | |||||
} | |||||
.container{ | |||||
padding-bottom: 200rpx; | |||||
} | |||||
.header{ | |||||
width: 100%; | |||||
} | |||||
.container button{ | |||||
padding-top: 0; | |||||
padding-bottom: 0; | |||||
border: 1px solid #ddd; | |||||
} | |||||
.devices_summary { | |||||
width: 100%; | |||||
line-height: 70rpx; | |||||
padding: 0 30rpx; | |||||
margin-top: 30rpx; | |||||
font-size: 32rpx; | |||||
} | |||||
.device_list { | |||||
flex: 1; | |||||
width: 100%; | |||||
height: calc(100vh - 600rpx); | |||||
margin-top: 0; | |||||
border: 1px solid #fff; | |||||
border-radius: 5px; | |||||
background: #fff; | |||||
} | |||||
.device_item { | |||||
line-height: 1.5; | |||||
padding: 10rpx 30rpx; | |||||
border-bottom: 1px solid #EEE; | |||||
} | |||||
.device_item_hover { | |||||
background-color: rgba(0, 0, 0, .1); | |||||
} | |||||
.connected_info { | |||||
position: fixed; | |||||
bottom: 0; | |||||
width: 100%; | |||||
height: 200rpx; | |||||
padding: 10px; | |||||
border-top: 1px solid #ddd; | |||||
background-color: #fff; | |||||
font-size: 14px; | |||||
box-shadow: 0px -4rpx 4rpx 0px rgba(0,0,0,.05); | |||||
} | |||||
.connected_info .operation { | |||||
position: absolute; | |||||
display: inline-block; | |||||
right: 30rpx; | |||||
} | |||||
.writeInputViewBg{ | |||||
position: fixed; | |||||
top: 0; | |||||
left: 0; | |||||
right: 0; | |||||
bottom: 0; | |||||
z-index: 1000; | |||||
background-color: rgba(0,0,0,0.5); | |||||
} | |||||
.writeInputView{ | |||||
position: fixed; | |||||
bottom: 200rpx; | |||||
left: 0; | |||||
z-index: 1001; | |||||
display: flex; | |||||
flex-direction: column; | |||||
align-items: center; | |||||
width: 100%; | |||||
height: calc(100vh - 500rpx); | |||||
background-color: #fff; | |||||
border-top: 1px solid #ddd; | |||||
} | |||||
.history{ | |||||
position: relative; | |||||
flex: 1; | |||||
width: 690rpx; | |||||
padding-top: 60rpx; | |||||
border: 1px solid #ddd; | |||||
margin: 30rpx; | |||||
} | |||||
.history_title{ | |||||
position: absolute; | |||||
top: 0; | |||||
left: 0; | |||||
padding: 0 30rpx; | |||||
line-height: 60rpx; | |||||
font-size: 30rpx; | |||||
} | |||||
.history_wrap{ | |||||
width: 100%; | |||||
height: 100%; | |||||
} | |||||
.history_item{ | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: space-between; | |||||
width: 100%; | |||||
height: 72rpx; | |||||
padding: 0 30rpx; | |||||
border-top: 1px solid #ddd; | |||||
} | |||||
.history_cmd{ | |||||
flex: 1; | |||||
overflow: hidden; | |||||
text-overflow: ellipsis; | |||||
white-space: nowrap; | |||||
font-size: 24rpx; | |||||
} | |||||
.history_btns{ | |||||
height: 60rpx; | |||||
overflow: hidden; | |||||
} | |||||
.writeInput{ | |||||
margin-top: 30rpx; | |||||
width: 690rpx; | |||||
height: 80rpx; | |||||
border: 1rpx solid #ccc; | |||||
} | |||||
.writeInput input{ | |||||
width: 100%; | |||||
height: 100%; | |||||
padding: 10rpx; | |||||
font-size: 32rpx; | |||||
} | |||||
.hint{ | |||||
padding-top: 10rpx; | |||||
font-size: 24rpx; | |||||
color: #999; | |||||
} | |||||
.btns{ | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: space-between; | |||||
width: 60%; | |||||
padding-bottom: 30rpx; | |||||
margin-top: 30rpx; | |||||
page { | |||||
background: #f0f0f0; | |||||
color: #333; | |||||
} | |||||
.container{ | |||||
padding-bottom: 200rpx; | |||||
} | |||||
.header{ | |||||
width: 100%; | |||||
} | |||||
.container button{ | |||||
padding-top: 0; | |||||
padding-bottom: 0; | |||||
border: 1px solid #ddd; | |||||
} | |||||
.devices_summary { | |||||
width: 100%; | |||||
line-height: 70rpx; | |||||
padding: 0 30rpx; | |||||
margin-top: 30rpx; | |||||
font-size: 32rpx; | |||||
} | |||||
.device_list { | |||||
flex: 1; | |||||
width: 100%; | |||||
height: calc(100vh - 600rpx); | |||||
margin-top: 0; | |||||
border: 1px solid #fff; | |||||
border-radius: 5px; | |||||
background: #fff; | |||||
} | |||||
.device_item { | |||||
line-height: 1.5; | |||||
padding: 10rpx 30rpx; | |||||
border-bottom: 1px solid #EEE; | |||||
} | |||||
.device_item_hover { | |||||
background-color: rgba(0, 0, 0, .1); | |||||
} | |||||
.connected_info { | |||||
position: fixed; | |||||
bottom: 0; | |||||
width: 100%; | |||||
height: 200rpx; | |||||
padding: 10px; | |||||
border-top: 1px solid #ddd; | |||||
background-color: #fff; | |||||
font-size: 14px; | |||||
box-shadow: 0px -4rpx 4rpx 0px rgba(0,0,0,.05); | |||||
} | |||||
.connected_info .operation { | |||||
position: absolute; | |||||
display: inline-block; | |||||
right: 30rpx; | |||||
} | |||||
.writeInputViewBg{ | |||||
position: fixed; | |||||
top: 0; | |||||
left: 0; | |||||
right: 0; | |||||
bottom: 0; | |||||
z-index: 1000; | |||||
background-color: rgba(0,0,0,0.5); | |||||
} | |||||
.writeInputView{ | |||||
position: fixed; | |||||
bottom: 200rpx; | |||||
left: 0; | |||||
z-index: 1001; | |||||
display: flex; | |||||
flex-direction: column; | |||||
align-items: center; | |||||
width: 100%; | |||||
height: calc(100vh - 500rpx); | |||||
background-color: #fff; | |||||
border-top: 1px solid #ddd; | |||||
} | |||||
.history{ | |||||
position: relative; | |||||
flex: 1; | |||||
width: 690rpx; | |||||
padding-top: 60rpx; | |||||
border: 1px solid #ddd; | |||||
margin: 30rpx; | |||||
} | |||||
.history_title{ | |||||
position: absolute; | |||||
top: 0; | |||||
left: 0; | |||||
padding: 0 30rpx; | |||||
line-height: 60rpx; | |||||
font-size: 30rpx; | |||||
} | |||||
.history_wrap{ | |||||
width: 100%; | |||||
height: 100%; | |||||
} | |||||
.history_item{ | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: space-between; | |||||
width: 100%; | |||||
height: 72rpx; | |||||
padding: 0 30rpx; | |||||
border-top: 1px solid #ddd; | |||||
} | |||||
.history_cmd{ | |||||
flex: 1; | |||||
overflow: hidden; | |||||
text-overflow: ellipsis; | |||||
white-space: nowrap; | |||||
font-size: 24rpx; | |||||
} | |||||
.history_btns{ | |||||
height: 60rpx; | |||||
overflow: hidden; | |||||
} | |||||
.writeInput{ | |||||
margin-top: 30rpx; | |||||
width: 690rpx; | |||||
height: 80rpx; | |||||
border: 1rpx solid #ccc; | |||||
} | |||||
.writeInput input{ | |||||
width: 100%; | |||||
height: 100%; | |||||
padding: 10rpx; | |||||
font-size: 32rpx; | |||||
} | |||||
.hint{ | |||||
padding-top: 10rpx; | |||||
font-size: 24rpx; | |||||
color: #999; | |||||
} | |||||
.btns{ | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: space-between; | |||||
width: 60%; | |||||
padding-bottom: 30rpx; | |||||
margin-top: 30rpx; | |||||
} | } |
// pages/serverConfig/serverConfig.js | |||||
const util = require("../../utils/util"); | |||||
const { | |||||
ab2hex | |||||
} = util; | |||||
const plugin = requirePlugin("sdkPlugin").AiLink; | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
serverAddress: '', | |||||
serverPort: '', | |||||
serverPath: '', | |||||
pwdModal: false, | |||||
itemIndex: 0, | |||||
serverAddressInput: '', | |||||
serverPortInput: '', | |||||
serverPathInput: '', | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
wx.onBLECharacteristicValueChange((characteristic) => { | |||||
// 解析特征值,返回解密后的数据 | |||||
let bleData = plugin.parseBleData(characteristic.value) | |||||
// console.log(bleData) | |||||
this.dealBleData(bleData) | |||||
}) | |||||
this.getServerAddress() | |||||
this.getServerPort() | |||||
this.getServerPath() | |||||
}, | |||||
showModal() { | |||||
this.setData({ | |||||
pwdModal: true | |||||
}) | |||||
}, | |||||
closeModal() { | |||||
this.setData({ | |||||
pwdModal: false | |||||
}) | |||||
}, | |||||
tapItem(e) { | |||||
let index = e.currentTarget.dataset.index | |||||
this.setData({ | |||||
itemIndex: index | |||||
}) | |||||
console.log('tapItem()', index) | |||||
this.showModal() | |||||
}, | |||||
confirm() { | |||||
console.log('confirm()') | |||||
if (this.data.itemIndex === 0) { | |||||
this.setServerAddress() | |||||
} else if (this.data.itemIndex === 1) { | |||||
this.setServerPort() | |||||
} else if (this.data.itemIndex === 2) { | |||||
this.setServerPath() | |||||
} | |||||
this.closeModal() | |||||
}, | |||||
/** | |||||
* 处理数据 | |||||
*/ | |||||
dealBleData(bleData) { | |||||
if (bleData.status == 0) { | |||||
console.log("握手成功") | |||||
} else if (bleData.status == 1) { | |||||
console.log('A7-----^') | |||||
} else if (bleData.status == 2) { | |||||
console.log(bleData) | |||||
console.log('A6-----^') | |||||
let payload = bleData.data | |||||
const result = ['成功', '失败', '不支持'] | |||||
switch (payload[0]) { | |||||
case 0x8B: { | |||||
wx.hideLoading() | |||||
wx.showToast({ | |||||
title: '设置服务器地址' + result[payload[1]], | |||||
icon: 'none' | |||||
}) | |||||
console.log('设置服务器地址' + result[payload[1]]) | |||||
break; | |||||
} | |||||
case 0x8C: { | |||||
console.log('上报服务器地址') | |||||
let end = payload[1] | |||||
if (end === 0) wx.hideLoading() | |||||
let nameArr = payload.slice(2) | |||||
console.log('原始数据===>' + ab2hex(nameArr, ' ')) | |||||
let nameStr = nameArr.length ? util.hex2str(nameArr) : '' | |||||
console.log('nameStr: ' + nameStr) | |||||
nameStr = this.data.serverAddress + nameStr | |||||
this.setData({ | |||||
serverAddress: nameStr | |||||
}) | |||||
break | |||||
} | |||||
case 0x8D: { | |||||
wx.hideLoading() | |||||
wx.showToast({ | |||||
title: '设置服务器端口' + result[payload[1]], | |||||
icon: 'none' | |||||
}) | |||||
console.log('设置服务器端口' + result[payload[1]]) | |||||
break; | |||||
} | |||||
case 0x8E: { | |||||
console.log('上报服务器端口') | |||||
wx.hideLoading() | |||||
let port = payload[1]<<8 | payload[2] | |||||
console.log('port: ' + port) | |||||
this.setData({ | |||||
serverPort: port | |||||
}) | |||||
break | |||||
} | |||||
case 0x96: { | |||||
wx.hideLoading() | |||||
wx.showToast({ | |||||
title: '设置服务器路径' + result[payload[1]], | |||||
icon: 'none' | |||||
}) | |||||
console.log('设置服务器路径' + result[payload[1]]) | |||||
break; | |||||
} | |||||
case 0x97: { | |||||
console.log('上报服务器路径') | |||||
let end = payload[1] | |||||
if (end === 0) wx.hideLoading() | |||||
let nameArr = payload.slice(2) | |||||
console.log('原始数据===>' + ab2hex(nameArr, ' ')) | |||||
let nameStr = nameArr.length ? util.hex2str(nameArr) : '' | |||||
console.log('nameStr: ' + nameStr) | |||||
nameStr = this.data.serverPath + nameStr | |||||
this.setData({ | |||||
serverPath: nameStr | |||||
}) | |||||
break | |||||
} | |||||
} | |||||
} | |||||
}, | |||||
/** | |||||
* 设置服务器地址 | |||||
*/ | |||||
setServerAddress() { | |||||
let str = this.data.serverAddressInput | |||||
if (!str || str.length === 0) { | |||||
wx.showToast({ | |||||
title: '请输入服务器地址', | |||||
icon: 'none' | |||||
}) | |||||
return | |||||
} | |||||
if (str.length > 56) { | |||||
wx.showToast({ | |||||
title: '最多56个字节', | |||||
icon: 'none' | |||||
}) | |||||
return | |||||
} | |||||
let arr = util.str2hex(str) | |||||
if (arr.length > 14) { // 超出14 byte 需分包 | |||||
console.log('超出14位===') | |||||
let list = [] | |||||
let len = parseInt(arr.length / 14) + 1 | |||||
for (let i = 0; i < len; i++) { | |||||
setTimeout(() => { | |||||
list[i] = arr.slice(i * 14, (i + 1) * 14) | |||||
console.log('list:', list) | |||||
let isEnd = +(i !== len - 1) | |||||
console.log('isEnd:', isEnd) | |||||
let cmd = [0x8B, isEnd, ...list[i]] | |||||
console.log('cmd:', cmd) | |||||
plugin.sendDataOfA6(cmd) | |||||
}, 200 * i) | |||||
} | |||||
console.log('arr:', arr) | |||||
} else { | |||||
let cmd = [0x8B, 0x00, ...arr] | |||||
plugin.sendDataOfA6(cmd) | |||||
} | |||||
//重新获取ServerAddress用于验证 | |||||
setTimeout(() => { | |||||
this.getServerAddress() | |||||
}, 1000) | |||||
}, | |||||
/** | |||||
* 设置服务器端口 | |||||
*/ | |||||
setServerPort() { | |||||
let str = this.data.serverPortInput | |||||
let port = parseInt(str) | |||||
console.log('port:', port) | |||||
if (port > 0xFFFF) { | |||||
wx.showToast({ | |||||
title: '超过端口号最大值65535', | |||||
icon: 'none' | |||||
}) | |||||
return | |||||
} | |||||
let cmd = [0x8D, (port>>8)&0xFF, port&0xFF] | |||||
plugin.sendDataOfA6(cmd) | |||||
//重新获取ServerPort用于验证 | |||||
setTimeout(() => { | |||||
this.getServerPort() | |||||
}, 1000) | |||||
}, | |||||
/** | |||||
* 设置服务器路径 | |||||
*/ | |||||
setServerPath() { | |||||
let str = this.data.serverPathInput | |||||
if (!str || str.length === 0) { | |||||
wx.showToast({ | |||||
title: '请输入服务器路径', | |||||
icon: 'none' | |||||
}) | |||||
return | |||||
} | |||||
if (str.length > 56) { | |||||
wx.showToast({ | |||||
title: '最多56个字节', | |||||
icon: 'none' | |||||
}) | |||||
return | |||||
} | |||||
let arr = util.str2hex(str) | |||||
if (arr.length > 14) { // 超出14 byte 需分包 | |||||
console.log('超出14位===') | |||||
let list = [] | |||||
let len = parseInt(arr.length / 14) + 1 | |||||
for (let i = 0; i < len; i++) { | |||||
setTimeout(() => { | |||||
list[i] = arr.slice(i * 14, (i + 1) * 14) | |||||
console.log('list:', list) | |||||
let isEnd = +(i !== len - 1) | |||||
console.log('isEnd:', isEnd) | |||||
let cmd = [0x96, isEnd, ...list[i]] | |||||
console.log('cmd:', cmd) | |||||
plugin.sendDataOfA6(cmd) | |||||
}, 200 * i) | |||||
} | |||||
console.log('arr:', arr) | |||||
} else { | |||||
let cmd = [0x96, 0x00, ...arr] | |||||
plugin.sendDataOfA6(cmd) | |||||
} | |||||
//重新获取ServerPath用于验证 | |||||
setTimeout(() => { | |||||
this.getServerPath() | |||||
}, 1000) | |||||
}, | |||||
/** | |||||
* 获取服务器地址 | |||||
*/ | |||||
getServerAddress() { | |||||
this.setData({ | |||||
serverAddress: '' | |||||
}) | |||||
let cmd = [0x8C] | |||||
plugin.sendDataOfA6(cmd) | |||||
}, | |||||
/** | |||||
* 获取服务器端口 | |||||
*/ | |||||
getServerPort() { | |||||
this.setData({ | |||||
serverPort: '' | |||||
}) | |||||
let cmd = [0x8E] | |||||
plugin.sendDataOfA6(cmd) | |||||
}, | |||||
/** | |||||
* 获取服务器路径 | |||||
*/ | |||||
getServerPath() { | |||||
this.setData({ | |||||
serverPath: '' | |||||
}) | |||||
let cmd = [0x97] | |||||
plugin.sendDataOfA6(cmd) | |||||
}, | |||||
}) |
{ | |||||
"usingComponents": {} | |||||
} |
<!--pages/serverConfig/serverConfig.wxml--> | |||||
<wxs module="utils"> | |||||
module.exports.max = function(n1, n2) { | |||||
return Math.max(n1, n2) | |||||
} | |||||
module.exports.len = function(arr) { | |||||
arr = arr || [] | |||||
return arr.length | |||||
} | |||||
</wxs> | |||||
<view class="container"> | |||||
<view class="header_button"> | |||||
<button class="text_left" bindtap="tapItem" data-index='{{0}}' style="font-size: 32rpx;line-height:100rpx;width: 100%;background:#fff">服务器地址:{{serverAddress}}</button> | |||||
<button class="text_left" bindtap="tapItem" data-index='{{1}}' style="font-size: 32rpx;line-height:100rpx;width: 100%;background:#fff">端口:{{serverPort}}</button> | |||||
<button class="text_left" bindtap="tapItem" data-index='{{2}}' style="font-size: 32rpx;line-height:100rpx;width: 100%;background:#fff">路径:{{serverPath}}</button> | |||||
</view> | |||||
</view> | |||||
<view class="modal_wrapper {{pwdModal ? 'modal_wrapper_show': ''}}" catchtouchmove="stopAction"> | |||||
<view class="remindModal" wx:if="{{itemIndex == 0}}"> | |||||
<view class="remindModal_title">输入服务器地址</view> | |||||
<view class="modal_input_wrap"> | |||||
<input model:value='{{serverAddressInput}}' class="modal_input" placeholder="请输入服务器地址" placeholder-style="font-size:30rpx;color:#b4b4b4" /> | |||||
</view> | |||||
<view class="remindModal_btn"> | |||||
<view class="confirm_btn" bindtap="confirm">确定</view> | |||||
<view class="remindModal_cancel_btn" bindtap="closeModal" hover-class="hover_tap">取消</view> | |||||
</view> | |||||
</view> | |||||
<view class="remindModal" wx:if="{{itemIndex == 1}}"> | |||||
<view class="remindModal_title">输入服务器端口</view> | |||||
<view class="modal_input_wrap"> | |||||
<input model:value='{{serverPortInput}}' class="modal_input" placeholder="请输入服务器端口" placeholder-style="font-size:30rpx;color:#b4b4b4" /> | |||||
</view> | |||||
<view class="remindModal_btn"> | |||||
<view class="confirm_btn" bindtap="confirm">确定</view> | |||||
<view class="remindModal_cancel_btn" bindtap="closeModal" hover-class="hover_tap">取消</view> | |||||
</view> | |||||
</view> | |||||
<view class="remindModal" wx:if="{{itemIndex == 2}}"> | |||||
<view class="remindModal_title">输入服务器路径</view> | |||||
<view class="modal_input_wrap"> | |||||
<input model:value='{{serverPathInput}}' class="modal_input" placeholder="请输入服务器路径" placeholder-style="font-size:30rpx;color:#b4b4b4" /> | |||||
</view> | |||||
<view class="remindModal_btn"> | |||||
<view class="confirm_btn" bindtap="confirm">确定</view> | |||||
<view class="remindModal_cancel_btn" bindtap="closeModal" hover-class="hover_tap">取消</view> | |||||
</view> | |||||
</view> | |||||
</view> |
/* pages/serverConfig/serverConfig.wxss */ | |||||
page{ | |||||
background: #f8f8f8; | |||||
} | |||||
.container{ | |||||
padding-bottom: 200rpx; | |||||
} | |||||
.container button{ | |||||
padding-top: 0; | |||||
padding-bottom: 0; | |||||
border: 1px solid #ddd; | |||||
} | |||||
.header_button{ | |||||
flex: 0 0 auto; | |||||
width: 100%; | |||||
} | |||||
.text_left { | |||||
text-align: left; | |||||
} | |||||
.footer { | |||||
position: fixed; | |||||
bottom: 0; | |||||
width: 100%; | |||||
height: 200rpx; | |||||
padding: 10px; | |||||
border-top: 1px solid #ddd; | |||||
background-color: #fff; | |||||
font-size: 14px; | |||||
box-shadow: 0px -4rpx 4rpx 0px rgba(0,0,0,.05); | |||||
} | |||||
.footer .operation { | |||||
position: absolute; | |||||
display: inline-block; | |||||
right: 30rpx; | |||||
} | |||||
.modal_wrapper{ | |||||
position: fixed; | |||||
top: 0; | |||||
left: 0; | |||||
right: 0; | |||||
z-index: -1; | |||||
background: rgba(0,0,0,0.5); | |||||
transition: .4s all; | |||||
height: 200vh; | |||||
opacity: 0; | |||||
} | |||||
.modal_wrapper_show{ | |||||
transform: translateY(-100vh); | |||||
opacity: 1; | |||||
overflow-x: hidden; | |||||
overflow-y: auto; | |||||
z-index: 1000; | |||||
} | |||||
.remindModal{ | |||||
position: absolute; | |||||
bottom: 70vh; | |||||
left: 50%; | |||||
z-index: 101; | |||||
transform: translate(-50%, 50%); | |||||
background: #fff; | |||||
width: 600rpx; | |||||
padding: 40rpx 60rpx; | |||||
border-radius: 20rpx; | |||||
} | |||||
.remindModal_title{ | |||||
padding: 10rpx 30rpx 50rpx; | |||||
text-align: center; | |||||
font-size: 32rpx; | |||||
} | |||||
.remindModal_content{ | |||||
font-size: 30rpx; | |||||
line-height: 1.6; | |||||
text-align: center; | |||||
padding-top: 30rpx; | |||||
min-height: 100rpx; | |||||
} | |||||
.remindModal_btn{ | |||||
margin-top: 80rpx; | |||||
margin-bottom: 10rpx; | |||||
} | |||||
.remindModal_cancel_btn{ | |||||
margin-top: 30rpx; | |||||
height: 80rpx; | |||||
line-height: 80rpx; | |||||
text-align: center; | |||||
color: #FA1111; | |||||
font-size: 30rpx; | |||||
} | |||||
.modal_input_wrap{ | |||||
width: 100%; | |||||
height: 80rpx; | |||||
padding: 0 10rpx; | |||||
border: 1px solid #dcdcdc; | |||||
border-radius: 10rpx; | |||||
} | |||||
.modal_input{ | |||||
width: 100%; | |||||
height: 100%; | |||||
padding: 10rpx; | |||||
font-size: 30rpx; | |||||
} | |||||
.confirm_btn{ | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
width: 480rpx; | |||||
height: 100rpx; | |||||
border: 1px solid transparent; | |||||
margin: auto; | |||||
background: #1977FF; | |||||
color: #fff; | |||||
font-size: 16px; | |||||
letter-spacing: 2rpx; | |||||
border-radius: 1000rpx; | |||||
white-space: nowrap; | |||||
} | |||||
.item_hover{ | |||||
background-color: rgba(0, 0, 0, .1); | |||||
} |
/* pages/wifiList/wifiList.wxss */ | |||||
page{ | |||||
background: #f8f8f8; | |||||
} | |||||
.container{ | |||||
padding-bottom: 200rpx; | |||||
} | |||||
.container button{ | |||||
padding-top: 0; | |||||
padding-bottom: 0; | |||||
border: 1px solid #ddd; | |||||
} | |||||
.header_button{ | |||||
flex: 0 0 auto; | |||||
width: 100%; | |||||
} | |||||
.wifi_title{ | |||||
width: 100%; | |||||
padding: 40rpx 30rpx 20rpx; | |||||
line-height: 1.5; | |||||
} | |||||
.wifi_list{ | |||||
width: 100%; | |||||
height: calc(100vh - 400rpx); | |||||
border: 1px solid #ccc; | |||||
} | |||||
.wifi_item{ | |||||
height: 100rpx; | |||||
padding: 0 30rpx; | |||||
border-bottom: 1px solid #ddd; | |||||
background: #fff; | |||||
} | |||||
.wifi_item_right{ | |||||
color: #1977ff; | |||||
} | |||||
.footer { | |||||
position: fixed; | |||||
bottom: 0; | |||||
width: 100%; | |||||
height: 200rpx; | |||||
padding: 10px; | |||||
border-top: 1px solid #ddd; | |||||
background-color: #fff; | |||||
font-size: 14px; | |||||
box-shadow: 0px -4rpx 4rpx 0px rgba(0,0,0,.05); | |||||
} | |||||
.footer .operation { | |||||
position: absolute; | |||||
display: inline-block; | |||||
right: 30rpx; | |||||
} | |||||
.modal_wrapper{ | |||||
position: fixed; | |||||
top: 0; | |||||
left: 0; | |||||
right: 0; | |||||
z-index: -1; | |||||
background: rgba(0,0,0,0.5); | |||||
transition: .4s all; | |||||
height: 200vh; | |||||
opacity: 0; | |||||
} | |||||
.modal_wrapper_show{ | |||||
transform: translateY(-100vh); | |||||
opacity: 1; | |||||
overflow-x: hidden; | |||||
overflow-y: auto; | |||||
z-index: 1000; | |||||
} | |||||
.remindModal{ | |||||
position: absolute; | |||||
bottom: 50vh; | |||||
left: 50%; | |||||
z-index: 101; | |||||
transform: translate(-50%, 50%); | |||||
background: #fff; | |||||
width: 600rpx; | |||||
padding: 40rpx 60rpx; | |||||
border-radius: 20rpx; | |||||
} | |||||
.remindModal_title{ | |||||
padding: 10rpx 30rpx 50rpx; | |||||
text-align: center; | |||||
font-size: 32rpx; | |||||
} | |||||
.remindModal_content{ | |||||
font-size: 30rpx; | |||||
line-height: 1.6; | |||||
text-align: center; | |||||
padding-top: 30rpx; | |||||
min-height: 100rpx; | |||||
} | |||||
.remindModal_btn{ | |||||
margin-top: 80rpx; | |||||
margin-bottom: 10rpx; | |||||
} | |||||
.remindModal_cancel_btn{ | |||||
margin-top: 30rpx; | |||||
height: 80rpx; | |||||
line-height: 80rpx; | |||||
text-align: center; | |||||
color: #FA1111; | |||||
font-size: 30rpx; | |||||
} | |||||
.modal_input_wrap{ | |||||
width: 100%; | |||||
height: 80rpx; | |||||
padding: 0 10rpx; | |||||
border: 1px solid #dcdcdc; | |||||
border-radius: 10rpx; | |||||
} | |||||
.modal_input{ | |||||
width: 100%; | |||||
height: 100%; | |||||
padding: 10rpx; | |||||
font-size: 30rpx; | |||||
} | |||||
.confirm_btn{ | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
width: 480rpx; | |||||
height: 100rpx; | |||||
border: 1px solid transparent; | |||||
margin: auto; | |||||
background: #1977FF; | |||||
color: #fff; | |||||
font-size: 16px; | |||||
letter-spacing: 2rpx; | |||||
border-radius: 1000rpx; | |||||
white-space: nowrap; | |||||
} | |||||
.item_hover{ | |||||
background-color: rgba(0, 0, 0, .1); | |||||
/* pages/wifiList/wifiList.wxss */ | |||||
page{ | |||||
background: #f8f8f8; | |||||
} | |||||
.container{ | |||||
padding-bottom: 200rpx; | |||||
} | |||||
.container button{ | |||||
padding-top: 0; | |||||
padding-bottom: 0; | |||||
border: 1px solid #ddd; | |||||
} | |||||
.header_button{ | |||||
flex: 0 0 auto; | |||||
width: 100%; | |||||
} | |||||
.wifi_title{ | |||||
width: 100%; | |||||
padding: 40rpx 30rpx 20rpx; | |||||
line-height: 1.5; | |||||
} | |||||
.wifi_list{ | |||||
width: 100%; | |||||
height: calc(100vh - 400rpx); | |||||
border: 1px solid #ccc; | |||||
} | |||||
.wifi_item{ | |||||
height: 100rpx; | |||||
padding: 0 30rpx; | |||||
border-bottom: 1px solid #ddd; | |||||
background: #fff; | |||||
} | |||||
.wifi_item_right{ | |||||
color: #1977ff; | |||||
} | |||||
.footer { | |||||
position: fixed; | |||||
bottom: 0; | |||||
width: 100%; | |||||
height: 200rpx; | |||||
padding: 10px; | |||||
border-top: 1px solid #ddd; | |||||
background-color: #fff; | |||||
font-size: 14px; | |||||
box-shadow: 0px -4rpx 4rpx 0px rgba(0,0,0,.05); | |||||
} | |||||
.footer .operation { | |||||
position: absolute; | |||||
display: inline-block; | |||||
right: 30rpx; | |||||
} | |||||
.modal_wrapper{ | |||||
position: fixed; | |||||
top: 0; | |||||
left: 0; | |||||
right: 0; | |||||
z-index: -1; | |||||
background: rgba(0,0,0,0.5); | |||||
transition: .4s all; | |||||
height: 200vh; | |||||
opacity: 0; | |||||
} | |||||
.modal_wrapper_show{ | |||||
transform: translateY(-100vh); | |||||
opacity: 1; | |||||
overflow-x: hidden; | |||||
overflow-y: auto; | |||||
z-index: 1000; | |||||
} | |||||
.remindModal{ | |||||
position: absolute; | |||||
bottom: 50vh; | |||||
left: 50%; | |||||
z-index: 101; | |||||
transform: translate(-50%, 50%); | |||||
background: #fff; | |||||
width: 600rpx; | |||||
padding: 40rpx 60rpx; | |||||
border-radius: 20rpx; | |||||
} | |||||
.remindModal_title{ | |||||
padding: 10rpx 30rpx 50rpx; | |||||
text-align: center; | |||||
font-size: 32rpx; | |||||
} | |||||
.remindModal_content{ | |||||
font-size: 30rpx; | |||||
line-height: 1.6; | |||||
text-align: center; | |||||
padding-top: 30rpx; | |||||
min-height: 100rpx; | |||||
} | |||||
.remindModal_btn{ | |||||
margin-top: 80rpx; | |||||
margin-bottom: 10rpx; | |||||
} | |||||
.remindModal_cancel_btn{ | |||||
margin-top: 30rpx; | |||||
height: 80rpx; | |||||
line-height: 80rpx; | |||||
text-align: center; | |||||
color: #FA1111; | |||||
font-size: 30rpx; | |||||
} | |||||
.modal_input_wrap{ | |||||
width: 100%; | |||||
height: 80rpx; | |||||
padding: 0 10rpx; | |||||
border: 1px solid #dcdcdc; | |||||
border-radius: 10rpx; | |||||
} | |||||
.modal_input{ | |||||
width: 100%; | |||||
height: 100%; | |||||
padding: 10rpx; | |||||
font-size: 30rpx; | |||||
} | |||||
.confirm_btn{ | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
width: 480rpx; | |||||
height: 100rpx; | |||||
border: 1px solid transparent; | |||||
margin: auto; | |||||
background: #1977FF; | |||||
color: #fff; | |||||
font-size: 16px; | |||||
letter-spacing: 2rpx; | |||||
border-radius: 1000rpx; | |||||
white-space: nowrap; | |||||
} | |||||
.item_hover{ | |||||
background-color: rgba(0, 0, 0, .1); | |||||
} | } |
let uint8 = new Uint8Array(arr) | let uint8 = new Uint8Array(arr) | ||||
let res = decoder.decode(uint8) | let res = decoder.decode(uint8) | ||||
return res | return res | ||||
// if (!arr.length) { | |||||
// return | |||||
// } | |||||
// let ret = "" | |||||
// arr.forEach(item=>{ | |||||
// ret += '%' + item.toString(16) | |||||
// }) | |||||
// console.log(ret) | |||||
// return decodeURIComponent(ret) | |||||
} | } | ||||
function str2hex(str) { | function str2hex(str) { | ||||
let encoder = new TextEncoder('utf8') | let encoder = new TextEncoder('utf8') | ||||
return encoder.encode(str) | return encoder.encode(str) | ||||
// let temp = encodeURIComponent(str).split('%').slice(1) | |||||
// let ret = temp.map(item=>{ | |||||
// return parseInt(item, 16) | |||||
// }) | |||||
// return ret | |||||
} | } | ||||
module.exports = { | module.exports = { |