153 lines
2.7 KiB
Vue
153 lines
2.7 KiB
Vue
|
|
<template>
|
||
|
|
<view class="content">
|
||
|
|
<!-- 日期搜索 -->
|
||
|
|
<view class="calendar">
|
||
|
|
<ren-calendar ref='ren' :markDays='markDays' @maskClick="maskClick" @onMonthClickPre='onMonthClickPre'
|
||
|
|
@onMonthClickNext="onMonthClickNext">
|
||
|
|
</ren-calendar>
|
||
|
|
</view>
|
||
|
|
<!-- 列表 -->
|
||
|
|
<view class="box">
|
||
|
|
<view class="list" v-for="(item,ind) in list" :key="ind" @click="handleDetail(item)">
|
||
|
|
<view class="time">{{item.time}}</view>
|
||
|
|
<view class="kcal">
|
||
|
|
<view>摄入卡路里<text>{{item.kcal}}</text>kcal</view>
|
||
|
|
<view class="status">
|
||
|
|
<text class="quan" :class="[item.status==1?'quan1':item.status==2?'quan2':'']"></text>
|
||
|
|
{{item.status==1?'达标':item.status==2?'未达标':'超标'}}
|
||
|
|
</view>
|
||
|
|
<icon class="iconfont icon-arrow-right"></icon>
|
||
|
|
</view>
|
||
|
|
</view>
|
||
|
|
</view>
|
||
|
|
|
||
|
|
</view>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import {
|
||
|
|
mapState
|
||
|
|
} from "vuex";
|
||
|
|
import RenCalendar from '@/uni_modules/ren-calendar/ren-calendar.vue';
|
||
|
|
export default {
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
single: "",
|
||
|
|
list: [],
|
||
|
|
markDays: {
|
||
|
|
warning: ['2023-07-04'],
|
||
|
|
success: ["2023-07-03"],
|
||
|
|
error: ["2023-07-02"],
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
components: {
|
||
|
|
RenCalendar,
|
||
|
|
},
|
||
|
|
computed: {
|
||
|
|
...mapState(["user"]),
|
||
|
|
end() {
|
||
|
|
return this.$tools.getTime()
|
||
|
|
},
|
||
|
|
},
|
||
|
|
onLoad() {
|
||
|
|
let that = this
|
||
|
|
that.list = that.$json.recordList
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
// 日期选择
|
||
|
|
maskClick(e) {
|
||
|
|
console.log('maskClick事件:', e);
|
||
|
|
},
|
||
|
|
onMonthClickPre(data) {
|
||
|
|
console.log("上月", data)
|
||
|
|
},
|
||
|
|
onMonthClickNext(data) {
|
||
|
|
console.log("下月", data)
|
||
|
|
},
|
||
|
|
handleDetail(item) {
|
||
|
|
let that = this
|
||
|
|
uni.setStorageSync("startDay", "2023-07-02")
|
||
|
|
uni.switchTab({
|
||
|
|
url: '/pages/count/count',
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style scoped="scoped" lang="scss">
|
||
|
|
.content {
|
||
|
|
padding: 0 15px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.calendar {
|
||
|
|
text-align: center;
|
||
|
|
background: #fff;
|
||
|
|
position: fixed;
|
||
|
|
top: 0;
|
||
|
|
left: 0;
|
||
|
|
right: 0;
|
||
|
|
z-index: 20;
|
||
|
|
height: 40px;
|
||
|
|
line-height: 40px;
|
||
|
|
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
|
||
|
|
}
|
||
|
|
|
||
|
|
.box {
|
||
|
|
margin-top: 55px;
|
||
|
|
width: 100%;
|
||
|
|
}
|
||
|
|
|
||
|
|
.list {
|
||
|
|
color: #999;
|
||
|
|
width: calc(100% - 30px);
|
||
|
|
background: #fff;
|
||
|
|
margin-bottom: 15px;
|
||
|
|
border-radius: 15px;
|
||
|
|
padding: 10px 15px;
|
||
|
|
|
||
|
|
|
||
|
|
.time {
|
||
|
|
width: 100%;
|
||
|
|
height: 30px;
|
||
|
|
line-height: 30px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.kcal {
|
||
|
|
display: flex;
|
||
|
|
justify-content: space-between;
|
||
|
|
align-items: center;
|
||
|
|
|
||
|
|
text {
|
||
|
|
font-size: 16px;
|
||
|
|
font-weight: bold;
|
||
|
|
margin: 0 3px;
|
||
|
|
color: #000;
|
||
|
|
}
|
||
|
|
|
||
|
|
.status {
|
||
|
|
width: 85px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.quan {
|
||
|
|
width: 12px;
|
||
|
|
height: 12px;
|
||
|
|
background: $uni-color-warning;
|
||
|
|
display: inline-block;
|
||
|
|
border-radius: 50%;
|
||
|
|
margin-right: 5px;
|
||
|
|
}
|
||
|
|
|
||
|
|
.quan1 {
|
||
|
|
background: $uni-color-success;
|
||
|
|
}
|
||
|
|
|
||
|
|
.quan2 {
|
||
|
|
background: $mainColor;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</style>
|