提交签到

This commit is contained in:
田岩
2025-10-31 14:09:07 +08:00
parent e6e4224848
commit 1a3a7d8ab1
4 changed files with 64 additions and 23 deletions
+2 -2
View File
@@ -3,8 +3,8 @@ ENV = 'development'
# 'development'
VITE_APP_BASE_API_Url = 'https://aits.jlbank.com.cn:7001'
# VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
# VITE_APP_BASE_API_Url = 'https://aits.jlbank.com.cn:7001'
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
# VITE_APP_BASE_API_Url = 'http://192.168.247.200'
# VITE_APP_BASE_API_Url = 'http://aitscdn.jlbank.com.cn:7001'
# VITE_APP_BASE_API_Url = 'http://192.168.108.129'
+41 -18
View File
@@ -16,13 +16,18 @@
<image class="img" src="@/static/images/pointsAndRank/badge-icon.png"></image>
<text class="text">
您已连续签到
<text class="number">27</text>
<text class="number">{{ continuousDay }}</text>
</text>
</view>
<scroll-view scroll-y="true" class="scroll-Y" :show-scrollbar="false">
<view class="calendar-div">
<view class="calendar-line" v-for="(line, lineIndex) in dateGroups">
<view class="calendar-div" :class="{expand:expand}">
<view
class="calendar-line"
v-for="(line, lineIndex) in dateGroups"
v-show="nowLine === lineIndex || expand"
>
<view
class="calendar-day"
v-for="(day, dayIndex) in line.days"
@@ -66,7 +71,7 @@
</template>
<script setup>
import { ref } from 'vue';
import { ref, computed } from 'vue';
import { optionErrorIcon, optionSuccessIcon } from '@/common/imgSvg';
const popup = ref(null);
@@ -75,17 +80,27 @@
borderRadius: '40rpx' //圆角
};
const dateGroups = ref([]);
const expand = ref(true); // 展开状态
const expand = ref(false); // 展开状态
const isSigned = ref(false); // 今日签到状态
const continuousDay = ref(6); // 连续签到
// 判断一下当前的签到显示在第几周
const nowLine = computed(() => {
// 计算当前需要显示图标的天数(已签到则是连续天数,未签到则是下一天)
const currentDay = isSigned.value ? continuousDay.value : continuousDay.value + 1;
// 按每周7天分行,行数从0开始(例如:1-7天 → 第0行,8-14天 → 第1行...
// 注意:如果天数从1开始(不是0),需要减1再计算
return Math.floor((currentDay - 1) / 7);
});
// 切换显示状态
const switchStatus = () => {
}
expand.value = !expand.value;
};
// 退出签到
const close = () => {
popup.value.close();
}
};
/**
* 生成35天日期列表(分5组,每组7天),包含类型标记和text字段
* 以"前X天"为第一天,第1天显示1,每7天显示5,第30天显示30
@@ -104,7 +119,6 @@
if (X < 0 || X > 35 || !Number.isInteger(X)) {
throw new Error('X必须是0到35之间的整数');
}
const allDays = [];
const today = new Date();
const todayDate = new Date(today.getFullYear(), today.getMonth(), today.getDate());
@@ -161,9 +175,12 @@
// 示例:X=10时,以"10天前"为第1天,生成35天列表
try {
const X = 10;
dateGroups.value = generateGroupedDateList(X);
const X = continuousDay.value - (isSigned.value ? 1 : 0);
// const X = 10;
console.log(`${continuousDay.value}`);
console.log(`${X}天前为第1天的35天分组日期:`);
dateGroups.value = generateGroupedDateList(X);
dateGroups.value.forEach((group) => {
console.log(`\n第${group.groupIndex + 1}组:`);
console.log(
@@ -180,7 +197,6 @@
}
const open = () => {
console.log('111111111');
popup.value.open();
};
defineExpose({ open, close });
@@ -189,6 +205,7 @@
<style scoped lang="scss">
// 日期
.calendar-day {
margin-top: 10rpx;
text-align: center;
// 隐藏展开时超过30天的样式
&.hide.expand {
@@ -200,6 +217,8 @@
display: none;
}
}
.calendar-day-bg {
width: 70rpx;
height: 84rpx;
@@ -211,7 +230,7 @@
position: relative;
font-family: Arial, Arial;
font-size: 32rpx;
letter-spacing: -4rpx;
.img {
width: 32rpx;
margin-bottom: 6rpx;
@@ -242,7 +261,7 @@
.check-in-tip {
display: none;
}
&.today > .check-in-tip {
&.today.no-signed > .check-in-tip {
display: block;
position: absolute;
top: 0;
@@ -268,7 +287,7 @@
}
}
.calendar-day-title {
margin: 8rpx 0;
margin: 4rpx 0;
font-family: ArialMT;
font-size: 22rpx;
color: #999999;
@@ -287,9 +306,8 @@
* 92rpx 下方按钮盒子高度
* 80rpx 切换盒子高度
*/
height: calc(100% - 26rpx - 68rpx - 128rpx - 16rpx - 92rpx - 80rpx - 8rpx );
height: calc(100% - 26rpx - 68rpx - 128rpx - 16rpx - 92rpx - 80rpx - 8rpx);
}
.switch-div {
display: flex;
justify-content: center;
@@ -324,9 +342,15 @@
.calendar-div {
display: flex;
flex-direction: column;
height: 130rpx;
transition: height 0.3s ease;
&.expand {
height: 650rpx;
}
.calendar-line {
display: flex;
justify-content: space-between;
height: 130rpx;
}
}
.button-div {
@@ -412,6 +436,5 @@
overflow: hidden;
margin-top: var(--status-bar-height);
margin-bottom: 120rpx;
}
</style>
+11 -1
View File
@@ -7,6 +7,9 @@
</view>
<view class="back_div" @click="exit_examination">
<image :src="practiceExitIcon()" class="img"></image>
<view class="text">
退出
</view>
</view>
</view>
<view class="countdown-and-question-number-div">
@@ -958,8 +961,9 @@
position: absolute;
right: $bg-margin-left;
top: 0;
width: 70rpx;
// width: 70rpx;
height: 70rpx;
// background-color: red;
display: flex;
align-items: center;
justify-content: flex-end;
@@ -968,6 +972,12 @@
width: 32rpx;
height: 32rpx;
}
.text{
color: #eaeaea;
font-size: 24rpx;
white-space: nowrap;
margin-left: 4rpx;
}
}
}
+10 -2
View File
@@ -7,6 +7,10 @@
</view>
<view class="back_div" @click="exit_practice">
<image :src="practiceExitIcon()" class="img"></image>
<view class="text">
退出
</view>
</view>
</view>
<view class="countdown-and-question-number-div">
@@ -735,16 +739,20 @@
position: absolute;
right: $bg-margin-left;
top: 0;
width: 70rpx;
height: 70rpx;
display: flex;
align-items: center;
justify-content: flex-end;
.img {
width: 32rpx;
height: 32rpx;
}
.text{
color: #eaeaea;
font-size: 24rpx;
white-space: nowrap;
margin-left: 4rpx;
}
}
}