This commit is contained in:
2025-09-03 09:13:29 +08:00
parent 8d50c6dadf
commit acaed047ce
6 changed files with 550 additions and 31 deletions

View File

@@ -131,6 +131,15 @@ const routes = [
hideForAuth: true
}
},
{
path: '/payment',
name: 'Payment',
component: () => import('@/views/Payment.vue'),
meta: {
title: '支付激活',
requiresAuth: true
}
},
{
path: '/profile',
name: 'Profile',
@@ -357,6 +366,18 @@ router.beforeEach(async (to, from, next) => {
return
}
}
// 检查支付状态(管理员除外)
if (userStore.user && userStore.user.role !== 'admin' && userStore.user.payment_status === 'unpaid') {
// 如果当前不在支付页面,静默重定向到支付页面(不显示额外通知)
if (to.name !== 'Payment') {
next({
name: 'Payment',
query: { redirect: to.fullPath }
})
return
}
}
}
}