配置路由和打包,添加包名
This commit is contained in:
parent
784ef2071d
commit
758b4fc1cc
@ -5,6 +5,6 @@ VITE_APP_TITLE = 运营云后台管理系统
|
||||
VITE_APP_ENV = 'development'
|
||||
|
||||
# 开发环境
|
||||
VITE_APP_BASE_API = 'http://192.168.18.88:8080'
|
||||
VITE_APP_BASE_API = 'http://192.168.18.99:8080'
|
||||
# VITE_APP_BASE_API = 'http://192.168.18.151:8080'
|
||||
VITE_APP_PLATFORM = 'http://localhost:9000/platform'
|
@ -5,8 +5,8 @@ VITE_APP_TITLE = 运营云后台管理系统
|
||||
VITE_APP_ENV = 'production'
|
||||
|
||||
# 生产环境
|
||||
VITE_APP_BASE_API = 'http://47.109.205.240:8080'
|
||||
VITE_APP_PLATFORM = 'http://47.109.205.240/platform'
|
||||
VITE_APP_BASE_API = 'https://app.yingyijt.com/apis'
|
||||
VITE_APP_PLATFORM = 'https://app.yingyijt.com/platform'
|
||||
|
||||
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
||||
VITE_BUILD_COMPRESS = gzip
|
@ -42,7 +42,7 @@
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<router-link to="/user/profile">
|
||||
<router-link to="/sub-operation-admin/user">
|
||||
<el-dropdown-item>个人中心</el-dropdown-item>
|
||||
</router-link>
|
||||
<el-dropdown-item divided command="logout">
|
||||
@ -104,9 +104,8 @@ function logout() {
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
userStore.logOut().then(() => {
|
||||
location.href = '/index'
|
||||
})
|
||||
userStore.logOut();
|
||||
goHome();
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ function isAffix(tag) {
|
||||
|
||||
function isFirstView() {
|
||||
try {
|
||||
return selectedTag.value.fullPath === '/index' || selectedTag.value.fullPath === visitedViews.value[1].fullPath
|
||||
return selectedTag.value.fullPath === '/sub-operation-admin' || selectedTag.value.fullPath === visitedViews.value[1].fullPath
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import usePermissionStore from '@/store/modules/permission'
|
||||
|
||||
NProgress.configure({ showSpinner: false })
|
||||
|
||||
const whiteList = ['/login', '/register']
|
||||
const whiteList = ['/sub-operation-admin/login', '/sub-operation-admin/register']
|
||||
|
||||
const isWhiteList = (path) => {
|
||||
return whiteList.some(pattern => isPathMatch(pattern, path))
|
||||
@ -22,8 +22,8 @@ router.beforeEach((to, from, next) => {
|
||||
if (getToken()) {
|
||||
to.meta.title && useSettingsStore().setTitle(to.meta.title)
|
||||
/* has token*/
|
||||
if (to.path === '/login') {
|
||||
next({ path: '/' })
|
||||
if (to.path === '/sub-operation-admin/login') {
|
||||
next({ path: '/sub-operation-admin' })
|
||||
NProgress.done()
|
||||
} else if (isWhiteList(to.path)) {
|
||||
next()
|
||||
@ -45,7 +45,7 @@ router.beforeEach((to, from, next) => {
|
||||
}).catch(err => {
|
||||
useUserStore().logOut().then(() => {
|
||||
ElMessage.error(err)
|
||||
next({ path: '/' })
|
||||
next({ path: '/sub-operation-admin' })
|
||||
})
|
||||
})
|
||||
} else {
|
||||
@ -58,7 +58,7 @@ router.beforeEach((to, from, next) => {
|
||||
// 在免登录白名单,直接进入
|
||||
next()
|
||||
} else {
|
||||
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
||||
next(`/sub-operation-admin/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
||||
NProgress.done()
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import Layout from '@/layout'
|
||||
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
|
||||
}
|
||||
*/
|
||||
|
||||
const serverName = '/sub-operation-admin'
|
||||
// 公共路由
|
||||
export const constantRoutes = [
|
||||
{
|
||||
@ -39,45 +39,45 @@ export const constantRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
path: '/sub-operation-admin/login',
|
||||
component: () => import('@/views/login'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/register',
|
||||
path: '/sub-operation-admin/register',
|
||||
component: () => import('@/views/register'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: "/:pathMatch(.*)*",
|
||||
path: "/sub-operation-admin/:pathMatch(.*)*",
|
||||
component: () => import('@/views/error/404'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/401',
|
||||
path: '/sub-operation-admin/401',
|
||||
component: () => import('@/views/error/401'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: "/icons",
|
||||
path: "/sub-operation-admin/icons",
|
||||
component: () => import("@/components/icons"),
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
path: '/sub-operation-admin',
|
||||
component: Layout,
|
||||
redirect: '/index',
|
||||
redirect: '/sub-operation-admin/subHome',
|
||||
children: [
|
||||
{
|
||||
path: '/index',
|
||||
path: 'subHome',
|
||||
component: () => import('@/views/index'),
|
||||
name: 'Index',
|
||||
meta: { title: '首页', icon: 'chart', affix: true }
|
||||
name: 'subHome',
|
||||
meta: { title: '首页', icon: 'chart', affix: true },
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/goods',
|
||||
path: '/sub-operation-admin/goods',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
redirect: 'noredirect',
|
||||
@ -112,13 +112,13 @@ export const constantRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/order',
|
||||
path: '/sub-operation-admin/order',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
redirect: 'noredirect',
|
||||
children: [
|
||||
{
|
||||
path: 'order/sendGoodsInfo/:activeTab?',
|
||||
path: 'sendGoodsInfo/:activeTab?',
|
||||
component: () => import('@/views/order/sendGoodsInfo'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -128,7 +128,7 @@ export const constantRoutes = [
|
||||
name: "sendGoodsInfo",
|
||||
},
|
||||
{
|
||||
path: 'order/orderDetails/:activeTab?',
|
||||
path: 'orderDetails/:activeTab?',
|
||||
component: () => import('@/views/order/orderDetails'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -140,10 +140,10 @@ export const constantRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/user',
|
||||
path: '/sub-operation-admin/user',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
redirect: 'noredirect',
|
||||
redirect: '/sub-operation-admin/user/profile',
|
||||
children: [
|
||||
{
|
||||
path: 'profile/:activeTab?',
|
||||
@ -154,7 +154,7 @@ export const constantRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/customer',
|
||||
path: '/sub-operation-admin/customer',
|
||||
name: "customer",
|
||||
component: Layout,
|
||||
hidden: false,
|
||||
@ -168,7 +168,7 @@ export const constantRoutes = [
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'customer/customerManage',
|
||||
path: 'customerManage',
|
||||
component: () => import('@/views/customer/customerManage'),
|
||||
name: 'customerManage',
|
||||
hidden: false,
|
||||
@ -180,7 +180,7 @@ export const constantRoutes = [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'customer/customerCategory',
|
||||
path: 'customerCategory',
|
||||
component: () => import('@/views/customer/customerCategory'),
|
||||
name: 'customerCategory',
|
||||
hidden: false,
|
||||
@ -194,7 +194,7 @@ export const constantRoutes = [
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/goods',
|
||||
path: '/sub-operation-admin/goods',
|
||||
name: "goods",
|
||||
component: Layout,
|
||||
hidden: false,
|
||||
@ -208,7 +208,7 @@ export const constantRoutes = [
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'goods/goodsManage',
|
||||
path: 'goodsManage',
|
||||
component: () => import('@/views/goods/goodsManage/index'),
|
||||
name: 'goodsManage',
|
||||
hidden: false,
|
||||
@ -220,7 +220,7 @@ export const constantRoutes = [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'goods/goodsCategory',
|
||||
path: 'goodsCategory',
|
||||
component: () => import('@/views/goods/goodsCategory/index'),
|
||||
name: 'goodsCategory',
|
||||
hidden: false,
|
||||
@ -232,7 +232,7 @@ export const constantRoutes = [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'goods/contrabandManage',
|
||||
path: 'contrabandManage',
|
||||
component: () => import('@/views/goods/contrabandManage/index'),
|
||||
name: 'contrabandManage',
|
||||
hidden: false,
|
||||
@ -244,7 +244,7 @@ export const constantRoutes = [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'goods/goodsReview',
|
||||
path: 'goodsReview',
|
||||
component: () => import('@/views/goods/goodsReview/index'),
|
||||
name: 'goodsReview',
|
||||
hidden: false,
|
||||
@ -258,7 +258,7 @@ export const constantRoutes = [
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/plant',
|
||||
path: '/sub-operation-admin/plant',
|
||||
name: "plant",
|
||||
component: Layout,
|
||||
hidden: false,
|
||||
@ -272,7 +272,7 @@ export const constantRoutes = [
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'plant/ambient',
|
||||
path: 'ambient',
|
||||
component: () => import('@/views/plant/ambient'),
|
||||
name: 'ambient',
|
||||
hidden: false,
|
||||
@ -284,7 +284,7 @@ export const constantRoutes = [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'plant/control',
|
||||
path: 'control',
|
||||
component: () => import('@/views/plant/control'),
|
||||
name: 'control',
|
||||
hidden: false,
|
||||
@ -298,7 +298,7 @@ export const constantRoutes = [
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/trade',
|
||||
path: '/sub-operation-admin/trade',
|
||||
name: "trade",
|
||||
component: Layout,
|
||||
hidden: false,
|
||||
@ -312,7 +312,7 @@ export const constantRoutes = [
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'trade/dataBoard',
|
||||
path: 'dataBoard',
|
||||
component: () => import('@/views/trade/dataBoard'),
|
||||
name: 'dataBoard',
|
||||
hidden: false,
|
||||
@ -324,7 +324,7 @@ export const constantRoutes = [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'trade/agriculturalinputstrading',
|
||||
path: 'agriculturalinputstrading',
|
||||
component: () => import('@/views/trade/agriculturalinputstrading'),
|
||||
name: 'agriculturalinputstrading',
|
||||
hidden: false,
|
||||
@ -336,7 +336,7 @@ export const constantRoutes = [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'trade/supplierServices',
|
||||
path: 'supplierServices',
|
||||
component: () => import('@/views/trade/supplierServices'),
|
||||
name: 'supplierServices',
|
||||
hidden: false,
|
||||
@ -348,7 +348,7 @@ export const constantRoutes = [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'trade/procurementServices',
|
||||
path: 'procurementServices',
|
||||
component: () => import('@/views/trade/procurementServices'),
|
||||
name: 'procurementServices',
|
||||
hidden: false,
|
||||
@ -360,7 +360,7 @@ export const constantRoutes = [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'trade/landTransaction',
|
||||
path: 'landTransaction',
|
||||
component: () => import('@/views/trade/landTransaction'),
|
||||
name: 'landTransaction',
|
||||
hidden: false,
|
||||
@ -374,7 +374,7 @@ export const constantRoutes = [
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/brand',
|
||||
path: '/sub-operation-admin/brand',
|
||||
name: "brand",
|
||||
component: Layout,
|
||||
hidden: false,
|
||||
@ -388,7 +388,7 @@ export const constantRoutes = [
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'brand/informationManagement',
|
||||
path: 'informationManagement',
|
||||
component: () => import('@/views/brand/informationManagement/index'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -400,7 +400,7 @@ export const constantRoutes = [
|
||||
name: "informationManagement",
|
||||
},
|
||||
{
|
||||
path: 'brand/applicationReview',
|
||||
path: 'applicationReview',
|
||||
component: () => import('@/views/brand/applicationReview/index'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -412,7 +412,7 @@ export const constantRoutes = [
|
||||
name: "applicationReview",
|
||||
},
|
||||
{
|
||||
path: 'brand/renewal',
|
||||
path: 'renewal',
|
||||
component: () => import('@/views/brand/renewal/index'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -424,7 +424,7 @@ export const constantRoutes = [
|
||||
name: "renewal",
|
||||
},
|
||||
{
|
||||
path: 'brand/management',
|
||||
path: 'management',
|
||||
component: () => import('@/views/brand/management/index'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -438,7 +438,7 @@ export const constantRoutes = [
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/order',
|
||||
path: '/sub-operation-admin/order',
|
||||
name: "order",
|
||||
component: Layout,
|
||||
hidden: false,
|
||||
@ -450,7 +450,7 @@ export const constantRoutes = [
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'order/obligation',
|
||||
path: 'obligation',
|
||||
component: () => import('@/views/order/obligation'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -461,7 +461,7 @@ export const constantRoutes = [
|
||||
name: "obligation",
|
||||
},
|
||||
{
|
||||
path: 'order/sendGoods',
|
||||
path: 'sendGoods',
|
||||
component: () => import('@/views/order/sendGoods'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -472,7 +472,7 @@ export const constantRoutes = [
|
||||
name: "sendGoods",
|
||||
},
|
||||
{
|
||||
path: 'order/shipped',
|
||||
path: 'shipped',
|
||||
component: () => import('@/views/order/shipped'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -483,7 +483,7 @@ export const constantRoutes = [
|
||||
name: "shipped",
|
||||
},
|
||||
{
|
||||
path: 'order/receivedGoods',
|
||||
path: 'receivedGoods',
|
||||
component: () => import('@/views/order/receivedGoods'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -494,7 +494,7 @@ export const constantRoutes = [
|
||||
name: "receivedGoods",
|
||||
},
|
||||
{
|
||||
path: 'order/completed',
|
||||
path: 'completed',
|
||||
component: () => import('@/views/order/completed'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -505,7 +505,7 @@ export const constantRoutes = [
|
||||
name: "completed",
|
||||
},
|
||||
{
|
||||
path: 'order/cancelled',
|
||||
path: 'cancelled',
|
||||
component: () => import('@/views/order/cancelled'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -516,7 +516,7 @@ export const constantRoutes = [
|
||||
name: "cancelled",
|
||||
},
|
||||
{
|
||||
path: 'order/salesService',
|
||||
path: 'salesService',
|
||||
component: () => import('@/views/order/salesService'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -527,7 +527,7 @@ export const constantRoutes = [
|
||||
name: "salesService",
|
||||
},
|
||||
{
|
||||
path: 'order/refunded',
|
||||
path: 'refunded',
|
||||
component: () => import('@/views/order/refunded'),
|
||||
hidden: false,
|
||||
meta: {
|
||||
@ -542,7 +542,7 @@ export const constantRoutes = [
|
||||
},
|
||||
// 内容管理,没有子菜单
|
||||
{
|
||||
path: '/content',
|
||||
path: '/sub-operation-admin/content',
|
||||
name: "content",
|
||||
meta: {
|
||||
title: "内容管理",
|
||||
@ -551,7 +551,7 @@ export const constantRoutes = [
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: 'content/index',
|
||||
path: 'index',
|
||||
component: () => import('@/views/content/index'),
|
||||
name: 'content',
|
||||
hidden: false,
|
||||
@ -570,7 +570,7 @@ export const constantRoutes = [
|
||||
// 动态路由,基于用户权限动态去加载
|
||||
export const dynamicRoutes = [
|
||||
{
|
||||
path: '/system/user-auth',
|
||||
path: '/sub-operation-admin/system/user-auth',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
permissions: ['system:user:edit'],
|
||||
@ -584,7 +584,7 @@ export const dynamicRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/system/role-auth',
|
||||
path: '/sub-operation-admin/system/role-auth',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
permissions: ['system:role:edit'],
|
||||
@ -598,7 +598,7 @@ export const dynamicRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/system/dict-data',
|
||||
path: '/sub-operation-admin/system/dict-data',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
permissions: ['system:dict:list'],
|
||||
@ -612,7 +612,7 @@ export const dynamicRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/monitor/job-log',
|
||||
path: '/sub-operation-admin/monitor/job-log',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
permissions: ['monitor:job:list'],
|
||||
@ -626,7 +626,7 @@ export const dynamicRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/tool/gen-edit',
|
||||
path: '/sub-operation-admin/tool/gen-edit',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
permissions: ['tool:gen:edit'],
|
||||
|
@ -117,7 +117,7 @@ const useUserStore = defineStore("user", {
|
||||
// })
|
||||
// })
|
||||
removeToken();
|
||||
location.href = "/index";
|
||||
// location.href = "/sub-operation-admin";
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -87,7 +87,7 @@ service.interceptors.response.use(res => {
|
||||
ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||
isRelogin.show = false
|
||||
useUserStore().logOut().then(() => {
|
||||
location.href = '/index'
|
||||
location.href = '/sub-operation-admin'
|
||||
})
|
||||
}).catch(() => {
|
||||
isRelogin.show = false
|
||||
|
@ -17,7 +17,7 @@
|
||||
<div class="bullshit__info">
|
||||
对不起,您正在寻找的页面不存在。尝试检查URL的错误,然后按浏览器上的刷新按钮或尝试在我们的应用程序中找到其他内容。
|
||||
</div>
|
||||
<router-link to="/index" class="bullshit__return-home">
|
||||
<router-link to="/sub-operation-admin" class="bullshit__return-home">
|
||||
返回首页
|
||||
</router-link>
|
||||
</div>
|
||||
|
@ -136,8 +136,6 @@ onMounted(() => {
|
||||
watch(
|
||||
route,
|
||||
(newRoute) => {
|
||||
console.log(newRoute);
|
||||
redirect.value = newRoute.query && newRoute.query.redirect;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
@ -170,7 +168,7 @@ function handleLogin() {
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
router.push({ path: redirect.value || "/", query: otherQueryParams });
|
||||
router.push({ path: redirect.value || "/sub-operation-admin", query: otherQueryParams });
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
|
@ -11,7 +11,7 @@ export default defineConfig(({ mode, command }) => {
|
||||
// 部署生产环境和开发环境下的URL。
|
||||
// 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上
|
||||
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
|
||||
base: VITE_APP_ENV === "production" ? "/" : "/",
|
||||
base: VITE_APP_ENV === "production" ? "/sub-operation-admin/" : "/",
|
||||
plugins: createVitePlugins(env, command === "build"),
|
||||
resolve: {
|
||||
// https://cn.vitejs.dev/config/#resolve-alias
|
||||
|
Loading…
x
Reference in New Issue
Block a user