fix: 前端页面架构重构优化

This commit is contained in:
Gsh
2026-01-02 22:47:09 +08:00
parent ba95d1798f
commit d25ca6dc4a
18 changed files with 227 additions and 541 deletions

View File

@@ -3,7 +3,6 @@ import type { GoodsItem } from '@/api/pay';
import { CircleCheck, Loading } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { useRouter } from 'vue-router';
import { createOrder, getOrderStatus } from '@/api';
import { getGoodsList, GoodsCategoryType } from '@/api/pay';
import SupportModelList from '@/components/userPersonalCenter/components/SupportModelList.vue';
@@ -305,8 +304,6 @@ async function checkPaymentStatus(outTradeNo: string) {
}
}
const router = useRouter();
function toggleDetails() {
showDetails.value = !showDetails.value;
}
@@ -322,7 +319,8 @@ function onClose() {
function goToActivation() {
close();
userStore.openUserCenter('activationCode');
// 使用 window.location 进行跳转,避免 router 注入问题
window.location.href = '/console/activation';
}
</script>

View File

@@ -1,8 +1,8 @@
<script lang="ts" setup>
import { ref, onMounted, computed } from 'vue';
import type { DailyTaskItem, DailyTaskStatusOutput } from '@/api/dailyTask/types';
import { ElMessage } from 'element-plus';
import { getTodayTaskStatus, claimTaskReward } from '@/api/dailyTask';
import type { DailyTaskStatusOutput, DailyTaskItem } from '@/api/dailyTask/types';
import { onMounted, ref } from 'vue';
import { claimTaskReward, getTodayTaskStatus } from '@/api/dailyTask';
const taskData = ref<DailyTaskStatusOutput | null>(null);
const loading = ref(false);
@@ -17,15 +17,18 @@ async function fetchTaskStatus() {
try {
const res = await getTodayTaskStatus();
taskData.value = res.data;
} catch (error: any) {
}
catch (error: any) {
ElMessage.error(error?.message || '获取任务状态失败');
} finally {
}
finally {
loading.value = false;
}
}
async function handleClaim(task: DailyTaskItem) {
if (task.status !== 1) return;
if (task.status !== 1)
return;
claiming.value[task.level] = true;
try {
@@ -34,9 +37,11 @@ async function handleClaim(task: DailyTaskItem) {
// 刷新任务状态
await fetchTaskStatus();
} catch (error: any) {
}
catch (error: any) {
ElMessage.error(error?.message || '领取奖励失败');
} finally {
}
finally {
claiming.value[task.level] = false;
}
}
@@ -76,8 +81,10 @@ function getButtonClass(task: DailyTaskItem): string {
// 获取进度条颜色
function getProgressColor(task: DailyTaskItem): string {
if (task.status === 2) return '#FFD700'; // 已完成:金色
if (task.status === 1) return '#67C23A'; // 可领取:绿
if (task.status === 2)
return '#FFD700'; // 已完成:金
if (task.status === 1)
return '#67C23A'; // 可领取:绿色
return '#409EFF'; // 进行中:蓝色
}
</script>
@@ -86,15 +93,21 @@ function getProgressColor(task: DailyTaskItem): string {
<div v-loading="loading" class="daily-task-container">
<div class="task-header">
<h2>每日任务</h2>
<p class="task-desc">完成每日任务领取额外尊享包 Token 奖励可累加重复</p>
<p class="task-desc">
完成每日任务领取额外尊享包 Token 奖励可累加重复
</p>
</div>
<div v-if="taskData" class="task-content">
<!-- 今日消耗统计 -->
<div class="consumption-card">
<div class="consumption-icon">🔥</div>
<div class="consumption-icon">
🔥
</div>
<div class="consumption-info">
<div class="consumption-label">今日尊享包消耗</div>
<div class="consumption-label">
今日尊享包消耗
</div>
<div class="consumption-value">
{{ formatTokenDisplay(taskData.todayConsumedTokens) }} Tokens
</div>
@@ -109,7 +122,7 @@ function getProgressColor(task: DailyTaskItem): string {
class="task-item"
:class="{
'task-completed': task.status === 2,
'task-claimable': task.status === 1
'task-claimable': task.status === 1,
}"
>
<div class="task-icon">
@@ -187,7 +200,6 @@ function getProgressColor(task: DailyTaskItem): string {
<style scoped>
.daily-task-container {
padding: 20px;
min-height: 400px;
height: 100%;
overflow-y: auto;

View File

@@ -83,10 +83,9 @@ onMounted(() => {
<style scoped lang="scss">
.premium-service {
padding: 24px;
height: 100%;
overflow-y: auto;
background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
//background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
// 美化滚动条
&::-webkit-scrollbar {
@@ -127,7 +126,6 @@ onMounted(() => {
/* 响应式布局 */
@media (max-width: 768px) {
.premium-service {
padding: 12px;
}
.usage-list-wrapper {

View File

@@ -599,18 +599,12 @@ onBeforeUnmount(() => {
<style scoped>
.usage-statistics {
padding: 20px;
position: relative;
background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
border-radius: 16px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
transition: all 0.3s ease;
height: 100%;
overflow-y: auto;
}
.usage-statistics:hover {
box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12);
}
.usage-statistics.fullscreen-mode {
@@ -620,7 +614,6 @@ onBeforeUnmount(() => {
right: 0;
bottom: 0;
z-index: 2000;
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
padding: 30px;
overflow-y: auto;
border-radius: 0;
@@ -632,7 +625,6 @@ onBeforeUnmount(() => {
align-items: center;
margin-bottom: 30px;
padding-bottom: 20px;
border-bottom: 2px solid #e9ecef;
}
.header-actions {
@@ -656,7 +648,6 @@ onBeforeUnmount(() => {
.option-label {
text-decoration: line-through;
color: #909399;
}
}
}
@@ -671,7 +662,6 @@ onBeforeUnmount(() => {
}
&.disabled-icon {
color: #c0c4cc;
}
}
@@ -710,14 +700,10 @@ onBeforeUnmount(() => {
.chart-card {
margin-bottom: 30px;
border-radius: 16px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
overflow: hidden;
background: white;
}
.chart-card:hover {
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
transform: translateY(-4px);
}

View File

@@ -303,7 +303,6 @@ function bindWechat() {
<style scoped>
.user-profile {
padding: 20px;
height: 100%;
overflow-y: auto;
}