This commit is contained in:
3321822538@qq.com 2024-12-16 16:50:03 +08:00
parent d504666dba
commit c96782e800
3 changed files with 22 additions and 32 deletions

View File

@ -32,7 +32,7 @@
<view class="rt" :id="item.deviceId" @click="createBLEConnections(item)"> <view class="rt" :id="item.deviceId" @click="createBLEConnections(item)">
<!-- <text style="margin-bottom: 10rpx;" :id="item.deviceId" @click="createBLEConnections(item)">{{item.lj}}</text> --> <!-- <text style="margin-bottom: 10rpx;" :id="item.deviceId" @click="createBLEConnections(item)">{{item.lj}}</text> -->
<text style="margin-bottom: 10rpx;">选择</text> <text style="margin-bottom: 10rpx;">选择</text>
<text style="margin-bottom: 10rpx;margin-top: 30rpx;" @click.stop="btnkongzhi(item)">控制</text> <text v-if="item.sn" style="margin-bottom: 10rpx;margin-top: 30rpx;" @click.stop="btnkongzhi(item.sn)">控制</text>
<!-- <text @click="scanQRCode(item)" style="margin-bottom: 10rpx;">扫码</text> <!-- <text @click="scanQRCode(item)" style="margin-bottom: 10rpx;">扫码</text>
<text :id="item.deviceId" @click="createBLEConnection(item)">录入</text> --> <text :id="item.deviceId" @click="createBLEConnection(item)">录入</text> -->
</view> </view>
@ -352,8 +352,9 @@
}) })
}, },
btnkongzhi(e){ btnkongzhi(e){
console.log(e);
uni.reLaunch({ uni.reLaunch({
url:'/page_user/wifijoint/index?mac=' + e.name.substring(5) url:'/page_user/wifijoint/index?sn=' + e
}) })
}, },
parseCustomData(data) { parseCustomData(data) {

View File

@ -14,9 +14,9 @@
</image> </image>
</view> </view>
<input type="text" class="ips" v-model="storeId" placeholder="请扫描设备上的二维码" style="margin-left: 32rpx;" <input type="text" class="ips" v-model="storeId" placeholder="请扫描设备上的二维码" style="margin-left: 32rpx;"
placeholder-class="my-placeholder" v-if="storeId"/> placeholder-class="my-placeholder"/>
<input type="text" class="ips" v-model="storeIds" v-if="storeIds" placeholder="请扫描设备上的二维码" style="margin-left: 32rpx;" <!-- <input type="text" class="ips" v-model="storeIds" v-if="storeIds" placeholder="请扫描设备上的二维码" style="margin-left: 32rpx;"
placeholder-class="my-placeholder" /> placeholder-class="my-placeholder" /> -->
</view> </view>
<view class="machao"> <view class="machao">
MAC号{{obj.mac == undefined ? '--' : obj.mac}} MAC号{{obj.mac == undefined ? '--' : obj.mac}}
@ -84,10 +84,7 @@
if (options.sn) { if (options.sn) {
this.storeId = options.sn this.storeId = options.sn
this.getsn() this.getsn()
} else if (options.mac) { }
this.storeIds = options.mac
this.getsn()
}
}, },
// //
onShareAppMessage: function() { onShareAppMessage: function() {

View File

@ -177,6 +177,7 @@
}; };
}, },
onLoad(option) { onLoad(option) {
// this.getuserinfo()
if (option.id) { if (option.id) {
let id = option.id let id = option.id
let that = this let that = this
@ -193,34 +194,25 @@
} }
}) })
} else if (res.data == 1) { } else if (res.data == 1) {
console.log(1); uni.showModal({
if(that.phonenumber == ''){ title: '提示',
that.huoqutelflag = true content: '该设备未绑定,你需进行绑定吗?',
that.xuanzeflag = false success: function(res) {
console.log(11); if (res.confirm) {
}else{ that.$u.put("/app/device/bind", data).then(res => {
console.log(12); if (res.code == 200) {
that.xuanzeflag = false that.$u.get(`/app/device/${id}/bySn`).then((res) => {
uni.showModal({
title: '提示',
content: '该设备未绑定,你需进行绑定吗?',
success: function(res) {
if (res.confirm) {
that.$u.put("/app/device/bind", data).then(res => {
if (res.code == 200) { if (res.code == 200) {
that.$u.get(`/app/device/${id}/bySn`).then((res) => { uni.navigateTo({
if (res.code == 200) { url: '/page_components/bindsz?id=' + res.data.deviceId
uni.navigateTo({
url: '/page_components/bindsz?id=' + res.data.deviceId
})
}
}) })
} }
}) })
} }
} })
}) }
} }
})
} else if (res.data == 0) { } else if (res.data == 0) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@ -847,13 +839,13 @@
getuserinfo() { getuserinfo() {
this.$u.get("/app/user/userInfo").then((res) => { this.$u.get("/app/user/userInfo").then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.phonenumber = res.data.phonenumber
this.type = res.data.type this.type = res.data.type
this.isStaff = res.data.isStaff this.isStaff = res.data.isStaff
this.isMch = res.data.isMch this.isMch = res.data.isMch
uni.setStorageSync('userType', res.data) uni.setStorageSync('userType', res.data)
this.userType = res.data.userType this.userType = res.data.userType
this.deviceCount = res.data.deviceCount this.deviceCount = res.data.deviceCount
this.phonenumber = res.data.phonenumber
} else { } else {
this.jmlogin() this.jmlogin()
} }