submit
This commit is contained in:
parent
6166648731
commit
196c725c80
10
pages.json
10
pages.json
@ -34,6 +34,16 @@
|
||||
"titleNView": false // 禁用原生导航
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/control-gate/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false,
|
||||
"app-plus": {
|
||||
"titleNView": false // 禁用原生导航
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
65
pages/control-gate/index.vue
Normal file
65
pages/control-gate/index.vue
Normal file
@ -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…
Reference in New Issue
Block a user