- 子菜单重组为知识付费/余额充值/VIP会员/创作分成/推广返佣/收款接口/提现策略 - 收款接口页 1:1 复刻 Zibll 双下拉结构,仅保留支付宝/微信/PayPal/Stripe/易支付 - 订单前缀/流水号前缀/提现单号前缀配置保留并移入收款接口页 - 知识付费/推广返佣按参考主题全字段复刻,余额充值并入充值卡配置 - 新增 tabbed/between_number/page_select 表单控件及后端 pages 搜索源 - 清理旧 SPA 组件、无消费者 REST 端点与废弃配置键(不写双路兼容) - 更新存量契约测试至新 schema 文件
111 lines
3.2 KiB
JavaScript
111 lines
3.2 KiB
JavaScript
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
import { getAdminSections, getAllAdminPages } from '@/constants/admin-sections'
|
|
import { componentLoaders } from './component-loaders/index.js'
|
|
|
|
const ADMIN_DEFAULT_ROUTE = '/global/common'
|
|
|
|
function resolveComponent(page) {
|
|
if (componentLoaders[page.component]) {
|
|
return componentLoaders[page.component]
|
|
}
|
|
|
|
// Log missing component for debugging — avoids silent fallback to DeferredPage
|
|
if (page.component && page.component !== 'DeferredPage') {
|
|
console.warn(
|
|
`[AKSRT Route] Component "${page.component}" not found in componentLoaders for route "${page.route}". Falling back to DeferredPage.`
|
|
)
|
|
}
|
|
|
|
return componentLoaders.DeferredPage
|
|
}
|
|
|
|
function createRouteMeta(page) {
|
|
const meta = {
|
|
title: page.title,
|
|
section: page.sectionKey || '',
|
|
desc: page.desc || '',
|
|
status: page.status || 'available',
|
|
secondaryEntry: page.secondaryEntry === true,
|
|
}
|
|
|
|
if (page.compatSourceSection) {
|
|
meta.compatSourceSection = page.compatSourceSection
|
|
}
|
|
|
|
if (page.canonicalDomain) {
|
|
meta.canonicalDomain = page.canonicalDomain
|
|
}
|
|
|
|
if (page.section) {
|
|
meta.section = page.section
|
|
}
|
|
|
|
if (page.component === 'DeferredPage') {
|
|
meta.deferred = true
|
|
meta.deferredProps = {
|
|
title: page.title,
|
|
description: page.desc || '',
|
|
icon: page.iconClass || 'fa fas fa-compass',
|
|
phase: page.phase || '',
|
|
status: page.status || 'deferred',
|
|
dependsOn: page.dependsOn || [],
|
|
reason: page.reason || '',
|
|
features: page.features || [],
|
|
}
|
|
}
|
|
|
|
return meta
|
|
}
|
|
|
|
function createSectionRedirectRoutes() {
|
|
const seenPaths = new Set(['/'])
|
|
|
|
return getAdminSections()
|
|
.filter((section) => section.defaultRoute && section.route !== section.defaultRoute && !seenPaths.has(section.route))
|
|
.map((section) => {
|
|
seenPaths.add(section.route)
|
|
return {
|
|
path: section.route,
|
|
redirect: section.defaultRoute,
|
|
}
|
|
})
|
|
}
|
|
|
|
/**
|
|
* Old SPA ops routes → native WP admin pages.
|
|
* Bookmarks under order-related paths land on NativeOpsRedirect.
|
|
*/
|
|
const NATIVE_OPS_REDIRECTS = [
|
|
{ path: '/users/messages', title: '消息中心', nativeAdminPath: 'users.php?page=aksrt_messages' },
|
|
{ path: '/users/referral-codes', title: '推广码运营', nativeAdminPath: 'users.php?page=aksrt_referral_codes' },
|
|
{ path: '/users/ban', title: '禁封管理', nativeAdminPath: 'users.php?page=aksrt_user_ban&tab=restrictions' },
|
|
{ path: '/users/report', title: '禁封/举报', nativeAdminPath: 'users.php?page=aksrt_user_ban&tab=reports' },
|
|
]
|
|
|
|
const routes = [
|
|
{ path: '/', redirect: ADMIN_DEFAULT_ROUTE },
|
|
...createSectionRedirectRoutes(),
|
|
...getAllAdminPages().map((page) => ({
|
|
path: page.route,
|
|
name: page.name,
|
|
component: resolveComponent(page),
|
|
meta: createRouteMeta(page),
|
|
})),
|
|
...NATIVE_OPS_REDIRECTS.map((item) => ({
|
|
path: item.path,
|
|
name: `NativeRedirect_${item.path.replace(/\W+/g, '_')}`,
|
|
component: componentLoaders.NativeOpsRedirect,
|
|
meta: {
|
|
title: item.title,
|
|
nativeAdminPath: item.nativeAdminPath,
|
|
status: 'redirect',
|
|
},
|
|
})),
|
|
]
|
|
|
|
export default createRouter({
|
|
history: createWebHashHistory(),
|
|
routes,
|
|
})
|
|
|