|
@@ -1,4 +1,8 @@
|
|
|
// pages/deviceConMode/index.js
|
|
|
+// const btHelper = require('../../devices/bt_helper');
|
|
|
+// const toastUtil = require('../../utils/toast_util');
|
|
|
+import routeUtil from '../../utils/route_util'
|
|
|
+import route_constant from '../../utils/route_constant.js'
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
@@ -18,20 +22,24 @@ Page({
|
|
|
},
|
|
|
isNotruter: false,
|
|
|
model: 0,
|
|
|
+ connectDevice: {},
|
|
|
typeList: [
|
|
|
{
|
|
|
"icon": "../../images/device/mode_wifi.png",
|
|
|
"text": "WiFi模式",
|
|
|
+ "type": 3,
|
|
|
},
|
|
|
{
|
|
|
"icon": "../../images/device/mode_ble.png",
|
|
|
"text": "蓝牙模式",
|
|
|
+ "type": 1,
|
|
|
},
|
|
|
{
|
|
|
"icon": "../../images/device/mode_g4.png",
|
|
|
"text": "4G模式",
|
|
|
+ "type": 2,
|
|
|
},
|
|
|
- ]
|
|
|
+ ],
|
|
|
},
|
|
|
getModeName(curItem) {
|
|
|
// 设备类型:1-蓝牙,2-Wifi,3-传统蓝牙,4-4G
|
|
@@ -45,12 +53,58 @@ Page({
|
|
|
}
|
|
|
return str;
|
|
|
},
|
|
|
- clickNextTap(){},
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
- */
|
|
|
- onLoad(options) {
|
|
|
+ nextTap(e) {
|
|
|
+ let device = this.data.typeList[0];
|
|
|
+ // console.log(e)
|
|
|
+ let type = device.type ?? 0;
|
|
|
+ if (type == 1) {
|
|
|
+ let device = e.currentTarget.dataset.data
|
|
|
+ routeUtil.jumpParam(route_constant.connectBle, this.data.connectDevice)
|
|
|
+ } else if (type == 2) {
|
|
|
+
|
|
|
+ } else if (type == 3) {
|
|
|
+ // btHelper.stopSearch()
|
|
|
+ } else {
|
|
|
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async selectDeviceModelTap(e) {
|
|
|
+ let device = e.currentTarget.dataset.device;
|
|
|
+ // console.log(e)
|
|
|
+ let type = device.type;
|
|
|
+ if (type == 1) {
|
|
|
+ // this.getConnectedDevices()
|
|
|
+ } else if (type == 2) {
|
|
|
+
|
|
|
+ } else if (type == 3) {
|
|
|
+ // btHelper.stopSearch()
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ var list = []
|
|
|
+ list.push(device)
|
|
|
+ this.data.typeList.forEach(element => {
|
|
|
+ if (element.type != type) {
|
|
|
+ list.push(element)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ typeList: list,
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ onLoad: function (options) {
|
|
|
+ console.log(options)
|
|
|
+ let device = options.param;
|
|
|
+ this.setData({
|
|
|
+ connectDevice: device
|
|
|
+ })
|
|
|
+
|
|
|
+ if (getApp().globalData.isIOS) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/**
|