123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425 |
- <template>
- <view class="container">
- <uni-nav-bar fixed :border="false" :backgroundColor="`rgba(255,255,255,${opacity})`" title="血糖监测" :statusBar="true"
- left-icon="left" @clickLeft="back"></uni-nav-bar>
- <image class="page-bg" src="@/static/images/pages_watch/images/blood_sugar_top_bg.png" mode="widthFix"></image>
- <view class="container-body">
- <dateTimePicker @onChange="onChangeTime"/>
- <!-- 血糖趋势 -->
- <view class="box">
- <view class="box-title">
- <view class="box-title-left">血糖趋势</view>
- </view>
- <view class="ytitle" v-show="!loading && !isEmpty">单位:mmol/L</view>
- <view class="echartbox">
- <qiun-data-charts v-show="!isEmpty" type="area" :opts="opts" :chartData="chartData" tooltipFormat="bsTooltip" />
- <myEmpty v-show="isEmpty" style="padding: 40rpx 0 0 0;"></myEmpty>
- </view>
- </view>
- <!-- 血糖异常记录 -->
- <view class="box">
- <view class="box-title" style="height: 80rpx;">
- <view class="box-title-left">血糖异常记录</view>
- <view class="box-title-right" @tap="handleMore">
- 查看更多<image src="@/static/images/pages_watch/icons/my_right_arrow_right_icon.png"></image>
- </view>
- </view>
- <view class="abnormal">
- <view class="abnormal-item colorbg1">
- <view class="abnormal-item-title">高风险</view>
- <view class="abnormal-item-num">
- <text>{{status1}}次</text>
- <image src="@/static/images/pages_watch/icons/zyss_arrow_icon1.png"></image>
- </view>
- </view>
- <view class="abnormal-item colorbg2">
- <view class="abnormal-item-title">不良</view>
- <view class="abnormal-item-num">
- <text>{{status2}}次</text>
- <image src="@/static/images/pages_watch/icons/zyss_arrow_icon2.png"></image>
- </view>
- </view>
- <view class="abnormal-item colorbg3">
- <view class="abnormal-item-title">一般</view>
- <view class="abnormal-item-num">
- <text>{{status3}}次</text>
- <image src="@/static/images/pages_watch/icons/zyss_arrow_icon3.png"></image>
- </view>
- </view>
- <view class="abnormal-item colorbg4">
- <view class="abnormal-item-title">良好</view>
- <view class="abnormal-item-num">
- <text>{{status4}}次</text>
- <image src="@/static/images/pages_watch/icons/zyss_arrow_icon4.png"></image>
- </view>
- </view>
- <view class="abnormal-item colorbg5">
- <view class="abnormal-item-title">正常</view>
- <view class="abnormal-item-num">
- <text>{{status5}}次</text>
- <image src="@/static/images/pages_watch/icons/zyss_arrow_icon5.png"></image>
- </view>
- </view>
- </view>
- <view class="standard">
- <view class="standard-title">
- <image src="@/static/images/pages_watch/icons/note_icon.png"></image>
- <text>血糖</text>
- <text>最新标准</text>
- </view>
- <view class="standard-con">
- <view>空腹血糖正常值为4.1-6.1mmol/L</view>
- <view>餐后1小时血糖正常值为6.7-9.4mmol/L</view>
- <view>餐后2小时血糖正常值为{{'<=' + 7.8}}mmol /L</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import myEmpty from "@/pages_watch/components/myEmpty/myEmpty.vue"
- import dateTimePicker from "@/pages_watch/components/dateTimePicker/dateTimePicker.vue"
- import {bgInfo,bgAbnormaInfo} from "@/api/pages_watch/healthMonitoring.js";
-
- export default {
- components: {
- myEmpty,
- dateTimePicker
- },
- data() {
- return {
- opacity: 0,
- loading: false,
- isEmpty: false,
- chartData: {},
- // 1:高风险2:不良 3:一般 4:良好 5:正常
- status1: 0,
- status2: 0,
- status3: 0,
- status4: 0,
- status5: 0,
- queryParam: {
- startTime: "",
- endTime: "",
- deviceId: uni.getStorageSync("deviceId")
- },
- opts: {
- color: ["#FF7700"],
- padding: [20, 0, 15, 0],
- enableScroll: false,
- dataLabel:false,
- dataPointShapeType: "hollow",
- legend: {
- show: false,
- },
- xAxis: {
- disableGrid: true,
- fontSize: 12,
- axisLine:false,
- fontColor: '#ccc',
- // 横坐标最多展示几个
- labelCount: 7,
- // 自定义横坐标展示(在/u-charts/config-ucharts中有配置)
- format: "formatterTime",
- },
- yAxis: {
- gridType: "dash",
- dashLength: 2,
- // splitNumber: 6,
- data: [{
- fontColor: '#ccc',
- min: 0,
- // max: 33,
- axisLine:false,
- fontSize: 12,
- }]
- },
- extra: {
- tooltip: {
- gridType: "dash",
- showArrow: false,
- legendShow: true,
- legendShape: "circle"
- },
- area: {
- type: "straight",
- opacity: 0.2,
- addLine: true,
- width: 2,
- gradient: true,
- activeType: "solid"
- }
- }
- }
- }
- },
- methods: {
- back() {
- uni.navigateBack({
- delta: 1
- })
- },
- onChangeTime(time) {
- const param = {
- startTime: this.$timeFormat(time[0],'yyyy/mm/dd hh:MM:ss'),
- endTime: this.$timeFormat(time[1],'yyyy/mm/dd hh:MM:ss'),
- deviceId: uni.getStorageSync("deviceId")
- }
- this.queryParam = param
- this.getServerData(param)
- this.getAbnormalInfo(param)
- },
- getServerData(param) {
- //模拟从服务器获取数据时的延时
- this.loading = true
- bgInfo(param).then((res) => {
- this.loading = false
- this.isEmpty = !(res.data && res.data.length>0)
- if(res.code == 200 && res.data) {
- let chartData = {
- categories: res.data.map(item=>item.createTime),
- series: [{
- name: "血糖",
- data: res.data.map(item=>item.bloodGlucose)
- }]
- }
- this.chartData = JSON.parse(JSON.stringify(chartData));
- }
- }).catch((err) => {
- this.loading = false
- });
- },
- // 获取异常数据
- getAbnormalInfo(param) {
- this.status1 = 0
- this.status2 = 0
- this.status3 = 0
- this.status4 = 0
- this.status5 = 0
- bgAbnormaInfo(param).then((res) => {
- if(res.code == 200 && res.data && res.data.length > 0) {
- res.data.forEach(item=>{
- this.status1 += item.status == 1 ? item.count : 0
- this.status2 += item.status == 2 ? item.count : 0
- this.status3 += item.status == 3 ? item.count : 0
- this.status4 += item.status == 4 ? item.count : 0
- this.status5 += item.status == 5 ? item.count : 0
- })
- } else {
- this.status1 = 0
- this.status2 = 0
- this.status3 = 0
- this.status4 = 0
- this.status5 = 0
- }
- }).catch((err) => { });
- },
- // 查看等多数据
- handleMore() {
- uni.navigateTo({
- url: "/pages_watch/healthMonitoring/bloodSugarAbnormal?startTime="+this.queryParam.startTime+ "&endTime=" + this.queryParam.endTime
- })
- }
- },
- onPageScroll(e) {
- if (e.scrollTop <= 44) {
- this.opacity = e.scrollTop / 44 * 1
- } else if (e.scrollTop > 44) {
- this.opacity = 1
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @mixin u-flex($flexD, $alignI, $justifyC) {
- display: flex;
- flex-direction: $flexD;
- align-items: $alignI;
- justify-content: $justifyC;
- }
- .container {
- padding: 0 24rpx;
- position: relative;
- }
- .page-bg {
- width: 100%;
- height: auto;
- position: absolute;
- top: 0;
- left: 0;
- }
- .container-body {
- position: relative;
- z-index: 1;
- padding-bottom: 24rpx;
- }
- .box-title {
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #757575;
- @include u-flex(row, center, space-between);
- &-left {
- font-weight: 500;
- font-size: 36rpx;
- color: #222222;
- line-height: 42rpx;
- }
- &-right {
- @include u-flex(row, center, flex-start);
- image {
- height: 48rpx;
- width: 48rpx;
- }
- }
- }
- .box {
- padding: 24rpx;
- margin-bottom: 20rpx;
- box-sizing: border-box;
- background: #FFFFFF;
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- }
- .ytitle {
- margin-top: 10rpx;
- line-height: 34rpx;
- margin-bottom: 24rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #999999;
- }
- .echartbox {
- height: 466rpx;
- width: 100%;
- }
- .abnormal {
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #757575;
- @include u-flex(row, center, flex-start);
- flex-wrap: wrap;
- // gap: 18rpx;
- margin-top: 20rpx;
- margin-bottom: -18rpx;
- margin-right: -18rpx;
- &-item {
- width: 206rpx;
- height: 144rpx;
- padding: 0 24rpx;
- margin: 0 18rpx 18rpx 0;
- box-sizing: border-box;
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- border: 2rpx solid #FCF4F4;
- @include u-flex(column, flex-start, center);
- &-title {
- font-weight: 500;
- font-size: 32rpx;
- color: #333333;
- margin-bottom: 12rpx;
- }
- image {
- width: 24rpx;
- height: 24rpx;
- }
- &-num {
- width: 100%;
- @include u-flex(row, center, space-between);
- }
- }
- .colorbg1 {
- background: #FFFCFC;
- border-color: #FCF4F4;
- }
- .colorbg2 {
- background: #FEFAF8;
- border-color: #FDF7F3;
- }
- .colorbg3 {
- background: #FAFBFF;
- border-color: #F2F7FE;
- }
- .colorbg4 {
- background: #FAFCFF;
- border-color: #F6FAFF;
- }
- .colorbg5 {
- background: #FAFFFC;
- border-color: #EBFFF3;
- }
- }
- .standard {
- padding: 24rpx;
- margin-top: 32rpx;
- background: #F5F7FA;
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- &-title {
- @include u-flex(row, center, flex-start);
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- font-size: 28rpx;
- color: #333333;
- image {
- width: 48rpx;
- height: 48rpx;
- margin-right: 14rpx;
- }
- text:last-child {
- color: #FF7700;
- }
- }
- &-con {
- margin-top: 28rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #757575;
- view {
- margin-bottom: 12rpx;
- padding-left: 24rpx;
- position: relative;
- &::before {
- content: "";
- width: 8rpx;
- height: 8rpx;
- background: rgba(255, 119, 0, 0.5);
- border-radius: 50%;
- position: absolute;
- left: 0;
- top: 50%;
- transform: translateY(-50%);
- }
- }
- }
- }
- </style>
|