|
|
@@ -0,0 +1,238 @@
|
|
|
+<template>
|
|
|
+ <div style="height:100%">
|
|
|
+ <van-nav-bar title="健康评估" @click-left="$router.back()" left-arrow fixed placeholder safe-area-inset-top />
|
|
|
+ <div class="main">
|
|
|
+ <div class="header">
|
|
|
+ <div>
|
|
|
+ <div class="selectBox">
|
|
|
+ <div class="content" @click="select=!select">{{selectValue}}</div>
|
|
|
+ <div :class="select? 'select':'select selectOut'">
|
|
|
+ <div @click="selectValue='近一年',select=!select">近一年</div>
|
|
|
+ <div @click="selectValue='近两年',select=!select">近两年</div>
|
|
|
+ <div @click="selectValue='近三年',select=!select">近三年</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <van-button class="search" :disabled="searchloading" @click="pageNum=1,queryaction()">查询</van-button>
|
|
|
+ </div>
|
|
|
+ <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
|
|
|
+ <div class="list" v-for="item in healths" :key="item.id">
|
|
|
+ <div>
|
|
|
+ <img class="listg" :src="require('../../assets/img/listg.png')" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="list_box">
|
|
|
+ <div>
|
|
|
+ <p class="time">{{item.dateTime}}</p>
|
|
|
+ <p class="num">健康评估:{{showEstimate(item.estimate)}}</p>
|
|
|
+ </div>
|
|
|
+ <p @click="$router.push({path:'/details',query:{estimate:showEstimate(item.estimate),id:item.id}})">
|
|
|
+ <van-icon name="question-o" />点击查看详情
|
|
|
+ </p>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </van-pull-refresh>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import { queryaction } from '../../api/index.js'
|
|
|
+
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ searchloading: false,
|
|
|
+ select: true,
|
|
|
+ selectValue: '近一年',
|
|
|
+ healths: [],
|
|
|
+ isLoading: false,
|
|
|
+ loading: false,
|
|
|
+ finished: false,
|
|
|
+ pageNum: 1,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.queryaction()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ showEstimate(estimate) {
|
|
|
+ if (estimate == 'VeryHigh') {
|
|
|
+ return '极高危人群'
|
|
|
+ } else if (estimate == 'High') {
|
|
|
+ return '高危人群'
|
|
|
+ } else if (estimate == 'Medium') {
|
|
|
+ return '中危人群'
|
|
|
+ } else if (estimate == 'Low') {
|
|
|
+ return '低危人群'
|
|
|
+ } else {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getStartTimeStr: function (day) {
|
|
|
+ var today = new Date()
|
|
|
+ var beforMilliseconds = today.getTime() - 1000 * 3600 * 24 * day
|
|
|
+ var beforday = new Date()
|
|
|
+ beforday.setTime(beforMilliseconds)
|
|
|
+ var strYear = beforday.getFullYear()
|
|
|
+ var strDay = beforday.getDate()
|
|
|
+ var strMonth = beforday.getMonth() + 1
|
|
|
+ if (strMonth < 10) {
|
|
|
+ strMonth = '0' + strMonth
|
|
|
+ }
|
|
|
+ if (strDay < 10) {
|
|
|
+ strDay = '0' + strDay
|
|
|
+ }
|
|
|
+
|
|
|
+ return strYear + '-' + strMonth + '-' + strDay
|
|
|
+ },
|
|
|
+ async queryaction() {
|
|
|
+ this.searchloading = true
|
|
|
+ if (!this.searchloading) return
|
|
|
+ var startTime = ''
|
|
|
+ var endTime = this.getStartTimeStr(-1)
|
|
|
+ switch (this.selectValue) {
|
|
|
+ case '近一年': //体重
|
|
|
+ startTime = this.getStartTimeStr(365)
|
|
|
+ break
|
|
|
+ case '近两年': //体重
|
|
|
+ startTime = this.getStartTimeStr(730)
|
|
|
+ break
|
|
|
+ case '近三年': //体重
|
|
|
+ startTime = this.getStartTimeStr(1095)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ const res = await queryaction({
|
|
|
+ command: 'gethealthsascvdchistory',
|
|
|
+ uid: 2121,
|
|
|
+ startDate: startTime,
|
|
|
+ endDate: endTime,
|
|
|
+ extra: 0,
|
|
|
+ })
|
|
|
+ this.healths = res.healths
|
|
|
+ },
|
|
|
+ onRefresh() {
|
|
|
+ this.pageNum = 1
|
|
|
+ this.queryaction()
|
|
|
+ this.isLoading = false
|
|
|
+ },
|
|
|
+ },
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.main {
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100% - 100px);
|
|
|
+ overflow: hidden;
|
|
|
+ background-color: #fff;
|
|
|
+}
|
|
|
+.content {
|
|
|
+ font-size: 28px;
|
|
|
+ width: 240px;
|
|
|
+ height: 80px;
|
|
|
+ text-align: center;
|
|
|
+ color: #fff;
|
|
|
+ border-radius: 5px;
|
|
|
+ background-color: #00cccb;
|
|
|
+ line-height: 80px;
|
|
|
+}
|
|
|
+.selectBox {
|
|
|
+ position: relative;
|
|
|
+}
|
|
|
+.select {
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ top: 80px;
|
|
|
+ right: 0;
|
|
|
+ transition: all 0.5s;
|
|
|
+ height: 0;
|
|
|
+ overflow: hidden;
|
|
|
+ z-index: 900;
|
|
|
+ background-color: #eee;
|
|
|
+ // background-color: #000;
|
|
|
+ font-size: 28px;
|
|
|
+ div {
|
|
|
+ height: 60px;
|
|
|
+ line-height: 60px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+}
|
|
|
+.selectOut {
|
|
|
+ height: 180px;
|
|
|
+}
|
|
|
+.header {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ display: flex;
|
|
|
+ padding: 0 30px;
|
|
|
+ justify-content: space-between;
|
|
|
+ // border-bottom: 1px solid #ddd;
|
|
|
+ padding-bottom: 16px;
|
|
|
+ margin-top: 100px;
|
|
|
+ width: calc(100% - 60px);
|
|
|
+ background-color: #fff;
|
|
|
+ z-index: 9;
|
|
|
+}
|
|
|
+.search {
|
|
|
+ width: 120px;
|
|
|
+ color: #fff;
|
|
|
+ border-radius: 5px;
|
|
|
+ background-color: #ffc900;
|
|
|
+ line-height: 80px;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 30px;
|
|
|
+ padding: 0;
|
|
|
+}
|
|
|
+.list {
|
|
|
+ height: 196px;
|
|
|
+
|
|
|
+ border-bottom: 1px solid #ddd;
|
|
|
+ padding-left: 30px;
|
|
|
+ display: flex;
|
|
|
+ width: 100%;
|
|
|
+ .list_box {
|
|
|
+ margin-top: 52px;
|
|
|
+ width: calc(100% - 100px);
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ p {
|
|
|
+ margin: 0;
|
|
|
+ }
|
|
|
+ > div {
|
|
|
+ font-size: 30px;
|
|
|
+ margin-left: 26px;
|
|
|
+ .time {
|
|
|
+ color: #adadad;
|
|
|
+ }
|
|
|
+ .num {
|
|
|
+ margin-top: 26px;
|
|
|
+ color: #50d4c2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ > p {
|
|
|
+ font-size: 30px;
|
|
|
+ color: #50d4c2;
|
|
|
+ height: 60px;
|
|
|
+ background-color: #f8f8f8;
|
|
|
+ padding: 0 20px;
|
|
|
+ line-height: 60px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.van-pull-refresh {
|
|
|
+ margin-top: 116px;
|
|
|
+ z-index: 1;
|
|
|
+ height: calc(100% - 110px);
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+/deep/.van-pull-refresh__track {
|
|
|
+ .list:nth-child(2) {
|
|
|
+ border-top: 1px solid #ddd;
|
|
|
+ }
|
|
|
+}
|
|
|
+.van-list {
|
|
|
+ height: 100%;
|
|
|
+}
|
|
|
+.listg {
|
|
|
+ height: 196px;
|
|
|
+}
|
|
|
+</style>
|