refactor: 项目架构重构 - 目录标准化 + 清理冗余

- 目录重命名: backend/wdkj-server/ → server/, frontend/ai-dimension/ → client/
- 删除 20+ 冗余文件(WDKJ 旧脚本、Windows 脚本、过时文档、设计稿)
- 更新 package.json 元数据(移除 wdkj 命名)
- 完善三级 .gitignore(根 + server + client)
- 重写 README.md 和 CHANGELOG.md
- 工具脚本移至 scripts/
This commit is contained in:
Yuzhiran Dev
2026-07-11 12:45:37 +08:00
parent 66ac576082
commit c1d6dd3b29
106 changed files with 17436 additions and 2311 deletions
+514
View File
@@ -0,0 +1,514 @@
<template>
<view class="page-profile">
<view class="status-bar-placeholder"></view>
<!-- 用户信息 -->
<view class="profile-card">
<view class="profile-avatar">
<image
v-if="userStore.userInfo?.avatarUrl"
:src="userStore.userInfo.avatarUrl"
class="avatar-img"
mode="aspectFill"
/>
<text v-else class="avatar-text">
{{ (userStore.userInfo?.nickName || '用').charAt(0) }}
</text>
</view>
<text class="profile-name">{{ userStore.userInfo?.nickName || '游客' }}</text>
<text class="profile-level">
{{ subscriptionBadge }} · 已收藏 {{ collectedCount }} 篇
</text>
</view>
<!-- 订阅卡片 -->
<view class="plan-card" @click="goPayment">
<view class="plan-info">
<text class="plan-title">{{ planTitle }}</text>
<text class="plan-desc">{{ planDesc }}</text>
<!-- 进度条(订阅到期倒计时) -->
<view class="plan-progress" v-if="userStore.subInfo">
<view class="progress-track">
<view class="progress-fill" :style="{ width: planPercent + '%' }"></view>
</view>
<text class="progress-text">
{{ planExpiryText }}
</text>
</view>
</view>
<view class="plan-btn" :class="{ disabled: userStore.isSubscribed }">
<text>{{ planBtnText }}</text>
</view>
</view>
<!-- AI 问答配额 -->
<view class="quota-card" @click="goChat" v-if="userStore.isLoggedIn">
<text class="quota-card-title">🤖 AI 问答配额</text>
<view class="quota-bar">
<view class="quota-fill" :style="{ width: quotaPercent + '%' }"></view>
</view>
<text class="quota-text">
{{ quotaUsed }} / {{ quotaTotal }}
<text class="quota-note">今日使用</text>
</text>
<text class="quota-share" @click.stop="goShare">🎁 分享得次数</text>
</view>
<!-- 菜单列表 -->
<view class="menu-section">
<view class="menu-item" @click="goFavorites">
<view class="m-icon" style="background:rgba(179,136,255,0.1);color:#b388ff">⭐</view>
<text class="m-label">我的收藏</text>
<text class="m-badge">{{ collectedCount }}</text>
<text class="m-arrow">→</text>
</view>
<view class="menu-item" @click="goProgress">
<view class="m-icon" style="background:rgba(77,208,225,0.1);color:#4dd0e1">📊</view>
<text class="m-label">学习进度</text>
<text class="m-arrow">→</text>
</view>
<view class="menu-item" @click="goAchievements">
<view class="m-icon" style="background:rgba(77,182,172,0.1);color:#4db6ac">🏆</view>
<text class="m-label">成就</text>
<text class="m-arrow">→</text>
</view>
<view class="menu-item" @click="goLeaderboard">
<view class="m-icon" style="background:rgba(255,167,38,0.1);color:#ffa726">🥇</view>
<text class="m-label">排行榜</text>
<text class="m-arrow">→</text>
</view>
<view class="menu-item" @click="goFeedback">
<view class="m-icon" style="background:rgba(102,187,106,0.1);color:#66bb6a">💬</view>
<text class="m-label">意见反馈</text>
<text class="m-arrow">→</text>
</view>
<view class="menu-item" @click="goAbout">
<view class="m-icon" style="background:rgba(255,213,79,0.1);color:#ffd54f">ℹ️</view>
<text class="m-label">关于 AI 维度</text>
<text class="m-arrow">→</text>
</view>
<view class="menu-item" @click="goSettings">
<view class="m-icon" style="background:rgba(239,83,80,0.1);color:#ef5350">⚙️</view>
<text class="m-label">设置</text>
<text class="m-arrow">→</text>
</view>
</view>
<!-- 登录/退出 -->
<view class="action-btn" v-if="!userStore.isLoggedIn" @click="goLogin">
<text>微信一键登录</text>
</view>
<view class="action-btn logout" v-else @click="handleLogout">
<text>退出登录</text>
</view>
<text class="version">宇之然 AI 维度 v1.0.0</text>
</view>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue'
import { useUserStore } from '@/stores/user'
import { knowledgeApi, aiChatApi } from '@/utils/api'
const userStore = useUserStore()
// 已收藏数量
const collectedCount = ref(0)
onMounted(() => {
if (userStore.isLoggedIn) {
loadUserInfo()
loadCollected()
}
})
async function loadUserInfo() {
await userStore.fetchMe()
if (userStore.token) {
await userStore.fetchQuota(userStore.token)
}
}
async function loadCollected() {
if (!userStore.token) return
try {
const list = await knowledgeApi.collected(userStore.token)
collectedCount.value = list.length
} catch (e) {
collectedCount.value = 0
}
}
// 订阅信息
const planTitle = computed(() => {
if (userStore.isSubscribed) {
return `✦ ${userStore.subscriptionLevel.toUpperCase()} 会员`
}
return '✦ 免费版'
})
const planDesc = computed(() => {
if (userStore.isSubscribed) {
return '全量知识解锁 · AI 问答无限次'
}
return '每日 5 次免费 AI 问答 · 升级解锁全部知识'
})
const planBtnText = computed(() => {
if (userStore.isLoggedIn && userStore.isSubscribed) return '已订阅'
if (userStore.isLoggedIn) return '升级 Pro'
return '登录后升级'
})
const planExpiryText = computed(() => {
if (!userStore.subInfo?.expiresAt) return ''
const expires = new Date(userStore.subInfo.expiresAt)
const now = new Date()
const diffDays = Math.ceil((expires - now) / (1000 * 60 * 60 * 24))
if (diffDays <= 0) return '已过期'
return `${diffDays} 天后到期`
})
const planPercent = computed(() => {
if (!userStore.subInfo?.expiresAt || !userStore.subInfo?.startDate) return 0
const start = new Date(userStore.subInfo.startDate).getTime()
const expires = new Date(userStore.subInfo.expiresAt).getTime()
const now = Date.now()
const total = expires - start
const elapsed = now - start
return Math.min(100, Math.max(0, (elapsed / total) * 100))
})
// 配额
const quotaPercent = computed(() => {
const q = userStore.quota
if (!q) return 0
const remaining = q.remainingQuota || 0
const used = q.usedQuota || q.dailyUsed || 0
const total = q.freeQuota || remaining + used
return total > 0 ? Math.round((used / total) * 100) : 0
})
const quotaUsed = computed(() => userStore.quota?.dailyUsed || userStore.quota?.usedQuota || 0)
const quotaTotal = computed(() => {
const q = userStore.quota
return (q?.freeQuota || 5) + (q?.sharedQuota || 0)
})
const subscriptionBadge = computed(() => {
if (userStore.isSubscribed) {
return userStore.subscriptionLevel.toUpperCase()
}
return '免费用户'
})
function goLogin() {
uni.navigateTo({ url: '/pages/login/login' })
}
function handleLogout() {
uni.showModal({
title: '退出登录',
content: '确定退出当前账号吗?',
success: (res) => {
if (res.confirm) {
userStore.logout()
collectedCount.value = 0
uni.showToast({ title: '已退出', icon: 'success' })
}
}
})
}
function goPayment() {
if (!userStore.isLoggedIn) {
goLogin()
return
}
if (userStore.isSubscribed) return
uni.navigateTo({ url: '/pages/payment/payment' })
}
function goChat() {
uni.switchTab({ url: '/pages/chat/chat' })
}
function goShare() {
aiChatApi.shareGain(userStore.token).then(() => {
uni.showToast({ title: '已记录分享', icon: 'success' })
if (userStore.token) userStore.fetchQuota(userStore.token)
}).catch(() => {
uni.showToast({ title: '已记录分享', icon: 'success' })
})
}
function goFavorites() {
uni.navigateTo({ url: '/pages/favorites/favorites' })
}
function goProgress() {
uni.navigateTo({ url: '/pages/progress/progress' })
}
function goAchievements() {
uni.navigateTo({ url: '/pages/achievements/achievements' })
}
function goLeaderboard() {
uni.navigateTo({ url: '/pages/leaderboard/leaderboard' })
}
function goFeedback() {
uni.navigateTo({ url: '/pages/feedback/feedback' })
}
function goAbout() {
uni.showModal({
title: '关于',
content: '宇之然 AI 维度\n从 5 个维度系统理解人工智能\n© 2026 宇之然',
showCancel: false
})
}
function goSettings() {
uni.navigateTo({ url: '/pages/settings/settings' })
}
</script>
<style lang="scss" scoped>
.page-profile {
min-height: 100vh;
padding: 0 20px 40px;
background: var(--bg-primary);
}
.status-bar-placeholder { height: 44px; }
// 用户卡片
.profile-card {
text-align: center;
padding: 20px 0 24px;
}
.profile-avatar {
width: 72px;
height: 72px;
border-radius: 50%;
background: linear-gradient(135deg, rgba(124, 77, 255, 0.3), rgba(0, 188, 212, 0.15));
border: 2px solid rgba(124, 77, 255, 0.2);
margin: 0 auto 14px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 0 40px rgba(124, 77, 255, 0.1);
overflow: hidden;
}
.avatar-img {
width: 100%;
height: 100%;
}
.avatar-text {
font-size: 28px;
font-weight: 600;
color: white;
}
.profile-name {
font-size: 18px;
color: var(--text-primary);
font-weight: 600;
display: block;
}
.profile-level {
font-size: 12px;
color: var(--text-tertiary);
margin-top: 4px;
display: block;
}
// 订阅卡片
.plan-card {
border-radius: 18px;
padding: 20px;
margin-bottom: 16px;
display: flex;
justify-content: space-between;
align-items: center;
background: linear-gradient(135deg, rgba(124, 77, 255, 0.08), rgba(0, 0, 0, 0.2));
border: 1px solid rgba(124, 77, 255, 0.12);
position: relative;
overflow: hidden;
}
.plan-info { flex: 1; }
.plan-title {
font-size: 16px;
color: var(--text-primary);
font-weight: 600;
display: block;
}
.plan-desc {
font-size: 12px;
color: var(--text-tertiary);
margin-top: 4px;
display: block;
}
.plan-progress {
margin-top: 10px;
}
.progress-track {
height: 3px;
background: rgba(255, 255, 255, 0.06);
border-radius: 2px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, var(--dim1-color), var(--dim3-color));
border-radius: 2px;
}
.progress-text {
font-size: 10px;
color: var(--text-muted);
margin-top: 6px;
display: block;
}
.plan-btn {
background: linear-gradient(135deg, #7c4dff, #b388ff);
padding: 10px 22px;
border-radius: 20px;
color: white;
font-size: 13px;
font-weight: 500;
box-shadow: 0 0 20px rgba(124, 77, 255, 0.2);
}
.plan-btn.disabled {
background: rgba(255, 255, 255, 0.1);
box-shadow: none;
}
// 配额卡片
.quota-card {
border-radius: 16px;
padding: 16px;
margin-bottom: 20px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.06);
}
.quota-card-title {
font-size: 13px;
color: var(--text-secondary);
display: block;
margin-bottom: 10px;
}
.quota-bar {
height: 4px;
background: rgba(255, 255, 255, 0.06);
border-radius: 2px;
overflow: hidden;
margin-bottom: 8px;
}
.quota-fill {
height: 100%;
background: linear-gradient(90deg, #4dd0e1, #b388ff);
border-radius: 2px;
}
.quota-text {
font-size: 11px;
color: var(--text-tertiary);
display: flex;
justify-content: space-between;
align-items: center;
}
.quota-note {
color: var(--text-muted);
}
.quota-share {
font-size: 11px;
color: var(--dim1-color);
margin-top: 4px;
display: block;
}
// 菜单
.menu-section {
border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.menu-item {
display: flex;
align-items: center;
gap: 14px;
padding: 14px 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.m-icon {
width: 34px;
height: 34px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
flex-shrink: 0;
}
.m-label {
flex: 1;
font-size: 14px;
color: var(--text-secondary);
}
.m-arrow {
font-size: 14px;
color: var(--text-muted);
}
.m-badge {
font-size: 10px;
padding: 2px 10px;
border-radius: 10px;
background: rgba(179, 136, 255, 0.12);
color: var(--dim1-color);
}
// 按钮
.action-btn {
text-align: center;
padding: 16px 0;
margin-top: 20px;
font-size: 14px;
color: var(--dim1-color);
border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.action-btn.logout {
color: var(--text-muted);
}
.version {
text-align: center;
font-size: 11px;
color: rgba(255, 255, 255, 0.1);
margin-top: 12px;
}
</style>