WEB/.umirc.ts

356 lines
8.5 KiB
TypeScript

import { defineConfig } from '@umijs/max';
import { codeInspectorPlugin } from 'code-inspector-plugin';
const isDev = process.env.NODE_ENV === 'development';
const UMI_APP_API_URL = isDev
? 'http://localhost:7001'
: 'https://api.yoone.ca';
export default defineConfig({
hash: true,
antd: {},
access: {},
model: {},
initialState: {},
request: {},
layout: {
title: 'YOONE',
},
esbuildMinifyIIFE: true,
define: {
UMI_APP_API_URL,
},
chainWebpack(config) {
config.plugin('code-inspector-plugin').use(
codeInspectorPlugin({
bundler: 'webpack',
}),
);
},
routes: [
{ path: '/', redirect: '/home' },
{ name: '追踪', path: '/track', component: './Track', layout: false },
{ name: '登录', path: '/login', component: './Login', layout: false },
{ name: '首页', path: '/home', component: './Home' },
{
name: '组织架构',
path: '/organiza',
access: 'canSeeOrganiza',
routes: [
{
name: '用户管理',
path: '/organiza/user',
component: './Organiza/User',
},
],
},
{
name: '地区管理',
path: '/area',
access: 'canSeeArea',
routes: [
{
name: '地区列表',
path: '/area/list',
component: './Area/List',
},
{
name: '地区地图',
path: '/area/map',
component: './Area/Map',
},
],
},
{
name: '站点管理',
path: '/site',
access: 'canSeeSite',
routes: [
{
name: '站点列表',
path: '/site/list',
component: './Site/List',
},
{
name: '店铺管理',
path: '/site/shop',
component: './Site/Shop/Layout',
routes: [
{
path: '/site/shop/:siteId/products',
component: './Site/Shop/Products',
},
{
path: '/site/shop/:siteId/orders',
component: './Site/Shop/Orders',
},
{
path: '/site/shop/:siteId/subscriptions',
component: './Site/Shop/Subscriptions',
},
{
path: '/site/shop/:siteId/logistics',
component: './Site/Shop/Logistics',
},
{
path: '/site/shop/:siteId/media',
component: './Site/Shop/Media',
},
{
path: '/site/shop/:siteId/customers',
component: './Site/Shop/Customers',
},
{
path: '/site/shop/:siteId/reviews',
component: './Site/Shop/Reviews',
},
{
path: '/site/shop/:siteId/webhooks',
component: './Site/Shop/Webhooks',
},
{
path: '/site/shop/:siteId/links',
component: './Site/Shop/Links',
},
],
},
{
name: 'Woo标签工具',
path: '/site/woocommerce/product/tool/tag',
component: './Woo/Product/TagTool',
},
],
},
{
name: '客户管理',
path: '/customer',
access: 'canSeeCustomer',
routes: [
{
name: '客户列表',
path: '/customer/list',
component: './Customer/List',
},
{
name: '数据分析列表',
path: '/customer/statistic',
component: './Customer/Statistic',
},
],
},
{
name: '产品管理',
path: '/product',
access: 'canSeeProduct',
routes: [
{
name: '产品列表',
path: '/product/list',
component: './Product/List',
},
{
name: '产品分类',
path: '/product/category',
component: './Product/Category',
},
{
name: '产品属性',
path: '/product/attribute',
component: './Product/Attribute',
},
{
name: '产品属性排列',
path: '/product/permutation',
component: './Product/Permutation',
},
{
name: '产品品牌空间',
path: '/product/groupBy',
component: './Product/GroupBy',
},
// sync
{
name: '同步产品',
path: '/product/sync',
component: './Product/Sync',
},
{
name: '产品CSV 工具',
path: '/product/csvtool',
component: './Product/CsvTool',
},
],
},
{
name: '库存管理',
path: '/stock',
access: 'canSeeStock',
routes: [
{
name: '库存列表',
path: '/stock/list',
component: './Stock/List',
},
{
name: '仓库点',
path: '/stock/warehouse',
component: './Stock/Warehouse',
},
{
name: '采购管理',
path: '/stock/purchaseOrder',
component: './Stock/PurchaseOrder',
},
{
name: '发货管理',
path: '/stock/transfer',
component: './Stock/Transfer',
},
{
name: '库存记录',
path: '/stock/record',
component: './Stock/Record',
},
],
},
{
name: '订单管理',
path: '/order',
access: 'canSeeOrder',
routes: [
{
name: '订单列表',
path: '/order/list',
component: './Order/List',
},
{
name: '待发货产品',
path: '/order/item',
component: './Order/PendingItems',
},
],
},
// 新增:订阅管理路由分组(权限复用 canSeeOrder)
{
name: '订阅管理',
path: '/subscription',
access: 'canSeeOrder',
routes: [
{
name: '订阅列表',
path: '/subscription/list',
component: './Subscription/List',
},
{
name: '订单管理',
path: '/subscription/orders',
component: './Subscription/Orders',
},
],
},
{
name: '物流管理',
path: '/logistics',
access: 'canSeeLogistics',
routes: [
{
name: '服务商',
path: '/logistics/services',
component: './Logistics/Services',
},
{
name: '地址管理',
path: '/logistics/address',
component: './Logistics/Address',
},
{
name: '物流列表',
path: '/logistics/list',
component: './Logistics/List',
},
],
},
{
name: '数据统计',
path: '/statistics',
access: 'canSeeStatistics',
routes: [
{
name: '销售统计',
path: '/statistics/sales',
component: './Statistics/Sales',
},
{
name: '订单统计',
path: '/statistics/order',
component: './Statistics/Order',
},
{
name: '订单来源',
path: '/statistics/orderSource',
component: './Statistics/OrderSource',
},
{
name: '客户统计',
path: '/statistics/customer',
component: './Statistics/Customer',
},
{
name: '库存预测',
path: '/statistics/inventoryForecast',
component: './Statistics/InventoryForecast',
},
{
name: '补货',
path: '/statistics/restocking',
component: './Statistics/Restocking',
},
],
},
{
name: '系统管理',
path: '/system',
access: 'canSeeSystem',
routes: [
{
name: '字典管理',
path: '/system/dict',
access: 'canSeeDict',
routes: [
{
name: '字典列表',
path: '/system/dict/list',
component: './Dict/List',
},
],
},
{
name: '模板管理',
path: '/system/template',
access: 'canSeeTemplate',
routes: [
{
name: '模板列表',
path: '/system/template/list',
component: './Template',
},
],
},
],
},
// {
// path: '*',
// component: './404',
// },
],
proxy: {
'/api': {
target: UMI_APP_API_URL,
changeOrigin: true,
pathRewrite: { '^/api': '' },
},
},
npmClient: 'pnpm',
});