// 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({ /** * 页面的初始数据 */ data: { scopeBluetooth: false, userFuzzyLocation: true, nvabarData: { showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示 title: '连接配网', //导航栏 中间的标题 }, isNotruter: false, model: 0, connectDevice: {}, typeList: [ { "icon": "../../images/device/mode_wifi.png", "text": "WiFi模式", "type": 2, }, { "icon": "../../images/device/mode_ble.png", "text": "蓝牙模式", "type": 1, }, { "icon": "../../images/device/mode_g4.png", "text": "4G模式", "type": 4, }, ], }, getModeName(curItem) { // 设备类型:1-蓝牙,2-Wifi,3-传统蓝牙,4-4G var str = ""; if (curItem.deviceMode == 4) { str = "移动数据模式"; } else if (curItem.deviceMode == 2) { str = "WiFi模式"; } else if (curItem.deviceMode == 1) { str = "蓝牙模式"; } return str; }, nextTap(e) { let device = this.data.typeList[0]; let type = device.type ?? 0; console.log("选择模式", type) if (type == 1) { // let device = e.currentTarget.dataset.data let json = JSON.stringify(this.data.connectDevice) routeUtil.jumpParam(route_constant.connectBle, json) } else if (type == 2) { wx.navigateTo({ url: './../deviceConnect0/deviceConnect0', }); } 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) { let json = JSON.parse(options.param) console.log(json) let device = json this.setData({ connectDevice: device }) if (getApp().globalData.isIOS) { } else { } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })