支付
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user