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

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> </div>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<router-link to="/user/profile"> <router-link to="/sub-government-admin/user">
<el-dropdown-item>个人中心</el-dropdown-item> <el-dropdown-item>个人中心</el-dropdown-item>
</router-link> </router-link>
<el-dropdown-item divided command="logout"> <el-dropdown-item divided command="logout">
@ -104,9 +104,8 @@ function logout() {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
userStore.logOut().then(() => { userStore.logOut();
location.href = '/index' goHome();
})
}).catch(() => { }) }).catch(() => { })
} }

View File

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

View File

@ -101,7 +101,7 @@ function isAffix(tag) {
function isFirstView() { function isFirstView() {
try { 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) { } catch (err) {
return false return false
} }

View File

@ -11,7 +11,7 @@ import usePermissionStore from '@/store/modules/permission'
NProgress.configure({ showSpinner: false }) NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/register'] const whiteList = ['/sub-government-admin/login', '/sub-government-admin/register']
const isWhiteList = (path) => { const isWhiteList = (path) => {
return whiteList.some(pattern => isPathMatch(pattern, path)) return whiteList.some(pattern => isPathMatch(pattern, path))
@ -22,8 +22,8 @@ router.beforeEach((to, from, next) => {
if (getToken()) { if (getToken()) {
to.meta.title && useSettingsStore().setTitle(to.meta.title) to.meta.title && useSettingsStore().setTitle(to.meta.title)
/* has token*/ /* has token*/
if (to.path === '/login') { if (to.path === '/sub-government-admin/login') {
next({ path: '/' }) next({ path: '/sub-government-admin' })
NProgress.done() NProgress.done()
} else if (isWhiteList(to.path)) { } else if (isWhiteList(to.path)) {
next() next()
@ -45,7 +45,7 @@ router.beforeEach((to, from, next) => {
}).catch(err => { }).catch(err => {
useUserStore().logOut().then(() => { useUserStore().logOut().then(() => {
ElMessage.error(err) ElMessage.error(err)
next({ path: '/' }) next({ path: '/sub-government-admin' })
}) })
}) })
} else { } else {
@ -58,7 +58,7 @@ router.beforeEach((to, from, next) => {
// 在免登录白名单,直接进入 // 在免登录白名单,直接进入
next() next()
} else { } else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 next(`/sub-government-admin/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
NProgress.done() NProgress.done()
} }
} }

View File

@ -38,108 +38,48 @@ export const constantRoutes = [
] ]
}, },
{ {
path: '/login', path: '/sub-government-admin/login',
component: () => import('@/views/login'), component: () => import('@/views/login'),
hidden: true hidden: true
}, },
{ {
path: '/register', path: '/sub-government-admin/register',
component: () => import('@/views/register'), component: () => import('@/views/register'),
hidden: true hidden: true
}, },
{ {
path: "/:pathMatch(.*)*", path: "/sub-government-admin/:pathMatch(.*)*",
component: () => import('@/views/error/404'), component: () => import('@/views/error/404'),
hidden: true hidden: true
}, },
{ {
path: '/401', path: '/sub-government-admin/401',
component: () => import('@/views/error/401'), component: () => import('@/views/error/401'),
hidden: true hidden: true
}, },
{ {
path: "/icons", path: "/sub-government-admin/icons",
component: () => import("@/components/icons"), component: () => import("@/components/icons"),
hidden: true, hidden: true,
}, },
{ {
path: '', path: '/sub-government-admin',
component: Layout, component: Layout,
redirect: '/index', redirect: '/sub-government-admin/subHome',
children: [ children: [
{ {
path: '/index', path: 'subHome',
component: () => import('@/views/index'), component: () => import('@/views/index'),
name: 'Index', name: 'subHome',
meta: { title: '首页', icon: 'chart', affix: true } meta: { title: '首页', icon: 'chart', affix: true }
} }
] ]
}, },
{ {
path: '/goods', path: '/sub-government-admin/user',
component: Layout, component: Layout,
hidden: true, hidden: true,
redirect: 'noredirect', redirect: '/sub-government-admin/user/profile',
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',
children: [ children: [
{ {
path: 'profile/:activeTab?', 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", name: "land",
component: Layout, component: Layout,
hidden: false, hidden: false,
@ -439,7 +106,7 @@ export const constantRoutes = [
}, },
children: [ children: [
{ {
path: 'land/landSort', path: 'landSort',
component: () => import('@/views/land/landSort'), component: () => import('@/views/land/landSort'),
name: "landSort", name: "landSort",
hidden: false, hidden: false,
@ -453,14 +120,14 @@ export const constantRoutes = [
], ],
}, },
{ {
path: '/region', path: '/sub-government-admin/region',
name: "region", name: "region",
component: Layout, component: Layout,
hidden: false, hidden: false,
redirect: 'noredirect', redirect: 'noredirect',
children: [ children: [
{ {
path: 'region/index', path: 'index',
component: () => import('@/views/region/index'), component: () => import('@/views/region/index'),
hidden: false, hidden: false,
meta: { meta: {
@ -474,13 +141,13 @@ export const constantRoutes = [
], ],
}, },
{ {
path: "/mainbody", path: "/sub-government-admin/mainbody",
name: "mainbody", name: "mainbody",
component: Layout, component: Layout,
hidden: false, hidden: false,
children: [ children: [
{ {
path: "mainbody/index", path: "index",
component: () => import("@/views/mainbody/index"), component: () => import("@/views/mainbody/index"),
hidden: false, hidden: false,
meta: { meta: {
@ -494,13 +161,13 @@ export const constantRoutes = [
], ],
}, },
{ {
path: "/inputs", path: "/sub-government-admin/inputs",
name: "inputs", name: "inputs",
component: Layout, component: Layout,
hidden: false, hidden: false,
children: [ children: [
{ {
path: "inputs/index", path: "index",
component: () => import("@/views/inputs/index"), component: () => import("@/views/inputs/index"),
hidden: false, hidden: false,
meta: { meta: {
@ -514,7 +181,7 @@ export const constantRoutes = [
], ],
}, },
{ {
path: "/traceability", path: "/sub-government-admin/traceability",
name: "traceability", name: "traceability",
component: Layout, component: Layout,
hidden: false, hidden: false,
@ -528,7 +195,7 @@ export const constantRoutes = [
}, },
children: [ children: [
{ {
path: "traceability/query", path: "query",
component: () => import("@/views/traceability/query"), component: () => import("@/views/traceability/query"),
name: "query", name: "query",
hidden: false, hidden: false,
@ -540,7 +207,7 @@ export const constantRoutes = [
}, },
}, },
{ {
path: "traceability/statistics", path: "statistics",
component: () => import("@/views/traceability/statistics"), component: () => import("@/views/traceability/statistics"),
name: "溯源统计", name: "溯源统计",
hidden: false, hidden: false,
@ -559,7 +226,7 @@ export const constantRoutes = [
// 动态路由,基于用户权限动态去加载 // 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [ export const dynamicRoutes = [
{ {
path: '/system/user-auth', path: '/sub-government-admin/system/user-auth',
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['system:user:edit'], permissions: ['system:user:edit'],
@ -573,7 +240,7 @@ export const dynamicRoutes = [
] ]
}, },
{ {
path: '/system/role-auth', path: '/sub-government-admin/system/role-auth',
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['system:role:edit'], permissions: ['system:role:edit'],
@ -587,7 +254,7 @@ export const dynamicRoutes = [
] ]
}, },
{ {
path: '/system/dict-data', path: '/sub-government-admin/system/dict-data',
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['system:dict:list'], permissions: ['system:dict:list'],
@ -601,7 +268,7 @@ export const dynamicRoutes = [
] ]
}, },
{ {
path: '/monitor/job-log', path: '/sub-government-admin/monitor/job-log',
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['monitor:job:list'], permissions: ['monitor:job:list'],
@ -615,7 +282,7 @@ export const dynamicRoutes = [
] ]
}, },
{ {
path: '/tool/gen-edit', path: '/sub-government-admin/tool/gen-edit',
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['tool:gen:edit'], permissions: ['tool:gen:edit'],

View File

@ -117,7 +117,7 @@ const useUserStore = defineStore("user", {
// }) // })
// }) // })
removeToken(); 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(() => { ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
isRelogin.show = false isRelogin.show = false
useUserStore().logOut().then(() => { useUserStore().logOut().then(() => {
location.href = '/index' location.href = '/sub-government-admin'
}) })
}).catch(() => { }).catch(() => {
isRelogin.show = false isRelogin.show = false

View File

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

View File

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

View File

@ -11,7 +11,7 @@ export default defineConfig(({ mode, command }) => {
// 部署生产环境和开发环境下的URL。 // 部署生产环境和开发环境下的URL。
// 默认情况下vite 会假设你的应用是被部署在一个域名的根路径上 // 默认情况下vite 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 // 例如 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"), plugins: createVitePlugins(env, command === "build"),
resolve: { resolve: {
// https://cn.vitejs.dev/config/#resolve-alias // https://cn.vitejs.dev/config/#resolve-alias