You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
zhishifufei_uniapp/pages/learningCenter/clockRecord.vue

249 lines
5.6 KiB

<template>
<BaseContainer class="record flex">
<NavBar title="打卡记录" />
<image :src="getImgPath('/static/frontend/record-bg.png')" mode="aspectFill" class="bg"></image>
<view class="record-container">
<view class="record-info flex">
<view class="total">
<view>累计打卡</view>
<view><text>{{ totalClock }}</text><text></text></view>
</view>
<view class="line"></view>
<view class="today">
<view>今日打卡</view>
<view :style="{ color: todayClock ? '#52C794' : '' }">{{ todayClock ? '已打卡' : '暂未打卡' }}</view>
</view>
</view>
<view class="calendar-box">
<calendar ref="calendar" @change="changeRecord"/>
</view>
<view class="record-list">
<view class="list-title">
打卡记录
</view>
<view v-for="(item, index) in recordList" :key="index" class="list-item flex">
<view class="item-left">
<view>{{ item.name }}</view>
<view v-if="item.type === 2" class="time">用时:{{ item.use_time }}</view>
</view>
<view class="item-right">
<view v-if="item.type === 2" class="score">{{ item.score }}分</view>
<view>{{ item.date }}</view>
</view>
</view>
<view v-if="recordList.length && !loading" class="finished">{{ loadTitle }}</view>
<view v-if="finished && !recordList.length" class="empty">
<image mode="aspectFill" :src="getImgPath('/wap/first/zsff/images/empty.png')" alt="暂无记录" />
<view>暂无消息</view>
</view>
</view>
</view>
</BaseContainer>
</template>
<script>
import { getDateRecordList } from '@/api/learning';
import Calendar from './components/calendar.vue';
export default {
components: {
Calendar,
},
data() {
return {
totalClock: 50,
todayClock: false,
recordList: [],
page: 1,
limit: 10,
loading: false,
finished: false,
loadTitle: '',
};
},
onLoad() {
this.$nextTick(() => {
this.getRecordList();
});
},
onReachBottom() {
this.getRecordList();
},
methods: {
changeRecord() {
this.page = 1;
this.limit = 10;
this.finished = false;
this.recordList = [];
this.getRecordList();
},
async getRecordList() {
if (this.loading || this.finished) {
return;
}
uni.showLoading();
console.log(this);
const { nowYear, nowMonth, nowDate } = this.$refs.calendar;
const { data } = await getDateRecordList(
{
page: this.page++,
limit: this.limit,
date: `${nowYear}-${nowMonth < 10 ? '0' + nowMonth : nowMonth}-${nowDate}`
// date: '',
}
);
uni.hideLoading();
this.recordList = this.recordList.concat(data);
console.log(this.recordList);
this.finished = data.length < this.limit;
this.loadTitle = this.finished ? "已全部加载完" : "上拉加载更多";
},
},
};
</script>
<style lang="scss" scoped>
.record {
flex-direction: column;
min-height: 100vh;
height: fit-content!important;
.bg {
position: absolute;
top: 0;
left: 0;
width: 750rpx;
height: 743rpx;
z-index: 0;
}
.record-container {
flex: 1;
padding-top: 60rpx;
.record-info {
justify-content: space-between;
margin-bottom: 50rpx;
padding: 0 150rpx;
>view {
color: #333;
font-size: 30rpx;
line-height: 30rpx;
&.line {
width: 2rpx;
height: 76rpx;
background: #EEEEEE;
}
>view:last-child {
height: 70rpx;
font-size: 38rpx;
color: #666;
margin-top: 27rpx;
>text {
font-size: 24rpx;
color: #999;
&:first-child {
font-size: 70rpx;
color: #3293FF;
}
}
}
}
}
.calendar-box {
width: 690rpx;
// height: 630rpx;
background: #fff;
border-radius: 10rpx;
margin: 0 auto;
position: relative;
padding: 0 35rpx;
&:before {
content: '';
width: 12rpx;
height: 36rpx;
background: linear-gradient(0deg, #DCEBF4 0%, #3293FF 100%);
border-radius: 6rpx;
position: absolute;
top: -18rpx;
left: 100rpx;
}
&:after {
content: '';
width: 12rpx;
height: 36rpx;
background: linear-gradient(0deg, #DCEBF4 0%, #3293FF 100%);
border-radius: 6rpx;
position: absolute;
top: -18rpx;
right: 100rpx;
}
}
.record-list {
background: #fff;
border-radius: 10rpx;
padding: 40rpx 30rpx;
width: 690rpx;
margin: 20rpx auto 0;
.list-title {
text-align: center;
color: #333333;
font-size: 34rpx;
margin-bottom: 20rpx;
}
.list-item {
border-bottom: 1rpx solid #F0F0F0;
padding: 30rpx 0;
>view {
justify-content: space-between;
&.item-left {
color: #333333;
font-size: 30rpx;
line-height: 30rpx;
width: 400rpx;
>view {
height: 30rpx;
}
>.time {
font-size: 22rpx;
color: #999797;
margin-top: 15rpx;
}
}
&.item-right {
font-size: 22rpx;
color: #999797;
line-height: 30rpx;
margin-left: auto;
>.score {
color: #3293FF;
font-size: 32rpx;
margin-bottom: 15rpx;
}
>view {
height: 30rpx;
}
}
}
}
.finished,
.loading {
font-size: 28rpx;
line-height: 100rpx;
text-align: center;
color: #bbb;
}
.empty {
margin-top: 100rpx;
font-size: 28rpx;
text-align: center;
color: #bbb;
}
.empty image {
display: block;
width: 414rpx;
height: 305rpx;
margin: 0 auto;
pointer-events: none;
}
}
}
}
</style>