Browse Source

增加了选择运营商

master
xiaohei 1 year ago
parent
commit
f4c4149cbe
3 changed files with 93 additions and 11 deletions
  1. +76
    -10
      pages/Bluetooth/Bluetooth.js
  2. +7
    -1
      pages/Bluetooth/Bluetooth.wxml
  3. +10
    -0
      pages/Bluetooth/Bluetooth.wxss

+ 76
- 10
pages/Bluetooth/Bluetooth.js View File

@ -61,6 +61,39 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
platformId: 0, // 运营商
platformname: "",
sheetshow: false,
actions1: [
{
name: '电信',
id: 1
},
{
name: '移动',
id: 2
},
{
name: '联通',
id: 3
},
{
name: "直连UDP平台",
id: 8
},
{
name: "直连TCP平台",
id: 9
},
{
name: "消息服务器",
id: 98
},
{
name: "本地缓存",
id: 99
}
],
selectRadio1: '1201', selectRadio1: '1201',
showreg: false, // 注册到平台的弹出层 showreg: false, // 注册到平台的弹出层
show2: false, show2: false,
@ -189,6 +222,18 @@ Page({
// } // }
// }) // })
let superAdmin = []
var superAdminIdlist = lock.mac.slice(lock.mac.length - 11, lock.mac.length).split(":").join("")
for (let i = 0; i < superAdminIdlist.length; i++) {
if (superAdminIdlist[i] >= 0 && superAdminIdlist[i] <= 9) {
superAdmin.push(superAdminIdlist[i])
} else {
let adminid = superAdminIdlist.charCodeAt(i)
superAdmin.push(adminid)
}
}
let superAdminId = superAdmin.join('').slice(superAdmin.length - 8, superAdmin.length)
basecode = superAdminId
this.setData({ this.setData({
deviceInfo: res.data.list[0], deviceInfo: res.data.list[0],
lock: lock, lock: lock,
@ -306,6 +351,18 @@ Page({
} }
this.getRoom() this.getRoom()
}, },
onSelect(event) {
console.log(event.detail);
this.setData({
platformId: event.detail.id,
platformname: event.detail.name
})
},
changesheetshow() {
this.setData({
sheetshow: true
})
},
// //
onChangeSelectRaio(event) { onChangeSelectRaio(event) {
this.setData({ this.setData({
@ -1669,8 +1726,15 @@ Page({
// 注册到平台 // 注册到平台
resgiterDeviceMethods1() { resgiterDeviceMethods1() {
if(this.data.platformId == 0){
return wx.showToast({
title: '请先选择运营商',
icon: "none",
duration: 2000
})
}
if (this.data.selectRadio1 == '1201') { if (this.data.selectRadio1 == '1201') {
this.addAdmin()
this.resgWfiDevice()
} else if (this.data.selectRadio1 == '1221') { } else if (this.data.selectRadio1 == '1221') {
} else if (this.data.selectRadio1 == '1231') { } else if (this.data.selectRadio1 == '1231') {
@ -1711,11 +1775,12 @@ Page({
data: { data: {
deviceNum: this.data.deviceNum, deviceNum: this.data.deviceNum,
imei: deviceimei, imei: deviceimei,
imsi: "",
platformId: 9,
imsi: deviceimei,
platformId: this.data.platformId,
manufactureId: this.data.selectRadio1 manufactureId: this.data.selectRadio1
} }
} }
console.log(data);
WXAPI.sendCommand(data).then(res => { WXAPI.sendCommand(data).then(res => {
console.log(res, data); console.log(res, data);
if (res.success) { if (res.success) {
@ -1782,9 +1847,9 @@ Page({
// duration: 2000 // duration: 2000
// }) // })
// } else { // } else {
this.setData({
showreg: true
})
this.setData({
showreg: true
})
// } // }
// }) // })
}, },
@ -2095,12 +2160,13 @@ Page({
}, },
onClose() { onClose() {
this.setData({ this.setData({
show: false
show: false,
show2: false
}); });
}, },
onClose() {
onClose1() {
this.setData({ this.setData({
show2: false
sheetshow: false
}) })
}, },
// 获取房间 // 获取房间
@ -3506,7 +3572,7 @@ Page({
characteristicId: config.uuid.writeUuid.toUpperCase(), characteristicId: config.uuid.writeUuid.toUpperCase(),
value: bytes, value: bytes,
success: function (res) { success: function (res) {
}, },
}) })
}, 50) }, 50)


+ 7
- 1
pages/Bluetooth/Bluetooth.wxml View File

@ -132,6 +132,7 @@
<view class='row'> <view class='row'>
<button class="button-action" type='primary' bindtap="changemanId" disabled="{{!resgiterdevice}}">注册到平台</button> <button class="button-action" type='primary' bindtap="changemanId" disabled="{{!resgiterdevice}}">注册到平台</button>
<!-- <button class="button-action" type='primary' bindtap="changemanId">注册到平台</button> -->
<button class="button-action" type='primary' bindtap="bindRoomMethods" disabled="{{resgiterdevice}}">绑定房间</button> <button class="button-action" type='primary' bindtap="bindRoomMethods" disabled="{{resgiterdevice}}">绑定房间</button>
</view> </view>
@ -208,7 +209,12 @@
<van-radio name="1241" class="ma-2">Wifi人脸智能锁</van-radio> <van-radio name="1241" class="ma-2">Wifi人脸智能锁</van-radio>
</van-radio-group> </van-radio-group>
</view> </view>
<view class="sheetlist" bindtap="changesheetshow">
<span class="platformIdlist">选择运营商:</span>
<span>{{platformname}}</span>
</view>
<van-button block type="primary" bindtap="resgiterDeviceMethods1">确定</van-button> <van-button block type="primary" bindtap="resgiterDeviceMethods1">确定</van-button>
</view> </view>
</van-popup> </van-popup>
</view>
</view>
<van-action-sheet show="{{ sheetshow }}" actions="{{ actions1 }}" bind:close="onClose1" bind:select="onSelect" />

+ 10
- 0
pages/Bluetooth/Bluetooth.wxss View File

@ -85,3 +85,13 @@
.radiolists{ .radiolists{
padding: 0 10px; padding: 0 10px;
} }
.sheetlist{
width: 100%;
padding: 0 10px;
display: flex;
align-items: center;
margin-bottom: 10px;
}
.platformIdlist{
margin-right: 10px;
}

Loading…
Cancel
Save