配置路由和打包,添加包名

This commit is contained in:
郭永超 2025-08-26 17:29:39 +08:00
parent be5db5ff8f
commit ed2a6e29de
10 changed files with 42 additions and 376 deletions

View File

@ -42,7 +42,7 @@
</div>
<template #dropdown>
<el-dropdown-menu>
<router-link to="/user/profile">
<router-link to="/sub-government-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(() => { })
}

View File

@ -287,7 +287,7 @@ const activeMenu = computed(() => {
onMounted(async () => {
baseRoutes.value = [...sidebarRouters.value];
await nextTick();
console.log("运营云菜单");
console.log("政务云菜单");
console.log(baseRoutes.value);
});
</script>

View File

@ -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-government-admin' || selectedTag.value.fullPath === visitedViews.value[1].fullPath
} catch (err) {
return false
}

View File

@ -11,7 +11,7 @@ import usePermissionStore from '@/store/modules/permission'
NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/register']
const whiteList = ['/sub-government-admin/login', '/sub-government-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-government-admin/login') {
next({ path: '/sub-government-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-government-admin' })
})
})
} else {
@ -58,7 +58,7 @@ router.beforeEach((to, from, next) => {
// 在免登录白名单,直接进入
next()
} else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
next(`/sub-government-admin/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
NProgress.done()
}
}

View File

@ -38,108 +38,48 @@ export const constantRoutes = [
]
},
{
path: '/login',
path: '/sub-government-admin/login',
component: () => import('@/views/login'),
hidden: true
},
{
path: '/register',
path: '/sub-government-admin/register',
component: () => import('@/views/register'),
hidden: true
},
{
path: "/:pathMatch(.*)*",
path: "/sub-government-admin/:pathMatch(.*)*",
component: () => import('@/views/error/404'),
hidden: true
},
{
path: '/401',
path: '/sub-government-admin/401',
component: () => import('@/views/error/401'),
hidden: true
},
{
path: "/icons",
path: "/sub-government-admin/icons",
component: () => import("@/components/icons"),
hidden: true,
},
{
path: '',
path: '/sub-government-admin',
component: Layout,
redirect: '/index',
redirect: '/sub-government-admin/subHome',
children: [
{
path: '/index',
path: 'subHome',
component: () => import('@/views/index'),
name: 'Index',
name: 'subHome',
meta: { title: '首页', icon: 'chart', affix: true }
}
]
},
{
path: '/goods',
path: '/sub-government-admin/user',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [
{
path: 'goodsManage/addGoods/:activeTab?',
component: () => import('@/views/goods/goodsManage/addGoods'),
name: 'addGoods',
meta: { title: '新增商品', icon: '' }
},
{
path: 'goodsManage/editGoods/:activeTab?',
component: () => import('@/views/goods/goodsManage/editGoods'),
name: 'editGoods',
meta: { title: '编辑商品', icon: '' }
},
{
path: 'goodsManage/seeDetails/:activeTab?',
component: () => import('@/views/goods/goodsManage/seeDetails'),
name: 'seeDetails',
meta: { title: '商品详情', icon: '' }
},
{
path: '/goods/goodsReview/auditGoods/:activeTab?',
component: () => import('@/views/goods/goodsReview/auditGoods'),
name: 'auditGoods',
meta: { title: '审核商品', icon: '' }
}
]
},
{
path: '/order',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [
{
path: 'order/sendGoodsInfo/:activeTab?',
component: () => import('@/views/order/sendGoodsInfo'),
hidden: false,
meta: {
title: "去发货",
icon: "star",
},
name: "sendGoodsInfo",
},
{
path: 'order/orderDetails/:activeTab?',
component: () => import('@/views/order/orderDetails'),
hidden: false,
meta: {
title: "订单详情",
icon: "star",
},
name: "orderDetails",
},
]
},
{
path: '/user',
component: Layout,
hidden: true,
redirect: 'noredirect',
redirect: '/sub-government-admin/user/profile',
children: [
{
path: 'profile/:activeTab?',
@ -150,282 +90,9 @@ export const constantRoutes = [
]
},
// 产业运营云后台管理菜单【可访问页面参考】
// {
// path: '/goods',
// name: "goods",
// component: Layout,
// hidden: false,
// alwaysShow: true,
// redirect: 'noredirect',
// meta: {
// icon: "example",
// link: null,
// noCache: false,
// title: "商品中心",
// },
// children: [
// {
// path: 'goods/goodsManage',
// component: () => import('@/views/goods/goodsManage/index'),
// name: 'goodsManage',
// hidden: false,
// meta: {
// title: "商品信息管理",
// icon: "",
// noCache: false,
// link: null,
// },
// },
// {
// path: 'goods/goodsCategory',
// component: () => import('@/views/goods/goodsCategory/index'),
// name: 'goodsCategory',
// hidden: false,
// meta: {
// title: "商品分类设置",
// icon: "",
// noCache: false,
// link: null,
// },
// },
// {
// path: 'goods/contrabandManage',
// component: () => import('@/views/goods/contrabandManage/index'),
// name: 'contrabandManage',
// hidden: false,
// meta: {
// title: "违禁物品管理",
// icon: "",
// noCache: false,
// link: null,
// },
// },
// {
// path: 'goods/goodsReview',
// component: () => import('@/views/goods/goodsReview/index'),
// name: 'goodsReview',
// hidden: false,
// meta: {
// title: "上架审核设置",
// icon: "",
// noCache: false,
// link: null,
// },
// },
// ],
// },
// {
// path: '/plant',
// name: "plant",
// component: Layout,
// hidden: false,
// alwaysShow: true,
// redirect: 'noredirect',
// meta: {
// icon: "sunny",
// link: null,
// noCache: false,
// title: "智慧种植",
// },
// children: [
// {
// path: 'plant/ambient',
// component: () => import('@/views/plant/ambient'),
// name: 'ambient',
// hidden: false,
// meta: {
// title: "农业环境监测",
// icon: "",
// noCache: false,
// link: null,
// },
// },
// {
// path: 'plant/control',
// component: () => import('@/views/plant/control'),
// name: 'control',
// hidden: false,
// meta: {
// title: "生产管理控制",
// icon: "",
// noCache: false,
// link: null,
// },
// }
// ],
// },
// {
// path: '/trade',
// name: "trade",
// component: Layout,
// hidden: false,
// alwaysShow: true,
// redirect: 'noredirect',
// meta: {
// icon: "money",
// link: null,
// noCache: false,
// title: "电商交易",
// },
// children: [
// {
// path: 'trade/agriculturalinputstrading',
// component: () => import('@/views/trade/agriculturalinputstrading'),
// name: 'agriculturalinputstrading',
// hidden: false,
// meta: {
// title: "农资交易",
// icon: "",
// noCache: false,
// link: null,
// },
// },
// {
// path: 'trade/supplierServices',
// component: () => import('@/views/trade/supplierServices'),
// name: 'supplierServices',
// hidden: false,
// meta: {
// title: "供应商服务",
// icon: "",
// noCache: false,
// link: null,
// },
// },
// {
// path: 'trade/procurementServices',
// component: () => import('@/views/trade/procurementServices'),
// name: 'procurementServices',
// hidden: false,
// meta: {
// title: "采购商服务",
// icon: "",
// noCache: false,
// link: null,
// },
// },
// {
// path: 'trade/landTransaction',
// component: () => import('@/views/trade/landTransaction'),
// name: 'landTransaction',
// hidden: false,
// meta: {
// title: "土地交易",
// icon: "",
// noCache: false,
// link: null,
// },
// },
// ],
// },
// {
// path: '/order',
// name: "order",
// component: Layout,
// hidden: false,
// meta: {
// title: "订单列表",
// icon: "documentation",
// noCache: false,
// link: null,
// },
// children: [
// {
// path: 'order/obligation',
// component: () => import('@/views/order/obligation'),
// hidden: false,
// meta: {
// title: "待付款",
// noCache: false,
// link: null,
// },
// name: "obligation",
// },
// {
// path: 'order/sendGoods',
// component: () => import('@/views/order/sendGoods'),
// hidden: false,
// meta: {
// title: "待发货",
// noCache: false,
// link: null,
// },
// name: "sendGoods",
// },
// {
// path: 'order/shipped',
// component: () => import('@/views/order/shipped'),
// hidden: false,
// meta: {
// title: "已发货",
// noCache: false,
// link: null,
// },
// name: "shipped",
// },
// {
// path: 'order/receivedGoods',
// component: () => import('@/views/order/receivedGoods'),
// hidden: false,
// meta: {
// title: "已收货",
// noCache: false,
// link: null,
// },
// name: "receivedGoods",
// },
// {
// path: 'order/completed',
// component: () => import('@/views/order/completed'),
// hidden: false,
// meta: {
// title: "已完成",
// noCache: false,
// link: null,
// },
// name: "completed",
// },
// {
// path: 'order/cancelled',
// component: () => import('@/views/order/cancelled'),
// hidden: false,
// meta: {
// title: "已取消",
// noCache: false,
// link: null,
// },
// name: "cancelled",
// },
// {
// path: 'order/salesService',
// component: () => import('@/views/order/salesService'),
// hidden: false,
// meta: {
// title: "退货/退款",
// noCache: false,
// link: null,
// },
// name: "salesService",
// },
// {
// path: 'order/refunded',
// component: () => import('@/views/order/refunded'),
// hidden: false,
// meta: {
// title: "已退货/退款",
// noCache: false,
// link: null,
// },
// name: "refunded",
// },
// ],
// },
// 政务云后台管理系统菜单
{
path: '/land',
path: '/sub-government-admin/land',
name: "land",
component: Layout,
hidden: false,
@ -439,7 +106,7 @@ export const constantRoutes = [
},
children: [
{
path: 'land/landSort',
path: 'landSort',
component: () => import('@/views/land/landSort'),
name: "landSort",
hidden: false,
@ -453,14 +120,14 @@ export const constantRoutes = [
],
},
{
path: '/region',
path: '/sub-government-admin/region',
name: "region",
component: Layout,
hidden: false,
redirect: 'noredirect',
children: [
{
path: 'region/index',
path: 'index',
component: () => import('@/views/region/index'),
hidden: false,
meta: {
@ -474,13 +141,13 @@ export const constantRoutes = [
],
},
{
path: "/mainbody",
path: "/sub-government-admin/mainbody",
name: "mainbody",
component: Layout,
hidden: false,
children: [
{
path: "mainbody/index",
path: "index",
component: () => import("@/views/mainbody/index"),
hidden: false,
meta: {
@ -494,13 +161,13 @@ export const constantRoutes = [
],
},
{
path: "/inputs",
path: "/sub-government-admin/inputs",
name: "inputs",
component: Layout,
hidden: false,
children: [
{
path: "inputs/index",
path: "index",
component: () => import("@/views/inputs/index"),
hidden: false,
meta: {
@ -514,7 +181,7 @@ export const constantRoutes = [
],
},
{
path: "/traceability",
path: "/sub-government-admin/traceability",
name: "traceability",
component: Layout,
hidden: false,
@ -528,7 +195,7 @@ export const constantRoutes = [
},
children: [
{
path: "traceability/query",
path: "query",
component: () => import("@/views/traceability/query"),
name: "query",
hidden: false,
@ -540,7 +207,7 @@ export const constantRoutes = [
},
},
{
path: "traceability/statistics",
path: "statistics",
component: () => import("@/views/traceability/statistics"),
name: "溯源统计",
hidden: false,
@ -559,7 +226,7 @@ export const constantRoutes = [
// 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [
{
path: '/system/user-auth',
path: '/sub-government-admin/system/user-auth',
component: Layout,
hidden: true,
permissions: ['system:user:edit'],
@ -573,7 +240,7 @@ export const dynamicRoutes = [
]
},
{
path: '/system/role-auth',
path: '/sub-government-admin/system/role-auth',
component: Layout,
hidden: true,
permissions: ['system:role:edit'],
@ -587,7 +254,7 @@ export const dynamicRoutes = [
]
},
{
path: '/system/dict-data',
path: '/sub-government-admin/system/dict-data',
component: Layout,
hidden: true,
permissions: ['system:dict:list'],
@ -601,7 +268,7 @@ export const dynamicRoutes = [
]
},
{
path: '/monitor/job-log',
path: '/sub-government-admin/monitor/job-log',
component: Layout,
hidden: true,
permissions: ['monitor:job:list'],
@ -615,7 +282,7 @@ export const dynamicRoutes = [
]
},
{
path: '/tool/gen-edit',
path: '/sub-government-admin/tool/gen-edit',
component: Layout,
hidden: true,
permissions: ['tool:gen:edit'],

View File

@ -117,7 +117,7 @@ const useUserStore = defineStore("user", {
// })
// })
removeToken();
location.href = "/index";
// location.href = "/sub-government-admin";
},
},
});

View File

@ -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-government-admin'
})
}).catch(() => {
isRelogin.show = false

View File

@ -17,7 +17,7 @@
<div class="bullshit__info">
对不起您正在寻找的页面不存在尝试检查URL的错误然后按浏览器上的刷新按钮或尝试在我们的应用程序中找到其他内容
</div>
<router-link to="/index" class="bullshit__return-home">
<router-link to="/sub-government-admin" class="bullshit__return-home">
返回首页
</router-link>
</div>

View File

@ -170,7 +170,7 @@ function handleLogin() {
}
return acc;
}, {});
router.push({ path: redirect.value || "/", query: otherQueryParams });
router.push({ path: redirect.value || "/sub-government-admin", query: otherQueryParams });
})
.catch(() => {
loading.value = false;

View File

@ -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-government-admin" : "/",
plugins: createVitePlugins(env, command === "build"),
resolve: {
// https://cn.vitejs.dev/config/#resolve-alias