feat(platform-ops): 增加平台运营统计总览页面
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
|
||||
import { adminPath, ADMIN_DASHBOARD_PATH } from '@/shared/utils/adminPath'
|
||||
import { adminPath, ADMIN_DASHBOARD_PATH, PLATFORM_OPS_PATH } from '@/shared/utils/adminPath'
|
||||
|
||||
const adminMeta = { layout: 'admin', requiresAdmin: true }
|
||||
|
||||
@@ -18,6 +18,12 @@ export const adminRoutes: RouteRecordRaw[] = [
|
||||
component: () => import('@/features/admin/views/AdminDashboardView.vue'),
|
||||
meta: adminMeta,
|
||||
},
|
||||
{
|
||||
path: PLATFORM_OPS_PATH,
|
||||
name: 'platform-ops-overview',
|
||||
component: () => import('@/features/admin/views/AdminPlatformOverviewView.vue'),
|
||||
meta: { ...adminMeta, platformOps: true },
|
||||
},
|
||||
{
|
||||
path: adminPath('users'),
|
||||
name: 'admin-users',
|
||||
|
||||
@@ -3,7 +3,8 @@ import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { useAdminSessionStore } from '@/stores/adminSession'
|
||||
import { useSessionStore } from '@/stores/session'
|
||||
import { getAccessToken, getLoginPath } from '@/shared/utils/authStorage'
|
||||
import { ADMIN_DASHBOARD_PATH, ADMIN_LOGIN_PATH } from '@/shared/utils/adminPath'
|
||||
import { ADMIN_DASHBOARD_PATH, ADMIN_LOGIN_PATH, PLATFORM_OPS_PATH } from '@/shared/utils/adminPath'
|
||||
import { isPlatformOpsHostname } from '@/stores/distributionSite'
|
||||
import { accountRoutes } from './accountRoutes'
|
||||
import { adminRoutes } from './adminRoutes'
|
||||
import { isMobileHost, isMobileDevice, getMobilePath, getPcPath } from './mobileHost'
|
||||
@@ -28,11 +29,12 @@ const router = createRouter({
|
||||
})
|
||||
|
||||
router.beforeEach(async to => {
|
||||
const platformOps = isPlatformOpsHostname()
|
||||
if (to.query.track_code) {
|
||||
saveTrackCode(String(to.query.track_code))
|
||||
}
|
||||
|
||||
const isMobile = isMobileHost() || isMobileDevice()
|
||||
const isMobile = !platformOps && (isMobileHost() || isMobileDevice())
|
||||
|
||||
if (isMobile) {
|
||||
const targetPath = getMobilePath(to.path)
|
||||
@@ -97,12 +99,18 @@ router.beforeEach(async to => {
|
||||
if (!adminSession.hasSessionHint) return true
|
||||
try {
|
||||
await adminSession.loadMe()
|
||||
return ADMIN_DASHBOARD_PATH
|
||||
return platformOps ? PLATFORM_OPS_PATH : ADMIN_DASHBOARD_PATH
|
||||
} catch {
|
||||
adminSession.logout()
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (platformOps && to.meta.requiresAdmin && to.path !== PLATFORM_OPS_PATH) {
|
||||
return PLATFORM_OPS_PATH
|
||||
}
|
||||
if (!platformOps && to.path === PLATFORM_OPS_PATH) {
|
||||
return ADMIN_DASHBOARD_PATH
|
||||
}
|
||||
if (to.meta.requiresAdmin) {
|
||||
try {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user