fix: 修复兑换中心偶尔无法打开问题

This commit is contained in:
Gsh
2025-12-24 23:36:37 +08:00
parent 96a21210b5
commit 639c683144
3 changed files with 30 additions and 18 deletions

View File

@@ -398,9 +398,15 @@ function goToActivation() {
<!-- 激活码引导页 --> <!-- 激活码引导页 -->
<div v-if="activeTab === 'activation'" class="activation-guide-container"> <div v-if="activeTab === 'activation'" class="activation-guide-container">
<div class="activation-content"> <div class="activation-content">
<div class="guide-icon">🎁</div> <div class="guide-icon">
<h3 class="guide-title">激活码兑换</h3> 🎁
<p class="guide-desc">如果您持有意心AI的会员激活码或Token兑换码<br>请点击下方按钮前往控制台进行兑换</p> </div>
<h3 class="guide-title">
激活码兑换
</h3>
<p class="guide-desc">
如果您持有意心AI的会员激活码或Token兑换码<br>请点击下方按钮前往控制台进行兑换
</p>
<el-button <el-button
type="primary" type="primary"
size="large" size="large"

View File

@@ -86,7 +86,6 @@ const navItems = [
// { name: 'userInfo', label: '用户信息', icon: 'User' }, // { name: 'userInfo', label: '用户信息', icon: 'User' },
{ name: 'apiKey', label: 'API密钥', icon: 'Key' }, { name: 'apiKey', label: 'API密钥', icon: 'Key' },
{ name: 'rechargeLog', label: '充值记录', icon: 'Document' }, { name: 'rechargeLog', label: '充值记录', icon: 'Document' },
{ name: 'usageStatistics', label: '用量统计', icon: 'Histogram' }, { name: 'usageStatistics', label: '用量统计', icon: 'Histogram' },
{ name: 'premiumService', label: '尊享服务', icon: 'ColdDrink' }, { name: 'premiumService', label: '尊享服务', icon: 'ColdDrink' },
@@ -105,6 +104,10 @@ function handleConfirm(activeNav: string) {
// 导航切换 // 导航切换
function handleNavChange(nav: string) { function handleNavChange(nav: string) {
activeNav.value = nav; activeNav.value = nav;
// 同步更新 store 中的 tab 状态,防止下次通过 store 打开同一 tab 时因值未变而不触发 watch
if (userStore.userCenterActiveTab !== nav) {
userStore.userCenterActiveTab = nav;
}
} }
// 联系售后 // 联系售后
@@ -307,6 +310,9 @@ watch(() => guideTourStore.shouldStartUserCenterTour, (shouldStart) => {
// ============ 监听 Store 状态,控制用户中心弹窗 (新增) ============ // ============ 监听 Store 状态,控制用户中心弹窗 (新增) ============
watch(() => userStore.isUserCenterVisible, (val) => { watch(() => userStore.isUserCenterVisible, (val) => {
dialogVisible.value = val; dialogVisible.value = val;
if (val && userStore.userCenterActiveTab) {
activeNav.value = userStore.userCenterActiveTab;
}
}); });
watch(() => userStore.userCenterActiveTab, (val) => { watch(() => userStore.userCenterActiveTab, (val) => {

View File

@@ -52,8 +52,8 @@ export const useUserStore = defineStore(
// 新增:打开用户中心方法 // 新增:打开用户中心方法
const openUserCenter = (tab: string = 'user') => { const openUserCenter = (tab: string = 'user') => {
userCenterActiveTab.value = tab;
isUserCenterVisible.value = true; isUserCenterVisible.value = true;
userCenterActiveTab.value = tab;
}; };
// 新增:关闭用户中心方法 // 新增:关闭用户中心方法