对接PCV02
This commit is contained in:
parent
e093806371
commit
26cb97f0eb
|
|
@ -120,7 +120,7 @@
|
||||||
|
|
||||||
.nolist {
|
.nolist {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
width: 100%;
|
width: calc(100% - 30px);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
|
|
|
||||||
41
pages.json
41
pages.json
|
|
@ -266,7 +266,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/devices/devices",
|
"path": "pages/devices/search",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "蓝牙搜索",
|
"navigationBarTitleText": "蓝牙搜索",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
|
|
@ -300,6 +300,45 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/devices/PCV02",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/business/addDevice",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "设备列表",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"app-plus": {
|
||||||
|
"titleNView": {
|
||||||
|
"backgroundImage": "linear-gradient(to right, #477EFF, #39D9C9)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/business/search",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "搜索设备",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"app-plus": {
|
||||||
|
"titleNView": {
|
||||||
|
"backgroundImage": "linear-gradient(to right, #477EFF, #39D9C9)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/devices/PCT01",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "",
|
||||||
|
"enablePullDownRefresh" : false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,190 @@
|
||||||
<view @click="active=2" :class="[active==2?'active':'']">曲线</view>
|
<view @click="active=2" :class="[active==2?'active':'']">曲线</view>
|
||||||
</view>
|
</view>
|
||||||
<!--报告 -->
|
<!--报告 -->
|
||||||
<view v-if="active==1">
|
<view v-if="active==1" class="report">
|
||||||
<report :acd_id="acd_id"></report>
|
<view class="box" v-if="info&&info.top_list.length">
|
||||||
|
<view class="time">{{info?info.record_time:''}}</view>
|
||||||
|
<view class="item2">
|
||||||
|
<view class="item2_data" v-for="(item,index) in info.top_list" @click="handleToggleTop(item)">
|
||||||
|
<view class="data ">
|
||||||
|
<view class="c666 mb-5">{{item.name}}</view>
|
||||||
|
<view><text>{{item.value}}</text>{{item.unit}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="myinfoPage" v-if="infoListTop">
|
||||||
|
<view class="desc">
|
||||||
|
<view v-if="infoListTop.desc" class="ming">{{infoListTop.desc}}</view>
|
||||||
|
<view :class="[infoListTop.list.length?'statuevue':'']" v-if="infoListTop.list">
|
||||||
|
<view class="bi">
|
||||||
|
<view :style="'left:'+infoListTop.offset+'%'" class="peobox">
|
||||||
|
<view class="xx"></view>
|
||||||
|
</view>
|
||||||
|
<view class="item" v-for="(ite , ind) in infoListTop.list" :key="ind"
|
||||||
|
:style="{backgroundColor:ite.color}">
|
||||||
|
<view class="span1">{{ite.text}}</view>
|
||||||
|
<view class="span" v-if="ind<infoListTop.list.length-1">{{ite.max_val}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="nolist" v-if="!info">
|
||||||
|
<image src="@/static/none.png"></image>
|
||||||
|
<text>暂无数据,请手动添加~</text>
|
||||||
|
</view>
|
||||||
|
<!-- -->
|
||||||
|
<view class="box2" v-if="info">
|
||||||
|
<view>身体得分:{{info?info.score_value:0}}分</view>
|
||||||
|
<view>身体类型:{{info?info.body_type_value:'无'}}</view>
|
||||||
|
</view>
|
||||||
|
<!-- -->
|
||||||
|
<view class="info">
|
||||||
|
<view class="item" @click="handlerRecord">
|
||||||
|
<text class="t-icon-jilu1 t-icon"></text>
|
||||||
|
<view>手动记录</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" @click="$tools.handleDevicesMac(isdevice,acd_id)">
|
||||||
|
<text class="t-icon-wulianjie t-icon"></text>
|
||||||
|
<view>连接设备</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- -->
|
||||||
|
<view class="bold mt-10" v-if="info&&info.bottom_list">其他数据</view>
|
||||||
|
<view class="myinfoPage" v-if="info&&info.bottom_list">
|
||||||
|
<view class="box1">
|
||||||
|
<uni-collapse accordion>
|
||||||
|
<uni-collapse-item class="list" v-for="(item,index) in info.bottom_list" :key="index">
|
||||||
|
<template v-slot:title>
|
||||||
|
<uni-list-item class="block">
|
||||||
|
<view class="name">
|
||||||
|
<icon class="t-icon iconfont" :class="'t-icon-'+item.key_name"></icon>
|
||||||
|
{{item.name}}
|
||||||
|
</view>
|
||||||
|
<view class="val" v-if="item.title=='肥胖等级'||item.title=='体型'"> - </view>
|
||||||
|
<view class="val" v-else>{{item.value?item.value:'0'}}{{item.unit}}</view>
|
||||||
|
<view class="level">
|
||||||
|
<view class="btnf"
|
||||||
|
:style="{backgroundColor:(item.standard=='异常'?'#FFF':item.color)}"
|
||||||
|
:class="[item.standard=='异常'?'btnC':'']">
|
||||||
|
{{item.standard=='异常'?'-':item.standard}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-list-item>
|
||||||
|
</template>
|
||||||
|
<view class="desc">
|
||||||
|
<view v-if="item.desc" class="ming">{{item.desc}}</view>
|
||||||
|
<view :class="[item.list.length?'statuevue':'']" v-if="item.list">
|
||||||
|
<view class="bi" v-if="item.title!='基础代谢'">
|
||||||
|
<view :style="'left:'+item.offset+'%'" class="peobox">
|
||||||
|
<view class="xx"></view>
|
||||||
|
</view>
|
||||||
|
<view class="item" v-for="(ite , ind) in item.list" :key="ind"
|
||||||
|
:style="{backgroundColor:ite.color}">
|
||||||
|
<view class="span1">{{ite.text}}</view>
|
||||||
|
<view class="span" v-if="ind<item.list.length-1">{{ite.max_val}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-else>
|
||||||
|
<view class="kcalClass" v-if="item.list&&item.list.length">
|
||||||
|
标准值:{{item.list[0].max_val}}kcal
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-collapse-item>
|
||||||
|
</uni-collapse>
|
||||||
|
</view>
|
||||||
|
<view class="tips c999 ml-15">
|
||||||
|
<uni-icons type="info-filled" color="red"></uni-icons>
|
||||||
|
此测量数据仅供参考,不可代替医学专业测试!
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 手动记录 -->
|
||||||
|
<record :rtype="acd_id"></record>
|
||||||
</view>
|
</view>
|
||||||
<!-- 曲线 -->
|
<!-- 曲线 -->
|
||||||
<view v-if="active==2">
|
<view v-if="active==2" class="charts">
|
||||||
<charts :acd_id="acd_id"></charts>
|
<view class="TrendPage">
|
||||||
|
<!-- 时间选择 -->
|
||||||
|
<view class="boxTime">
|
||||||
|
<view class="one">
|
||||||
|
<uni-datetime-picker type="date" :end="startDate" :clear-icon="false"
|
||||||
|
:value="startTime?startTime:startDate" @change="handStartTimeH" :border="false" />
|
||||||
|
<view>~</view>
|
||||||
|
<uni-datetime-picker type="date" :end="endDate" :clear-icon="false"
|
||||||
|
:value="endTime?endTime:endDate" @change="handEndTimeH" :border="false" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 曲线图 -->
|
||||||
|
<view class="box" v-if="weightList.length">
|
||||||
|
<view class="listC">
|
||||||
|
<view :class="{active2:index==active1}" class="name" v-for="(item,index) in weightList"
|
||||||
|
:key="index" @click="showbox(index)">
|
||||||
|
{{item.title}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="blockC">
|
||||||
|
<view v-if="handTrue">
|
||||||
|
<qiunDataCharts type="area" :chartData="lineData" :canvas2d="true" canvasId="charts09"
|
||||||
|
:cHeight="480" :cWidth="680" :animation="false"
|
||||||
|
:opts="{enableScroll:true,xAxis:{scrollShow:false,itemCount:3}}" :ontouch="true" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="box" v-else>
|
||||||
|
<view class="nolist">
|
||||||
|
<image src="@/static/none.png"></image>
|
||||||
|
<text>暂无数据,请手动添加~</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 目标-->
|
||||||
|
<view class="gridList">
|
||||||
|
<view class="info">
|
||||||
|
<view class="item" @click="navTo('/pages/history/history?acd_id='+ acd_id)">
|
||||||
|
<text class="t-icon-lishi t-icon"></text>
|
||||||
|
<view>历史记录</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" @click="navTo('/pages/compk/contrast?acd_id='+ acd_id)">
|
||||||
|
<text class="t-icon-renshiduibifenxi t-icon"></text>
|
||||||
|
<view>数据对比</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="data">
|
||||||
|
<view class="item" @click="handleClick(1)">
|
||||||
|
<view class="val">
|
||||||
|
{{userInfo.target_current?userInfo.target_current.target_weight:0}}<text>kg</text>
|
||||||
|
</view>
|
||||||
|
<view class="name">目标体重<uni-icons class="iconfont icon-bianji" color="#FEC407"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="val">
|
||||||
|
{{userInfo.target_current?Math.abs(userInfo.target_current.cumulative_weight):0}}<text>kg</text>
|
||||||
|
</view>
|
||||||
|
<view class="name" v-if="Number(userInfo.target_current.cumulative_weight)>0">累计增重</view>
|
||||||
|
<view class="name" v-else>累计减重</view>
|
||||||
|
</view>
|
||||||
|
<view class="item" @click="handleClick(2)">
|
||||||
|
<view class="val">
|
||||||
|
{{userInfo.target_current?userInfo.target_current.initial_weight:0}}<text>kg</text>
|
||||||
|
</view>
|
||||||
|
<view class="name">初始体重<uni-icons class="iconfont icon-bianji" color="#FEC407"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="val">
|
||||||
|
{{userInfo.target_current?userInfo.target_current.cumulative_day:0}}<text>天</text>
|
||||||
|
</view>
|
||||||
|
<view class="name">减重天数</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 初始 -->
|
||||||
|
<firstweight :type="ind"></firstweight>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -20,17 +198,40 @@
|
||||||
import {
|
import {
|
||||||
mapState
|
mapState
|
||||||
} from "vuex";
|
} from "vuex";
|
||||||
import report from "./components/report.vue"
|
import record from '@/components/manuallyAdd/record.vue';
|
||||||
import charts from "./components/charts.vue"
|
import firstweight from '@/components/target/firstweight.vue';
|
||||||
|
import qiunDataCharts from '@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
active: 1,
|
active: 1,
|
||||||
acd_id: "",
|
acd_id: 2,
|
||||||
|
isdevice: false,
|
||||||
|
infoList: [],
|
||||||
|
infoListTop: {},
|
||||||
|
ind: 0,
|
||||||
|
active1: 0,
|
||||||
|
startTime: "",
|
||||||
|
endTime: "",
|
||||||
|
lineData: {},
|
||||||
|
handTrue: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['user']),
|
...mapState(['user', "MeasureResult", "Trend"]),
|
||||||
|
weightList() {
|
||||||
|
let that = this
|
||||||
|
that.showbox(0)
|
||||||
|
return that.Trend
|
||||||
|
},
|
||||||
|
userInfo() {
|
||||||
|
return this.user
|
||||||
|
},
|
||||||
|
info() {
|
||||||
|
let that = this
|
||||||
|
that.infoListTop = that.MeasureResult ? that.MeasureResult.top_list[0] : {}
|
||||||
|
return that.MeasureResult
|
||||||
|
},
|
||||||
endDate() {
|
endDate() {
|
||||||
return this.$tools.getDate("start")
|
return this.$tools.getDate("start")
|
||||||
},
|
},
|
||||||
|
|
@ -39,11 +240,14 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
report,
|
record,
|
||||||
charts
|
firstweight,
|
||||||
|
qiunDataCharts,
|
||||||
},
|
},
|
||||||
onShow() {
|
onLoad(options) {
|
||||||
let that = this
|
let that = this
|
||||||
|
that.acd_id = options.acd_id
|
||||||
|
that.isdevice = options.device
|
||||||
that.$store.dispatch("getResult", {
|
that.$store.dispatch("getResult", {
|
||||||
aud_id: uni.getStorageSync('userid')
|
aud_id: uni.getStorageSync('userid')
|
||||||
})
|
})
|
||||||
|
|
@ -52,13 +256,95 @@
|
||||||
s_time: that.startDate,
|
s_time: that.startDate,
|
||||||
e_time: that.endDate
|
e_time: that.endDate
|
||||||
})
|
})
|
||||||
},
|
console.log("11111", options)
|
||||||
onLoad(options) {
|
|
||||||
let that = this
|
|
||||||
that.acd_id = options.acd_id
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 历史数据删除时重新加载接口
|
||||||
|
reload() {
|
||||||
|
let that = this
|
||||||
|
console.log('重新加载');
|
||||||
|
this.$nextTick(() => {
|
||||||
|
that.$store.dispatch("getResult", {
|
||||||
|
aud_id: uni.getStorageSync('userid')
|
||||||
|
})
|
||||||
|
that.$store.dispatch("GetBodyTrendList", {
|
||||||
|
aud_id: uni.getStorageSync('userid'),
|
||||||
|
s_time: that.startDate,
|
||||||
|
e_time: that.endDate
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
showbox(index) {
|
||||||
|
let that = this
|
||||||
|
that.handTrue = false
|
||||||
|
that.$nextTick(function() {
|
||||||
|
that.handTrue = true
|
||||||
|
that.lineData = that.weightList.length ? that.weightList[index].line : {}
|
||||||
|
})
|
||||||
|
that.active1 = index
|
||||||
|
},
|
||||||
|
//开始
|
||||||
|
handStartTimeH(e) {
|
||||||
|
let that = this
|
||||||
|
if (that.endTime) {
|
||||||
|
if (Date.parse(e) > Date.parse(that.endTime)) {
|
||||||
|
that.$tools.msg("请选择正确的时间")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Date.parse(e) > Date.parse(that.endDate)) {
|
||||||
|
that.$tools.msg("请选择正确的时间")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that.startTime = e
|
||||||
|
let endtime = that.endTime ? that.endTime : that.endDate
|
||||||
|
that.$store.dispatch("GetBodyTrendList", {
|
||||||
|
aud_id: that.user.id,
|
||||||
|
s_time: that.startTime,
|
||||||
|
e_time: that.endTime ? that.endTime : that.endDate
|
||||||
|
})
|
||||||
|
that.showbox(0)
|
||||||
|
},
|
||||||
|
// 结束
|
||||||
|
handEndTimeH(e) {
|
||||||
|
let that = this
|
||||||
|
if (that.startTime) {
|
||||||
|
if (Date.parse(e) < Date.parse(that.startTime)) {
|
||||||
|
that.$tools.msg("请选择正确的时间")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Date.parse(e) < Date.parse(that.startDate)) {
|
||||||
|
that.$tools.msg("请选择正确的时间")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that.endTime = e
|
||||||
|
let startTime = that.startTime ? that.startTime : that.startDate
|
||||||
|
that.$store.dispatch("GetBodyTrendList", {
|
||||||
|
aud_id: uni.getStorageSync('userid'),
|
||||||
|
s_time: startTime,
|
||||||
|
e_time: that.endTime
|
||||||
|
})
|
||||||
|
that.showbox(0)
|
||||||
|
},
|
||||||
|
handleClick(ind) {
|
||||||
|
this.ind = ind
|
||||||
|
this.$store.commit("changeFirst", true);
|
||||||
|
},
|
||||||
|
// 报告
|
||||||
|
handlerRecord() {
|
||||||
|
this.$store.commit('changeRecord', true)
|
||||||
|
},
|
||||||
|
handleToggleTop(item) {
|
||||||
|
this.infoListTop = item
|
||||||
|
},
|
||||||
|
navTo(url) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: url
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -93,4 +379,358 @@
|
||||||
background: $maincolor;
|
background: $maincolor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 曲线
|
||||||
|
.charts {
|
||||||
|
.boxTime {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 10px 10px 0 0;
|
||||||
|
|
||||||
|
.one {
|
||||||
|
width: 80%;
|
||||||
|
display: flex;
|
||||||
|
line-height: 25px;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.box {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
border-radius: 0 0 10px 10px;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.listC {
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
width: 20%;
|
||||||
|
padding: 0 15px;
|
||||||
|
font-size: 14px;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 5px;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active2 {
|
||||||
|
color: #fff;
|
||||||
|
background: $maincolor;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.blockC {
|
||||||
|
clear: both;
|
||||||
|
width: 100%;
|
||||||
|
height: 250px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 0 0 10px 10px;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.gridList {
|
||||||
|
margin: 0px !important;
|
||||||
|
width: 100% !important;
|
||||||
|
|
||||||
|
.data {
|
||||||
|
.item {
|
||||||
|
display: block !important
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 报告
|
||||||
|
.report {
|
||||||
|
.box {
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
.time {
|
||||||
|
color: #999;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item2 {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.item2_data {
|
||||||
|
width: 33%;
|
||||||
|
|
||||||
|
.data {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
border-right: 1PX solid #f7f7f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-size: 20px !important;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.box2 {
|
||||||
|
height: 50px;
|
||||||
|
line-height: 50px;
|
||||||
|
border-radius: 10px;
|
||||||
|
display: flex;
|
||||||
|
padding: 0 10px;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
color: #fff;
|
||||||
|
width: 45%;
|
||||||
|
height: 50px;
|
||||||
|
background: $maincolor;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 10px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
text {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 10px;
|
||||||
|
display: inline-block;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.myinfoPage {
|
||||||
|
width: 100%;
|
||||||
|
background: #fff;
|
||||||
|
margin-top: 10px;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
border-radius: 10px;
|
||||||
|
|
||||||
|
.box1 {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 14px;
|
||||||
|
position: relative;
|
||||||
|
margin: 0px 15px 0;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
|
||||||
|
.list {
|
||||||
|
width: 100%;
|
||||||
|
color: #666;
|
||||||
|
padding: 0;
|
||||||
|
line-height: 50px;
|
||||||
|
// display: flex;
|
||||||
|
// justify-content: space-between;
|
||||||
|
// align-items: center;
|
||||||
|
// flex-wrap: wrap;
|
||||||
|
|
||||||
|
image,
|
||||||
|
.t-icon {
|
||||||
|
width: 18px !important;
|
||||||
|
height: 18px;
|
||||||
|
border: 2px solid #c7c7c7;
|
||||||
|
background-color: #c7c7c7;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
color: #666;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.level,
|
||||||
|
.val {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
width: 40%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 20px;
|
||||||
|
text-align: right;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
line-height: 20px;
|
||||||
|
text-align: left;
|
||||||
|
width: calc(100%-20px);
|
||||||
|
height: auto;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #999;
|
||||||
|
padding: 10px;
|
||||||
|
background: #f7f7f7;
|
||||||
|
|
||||||
|
|
||||||
|
.statuevue {
|
||||||
|
height: 35px;
|
||||||
|
position: relative;
|
||||||
|
width: 100% !important;
|
||||||
|
margin: 20px auto 10px;
|
||||||
|
|
||||||
|
.bi {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: auto;
|
||||||
|
padding-top: 10px;
|
||||||
|
|
||||||
|
.peobox {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: -1px;
|
||||||
|
|
||||||
|
.xx {
|
||||||
|
width: 5px;
|
||||||
|
height: 5px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #fff;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 9;
|
||||||
|
border: 2px solid #1b2086;
|
||||||
|
top: 9px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
position: relative;
|
||||||
|
margin: 0;
|
||||||
|
flex: 1;
|
||||||
|
height: 5px;
|
||||||
|
color: #666;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
.span1 {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
position: absolute;
|
||||||
|
top: -23px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.span {
|
||||||
|
margin-top: 8px;
|
||||||
|
position: absolute;
|
||||||
|
right: -8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.yuanxing {
|
||||||
|
display: inline-block;
|
||||||
|
background: #f19601;
|
||||||
|
width: 8px;
|
||||||
|
height: 12px;
|
||||||
|
margin-right: 5px;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnf {
|
||||||
|
font-size: 13px;
|
||||||
|
border-radius: 5px;
|
||||||
|
height: 22px;
|
||||||
|
margin: 0 10px 0 0;
|
||||||
|
line-height: 22px;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 400;
|
||||||
|
width: 44px !important;
|
||||||
|
text-align: center !important;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tivon {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.bianji {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.box1 :last-child.list {
|
||||||
|
.val {
|
||||||
|
width: 25% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.kcalClass {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 55px;
|
||||||
|
margin: -20px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yichang {
|
||||||
|
background: #ffe4be;
|
||||||
|
color: #ff4239;
|
||||||
|
padding: 5px;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin: 0 15px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/deep/.uni-collapse-item {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/.uni-collapse-item__title-arrow {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/.uni-collapse-item__wrap-content.uni-collapse-item--border {
|
||||||
|
border-bottom-width: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -1,271 +0,0 @@
|
||||||
<template>
|
|
||||||
<view>
|
|
||||||
<view class="TrendPage">
|
|
||||||
<!-- 时间选择 -->
|
|
||||||
<view class="boxTime">
|
|
||||||
<view class="one">
|
|
||||||
<!-- <picker mode="date" class="f-l" :value="startTime?startTime:startDate" @change="handStartTimeH">
|
|
||||||
<view class="uni-input">{{startTime?startTime:startDate}}
|
|
||||||
<uni-icons class="iconfont icon-arrow-down-bold"></uni-icons>
|
|
||||||
</view>
|
|
||||||
</picker> -->
|
|
||||||
<uni-datetime-picker type="date" :end="startDate" :clear-icon="false"
|
|
||||||
:value="startTime?startTime:startDate" @change="handStartTimeH" :border="false" />
|
|
||||||
<view>~</view>
|
|
||||||
<uni-datetime-picker type="date" :end="endDate" :clear-icon="false" :value="endTime?endTime:endDate"
|
|
||||||
@change="handEndTimeH" :border="false" />
|
|
||||||
<!-- <picker mode="date" :end="endDate" class="f-r" :value="endDate" @change="handEndTimeH">
|
|
||||||
<view class="uni-input"> {{endTime?endTime:endDate}}
|
|
||||||
<uni-icons class="iconfont icon-arrow-down-bold"></uni-icons>
|
|
||||||
</view>
|
|
||||||
</picker> -->
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 曲线图 -->
|
|
||||||
<view class="box" v-if="weightList.length">
|
|
||||||
<view class="listC">
|
|
||||||
<view :class="{active2:index==active1}" class="name" v-for="(item,index) in weightList" :key="index"
|
|
||||||
@click="showbox(index)">
|
|
||||||
{{item.title}}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="blockC">
|
|
||||||
<view v-if="handTrue">
|
|
||||||
<qiunDataCharts type="area" :chartData="lineData" :canvas2d="true" canvasId="charts09"
|
|
||||||
:cHeight="480" :cWidth="680" :animation="false"
|
|
||||||
:opts="{enableScroll:true,xAxis:{scrollShow:false,itemCount:3}}" :ontouch="true" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="box" v-else>
|
|
||||||
<view class="nolist">
|
|
||||||
<image src="@/static/none.png"></image>
|
|
||||||
<text>暂无数据,请手动添加~</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 目标-->
|
|
||||||
<view class="gridList">
|
|
||||||
<view class="info">
|
|
||||||
<view class="item" @click="navTo('/pages/history/history?acd_id='+acd_id)">
|
|
||||||
<text class="t-icon-lishi t-icon"></text>
|
|
||||||
<view>历史记录</view>
|
|
||||||
</view>
|
|
||||||
<view class="item" @click="navTo('/pages/compk/contrast?acd_id='+acd_id)">
|
|
||||||
<text class="t-icon-renshiduibifenxi t-icon"></text>
|
|
||||||
<view>数据对比</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="data">
|
|
||||||
<view class="item" @click="handleClick(1)">
|
|
||||||
<view class="val">{{userInfo.target_current?userInfo.target_current.target_weight:0}}<text>kg</text>
|
|
||||||
</view>
|
|
||||||
<view class="name">目标体重<uni-icons class="iconfont icon-bianji" color="#FEC407"></uni-icons>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="item">
|
|
||||||
<view class="val">
|
|
||||||
{{userInfo.target_current?Math.abs(userInfo.target_current.cumulative_weight):0}}<text>kg</text>
|
|
||||||
</view>
|
|
||||||
<view class="name" v-if="Number(userInfo.target_current.cumulative_weight)>0">累计增重</view>
|
|
||||||
<view class="name" v-else>累计减重</view>
|
|
||||||
</view>
|
|
||||||
<view class="item" @click="handleClick(2)">
|
|
||||||
<view class="val">
|
|
||||||
{{userInfo.target_current?userInfo.target_current.initial_weight:0}}<text>kg</text>
|
|
||||||
</view>
|
|
||||||
<view class="name">初始体重<uni-icons class="iconfont icon-bianji" color="#FEC407"></uni-icons>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="item">
|
|
||||||
<view class="val">
|
|
||||||
{{userInfo.target_current?userInfo.target_current.cumulative_day:0}}<text>天</text>
|
|
||||||
</view>
|
|
||||||
<view class="name">减重天数</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 初始 -->
|
|
||||||
<firstweight :type="ind"></firstweight>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
import {
|
|
||||||
mapState
|
|
||||||
} from "vuex";
|
|
||||||
import firstweight from '@/components/target/firstweight.vue';
|
|
||||||
import qiunDataCharts from '@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue';
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
firstweight,
|
|
||||||
qiunDataCharts,
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
acd_id: ""
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapState(["user", "Trend"]),
|
|
||||||
weightList() {
|
|
||||||
return this.Trend
|
|
||||||
},
|
|
||||||
userInfo() {
|
|
||||||
return this.user
|
|
||||||
},
|
|
||||||
endDate() {
|
|
||||||
return this.$tools.getDate("start")
|
|
||||||
},
|
|
||||||
startDate() {
|
|
||||||
return this.$tools.GetDateStr(-90);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
let that = this
|
|
||||||
that.showbox(0)
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
showbox(index) {
|
|
||||||
let that = this
|
|
||||||
that.handTrue = false
|
|
||||||
this.$nextTick(function() {
|
|
||||||
that.handTrue = true
|
|
||||||
that.lineData = that.weightList.length ? that.weightList[index].line : {}
|
|
||||||
})
|
|
||||||
that.active1 = index
|
|
||||||
},
|
|
||||||
//开始
|
|
||||||
handStartTimeH(e) {
|
|
||||||
let that = this
|
|
||||||
if (that.endTime) {
|
|
||||||
if (Date.parse(e) > Date.parse(that.endTime)) {
|
|
||||||
that.$tools.msg("请选择正确的时间")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (Date.parse(e) > Date.parse(that.endDate)) {
|
|
||||||
that.$tools.msg("请选择正确的时间")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
that.startTime = e
|
|
||||||
let endtime = that.endTime ? that.endTime : that.endDate
|
|
||||||
that.$store.dispatch("GetBodyTrendList", {
|
|
||||||
aud_id: that.user.id,
|
|
||||||
s_time: that.startTime,
|
|
||||||
e_time: that.endTime ? that.endTime : that.endDate
|
|
||||||
})
|
|
||||||
that.showbox(0)
|
|
||||||
},
|
|
||||||
// 结束
|
|
||||||
handEndTimeH(e) {
|
|
||||||
let that = this
|
|
||||||
if (that.startTime) {
|
|
||||||
if (Date.parse(e) < Date.parse(that.startTime)) {
|
|
||||||
that.$tools.msg("请选择正确的时间")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (Date.parse(e) < Date.parse(that.startDate)) {
|
|
||||||
that.$tools.msg("请选择正确的时间")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
that.endTime = e
|
|
||||||
let startTime = that.startTime ? that.startTime : that.startDate
|
|
||||||
that.$store.dispatch("GetBodyTrendList", {
|
|
||||||
aud_id: uni.getStorageSync('userid'),
|
|
||||||
s_time: startTime,
|
|
||||||
e_time: that.endTime
|
|
||||||
})
|
|
||||||
that.showbox(0)
|
|
||||||
},
|
|
||||||
handleClick(ind) {
|
|
||||||
this.ind = ind
|
|
||||||
this.$store.commit("changeFirst", true);
|
|
||||||
},
|
|
||||||
navTo(url) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: url
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
ind: 0,
|
|
||||||
active1: 0,
|
|
||||||
startTime: "",
|
|
||||||
endTime: "",
|
|
||||||
lineData: {},
|
|
||||||
handTrue: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.boxTime {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 10px 10px 0 0;
|
|
||||||
|
|
||||||
.one {
|
|
||||||
width: 80%;
|
|
||||||
display: flex;
|
|
||||||
line-height: 25px;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.box {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
border-radius: 0 0 10px 10px;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.listC {
|
|
||||||
background-color: #fff;
|
|
||||||
|
|
||||||
.name {
|
|
||||||
width: 20%;
|
|
||||||
padding: 0 15px;
|
|
||||||
font-size: 14px;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 5px;
|
|
||||||
height: 30px;
|
|
||||||
line-height: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.active2 {
|
|
||||||
color: #fff;
|
|
||||||
background: $maincolor;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.blockC {
|
|
||||||
clear: both;
|
|
||||||
width: 100%;
|
|
||||||
height: 250px;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 0 0 10px 10px;
|
|
||||||
padding-bottom: 15px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.gridList {
|
|
||||||
margin: 0px !important;
|
|
||||||
width: 100% !important;
|
|
||||||
|
|
||||||
.data {
|
|
||||||
.item {
|
|
||||||
display: block !important
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,428 +0,0 @@
|
||||||
<template>
|
|
||||||
<view class="">
|
|
||||||
<view class="nolist" v-if="!info">
|
|
||||||
<image src="@/static/none.png"></image>
|
|
||||||
<text>暂无数据,请手动添加~</text>
|
|
||||||
</view>
|
|
||||||
<view class="box" v-if="info&&info.top_list.length">
|
|
||||||
<view class="time">{{info?info.record_time:''}}</view>
|
|
||||||
<view class="item2">
|
|
||||||
<view class="item2_data" v-for="(item,index) in info.top_list" @click="handleToggleTop(item)">
|
|
||||||
<view class="data ">
|
|
||||||
<view class="c666 mb-5">{{item.name}}</view>
|
|
||||||
<view><text>{{item.value}}</text>{{item.unit}}</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="myinfoPage" v-if="infoListTop">
|
|
||||||
<view class="desc">
|
|
||||||
<view v-if="infoListTop.desc" class="ming">{{infoListTop.desc}}</view>
|
|
||||||
<view :class="[infoListTop.list.length?'statuevue':'']" v-if="infoListTop.list">
|
|
||||||
<view class="bi">
|
|
||||||
<view :style="'left:'+infoListTop.offset+'%'" class="peobox">
|
|
||||||
<view class="xx"></view>
|
|
||||||
</view>
|
|
||||||
<view class="item" v-for="(ite , ind) in infoListTop.list" :key="ind"
|
|
||||||
:style="{backgroundColor:ite.color}">
|
|
||||||
<view class="span1">{{ite.text}}</view>
|
|
||||||
<view class="span" v-if="ind<infoListTop.list.length-1">{{ite.max_val}}</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- -->
|
|
||||||
<view class="box2" v-if="info">
|
|
||||||
<view>身体得分:{{info?info.score_value:0}}分</view>
|
|
||||||
<view>身体类型:{{info?info.body_type_value:'无'}}</view>
|
|
||||||
</view>
|
|
||||||
<!-- -->
|
|
||||||
<view class="info">
|
|
||||||
<view class="item" @click="$store.commit('changeRecord', true)">
|
|
||||||
<text class="t-icon-jilu1 t-icon"></text>
|
|
||||||
<view>手动记录</view>
|
|
||||||
</view>
|
|
||||||
<view class="item" @click="$tools.handleBluetoothClick()">
|
|
||||||
<text class="t-icon-wulianjie t-icon"></text>
|
|
||||||
<view>连接设备</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- -->
|
|
||||||
<view class="bold mt-10" v-if="info&&info.bottom_list">其他数据</view>
|
|
||||||
<view class="myinfoPage" v-if="info&&info.bottom_list">
|
|
||||||
<view class="box1">
|
|
||||||
<uni-collapse accordion>
|
|
||||||
<uni-collapse-item class="list" v-for="(item,index) in info.bottom_list" :key="index">
|
|
||||||
<template v-slot:title>
|
|
||||||
<uni-list-item class="block">
|
|
||||||
<view class="name">
|
|
||||||
<icon class="t-icon iconfont" :class="'t-icon-'+item.key_name"></icon>
|
|
||||||
{{item.name}}
|
|
||||||
</view>
|
|
||||||
<view class="val" v-if="item.title=='肥胖等级'||item.title=='体型'"> - </view>
|
|
||||||
<view class="val" v-else>{{item.value?item.value:'0'}}{{item.unit}}</view>
|
|
||||||
<view class="level">
|
|
||||||
<view class="btnf"
|
|
||||||
:style="{backgroundColor:(item.standard=='异常'?'#FFF':item.color)}"
|
|
||||||
:class="[item.standard=='异常'?'btnC':'']">
|
|
||||||
{{item.standard=='异常'?'-':item.standard}}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</uni-list-item>
|
|
||||||
</template>
|
|
||||||
<view class="desc">
|
|
||||||
<view v-if="item.desc" class="ming">{{item.desc}}</view>
|
|
||||||
<view :class="[item.list.length?'statuevue':'']" v-if="item.list">
|
|
||||||
<view class="bi" v-if="item.title!='基础代谢'">
|
|
||||||
<view :style="'left:'+item.offset+'%'" class="peobox">
|
|
||||||
<view class="xx"></view>
|
|
||||||
</view>
|
|
||||||
<view class="item" v-for="(ite , ind) in item.list" :key="ind"
|
|
||||||
:style="{backgroundColor:ite.color}">
|
|
||||||
<view class="span1">{{ite.text}}</view>
|
|
||||||
<view class="span" v-if="ind<item.list.length-1">{{ite.max_val}}</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view v-else>
|
|
||||||
<view class="kcalClass" v-if="item.list&&item.list.length">
|
|
||||||
标准值:{{item.list[0].max_val}}kcal
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</uni-collapse-item>
|
|
||||||
</uni-collapse>
|
|
||||||
</view>
|
|
||||||
<view class="tips c999 ml-15">
|
|
||||||
<uni-icons type="info-filled" color="red"></uni-icons>
|
|
||||||
此测量数据仅供参考,不可代替医学专业测试!
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 手动记录 -->
|
|
||||||
<record :rtype="acd_id"></record>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {
|
|
||||||
mapState
|
|
||||||
} from "vuex";
|
|
||||||
import record from '@/components/manuallyAdd/record.vue';
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
infoList: [],
|
|
||||||
infoListTop: {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
acd_id: ""
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
record
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapState(["MeasureResult"]),
|
|
||||||
info() {
|
|
||||||
let that = this
|
|
||||||
that.infoListTop = that.MeasureResult ? that.MeasureResult.top_list[0] : {}
|
|
||||||
return that.MeasureResult
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {},
|
|
||||||
methods: {
|
|
||||||
navTo(url) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: url
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleToggleTop(item) {
|
|
||||||
this.infoListTop = item
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.box {
|
|
||||||
padding: 10px;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
|
|
||||||
.time {
|
|
||||||
color: #999;
|
|
||||||
padding-bottom: 15px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item2 {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.item2_data {
|
|
||||||
width: 33%;
|
|
||||||
|
|
||||||
.data {
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
border-right: 1PX solid #f7f7f7;
|
|
||||||
}
|
|
||||||
|
|
||||||
text {
|
|
||||||
font-size: 20px !important;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.box2 {
|
|
||||||
height: 50px;
|
|
||||||
line-height: 50px;
|
|
||||||
border-radius: 10px;
|
|
||||||
display: flex;
|
|
||||||
padding: 0 10px;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.item {
|
|
||||||
color: #fff;
|
|
||||||
width: 45%;
|
|
||||||
height: 50px;
|
|
||||||
background: $maincolor;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 10px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
text {
|
|
||||||
width: 30px;
|
|
||||||
height: 30px;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 10px;
|
|
||||||
display: inline-block;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.myinfoPage {
|
|
||||||
width: 100%;
|
|
||||||
background: #fff;
|
|
||||||
margin-top: 10px;
|
|
||||||
padding-bottom: 15px;
|
|
||||||
border-radius: 10px;
|
|
||||||
|
|
||||||
.box1 {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
border-radius: 10px;
|
|
||||||
font-size: 14px;
|
|
||||||
position: relative;
|
|
||||||
margin: 0px 15px 0;
|
|
||||||
padding-bottom: 10px;
|
|
||||||
|
|
||||||
.list {
|
|
||||||
width: 100%;
|
|
||||||
color: #666;
|
|
||||||
padding: 0;
|
|
||||||
line-height: 50px;
|
|
||||||
// display: flex;
|
|
||||||
// justify-content: space-between;
|
|
||||||
// align-items: center;
|
|
||||||
// flex-wrap: wrap;
|
|
||||||
|
|
||||||
image,
|
|
||||||
.t-icon {
|
|
||||||
width: 18px !important;
|
|
||||||
height: 18px;
|
|
||||||
border: 2px solid #c7c7c7;
|
|
||||||
background-color: #c7c7c7;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
color: #666;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
.level,
|
|
||||||
.val {
|
|
||||||
width: 25%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.name {
|
|
||||||
width: 40%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
width: 20px;
|
|
||||||
text-align: right;
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.desc {
|
|
||||||
line-height: 20px;
|
|
||||||
text-align: left;
|
|
||||||
width: calc(100%-20px);
|
|
||||||
height: auto;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #999;
|
|
||||||
padding: 10px;
|
|
||||||
background: #f7f7f7;
|
|
||||||
|
|
||||||
|
|
||||||
.statuevue {
|
|
||||||
height: 35px;
|
|
||||||
position: relative;
|
|
||||||
width: 100% !important;
|
|
||||||
margin: 20px auto 10px;
|
|
||||||
|
|
||||||
.bi {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
width: auto;
|
|
||||||
padding-top: 10px;
|
|
||||||
|
|
||||||
.peobox {
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
top: -1px;
|
|
||||||
|
|
||||||
.xx {
|
|
||||||
width: 5px;
|
|
||||||
height: 5px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: #fff;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 9;
|
|
||||||
border: 2px solid #1b2086;
|
|
||||||
top: 9px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.item {
|
|
||||||
position: relative;
|
|
||||||
margin: 0;
|
|
||||||
flex: 1;
|
|
||||||
height: 5px;
|
|
||||||
color: #666;
|
|
||||||
font-size: 12px;
|
|
||||||
|
|
||||||
.span1 {
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
position: absolute;
|
|
||||||
top: -23px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.span {
|
|
||||||
margin-top: 8px;
|
|
||||||
position: absolute;
|
|
||||||
right: -8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.yuanxing {
|
|
||||||
display: inline-block;
|
|
||||||
background: #f19601;
|
|
||||||
width: 8px;
|
|
||||||
height: 12px;
|
|
||||||
margin-right: 5px;
|
|
||||||
font-size: 32rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btnf {
|
|
||||||
font-size: 13px;
|
|
||||||
border-radius: 5px;
|
|
||||||
height: 22px;
|
|
||||||
margin: 0 10px 0 0;
|
|
||||||
line-height: 22px;
|
|
||||||
color: #fff;
|
|
||||||
font-weight: 400;
|
|
||||||
width: 44px !important;
|
|
||||||
text-align: center !important;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tivon {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-content: center;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.bianji {
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
margin-left: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.box1 :last-child.list {
|
|
||||||
.val {
|
|
||||||
width: 25% !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.kcalClass {
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 16px;
|
|
||||||
line-height: 55px;
|
|
||||||
margin: -20px auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.yichang {
|
|
||||||
background: #ffe4be;
|
|
||||||
color: #ff4239;
|
|
||||||
padding: 5px;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 5px;
|
|
||||||
margin: 0 15px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/deep/.uni-collapse-item {
|
|
||||||
width: 100% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/deep/.uni-collapse-item__title-arrow {
|
|
||||||
margin-right: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/deep/.uni-collapse-item__wrap-content.uni-collapse-item--border {
|
|
||||||
border-bottom-width: 0
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<view class="list">
|
||||||
|
<view class="item" v-for="(item,index) in list" @click="handlebinging(item)">
|
||||||
|
<image :src="item.pic"></image>
|
||||||
|
<view class="name">{{item.name}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.handleUserDeviceList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleUserDeviceList() {
|
||||||
|
let that = this
|
||||||
|
that.$model.getDeviceList({}).then(res => {
|
||||||
|
if (res.code != 0) {
|
||||||
|
that.$tools.msg(res.msg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
that.list = res.data.list
|
||||||
|
}).catch(err => {})
|
||||||
|
},
|
||||||
|
handlebinging(item) {
|
||||||
|
console.log("item", item)
|
||||||
|
uni.redirectTo({
|
||||||
|
url: "/pages/business/search?id=" + item.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.list {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
|
||||||
|
.item {
|
||||||
|
width: 33.3%;
|
||||||
|
padding-top: 8px;
|
||||||
|
display: flex;
|
||||||
|
float: left;
|
||||||
|
flex-direction: column;
|
||||||
|
box-sizing: border-box;
|
||||||
|
justify-content: center;
|
||||||
|
border-right: 1px solid #dfdfdf;
|
||||||
|
border-bottom: 1px solid #dfdfdf;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
margin: 0 auto 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -1,22 +1,147 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view class="content">
|
||||||
|
<view class="add" @click="handleAddDevice()">添加设备</view>
|
||||||
|
<view class="list" v-if="list.length">
|
||||||
|
<view class="item" v-for="(item,index) in list" @click="handleunbind(item,index)">
|
||||||
|
<view class="left">
|
||||||
|
<image :src="item.pic"></image>
|
||||||
|
<view class="name">
|
||||||
|
<text>{{item.name}}</text>
|
||||||
|
<text>{{item.bind_time}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="bing">解绑</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
mapState
|
||||||
|
} from "vuex";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
// list: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(["user", "userDeviceList"]),
|
||||||
|
list() {
|
||||||
|
return this.userDeviceList
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
let that = this
|
||||||
|
that.$store.dispatch('getUserDeviceList')
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
userDeviceList() {
|
||||||
|
let that = this
|
||||||
|
console.log("userDeviceList变了", that.userDeviceList)
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleunbind(item, index) {
|
||||||
|
let that = this
|
||||||
|
uni.showModal({
|
||||||
|
title: '友情提示',
|
||||||
|
content: '是否解绑该设备?',
|
||||||
|
success: function(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
that.$model.getUnbinding({
|
||||||
|
id: item.id
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code != 0) {
|
||||||
|
that.$tools.msg(res.msg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
that.$tools.msg("操作成功")
|
||||||
|
that.list.splice(index, 1)
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
that.$tools.msg("您已取消操作!");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleAddDevice() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/business/addDevice"
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.content {
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 15px;
|
||||||
|
background-color: #F5F6FA;
|
||||||
|
min-height: calc(100vh - 30px);
|
||||||
|
}
|
||||||
|
|
||||||
<style>
|
.add {
|
||||||
|
width: 100%;
|
||||||
|
height: 35px;
|
||||||
|
line-height: 35px;
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 15px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
background: $btncolor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
|
||||||
|
.item {
|
||||||
|
width: calc(100% - 20px);
|
||||||
|
padding: 5px 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
.left {
|
||||||
|
width: 80%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
text {
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
text-align: left;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.bing {
|
||||||
|
width: auto;
|
||||||
|
float: right;
|
||||||
|
background-color: #dfdfdf;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -0,0 +1,366 @@
|
||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view class="tips">请在设备开机状态下,搜索设备</view>
|
||||||
|
<view class="item" @click="openBluetoothAdapter">开始搜索设备</view>
|
||||||
|
<view class="devices_summary">已发现 {{devices.length}} 个设备:</view>
|
||||||
|
<view>
|
||||||
|
<scroll-view class="device_list" scroll-y scroll-with-animation v-if="popup">
|
||||||
|
<view v-for="(item,index) in devices" :key="index" @tap="createBLEConnection(item)" class="device_item">
|
||||||
|
<view>
|
||||||
|
<text>{{item.localName ||item.name}}</text>
|
||||||
|
</view>
|
||||||
|
<view>mac地址:{{item.macAddr || item.deviceId}}</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
<view class="tishi">
|
||||||
|
<view class="text">
|
||||||
|
<icon class="t-icon t-icon-tishi"></icon> 设备绑定流程说明
|
||||||
|
</view>
|
||||||
|
<view class="dv">
|
||||||
|
<text>1、打开手机蓝牙和位置信息</text>
|
||||||
|
<text>2、ios系统需打开设置—>应用—>微信里的蓝牙权限</text>
|
||||||
|
<text>3、设备亮屏状态下搜索蓝牙</text>
|
||||||
|
<text>4、选择蓝牙进行绑定</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let that;
|
||||||
|
let myTime;
|
||||||
|
import {
|
||||||
|
mapState
|
||||||
|
} from "vuex";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
macAddr: "",
|
||||||
|
code: "",
|
||||||
|
deviceId: "",
|
||||||
|
popup: false,
|
||||||
|
devices: [],
|
||||||
|
id: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(["user", "isConnected", "isBluetoothTyle"]),
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
that = this
|
||||||
|
that.id = options.id
|
||||||
|
uni.onBluetoothAdapterStateChange(function(res) {
|
||||||
|
that.$store.commit("changeBluetooth", res.available);
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
console.log("onUnload")
|
||||||
|
let that = this
|
||||||
|
if (!that.Unload) {
|
||||||
|
that.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||||
|
that.closeBLEConnection()
|
||||||
|
that.closeBluetoothAdapter()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 初始化蓝牙
|
||||||
|
openBluetoothAdapter() {
|
||||||
|
let that = this
|
||||||
|
uni.openBluetoothAdapter({
|
||||||
|
success: e => {
|
||||||
|
console.log("蓝牙初始化成功")
|
||||||
|
that.startBluetoothDeviceDiscovery()
|
||||||
|
},
|
||||||
|
fail: e => {
|
||||||
|
console.log('初始化蓝牙失败:' + e.errMsg);
|
||||||
|
that.$tools.getBluetoothAdapter(e)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 开始搜寻附近的蓝牙外围设备
|
||||||
|
startBluetoothDeviceDiscovery() {
|
||||||
|
let that = this
|
||||||
|
uni.showLoading({
|
||||||
|
title: '设备搜索中',
|
||||||
|
})
|
||||||
|
uni.startBluetoothDevicesDiscovery({
|
||||||
|
allowDuplicatesKey: true, //是否允许重复上报同一设备
|
||||||
|
success: res => {
|
||||||
|
uni.hideLoading()
|
||||||
|
that.onBluetoothDeviceFound();
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
uni.hideLoading()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 发现外围设备
|
||||||
|
*/
|
||||||
|
onBluetoothDeviceFound() {
|
||||||
|
var that = this;
|
||||||
|
const foundDevices = []
|
||||||
|
uni.showLoading({
|
||||||
|
title: '设备搜索中',
|
||||||
|
})
|
||||||
|
console.log("id", that.id)
|
||||||
|
uni.onBluetoothDeviceFound(res => {
|
||||||
|
res.devices.forEach(device => {
|
||||||
|
//
|
||||||
|
if (that.id == 3 && device.name.indexOf("YPC") != -1) {
|
||||||
|
console.log("跳绳", device,"YPC1293ED6802464CC843")
|
||||||
|
clearTimeout(myTime);
|
||||||
|
let buff = device.name.slice(7, 19)
|
||||||
|
device.macAddr = that.$tools.str2Num(buff)
|
||||||
|
if (device.macAddr != "") {
|
||||||
|
that.handleDevice(device)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (that.id == 4 && device.name.indexOf("G02") != -1) {
|
||||||
|
clearTimeout(myTime);
|
||||||
|
let buff = device.advertisData.slice(3, 9)
|
||||||
|
device.mac = new Uint8Array(buff) // 保存广播数据中的mac地址,这是由于iOS不直接返回mac地址
|
||||||
|
let tempMac = Array.from(device.mac)
|
||||||
|
device.macAddr = that.$tools.ab2hex(tempMac, ':').toUpperCase()
|
||||||
|
that.handleDevice(device)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (that.id == 5 && device.name.indexOf("Yihejia_Lung") != -1) {
|
||||||
|
console.log("肺活量", device,'04:0D:84:48:E0:9B')
|
||||||
|
device.macAddr = device.deviceId
|
||||||
|
clearTimeout(myTime);
|
||||||
|
// let buff = device.advertisData.slice(-6)
|
||||||
|
// device.mac = new Uint8Array(buff) // 保存广播数据中的mac地址,这是由于iOS不直接返回mac地址
|
||||||
|
// let tempMac = Array.from(device.mac)
|
||||||
|
// device.macAddr = that.$tools.ab2hex(tempMac, ':').toUpperCase()
|
||||||
|
that.handleDevice(device)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
that.handleMyTime()
|
||||||
|
},
|
||||||
|
handleDevice(device) {
|
||||||
|
let that = this
|
||||||
|
console.log("11111112222")
|
||||||
|
const foundDevices = that.devices
|
||||||
|
const idx = that.$tools.inArray(foundDevices, "deviceId", device.deviceId)
|
||||||
|
that.deviceId = device.deviceId;
|
||||||
|
if (idx === -1) {
|
||||||
|
that.devices.push(device);
|
||||||
|
} else {
|
||||||
|
that.devices[idx] = device
|
||||||
|
}
|
||||||
|
that.popup = true
|
||||||
|
},
|
||||||
|
handleMyTime() {
|
||||||
|
var that = this;
|
||||||
|
myTime = setTimeout(function() {
|
||||||
|
clearTimeout(myTime);
|
||||||
|
uni.hideLoading()
|
||||||
|
that.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||||
|
if (!that.devices.length) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '请确定蓝牙已打开!是否继续?',
|
||||||
|
cancelText: "取消",
|
||||||
|
confirmText: "继续",
|
||||||
|
success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
that.startBluetoothDeviceDiscovery()
|
||||||
|
} else {
|
||||||
|
that.$tools.msg("您已取消操作")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, 30000);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 停止搜索蓝牙设备
|
||||||
|
*/
|
||||||
|
stopBluetoothDevicesDiscovery() {
|
||||||
|
uni.stopBluetoothDevicesDiscovery({
|
||||||
|
success: e => {
|
||||||
|
console.log("停止搜索蓝牙设备", e)
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 连接蓝牙
|
||||||
|
createBLEConnection(e) {
|
||||||
|
let that = this;
|
||||||
|
that.stopBluetoothDevicesDiscovery()
|
||||||
|
that.macAddr = e.macAddr
|
||||||
|
that.getCode()
|
||||||
|
},
|
||||||
|
getCode() {
|
||||||
|
let that = this;
|
||||||
|
clearTimeout(myTime);
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '是否绑定该设备?',
|
||||||
|
cancelText: "取消",
|
||||||
|
confirmText: "确定",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
that.getActive()
|
||||||
|
} else {
|
||||||
|
that.$tools.msg("您已取消操作")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getActive() {
|
||||||
|
let that = this
|
||||||
|
that.$model.getBinding({
|
||||||
|
device_id: that.id,
|
||||||
|
device_mac: that.macAddr
|
||||||
|
}).then(res => {
|
||||||
|
that.closeBluetoothAdapter()
|
||||||
|
that.closeBLEConnection()
|
||||||
|
that.devices = []
|
||||||
|
if (res.code == 0) {
|
||||||
|
that.$tools.msg('绑定成功!')
|
||||||
|
that.$store.dispatch('getUserDeviceList')
|
||||||
|
that.$store.dispatch('getUserInfo', {
|
||||||
|
aud_id: uni.getStorageSync('userid')
|
||||||
|
})
|
||||||
|
setTimeout(function() {
|
||||||
|
uni.switchTab({
|
||||||
|
url: "/pages/business/business"
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 监听蓝牙连接状态
|
||||||
|
onBLEConnectionStateChange() {
|
||||||
|
let that = this
|
||||||
|
uni.onBLEConnectionStateChange(function(res) {
|
||||||
|
console.log("蓝牙连接状态", res.connected)
|
||||||
|
that.$store.commit("changeConnected", res.connected);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 断开蓝牙模块
|
||||||
|
*/
|
||||||
|
closeBluetoothAdapter() {
|
||||||
|
let that = this;
|
||||||
|
uni.closeBluetoothAdapter({
|
||||||
|
success: res => {
|
||||||
|
console.log('蓝牙模块关闭成功');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 断开蓝牙连接
|
||||||
|
*/
|
||||||
|
closeBLEConnection() {
|
||||||
|
var that = this;
|
||||||
|
uni.closeBLEConnection({
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
success: res => {
|
||||||
|
console.log('断开蓝牙连接成功');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.content {
|
||||||
|
min-height: calc(100vh - 66px);
|
||||||
|
padding: 0;
|
||||||
|
border-top: 66px solid #F9FAFC;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tishi {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 25px;
|
||||||
|
font-weight: bold;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 20px;
|
||||||
|
padding-left: 15px;
|
||||||
|
|
||||||
|
.text {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
icon {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #999;
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
width: 70%;
|
||||||
|
height: 40px;
|
||||||
|
line-height: 38px;
|
||||||
|
text-align: center;
|
||||||
|
background: #f7f7f7;
|
||||||
|
border: 1px solid #dfdfdf;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: auto;
|
||||||
|
border-radius: 15px;
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.devices_summary {
|
||||||
|
width: 100%;
|
||||||
|
height: 40px;
|
||||||
|
line-height: 40px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device_list {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
max-height: 340px;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 160px;
|
||||||
|
top: 170px;
|
||||||
|
|
||||||
|
.device_item {
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 7px 10px;
|
||||||
|
color: #999;
|
||||||
|
border-bottom: 1px solid #dfdfdf;
|
||||||
|
|
||||||
|
text {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
font-size: 14px;
|
||||||
|
text-align: center;
|
||||||
|
color: #e83a1e;
|
||||||
|
background: #f7e4c8;
|
||||||
|
padding: 5px 0;
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
<view class="Blue">
|
<view class="Blue">
|
||||||
<view class="h4">测量结果提示</view>
|
<view class="h4">测量结果提示</view>
|
||||||
<view class="Blue-box">
|
<view class="Blue-box">
|
||||||
本次测量身高为:<text>{{height}}</text>
|
本次测量身高为:<text>{{height}}{{unit}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="Blue-box">
|
<view class="Blue-box">
|
||||||
上次测量体重为:<input v-model="weight" type="digit" placeholder="请输入体重" />kg
|
上次测量体重为:<input v-model="weight" type="digit" placeholder="请输入体重" />kg
|
||||||
|
|
@ -56,7 +56,13 @@
|
||||||
...mapState(["user", "isConnected", "isBluetoothTyle"]),
|
...mapState(["user", "isConnected", "isBluetoothTyle"]),
|
||||||
info() {
|
info() {
|
||||||
return this.user
|
return this.user
|
||||||
}
|
},
|
||||||
|
endDate() {
|
||||||
|
return this.$tools.getDate("start")
|
||||||
|
},
|
||||||
|
startDate() {
|
||||||
|
return this.$tools.GetDateStr(-90);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
onUnload: function() {
|
||||||
let that = this
|
let that = this
|
||||||
|
|
@ -138,7 +144,7 @@
|
||||||
if (!device.name && !device.localName) {
|
if (!device.name && !device.localName) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (device.name.indexOf("WSD") !== -1) {
|
if (device.name.indexOf("G02") !== -1) {
|
||||||
let value = that.$tools.ab2hex(device.advertisData, "")
|
let value = that.$tools.ab2hex(device.advertisData, "")
|
||||||
let type = value.substring(22, 24)
|
let type = value.substring(22, 24)
|
||||||
let num = value.substring(28, 29)
|
let num = value.substring(28, 29)
|
||||||
|
|
@ -167,7 +173,7 @@
|
||||||
device.macAddr = that.$tools.ab2hex(tempMac, ':').toUpperCase()
|
device.macAddr = that.$tools.ab2hex(tempMac, ':').toUpperCase()
|
||||||
that.deviceId = device.deviceId
|
that.deviceId = device.deviceId
|
||||||
that.macAddr = device.macAddr
|
that.macAddr = device.macAddr
|
||||||
that.height = data + that.unit
|
that.height = data
|
||||||
that.stopblue = false
|
that.stopblue = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -210,17 +216,24 @@
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
that.$model.getmeasurefunit({
|
that.$model.getmeasurefunit({
|
||||||
imp: that.imp,
|
adc: 0,
|
||||||
weight: that.weight,
|
weight: that.weight,
|
||||||
ecode: that.macAddr,
|
|
||||||
height: that.height,
|
height: that.height,
|
||||||
familyid: that.info.id
|
aud_id: that.info.id
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
that.isHeight = false
|
that.isHeight = false
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
that.$store.dispatch("getUserInfo", {
|
that.$store.dispatch('getUserInfo', {
|
||||||
familyid: that.info.id
|
aud_id: uni.getStorageSync('userid')
|
||||||
});
|
})
|
||||||
|
that.$store.dispatch("getResult", {
|
||||||
|
aud_id: uni.getStorageSync('userid')
|
||||||
|
})
|
||||||
|
that.$store.dispatch("GetBodyTrendList", {
|
||||||
|
aud_id: uni.getStorageSync('userid'),
|
||||||
|
s_time: that.startDate,
|
||||||
|
e_time: that.endDate
|
||||||
|
})
|
||||||
that.$tools.msg("测量成功")
|
that.$tools.msg("测量成功")
|
||||||
} else {
|
} else {
|
||||||
that.$tools.msg("测量失败")
|
that.$tools.msg("测量失败")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,637 @@
|
||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<view class="tips" v-if="!isstart">
|
||||||
|
<view class="top">
|
||||||
|
<view class="left cgreen f-l">T</view>
|
||||||
|
<view class="right">
|
||||||
|
<text class="cgreen">肺活量测试</text>
|
||||||
|
<text class="text">肺活量测试能让我们更好的了解您,为您生成详细的健康报告。</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item" v-if="number1">
|
||||||
|
<text class="ml-10 mr-10">1</text>
|
||||||
|
<text>吸气肺活量</text>
|
||||||
|
<text class="cgreen">{{number1}}ml</text>
|
||||||
|
<text>吸气速度</text>
|
||||||
|
<text class="cgreen level">{{level1}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="item" v-if="number2">
|
||||||
|
<text class="ml-10 mr-10">2</text>
|
||||||
|
<text>吸气肺活量</text>
|
||||||
|
<text class="cgreen">{{number2}}ml</text>
|
||||||
|
<text>吸气速度</text>
|
||||||
|
<text class="cgreen level">{{level2}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="item" v-if="number3">
|
||||||
|
<text class="ml-10 mr-10">3</text>
|
||||||
|
<text>吸气肺活量</text>
|
||||||
|
<text class="cgreen">{{number3}}ml</text>
|
||||||
|
<text>吸气速度</text>
|
||||||
|
<text class="cgreen level">{{level3}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="title" v-if="number3==''">
|
||||||
|
<view class="">您好!第<text>{{number1!=""?'二':number2!=''?'三':'一'}}</text>次测试开始</view>
|
||||||
|
<view>放下呼吸训练器,缓慢呼气,尽可能排空肺部气体</view>
|
||||||
|
<view class="cgreen">使用呼吸训练器,缓慢吸气,直至到达极限</view>
|
||||||
|
</view>
|
||||||
|
<view class="data" v-if="number3">
|
||||||
|
<view class="val">
|
||||||
|
<text>1441ml</text>
|
||||||
|
平均吸气肺活量
|
||||||
|
</view>
|
||||||
|
<view class="text">
|
||||||
|
根据您的个人信息,您的达标吸气肺活量为2900ml。您本次测试吸气速度23.2L/min,肺活量测试结果1441ml。结合您的身体状态和改善目标,我们将为您生成详细的健康报告。
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="btn" v-if="number3">查看本次报告</view>
|
||||||
|
<view class="btn close" v-if="number3">我想重新测试</view>
|
||||||
|
<view class="btn" v-if="number1!=''&&number3==''">
|
||||||
|
2S后开始第<text>{{number1!=""?'二':number2!=''?'三':'一'}}</text>次测试</view>
|
||||||
|
</view>
|
||||||
|
<!-- -->
|
||||||
|
<view class="weight" v-else>
|
||||||
|
<view class="title cgreen">使用呼吸训练器,缓慢吸气,直至到达极限</view>
|
||||||
|
<view class="box1">
|
||||||
|
<view class="time">吸气速度 <text class="cgreen ml-5">38.3L/min</text></view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="image">
|
||||||
|
<image src="../../static/bae.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="center mt-15">
|
||||||
|
<view class="level"></view>
|
||||||
|
<view class="level level-bg"></view>
|
||||||
|
<view class="level-item" v-if="info">
|
||||||
|
<view class="ite" v-for="(ite,ind) in list">{{ite}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="val">
|
||||||
|
<text>{{average}}ml</text>吸气肺活量
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
mapState
|
||||||
|
} from "vuex";
|
||||||
|
let myTime;
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isstart: true, //是否开始测量
|
||||||
|
number1: "11",
|
||||||
|
number2: "22",
|
||||||
|
number3: "33",
|
||||||
|
level1: "适中",
|
||||||
|
level2: "适中",
|
||||||
|
level3: "适中",
|
||||||
|
average: "11",
|
||||||
|
list: [],
|
||||||
|
macAddr: "",
|
||||||
|
serviceId: "",
|
||||||
|
deviceId: "",
|
||||||
|
Unload: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(["user", "isConnected", "isBluetoothTyle"]),
|
||||||
|
info() {
|
||||||
|
return this.user
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onUnload: function() {
|
||||||
|
let that = this
|
||||||
|
if (!that.Unload) {
|
||||||
|
clearTimeout(myTime)
|
||||||
|
that.stopBluetoothDevicesDiscovery() //取消蓝牙搜索
|
||||||
|
that.closeBluetoothAdapter()
|
||||||
|
console.log("页面返回onUnload")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
let that = this
|
||||||
|
if (options && options.deviceId) {
|
||||||
|
that.deviceId = options.deviceId
|
||||||
|
that.closeBLEConnection()
|
||||||
|
that.closeBluetoothAdapter()
|
||||||
|
that.openBluetoothAdapter()
|
||||||
|
}
|
||||||
|
that.onBLEConnectionStateChange()
|
||||||
|
uni.onBluetoothAdapterStateChange(function(res) {
|
||||||
|
that.$store.commit("changeBluetooth", res.available);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
isConnected: function() {
|
||||||
|
let that = this
|
||||||
|
if (!that.isConnected) {
|
||||||
|
that.handleBack()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isBluetoothTyle: function() {
|
||||||
|
let that = this
|
||||||
|
if (!that.isBluetoothTyle) {
|
||||||
|
that.handleBack()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 重新连接
|
||||||
|
openBluetoothAdapter() {
|
||||||
|
let that = this
|
||||||
|
that.text = ""
|
||||||
|
uni.openBluetoothAdapter({
|
||||||
|
success: e => {
|
||||||
|
that.startBluetoothDeviceDiscovery()
|
||||||
|
},
|
||||||
|
fail: e => {
|
||||||
|
that.$tools.msg("请确定设备是开机状态、手机蓝牙权限已打开!")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 开始搜寻附近的蓝牙外围设备
|
||||||
|
startBluetoothDeviceDiscovery() {
|
||||||
|
let that = this
|
||||||
|
uni.startBluetoothDevicesDiscovery({
|
||||||
|
allowDuplicatesKey: true,
|
||||||
|
success: res => {
|
||||||
|
that.onBluetoothDeviceFound();
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
that.$tools.msg("请确定设备是开机状态、手机蓝牙权限已打开!")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 发现外围设备
|
||||||
|
*/
|
||||||
|
onBluetoothDeviceFound() {
|
||||||
|
var that = this;
|
||||||
|
uni.onBluetoothDeviceFound(res => {
|
||||||
|
res.devices.forEach(device => {
|
||||||
|
if (!device.name && !device.localName) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (device.name.indexOf('PC') != -1) {
|
||||||
|
console.log("搜索设备", device)
|
||||||
|
clearTimeout(myTime);
|
||||||
|
let buff = device.advertisData.slice(-6)
|
||||||
|
device.mac = new Uint8Array(buff) // 保存广播数据中的mac地址,这是由于iOS不直接返回mac地址
|
||||||
|
let tempMac = Array.from(device.mac)
|
||||||
|
tempMac.reverse()
|
||||||
|
device.macAddr = that.$tools.ab2hex(tempMac, ':').toUpperCase()
|
||||||
|
if (device.deviceId.indexOf(that.deviceId) != -1 || device.macAddr.indexOf(that
|
||||||
|
.deviceId) != -1) {
|
||||||
|
that.stopBluetoothDevicesDiscovery()
|
||||||
|
that.macAddr = device.macAddr
|
||||||
|
that.deviceId = device.deviceId
|
||||||
|
that.createBLEConnection()
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
that.handleMyTime()
|
||||||
|
},
|
||||||
|
// 连接蓝牙
|
||||||
|
createBLEConnection() {
|
||||||
|
let that = this;
|
||||||
|
uni.createBLEConnection({
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
success: res => {
|
||||||
|
that.getBLEDeviceServices();
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
console.log("设备连接失败,请重新连接", res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取设备的UUID
|
||||||
|
*/
|
||||||
|
getBLEDeviceServices() {
|
||||||
|
let serviceList = [];
|
||||||
|
let that = this;
|
||||||
|
uni.getBLEDeviceServices({
|
||||||
|
deviceId: "12:F7:00:08:83:FC",
|
||||||
|
success: res => {
|
||||||
|
console.log("获取设备的UUID成功", res)
|
||||||
|
serviceList = res.services;
|
||||||
|
for (let i = 0; i < serviceList.length; i++) {
|
||||||
|
let service = serviceList[i];
|
||||||
|
if (service.uuid.indexOf("FFE0") != -1) {
|
||||||
|
that.serviceId = service.uuid;
|
||||||
|
that.getBLEDeviceCharacteristics();
|
||||||
|
console.log("设备的FFE0的serviceId: " + that.serviceId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
console.log('获取设备的UUID失败:', res)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取指定服务的特征值
|
||||||
|
*/
|
||||||
|
getBLEDeviceCharacteristics() {
|
||||||
|
let characteristicsList = [];
|
||||||
|
let that = this;
|
||||||
|
uni.getBLEDeviceCharacteristics({
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: that.serviceId,
|
||||||
|
success: res => {
|
||||||
|
console.log("服务的特征值成功", res)
|
||||||
|
for (let i = 0; i < res.characteristics.length; i++) {
|
||||||
|
let item = res.characteristics[i];
|
||||||
|
if (item.uuid.indexOf('0000FFE9') != -1) {
|
||||||
|
console.log("0000FFE9")
|
||||||
|
} else if (item.uuid.indexOf('0000FFE4') != -1) {
|
||||||
|
console.log("0000FFE4")
|
||||||
|
that.notifyBLECharacteristicValue(item.uuid)
|
||||||
|
} else if (item.uuid.indexOf('0000FFE0') != -1) {
|
||||||
|
console.log("0000FFE0")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
console.log('获取特征值失败:', JSON.stringify(res))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 开启订阅特征值
|
||||||
|
* read: true, //读,write: true, //写,notify: true, //广播
|
||||||
|
*/
|
||||||
|
notifyBLECharacteristicValue(uuid) {
|
||||||
|
let that = this;
|
||||||
|
uni.notifyBLECharacteristicValueChange({
|
||||||
|
state: true, // 启用 notify 功能
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
serviceId: that.serviceId,
|
||||||
|
characteristicId: uuid,
|
||||||
|
success(res) {
|
||||||
|
uni.onBLECharacteristicValueChange(function(res) {
|
||||||
|
let value = that.$tools.ab2hex(res.value, "");
|
||||||
|
let num = value.substring(18, 19)
|
||||||
|
let dw = value.substring(19, 20)
|
||||||
|
let type = value.substring(8, 10)
|
||||||
|
let typeInfo = value.substring(10, 12)
|
||||||
|
console.log("value", value)
|
||||||
|
if (type == "10") {
|
||||||
|
|
||||||
|
}
|
||||||
|
if (type == "11") {
|
||||||
|
that.type = 2
|
||||||
|
if (typeInfo == "03" || typeInfo == "04") {
|
||||||
|
that.imp = parseInt(value.substring(17, 22), 16)
|
||||||
|
}
|
||||||
|
console.log("体脂:", that.imp)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail(res) {
|
||||||
|
console.log("测量失败", res.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleMyTime() {
|
||||||
|
var that = this;
|
||||||
|
myTime = setTimeout(function() {
|
||||||
|
if (!that.macAddr) {
|
||||||
|
clearTimeout(myTime);
|
||||||
|
that.Unload = true
|
||||||
|
that.startBluetoothDeviceDiscovery()
|
||||||
|
that.closeBluetoothAdapter()
|
||||||
|
}
|
||||||
|
}, 30000);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 停止搜索蓝牙设备
|
||||||
|
*/
|
||||||
|
stopBluetoothDevicesDiscovery() {
|
||||||
|
uni.stopBluetoothDevicesDiscovery({
|
||||||
|
success: e => {
|
||||||
|
console.log("停止搜索蓝牙设备", e)
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 监听蓝牙连接状态
|
||||||
|
onBLEConnectionStateChange() {
|
||||||
|
let that = this
|
||||||
|
uni.onBLEConnectionStateChange(function(res) {
|
||||||
|
console.log("监听蓝牙连接状态", res.connected)
|
||||||
|
if (!res.connected) {
|
||||||
|
clearTimeout(myTime);
|
||||||
|
that.Unload = true
|
||||||
|
that.closeBLEConnection()
|
||||||
|
that.closeBluetoothAdapter()
|
||||||
|
}
|
||||||
|
that.$store.commit("changeConnected", res.connected);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 保存测量结果
|
||||||
|
handleGetMeasure() {
|
||||||
|
let that = this
|
||||||
|
that.$model.getmeasurefunit({
|
||||||
|
imp: that.imp,
|
||||||
|
weight: that.weight,
|
||||||
|
ecode: that.macAddr,
|
||||||
|
height: that.height,
|
||||||
|
familyid: that.info.id
|
||||||
|
}).then(res => {
|
||||||
|
that.isHeight = false
|
||||||
|
if (res.code == 0) {
|
||||||
|
that.$store.dispatch("getUserInfo", {
|
||||||
|
familyid: that.info.id
|
||||||
|
});
|
||||||
|
that.$tools.msg("测量成功")
|
||||||
|
} else {
|
||||||
|
that.$tools.msg("测量失败")
|
||||||
|
}
|
||||||
|
that.Unload = true
|
||||||
|
setTimeout(function() {
|
||||||
|
that.closeBluetoothAdapter()
|
||||||
|
uni.switchTab({
|
||||||
|
url: "/pages/index/index"
|
||||||
|
})
|
||||||
|
}, 200)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//
|
||||||
|
handleBack(ind) {
|
||||||
|
let that = this
|
||||||
|
that.text = ""
|
||||||
|
that.Unload = true
|
||||||
|
that.stopBluetoothDevicesDiscovery()
|
||||||
|
that.closeBluetoothAdapter()
|
||||||
|
if (ind == 1) {
|
||||||
|
uni.switchTab({
|
||||||
|
url: "/pages/index/index"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 断开蓝牙模块
|
||||||
|
*/
|
||||||
|
closeBluetoothAdapter() {
|
||||||
|
let that = this;
|
||||||
|
uni.closeBluetoothAdapter({
|
||||||
|
success: res => {
|
||||||
|
console.log('蓝牙模块关闭成功');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 断开蓝牙连接
|
||||||
|
*/
|
||||||
|
closeBLEConnection() {
|
||||||
|
var that = this;
|
||||||
|
uni.closeBLEConnection({
|
||||||
|
deviceId: that.deviceId,
|
||||||
|
success: res => {
|
||||||
|
console.log('断开蓝牙连接成功');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.content {
|
||||||
|
width: calc(100% - 30px);
|
||||||
|
padding: 0 15px;
|
||||||
|
min-height: 100vh;
|
||||||
|
color: #5d5651;
|
||||||
|
background-color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cgreen {
|
||||||
|
color: #39D9C9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.top {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
margin-top: 20px;
|
||||||
|
align-items: flex-start;
|
||||||
|
|
||||||
|
.left {
|
||||||
|
font-size: 32px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
.text {
|
||||||
|
font-size: 12px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-size: 14px;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
background-color: #272a2a;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin-top: 8px;
|
||||||
|
color: #fff;
|
||||||
|
height: 35px;
|
||||||
|
line-height: 35px;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
text {
|
||||||
|
flex-grow: 0;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cgreen {
|
||||||
|
flex-grow: 2;
|
||||||
|
font-size: 16px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.level {
|
||||||
|
color: #516752;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 18px;
|
||||||
|
margin: 20px;
|
||||||
|
|
||||||
|
|
||||||
|
view {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 40px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.data {
|
||||||
|
margin-top: 20px;
|
||||||
|
|
||||||
|
.text {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #fff;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
width: 70%;
|
||||||
|
color: #fff;
|
||||||
|
padding: 5px 15px;
|
||||||
|
border-radius: 15px;
|
||||||
|
text-align: center;
|
||||||
|
background: $maincolor;
|
||||||
|
margin: 15px auto;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 80px;
|
||||||
|
left: calc(15% - 15px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.close {
|
||||||
|
background: #999;
|
||||||
|
bottom: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.weight {
|
||||||
|
padding-top: 30px;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
width: 80%;
|
||||||
|
margin: auto;
|
||||||
|
font-size: 18px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.box1 {
|
||||||
|
color: #fff;
|
||||||
|
margin: 50px 15px 15px;
|
||||||
|
width: calc(100%- 30px);
|
||||||
|
|
||||||
|
.time {
|
||||||
|
width: 60%;
|
||||||
|
margin: auto;
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: #272a2a;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.time:after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
left: 45%;
|
||||||
|
bottom: -7px;
|
||||||
|
width: 0px;
|
||||||
|
height: 0px;
|
||||||
|
border-left: 5px solid transparent;
|
||||||
|
border-right: 5px solid transparent;
|
||||||
|
border-top: 8px solid #272a2a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 10px 0;
|
||||||
|
border-radius: 15px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
position: relative;
|
||||||
|
margin-top: 10px;
|
||||||
|
|
||||||
|
.image {
|
||||||
|
width: 80%;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
top: -10px;
|
||||||
|
bottom: 20px;
|
||||||
|
position: absolute;
|
||||||
|
width: 55px;
|
||||||
|
margin: auto;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #333;
|
||||||
|
border-radius: 10px;
|
||||||
|
z-index: 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.level-bg {
|
||||||
|
position: absolute;
|
||||||
|
width: 55px;
|
||||||
|
margin: auto;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #4d6c7b;
|
||||||
|
border-radius: 0 0 10px 10px;
|
||||||
|
bottom: 0px;
|
||||||
|
z-index: 19;
|
||||||
|
}
|
||||||
|
|
||||||
|
.level-item {
|
||||||
|
width: 55px;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 99;
|
||||||
|
|
||||||
|
:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.ite {
|
||||||
|
margin: 0 5px;
|
||||||
|
width: calc(100% - 10px);
|
||||||
|
height: 40px;
|
||||||
|
line-height: 40px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #fff;
|
||||||
|
z-index: 99;
|
||||||
|
border-bottom: 1px solid #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.val {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
margin: 20px 0;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 14px;
|
||||||
|
|
||||||
|
text {
|
||||||
|
display: block;
|
||||||
|
color: #39D9C9 !important;
|
||||||
|
font-size: 32px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<view class="item" v-for="(item,index) in devList" :key="index" @click="handleWeight(item)">
|
<view class="item" v-for="(item,index) in devList" :key="index" @click="handleWeight(item)">
|
||||||
<!-- <image :src="item.img"></image> -->
|
<image :src="item.pic"></image>
|
||||||
<text>{{item.macAddr}}</text>
|
<text>{{item.name}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="tips" v-if="isdevTip">
|
<view class="tips" v-if="isdevTip">
|
||||||
|
|
@ -36,7 +36,8 @@
|
||||||
issearch: false, //是否重新搜索
|
issearch: false, //是否重新搜索
|
||||||
isdevTip: false, //是否有提示
|
isdevTip: false, //是否有提示
|
||||||
devicesList: [],
|
devicesList: [],
|
||||||
devList: []
|
devList: [],
|
||||||
|
id: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -44,6 +45,7 @@
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
that = this
|
that = this
|
||||||
|
that.id = options ? options.id : 0
|
||||||
that.openBluetoothAdapter()
|
that.openBluetoothAdapter()
|
||||||
that.onBLEConnectionStateChange()
|
that.onBLEConnectionStateChange()
|
||||||
uni.onBluetoothAdapterStateChange(function(res) {
|
uni.onBluetoothAdapterStateChange(function(res) {
|
||||||
|
|
@ -92,7 +94,7 @@
|
||||||
startBluetoothDeviceDiscovery() {
|
startBluetoothDeviceDiscovery() {
|
||||||
let that = this
|
let that = this
|
||||||
uni.startBluetoothDevicesDiscovery({
|
uni.startBluetoothDevicesDiscovery({
|
||||||
allowDuplicatesKey: false, //是否允许重复上报同一设备
|
allowDuplicatesKey: true, //是否允许重复上报同一设备
|
||||||
success: res => {
|
success: res => {
|
||||||
that.onBluetoothDeviceFound();
|
that.onBluetoothDeviceFound();
|
||||||
},
|
},
|
||||||
|
|
@ -106,7 +108,7 @@
|
||||||
var that = this;
|
var that = this;
|
||||||
uni.onBluetoothDeviceFound(res => {
|
uni.onBluetoothDeviceFound(res => {
|
||||||
res.devices.forEach(device => {
|
res.devices.forEach(device => {
|
||||||
if (device.name.indexOf("WSD") != -1) {
|
if (device.name.indexOf("G02") != -1) {
|
||||||
console.log("G02", device)
|
console.log("G02", device)
|
||||||
clearTimeout(myTime);
|
clearTimeout(myTime);
|
||||||
let buff = device.advertisData.slice(3, 9)
|
let buff = device.advertisData.slice(3, 9)
|
||||||
|
|
@ -116,6 +118,26 @@
|
||||||
that.handleDevice(device)
|
that.handleDevice(device)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (device.name.indexOf("PC") != -1) {
|
||||||
|
console.log("肺活量", device)
|
||||||
|
clearTimeout(myTime);
|
||||||
|
let buff = device.advertisData.slice(-6)
|
||||||
|
device.mac = new Uint8Array(buff) // 保存广播数据中的mac地址,这是由于iOS不直接返回mac地址
|
||||||
|
let tempMac = Array.from(device.mac)
|
||||||
|
device.macAddr = that.$tools.ab2hex(tempMac, ':').toUpperCase()
|
||||||
|
that.handleDevice(device)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (device.name.indexOf("YPC") != -1) {
|
||||||
|
console.log("device333333", device.name, device)
|
||||||
|
clearTimeout(myTime);
|
||||||
|
let buff = device.name.slice(7, 19)
|
||||||
|
device.macAddr = that.$tools.str2Num(buff)
|
||||||
|
if (device.macAddr != "") {
|
||||||
|
that.handleDevice(device)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
that.handleMyTime()
|
that.handleMyTime()
|
||||||
|
|
@ -124,13 +146,13 @@
|
||||||
let that = this
|
let that = this
|
||||||
const foundDevices = that.devicesList
|
const foundDevices = that.devicesList
|
||||||
const idx = that.$tools.inArray(foundDevices, "deviceId", device.deviceId)
|
const idx = that.$tools.inArray(foundDevices, "deviceId", device.deviceId)
|
||||||
that.deviceId = device.deviceId;
|
that.deviceId = device.macAddr;
|
||||||
console.log("111", idx, device, )
|
console.log("111", idx, device, )
|
||||||
if (idx === -1) {
|
if (idx === -1) {
|
||||||
that.devicesList.push(device);
|
that.devicesList.push(device);
|
||||||
// if (device.macAddr != "") {
|
if (device.macAddr != "") {
|
||||||
// that.handleDevType(device.macAddr)
|
that.handleDevType(device.macAddr)
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleMyTime() {
|
handleMyTime() {
|
||||||
|
|
@ -161,7 +183,8 @@
|
||||||
handleDevType(sn) {
|
handleDevType(sn) {
|
||||||
that = this
|
that = this
|
||||||
that.$model.getdevdetail({
|
that.$model.getdevdetail({
|
||||||
sn: sn,
|
mac: sn,
|
||||||
|
acd_id: that.id
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log("排查返回", res)
|
console.log("排查返回", res)
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
|
|
@ -172,15 +195,14 @@
|
||||||
},
|
},
|
||||||
handleWeight(item) {
|
handleWeight(item) {
|
||||||
let that = this
|
let that = this
|
||||||
that.Unload = true
|
|
||||||
// bletype 0:未找到,1:透传,2:广播
|
|
||||||
clearTimeout(myTime);
|
clearTimeout(myTime);
|
||||||
|
that.Unload = true
|
||||||
console.log("跳转测量", item)
|
console.log("跳转测量", item)
|
||||||
// if (item.bletype != 2) {
|
if (item.bluetooth_type == '透传') {
|
||||||
// that.stopBluetoothDevicesDiscovery()
|
that.stopBluetoothDevicesDiscovery()
|
||||||
// }
|
}
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/devices/G02'
|
url: item.page_measure + '?deviceId=' + that.deviceId
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 监听蓝牙连接状态
|
// 监听蓝牙连接状态
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="common">
|
<view class="common">
|
||||||
<view class="history">
|
<view class="history">
|
||||||
<view class="list" v-for="(item, index) in ranklist" :key="index"
|
<view class="list" v-for="(item, index) in ranklist" :key="index" @click="clickItemMethod(item)">
|
||||||
@click="type=='edit'?handleEdit(item.id):clickItemMethod(item)">
|
|
||||||
<uni-swipe-action>
|
<uni-swipe-action>
|
||||||
<uni-swipe-action-item :right-options="item.options" @click="swipeClick($event, index)">
|
<uni-swipe-action-item :right-options="item.options" @click="swipeClick($event, index)">
|
||||||
<view class="time">
|
<view class="time">
|
||||||
|
|
@ -13,11 +12,7 @@
|
||||||
<view>{{item.v1}}<text>{{item.v1_name}}</text></view>
|
<view>{{item.v1}}<text>{{item.v1_name}}</text></view>
|
||||||
<view v-if="item.v2">{{item.v2}}<text>{{item.v2_name}}</text></view>
|
<view v-if="item.v2">{{item.v2}}<text>{{item.v2_name}}</text></view>
|
||||||
<view v-if="item.v3">{{item.v3}}<text>{{item.v3_name}}</text></view>
|
<view v-if="item.v3">{{item.v3}}<text>{{item.v3_name}}</text></view>
|
||||||
<view class="check" v-if="type=='edit'" @click.stop>
|
<uni-icons type="right" v-if="acd_id!=6"></uni-icons>
|
||||||
<uni-icons :type="isActive==item.id?'checkbox-filled':'circle'" size="22"
|
|
||||||
:color="isActive==item.id?'#FEC407':'#dfdfdf'"></uni-icons>
|
|
||||||
</view>
|
|
||||||
<uni-icons type="right" v-if="type!='edit'&&acd_id!=6"></uni-icons>
|
|
||||||
</view>
|
</view>
|
||||||
</uni-swipe-action-item>
|
</uni-swipe-action-item>
|
||||||
</uni-swipe-action>
|
</uni-swipe-action>
|
||||||
|
|
@ -49,7 +44,7 @@
|
||||||
return {
|
return {
|
||||||
ranklist: [],
|
ranklist: [],
|
||||||
page: 1,
|
page: 1,
|
||||||
type: "add",
|
isDelete: false,
|
||||||
lastPage: '',
|
lastPage: '',
|
||||||
isActive: null,
|
isActive: null,
|
||||||
acd_id: "",
|
acd_id: "",
|
||||||
|
|
@ -58,8 +53,18 @@
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let that = this
|
let that = this
|
||||||
that.acd_id = options.acd_id
|
that.acd_id = options.acd_id
|
||||||
that.type = options.type ? options.type : 'add'
|
|
||||||
that.getList()
|
that.getList()
|
||||||
|
console.log("options", options)
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
console.log('关闭页面');
|
||||||
|
let that = this
|
||||||
|
var pages = getCurrentPages();
|
||||||
|
var Page = pages[pages.length - 1]; //当前页
|
||||||
|
var prevPage = pages[pages.length - 2];
|
||||||
|
if (that.isDelete) { //确定要返回到相应页面,在触发
|
||||||
|
prevPage.$vm.reload()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
let that = this
|
let that = this
|
||||||
|
|
@ -95,6 +100,7 @@
|
||||||
that.$store.dispatch("getUserInfo", {
|
that.$store.dispatch("getUserInfo", {
|
||||||
aud_id: uni.getStorageSync('userid')
|
aud_id: uni.getStorageSync('userid')
|
||||||
})
|
})
|
||||||
|
that.isDelete = true
|
||||||
that.$tools.msg("删除成功")
|
that.$tools.msg("删除成功")
|
||||||
})
|
})
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
|
|
@ -106,13 +112,10 @@
|
||||||
clickItemMethod(item) {
|
clickItemMethod(item) {
|
||||||
let that = this
|
let that = this
|
||||||
if (that.acd_id == "6") return
|
if (that.acd_id == "6") return
|
||||||
if (that.type == 'add') {
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/history/historyDetail?type=" + that.acd_id + '&id=' + item.id
|
url: "/pages/history/historyDetail?type=" + that.acd_id + '&id=' + item.id
|
||||||
})
|
})
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getList(page) {
|
getList(page) {
|
||||||
let that = this
|
let that = this
|
||||||
that.$model.gethistory({
|
that.$model.gethistory({
|
||||||
|
|
@ -190,6 +193,7 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
|
||||||
icon {
|
icon {
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@
|
||||||
</view>
|
</view>
|
||||||
<!-- 手动记录 -->
|
<!-- 手动记录 -->
|
||||||
<view class="target" @click.stop>
|
<view class="target" @click.stop>
|
||||||
<view class="left" @click="$tools.handleBluetoothClick()">蓝牙连接</view>
|
<view class="left" @click="$tools.handleDevicesMac(item.device_determine,item.acd_id)">蓝牙连接
|
||||||
|
</view>
|
||||||
<view class="targetBtn" @click="handlerRecord(item.acd_id)">手动记录</view>
|
<view class="targetBtn" @click="handlerRecord(item.acd_id)">手动记录</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -139,8 +140,9 @@
|
||||||
},
|
},
|
||||||
// 报告页
|
// 报告页
|
||||||
handlerReport(item) {
|
handlerReport(item) {
|
||||||
|
console.log("item", item)
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: item.page_url_report + "?acd_id = " + item.acd_id
|
url: item.page_url_report + "?acd_id=" + item.acd_id + '&device=' + item.device_determine
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 手动添加
|
// 手动添加
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<view class="content skipping">
|
<view class="content skipping">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<view class="skiptop">
|
<view class="skiptop">
|
||||||
<view class="status" @click="$tools.handleBluetoothClick()"><text>设备连接</text></view>
|
<view class="status" @click="$tools.handleDevicesMac(isdevice,acd_id)"><text>设备连接</text></view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="item-ite">今日个数<text>{{info?info.today_jump_num:'--'}}</text></view>
|
<view class="item-ite">今日个数<text>{{info?info.today_jump_num:'--'}}</text></view>
|
||||||
<view class="item-ite">今日时长<text>{{info?info.today_jump_time:'--'}}</text></view>
|
<view class="item-ite">今日时长<text>{{info?info.today_jump_time:'--'}}</text></view>
|
||||||
|
|
@ -115,7 +115,7 @@
|
||||||
return {
|
return {
|
||||||
active: 1,
|
active: 1,
|
||||||
acd_id: 6,
|
acd_id: 6,
|
||||||
isEdit: false,
|
isdevice: false,
|
||||||
weight: 500,
|
weight: 500,
|
||||||
timeList: [],
|
timeList: [],
|
||||||
timesTndex: [0, 0]
|
timesTndex: [0, 0]
|
||||||
|
|
@ -133,12 +133,11 @@
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let that = this
|
let that = this
|
||||||
that.acd_id = options.acd_id
|
that.acd_id = options.acd_id
|
||||||
},
|
that.isdevice = options.device
|
||||||
onShow() {
|
|
||||||
let that = this
|
|
||||||
that.$store.dispatch("getSkipResult", {
|
that.$store.dispatch("getSkipResult", {
|
||||||
aud_id: uni.getStorageSync('userid')
|
aud_id: uni.getStorageSync('userid')
|
||||||
})
|
})
|
||||||
|
console.log("跳绳传参", options)
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.timeList = this.$tools.gethms()
|
this.timeList = this.$tools.gethms()
|
||||||
|
|
@ -148,6 +147,16 @@
|
||||||
console.log("picker携带值", e.target.vaule)
|
console.log("picker携带值", e.target.vaule)
|
||||||
this.timesTndex = e.target.vaule
|
this.timesTndex = e.target.vaule
|
||||||
},
|
},
|
||||||
|
// 历史数据删除时重新加载接口
|
||||||
|
reload() {
|
||||||
|
let that = this
|
||||||
|
console.log('重新加载');
|
||||||
|
this.$nextTick(() => {
|
||||||
|
that.$store.dispatch("getSkipResult", {
|
||||||
|
aud_id: uni.getStorageSync('userid')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
navTo(url) {
|
navTo(url) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: url
|
url: url
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,7 @@
|
||||||
handleActive(ite) {
|
handleActive(ite) {
|
||||||
let that = this
|
let that = this
|
||||||
that.handTrue = false
|
that.handTrue = false
|
||||||
that.time = ite == 1 ? this.startDate : ite == 2 ? this.$tools.getDate("month") : this.$tools.getDate(
|
that.time = ite == 1 ? this.startDate : ite == 2 ? this.$tools.getDate("month") : this.$tools.getDate("year")
|
||||||
"year")
|
|
||||||
that.getList()
|
that.getList()
|
||||||
that.$nextTick(function() {
|
that.$nextTick(function() {
|
||||||
that.handTrue = true
|
that.handTrue = true
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<view class="skiptop">
|
<view class="skiptop">
|
||||||
<view class="status" @click="$tools.handleBluetoothClick()"><text>设备连接</text></view>
|
<view class="status" @click="$tools.handleDevicesMac(isdevice,acd_id)"><text>设备连接</text></view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="item-ite">平均吸气肺活量<text>{{info?info.average:'--'}}</text></view>
|
<view class="item-ite">平均吸气肺活量<text>{{info?info.average:'--'}}</text></view>
|
||||||
<view class="item-ite">吸气速度<text>--</text></view>
|
<view class="item-ite">吸气速度<text>--</text></view>
|
||||||
|
|
@ -70,7 +70,10 @@
|
||||||
import record from '@/components/manuallyAdd/record.vue';
|
import record from '@/components/manuallyAdd/record.vue';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {
|
||||||
|
acd_id: 8,
|
||||||
|
isdevice: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
record
|
record
|
||||||
|
|
@ -84,14 +87,22 @@
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let that = this
|
let that = this
|
||||||
that.acd_id = options.acd_id
|
that.acd_id = options.acd_id
|
||||||
},
|
that.isdevice = options.device
|
||||||
onShow() {
|
|
||||||
let that = this
|
|
||||||
that.$store.dispatch("getLungResult", {
|
that.$store.dispatch("getLungResult", {
|
||||||
aud_id: uni.getStorageSync('userid')
|
aud_id: uni.getStorageSync('userid')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 历史数据删除时重新加载接口
|
||||||
|
reload() {
|
||||||
|
let that = this
|
||||||
|
console.log('重新加载');
|
||||||
|
this.$nextTick(() => {
|
||||||
|
that.$store.dispatch("getLungResult", {
|
||||||
|
aud_id: uni.getStorageSync('userid')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
navTo(url) {
|
navTo(url) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: url
|
url: url
|
||||||
|
|
@ -142,7 +153,7 @@
|
||||||
|
|
||||||
.center {
|
.center {
|
||||||
top: -10px;
|
top: -10px;
|
||||||
bottom: 20px;
|
bottom: 0px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 55px;
|
width: 55px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
|
|
||||||
|
|
@ -114,5 +114,18 @@ export default {
|
||||||
commit('changehistoryList', null)
|
commit('changehistoryList', null)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
// 设备
|
||||||
|
getUserDeviceList({ // 用户设备
|
||||||
|
commit
|
||||||
|
}) {
|
||||||
|
return model.getUserDeviceList({}).then(res => {
|
||||||
|
console.log("用户设备", res)
|
||||||
|
if (res.data && res.data.list.length) {
|
||||||
|
commit('changeUserDeviceList', res.data.list)
|
||||||
|
} else {
|
||||||
|
commit('changeUserDeviceList', [])
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -33,6 +33,7 @@ export default new Vuex.Store({
|
||||||
all: []
|
all: []
|
||||||
},
|
},
|
||||||
Trend: [],
|
Trend: [],
|
||||||
|
userDeviceList: [], //用户设备列表
|
||||||
isDrawe: false, //左侧弹框
|
isDrawe: false, //左侧弹框
|
||||||
isedit: false, //信息弹框
|
isedit: false, //信息弹框
|
||||||
isTarget: false, //目标体重
|
isTarget: false, //目标体重
|
||||||
|
|
@ -120,6 +121,10 @@ export default new Vuex.Store({
|
||||||
changeConnected(state, newData) {
|
changeConnected(state, newData) {
|
||||||
state.isConnected = newData
|
state.isConnected = newData
|
||||||
},
|
},
|
||||||
|
// 用户设备列表
|
||||||
|
changeUserDeviceList(state, newData) {
|
||||||
|
state.userDeviceList = newData
|
||||||
|
},
|
||||||
},
|
},
|
||||||
// 模块化vuex
|
// 模块化vuex
|
||||||
modules: {},
|
modules: {},
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,11 @@ export default {
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getmeasurefunit(param) { //保存测量结果
|
||||||
|
return http.post("/card_manual_recording_device", param).then(res => {
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
},
|
||||||
// 跳绳
|
// 跳绳
|
||||||
getSkipResult(param) { //获取测量报告
|
getSkipResult(param) { //获取测量报告
|
||||||
return http.post("/skip_today_data", param).then(res => {
|
return http.post("/skip_today_data", param).then(res => {
|
||||||
|
|
@ -180,6 +185,32 @@ export default {
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 设备管理
|
||||||
|
getDeviceList(param) { //获取系统设备列表
|
||||||
|
return http.post("/device_data_list", param).then(res => {
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getBinding(param) { //绑定系统设备
|
||||||
|
return http.post("/device_binding", param).then(res => {
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getUserDeviceList(param) { //获取用户设备列表
|
||||||
|
return http.post("/device_user_data_list", param).then(res => {
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getUnbinding(param) { //解绑系统设备
|
||||||
|
return http.post("/device_unbinding", param).then(res => {
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getdevdetail(param) { //根据Mac地址获取设备详情
|
||||||
|
return http.post("/device_mac_get_content", param).then(res => {
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
},
|
||||||
// 公共
|
// 公共
|
||||||
gethistory(param) { //历史记录
|
gethistory(param) { //历史记录
|
||||||
return http.post("/get_all_record_data_page", param).then(res => {
|
return http.post("/get_all_record_data_page", param).then(res => {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import $store from '@/store'
|
import $store from '@/store'
|
||||||
|
import $tools from '@/tools/tools.js'
|
||||||
export default {
|
export default {
|
||||||
msg,
|
msg,
|
||||||
|
str2Num,
|
||||||
gethms,
|
gethms,
|
||||||
str2hex,
|
str2hex,
|
||||||
hex2str,
|
hex2str,
|
||||||
|
|
@ -11,20 +13,37 @@ export default {
|
||||||
GetDateStr,
|
GetDateStr,
|
||||||
PrefixZero,
|
PrefixZero,
|
||||||
validatePhoneEmail,
|
validatePhoneEmail,
|
||||||
handleBluetoothClick
|
getBluetoothAdapter,
|
||||||
|
handleDevicesMac
|
||||||
}
|
}
|
||||||
|
// 蓝牙连接
|
||||||
function handleBluetoothClick() {
|
function handleDevicesMac(device, acd_id) {
|
||||||
|
console.log("卡片设备", device, acd_id)
|
||||||
|
if (device == 'true') {
|
||||||
uni.openBluetoothAdapter({
|
uni.openBluetoothAdapter({
|
||||||
success: e => {
|
success: e => {
|
||||||
$store.commit("changeBluetooth", true);
|
$store.commit("changeBluetooth", true);
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/devices/devices"
|
url: "/pages/devices/search?id=" + acd_id
|
||||||
})
|
})
|
||||||
console.log('初始化蓝牙成功:' + e.errMsg);
|
console.log('初始化蓝牙成功:' + e.errMsg);
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: err => {
|
||||||
console.log('初始化蓝牙失败:' + err.errMsg);
|
console.log('初始化蓝牙失败:' + err.errMsg);
|
||||||
|
return $tools.getBluetoothAdapter(err)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$tools.msg("请先添加设备!")
|
||||||
|
setTimeout(function() {
|
||||||
|
uni.switchTab({
|
||||||
|
url: "/pages/business/business"
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 蓝牙连接失败
|
||||||
|
function getBluetoothAdapter(err) {
|
||||||
if (err.errMsg == "openBluetoothAdapter:fail auth denied" || err.errMsg ===
|
if (err.errMsg == "openBluetoothAdapter:fail auth denied" || err.errMsg ===
|
||||||
"openBluetoothAdapter:fail auth deny" ||
|
"openBluetoothAdapter:fail auth deny" ||
|
||||||
err.errMsg === "openBluetoothAdapter:fail authorize no response"
|
err.errMsg === "openBluetoothAdapter:fail authorize no response"
|
||||||
|
|
@ -43,8 +62,7 @@ function handleBluetoothClick() {
|
||||||
title: "获取权限成功,请继续去测量",
|
title: "获取权限成功,请继续去测量",
|
||||||
icon: "none"
|
icon: "none"
|
||||||
})
|
})
|
||||||
$store.commit("changeBluetooth",
|
$store.commit("changeBluetooth", true);
|
||||||
true);
|
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -52,8 +70,7 @@ function handleBluetoothClick() {
|
||||||
icon: "none",
|
icon: "none",
|
||||||
duration: 1000,
|
duration: 1000,
|
||||||
})
|
})
|
||||||
console.log('初始化蓝牙失败:' + err
|
console.log('初始化蓝牙失败:' + err.errMsg);
|
||||||
.errMsg);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -74,9 +91,6 @@ function handleBluetoothClick() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 2进制位数不足补0
|
// 2进制位数不足补0
|
||||||
function PrefixZero(num, n) {
|
function PrefixZero(num, n) {
|
||||||
|
|
@ -140,6 +154,14 @@ function str2hex(str) {
|
||||||
return encoder.encode(str)
|
return encoder.encode(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function str2Num(str) {
|
||||||
|
var result = "";
|
||||||
|
for (let i = 0; i < str.length - 2; i++) {
|
||||||
|
result += str[i];
|
||||||
|
if (i % 2 === 1) result += ':';
|
||||||
|
}
|
||||||
|
return result + str.slice(-2)
|
||||||
|
}
|
||||||
// 跳绳分秒时间选择
|
// 跳绳分秒时间选择
|
||||||
function gethms(type) {
|
function gethms(type) {
|
||||||
var mindata = []
|
var mindata = []
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue