子系统标题

main
许宏杰 3 weeks ago
parent 44d7207ccf
commit 4ca953802c

@ -1,53 +1,64 @@
<template> <template>
<div class="sidebar-logo-container" :class="{ 'collapse': collapse }"> <div class="sidebar-logo-container" :class="{ collapse: collapse }">
<transition name="sidebarLogoFade"> <transition name="sidebarLogoFade">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/"> <router-link
v-if="collapse"
key="collapse"
class="sidebar-logo-link"
to="/"
>
<img v-if="logo" :src="logo" class="sidebar-logo" /> <img v-if="logo" :src="logo" class="sidebar-logo" />
<h1 v-else class="sidebar-title">{{ title }}</h1> <h1 v-else class="sidebar-title">{{ title }}</h1>
</router-link> </router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/"> <router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" /> <!-- <img v-if="logo" :src="logo" class="sidebar-logo" /> -->
<h1 class="sidebar-title">{{ title }}</h1> <h1 class="sidebar-title">{{ getLogoName }}</h1>
</router-link> </router-link>
</transition> </transition>
</div> </div>
</template> </template>
<script setup> <script setup>
import logo from '@/assets/logo/logo.png' import logo from "@/assets/logo/logo.png";
import useSettingsStore from '@/store/modules/settings' import useSettingsStore from "@/store/modules/settings";
import variables from '@/assets/styles/variables.module.scss' import variables from "@/assets/styles/variables.module.scss";
const { proxy } = getCurrentInstance();
defineProps({ defineProps({
collapse: { collapse: {
type: Boolean, type: Boolean,
required: true required: true,
} },
}) });
const title = import.meta.env.VITE_APP_TITLE const title = import.meta.env.VITE_APP_TITLE;
const settingsStore = useSettingsStore() const settingsStore = useSettingsStore();
const sideTheme = computed(() => settingsStore.sideTheme) const sideTheme = computed(() => settingsStore.sideTheme);
// Logo // Logo
const getLogoBackground = computed(() => { const getLogoBackground = computed(() => {
if (settingsStore.isDark) { if (settingsStore.isDark) {
return 'var(--sidebar-bg)' return "var(--sidebar-bg)";
} }
return sideTheme.value === 'theme-dark' ? variables.menuBg : variables.menuLightBg return sideTheme.value === "theme-dark"
}) ? variables.menuBg
: variables.menuLightBg;
});
// Logo // Logo
const getLogoTextColor = computed(() => { const getLogoTextColor = computed(() => {
if (settingsStore.isDark) { if (settingsStore.isDark) {
return 'var(--sidebar-text)' return "var(--sidebar-text)";
} }
return sideTheme.value === 'theme-dark' ? '#fff' : variables.menuLightText return sideTheme.value === "theme-dark" ? "#fff" : variables.menuLightText;
}) });
const getLogoName = computed(() => {
return proxy.$cache.local.get("systemName");
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/assets/styles/variables.module.scss'; @import "@/assets/styles/variables.module.scss";
.sidebarLogoFade-enter-active { .sidebarLogoFade-enter-active {
transition: opacity 1.5s; transition: opacity 1.5s;
@ -64,7 +75,7 @@ const getLogoTextColor = computed(() => {
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;
// background: v-bind(getLogoBackground); // background: v-bind(getLogoBackground);
background: #537CF7; background: #537cf7;
text-align: center; text-align: center;
overflow: hidden; overflow: hidden;
@ -85,8 +96,10 @@ const getLogoTextColor = computed(() => {
color: v-bind(getLogoTextColor); color: v-bind(getLogoTextColor);
font-weight: 600; font-weight: 600;
line-height: 50px; line-height: 50px;
font-size: 14px;
font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif; font-size: 18px;
font-weight: bold;
font-family: "Alimama ShuHeiTi-Bold";
vertical-align: middle; vertical-align: middle;
} }
} }

@ -27,7 +27,7 @@
class="menu-item" class="menu-item"
v-for="(item, index) in topMenus" v-for="(item, index) in topMenus"
:key="index" :key="index"
@click="handleSelect(item.path)" @click="handleSelect(item.path,item.meta.title)"
> >
<div class="system-type div-flex-center"> <div class="system-type div-flex-center">
<div class="type-box div-flex-center"> <div class="type-box div-flex-center">
@ -74,7 +74,7 @@ const router = useRouter();
* 点击菜单 * 点击菜单
* @param key * @param key
*/ */
function handleSelect(key) { function handleSelect(key,title) {
if (disableList.includes(key)) { if (disableList.includes(key)) {
proxy.$modal.msgWarning("功能开发中,敬请期待"); proxy.$modal.msgWarning("功能开发中,敬请期待");
return; return;
@ -94,8 +94,8 @@ function handleSelect(key) {
// //
const currentChildRoter = activeRoutes(key); const currentChildRoter = activeRoutes(key);
appStore.toggleSideBarHide(false); appStore.toggleSideBarHide(false);
if (currentChildRoter.length > 0) { if (currentChildRoter.length > 0) {
proxy.$cache.local.set('systemName', title)
router.push({ path: currentChildRoter[0].path }); router.push({ path: currentChildRoter[0].path });
} }
} }

Loading…
Cancel
Save