录入页面布局修改
This commit is contained in:
parent
bcdfee8f9f
commit
d712f62917
|
|
@ -1,14 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<u-navbar
|
|
||||||
:background="bgc"
|
|
||||||
:border-bottom="false"
|
|
||||||
:custom-back="btnfh"
|
|
||||||
height="50"
|
|
||||||
title="添加设备"
|
|
||||||
title-color="#262B37"
|
|
||||||
title-size="38"
|
|
||||||
></u-navbar>
|
|
||||||
<view class="iptbox" @click="backpage()">
|
<view class="iptbox" @click="backpage()">
|
||||||
<input
|
<input
|
||||||
v-model="mac"
|
v-model="mac"
|
||||||
|
|
@ -38,19 +29,19 @@
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="iptbox" @click="kashow = true">
|
<!-- <view class="iptbox" @click="kashow = true">-->
|
||||||
<view v-if="kaname" class=""> 卡商:{{ kaname }}</view>
|
<!-- <view v-if="kaname" class=""> 卡商:{{ kaname }}</view>-->
|
||||||
<view v-else class=""> 请点击选择卡商</view>
|
<!-- <view v-else class=""> 请点击选择卡商</view>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
<u-select v-model="kashow" :list="kalist" title="选择卡商" @confirm="confirmka"></u-select>
|
<!-- <u-select v-model="kashow" :list="kalist" title="选择卡商" @confirm="confirmka"></u-select>-->
|
||||||
<view class="iptbox" @click="show = true">
|
<!-- <view class="iptbox" @click="show = true">-->
|
||||||
<view v-if="hardwareInfo.version" class=""> 版本:{{ hardwareInfo.version }}</view>
|
<!-- <view v-if="hardwareInfo.version" class=""> 版本:{{ hardwareInfo.version }}</view>-->
|
||||||
<view v-else class=""> 请点击选择版本</view>
|
<!-- <view v-else class=""> 请点击选择版本</view>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
<view v-if="hardwareInfo.version" class="tips">
|
<!-- <view v-if="hardwareInfo.version" class="tips">-->
|
||||||
版本介绍:{{ hardwareInfo.instructions }}
|
<!-- 版本介绍:{{ hardwareInfo.instructions }}-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
<u-select v-model="show" :list="list" title="选择版本" @confirm="confirm"></u-select>
|
<!-- <u-select v-model="show" :list="list" title="选择版本" @confirm="confirm"></u-select>-->
|
||||||
|
|
||||||
<view class="imgs" style="margin-top: 30rpx">
|
<view class="imgs" style="margin-top: 30rpx">
|
||||||
<image
|
<image
|
||||||
|
|
@ -60,17 +51,17 @@
|
||||||
></image>
|
></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn" @click="bind()"> 确认添加</view>
|
<view class="btn" @click="bind()"> 确认添加</view>
|
||||||
<view class="bot_btn">
|
<!-- <view class="bot_btn">-->
|
||||||
<view class="btn1" @click="btnfh"> 返回</view>
|
<!-- <view class="btn1" @click="btnfh"> 返回</view>-->
|
||||||
<view class="btn1" @click="findDevice()"> 蓝牙链接</view>
|
<!-- <view class="btn1" @click="findDevice()"> 蓝牙链接</view>-->
|
||||||
<view v-if="carstause" class="btn1" @click="ring()"> 响铃寻车</view>
|
<!-- <view v-if="carstause" class="btn1" @click="ring()"> 响铃寻车</view>-->
|
||||||
|
|
||||||
<view v-if="carstause" class="btn1" @click="open()"> 蓝牙开锁</view>
|
<!-- <view v-if="carstause" class="btn1" @click="open()"> 蓝牙开锁</view>-->
|
||||||
<view v-if="carstause" class="btn1" @click="close()"> 蓝牙关锁</view>
|
<!-- <view v-if="carstause" class="btn1" @click="close()"> 蓝牙关锁</view>-->
|
||||||
<view v-if="carstause" class="btn1" @click="shaoru"> 进入烧录</view>
|
<!-- <view v-if="carstause" class="btn1" @click="shaoru"> 进入烧录</view>-->
|
||||||
<view v-if="carstause" class="btn1" @click="reboot()"> 设备重启</view>
|
<!-- <view v-if="carstause" class="btn1" @click="reboot()"> 设备重启</view>-->
|
||||||
<view v-if="isbands" class="btn1" @click="Binddevice()"> 接口响铃</view>
|
<!-- <view v-if="isbands" class="btn1" @click="Binddevice()"> 接口响铃</view>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
<u-mask :show="showbind" :z-index="100" />
|
<u-mask :show="showbind" :z-index="100" />
|
||||||
<view v-if="showbind" class="tip_box">
|
<view v-if="showbind" class="tip_box">
|
||||||
<view v-if="showbind" class="top">
|
<view v-if="showbind" class="top">
|
||||||
|
|
|
||||||
|
|
@ -1,105 +1,68 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="pages">
|
<view class="">
|
||||||
<u-navbar
|
<view class="title"> 控制台</view>
|
||||||
:background="bgc"
|
<view class="shuom"> 请扫描设备上的二维码</view>
|
||||||
:border-bottom="false"
|
|
||||||
:custom-back="backPage"
|
|
||||||
height="50"
|
|
||||||
title="设备控制"
|
|
||||||
title-color="#262B37"
|
|
||||||
title-size="38"
|
|
||||||
></u-navbar>
|
|
||||||
<view class="title">
|
|
||||||
<text>控制台</text>
|
|
||||||
</view>
|
|
||||||
<view class="iptbox">
|
<view class="iptbox">
|
||||||
<view class="qrcode" @click="qrcode()">
|
<view class="qrcode" @click="qrcode()">
|
||||||
<image
|
<image
|
||||||
mode=""
|
mode="aspectFit"
|
||||||
src="https://api.ccttiot.com/smartmeter/img/static/uy7BNwAMIKwvstqFnRhs"
|
src="https://api.ccttiot.com/smartmeter/img/static/uy7BNwAMIKwvstqFnRhs"
|
||||||
></image>
|
>
|
||||||
|
</image>
|
||||||
</view>
|
</view>
|
||||||
<input
|
<input
|
||||||
v-model="sn"
|
v-model="storeId"
|
||||||
class="ips"
|
class="ips"
|
||||||
placeholder="请扫描设备上的二维码"
|
placeholder="请扫描设备上的二维码"
|
||||||
placeholder-class="my-placeholder"
|
placeholder-class="my-placeholder"
|
||||||
style="margin-left: 32rpx"
|
style="margin-left: 32rpx"
|
||||||
type="text"
|
type="text"
|
||||||
@input="search()"
|
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="txt"> MAC:{{ carInfo.mac == undefined ? '--' : carInfo.mac }} </view>
|
<view class="machao"> MAC号:{{ obj.mac == undefined ? '--' : obj.mac }}</view>
|
||||||
<view class="txt">
|
<view class="machao"> 电压:{{ obj.voltage == undefined ? '--' : obj.voltage }}V</view>
|
||||||
|
<view class="machao">
|
||||||
|
功率:{{ obj.realTimePower == undefined ? '--' : obj.realTimePower }}W
|
||||||
|
</view>
|
||||||
|
<view class="machao"> 电流:{{ obj.electricity == undefined ? '--' : obj.electricity }}A</view>
|
||||||
|
<view class="machao">
|
||||||
网络:
|
网络:
|
||||||
<span v-if="carInfo.onlineStatus == 0">离线</span>
|
<text v-if="onlineStatus == '离线'" style="color: red">离线</text>
|
||||||
<span v-if="carInfo.onlineStatus == 1" style="color: #8883f0">在线</span>
|
<text v-if="onlineStatus == '在线'" style="color: green">在线</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">
|
<view class="machao">
|
||||||
信号:{{ carInfo.signalStrength == undefined ? '--' : carInfo.signalStrength }}
|
状态:
|
||||||
|
<text v-if="powerStatus == '关闭'" style="color: red">关闭</text>
|
||||||
|
<text v-if="powerStatus == '开启'" style="color: green">开启</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">
|
<view class="machao"> 版本号:{{ obj.version == undefined ? '--' : obj.version }}</view>
|
||||||
卫星:{{ carInfo.satellites == undefined ? '--' : carInfo.satellites }}
|
<view class="machao">
|
||||||
|
最后更新时间:{{ obj.lastPullTime == undefined ? '--' : obj.lastPullTime }}
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">
|
<view class="machao">
|
||||||
电压:{{ carInfo.voltage == undefined ? '--' : carInfo.voltage.toFixed(2) }}V
|
最后在线时间:{{ obj.lastOnlineTime == undefined ? '--' : obj.lastOnlineTime }}
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">
|
|
||||||
锁状态:
|
<view class="jiaozhun">
|
||||||
<span v-if="carInfo.lockStatus == 0">关</span>
|
<view class="input">
|
||||||
<span v-if="carInfo.lockStatus == 1" style="color: #8883f0">开</span>
|
<button @click="btnjian">-</button>
|
||||||
|
<input v-model="valuedian" placeholder="输入校准电压" type="text" />
|
||||||
|
<button @click="btnadd">+</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">
|
<view class="view" @click="btnjiaozhun"> 校准电压</view>
|
||||||
电门:
|
|
||||||
<span v-if="carInfo.quality == 0">关</span>
|
|
||||||
<span v-if="carInfo.quality == 1" style="color: #8883f0">开</span>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">
|
|
||||||
硬件版本:{{ carInfo.hardwareVersion == undefined ? '--' : carInfo.hardwareVersion }}
|
<view class="list">
|
||||||
|
<view class="anniulist">
|
||||||
|
<view class="anniu" @click="btncq"> 重启</view>
|
||||||
|
<view class="anniu" @click="btnsxs"> 刷新</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="txt" style="display: flex; justify-content: space-between; align-items: center">
|
<view class="anniulist">
|
||||||
<view class="">
|
<view class="anniu" @click="btnkq"> 开启</view>
|
||||||
软件版本:{{ carInfo.softwareVersion == undefined ? '--' : carInfo.softwareVersion }}
|
<view class="anniu" @click="btngb"> 关闭</view>
|
||||||
|
<view class="anniu" @click="btnsx"> 同步</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view class="fanhui" @click="btnfh"> 返回</view>
|
||||||
class=""
|
|
||||||
style="
|
|
||||||
font-size: 30rpx;
|
|
||||||
background-color: #8883f0;
|
|
||||||
color: #fff;
|
|
||||||
padding: 6rpx 10rpx;
|
|
||||||
border-radius: 10rpx;
|
|
||||||
"
|
|
||||||
@click="btnsj"
|
|
||||||
>
|
|
||||||
升级
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="txt">
|
|
||||||
声音:
|
|
||||||
<span v-if="carInfo.music == 0">静音</span>
|
|
||||||
<span v-if="carInfo.music == 1">语音</span>
|
|
||||||
<span v-if="carInfo.music == 2">彩铃</span>
|
|
||||||
</view>
|
|
||||||
<view class="txt">
|
|
||||||
最后定位时间:{{ carInfo.lastLocationTime == undefined ? '--' : carInfo.lastLocationTime }}
|
|
||||||
</view>
|
|
||||||
<view class="txt">
|
|
||||||
最后在线时间:{{ carInfo.lastOnlineTime == undefined ? '--' : carInfo.lastOnlineTime }}
|
|
||||||
</view>
|
|
||||||
<view class="btnbox">
|
|
||||||
<view class="btn_box" style="margin-bottom: 20rpx"> </view>
|
|
||||||
<view class="btn_box">
|
|
||||||
<view class="btn1" @click="btn(0)"> 开锁 </view>
|
|
||||||
<view class="btn1" @click="btn(1)"> 关锁 </view>
|
|
||||||
<view class="btn1" @click="btn(9)"> 坐垫锁 </view>
|
|
||||||
</view>
|
|
||||||
<view class="btn_box" style="margin-top: 20rpx">
|
|
||||||
<view class="btn1" @click="btn(3)"> 响铃 </view>
|
|
||||||
<view class="btn1" @click="btn(8)"> 重启 </view>
|
|
||||||
<view class="btn1" @click="btn(4)"> 更新 </view>
|
|
||||||
</view>
|
|
||||||
<view class="btn2" style="margin-top: 20rpx" @click="back()"> 返回扫描 </view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -108,88 +71,142 @@
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
titleflag: false, //提示隐藏
|
|
||||||
bgc: {
|
bgc: {
|
||||||
backgroundColor: '#F7FAFE',
|
backgroundColor: '#F7FAFE',
|
||||||
},
|
},
|
||||||
sn: '',
|
storeId: '',
|
||||||
carInfo: {},
|
obj: {},
|
||||||
|
id: '',
|
||||||
|
onlineStatus: '--',
|
||||||
|
powerStatus: '--',
|
||||||
|
valuedian: 220,
|
||||||
|
xshu: '1',
|
||||||
|
x: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(options) {
|
||||||
if (e.sn) {
|
if (options.sn) {
|
||||||
this.sn = e.sn
|
this.storeId = options.sn
|
||||||
this.deviceInfo()
|
this.getsn()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {},
|
// 分享到好友(会话)
|
||||||
mounted() {
|
onShareAppMessage: function () {
|
||||||
// this.videoContext = uni.createVideoContext('myVideo', this)
|
return {
|
||||||
|
title: '创想物联',
|
||||||
|
path: '/pages/shouye/index',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 分享到朋友圈
|
||||||
|
onShareTimeline: function () {
|
||||||
|
return {
|
||||||
|
title: '创想物联',
|
||||||
|
query: '',
|
||||||
|
path: '/pages/shouye/index',
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 点击升级
|
btncq() {
|
||||||
btnsj() {
|
this.$u.put(`/app/device/admin/reboot?sn=${this.storeId}`).then(res => {
|
||||||
uni.showLoading({
|
if (res.code == 200) {
|
||||||
title: '加载中...',
|
|
||||||
mask: true,
|
|
||||||
})
|
|
||||||
this.$u.put(`/bst/device/iot/update?sn=${this.sn}`).then(res => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '操作成功',
|
title: '重启成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 3000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 3000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
backPage() {
|
btnsxs() {
|
||||||
uni.redirectTo({
|
this.$u.put(`/app/device/admin/uploadData?sn=${this.storeId}`).then(res => {
|
||||||
url: '/page_user/luru/index',
|
if (res.code == 200) {
|
||||||
})
|
this.obj = res.data
|
||||||
},
|
this.id = res.data.deviceId
|
||||||
back() {
|
if (res.data.vxs == null) {
|
||||||
uni.reLaunch({
|
this.xshu = 1
|
||||||
url: '/page_user/luru/index',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
search() {
|
|
||||||
if (this.sn && this.sn.length === 7 && /^\d+$/.test(this.sn)) {
|
|
||||||
// 当 this.sn 满足条件时调用 deviceInfo
|
|
||||||
this.deviceInfo()
|
|
||||||
} else {
|
} else {
|
||||||
console.log('SN 不是 7 位数字')
|
this.xshu = res.data.vxs
|
||||||
// 你可以在这里处理不符合条件的情况,比如提示用户输入正确的 SN
|
|
||||||
}
|
}
|
||||||
|
if (res.data.onlineStatus == 0) {
|
||||||
|
this.onlineStatus = '离线'
|
||||||
|
} else if (res.data.onlineStatus == 1) {
|
||||||
|
this.onlineStatus = '在线'
|
||||||
|
}
|
||||||
|
if (res.data.powerStatus == 0) {
|
||||||
|
this.powerStatus = '关闭'
|
||||||
|
} else if (res.data.powerStatus == 1) {
|
||||||
|
this.powerStatus = '开启'
|
||||||
|
}
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000,
|
||||||
|
})
|
||||||
|
uni.hideLoading()
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
btnjian() {
|
||||||
|
this.valuedian = Number(this.valuedian) - 1
|
||||||
|
},
|
||||||
|
btnadd() {
|
||||||
|
this.valuedian = Number(this.valuedian) + 1
|
||||||
|
},
|
||||||
|
btnjiaozhun() {
|
||||||
|
this.x = (this.valuedian / this.obj.voltage) * this.xshu
|
||||||
|
this.x = this.x.toFixed(3)
|
||||||
|
console.log(this.x)
|
||||||
|
this.$u.put(`/app/device/admin/${this.obj.deviceId}/vxs?vxs=${this.x}`).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '校准成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000,
|
||||||
|
})
|
||||||
|
this.getsn()
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
btnmy() {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/my',
|
||||||
|
})
|
||||||
},
|
},
|
||||||
qrcode() {
|
qrcode() {
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
onlyFromCamera: true,
|
onlyFromCamera: true,
|
||||||
scanType: ['qrCode'],
|
scanType: ['qrCode'],
|
||||||
success: res => {
|
success: res => {
|
||||||
let sn = null
|
function getQueryParam(url, paramName) {
|
||||||
let queryParams = res.result.split('?')[1]
|
let regex = new RegExp(`[?&]${paramName}=([^&]*)`)
|
||||||
if (queryParams) {
|
let results = regex.exec(url)
|
||||||
let params = queryParams.split('&')
|
return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null
|
||||||
params.forEach(param => {
|
|
||||||
let [key, value] = param.split('=')
|
|
||||||
if (key === 's') {
|
|
||||||
sn = value
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.sn = sn
|
|
||||||
console.log(res.result)
|
|
||||||
if (this.sn != '') {
|
|
||||||
this.deviceInfo()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let sceneValue = res.result
|
||||||
|
let decodedValue = decodeURIComponent(sceneValue)
|
||||||
|
let id = getQueryParam(decodedValue, 's')
|
||||||
|
this.storeId = id
|
||||||
|
this.getsn()
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: err => {
|
||||||
console.error('扫描失败:', err)
|
console.error('扫描失败:', err)
|
||||||
|
|
@ -200,240 +217,231 @@ export default {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deviceInfo() {
|
|
||||||
this.$u
|
getsn() {
|
||||||
.get('/bst/device?sn=' + this.sn)
|
this.$u.get(`/app/device/admin/get?sn=${this.storeId}`).then(res => {
|
||||||
.then(res => {
|
if (res.code == 200) {
|
||||||
if (res.code === 200) {
|
this.obj = res.data
|
||||||
this.carInfo = res.data
|
this.id = res.data.deviceId
|
||||||
|
if (res.data.vxs == null) {
|
||||||
|
this.xshu = 1
|
||||||
|
} else {
|
||||||
|
this.xshu = res.data.vxs
|
||||||
}
|
}
|
||||||
|
if (res.data.onlineStatus == 0) {
|
||||||
|
this.onlineStatus = '离线'
|
||||||
|
} else if (res.data.onlineStatus == 1) {
|
||||||
|
this.onlineStatus = '在线'
|
||||||
|
}
|
||||||
|
if (res.data.powerStatus == 0) {
|
||||||
|
this.powerStatus = '关闭'
|
||||||
|
} else if (res.data.powerStatus == 1) {
|
||||||
|
this.powerStatus = '开启'
|
||||||
|
}
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000,
|
||||||
})
|
})
|
||||||
.catch(error => {
|
uni.hideLoading()
|
||||||
console.error('Error fetching area data:', error)
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000,
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
btn(num) {
|
|
||||||
if (num == 0) {
|
// 返回录入
|
||||||
uni.showLoading({
|
btnfh() {
|
||||||
title: '加载中...',
|
uni.navigateBack({
|
||||||
|
delta: 1, // 返回的页面数,默认1
|
||||||
|
success: () => {
|
||||||
|
console.log('返回上一页成功')
|
||||||
|
},
|
||||||
|
fail: err => {
|
||||||
|
console.error('返回上一页失败:', err)
|
||||||
|
},
|
||||||
})
|
})
|
||||||
console.log('点击了....1')
|
},
|
||||||
this.$u
|
|
||||||
.put('/bst/device/iot/unlock?sn=' + this.sn)
|
// 开启
|
||||||
.then(res => {
|
btnkq() {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '设备开启中...',
|
||||||
|
})
|
||||||
|
this.$u.put(`/app/device/admin/${this.id}/switch?open=true`).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
|
||||||
this.deviceInfo()
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '操作成功',
|
title: '开启成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
|
this.powerStatus = '开启'
|
||||||
} else {
|
} else {
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: '开启失败',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
},
|
||||||
console.error('Error fetching area data:', error)
|
// 关闭
|
||||||
})
|
btngb() {
|
||||||
} else if (num == 1) {
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中...',
|
title: '设备关闭中...',
|
||||||
})
|
})
|
||||||
console.log('点击了....2')
|
this.$u.put(`/app/device/admin/${this.id}/switch?open=false`).then(res => {
|
||||||
this.$u
|
|
||||||
.put('/bst/device/iot/lock?sn=' + this.sn)
|
|
||||||
.then(res => {
|
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
// setTimeout(()=>{
|
||||||
this.deviceInfo()
|
// this.btnsx()
|
||||||
|
// },1000)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '操作成功',
|
title: '关闭成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
|
this.powerStatus = '关闭'
|
||||||
} else {
|
} else {
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: '关闭失败',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
},
|
||||||
console.error('Error fetching area data:', error)
|
// 刷新
|
||||||
})
|
btnsx() {
|
||||||
} else if (num == 3) {
|
this.$u.get(`/app/device/v2/refreshIot?deviceNo=${this.storeId}`).then(res => {
|
||||||
uni.showLoading({
|
|
||||||
title: '加载中...',
|
|
||||||
})
|
|
||||||
this.$u.put('/bst/device/iot/ring?sn=' + this.sn).then(res => {
|
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.deviceInfo()
|
this.getsn()
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '操作成功',
|
title: '同步成功',
|
||||||
icon: 'success',
|
|
||||||
duration: 2000,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: res.msg,
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if (num == 4) {
|
|
||||||
uni.showLoading({
|
|
||||||
title: '加载中...',
|
|
||||||
})
|
|
||||||
this.$u.put('/bst/device/iot/refresh?sn=' + this.sn).then(res => {
|
|
||||||
if (res.code == 200) {
|
|
||||||
this.deviceInfo()
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: '操作成功',
|
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: '同步失败',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if (num == 5) {
|
|
||||||
uni.showLoading({
|
|
||||||
title: '加载中...',
|
|
||||||
})
|
|
||||||
this.$u.put('/app/voltage/check?sn=' + this.sn).then(res => {
|
|
||||||
if (res.code == 200) {
|
|
||||||
this.deviceInfo()
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: '操作成功',
|
|
||||||
icon: 'success',
|
|
||||||
duration: 2000,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: res.msg,
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if (num == 8) {
|
|
||||||
uni.showLoading({
|
|
||||||
title: '加载中...',
|
|
||||||
})
|
|
||||||
this.$u.put('/bst/device/iot/reboot?sn=' + this.sn).then(res => {
|
|
||||||
if (res.code == 200) {
|
|
||||||
this.deviceInfo()
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: '操作成功',
|
|
||||||
icon: 'success',
|
|
||||||
duration: 2000,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: res.msg,
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if (num == 9) {
|
|
||||||
uni.showLoading({
|
|
||||||
title: '加载中...',
|
|
||||||
})
|
|
||||||
this.$u.put('/bst/device/iot/unlockSeat?sn=' + this.sn).then(res => {
|
|
||||||
if (res.code == 200) {
|
|
||||||
this.deviceInfo()
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: '操作成功',
|
|
||||||
icon: 'success',
|
|
||||||
duration: 2000,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: res.msg,
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="less">
|
||||||
page {
|
.jiaozhun {
|
||||||
background-color: #f7faff !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btnbox {
|
|
||||||
margin-left: -66rpx;
|
|
||||||
width: 750rpx;
|
|
||||||
padding: 0 66rpx;
|
|
||||||
position: fixed;
|
|
||||||
bottom: 50rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.txt {
|
|
||||||
margin-top: 16rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: #808080;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn_box {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
padding: 50rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
.btn1 {
|
button {
|
||||||
display: flex;
|
height: 80rpx;
|
||||||
align-items: center;
|
line-height: 80rpx;
|
||||||
justify-content: center;
|
background-color: #8883f0;
|
||||||
width: 180rpx;
|
|
||||||
height: 100rpx;
|
|
||||||
background: #8b83f0;
|
|
||||||
font-size: 50rpx;
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 30rpx;
|
}
|
||||||
|
|
||||||
|
.input {
|
||||||
|
input {
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
display: flex;
|
||||||
|
width: 400rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.view {
|
||||||
|
width: 200rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
background-color: #8883f0;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 80rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn2 {
|
.list {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 50rpx;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
|
||||||
|
.anniulist {
|
||||||
|
width: 658rpx;
|
||||||
|
margin: auto;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 32rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
.anniu {
|
||||||
width: 100%;
|
margin-right: 20rpx;
|
||||||
height: 100rpx;
|
width: 30%;
|
||||||
background: #8b83f0;
|
height: 90rpx;
|
||||||
font-size: 50rpx;
|
border-radius: 20rpx;
|
||||||
|
background-color: #8883f0;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 30rpx;
|
font-size: 32rpx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 90rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.pages {
|
.fanhui {
|
||||||
padding: 0 66rpx;
|
width: 658rpx;
|
||||||
box-sizing: border-box;
|
height: 90rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
background-color: #8883f0;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 32rpx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 90rpx;
|
||||||
|
margin: auto;
|
||||||
|
margin-top: 50rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.machao {
|
||||||
|
width: 658rpx;
|
||||||
|
margin: auto;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 70rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: left;
|
||||||
|
width: 658rpx;
|
||||||
|
margin: auto;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shuom {
|
||||||
|
width: 658rpx;
|
||||||
|
margin: auto;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.iptbox {
|
.iptbox {
|
||||||
|
|
@ -473,99 +481,4 @@ page {
|
||||||
color: #808080;
|
color: #808080;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
|
||||||
margin-bottom: 84rpx;
|
|
||||||
|
|
||||||
image {
|
|
||||||
display: inline-block;
|
|
||||||
width: 48rpx;
|
|
||||||
height: 48rpx;
|
|
||||||
vertical-align: bottom;
|
|
||||||
margin-right: 10rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
text:nth-child(1) {
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 96rpx;
|
|
||||||
color: #262b37;
|
|
||||||
line-height: 88rpx;
|
|
||||||
text-align: left;
|
|
||||||
font-style: normal;
|
|
||||||
text-transform: none;
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 48rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.dblist {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 34rpx;
|
|
||||||
background: #ffffff;
|
|
||||||
box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08);
|
|
||||||
padding: 20rpx 0 24rpx 18rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 10rpx;
|
|
||||||
|
|
||||||
.lt {
|
|
||||||
padding-left: 10rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin-right: 38rpx;
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 42rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.cen {
|
|
||||||
width: 370rpx;
|
|
||||||
padding-left: 10rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
.name {
|
|
||||||
white-space: nowrap;
|
|
||||||
font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #262b37;
|
|
||||||
line-height: 40rpx;
|
|
||||||
text-align: left;
|
|
||||||
font-style: normal;
|
|
||||||
text-transform: none;
|
|
||||||
margin-top: 10rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mac {
|
|
||||||
font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #262b37;
|
|
||||||
line-height: 32rpx;
|
|
||||||
text-align: left;
|
|
||||||
font-style: normal;
|
|
||||||
text-transform: none;
|
|
||||||
margin-top: 16rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.rt {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-top: 22rpx;
|
|
||||||
|
|
||||||
text {
|
|
||||||
display: inline-block;
|
|
||||||
width: 108rpx;
|
|
||||||
height: 60rpx;
|
|
||||||
background: rgba(255, 255, 255, 0);
|
|
||||||
border: 2rpx solid #8883f0;
|
|
||||||
filter: blur(0px);
|
|
||||||
border-radius: 20rpx;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 60rpx;
|
|
||||||
color: #8883f0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="pages">
|
<view class="pages">
|
||||||
<u-navbar
|
|
||||||
:background="bgc"
|
|
||||||
:border-bottom="false"
|
|
||||||
:custom-back="backPage"
|
|
||||||
height="50"
|
|
||||||
title="添加设备"
|
|
||||||
title-color="#262B37"
|
|
||||||
title-size="38"
|
|
||||||
></u-navbar>
|
|
||||||
<view class="title">
|
<view class="title">
|
||||||
<view class="title_li" style="display: flex; align-items: center">
|
<view class="title_li" style="display: flex; align-items: center">
|
||||||
<view class="text">设备列表</view>
|
<view class="text">设备列表</view>
|
||||||
<view class="btns" @click="toControl()"> 控制台</view>
|
|
||||||
<view class="btns" @click="replay()"> 重置页面</view>
|
<view class="btns" @click="replay()"> 重置页面</view>
|
||||||
</view>
|
</view>
|
||||||
<image
|
<image
|
||||||
|
|
@ -153,13 +144,8 @@ export default {
|
||||||
url: '/page_user/luru/index',
|
url: '/page_user/luru/index',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
backPage() {
|
|
||||||
uni.switchTab({
|
|
||||||
url: '/pages/my',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
toControl() {
|
toControl() {
|
||||||
uni.redirectTo({
|
uni.navigateTo({
|
||||||
url: '/page_user/luru/controlDevice',
|
url: '/page_user/luru/controlDevice',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
@ -206,7 +192,7 @@ export default {
|
||||||
choose(e) {
|
choose(e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
let Bluetoothmac = e.name.substring(5)
|
let Bluetoothmac = e.name.substring(5)
|
||||||
uni.redirectTo({
|
uni.navigateTo({
|
||||||
url: '/page_user/luru/bind_mac?mac=' + Bluetoothmac,
|
url: '/page_user/luru/bind_mac?mac=' + Bluetoothmac,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
15
pages.json
15
pages.json
|
|
@ -119,25 +119,22 @@
|
||||||
{
|
{
|
||||||
"path": "luru/index",
|
"path": "luru/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "上传",
|
"navigationBarTitleText": "添加设备",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "luru/controlDevice",
|
"path": "luru/controlDevice",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "上传",
|
"navigationBarTitleText": "设备控制",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "luru/bind_mac",
|
"path": "luru/bind_mac",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "上传",
|
"navigationBarTitleText": "添加设备",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user