uptada
This commit is contained in:
parent
6383555556
commit
5e82b38f62
@ -112,6 +112,7 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.audioElement = new Audio('https://www.kaiyuancloud.cn/dev/idfile?path=/batch_upload/phone-ring.mp3');
|
||||
|
||||
// 设置音频循环播放
|
||||
this.audioElement.loop = true;
|
||||
if (sessionStorage.getItem('juese') === '销售' && !window.location.href.includes('login')) {
|
||||
|
||||
@ -95,7 +95,7 @@
|
||||
style="width: 80px;height: 25px;display: flex!important;justify-content: center;align-items: center">
|
||||
<el-skeleton
|
||||
style="width: 100%;padding: 0;margin: 0;height: 100%;margin-top: -25px"
|
||||
rows="1"
|
||||
:rows="1"
|
||||
animated/>
|
||||
</div>
|
||||
<p v-else class="cloud-contact-us-con" style="font-size: 12px;height: 20px;margin-top: 5px">
|
||||
|
||||
@ -30,7 +30,17 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
// handleScroll(){
|
||||
|
||||
// console.log("滚动条事件");
|
||||
|
||||
|
||||
// },
|
||||
checkScreenHeight() {
|
||||
|
||||
console.log(9999);
|
||||
|
||||
const screenHeight = window.innerHeight;
|
||||
// 可以根据实际需求调整阈值
|
||||
this.shouldShow = screenHeight >= 900;
|
||||
@ -46,10 +56,10 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.checkScreenHeight();
|
||||
window.addEventListener('scroll', this.handleScroll);
|
||||
// window.addEventListener('scroll', this.handleScroll);
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.removeEventListener('scroll', this.handleScroll);
|
||||
// window.removeEventListener('scroll', this.handleScroll);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
|
||||
<!-- Sidebar.vue -->
|
||||
<template>
|
||||
<div class="index">
|
||||
<div :class="{ 'has-logo': showLogo }" class="sidebar-container">
|
||||
@ -13,16 +13,16 @@
|
||||
:unique-opened="true"
|
||||
:active-text-color="variables.menuActiveText"
|
||||
:collapse-transition="false"
|
||||
:default-active="$route.path"
|
||||
:default-active="activeMenu"
|
||||
mode="vertical"
|
||||
class="el-menu-vertical"
|
||||
>
|
||||
<!-- 循环 filteredRoutes -->
|
||||
<sidebar-item
|
||||
v-for="(route, index) in filteredRoutes"
|
||||
:key="index"
|
||||
v-for="(route, index) in permissionRoutes"
|
||||
:key="route.path + index"
|
||||
:item="route"
|
||||
:base-path="route.path"
|
||||
:is-collapse="isCollapse"
|
||||
/>
|
||||
</el-menu>
|
||||
</happy-scroll>
|
||||
@ -38,42 +38,72 @@ import Logo from "./Logo.vue";
|
||||
|
||||
export default {
|
||||
name: "Sidebar",
|
||||
data() {
|
||||
return {
|
||||
role: '',
|
||||
homePageRouteIdentifier: (route) => {
|
||||
return route.name === 'homePage';
|
||||
}
|
||||
};
|
||||
},
|
||||
components: { SidebarItem, Logo },
|
||||
created() {
|
||||
console.log("filteredRoutes路由Menu",this.filteredRoutes);
|
||||
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["permission_routes", "sidebar", "userType"]), // 新增:映射userType
|
||||
|
||||
...mapGetters(["permission_routes", "sidebar"]),
|
||||
showLogo() {
|
||||
return true;
|
||||
},
|
||||
|
||||
variables() {
|
||||
return variables;
|
||||
},
|
||||
|
||||
isCollapse() {
|
||||
return !this.sidebar.opened;
|
||||
},
|
||||
// --- 新增计算属性:过滤后的路由 ---
|
||||
filteredRoutes() {
|
||||
if (!this.permission_routes) {
|
||||
return [];
|
||||
}
|
||||
return this.permission_routes.filter(route => !this.homePageRouteIdentifier(route));
|
||||
|
||||
// 修复:确保权限路由正确获取
|
||||
permissionRoutes() {
|
||||
const routes = this.permission_routes || [];
|
||||
console.log("Sidebar - 当前权限路由:", routes);
|
||||
console.log("Sidebar - 用户类型:", this.userType); // 新增:打印用户类型
|
||||
|
||||
// 调试:检查是否包含订单管理和资源管理路由
|
||||
const hasOrderManagement = routes.some(route => route.path === '/orderManagement');
|
||||
const hasResourceManagement = routes.some(route => route.path === '/resourceManagement');
|
||||
console.log("是否包含订单管理:", hasOrderManagement);
|
||||
console.log("是否包含资源管理:", hasResourceManagement);
|
||||
|
||||
return routes;
|
||||
},
|
||||
|
||||
// 修复:激活菜单的高亮
|
||||
activeMenu() {
|
||||
const route = this.$route;
|
||||
const { meta, path } = route;
|
||||
|
||||
// 如果设置了activeMenu,就使用它
|
||||
if (meta.activeMenu) {
|
||||
return meta.activeMenu;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
mounted() {
|
||||
console.log("Sidebar mounted - 权限路由:", this.permissionRoutes);
|
||||
console.log("Sidebar mounted - 用户类型:", this.userType);
|
||||
},
|
||||
|
||||
watch: {
|
||||
permission_routes: {
|
||||
handler(newRoutes) {
|
||||
console.log("Sidebar - 权限路由变化:", newRoutes);
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
},
|
||||
|
||||
// 新增:监听用户类型变化
|
||||
userType: {
|
||||
handler(newType) {
|
||||
console.log("Sidebar - 用户类型变化:", newType);
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@ -136,7 +166,3 @@ export default {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -111,6 +111,7 @@ Object.keys(filters).forEach(key => {
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
|
||||
@ -19,14 +19,9 @@ import ShowGpu from "@/views/product/productHome/capitalOnline/productItem/GpuPr
|
||||
import ShowEip from "@/views/product/productHome/capitalOnline/Net/Eip/showEip/index.vue";
|
||||
import CreateEip from "@/views/product/productHome/capitalOnline/Net/Eip/createEip/index.vue";
|
||||
import { getHomePath } from '@/views/setting/tools'
|
||||
// import { h } from "vue";
|
||||
|
||||
Vue.use(Router);
|
||||
|
||||
// const originalPush = Router.prototype.push
|
||||
|
||||
// Router.prototype.push = function push(location) {
|
||||
// return originalPush.call(this, location).catch(err => err)}
|
||||
// import nestedRouter from '@/router/modules/nested'
|
||||
/**
|
||||
* Note: sub-menu only appear when route children.length >= 1
|
||||
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
|
||||
@ -93,7 +88,7 @@ export const constantRoutes = [
|
||||
title: '可视化首页',
|
||||
component: () => import('@/views/product/bigScreen/mainPage/index.vue'),
|
||||
meta: {
|
||||
title: "可视化大屏", fullPath: "/operation/analyze/screen",
|
||||
title: "可视化首页", fullPath: "/operation/analyze/screen",
|
||||
},
|
||||
}, {
|
||||
path: "userPage",
|
||||
@ -272,14 +267,6 @@ export const constantRoutes = [
|
||||
|
||||
}]
|
||||
},
|
||||
// {
|
||||
// path: "/homePage/mobile",
|
||||
// component: () => import("@/views/homePageMobile/indexNew.vue"),
|
||||
// name: "HomePage",
|
||||
// hidden: true,
|
||||
// meta: { title: "首页" },
|
||||
// },
|
||||
|
||||
{
|
||||
path: "/homePageImage",
|
||||
component: () => import("@/views/homePageImage/index"),
|
||||
@ -304,68 +291,138 @@ export const constantRoutes = [
|
||||
path: "/404", component: () => import("@/views/error-page/404"), hidden: true,
|
||||
}, {
|
||||
path: "/401", component: () => import("@/views/error-page/401"), hidden: true,
|
||||
}, // {
|
||||
// path: "/shoppingManagement",
|
||||
// component: () => import("@/views/management/shoppingManagement"),
|
||||
// },
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* asyncRoutes
|
||||
* 需要根据用户角色动态加载的路由
|
||||
*/
|
||||
export const asyncRoutes = [
|
||||
|
||||
// {
|
||||
// component: Layout,
|
||||
// path: "/productHome",
|
||||
// component: () => import('@/views/product/productHome/productIndex/index.vue'),
|
||||
// name: 'productHome',
|
||||
// meta: {title: "概览", fullPath: "/productHome", noCache: true}
|
||||
// },
|
||||
|
||||
// 官网
|
||||
{
|
||||
path: getHomePath() == '/ncmatchHome/index' ? "/ncmatchHome" : "/homePage",
|
||||
component: () => import("@/views/homePage/indexLast.vue"),
|
||||
name: "homePage",
|
||||
redirect: "/homePage/index",
|
||||
meta: { fullPath: "/homePage/index", title: "官网首页", noCache: true, icon: 'el-icon-s-home' },
|
||||
path: "/product",
|
||||
component: Layout,
|
||||
redirect: "/product/overview",
|
||||
meta: {
|
||||
title: "全部产品",
|
||||
fullPath: "/product",
|
||||
noCache: true,
|
||||
icon: "el-icon-s-platform"
|
||||
},
|
||||
alwaysShow: true,
|
||||
children: [
|
||||
{
|
||||
path: "index",
|
||||
component: () => import("@/views/homePage/mainPage/index.vue"),
|
||||
name: "homePageIndex",
|
||||
hidden: true,
|
||||
meta: { title: "首页", fullPath: "/homePage/index" },
|
||||
path: "overview",
|
||||
component: () => import('@/views/product/productHome/productIndex/index.vue'),
|
||||
name: 'ProductOverview',
|
||||
meta: {
|
||||
title: "资源概览",
|
||||
fullPath: "/product/overview",
|
||||
noCache: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "detail",
|
||||
component: () => import("@/views/homePage/detail/index.vue"),
|
||||
name: "detail",
|
||||
hidden: true,
|
||||
meta: { title: "详情", cache: true },
|
||||
}, {
|
||||
path: "hospital",
|
||||
component: () => import("@/views/homePage/solve/hospital/index.vue"),
|
||||
name: "hospital",
|
||||
hidden: true,
|
||||
meta: { title: "灵医智能体" },
|
||||
}, {
|
||||
path: "customerService",
|
||||
component: () => import("@/views/homePage/solve/customerService/index.vue"),
|
||||
name: "customerService",
|
||||
hidden: true,
|
||||
meta: { title: "客悦" },
|
||||
|
||||
}, {
|
||||
path: "about",
|
||||
component: () => import("@/views/homePage/about/index.vue"),
|
||||
name: "about",
|
||||
hidden: true,
|
||||
meta: { title: "关于" },
|
||||
|
||||
}]
|
||||
]
|
||||
},
|
||||
|
||||
// 订单管理菜单 - 保持为一级菜单,调整顺序到全部产品后面
|
||||
{
|
||||
path: "/orderManagement",
|
||||
component: Layout,
|
||||
redirect: "/orderManagement/baidu",
|
||||
name: "OrderManagement",
|
||||
meta: {
|
||||
title: "订单管理",
|
||||
fullPath: "/orderManagement",
|
||||
noCache: true,
|
||||
icon: "el-icon-s-order"
|
||||
},
|
||||
alwaysShow: true,
|
||||
children: [
|
||||
{
|
||||
path: "baidu",
|
||||
component: () => import('@/views/product/productHome/productIndex/index.vue'),
|
||||
name: 'BaiduOrder',
|
||||
meta: {
|
||||
title: "百度订单",
|
||||
fullPath: "/orderManagement/baidu",
|
||||
noCache: true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// 资源管理菜单 - 保持为一级菜单,调整顺序到订单管理后面
|
||||
|
||||
{
|
||||
path: "/resourceManagement",
|
||||
component: Layout,
|
||||
redirect: "/resourceManagement/baidu",
|
||||
name: "ResourceManagement",
|
||||
meta: {
|
||||
title: "资源管理",
|
||||
fullPath: "/resourceManagement",
|
||||
noCache: true,
|
||||
icon: "el-icon-copy-document"
|
||||
},
|
||||
alwaysShow: true,
|
||||
children: [
|
||||
{
|
||||
path: "baidu",
|
||||
component: () => import('@/views/product/productHome/productIndex/index.vue'),
|
||||
name: 'BaiduResource',
|
||||
meta: {
|
||||
title: "百度资源",
|
||||
fullPath: "/resourceManagement/baidu",
|
||||
noCache: true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// 官网
|
||||
// {
|
||||
// path: getHomePath() == '/ncmatchHome/index' ? "/ncmatchHome" : "/homePage",
|
||||
// component: () => import("@/views/homePage/indexLast.vue"),
|
||||
// name: "homePage",
|
||||
// redirect: "/homePage/index",
|
||||
// meta: { fullPath: "/homePage/index", title: "官网首页", noCache: true, icon: 'el-icon-s-home' },
|
||||
// children: [
|
||||
// {
|
||||
// path: "index",
|
||||
// component: () => import("@/views/homePage/mainPage/index.vue"),
|
||||
// name: "homePageIndex",
|
||||
// hidden: true,
|
||||
// meta: { title: "首页", fullPath: "/homePage/index" },
|
||||
// },
|
||||
// {
|
||||
// path: "detail",
|
||||
// component: () => import("@/views/homePage/detail/index.vue"),
|
||||
// name: "detail",
|
||||
// hidden: true,
|
||||
// meta: { title: "详情", cache: true },
|
||||
// }, {
|
||||
// path: "hospital",
|
||||
// component: () => import("@/views/homePage/solve/hospital/index.vue"),
|
||||
// name: "hospital",
|
||||
// hidden: true,
|
||||
// meta: { title: "灵医智能体" },
|
||||
// }, {
|
||||
// path: "customerService",
|
||||
// component: () => import("@/views/homePage/solve/customerService/index.vue"),
|
||||
// name: "customerService",
|
||||
// hidden: true,
|
||||
// meta: { title: "客悦" },
|
||||
|
||||
// }, {
|
||||
// path: "about",
|
||||
// component: () => import("@/views/homePage/about/index.vue"),
|
||||
// name: "about",
|
||||
// hidden: true,
|
||||
// meta: { title: "关于" },
|
||||
|
||||
// }]
|
||||
// },
|
||||
// 咨询表单
|
||||
{
|
||||
path: "/consultingMangement",
|
||||
@ -393,15 +450,6 @@ export const asyncRoutes = [
|
||||
component: () => import('@/views/product/productHome/productIndex/index.vue'),
|
||||
name: 'baiduProduct',
|
||||
},
|
||||
// {
|
||||
// path: '/external-link',
|
||||
// {
|
||||
//
|
||||
// path: "productHome",
|
||||
// component: () => import('@/views/product/productHome/productIndex/index.vue'),
|
||||
// name: 'baiduProduct',
|
||||
// meta: {title: "首页", fullPath: "/product/productHome", noCache: true}
|
||||
// },
|
||||
{
|
||||
hidden: true,
|
||||
path: "baiduProduct",
|
||||
@ -414,13 +462,7 @@ export const asyncRoutes = [
|
||||
component: () => import('@/views/product/productHome/k8s/createK8s/index.vue'),
|
||||
name: 'superComputingDomestic',
|
||||
meta: { title: "容器云", fullPath: "/product/productHome/k8s/createK8s", noCache: true }
|
||||
}, // {
|
||||
//
|
||||
// path: "jdProduct",
|
||||
// component: () => import('@/views/product/productHome/jdProduct/index.vue'),
|
||||
// name: 'jdProduct',
|
||||
// meta: {title: "京东云", fullPath: "/product/jdProduct"}
|
||||
// },
|
||||
},
|
||||
{
|
||||
hidden: true,
|
||||
path: "productHome",
|
||||
@ -455,13 +497,6 @@ export const asyncRoutes = [
|
||||
meta: { title: "k8s", fullPath: "/product/productHome/k8s/createK8s", noCache: true }
|
||||
},
|
||||
|
||||
// {
|
||||
// hidden: true,
|
||||
// path: "jdProduct",
|
||||
// component: () => import('@/views/product/productHome/jdProduct/index.vue'),
|
||||
// name: 'jdProduct',
|
||||
// meta: {title: "京东产品列表", fullPath: "/product/jdProduct", noCache: true}
|
||||
// },
|
||||
{
|
||||
hidden: true,
|
||||
path: "capProduct",
|
||||
@ -606,13 +641,7 @@ export const asyncRoutes = [
|
||||
name: 'showUEip',
|
||||
meta: { title: "Eip列表", fullPath: "/product/productHome/ucloud/Eip/showUEip", noCache: true },
|
||||
}]
|
||||
}, // {
|
||||
// hidden: true,
|
||||
// path: "baiduProduct",
|
||||
// component: () => import('@/views/product/productHome/baiduProduct/index.vue'),
|
||||
// name: 'baiduProduct',
|
||||
// meta: {title: "百度产品列表", fullPath: "/product/baiduProduct", noCache: true}
|
||||
// },
|
||||
},
|
||||
{
|
||||
hidden: true,
|
||||
path: "baiduProductShow",
|
||||
@ -714,7 +743,6 @@ export const asyncRoutes = [
|
||||
},
|
||||
},
|
||||
|
||||
//网络
|
||||
//网络
|
||||
{
|
||||
hidden: true,
|
||||
@ -725,7 +753,8 @@ export const asyncRoutes = [
|
||||
title: "网络", fullPath: "/product/productHome/network/networkItem",
|
||||
},
|
||||
|
||||
}, //超算专用网络
|
||||
},
|
||||
//超算专用网络
|
||||
{
|
||||
hidden: true,
|
||||
path: "hypercomputingPrivateNetwork",
|
||||
@ -735,7 +764,8 @@ export const asyncRoutes = [
|
||||
title: "超算专用网络", fullPath: "/product/productHome/network/hypercomputingPrivateNetwork",
|
||||
},
|
||||
|
||||
}, //传输
|
||||
},
|
||||
//传输
|
||||
{
|
||||
hidden: true,
|
||||
path: "transmission",
|
||||
@ -751,192 +781,166 @@ export const asyncRoutes = [
|
||||
},
|
||||
|
||||
|
||||
// {
|
||||
// path: "/product",
|
||||
// component: Layout,
|
||||
// component: () => import("@/views/product"),
|
||||
// meta: { title: "产品", fullPath: "/product", icon: "el-icon-s-data", },
|
||||
// },
|
||||
// 客户
|
||||
{
|
||||
path: "/customer", component: Layout, redirect: "/customer/workOrderManagement", meta: {
|
||||
title: "客户", icon: "el-icon-s-custom", noCache: true, fullPath: "/customer",
|
||||
},
|
||||
children: [
|
||||
// 工单
|
||||
{
|
||||
path: "workOrderManagement",
|
||||
component: () => import("@/views/customer/workOrderManagement"),
|
||||
name: "WorkOrderManagement",
|
||||
meta: { title: "工单管理", fullPath: "/customer/workOrderManagement" },
|
||||
},
|
||||
// 退订
|
||||
{
|
||||
path: "unsubscribe",
|
||||
|
||||
component: () => import("@/views/customer/unsubscribe"),
|
||||
name: "Unsubscribe",
|
||||
meta: {
|
||||
title: "退订管理",
|
||||
alwaysShow: true
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "BaiduNetdisk",
|
||||
component: () => import("@/views/customer/unsubscribe/BaiduNetdisk.vue"),
|
||||
name: "BaiduNetdisk",
|
||||
meta: { title: "百度云" }
|
||||
},
|
||||
{
|
||||
path: "JDNetdisk", // 可选:默认子路由
|
||||
// component: () => import("@/views/customer/unsubscribe/JDNetdisk/index.vue"),
|
||||
name: "JDNetdisk",
|
||||
meta: { title: "其他" }
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
// 完善信息
|
||||
{
|
||||
path: 'approve',
|
||||
component: () => import('@/views/customer/ncApprove/index.vue'),
|
||||
name: "Approve",
|
||||
meta: { title: "信息完善", fullPath: "/customer/ncApprove" },
|
||||
},
|
||||
// 渠道管理
|
||||
{
|
||||
hidden: true,
|
||||
path: "channelMangement",
|
||||
component: () => import("@/views/customer/channelMangement/index.vue"),
|
||||
name: "ChannelMangement",
|
||||
meta: { title: "渠道管理", fullPath: "/customer/channelMangement" },
|
||||
},
|
||||
//渠道产品管理
|
||||
{
|
||||
hidden: true,
|
||||
path: "channelProductMangement",
|
||||
component: () => import("@/views/customer/channelMangement/channelProductMangement/index.vue"),
|
||||
name: "channelProductMangement",
|
||||
meta: { title: "渠道产品管理", fullPath: "/customer/channelMangement/channelProductMangement", noCache: true },
|
||||
},
|
||||
// 无权限
|
||||
{
|
||||
hidden: true,
|
||||
path: "noChannelPermission",
|
||||
component: () => import("@/views/customer/channelMangement/noChannelPermission/index.vue"),
|
||||
name: "noChannelPermission",
|
||||
meta: { title: "无权限", fullPath: "/customer/channelMangement/noChannelPermission", noCache: true },
|
||||
},
|
||||
// 聊天
|
||||
{
|
||||
hidden: true,
|
||||
path: "chat",
|
||||
component: () => import("@/views/product/productHome/chat/index.vue"),
|
||||
name: "chat",
|
||||
meta: {
|
||||
title: "聊天", fullPath: "/product/productHome/chat", noCache: true
|
||||
},
|
||||
},
|
||||
|
||||
// {
|
||||
// path: "workOrderManagement/mobile",
|
||||
// component: () => import("@/views/customer/mobile_workOrderManagement"),
|
||||
// name: "mobile_workOrderManagement",
|
||||
// meta: { title: "工单管理", fullPath: "/customer/workOrderManagement" , isMobile: true },
|
||||
// },
|
||||
|
||||
// 个人中心
|
||||
{
|
||||
hidden: true,
|
||||
path: "customerInformation",
|
||||
component: () => import("@/views/customer/customerInformation"),
|
||||
name: "customerInformation",
|
||||
meta: { title: "个人中心", fullPath: "/customer/customerInformation" },
|
||||
},
|
||||
// 充值管理
|
||||
{
|
||||
path: "rechargeRecord",
|
||||
component: () => import("@/views/customer/rechargeRecord"),
|
||||
name: "RechargeRecord",
|
||||
meta: { title: "充值管理", fullPath: "/customer/rechargeRecord" },
|
||||
},
|
||||
// 订单管理
|
||||
{
|
||||
path: "orderManagement",
|
||||
component: () => import("@/views/customer/orderManagement"),
|
||||
name: "OrderManagement",
|
||||
meta: { title: "产品订单", fullPath: "/customer/orderManagement", noCache: true, },
|
||||
},
|
||||
// 订单详情
|
||||
{
|
||||
path: "orderDetil",
|
||||
component: () => import("@/views/customer/orderDetil"),
|
||||
name: "orderDetil",
|
||||
hidden: true,
|
||||
meta: { title: "订单详情", fullPath: "/customer/orderDetil", noCache: true, },
|
||||
},
|
||||
// 促销邀请码
|
||||
{
|
||||
hidden: true,
|
||||
path: "promotionalInvitationCode",
|
||||
component: () => import("@/views/customer/promotionalInvitationCode"),
|
||||
name: "PromotionalInvitationCode",
|
||||
meta: { title: "促销邀请码", fullPath: "/customer/promotionalInvitationCode" },
|
||||
},
|
||||
|
||||
// {
|
||||
// path: "bpmn",
|
||||
// component: () =>
|
||||
// import(
|
||||
// "@/views/customer/bpmn"
|
||||
// ),
|
||||
// name: "bpmn",
|
||||
// meta: { title: "bpmn", fullPath: "/customer/bpmn" },
|
||||
// },
|
||||
// {
|
||||
// path: "panel",
|
||||
// component: () =>
|
||||
// import(
|
||||
// "@/views/customer/panel"
|
||||
// ),
|
||||
// name: "panel",
|
||||
// meta: { title: "panel", fullPath: "/customer/panel" },
|
||||
// },
|
||||
{
|
||||
path: "userResource", component: () => import(
|
||||
// "@/views/customer/userResource/iframeJiNan.vue"//iframe报错
|
||||
"@/views/customer/userResource"
|
||||
), name: "userResource", meta: { title: "资源实例", fullPath: "/customer/userResource", noCache: true },
|
||||
},
|
||||
{
|
||||
|
||||
path: "sshTerminal",
|
||||
component: () => import(
|
||||
// "@/views/customer/userResource/iframeJiNan.vue"//iframe报错
|
||||
"@/views/customer/userResource/SshTerminal.vue"
|
||||
),
|
||||
name: "sshTerminal",
|
||||
meta: { title: "ssh登录", fullPath: "/customer/SshTerminal", noCache: true },
|
||||
},
|
||||
|
||||
{
|
||||
hidden: true, path: "approvalRecord", component: () => import(
|
||||
// "@/views/customer/approvalRecord/iframeJiNan.vue"//iframe报错
|
||||
"@/views/customer/approvalRecord"
|
||||
), name: "approvalRecord", meta: { title: "审批记录", fullPath: "/customer/approvalRecord" },
|
||||
}, {
|
||||
path: "invoice",
|
||||
component: () => import("@/views/customer/invoice"),
|
||||
name: "Invoice",
|
||||
meta: { title: "发票管理", fullPath: "/customer/invoice" },
|
||||
}, {
|
||||
hidden: true,
|
||||
path: "productIndex",
|
||||
component: () => import("@/views/product/productHome/productIndex/index.vue"),
|
||||
name: "ProductIndex",
|
||||
meta: { title: "产品最新页", fullPath: "/product/productHome/productIndex", noCache: true },
|
||||
},],
|
||||
},
|
||||
// // 客户
|
||||
// {
|
||||
// path: "/customer", component: Layout, redirect: "/customer/workOrderManagement", meta: {
|
||||
// title: "客户", icon: "el-icon-s-custom", noCache: true, fullPath: "/customer",
|
||||
// },
|
||||
// children: [
|
||||
// // 工单
|
||||
// {
|
||||
// path: "workOrderManagement",
|
||||
// component: () => import("@/views/customer/workOrderManagement"),
|
||||
// name: "WorkOrderManagement",
|
||||
// meta: { title: "工单管理", fullPath: "/customer/workOrderManagement" },
|
||||
// },
|
||||
// // 退订
|
||||
// {
|
||||
// path: "unsubscribe",
|
||||
|
||||
// component: () => import("@/views/customer/unsubscribe"),
|
||||
// name: "Unsubscribe",
|
||||
// alwaysShow: true, // 确保父菜单始终显示
|
||||
// meta: {
|
||||
// title: "退订管理",
|
||||
// alwaysShow: true
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// path: "BaiduNetdisk",
|
||||
// component: () => import("@/views/customer/unsubscribe/BaiduNetdisk.vue"),
|
||||
// name: "BaiduNetdisk",
|
||||
// meta: { title: "百度云" }
|
||||
// },
|
||||
|
||||
|
||||
// ]
|
||||
// },
|
||||
// // 完善信息
|
||||
// {
|
||||
// path: 'approve',
|
||||
// component: () => import('@/views/customer/ncApprove/index.vue'),
|
||||
// name: "Approve",
|
||||
// meta: { title: "信息完善", fullPath: "/customer/ncApprove" },
|
||||
// },
|
||||
// // 渠道管理
|
||||
// {
|
||||
// hidden: true,
|
||||
// path: "channelMangement",
|
||||
// component: () => import("@/views/customer/channelMangement/index.vue"),
|
||||
// name: "ChannelMangement",
|
||||
// meta: { title: "渠道管理", fullPath: "/customer/channelMangement" },
|
||||
// },
|
||||
// //渠道产品管理
|
||||
// {
|
||||
// hidden: true,
|
||||
// path: "channelProductMangement",
|
||||
// component: () => import("@/views/customer/channelMangement/channelProductMangement/index.vue"),
|
||||
// name: "channelProductMangement",
|
||||
// meta: { title: "渠道产品管理", fullPath: "/customer/channelMangement/channelProductMangement", noCache: true },
|
||||
// },
|
||||
// // 无权限
|
||||
// {
|
||||
// hidden: true,
|
||||
// path: "noChannelPermission",
|
||||
// component: () => import("@/views/customer/channelMangement/noChannelPermission/index.vue"),
|
||||
// name: "noChannelPermission",
|
||||
// meta: { title: "无权限", fullPath: "/customer/channelMangement/noChannelPermission", noCache: true },
|
||||
// },
|
||||
// // 聊天
|
||||
// {
|
||||
// hidden: true,
|
||||
// path: "chat",
|
||||
// component: () => import("@/views/product/productHome/chat/index.vue"),
|
||||
// name: "chat",
|
||||
// meta: {
|
||||
// title: "聊天", fullPath: "/product/productHome/chat", noCache: true
|
||||
// },
|
||||
// },
|
||||
|
||||
// // 个人中心
|
||||
// {
|
||||
// hidden: true,
|
||||
// path: "customerInformation",
|
||||
// component: () => import("@/views/customer/customerInformation"),
|
||||
// name: "customerInformation",
|
||||
// meta: { title: "个人中心", fullPath: "/customer/customerInformation" },
|
||||
// },
|
||||
// // 充值管理
|
||||
// {
|
||||
// path: "rechargeRecord",
|
||||
// component: () => import("@/views/customer/rechargeRecord"),
|
||||
// name: "RechargeRecord",
|
||||
// meta: { title: "充值管理", fullPath: "/customer/rechargeRecord" },
|
||||
// },
|
||||
// // 订单管理
|
||||
// {
|
||||
// path: "orderManagement",
|
||||
// component: () => import("@/views/customer/orderManagement"),
|
||||
// name: "OrderManagement",
|
||||
// meta: { title: "产品订单", fullPath: "/customer/orderManagement", noCache: true, },
|
||||
// },
|
||||
// // 订单详情
|
||||
// {
|
||||
// path: "orderDetil",
|
||||
// component: () => import("@/views/customer/orderDetil"),
|
||||
// name: "orderDetil",
|
||||
// hidden: true,
|
||||
// meta: { title: "订单详情", fullPath: "/customer/orderDetil", noCache: true, },
|
||||
// },
|
||||
// // 促销邀请码
|
||||
// {
|
||||
// hidden: true,
|
||||
// path: "promotionalInvitationCode",
|
||||
// component: () => import("@/views/customer/promotionalInvitationCode"),
|
||||
// name: "PromotionalInvitationCode",
|
||||
// meta: { title: "促销邀请码", fullPath: "/customer/promotionalInvitationCode" },
|
||||
// },
|
||||
|
||||
// // 资源示例
|
||||
// {
|
||||
// path: "userResource", component: () => import(
|
||||
// // "@/views/customer/userResource/iframeJiNan.vue"//iframe报错
|
||||
// "@/views/customer/userResource"
|
||||
// ), name: "userResource", meta: { title: "资源实例", fullPath: "/customer/userResource", noCache: true },
|
||||
// },
|
||||
// // ssh登录
|
||||
// {
|
||||
|
||||
// path: "sshTerminal",
|
||||
// component: () => import(
|
||||
// // "@/views/customer/userResource/iframeJiNan.vue"//iframe报错
|
||||
// "@/views/customer/userResource/SshTerminal.vue"
|
||||
// ),
|
||||
// name: "sshTerminal",
|
||||
// meta: { title: "ssh登录", fullPath: "/customer/SshTerminal", noCache: true },
|
||||
// },
|
||||
// // 审批记录
|
||||
// {
|
||||
// hidden: true, path: "approvalRecord", component: () => import(
|
||||
// // "@/views/customer/approvalRecord/iframeJiNan.vue"//iframe报错
|
||||
// "@/views/customer/approvalRecord"
|
||||
// ), name: "approvalRecord", meta: { title: "审批记录", fullPath: "/customer/approvalRecord" },
|
||||
// },
|
||||
// // 发票管理
|
||||
// {
|
||||
// path: "invoice",
|
||||
// component: () => import("@/views/customer/invoice"),
|
||||
// name: "Invoice",
|
||||
// meta: { title: "发票管理", fullPath: "/customer/invoice" },
|
||||
// },
|
||||
// // 产品最新页
|
||||
// {
|
||||
// hidden: true,
|
||||
// path: "productIndex",
|
||||
// component: () => import("@/views/product/productHome/productIndex/index.vue"),
|
||||
// name: "ProductIndex",
|
||||
// meta: { title: "产品最新页", fullPath: "/product/productHome/productIndex", noCache: true },
|
||||
// },],
|
||||
// },
|
||||
// 资质审核
|
||||
{
|
||||
path: "/qualificationReview",
|
||||
@ -983,7 +987,7 @@ export const asyncRoutes = [
|
||||
|
||||
]
|
||||
},
|
||||
// 需求管理 - 移动到商品管理上方
|
||||
// 需求管理
|
||||
{
|
||||
path: "/demandMangement",
|
||||
component: Layout,
|
||||
@ -1570,15 +1574,6 @@ export const asyncRoutes = [
|
||||
}
|
||||
},
|
||||
|
||||
// {
|
||||
// path: "approvalBusinessConfig",
|
||||
// component: () => import("@/views/operation/approval/approveBusinessConfig"),
|
||||
// name: "approvalBusinessConfig",
|
||||
// meta: {
|
||||
// title: "业务模板配置",
|
||||
// fullPath: "/operation/approval/approveBusinessConfig"
|
||||
// }
|
||||
// },
|
||||
{
|
||||
path: "approvalConfig",
|
||||
component: () => import("@/views/operation/approval/approvalConfig"),
|
||||
@ -1624,7 +1619,7 @@ export const asyncRoutes = [
|
||||
meta: {
|
||||
title: "产品供应", fullPath: "/operationAndMaintenance/productSupply", noCache: true
|
||||
},
|
||||
},{
|
||||
}, {
|
||||
path: "envDeployment",
|
||||
component: () => import("@/views/operationAndMaintenance/envDeployment"),
|
||||
name: "envDeployment",
|
||||
@ -1632,7 +1627,7 @@ export const asyncRoutes = [
|
||||
title: "环境部署", fullPath: "/operationAndMaintenance/envDeployment", noCache: true
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
@ -1665,13 +1660,7 @@ export const asyncRoutes = [
|
||||
component: () => import("@/views/endDay/supplierSettlementStatistics"),
|
||||
name: "supplierSettlementStatistics",
|
||||
meta: { title: "供应商结算统计", fullPath: "/endDay/supplierSettlementStatistics" },
|
||||
}, // {
|
||||
// path: "supplierSettlementStatistics/mobile",
|
||||
// component: () =>
|
||||
// import("@/views/endDay/mobile_supplierSettlementStatistics"),
|
||||
// name: "mbile_supplierSettlementStatistics",
|
||||
// meta: { title: "供应商结算统计", fullPath: "/endDay/supplierSettlementStatistics", isMobile: true },
|
||||
// },
|
||||
},
|
||||
{
|
||||
path: "customerRechargeManagement",
|
||||
component: () => import("@/views/finance/customerRechargeManagement"),
|
||||
@ -1685,19 +1674,7 @@ export const asyncRoutes = [
|
||||
), name: "CustomersRechargeOnffline", meta: {
|
||||
title: "客户线下充值入账", fullPath: "/finance/customerRechargeManagement/customersRechargeOnffline",
|
||||
},
|
||||
}, // {
|
||||
// path: "customersRechargeOnline",
|
||||
// component: () =>
|
||||
// import(
|
||||
// "@/views/finance/customerRechargeManagement/customersRechargeOnline"
|
||||
// ),
|
||||
// name: "CustomersRechargeOnline",
|
||||
// meta: {
|
||||
// title: "客户线上充值核对入账",
|
||||
// fullPath:
|
||||
// "/finance/customerRechargeManagement/customersRechargeOnline",
|
||||
// },
|
||||
// },
|
||||
},
|
||||
],
|
||||
}, {
|
||||
path: "financialAnalysis",
|
||||
@ -1709,27 +1686,6 @@ export const asyncRoutes = [
|
||||
],
|
||||
},
|
||||
|
||||
// {
|
||||
// path: "/mobile/finance",
|
||||
// component: Layout,
|
||||
// redirect: "/mobile/finance",
|
||||
// meta: {
|
||||
// title: "财务",
|
||||
// icon: "el-icon-s-data",
|
||||
// noCache: true,
|
||||
// fullPath: "/mobile/finance",
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// path: "supplierSettlementStatistics",
|
||||
// component: () =>
|
||||
// import("@/views/endDay/mobile_supplierSettlementStatistics"),
|
||||
// name: "obile_supplierSettlementStatistics",
|
||||
// meta: { title: "供应商结算统计", fullPath: "/endDay/supplierSettlementStatistics" },
|
||||
// },
|
||||
//
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
path: "/superAdministrator", component: Layout, redirect: "/superAdministrator/index", meta: {
|
||||
title: "超级管理员", icon: "el-icon-user-solid", noCache: true, fullPath: "/superAdministrator",
|
||||
@ -1773,27 +1729,27 @@ export const asyncRoutes = [
|
||||
title: "企业管理", icon: "el-icon-s-tools", noCache: true, fullPath: "/administrator",
|
||||
}, children: [
|
||||
{
|
||||
path: "departmentManagement",
|
||||
component: () => import("@/views/administrator/departmentManagement"),
|
||||
name: "epartmentManagement",
|
||||
meta: {
|
||||
title: "部门管理", fullPath: "/administrator/departmentManagement",
|
||||
},
|
||||
},{
|
||||
path: "configureOrganizationUserRole",
|
||||
component: () => import("@/views/administrator/configureOrganizationUserRole"),
|
||||
name: "ConfigureOrganizationUserRole",
|
||||
meta: {
|
||||
title: "角色管理", fullPath: "/administrator/configureOrganizationUserRole",
|
||||
},
|
||||
}, {
|
||||
path: "stationMessageSettings",
|
||||
component: () => import("@/views/administrator/stationMessageSettings"),
|
||||
name: "StationMessageSettings",
|
||||
meta: {
|
||||
title: "站内信设置", fullPath: "/administrator/stationMessageSettings",
|
||||
},
|
||||
},],
|
||||
path: "departmentManagement",
|
||||
component: () => import("@/views/administrator/departmentManagement"),
|
||||
name: "epartmentManagement",
|
||||
meta: {
|
||||
title: "部门管理", fullPath: "/administrator/departmentManagement",
|
||||
},
|
||||
}, {
|
||||
path: "configureOrganizationUserRole",
|
||||
component: () => import("@/views/administrator/configureOrganizationUserRole"),
|
||||
name: "ConfigureOrganizationUserRole",
|
||||
meta: {
|
||||
title: "角色管理", fullPath: "/administrator/configureOrganizationUserRole",
|
||||
},
|
||||
}, {
|
||||
path: "stationMessageSettings",
|
||||
component: () => import("@/views/administrator/stationMessageSettings"),
|
||||
name: "StationMessageSettings",
|
||||
meta: {
|
||||
title: "站内信设置", fullPath: "/administrator/stationMessageSettings",
|
||||
},
|
||||
},],
|
||||
}, {
|
||||
path: "/management",
|
||||
hidden: true,
|
||||
@ -1875,21 +1831,12 @@ export const asyncRoutes = [
|
||||
meta: { title: "日末", fullPath: "/endDay/endDay" },
|
||||
},
|
||||
|
||||
// {
|
||||
// path: "xterm",
|
||||
// component: () =>
|
||||
// import("@/views/endDay/xterm"),
|
||||
// hidden: true,
|
||||
// name: "xterm",
|
||||
// meta: {title: "xterm", fullPath: "/endDay/xterm"},
|
||||
// },
|
||||
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
path: "*", redirect: "/404", hidden: true,
|
||||
},];
|
||||
},];
|
||||
|
||||
|
||||
const createRouter = () => new Router({
|
||||
|
||||
@ -12,6 +12,8 @@ const getters = {
|
||||
auths: state => state.user.auths,
|
||||
requestCode: state => state.user.requestCode,
|
||||
permission_routes: state => state.permission.routes,
|
||||
// 新增:用户类型getter
|
||||
userType: state => state.user.userType,
|
||||
// errorLogs: state => state.errorLog.logs,
|
||||
}
|
||||
export default getters
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { asyncRoutes, constantRoutes } from "@/router";
|
||||
import path from "path";
|
||||
|
||||
// 获取用户代理字符串
|
||||
const userAgent = window.navigator.userAgent;
|
||||
@ -7,32 +6,58 @@ const userAgent = window.navigator.userAgent;
|
||||
// 判断是否为移动设备
|
||||
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
|
||||
|
||||
function filterAsyncRoutes(data, values) {
|
||||
return data.reduce((filteredData, item) => {
|
||||
if (item.meta && item.meta.fullPath) {
|
||||
if (values.includes(item.meta.fullPath)) {
|
||||
const newItem = {
|
||||
...item,
|
||||
};
|
||||
// if (item.children && item.children.length > 0) {
|
||||
// newItem.children = filterAsyncRoutes(item.children, values);
|
||||
// }
|
||||
filteredData.push(newItem);
|
||||
} else if (item.children && item.children.length > 0) {
|
||||
const filteredChildren = filterAsyncRoutes(item.children, values);
|
||||
if (filteredChildren.length > 0) {
|
||||
const newItem = {
|
||||
...item,
|
||||
children: filteredChildren,
|
||||
};
|
||||
filteredData.push(newItem);
|
||||
}
|
||||
}
|
||||
return filteredData;
|
||||
} else {
|
||||
return filteredData;
|
||||
// 修复:更全面的路由过滤逻辑
|
||||
function filterAsyncRoutes(routes, permissions) {
|
||||
const res = [];
|
||||
routes.forEach(route => {
|
||||
// 创建路由副本
|
||||
const tmpRoute = { ...route };
|
||||
|
||||
// 检查当前路由是否在权限列表中
|
||||
const hasPermission = permissions.some(p => p.path === route.meta?.fullPath);
|
||||
|
||||
// 如果当前路由有权限,则加入结果
|
||||
if (hasPermission) {
|
||||
res.push(tmpRoute);
|
||||
}
|
||||
}, []);
|
||||
// 如果没有直接权限,但有子路由,递归处理子路由
|
||||
else if (tmpRoute.children) {
|
||||
const filteredChildren = filterAsyncRoutes(tmpRoute.children, permissions);
|
||||
if (filteredChildren.length > 0) {
|
||||
tmpRoute.children = filteredChildren;
|
||||
res.push(tmpRoute); // 即使父路由本身没有权限,只要有子路由有权限,也要保留父路由
|
||||
}
|
||||
}
|
||||
// 如果当前路由既没有权限,也没有有权限的子路由,则不添加到结果中
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
// 新增:为普通用户添加订单管理和资源管理路由
|
||||
function addUserRoutes(routes, userType) {
|
||||
console.log("addUserRoutes - userType:", userType);
|
||||
|
||||
// 如果是普通用户(非管理员),添加订单管理和资源管理路由
|
||||
if (userType === 'user') {
|
||||
const orderManagementRoute = routes.find(route => route.path === "/orderManagement");
|
||||
const resourceManagementRoute = routes.find(route => route.path === "/resourceManagement");
|
||||
|
||||
const userRoutes = [];
|
||||
|
||||
if (orderManagementRoute) {
|
||||
console.log("添加订单管理路由");
|
||||
userRoutes.push(orderManagementRoute);
|
||||
}
|
||||
|
||||
if (resourceManagementRoute) {
|
||||
console.log("添加资源管理路由");
|
||||
userRoutes.push(resourceManagementRoute);
|
||||
}
|
||||
|
||||
return userRoutes;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
function filterRoutesMobile(routes) {
|
||||
@ -41,20 +66,21 @@ function filterRoutesMobile(routes) {
|
||||
route.children = filterRoutesMobile(route.children);
|
||||
return route.children.length > 0;
|
||||
}
|
||||
if (route.meta.isMobile || route.meta.isMobile == true) {
|
||||
if (route.meta?.isMobile || route.meta?.isMobile === true) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function filterRoutesPc(routes) {
|
||||
return routes.filter(route => {
|
||||
if (route.children && route.children.length) {
|
||||
route.children = filterRoutesPc(route.children);
|
||||
return route.children.length > 0;
|
||||
}
|
||||
if (!route.meta.isMobile || route.meta.isMobile == false) {
|
||||
if (!route.meta?.isMobile || route.meta?.isMobile === false) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -70,48 +96,64 @@ const state = {
|
||||
|
||||
const mutations = {
|
||||
SET_ROUTES: (state, routes) => {
|
||||
// console.log(state, routes);
|
||||
console.log("MUTATION SET_ROUTES - received routes:", routes);
|
||||
state.addRoutes = routes;
|
||||
sessionStorage.setItem("routes", JSON.stringify(routes));
|
||||
state.routes = constantRoutes.concat(routes);
|
||||
console.log("MUTATION SET_ROUTES - final state.routes:", state.routes);
|
||||
},
|
||||
SETUSERS: (state, user) => {
|
||||
state.users = user
|
||||
state.users = user;
|
||||
}
|
||||
};
|
||||
|
||||
const actions = {
|
||||
generateRoutes({ commit }, params) {
|
||||
// console.log("paramsdispatch:", params);
|
||||
// console.log("commit:", commit);
|
||||
console.log("ACTION generateRoutes - params:", params);
|
||||
return new Promise((resolve) => {
|
||||
let accessedRoutes;
|
||||
// let filterRoutes;
|
||||
|
||||
// 判断用户类型:admin为1是管理员,否则是普通用户
|
||||
const userType = params.admin == 1 ? 'admin' : 'user';
|
||||
console.log("用户类型:", userType);
|
||||
|
||||
if (params.user.includes("admin") && params.admin == 1) {
|
||||
const routes = asyncRoutes.filter((item => { return item.path == '/superAdministrator' }));
|
||||
accessedRoutes = routes;
|
||||
// 管理员:只显示超级管理员菜单
|
||||
accessedRoutes = asyncRoutes.filter(item => item.path === '/superAdministrator');
|
||||
} else {
|
||||
const auths = JSON.parse(JSON.stringify(params.auths));
|
||||
console.log("ACTION generateRoutes - auths:", auths);
|
||||
|
||||
if (auths.length) {
|
||||
// 确保 auths 中的 path 与路由 meta.fullPath 匹配
|
||||
const paths = auths.map((item) => {
|
||||
return item.path;
|
||||
});
|
||||
if (!paths.includes("")) {
|
||||
accessedRoutes = filterAsyncRoutes(asyncRoutes, paths);
|
||||
} else {
|
||||
console.log("ACTION generateRoutes - paths from auths:", paths);
|
||||
|
||||
if (paths.includes("")) {
|
||||
// 如果权限列表包含空路径,认为用户有所有权限
|
||||
accessedRoutes = asyncRoutes || [];
|
||||
} else {
|
||||
// 使用修复后的过滤函数
|
||||
accessedRoutes = filterAsyncRoutes(asyncRoutes, auths);
|
||||
}
|
||||
} else {
|
||||
accessedRoutes = asyncRoutes || [];
|
||||
// 如果没有权限列表,不显示任何动态路由
|
||||
accessedRoutes = [];
|
||||
}
|
||||
|
||||
// 新增:为普通用户添加订单管理和资源管理路由
|
||||
if (userType === 'user') {
|
||||
console.log("为普通用户添加订单管理和资源管理路由");
|
||||
const userSpecificRoutes = addUserRoutes(asyncRoutes, userType);
|
||||
accessedRoutes = [...accessedRoutes, ...userSpecificRoutes];
|
||||
console.log("添加用户特定路由后的accessedRoutes:", accessedRoutes);
|
||||
}
|
||||
}
|
||||
// debugger
|
||||
// if (isMobile) {
|
||||
// filterRoutes = filterRoutesMobile(accessedRoutes)
|
||||
// } else {
|
||||
// filterRoutes = filterRoutesPc(accessedRoutes)
|
||||
// }
|
||||
// console.log(filterRoutes)
|
||||
|
||||
console.log("ACTION generateRoutes - calculated accessedRoutes:", accessedRoutes);
|
||||
|
||||
commit("SET_ROUTES", accessedRoutes);
|
||||
resolve(accessedRoutes);
|
||||
});
|
||||
|
||||
@ -19,7 +19,9 @@ const state = {
|
||||
// 当前状态码
|
||||
requestCode: 200,
|
||||
//客户余额
|
||||
mybalance: ''
|
||||
mybalance: '',
|
||||
// 新增:用户类型(admin/user)
|
||||
userType: ''
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
@ -48,6 +50,11 @@ const mutations = {
|
||||
},
|
||||
SETMYBANLANCE(state, mybalance) {
|
||||
state.mybalance = mybalance
|
||||
},
|
||||
// 新增:设置用户类型
|
||||
SET_USER_TYPE: (state, userType) => {
|
||||
state.userType = userType;
|
||||
sessionStorage.setItem("userType", userType);
|
||||
}
|
||||
};
|
||||
|
||||
@ -77,6 +84,12 @@ const actions = {
|
||||
} else {
|
||||
const {data, admin} = response;
|
||||
commit("SET_USER", username);
|
||||
|
||||
// 新增:设置用户类型
|
||||
const userType = admin == 1 ? 'admin' : 'user';
|
||||
commit("SET_USER_TYPE", userType);
|
||||
console.log("登录用户类型:", userType);
|
||||
|
||||
data ? commit("SET_AUTHS", data) : commit("SET_AUTHS", []);
|
||||
const accessRoutes = await store.dispatch(
|
||||
"permission/generateRoutes",
|
||||
@ -131,6 +144,7 @@ const actions = {
|
||||
.then(() => {
|
||||
commit("SET_TOKEN", "");
|
||||
commit("SET_ROLES", []);
|
||||
commit("SET_USER_TYPE", ""); // 新增:清除用户类型
|
||||
removeToken();
|
||||
resetRouter();
|
||||
|
||||
@ -144,6 +158,7 @@ const actions = {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
// remove token
|
||||
@ -151,6 +166,7 @@ const actions = {
|
||||
return new Promise((resolve) => {
|
||||
commit("SET_TOKEN", "");
|
||||
commit("SET_ROLES", []);
|
||||
commit("SET_USER_TYPE", ""); // 新增:清除用户类型
|
||||
removeToken();
|
||||
resolve();
|
||||
});
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
京东云 (测试menu)
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
||||
@ -215,8 +215,9 @@
|
||||
<!-- 分隔线 -->
|
||||
<span class="ge"></span>
|
||||
<!-- 左侧面板:三级菜单(如果存在且不等于二级菜单标题) -->
|
||||
<!-- 修复:添加安全判断 -->
|
||||
<div
|
||||
v-if="secMenuData[0].thrMenu[0].thrTitle != null && secMenuData[0].secTitle !== secMenuData[0].thrMenu[0].thrTitle"
|
||||
v-if="secMenuData.length > 0 && secMenuData[0].thrMenu && secMenuData[0].thrMenu.length > 0 && secMenuData[0].thrMenu[0].thrTitle != null && secMenuData[0].secTitle !== secMenuData[0].thrMenu[0].thrTitle"
|
||||
class="panelLeft">
|
||||
<ul>
|
||||
<li style="font-size: 14px!important;" @mouseenter="sildeThrMenu(thr)" v-for="(thr, index) in threeData"
|
||||
@ -226,11 +227,13 @@
|
||||
</ul>
|
||||
</div>
|
||||
<!-- 分隔线 -->
|
||||
<!-- 修复:添加安全判断 -->
|
||||
<span
|
||||
v-if="secMenuData[0].thrMenu[0].thrTitle != null && secMenuData[0].secTitle !== secMenuData[0].thrMenu[0].thrTitle"
|
||||
v-if="secMenuData.length > 0 && secMenuData[0].thrMenu && secMenuData[0].thrMenu.length > 0 && secMenuData[0].thrMenu[0].thrTitle != null && secMenuData[0].secTitle !== secMenuData[0].thrMenu[0].thrTitle"
|
||||
class="ge"></span>
|
||||
<!-- 右侧面板:最细粒度的菜单项 -->
|
||||
<div class="panelRight">
|
||||
<!-- 修复:添加安全判断 -->
|
||||
<div class="panelRight" v-if="showPanelRightData.length > 0 && showPanelRightData[0] && showPanelRightData[0].value">
|
||||
<ul class="leastMenu inBox">
|
||||
<li class="clickItem" style="font-size: 14px!important;margin: 8px 0;cursor: pointer"
|
||||
v-for="itemR in showPanelRightData[0].value" :key="itemR.id" @click="clickGo(itemR)">
|
||||
@ -239,6 +242,12 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- 修复:当没有数据时显示空状态 -->
|
||||
<div class="panelRight" v-else>
|
||||
<div style="text-align: center; color: #999; padding: 20px;">
|
||||
暂无数据
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -620,7 +629,7 @@ export default Vue.extend({
|
||||
},
|
||||
// 改变面板数据
|
||||
changeData(data) {
|
||||
this.showPanelData = data
|
||||
this.showPanelData = data || []
|
||||
|
||||
// 更安全的初始化方式
|
||||
this.secMenuData = data?.[0]?.secMenu || []
|
||||
@ -658,6 +667,8 @@ export default Vue.extend({
|
||||
}).catch(error => {
|
||||
console.error("获取导航数据失败:", error)
|
||||
// 可以设置一些默认数据或显示错误信息
|
||||
this.product_service = []
|
||||
this.changeData([])
|
||||
})
|
||||
},
|
||||
// 构建导航数据结构
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
@navigate="handleNavigation"
|
||||
:show-threshold-element-selector="'.tagUl'"
|
||||
:show-offset="0"
|
||||
id="sticky"
|
||||
></HomePageSticky>
|
||||
|
||||
<div id="banner" class="banner">
|
||||
@ -414,6 +415,17 @@ export default Vue.extend({
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 监听滚动 控制sticky显示隐藏
|
||||
document.getElementById("homeOut").addEventListener('scroll', (e) =>{
|
||||
|
||||
// console.log("滚动条事件",e.target.scrollTop);
|
||||
if (e.target.scrollTop > 500) {
|
||||
document.getElementById('sticky').style.display = 'block'
|
||||
} else {
|
||||
document.getElementById('sticky').style.display = 'none'
|
||||
}
|
||||
|
||||
})
|
||||
this.initData()
|
||||
},
|
||||
computed: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user