master
xingyy 9 months ago
parent 6166648731
commit 196c725c80

@ -34,6 +34,16 @@
"titleNView": false //
}
}
},
{
"path": "pages/control-gate/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"app-plus": {
"titleNView": false //
}
}
}
],
"globalStyle": {

@ -0,0 +1,65 @@
<template>
<div>
<tm-sheet >
<tm-alerts :label="`当前设备编号:${sn}`" close></tm-alerts>
<div style="display: flex;flex-direction: column;align-items: center">
<tm-images :src="imgUrl"></tm-images>
<tm-button @click="getPhoto" >获取当前照片</tm-button>
</div>
<tm-listitem title="开关门">
<template v-slot:rightIcon="">
<tm-switch :width="260" :height="80" offBgcolor="blue" :text="['打开','关闭']" v-model="switchValue" @change="changeSwitch" ></tm-switch>
</template>
</tm-listitem>
</tm-sheet>
</div>
</template>
<script>
export default {
name: "index",
data(){
return{
sn:'',
switchValue:false,
imgUrl:'',
}
},
onLoad(options){
this.sn=options.sn
this.getPhoto()
},
methods:{
changeSwitch(data){
uni.request({
method:'post',
responseType: 'arraybuffer',
url:'http://114.218.158.24:9020/secret/set/door',
data:{deviceNum:this.sn,value:data.checked?'on':'off'},
complete:(res)=>{
if (res.statusCode===200){
uni.showToast({ title: '操作成功', icon: 'none' });
}
}
})
},
getPhoto(){
uni.request({
method:'post',
responseType: 'arraybuffer',
url:'http://114.218.158.24:9020/secret/batch/capture/photo',
data:{deviceNum:this.sn},
complete:(res)=>{
const arrayBuffer = new Uint8Array(res.data)
this.imgUrl = "data:image/png;base64," + uni.arrayBufferToBase64(arrayBuffer)
}
})
}
}
}
</script>
<style scoped lang="scss">
</style>
Loading…
Cancel
Save