Commit 417b8ed2 by cen

fix: 倒计时

1 parent 20a1c847

2.83 MB | W: | H:

2.83 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template> <template>
<view class="card" @click="handleTaskItemClick(item)"> <view class="card" @click="handleTaskItemClick(item)">
<view class="time-limit-tag" v-if="tabIndex === 0 && item.punishType == 1"></view> <view v-if="tabIndex === 1" class="time-limit-countdown">
<view v-if="tabIndex === 0 && item.punishType == 1" class="time-limit-countdown">
<template v-if="item._timeout"> <template v-if="item._timeout">
<view class="countdown-label timeout-label">已超时</view> <view class="countdown-label timeout-label">已超时</view>
</template> </template>
<template v-else-if="item._showCountdown"> <template v-else-if="item._showCountdown">
<view class="countdown-label">剩</view> <view class="countdown-label">即将开始</view>
<view class="countdown-num">{{ item._countdownHour }}</view> <view class="countdown-num">{{ item._countdownHour }}</view>
<view class="countdown-separator">:</view> <view class="countdown-label">分</view>
<view class="countdown-num">{{ item._countdownMinute }}</view> <view class="countdown-num">{{ item._countdownMinute }}</view>
<view class="countdown-separator">:</view> <view class="countdown-label">秒</view>
<view class="countdown-num">{{ item._countdownSecond }}</view> <view class="countdown-num">{{ item._countdownSecond }}</view>
</template> </template>
<template v-else-if="item._showDays"> <template v-else-if="item._showDays">
<view class="countdown-label">剩</view> <view class="countdown-label">即将开始</view>
<view class="countdown-num">{{ item._leftDays }}</view> <view class="countdown-num">{{ item._leftDays }}</view>
<view class="countdown-label">天</view> <view class="countdown-label">天</view>
<view class="countdown-num">{{ item._leftDays }}</view>
<view class="countdown-label">时</view>
</template> </template>
<template v-else> <template v-else>
<view class="countdown-label">剩</view> <view class="countdown-label">即将开始</view>
<view class="countdown-num">--</view> <view class="countdown-num">--</view>
<view class="countdown-separator">:</view> <view class="countdown-separator">:</view>
<view class="countdown-num">--</view> <view class="countdown-num">--</view>
...@@ -27,40 +28,50 @@ ...@@ -27,40 +28,50 @@
<view class="countdown-num">--</view> <view class="countdown-num">--</view>
</template> </template>
</view> </view>
<image class="task-item-img" :src="item.courseType === 1 ? require('../../../../assets/images/common/short-course-default.webp') : require('../../../../assets/images/common/course-default-bg.webp')" mode="aspectFill" /> <image class="task-item-img" :src="require('../../../../assets/images/common/activityBg.png')" mode="aspectFill" />
<view class="task-item-content"> <view class="task-item-content">
<view class="task-item-title">{{ item.taskTitle }}</view> <view class="task-item-title">{{ item.name }}</view>
<view class="task-item-text"> <view class="task-item-text" v-if="tabIndex !== 1">
<view class="task-item-label">任务进度</view> <view class="task-item-label">活动进度</view>
<view class="task-item-progress" v-if="item.completeStatus == 0"> <view class="task-item-progress" v-if="tabIndex !== 2">
<view class="task-item-progress-bar" :style="{ width: Math.floor(item.taskProgress) + '%' }"></view> <view class="task-item-progress-bar" :style="{ width: Math.floor(68.909) + '%' }"></view>
<view class="task-item-progress-text">{{ Math.floor(item.taskProgress) }}%</view> <view class="task-item-progress-text">{{ Math.floor(68.909) }}%</view>
</view> </view>
<view class="task-item-value" v-else> <view class="task-item-value" v-else>
<view class="dot-value"></view> <view class="gray">已结束</view>
<view class="green">已完成</view>
</view>
</view> </view>
<view class="task-item-text" v-if="item.courseType === 2">
<view class="task-item-label">课程数</view>
<view class="task-item-value">
{{ item.courseTotalCount }}节 |
{{ item.totalDuration || item.totalDuration === 0 ? `${item.totalDuration}min` : '-' }}
</view> </view>
<view class="task-item-text">
<view class="task-item-label">活动时间</view>
<view class="task-item-value">2025.09.01 00:00 - 2025.09.30 23:59</view>
</view> </view>
<view class="task-item-text"> <view class="task-item-text">
<view class="task-item-label">完成时间</view> <view class="task-item-label">评选规则</view>
<view class="task-item-value">{{ tabIndex === 0 ? formatTime(item.taskDeadline, 'YYYY-MM-DD HH:mm') : formatTime(item.finishDate, 'YYYY-MM-DD HH:mm') }}</view> <view class="task-item-value blueValue">查看</view>
</view> </view>
<view class="task-item-status">{{ item.status }}</view> <!-- <view class="task-item-status">{{ item.status }}</view> -->
</view> </view>
</view> </view>
</template> </template>
<script>
export default {
props: {
item: {
type: Object,
default: () => ({})
},
tabIndex: {
type: Number,
default: 0
}
}
}
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
.task-item { .card {
position: relative; position: relative;
width: 100%; width: 100%;
height: toRpx(432); // height: toRpx(516);
background-color: #fff; background-color: #fff;
border-radius: toRpx(24); border-radius: toRpx(24);
font-size: 0; font-size: 0;
...@@ -123,7 +134,7 @@ ...@@ -123,7 +134,7 @@
.task-item-img { .task-item-img {
width: 100%; width: 100%;
height: toRpx(180); height: toRpx(312);
border-radius: toRpx(16) toRpx(16) 0 0; border-radius: toRpx(16) toRpx(16) 0 0;
} }
...@@ -135,7 +146,7 @@ ...@@ -135,7 +146,7 @@
font-size: toRpx(30); font-size: toRpx(30);
color: #292d33; color: #292d33;
font-weight: 500; font-weight: 500;
margin-bottom: toRpx(24); margin-bottom: toRpx(20);
width: toRpx(340); width: toRpx(340);
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -147,7 +158,7 @@ ...@@ -147,7 +158,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
font-size: toRpx(24); font-size: toRpx(24);
margin-bottom: toRpx(24); margin-bottom: toRpx(12);
.task-item-label { .task-item-label {
width: toRpx(96); width: toRpx(96);
...@@ -167,9 +178,12 @@ ...@@ -167,9 +178,12 @@
background: #2cca74; background: #2cca74;
margin-right: toRpx(8); margin-right: toRpx(8);
} }
.green { .gray {
color: #2cca74; color: #666666;
}
} }
.blueValue {
color: #4673ff;
} }
} }
......
<!--针对弹窗穿透滚动,统一封装的popup-->
<template>
<page-meta :page-style="'overflow:' + (show ? 'hidden' : 'visible')"></page-meta>
<uni-popup :class="['customPopup', popupClass, noTitle ? 'noTitle' : '']" ref="publishPopup" :type="type" @change="change" :safe-area="safeArea" :is-mask-click="isMaskClick" :showClose="showClose">
<!-- 顶部标题栏插槽 -->
<slot name="header">
<view class="popup-top-box flex align-center" v-if="showTitle">
<view class="popup-top-box-title flex-1">{{ title }}</view>
<view style="font-size: 0">{{ otherText }}</view>
<view @click.stop="closePopup">
<view class="sprite-icon icon-evaluationClose"></view>
</view>
</view>
</slot>
<!-- 主要内容插槽 -->
<view class="content">
<slot name="content"></slot>
</view>
<!-- 底部插槽 插槽有内容就优先自定义内容-->
<slot name="footer">
<view class="footer-box flex justify-center" v-if="isShowFooter">
<view class="cancle-btn btn" v-if="isShowCancel" @click.stop="closePopup">{{ cancelText }}</view>
<view class="sure-btn btn" :class="{ 'single-btn': isShowCancel }" @click.stop="confirm">{{ confirmText }}</view>
</view>
</slot>
</uni-popup>
</template>
<script>
export default {
name: 'GeneralPopup',
props: {
type: {
type: String,
default: 'bottom'
},
isMaskClick: {
type: Boolean,
default: false
},
safeArea: {
type: Boolean,
default: true
},
popupClass: {
type: String,
default: ''
},
showClose: {
type: Boolean,
default: true
},
title: {
type: String,
default: ''
},
showTitle: {
type: Boolean,
default: true
},
isShowFooter: {
type: Boolean,
default: true
},
cancelText: {
type: String,
default: '取消'
},
confirmText: {
type: String,
default: '确定'
},
isShowCancel: {
type: Boolean,
default: true
},
autoClose: {
type: Boolean,
default: true
},
noTitle: {
type: Boolean,
default: false
},
otherText: {
type: String,
default: ''
}
},
data() {
return {
show: false
}
},
methods: {
open() {
this.$refs.publishPopup.open()
},
change(e) {
this.show = e.show
},
closePopup() {
this.$refs.publishPopup.close()
this.$emit('close')
},
confirm() {
if (this.autoClose) {
this.$refs.publishPopup.close()
}
this.$emit('confirm')
}
}
}
</script>
<style scoped lang="scss">
.justify-between {
-webkit-box-pack: justify;
-ms-flex-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
}
.align-center {
align-items: center;
}
.uniui-closeempty {
color: #1a1a1a;
font-size: toRpx(24);
font-weight: 600;
}
.single-btn {
width: 100%;
}
.btn {
width: toRpx(720);
height: toRpx(76);
border-radius: toRpx(48);
opacity: 1;
line-height: toRpx(80);
text-align: center;
color: rgba(26, 26, 26, 0.6);
font-size: toRpx(32);
font-weight: 500;
}
.cancle-btn {
background: #f0f1f5;
margin-right: toRpx(38);
}
.sure-btn {
color: #fff;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
}
</style>
...@@ -28,10 +28,11 @@ ...@@ -28,10 +28,11 @@
</view> </view>
</view> </view>
<template> <template>
<scroll-view scroll-y ref="scrollViewRef" :scroll-top="scrollTop" @scrolltolower="pageonReachBottom" :class="[getScrollHeight]"> <view class="activity-box">
<scroll-view scroll-y ref="scrollViewRef" :scroll-top="scrollTop" @scrolltolower="pageonReachBottom" class="activity-list-box">
<template v-if="cardList.length"> <template v-if="cardList.length">
<view class="task-list"> <view class="card-list">
<Card v-for="item in cardList" :key="item.taskId" :item="item" /> <Card v-for="item in cardList" :key="item" :item="item" :tabIndex="firstIndex" />
</view> </view>
</template> </template>
<template v-else> <template v-else>
...@@ -44,6 +45,7 @@ ...@@ -44,6 +45,7 @@
<view class="end-text">到底了!</view> <view class="end-text">到底了!</view>
</template> </template>
</scroll-view> </scroll-view>
</view>
</template> </template>
</view> </view>
</view> </view>
...@@ -67,7 +69,7 @@ export default { ...@@ -67,7 +69,7 @@ export default {
{ tabName: '即将开始', num: () => '' }, { tabName: '即将开始', num: () => '' },
{ tabName: '已结束', num: () => '' } { tabName: '已结束', num: () => '' }
], ],
cardList: [], cardList: [{ name: '1' }, { name: '1' }, { name: '1' }, { name: '1' }, { name: '1' }, { name: '1' }, { name: '1' }, { name: '1' }, { name: '1' }],
firstIndex: 0, firstIndex: 0,
firstLeft: ['first', 'second'], firstLeft: ['first', 'second'],
firstClass: ['short-first-nav', 'short-second-nav'], firstClass: ['short-first-nav', 'short-second-nav'],
...@@ -352,6 +354,20 @@ export default { ...@@ -352,6 +354,20 @@ export default {
} }
} }
} }
.activity-box {
padding-top: toRpx(32);
height: calc(100% - #{toRpx(100)});
.activity-list-box {
margin-top: toRpx(24);
height: calc(100% - #{toRpx(210)});
}
}
.card-list {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: toRpx(40);
padding: 0 toRpx(40) toRpx(32);
}
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!