From 7520cde13338edda61cb6bb790f60f2653e81b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E5=B2=A9?= Date: Mon, 1 Dec 2025 14:06:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B32=E4=B8=AAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- src/components/points-and-badge/check-in.vue | 39 +++++++++++--------- src/pages/competition/ranking.vue | 12 +++--- src/pages/competition/result.vue | 8 ++-- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/.env.development b/.env.development index 5cbaf81e..98646230 100644 --- a/.env.development +++ b/.env.development @@ -8,7 +8,7 @@ ENV = 'development' # VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' - VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' + # 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' diff --git a/src/components/points-and-badge/check-in.vue b/src/components/points-and-badge/check-in.vue index bf337eb5..d573a771 100644 --- a/src/components/points-and-badge/check-in.vue +++ b/src/components/points-and-badge/check-in.vue @@ -89,17 +89,23 @@ const expand = ref(false); // 展开状态 const isSigned = ref(false); // 今日签到状态 const continuousDay = ref(0); // 连续签到 - const continuousDay30 = computed(() => continuousDay.value % 30); // 连续签到取模30的天数 + const continuousDay30 = computed(() => { + // 连续签到取30的天数 + const mod = continuousDay.value % 30; + // 关键:取模为0时返回30(代表满30天),否则返回mod(1-29天) + return mod === 0 ? (continuousDay.value === 0 ? 0 : 30) : mod; + }); // 判断一下当前的签到显示在第几周 const nowLine = computed(() => { // 计算当前需要显示图标的天数(已签到则是连续天数,未签到则是下一天) const currentDay = isSigned.value ? continuousDay30.value : continuousDay30.value + 1; // 按每周7天分行,行数从0开始(例如:1-7天 → 第0行,8-14天 → 第1行...) // 注意:如果天数从1开始(不是0),需要减1再计算 - console.log('nowLine', Math.floor((currentDay - 1) / 7)); - return Math.floor((currentDay - 1) / 7); + const line = Math.floor((currentDay - 1) / 7); + console.log('nowLine', Math.max(line, 0)); // 避免输出 -1 + return Math.max(line, 0); // 核心修复:-1 会被转为 0 }); - + const emits = defineEmits(['checkInFun']); // 切换显示状态 const switchStatus = () => { @@ -108,9 +114,10 @@ // 退出签到 const close = () => { popup.value.close(); - typeof checkInClickCallback === 'function' && checkInClickCallback({ - status:false - }) + typeof checkInClickCallback === 'function' && + checkInClickCallback({ + status: false + }); }; const checkInLoading = ref(false); // 签到 @@ -119,7 +126,7 @@ checkInLoading.value = true; // 函数执行成功的回调 checkInClickCallback({ - status:true, + status: true, days: continuousDay.value, successCb: ({ days, res }) => { console.log('签到成功', res); @@ -176,7 +183,7 @@ // 计算当前是第几天(以"前X天"为第1天) const dayNumber = i - -X + 1; // 核心计算:转换为从1开始的序列 - + // 计算text字段 let text = '1'; // 默认显示1 if (dayNumber === 30) { @@ -207,23 +214,20 @@ return groupedList; } - + const open = (isSignedStatus, days, onCheckInClick = () => {}, onCheckInSuccess = () => {}) => { isSigned.value = isSignedStatus; // 今日签到状态 continuousDay.value = days; // 连续签到 // isSigned.value = false; // 今日签到状态 - // continuousDay.value = 1; // 连续签到 + // continuousDay.value = 30; // 连续签到 checkInClickCallback = onCheckInClick; checkInSuccessCallback = onCheckInSuccess; // 示例:X=10时,以"10天前"为第1天,生成35天列表 try { - const X = continuousDay30.value - (isSigned.value ? 1 : 0); - // const X = 10; - // console.log(`以${continuousDay.value}天`); - // console.log(`以${X}天前为第1天的35天分组日期:`); - // console.log('取', X); + const subtractNum = isSigned.value ? 1 : 0; + const X = Math.max(continuousDay30.value - subtractNum, 0); + console.log('取', X); dateGroups.value = generateGroupedDateList(X); - } catch (err) { console.error(err.message); } @@ -239,7 +243,6 @@ text-align: center; // 隐藏展开时超过30天的样式 &.hide.expand { - .calendar-day-title { width: 70rpx; color: #fff; diff --git a/src/pages/competition/ranking.vue b/src/pages/competition/ranking.vue index 67a00174..64199eb0 100644 --- a/src/pages/competition/ranking.vue +++ b/src/pages/competition/ranking.vue @@ -56,7 +56,7 @@ - 我的排名 + 我的排名 @@ -227,7 +227,6 @@ overflow: hidden; display: flex; - &.list-header { height: 54rpx; line-height: 54rpx; @@ -315,7 +314,7 @@ } .rank-column { - width: 130rpx; + width: 140rpx; padding-left: 40rpx; float: left; font-weight: 600; @@ -326,10 +325,13 @@ font-style: italic; text-indent: 8rpx; } - + .my_pai{ + padding-top: 10rpx; + padding-left: 26rpx; + } .user-column { // background-color: red; - // width: 330rpx; + max-width: 370rpx; flex: 1; float: left; padding: 15rpx 0; diff --git a/src/pages/competition/result.vue b/src/pages/competition/result.vue index 095085f0..641cb5fb 100644 --- a/src/pages/competition/result.vue +++ b/src/pages/competition/result.vue @@ -179,6 +179,10 @@ setTimeout(() => { queryCompetitionAnswerResult({ execId: pkData.execId, autoSub:autoSub.value }).then(({ body }) => { + if (mode.value === 'pk_in') { + console.log('调用它'); + pointAndBadgesRun('11'); + } // 计算需要额外延时的时间 const currentTime = Math.floor(Date.now() / 1000); // 2. 计算对手的答题结束时间(秒) @@ -211,10 +215,6 @@ nextTick(() => { action.value = 'result'; }); - if (mode.value === 'pk_in') { - console.log('调用它'); - pointAndBadgesRun('11'); - } }, delayTime * 1000); }); }, mode.value === 'pk_result'?0:1000);