123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530 |
- <template>
- <view class="hb column hidden container">
- <image class="bg" src="https://user.test.ylrztop.com/images/waist_circumference_top_bg.png" mode="widthFix"></image>
- <view :style="{height: statusBarHeight,background: bgColor }"></view>
- <u-navbar title="腰围" titleStyle="font-weight: bold;" @rightClick="rightClick" :autoBack="true"
- :bg-color="bgColor">
- </u-navbar>
- <view class="top-fixed">
- <!-- tab切换 -->
- <!-- <view class="pub-tab-box">
- <view class="tab-inner">
- <view v-for="(item,index) in times" :key="index" :class="item.val == aIndex?'item active':'item'"
- @click="orderStatusChange(item)">
- <view class="text">
- {{ item.name }}
- </view>
- </view>
- </view>
- </view> -->
- <dateTimePicker @onChange="onChangeTime" :tab-color="'orange'"/>
- </view>
- <scroll-view class="content" :scroll-y="true">
- <view class="content-box">
- <!-- <view class="box-tab">
- <view class="item active">图表</view>
- <view class="item">列表</view>
- </view>
- <view class="h40"></view> -->
- <view class="tltle">腰围趋势</view>
- <view class="subtitle">单位:CM</view>
- <view class="charts-box">
- <qiun-data-charts type="line" :opts="opts" :chartData="chartData" />
- </view>
- <!-- <view class="legend">
- <view class="legend-item">
- <view class="legend-dot" style="background-color: #52D087;"></view><text>正常</text>
- </view>
- <view class="legend-item">
- <view class="legend-dot" style="background-color: #FDBD27;"></view><text>偏小</text>
- </view>
- <view class="legend-item">
- <view class="legend-dot" style="background-color: #FF5030;"></view><text>偏大</text>
- </view>
- </view> -->
- </view>
- <view class="content-box">
- <view class="align-center justify-between">
- <view class="tltle">腰围异常记录</view>
- <view class="more" @click="goPage()">
- <text>查看更多</text>
- <image class="w48 h48" src="/static/images/health/right_arrow_right_icon24.png"></image>
- </view>
- </view>
- <view class="type-box">
- <view class="box bg1">
- <view class="fs32 mb12">正常</view>
- <view class="align-center justify-between">
- <text class="subtitle">{{count.count0}}次</text>
- <image class="w24 h24" src="/static/images/health/zc_arrow_icon.png"></image>
- </view>
- </view>
- <view class="box bg2">
- <view class="fs32 mb12">偏小</view>
- <view class="align-center justify-between">
- <text class="subtitle">{{count.count1}}次</text>
- <image class="w24 h24" src="/static/images/health/qw_arrow_icon.png"></image>
- </view>
- </view>
- <view class="box bg3">
- <view class="fs32 mb12">偏大</view>
- <view class="align-center justify-between">
- <text class="subtitle">{{count.count2}}次</text>
- <image class="w24 h24" src="/static/images/health/yz_arrow_icon.png"></image>
- </view>
- </view>
- </view>
- </view>
- <view class="h40"></view>
- <view class="btn-box">
- <view class="sub-btn" @click="navgetTo()">记录</view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- import {getDataList,getLatest,getLatestList} from '@/api/healthUser.js'
- import dateTimePicker from "@/pages_echarts/components/dateTimePicker/dateTimePicker.vue"
- export default {
- components: {
- dateTimePicker
- },
- data() {
- return {
- examDate:null,
- statusBarHeight: '',
- top: 0,
- aIndex: 0,
- times: [{
- name: "每日",
- val: 0
- },
- {
- name: "每周",
- val: 1
- },
- {
- name: "每月",
- val: 2
- }
- ],
- indexInfo: [],
- chartData: {},
- opts: {
- color: ["#FDBD27", "#FF5030"],
- padding: [15, 0, 15, 0],
- enableScroll: false,
- dataLabel: false,
- dataPointShapeType: 'hollow',
- tapLegend: false,
- legend: {
- show: false
- },
- xAxis: {
- // disableGrid: true
- axisLine: false,
- fontColor: '#CCCCCC'
- },
- yAxis: {
- // showTitle:true,
- // title:"单位:mmol/L",
- gridType: "dash",
- dashLength: 2,
- data: [{
- axisLine: false,
- fontColor: '#CCCCCC'
- }]
- // fontColor:'#CCCCCC'
- },
- extra: {
- line: {
- type: "straight",
- width: 2,
- activeType: "hollow"
- }
- }
- },
- count:{},
- user:null
- }
- },
- computed: {
- // 计算属性的 getter
- bgColor: function() {
- var top = this.top / 30;
- return 'rgba(11,179,242, ' + top + ')';
- },
- },
- onLoad(options) {
- // 获取系统信息
- // console.log(options,'===')
- // this.user=JSON.parse(uni.getStorageSync('userInfo'))
- const sys = uni.getSystemInfoSync()
- this.statusBarHeight = sys.statusBarHeight + 'px'
- this.userId=options.userId
- uni.$on('refreshWaistLine', () => {
- this.aIndex=0
- this.getServerData(0);
- })
- // this.getServerData();
- },
- onUnload() { //普通页面在 onUnload 生命周期中执行
- uni.$emit('stop')
- },
- onHide() { //tabBar页面在onHide生命周期中执行
- uni.$emit('stop')
- },
- onPageScroll(e) {
- //console.log(e)
- this.top = e.scrollTop;
- },
- methods: {
- // tab切换
- orderStatusChange(item) {
- this.aIndex = item.val
- },
- onChangeTime(time,tab) {
- if (this.userId) {
- this.examDate=time
- this.getServerData(tab);
- }
- // this.examDate = {
- // startTime: this.utils.timeFormat(time[0],'yyyy/mm/dd hh:MM:ss'),
- // endTime: this.utils.timeFormat(time[1],'yyyy/mm/dd hh:MM:ss'),
- // deviceId: ''
- // }
- // this.queryParam = param
- // this.getServerData(param)
- // this.getAbnormalInfo(param)
- },
- getServerData(index) {
- var that=this
- var data={
- userId: this.userId,
- measurementType: 0,
- pageNum:1,
- pageSize:100,
- timeSearch:this.examDate,
- // "value1": 85,
- // "measurementTime": this.utils.timeFormat(new Date(),'hh:MM:ss')
- }
- const weekMap= {
- 1: '一',
- 2: '二',
- 3: '三',
- 4: '四',
- 5: '五',
- 6: '六',
- 0: '日' // 注意:JavaScript中getDay()返回0表示周日
- };
- getLatestList(data).then(
- res => {
- if (res.code == 200) {
- this.count=res.count
- var list=res.data.list
- var time=list.map(item => item.measurementTime).reverse()
- var week=list.map(item => '周'+weekMap[item.week]).reverse()
- var month=list.map(item => item.measurementDate).reverse()
- setTimeout(() => {
- //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
- let res = {
- categories:index==0?time:index==1?week:month,
- series: [{
- name: "测量值",
- data: list.map(item => item.value1)
- }
- ]
- };
- this.chartData = JSON.parse(JSON.stringify(res));
- }, 500);
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- });
- }
- },
- rej => {}
- )
-
- },
- goPage(index) {
- uni.navigateTo({
- url: '/pages_echarts/waistLineList?userId='+this.userId
- })
- },
- navgetTo(index) {
- uni.navigateTo({
- url: '/pages_echarts/waistLineDetail?type=add&userId='+this.userId
- })
- },
- goToUser() {
- uni.navigateTo({
- url: '/pages_health/addUser?type=edit&docId='
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- position: relative;
- .bg {
- width: 100%;
- height: 380rpx;
- position: absolute;
- top: 0;
- left: 0;
- z-index: -1;
- }
- }
- .top-fixed {
- width: 100%;
- position: fixed;
- top: calc(var(--status-bar-height) + 140rpx);
- left: 0;
- z-index: 10;
- }
- .pub-tab-box {
- box-sizing: border-box;
- width: 400rpx;
- // padding: 0 60rpx;
- margin: 0 auto;
- // background-color: #FFFFFF;
- .tab-inner {
- height: 88upx;
- line-height: 88upx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- overflow-x: auto;
- }
- .item {
- font-family: PingFang SC;
- font-weight: 400;
- font-size: 30rpx;
- color: #626468;
- line-height: 64rpx;
- text-align: center;
- &:last-child {
- margin-right: 0;
- }
- &.active {
- font-weight: 500;
- width: 124rpx;
- height: 64rpx;
- background: #FF5039;
- border-radius: 32rpx 32rpx 32rpx 32rpx;
- color: #fff;
- }
- .text {
- position: relative;
- z-index: 1;
- }
- .tab-bg {
- width: 72upx;
- height: 28upx;
- position: absolute;
- top: 17upx;
- left: 50%;
- transform: translateX(-36upx);
- z-index: -1;
- }
- }
- }
- .content {
- padding-top: calc(var(--status-bar-height) + 300rpx) !important;
- height: 100vh;
- box-sizing: border-box;
- width: 100%;
- // padding: 0 24rpx 24rpx 24rpx;
- overflow: hidden;
- padding: 20rpx;
- .btn-box {
- height: 120upx;
- padding: 0 30upx;
- display: flex;
- align-items: center;
- justify-content: center;
- .sub-btn {
- width: 388rpx;
- height: 72rpx;
- line-height: 72upx;
- text-align: center;
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FFFFFF;
- background: #FF5039;
- border-radius: 44upx;
- margin-bottom: 40upx;
- }
- }
- .content-box {
- // width: 100%;
- background: #FFFFFF;
- border-radius: 16rpx;
- padding: 24rpx;
- margin-bottom: 20rpx;
- .tltle {
- font-family: PingFang SC;
- font-weight: 500;
- font-size: 36rpx;
- color: #222426;
- text-align: left;
- margin-bottom: 16rpx;
- }
- .subtitle {
- // padding-left: 24rpx;
- font-weight: 400;
- font-size: 24rpx;
- color: #898E91;
- text-align: left;
- }
- .type-box {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-top: 20rpx;
-
- .box {
- padding: 24rpx;
- width: 158rpx;
- // height: 144rpx;
- border-radius: 16rpx 16rpx 16rpx 16rpx;
-
- &.bg1 {
- background: #FAFFFC;
- border: 2rpx solid #EBFFF3;
- }
-
- &.bg2 {
- background: #FEFAF8;
- border: 2rpx solid #FDF7F3;
- }
-
- &.bg3 {
- background: #FFFCFC;
- border: 2rpx solid #FCF4F4;
- }
- }
- }
- /* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
- .charts-box {
- padding: 24rpx;
- // width: 100%;
- height: 500rpx;
- margin-top: 30rpx;
- }
- .legend {
- // height: 34rpx;
- margin-top: 44rpx;
- // @include u-flex(row, center, space-between);
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #626468;
- &-item {
- flex: 1;
- text-align: center;
- // @include u-flex(row, center, center);
- display: flex;
- align-items: center;
- justify-content: center;
- }
- &-dot {
- width: 16rpx;
- height: 16rpx;
- border-radius: 50%;
- margin: 16rpx;
- }
- }
- .more {
- display: flex;
- align-items: center;
- font-family: PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #898E91;
- }
- .box-tab{
- display: flex;
- align-items: center;
- height: 100rpx;
- line-height: 100rpx;
- background: linear-gradient( 360deg, #F9EDEC 0%, #FFD6D2 100%);
- // background: url(@/static/images/health/hip_circumference_tab_switch_bg.png) no-repeat center center / cover;
- .item {
- font-family: PingFang SC;
- font-weight: 400;
- font-size: 36rpx;
- color: #626468;
- flex:1;
- text-align: center;
- display: flex;
- align-items: flex-end;
- justify-content: center;
- &.active {
- background: #fff;
- color: #FF5039;
- font-weight: bold;
- border-radius: 40rpx 40rpx 0 0;
- // box-shadow: 5rpx 0px 15rpx rgba(0, 0, 0, 0.1);
- &::after {
- content: "";
- width: 36rpx;
- height: 8rpx;
- background: #FF5039;
- border-radius: 4rpx 4rpx 4rpx 4rpx;
- position: absolute;
- // bottom: 0;
- }
-
- }
-
- .text {
- position: relative;
- z-index: 1;
- }
-
- .tab-bg {
- width: 72upx;
- height: 28upx;
- position: absolute;
- top: 17upx;
- left: 50%;
- transform: translateX(-36upx);
- z-index: -1;
- }
- }
- }
-
-
- }
- }
- </style>
|