feat: 监测9408端口自动开启 TopNav、侧栏改为政务蓝色

This commit is contained in:
Tony 2024-07-12 15:04:28 +08:00
parent 1f32221195
commit 13c837a8eb
3 changed files with 61 additions and 8 deletions

View File

@ -1,5 +1,11 @@
<template>
<div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
<div
class="sidebar-logo-container"
:class="{'collapse':collapse}"
:style="{
backgroundColor: sideTheme === 'theme-dark' ? CJCXBgColor : variables.menuLightBackground
}"
>
<transition name="sidebarLogoFade">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
@ -7,7 +13,12 @@
</router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
<h1
class="sidebar-title"
:style="{
color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor
}"
>{{ title }}</h1>
</router-link>
</transition>
</div>
@ -31,6 +42,9 @@ export default {
},
sideTheme() {
return this.$store.state.settings.sideTheme
},
CJCXBgColor() {
return this.isCJCXPro ? '#003e92' : this.variables.menuBackground
}
},
mounted() {
@ -162,7 +176,8 @@ export default {
data() {
return {
title: process.env.VUE_APP_TITLE,
logo: ''
logo: '',
isCJCXPro: window.location.port === '9408'
}
}
}

View File

@ -2,7 +2,10 @@
<div v-if="!item.hidden">
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path, onlyOneChild.query)">
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
<el-menu-item
:index="resolvePath(onlyOneChild.path)"
:class="{ 'submenu-title-noDropdown': !isNest }"
>
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
</el-menu-item>
</app-link>
@ -18,7 +21,6 @@
:is-nest="true"
:item="child"
:base-path="resolvePath(child.path)"
class="nest-menu"
/>
</el-submenu>
</div>
@ -50,9 +52,16 @@ export default {
default: ''
}
},
computed: {
CJCXBgColor() {
return this.isCJCXPro ? 'cjcx-bg' : ''
}
},
data() {
this.onlyOneChild = null
return {}
return {
isCJCXPro: window.location.port === '9408'
}
},
methods: {
hasOneShowingChild(children = [], parent) {
@ -98,3 +107,8 @@ export default {
}
}
</script>
<style>
.cjcx-bg {
background-color: #003e92 !important;
}
</style>

View File

@ -1,11 +1,16 @@
<template>
<div :class="{'has-logo':showLogo}" :style="{ backgroundColor: settings.sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
<div
:class="{'has-logo':showLogo}"
:style="{
backgroundColor: settings.sideTheme === 'theme-dark' ? CJCXBgColor : variables.menuLightBackground
}"
>
<logo v-if="showLogo" :collapse="isCollapse" />
<el-scrollbar :class="settings.sideTheme" wrap-class="scrollbar-wrapper">
<el-menu
:default-active="activeMenu"
:collapse="isCollapse"
:background-color="settings.sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground"
:background-color="settings.sideTheme === 'theme-dark' ? CJCXBgColor : variables.menuLightBackground"
:text-color="settings.sideTheme === 'theme-dark' ? variables.menuColor : variables.menuLightColor"
:unique-opened="true"
:active-text-color="settings.theme"
@ -31,6 +36,22 @@ import variables from "@/assets/styles/variables.scss";
export default {
components: { SidebarItem, Logo },
data() {
return {
isCJCXPro: window.location.port === '9408'
}
},
created() {
const val = true
this.$store.dispatch('settings/changeSetting', {
key: 'topNav',
value: val
})
if (!val) {
this.$store.dispatch('app/toggleSideBarHide', false);
this.$store.commit("SET_SIDEBAR_ROUTERS", this.$store.state.permission.defaultRoutes);
}
},
computed: {
...mapState(["settings"]),
...mapGetters(["sidebarRouters", "sidebar"]),
@ -51,6 +72,9 @@ export default {
},
isCollapse() {
return !this.sidebar.opened;
},
CJCXBgColor() {
return this.isCJCXPro ? '#003e92' : this.variables.menuBackground
}
}
};