ai-watch-app/pages/index/index.vue

676 lines
19 KiB
Vue

<template>
<view>
<navtab :current="0"></navtab>
<view class="content">
<z-paging ref="paging"refresher-only @onRefresh="onRefresh">
<view class="flx jcsb ac">
<view class="left">
<view class="content-header">
<view class="sha-dow"></view>
<view class="text">
<view class="left" style="width: 100%">
<view class="title">
家庭健康管理
</view>
<view class="desc">
<text class="">共享健康 · 守护家人</text>
</view>
</view>
</view>
</view>
<view class="list-wrap">
<view class="content-item row" @click="toPage('/pages/index/echarts?type=step&calorie='+(dataListsNew.stepIndex.data_msg?dataListsNew.stepIndex.data_msg.calorie:0)+'&step='+(dataListsNew.stepIndex.data_msg?dataListsNew.stepIndex.data_msg.step:0)+'&distance='+ (dataListsNew.stepIndex.data_msg?(dataListsNew.stepIndex.data_msg.distance / 1000).toFixed(2):0))">
<view class="item">
<view class="title">卡路里</view>
<view class="row-date">
<view>{{dataListsNew.stepIndex.data_msg ? dataListsNew.stepIndex.data_msg.calorie / 10 : '--'}}</view>
<text>千卡</text>
</view>
</view>
<view class="item">
<view class="title">步数</view>
<view class="row-date">
<view>{{dataListsNew.stepIndex.data_msg ? dataListsNew.stepIndex.data_msg.step : '--'}}</view>
<text></text>
</view>
</view>
<view class="item">
<view class="title">距离</view>
<view class="row-date">
<view>{{dataListsNew.stepIndex.data_msg ? (dataListsNew.stepIndex.data_msg.distance / 1000).toFixed(2) : '--'}}</view>
<text>公里</text>
</view>
</view>
<view class="row-time" v-if="dataListsNew.stepIndex">
{{(dataListsNew.stepIndex.device_real_time)}}
</view>
<view class="bg">
<!-- <image src="../../static/icon/血糖.png" mode="widthFix"></image> -->
</view>
</view>
<view class="content-item" @click="toPage('/pages/index/sleep_info')">
<view class="title">
{{getNameByKey('sleep')}}
</view>
<view class="time">
{{dataListsNew.SleepDatas.data_msg? dataListsNew.SleepDatas.device_real_time + '更新' : '--'}}
</view>
<view class="date">
<view class="flex_data" v-if="dataListsNew.SleepDatas.data_msg">
<view v-if="!(i == 0 && v == 0)" class="" v-for="(v,i) in mkHourMin(dataListsNew.SleepDatas.data_msg[0].sleepTotalTime)" :key="i" class="flex_data">
<view class="f_left" >
{{v}}
</view>
<view class="f_right">
<text class="icon">{{(i == 0?'时':'分')}}</text>
</view>
</view>
</view>
</view>
<view class="bg">
<image src="../../static/icon/sleep.png" style="width: 200rpx;" mode="widthFix"></image>
</view>
</view>
<view class="content-item" @click="toPage('/pages/index/echarts?type=bloodGlucose')">
<view class="title">
{{getNameByKey('bloodGlucose')}}
</view>
<view class="time">
{{dataListsNew.bloodGlucose.data_msg? dataListsNew.bloodGlucose.device_real_time + '更新' : '--'}}
</view>
<view class="date">
<view class="flex_data">
<view class="f_left">
{{dataListsNew.bloodGlucose.data_msg || '--'}}
</view>
<view class="f_right">
<text class="icon">毫摩尔/升</text>
</view>
</view>
</view>
<view class="bg">
<image src="../../static/icon/xuetang.png" mode="widthFix"></image>
</view>
</view>
<view class="content-item" @click="toPage('/pages/index/echarts?type=bloodOxygen')">
<view class="title">
{{getNameByKey('bloodOxygen')}}
</view>
<view class="time">
{{dataListsNew.bloodOxygen.data_msg? dataListsNew.bloodOxygen.device_real_time + '更新' : '--'}}
</view>
<view class="date">
<view class="flex_data">
<view class="f_left">
{{dataListsNew.bloodOxygen.data_msg? (dataListsNew.bloodOxygen.data_msg[0]) : '--'}}
</view>
<view class="f_right">
<text class="icon">%</text>
</view>
</view>
</view>
<view class="bg">
<image src="../../static/icon/xueyang.png" mode="widthFix"></image>
</view>
</view>
<view class="content-item" @click="toPage('/pages/index/echarts?type=bloodPressure')">
<view class="title">
{{getNameByKey('bloodPressure')}}
</view>
<view class="time">
{{dataListsNew.bloodPressure.data_msg? dataListsNew.bloodPressure.device_real_time + '更新' : '--'}}
</view>
<view class="date">
<view class="flex_data">
<view class="f_left">
{{dataListsNew.bloodPressure.data_msg? dataListsNew.bloodPressure.data_msg.bloodPressureHigh + '/' + dataListsNew.bloodPressure.data_msg.bloodPressureLow : '--'}}
</view>
<view class="f_right">
<text class="icon">mmHG</text>
</view>
</view>
</view>
<view class="bg">
<image src="../../static/icon/xueya.png" mode="widthFix"></image>
</view>
</view>
<view class="content-item" @click="toPage('/pages/index/echarts?type=bodyTemperature')">
<view class="title">
{{getNameByKey('bodyTemperature')}}
</view>
<view class="time">
{{dataListsNew.bodyTemperature.data_msg? dataListsNew.bodyTemperature.device_real_time + '更新' : '--'}}
</view>
<view class="date">
<view class="flex_data">
<view class="f_left">
{{dataListsNew.bodyTemperature.data_msg? (dataListsNew.bodyTemperature.data_msg) : '--'}}
</view>
<view class="f_right">
<text class="icon">℃</text>
</view>
</view>
</view>
<view class="bg">
<image src="../../static/icon/wendu.png" mode="widthFix"></image>
</view>
</view>
<view class="content-item" @click="toPage('/pages/index/echarts?type=pulseReat')">
<view class="title">
{{getNameByKey('pulseReat')}}
</view>
<view class="time">
{{dataListsNew.pulseReat.data_msg? dataListsNew.pulseReat.device_real_time + '更新' : '--'}}
</view>
<view class="date">
<view class="flex_data">
<view class="f_left">
{{dataListsNew.pulseReat.data_msg? (dataListsNew.pulseReat.data_msg[0]) : '--'}}
</view>
<view class="f_right">
<text class="icon">次/分</text>
</view>
</view>
</view>
<view class="bg">
<image src="../../static/icon/mailv.png" mode="widthFix"></image>
</view>
</view>
<view class="content-item" @click="toPage('/pages/index/detail?type=ECGData')">
<view class="title">
心电图
</view>
<view class="time">
{{dataListsNew.ECGData.data_msg? dataListsNew.ECGData.device_real_time + '更新' : '--'}}
</view>
<view class="date">
<view class="flex_data">
<view class="f_left">
{{dataListsNew.ECGData.data_msg? (dataListsNew.ECGData.data_msg.heartRate || dataListsNew.ECGData.data_msg.meanHeartRate) : '--'}}
</view>
<view class="f_right">
<text class="icon">次/分</text>
</view>
</view>
</view>
<view class="bg">
<image src="../../static/icon/xindiantu.png" style="width: 220rpx;" mode="widthFix"></image>
</view>
</view>
<view class="content-item" @click="toPage('/pages/index/detail?type=bodyData')">
<view class="title">
身体成分
</view>
<view class="time">
{{dataListsNew.bodyData.data_msg? dataListsNew.bodyData.device_real_time + '更新' : '--'}}
</view>
<view class="date">
<view class="flex_data">
<view class="f_left">
{{dataListsNew.bodyData.data_msg? (dataListsNew.bodyData.data_msg.BMI ) : '--'}}
</view>
<view class="f_right">
<text class="icon">BMI</text>
</view>
</view>
</view>
<view class="bg">
<image src="../../static/icon/rtcf.png" style="width: 220rpx;" mode="widthFix"></image>
</view>
</view>
<!-- <view class="content-item" @click="toPage('/pages/index/detail?type=meiTuo')">
<view class="title">
{{getNameByKey('meiTuo')}}
</view>
<view class="time">
{{dataListsNew.meiTuo.data_msg? dataListsNew.meiTuo.device_real_time + '更新' : '--'}}
</view>
<view class="date">
<view class="flex_data">
<view class="f_left">
{{dataListsNew.meiTuo.data_msg? (dataListsNew.meiTuo.data_msg[0] / 10) : '--'}}
</view>
<view class="f_right">
<text class="icon">MET</text>
</view>
</view>
</view>
<view class="bg">
<image src="../../static/icon/xinlv.png" mode="widthFix"></image>
</view>
</view> -->
<view class="content-item" @click="toPage('/pages/index/echarts?type=bloodLiquid&desc=uricAcidVal')">
<view class="title">
尿酸
</view>
<view class="time">
{{dataListsNew.bloodLiquid.data_msg? dataListsNew.bloodLiquid.device_real_time + '更新' : '--'}}
</view>
<view class="date">
<view class="flex_data">
<view class="f_left">
{{dataListsNew.bloodLiquid.data_msg? (dataListsNew.bloodLiquid.data_msg.uricAcidVal / 10).toFixed(2) : '--'}}
</view>
<view class="f_right">
<text class="icon">微摩尔/升</text>
</view>
</view>
</view>
<view class="bg">
<image src="../../static/icon/niaosuan.png" style="width: 220rpx;" mode="widthFix"></image>
</view>
</view>
<view class="content-item" style="height: 430rpx" @click="toPage('/pages/index/echarts?type=bloodLiquidAll')">
<view class="title">
{{getNameByKey('bloodLiquid')}}
</view>
<view class="time">
{{dataListsNew.bloodLiquid.data_msg? dataListsNew.bloodLiquid.device_real_time + '更新' : '--'}}
</view>
<view class="gap-content">
<view class="gap-item">
<view class="title">
总胆固醇
</view>
<view class="num">
{{dataListsNew.bloodLiquid.data_msg? (dataListsNew.bloodLiquid.data_msg.cholesterol / 100).toFixed(2) : '--'}}
<text class="icon">毫摩尔/升</text>
</view>
</view>
<view class="gap-item">
<view class="title">
甘油三脂
</view>
<view class="num">
{{dataListsNew.bloodLiquid.data_msg? (dataListsNew.bloodLiquid.data_msg.triacylglycerol / 100).toFixed(2) : '--'}}
<text class="icon">毫摩尔/升</text>
</view>
</view>
<view class="gap-item">
<view class="title">
高密度脂蛋白
</view>
<view class="num">
{{dataListsNew.bloodLiquid.data_msg? (dataListsNew.bloodLiquid.data_msg.highDensity / 100).toFixed(2) : '--'}}
<text class="icon">毫摩尔/升</text>
</view>
</view>
<view class="gap-item">
<view class="title">
低密度脂蛋白
</view>
<view class="num">
{{dataListsNew.bloodLiquid.data_msg? (dataListsNew.bloodLiquid.data_msg.lowDensity / 100).toFixed(2) : '--'}}
<text class="icon">毫摩尔/升</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="right">
<video :enable-progress-gesture="false"
object-fit="cover"
style="width: 100%; height: 100%;"
:controls="false"
:show-center-play-btn="false"
src="https://img.agrimedia.cn/bmsc/%E9%A3%9E%E4%B9%A620240918-175041.mp4">
</video>
</view>
</view>
<view style="height: 200rpx"></view>
</z-paging>
</view>
</view>
</template>
<script>
import navtab from '../../components/navtab/navtab.vue'
import { getArrMaxValue } from '@/utils/utils.js'
import store from "@/store/index.js";
import { mapGetters } from "vuex";
export default {
data() {
return {
keyNameMap: {
bloodGlucose: "血糖",
sleep: "睡眠",
bloodOxygen: "血氧",
bloodPressure: '血压',
bloodLiquid: "血脂",
meiTuo: '梅脱',
pulseReat: '心率',
updataDate: '更新时间',
bodyTemperature: '体温'
},
dataLists: {},
dataListsNew:{
stepIndex:{},
pulseReat:{},
bloodOxygen:{},
bloodPressure:{},
bloodGlucose:{},
meiTuo:{},
bodyTemperature:{},
bloodLiquid:{},
ECGData:{},
bodyData:{},
SleepDatas:{
}
}
// dataListsNew:{
// stepIndex:{
// calorie:'--',
// distance:'--',
// step:'--',
// },
// pulseReat:[],
// bloodOxygen:[],
// bloodPressure:{
// bloodPressureHigh:'',
// bloodPressureLow:''
// },
// bloodGlucose:'',
// meiTuo:[],
// bodyTemperature:'',
// bloodLiquid:{
// cholesterol:0,
// highDensity:0,
// lowDensity:0,
// triacylglycerol:0,
// uricAcidVal:0,
// }
// }
}
},
onLoad() {
this.onRefresh();
},
computed: {
...mapGetters({
getActiceDevice: "api/getActiceDevice"
})
},
methods: {
getArrMaxValue,
onRefresh(pageNo, pageSize) {
this.$store.dispatch('api/getIndexData', {
device_id: this.getActiceDevice.device_id ,
need_arr :[
'pulseReat',
'bloodOxygen',
'bloodPressure',
'bloodGlucose',
'meiTuo',
'bodyTemperature',
'bloodLiquid',
'stepIndex',
'ECGData',
'SleepDatas',
'bodyData'
],
}).then(res => {
for(let i = 0;i<res.length;i++){
// console.log(this.dataListsNew[res[i].type])
// console.log(res[i].data_msg)
this.dataListsNew[res[i].type] = res[i]
}
// this.dataListsNew = res.data_msg;
this.$refs.paging.complete();
});
},
mkHourMin(min){
if(min < 60){
return [0,min]
}
return [(Math.floor(min / 60)),(min % 60)]
},
toPage(url) {
uni.navigateTo({
url
})
},
getNameByKey(key) {
return this.keyNameMap[key] || "Key not found";
},
formatDateTime(dateTimeStr) {
if (dateTimeStr) {
return dateTimeStr.replace(/-/g, ' ').replace(' ', ' ', 2).replace(' ', ':');
}
}
}
}
</script>
<style lang="scss" scoped>
.flex_data{
display: flex;
.f_left{
margin-right: 10rpx;
}
.f_right{
padding-top: 16rpx;
}
}
.content {
padding: 20rpx 30rpx;
margin-top:20rpx;
display: flex;
align-items: center;
.left {
width: 60%;
}
.right {
position: fixed;
right: 0rpx;
height: 100vh;
width: 40%;
padding: 30rpx;
box-sizing: border-box;
overflow: hidden;
border-radius: 30rpx;
}
.content-header {
margin-bottom: 30rpx;
padding: 30rpx;
height: 600rpx;
display: flex;
align-items: center;
justify-content: space-between;
margin: 0rpx 0rpx 30rpx 0rpx;
background-image: url('https://img.agrimedia.cn/watch-app/header-bg.png');
background-repeat: no-repeat;
background-size: 100% 100%;
position: relative;
.sha-dow {
width: 100%;
height: 640rpx;
position: absolute;
top: 0;
left: 0;
background-color: #fff;
opacity: .4;
}
.text {
width: 800rpx;
// height: 300rpx;
left: 0px;
top: 0px;
right:0px;
bottom:0px;
margin:auto;
margin: 0 auto;
z-index: 999;
backdrop-filter: blur(6rpx);
border-radius: 20rpx;
padding:20rpx;
margin-top: 60rpx;
}
.left {
.title {
font-size: 100rpx;
text-align: center;
font-weight: 900;
margin-bottom: 20rpx;
text-stroke: 10rpx white;
}
.desc {
text-align: center;
font-size: 34rpx;
}
}
}
.row {
display: flex;
align-items: center;
justify-content: space-around;
}
.list-wrap {
display: flex;
align-items: center;
flex-wrap: wrap;
justify-content: space-between;
padding: 0rpx 40rpx;
}
.content-item {
width: 42%;
margin: 20rpx 10rpx;
padding: 20rpx;
border: none;
border-radius: 30rpx ;
-webkit-box-shadow: 0 0 60rpx 0 rgba(43,86,112,.1) ;
box-shadow: 0 0 60rpx 0 rgba(43,86,112,.1) ;
position: relative;
height: 200rpx;
overflow: hidden;
.title {
font-size: 38rpx;
font-weight: 800;
margin-bottom: 14rpx;
}
.row-time {
position: absolute;
bottom: 30rpx;
right: 30rpx;
font-size: 28rpx;
color: grey;
}
.bg {
position: absolute;
bottom: 0rpx;
right: 50rpx;
opacity: .4;
z-index: -1;
image {
width: 250rpx;
}
}
.time {
font-size: 28rpx;
color: grey;
padding: 20rpx 0rpx 20rpx 0rpx;
}
.row-date {
font-size: 46rpx;
font-weight: 800;
display: flex;
align-items: baseline;
justify-content: center;
text {
opacity: .5;
font-size: 24rpx;
font-weight: 500;
padding-left: 10rpx;
}
}
.date {
font-size: 46rpx;
font-weight: 800;
display: flex;
align-items: baseline;
.icon {
font-weight: 100rpx;
font-size: 28rpx;
color: grey;
display: flex;
flex-direction: column-reverse;
}
}
.gap-content {
display: flex;
flex-wrap: wrap;
.gap-item {
margin-top: 20rpx;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
width: 50%;
.title {
font-size: 36rpx;
padding-bottom: 10rpx;
}
.num {
font-size: 28rpx;
font-weight: 600;
}
}
}
}
}
// 播放器样式 ********************************
.video {
width: 80%;
padding: 0rpx 20rpx;
}
/* 隐藏所有默认控件 */
video::-webkit-media-controls {
display: none !important;
}
video::-moz-media-controls {
display: none !important;
}
video::-ms-media-controls {
display: none !important;
}
/* 针对不同浏览器的隐藏控件的方式 */
video::part(media-controls) {
display: none !important;
}
video {
border-radius: 30rpx;
overflow: hidden;
}
.video-wrap{
display: flex;
align-items: center;
background-color: #06193a;
margin: 0rpx 20rpx;
justify-content: center;
}
</style>