From 1c829f9177eab675b22be4d20ef2761ed1bbb423 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 15 九月 2026 16:15:48 +0800
Subject: [PATCH] refactor(layout): 调整布局样式并优化轮播卡片组件

---
 src/layout/components/Sidebar/Logo.vue |  251 ++++++++++++++++++++++++-------------------------
 1 files changed, 122 insertions(+), 129 deletions(-)

diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue
index f8f1da3..eba3890 100644
--- a/src/layout/components/Sidebar/Logo.vue
+++ b/src/layout/components/Sidebar/Logo.vue
@@ -1,129 +1,122 @@
-<template>
-  <div class="sidebar-logo-container" :class="{ 'collapse': collapse }">
-    <transition name="sidebarLogoFade">
-      <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
-        <img v-if="logoUrl" :src="logoUrl" class="sidebar-logo" @error="handleImageError" alt="鍏徃Logo" />
-        <h1 class="sidebar-title">{{ title }}</h1>
-      </router-link>
-      <router-link v-else key="expand" class="sidebar-logo-link" to="/">
-        <img v-if="logoUrl" :src="logoUrl" class="sidebar-logo" @error="handleImageError" alt="鍏徃Logo" />
-        <h1 class="sidebar-title">{{ title }}</h1>
-      </router-link>
-    </transition>
-  </div>
-</template>
-
-<script setup>
-import { ref, computed, onMounted, watch } from 'vue'
-import useUserStore from '@/store/modules/user'
-import defaultLogo from '@/assets/logo/logo.png' // 瀵煎叆榛樿logo
-
-defineProps({
-  collapse: {
-    type: Boolean,
-    required: true
-  }
-})
-
-const title = import.meta.env.VITE_APP_TITLE
-const userStore = useUserStore()
-
-// 澶勭悊宸ュ巶鍚嶇О锛岀敓鎴愬悎娉曠殑鏂囦欢鍚�
-const cleanFactoryName = computed(() => {
-  if (!userStore.currentFactoryName) return ''
-  return userStore.currentFactoryName.trim()
-})
-
-// 鍔ㄦ�乴ogo璺緞
-const logoUrl = ref('')
-
-// 妫�鏌ogo鏄惁瀛樺湪骞惰缃畊rl
-const updateLogoUrl = () => {
-  if (!cleanFactoryName.value) {
-    logoUrl.value = defaultLogo
-    return
-  }
-
-  // 浣跨敤Vite鐨勫姩鎬佸鍏�
-  try {
-    const dynamicLogo = import.meta.glob('/src/assets/logo/*.png', { eager: true })
-    const logoPath = `/src/assets/logo/${cleanFactoryName.value}.png`
-
-    if (dynamicLogo[logoPath]) {
-      logoUrl.value = dynamicLogo[logoPath].default
-    } else {
-      logoUrl.value = defaultLogo
-    }
-  } catch (error) {
-    console.error('鍔犺浇宸ュ巶Logo澶辫触:', error)
-    logoUrl.value = defaultLogo
-  }
-}
-
-// 鍒濆鍖栧拰鐩戝惉鍙樺寲
-onMounted(() => {
-  updateLogoUrl()
-
-  // 鐩戝惉宸ュ巶鍚嶇О鍙樺寲
-  watch(() => userStore.currentFactoryName, updateLogoUrl)
-})
-
-// 鍥剧墖鍔犺浇閿欒澶勭悊
-const handleImageError = (event) => {
-  console.warn('Logo鍔犺浇澶辫触锛屼娇鐢ㄩ粯璁ogo')
-  logoUrl.value = defaultLogo
-}
-</script>
-
-<style lang="scss" scoped>
-@import '@/assets/styles/variables.module.scss';
-
-.sidebarLogoFade-enter-active {
-  transition: opacity 1.5s;
-}
-
-.sidebarLogoFade-enter,
-.sidebarLogoFade-leave-to {
-  opacity: 0;
-}
-
-.sidebar-logo-container {
-  position: relative;
-  width: 100% !important;
-  height: 50px !important;
-  line-height: 50px;
-  background: #fff;
-  text-align: center;
-  overflow: hidden;
-
-  & .sidebar-logo-link {
-    height: 100%;
-    width: 100%;
-
-    & .sidebar-logo {
-      width: 100%;
-      height: 100%;
-      // height: 32px;
-      vertical-align: middle;
-      margin-right: 12px;
-    }
-
-    & .sidebar-title {
-      display: inline-block;
-      margin: 0;
-      color: v-bind(getLogoTextColor);
-      font-weight: 600;
-      line-height: 50px;
-      font-size: 14px;
-      font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
-      vertical-align: middle;
-    }
-  }
-
-  &.collapse {
-    .sidebar-logo {
-      margin-right: 0px;
-    }
-  }
-}
-</style>
+<template>
+  <div class="sidebar-logo-container" :class="{ 'collapse': collapse }">
+    <transition name="sidebarLogoFade">
+      <router-link key="logo" class="sidebar-logo-link" to="/">
+        <span class="sidebar-logo-patch">
+          <img v-if="logoUrl" :src="logoUrl" class="sidebar-logo" @error="handleImageError" alt="鍏徃Logo" />
+        </span>
+      </router-link>
+    </transition>
+  </div>
+</template>
+
+<script setup>
+import { ref, computed, onMounted, watch } from 'vue'
+import useUserStore from '@/store/modules/user'
+import defaultLogo from '@/assets/login/JCCKLogo.png' // 涓庣櫥褰曢〉淇濇寔涓�鑷寸殑鍝佺墝 Logo
+
+defineProps({
+  collapse: {
+    type: Boolean,
+    required: true
+  }
+})
+
+const userStore = useUserStore()
+
+// 澶勭悊宸ュ巶鍚嶇О锛岀敓鎴愬悎娉曠殑鏂囦欢鍚�
+const cleanFactoryName = computed(() => {
+  if (!userStore.currentFactoryName) return ''
+  return userStore.currentFactoryName.trim()
+})
+
+// 鍔ㄦ�乴ogo璺緞
+const logoUrl = ref('')
+
+// 妫�鏌ogo鏄惁瀛樺湪骞惰缃畊rl
+const updateLogoUrl = () => {
+  if (!cleanFactoryName.value) {
+    logoUrl.value = defaultLogo
+    return
+  }
+
+  // 浣跨敤Vite鐨勫姩鎬佸鍏�
+  try {
+    const dynamicLogo = import.meta.glob('/src/assets/logo/*.png', { eager: true })
+    const logoPath = `/src/assets/logo/${cleanFactoryName.value}.png`
+
+    if (dynamicLogo[logoPath]) {
+      logoUrl.value = dynamicLogo[logoPath].default
+    } else {
+      logoUrl.value = defaultLogo
+    }
+  } catch (error) {
+    console.error('鍔犺浇宸ュ巶Logo澶辫触:', error)
+    logoUrl.value = defaultLogo
+  }
+}
+
+// 鍒濆鍖栧拰鐩戝惉鍙樺寲
+onMounted(() => {
+  updateLogoUrl()
+
+  // 鐩戝惉宸ュ巶鍚嶇О鍙樺寲
+  watch(() => userStore.currentFactoryName, updateLogoUrl)
+})
+
+// 鍥剧墖鍔犺浇閿欒澶勭悊
+const handleImageError = (event) => {
+  console.warn('Logo鍔犺浇澶辫触锛屼娇鐢ㄩ粯璁ogo')
+  logoUrl.value = defaultLogo
+}
+</script>
+
+<style lang="scss" scoped>
+.sidebarLogoFade-enter-active {
+  transition: opacity 1.5s;
+}
+
+.sidebarLogoFade-enter,
+.sidebarLogoFade-leave-to {
+  opacity: 0;
+}
+
+.sidebar-logo-container {
+  position: relative;
+  width: 100%;
+  height: 60px;
+  background: transparent;
+  overflow: hidden;
+
+  & .sidebar-logo-link {
+    display: flex;
+    align-items: center;
+    height: 100%;
+    width: 100%;
+    padding: 7px 10px;
+    box-sizing: border-box;
+
+    // logo 鍘熷浘鑷甫鐧藉簳锛岀敤鐧藉渾瑙掕创鐗囧~婊℃暣鏉� Logo 鏍�
+    & .sidebar-logo-patch {
+      flex: 1;
+      width: 100%;
+      height: 100%;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      padding: 2px 6px;
+      box-sizing: border-box;
+      background: #fff;
+      border-radius: 8px;
+      overflow: hidden;
+    }
+
+    & .sidebar-logo {
+      display: block;
+      width: 100%;
+      height: 100%;
+      object-fit: contain;
+    }
+  }
+}
+</style>

--
Gitblit v1.9.3