新增 IDE 官网静态资源与 D3 分区域地图布局,构建时复制至 dist/site;同步应收应付、代发打包、订单详情等页面优化。 Co-authored-by: Cursor <cursoragent@cursor.com>
281 lines
7.5 KiB
TypeScript
281 lines
7.5 KiB
TypeScript
import { createRouter, createWebHistory } from 'vue-router';
|
||
import NProgress from 'nprogress'; // progress bar
|
||
import 'nprogress/nprogress.css';
|
||
|
||
import { appRoutes } from './routes';
|
||
import { REDIRECT_MAIN, NOT_FOUND_ROUTE } from './routes/base';
|
||
import createRouteGuard from './guard';
|
||
|
||
NProgress.configure({
|
||
showSpinner: false,
|
||
speed: 280,
|
||
minimum: 0.12,
|
||
trickleSpeed: 160,
|
||
}); // NProgress Configuration
|
||
|
||
const router = createRouter({
|
||
history: createWebHistory(),
|
||
routes: [
|
||
{
|
||
path: '/',
|
||
name: 'siteRoot',
|
||
redirect: '/login',
|
||
},
|
||
{
|
||
path: '/login',
|
||
name: 'login',
|
||
component: () => import('@/views/login/index.vue'),
|
||
meta: {
|
||
requiresAuth: false,
|
||
loginPortal: 'customer',
|
||
},
|
||
},
|
||
{
|
||
path: '/admin',
|
||
name: 'adminLogin',
|
||
component: () => import('@/views/login/index.vue'),
|
||
meta: {
|
||
requiresAuth: false,
|
||
loginPortal: 'admin',
|
||
},
|
||
},
|
||
{
|
||
path: '/track/query',
|
||
name: 'H5TrackQuery',
|
||
component: () => import('@/views/h5/track-query/index.vue'),
|
||
meta: {
|
||
requiresAuth: false,
|
||
hideInMenu: true,
|
||
},
|
||
},
|
||
// 登录独立壳:不挂 customer-center layout,避免同步拉下单树导致首屏慢/闪乱
|
||
{
|
||
path: '/h5/login',
|
||
name: 'H5Login',
|
||
component: () => import('@/views/h5/customer-center/login/index.vue'),
|
||
meta: {
|
||
requiresAuth: false,
|
||
hideInMenu: true,
|
||
customerPortalOnly: true,
|
||
locale: 'h5.login.title',
|
||
},
|
||
},
|
||
{
|
||
path: '/h5',
|
||
name: 'H5CustomerCenter',
|
||
component: () => import('@/views/h5/customer-center/layout.vue'),
|
||
meta: {
|
||
requiresAuth: false,
|
||
hideInMenu: true,
|
||
customerPortalOnly: true,
|
||
},
|
||
children: [
|
||
{
|
||
path: '',
|
||
name: 'H5CustomerCenterIndex',
|
||
redirect: () => {
|
||
const token =
|
||
localStorage.getItem('rbac_access_token') ||
|
||
localStorage.getItem('token');
|
||
return token ? '/h5/orders' : '/h5/login';
|
||
},
|
||
},
|
||
{
|
||
path: 'assistant',
|
||
name: 'H5Assistant',
|
||
component: () => import('@/views/h5/customer-center/assistant/index.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
locale: 'h5.tab.assistant',
|
||
h5HideHeader: true,
|
||
},
|
||
},
|
||
{
|
||
path: 'price',
|
||
name: 'H5Price',
|
||
component: () => import('@/views/h5/customer-center/price/index.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
locale: 'h5.tab.price',
|
||
h5HideHeader: true,
|
||
},
|
||
},
|
||
{
|
||
path: 'orders',
|
||
name: 'H5Orders',
|
||
component: () => import('@/views/h5/customer-center/orders/index.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
locale: 'h5.tab.orders',
|
||
h5HideHeader: true,
|
||
},
|
||
},
|
||
{
|
||
path: 'orders/:id',
|
||
name: 'H5OrderDetail',
|
||
component: () => import('@/views/h5/customer-center/orders/detail.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
locale: 'h5.orders.detail.title',
|
||
h5HideTabBar: true,
|
||
h5HideHeader: true,
|
||
},
|
||
},
|
||
{
|
||
path: 'me',
|
||
name: 'H5Me',
|
||
component: () => import('@/views/h5/customer-center/me/index.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
locale: 'h5.tab.me',
|
||
h5HideHeader: true,
|
||
},
|
||
},
|
||
{
|
||
path: 'storeOrders',
|
||
name: 'H5StoreOrders',
|
||
component: () => import('@/views/h5/customer-center/store-orders/index.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
locale: 'h5.storeOrders.title',
|
||
h5HideTabBar: true,
|
||
h5HideHeader: true,
|
||
},
|
||
},
|
||
{
|
||
path: 'storeOrders/:id',
|
||
name: 'H5StoreOrderDetail',
|
||
component: () => import('@/views/h5/customer-center/store-orders/detail.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
locale: 'h5.storeOrders.detail.title',
|
||
h5HideTabBar: true,
|
||
h5HideHeader: true,
|
||
},
|
||
},
|
||
{
|
||
path: 'recharge',
|
||
name: 'H5Recharge',
|
||
component: () => import('@/views/h5/customer-center/recharge/index.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
locale: 'h5.recharge.title',
|
||
h5HideTabBar: true,
|
||
h5HideHeader: true,
|
||
},
|
||
},
|
||
{
|
||
path: 'place-order',
|
||
name: 'H5PlaceOrder',
|
||
component: () => import('@/views/h5/customer-center/place-order/index.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
locale: 'h5.placeOrder.title',
|
||
h5HideTabBar: true,
|
||
h5HideHeader: true,
|
||
},
|
||
},
|
||
{
|
||
path: 'coupons',
|
||
name: 'H5Coupons',
|
||
component: () => import('@/views/h5/customer-center/coupons/index.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
locale: 'h5.coupons.title',
|
||
h5HideTabBar: true,
|
||
h5HideHeader: true,
|
||
},
|
||
},
|
||
{
|
||
path: 'invite',
|
||
name: 'H5Invite',
|
||
component: () => import('@/views/h5/customer-center/invite/index.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
locale: 'h5.invite.title',
|
||
h5HideTabBar: true,
|
||
h5HideHeader: true,
|
||
},
|
||
},
|
||
{
|
||
path: 'commission',
|
||
name: 'H5Commission',
|
||
component: () => import('@/views/h5/customer-center/commission/index.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
locale: 'h5.commission.title',
|
||
h5HideTabBar: true,
|
||
h5HideHeader: true,
|
||
},
|
||
},
|
||
// 未知 /h5/* 回落客户中心,避免空白页
|
||
{
|
||
path: ':pathMatch(.*)*',
|
||
name: 'H5CustomerCenterFallback',
|
||
redirect: () => {
|
||
const token =
|
||
localStorage.getItem('rbac_access_token') ||
|
||
localStorage.getItem('token');
|
||
return token ? '/h5/orders' : '/h5/login';
|
||
},
|
||
},
|
||
],
|
||
},
|
||
{
|
||
path: '/wechat/register',
|
||
name: 'WechatRegister',
|
||
component: () => import('@/views/wechat/register/index.vue'),
|
||
meta: {
|
||
requiresAuth: false,
|
||
hideInMenu: true,
|
||
},
|
||
},
|
||
{
|
||
path: '/register',
|
||
name: 'CustomerRegister',
|
||
component: () => import('@/views/register/index.vue'),
|
||
meta: {
|
||
requiresAuth: false,
|
||
hideInMenu: true,
|
||
},
|
||
},
|
||
{
|
||
path: '/wechat/bind',
|
||
name: 'WechatBind',
|
||
component: () => import('@/views/wechat/bind/index.vue'),
|
||
meta: {
|
||
requiresAuth: false,
|
||
hideInMenu: true,
|
||
},
|
||
},
|
||
{
|
||
path: '/oauth/platform-store/:platform',
|
||
name: 'PlatformStoreOAuthCallback',
|
||
component: () => import('@/views/order/platformStore/oauthCallback.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
hideInMenu: true,
|
||
},
|
||
},
|
||
{
|
||
path: '/Plugin/AddPackage',
|
||
name: 'PluginAddPackage',
|
||
component: () => import('@/views/plugin/AddPackage.vue'),
|
||
meta: {
|
||
requiresAuth: true,
|
||
hideInMenu: true,
|
||
},
|
||
},
|
||
...appRoutes,
|
||
REDIRECT_MAIN,
|
||
NOT_FOUND_ROUTE,
|
||
],
|
||
scrollBehavior() {
|
||
return { top: 0 };
|
||
},
|
||
});
|
||
|
||
createRouteGuard(router);
|
||
|
||
export default router;
|