147 lines
3.0 KiB
Vue
147 lines
3.0 KiB
Vue
<template>
|
||
<view class="fullHeight">
|
||
<headers :showBack="true">
|
||
<view class="headerName">
|
||
{{pageTitle}}
|
||
</view>
|
||
</headers>
|
||
<view class="task-des">
|
||
<text>任务类型:</text>
|
||
<text>表面垂直度</text>
|
||
</view>
|
||
<view class="task-des">
|
||
<text>任务编码:</text>
|
||
<text>test123</text>
|
||
</view>
|
||
<view class="task-des">
|
||
<text>截止时间:</text>
|
||
<text>2024-2-1 10:3:0</text>
|
||
</view>
|
||
<view class="test-area-title">
|
||
<text>选择测区:</text>
|
||
<button type="default" size="mini" @click="addArea">添加测区</button>
|
||
</view>
|
||
<view class="bigOperateBtn">
|
||
<button type="primary" size="mini">实时上报</button>
|
||
<button type="primary" size="mini">上传</button>
|
||
<button type="primary" size="mini">下一步</button>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
writeBLE
|
||
} from '@/static/js/BLEConn.js';
|
||
export default {
|
||
data() {
|
||
return {
|
||
pageTitle: '任务详情'
|
||
}
|
||
},
|
||
onLoad(options) {
|
||
this.startSpringback()
|
||
},
|
||
onShow() {
|
||
|
||
},
|
||
methods: {
|
||
// 4. 发送数据
|
||
async send(data) {
|
||
//格式检查
|
||
// if (!this.sendData) {
|
||
// uni.showToast({
|
||
// title: '数据不能为空'
|
||
// })
|
||
// return
|
||
// }
|
||
// uni.showLoading({
|
||
// title: '正在发送数据',
|
||
// icon: "loading",
|
||
// mask: true
|
||
// })
|
||
await writeBLE(data).then(res => {
|
||
console.log('发送数据成功',res)
|
||
// uni.hideLoading()
|
||
// uni.showToast({
|
||
// title: '发送成功:' + res
|
||
// })
|
||
}).catch(err => {
|
||
// uni.hideLoading()
|
||
uni.showToast({
|
||
title: '开启采集数据失败',
|
||
icon: 'none'
|
||
})
|
||
})
|
||
},
|
||
reviceDevData(e) {
|
||
console.log('设备返回的数据')
|
||
console.log(e)
|
||
var arr = e.split('"')
|
||
// if (arr[0] == '$RRD') {
|
||
// this.table['reboundValue' + this.dataIndex] = arr[1]
|
||
// this.calculate()
|
||
// this.dataIndex++
|
||
// // if (this.dataIndex > 16) {
|
||
// if (this.dataIndex == 17) {
|
||
// this.stopGetData()
|
||
// // this.measureBtn()
|
||
// }
|
||
// }
|
||
|
||
},
|
||
//开启回弹采集
|
||
startSpringback(){
|
||
this.send('24535253F8230D0A')
|
||
//监听接收数据事件
|
||
uni.$on('recvEvent', this.reviceDevData)
|
||
},
|
||
addArea(){
|
||
uni.navigateTo({
|
||
url: './addTestArea'
|
||
});
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.fullHeight{
|
||
position: relative;
|
||
}
|
||
.task-des{
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 20rpx 20rpx;
|
||
}
|
||
.test-area-title{
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 20rpx 20rpx;
|
||
border-top: 1px solid #ccc;
|
||
border-bottom: 1px solid #ccc;
|
||
button{
|
||
// padding: 0px;
|
||
margin: 0px;
|
||
}
|
||
}
|
||
.bigOperateBtn{
|
||
position: fixed;
|
||
bottom: 0px;
|
||
left: 0px;
|
||
width: 100%;
|
||
height: 70px;
|
||
line-height: 70px;
|
||
color: white;
|
||
font-size: 40rpx;
|
||
border-top: 1px solid #ccc;
|
||
border-bottom: 1px solid #ccc;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-around;
|
||
button{
|
||
width: 180rpx;
|
||
}
|
||
}
|
||
</style> |