AppLayout.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  1. <template>
  2. <div
  3. class="layout-wrapper"
  4. :class="{ 'full-screen': isFullScreen }"
  5. :style="isSpecialBg ? backgroundStyle : {}"
  6. >
  7. <!-- 背景层 -->
  8. <div v-if="isSpecialBg" class="background-layer"></div>
  9. <!-- Header -->
  10. <el-header
  11. class="layout-header"
  12. v-if="!isFullScreen"
  13. :class="{ 'transparent-header': isSpecialBg }"
  14. >
  15. <div class="logo-title-row">
  16. <!-- 左侧:Logo 和标题 -->
  17. <div class="left-section">
  18. <img src="@/assets/logo.png" alt="Logo" class="logo" />
  19. <span class="project-name" :class="{ 'light-text': isSpecialBg }">
  20. {{ t('Header.title') }}
  21. </span>
  22. </div>
  23. <!-- 右侧:用户信息 -->
  24. <div class="right-section" v-if="!isSelectCity">
  25. <div class="user-info-row">
  26. <div class="lang-buttons">
  27. <!-- 语言切换按钮 -->
  28. <button
  29. class="lang-toggle-btn"
  30. :class="{ 'light-text': isSpecialBg }"
  31. @click="toggleLanguage"
  32. :title="currentLang === 'zh' ? 'Switch to English' : '切换到中文'"
  33. >
  34. <i class="el-icon-globe"></i>
  35. <span class="lang-label">{{ currentLang === 'zh' ? '中文' : 'English' }}</span>
  36. </button>
  37. </div>
  38. <span class="welcome-text" :class="{ 'light-text': isSpecialBg }">
  39. {{ t('Header.welcome') }} {{ userInfo.name }}
  40. </span>
  41. <el-dropdown>
  42. <span class="el-dropdown-link">
  43. <el-avatar
  44. :size="40"
  45. :class="{ 'light-avatar-border': isSpecialBg }"
  46. src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png"
  47. />
  48. </span>
  49. <template #dropdown>
  50. <el-dropdown-menu>
  51. <el-dropdown-item disabled>
  52. {{ t('Header.username') }}: {{ userInfo.name }}
  53. </el-dropdown-item>
  54. <el-dropdown-item divided @click="handleLogout">
  55. {{ t('Header.logout') }}
  56. </el-dropdown-item>
  57. </el-dropdown-menu>
  58. </template>
  59. </el-dropdown>
  60. </div>
  61. </div>
  62. </div>
  63. </el-header>
  64. <div class="tabs-row" v-if="!isFullScreen">
  65. <el-tabs
  66. v-if="showTabs"
  67. v-model="activeName"
  68. class="demo-tabs"
  69. :style="tabStyle"
  70. @tab-click="handleClick"
  71. >
  72. <el-tab-pane v-for="tab in tabs" :key="tab.name" :name="tab.name">
  73. <template #label>
  74. <i :class="['tab-icon', tab.icon]"></i>
  75. <span class="tab-label-text">{{ tab.label }}</span>
  76. </template>
  77. </el-tab-pane>
  78. </el-tabs>
  79. <div v-else class="single-tab" @click="handleClick(tabs[0], $event)">
  80. <i :class="['tab-icon', tabs[0].icon]"></i>
  81. <span class="tab-label-text">{{ tabs[0].label }}</span>
  82. </div>
  83. </div>
  84. <!-- Main Content -->
  85. <el-container class="layout-main-container">
  86. <el-aside v-if="showAside && showTabs" class="layout-aside">
  87. <component
  88. :is="AsideComponent"
  89. :activeTab="activeName"
  90. :showTabs="showTabs"
  91. />
  92. </el-aside>
  93. <el-main class="layout-content-wrapper" :style="mainStyle">
  94. <div
  95. class="scrollable-content"
  96. :class="{ 'transparent-scroll': isSpecialBg }"
  97. >
  98. <div :class="{ 'select-city-container': isSelectCity }">
  99. <RouterView />
  100. </div>
  101. </div>
  102. </el-main>
  103. </el-container>
  104. <!-- 全局消息提示组件 -->
  105. <div v-if="showGlobalMessage" class="global-message">
  106. <div class="message-content" :class="messageType">
  107. {{ globalMessage }}
  108. </div>
  109. </div>
  110. </div>
  111. </template>
  112. <script setup lang="ts">
  113. import { ref, reactive, computed, watch, defineAsyncComponent } from "vue";
  114. import { useRouter, useRoute } from "vue-router";
  115. import { useTokenStore } from "@/stores/mytoken";
  116. import { ElMessageBox, ElMessage } from "element-plus";
  117. import { logout } from "@/API/users";
  118. import { useI18n } from 'vue-i18n'
  119. const { t, locale } = useI18n()
  120. const currentLang = ref(locale.value || 'zh')
  121. // 切换语言
  122. const changeLanguage = () => {
  123. locale.value = currentLang.value
  124. localStorage.setItem('language', currentLang.value)
  125. // 触发一个自定义事件,让其他组件知道语言改变了
  126. window.dispatchEvent(new CustomEvent('languageChanged', {
  127. detail: { lang: currentLang.value }
  128. }))
  129. }
  130. // 按钮点击切换
  131. const toggleLanguage = () => {
  132. currentLang.value = currentLang.value === 'zh' ? 'en' : 'zh'
  133. changeLanguage()
  134. }
  135. // 监听语言变化
  136. watch(locale, (newVal) => {
  137. currentLang.value = newVal
  138. })
  139. const router = useRouter();
  140. const route = useRoute();
  141. const tokenStore = useTokenStore();
  142. const currentBgImage = ref("");
  143. // ============ 新增状态 ============
  144. const showGlobalMessage = ref(false);
  145. const globalMessage = ref("");
  146. const messageType = ref("success");
  147. currentBgImage.value = `url(${new URL('../../assets/bg/background.jpg', import.meta.url).href})`;
  148. const isSpecialBg = computed(() => true);
  149. const backgroundStyle = computed(() => ({
  150. backgroundImage: currentBgImage.value,
  151. backgroundSize: "cover",
  152. backgroundPosition: "center",
  153. backgroundRepeat: "no-repeat",
  154. backgroundAttachment: "fixed",
  155. }));
  156. const isFullScreen = computed(() => route.meta.fullScreen === true);
  157. const isSelectCity = computed(() => route.path === "/select-city");
  158. // 当前用户信息
  159. const userInfo = reactive({
  160. name: tokenStore.userName,
  161. type: tokenStore.userType,
  162. });
  163. const tabs = computed(() => {
  164. if (userInfo.type === "admin") {
  165. return [
  166. {
  167. name: "dataManagement",
  168. label: t('Menu.dataManagement'),
  169. icon: "el-icon-folder",
  170. routes: [
  171. "/soilAcidReductionData",
  172. "/soilAcidificationData",
  173. "/crossSectionSampleData",
  174. "/irrigationWaterInputFluxData",
  175. "/heavyMetalEnterpriseData",
  176. "/atmosphericSampleData",
  177. ],
  178. },
  179. {
  180. name: "infoManagement",
  181. label: t('Menu.infoManagement'),
  182. icon: "el-icon-document",
  183. routes: ["/IntroductionUpdate"],
  184. },
  185. {
  186. name: "modelManagement",
  187. label: t('Menu.modelManagement'),
  188. icon: "el-icon-cpu",
  189. routes: ["/ModelSelection", "/thres", "/ModelTrain"],
  190. },
  191. {
  192. name: "userManagement",
  193. label: t('Menu.userManagement'),
  194. icon: "el-icon-user",
  195. routes: ["/UserManagement"],
  196. },
  197. ];
  198. } else {
  199. return [
  200. {
  201. name: "introduction",
  202. label: t('Menu.swIntroduce'),
  203. icon: "el-icon-info-filled",
  204. routes: ["/SoilPro", "/Overview", "/ResearchFindings", "/Unit"],
  205. },
  206. {
  207. name: "acidmodelmap",
  208. label: t('Menu.mapcalulate'),
  209. icon: "el-icon-data-analysis",
  210. routes: ["/shaoguan_acidmodelmap","nanxiong_acidmodelmap"],
  211. },
  212. {
  213. name: "Calculation",
  214. label: t('Menu.reversionmodel'),
  215. icon: "el-icon-data-analysis",
  216. routes: ["/Calculation", "/SoilAcidReductionIterativeEvolution"],
  217. },
  218. {
  219. name: "AcidNeutralizationModel",
  220. label: t('Menu.reducemodel'),
  221. icon: "el-icon-data-analysis",
  222. routes: ["/AcidNeutralizationModel", "/SoilAcidificationIterativeEvolution"],
  223. },
  224. {
  225. name: "dataStatistics",
  226. label: t('Menu.dataStatistics'),
  227. icon: "el-icon-pie-chart",
  228. routes: [
  229. "/DetectionStatistics",
  230. "/FarmlandPollutionStatistics",
  231. "/LandClutivatesStatistics",
  232. "/SoilacidificationStatistics",
  233. ],
  234. },
  235. ];
  236. }
  237. });
  238. const activeName = ref(tabs.value[0]?.name || "");
  239. const showTabs = computed(() => tabs.value.length > 1);
  240. const tabStyle = computed(() =>
  241. tabs.value.length === 1 ? { width: "100%", justifyContent: "center" } : {}
  242. );
  243. let hasNavigated = false;
  244. watch(
  245. () => activeName.value,
  246. (newTab) => {
  247. const tab = tabs.value.find((t) => t.name === newTab);
  248. const targetPath = tab?.routes?.[0];
  249. if (!hasNavigated) {
  250. hasNavigated = true;
  251. return;
  252. }
  253. if (tab && targetPath && router.currentRoute.value.path !== targetPath)
  254. router.push({ path: targetPath });
  255. },
  256. { immediate: true }
  257. );
  258. const activeAsideTab = ref(activeName.value || "");
  259. const handleClick = (tab: any, _event?: Event) => {
  260. activeAsideTab.value = tab.name || tab.props?.name;
  261. };
  262. const AsideComponent = computed(() => {
  263. return [
  264. "dataManagement",
  265. "infoManagement",
  266. "modelManagement",
  267. "userManagement",
  268. ].includes(activeName.value)
  269. ? defineAsyncComponent(() => import("./AppAsideForTab2.vue"))
  270. : defineAsyncComponent(() => import("./AppAside.vue"));
  271. });
  272. const showAside = computed(
  273. () =>
  274. !isFullScreen.value && !["cropRiskAssessment"].includes(activeName.value)
  275. );
  276. const mainStyle = computed(() => ({
  277. padding: ["mapView", "infoManagement"].includes(activeName.value)
  278. ? "0"
  279. : "20px",
  280. overflow: "hidden",
  281. }));
  282. // 登出逻辑 - 支持多语言
  283. const handleLogout = async () => {
  284. try {
  285. await ElMessageBox.confirm(
  286. t('logout.confirmMessage'),
  287. t('logout.confirmTitle'),
  288. {
  289. confirmButtonText: t('logout.confirmButton'),
  290. cancelButtonText: t('logout.cancelButton'),
  291. type: "warning",
  292. }
  293. );
  294. await logout();
  295. tokenStore.clearToken();
  296. ElMessage.success(t('logout.logoutSuccess'));
  297. setTimeout(() => {
  298. router.push("/login");
  299. }, 1000);
  300. } catch (error) {
  301. if (error === 'cancel' || error?.toString().includes('cancel')) {
  302. // 用户取消操作
  303. } else {
  304. ElMessage.error(t('logout.logoutFailed'));
  305. console.error("退出登录错误:", error);
  306. }
  307. }
  308. };
  309. </script>
  310. <style>
  311. /* 隐藏所有滚动条 */
  312. *::-webkit-scrollbar {
  313. display: none;
  314. /* Chrome, Safari, Opera */
  315. }
  316. * {
  317. -ms-overflow-style: none;
  318. /* IE and Edge */
  319. scrollbar-width: none;
  320. /* Firefox */
  321. }
  322. /* 整体布局容器 */
  323. .layout-wrapper {
  324. display: flex;
  325. flex-direction: column;
  326. height: 100vh;
  327. overflow: hidden;
  328. position: relative; /* 创建层叠上下文 */
  329. background-color: #f5f7fa; /* 默认背景色 */
  330. /* 确保 layout-wrapper 自身的 z-index 不干扰子元素,或根据需要设置 */
  331. /* z-index: 0; */ /* 通常不需要显式设置,除非有特殊需求 */
  332. }
  333. /* 背景层 - 关键修改 */
  334. .background-layer {
  335. position: absolute;
  336. top: 0;
  337. left: 0;
  338. width: 100%;
  339. height: 100%;
  340. /* 将背景层的 z-index 设为一个较低的负值或非常小的正值,确保它在最底层 */
  341. z-index: -1; /* 修改点:使用负值确保其在最底层,避免任何可能的遮挡 */
  342. background-size: cover;
  343. background-position: center;
  344. background-repeat: no-repeat;
  345. filter: brightness(0.8);
  346. }
  347. /* 全屏页面特殊处理 */
  348. .layout-wrapper.full-screen {
  349. background: none;
  350. min-height: 100vh;
  351. }
  352. /* 特殊背景页面的Header样式 */
  353. .transparent-header {
  354. background: transparent !important;
  355. backdrop-filter: blur(2px); /* 添加轻微模糊效果增强可读性 */
  356. }
  357. /* 特殊背景页面的文字颜色 */
  358. .light-text {
  359. color: #ffffff !important; /* 白色文字 */
  360. text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); /* 文字阴影增强可读性 */
  361. }
  362. /* 特殊背景页面的头像边框 */
  363. .light-avatar-border {
  364. border: 2px solid #ffffff !important; /* 白色边框 */
  365. }
  366. /* 内容区域在特殊背景页面透明 */
  367. .transparent-scroll {
  368. background-color: transparent !important;
  369. }
  370. /* Header 样式 */
  371. .layout-header {
  372. height: 80px;
  373. display: flex;
  374. align-items: center;
  375. justify-content: space-between;
  376. color: #333; /* 深色文字 */
  377. flex-shrink: 0;
  378. /* 确保在背景层上方 */
  379. position: relative;
  380. /* 修改点:增大 z-index 确保在背景层之上 */
  381. z-index: 10; /* 增大 z-index */
  382. background-color: white; /* 默认背景色 */
  383. }
  384. /* 修改Header布局样式 */
  385. .logo-title-row {
  386. display: flex;
  387. align-items: center;
  388. justify-content: space-between; /* 左右两侧分布 */
  389. width: 100%;
  390. gap: 24px;
  391. }
  392. .title-and-user {
  393. display: flex;
  394. flex-direction: row;
  395. flex: 1;
  396. }
  397. /* 用户信息区域样式调整 */
  398. .user-info-row {
  399. display: flex;
  400. align-items: center;
  401. gap: 16px;
  402. color: #333;
  403. }
  404. .welcome-text {
  405. font-size: 28px;
  406. font-weight: 500;
  407. color: #ffffff;
  408. white-space: nowrap; /* 防止文字换行 */
  409. }
  410. /* Tab 区域 - 不透明 */
  411. .tabs-row {
  412. height: 48px;
  413. display: flex;
  414. justify-content: center;
  415. align-items: center;
  416. padding: 0 24px;
  417. background: linear-gradient(to right, #1092d8, #02c3ad);
  418. border-bottom: none !important;
  419. flex-shrink: 0;
  420. /* 确保在背景层上方 */
  421. position: relative;
  422. /* 修改点:增大 z-index 确保在背景层之上 */
  423. z-index: 10; /* 增大 z-index */
  424. }
  425. /* el-tabs 外层容器 */
  426. .demo-tabs {
  427. height: 48px !important;
  428. display: flex;
  429. align-items: center;
  430. width: 100%;
  431. padding: 0 !important;
  432. margin: 0 !important;
  433. border-bottom: none !important;
  434. }
  435. /* 清除滑块条和底部线条 */
  436. .el-tabs__nav-wrap::after,
  437. .el-tabs__active-bar {
  438. display: none !important;
  439. height: 0 !important;
  440. border: none !important;
  441. }
  442. .el-tabs__nav-scroll {
  443. padding: 0 !important;
  444. margin: 0 !important;
  445. }
  446. /* Tabs 单项样式 */
  447. .el-tabs__item {
  448. height: 48px !important;
  449. line-height: 48px !important;
  450. display: flex !important;
  451. align-items: center;
  452. justify-content: center;
  453. padding: 0 20px !important;
  454. font-size: 20px;
  455. font-weight: 600;
  456. border-radius: 10px;
  457. transition: all 0.2s ease-in-out;
  458. background-color: transparent;
  459. position: relative;
  460. /* 修改点:增大 z-index 确保在背景层之上 */
  461. z-index: 10; /* 增大 z-index */
  462. }
  463. /* 激活 Tab */
  464. .el-tabs__item.is-active {
  465. background-color: #2a53ba;
  466. color: #ffffff;
  467. font-weight: 700;
  468. box-shadow: 0 4px 16px rgba(26, 188, 156, 0.4);
  469. /* 修改点:增大 z-index 确保在背景层之上 */
  470. z-index: 11; /* 激活项可以更高一点 */
  471. }
  472. /* 鼠标悬停 */
  473. .el-tabs__item:hover {
  474. background-color: #455a64;
  475. color: #ffffff;
  476. /* 修改点:增大 z-index 确保在背景层之上 */
  477. z-index: 11; /* 悬停时也可以更高 */
  478. }
  479. /* 图标样式 */
  480. .tab-icon {
  481. font-size: 24px;
  482. margin-right: 4px;
  483. color: inherit;
  484. }
  485. /* 文字样式 */
  486. .tab-label-text {
  487. font-size: 20px;
  488. color: inherit;
  489. line-height: 1;
  490. display: inline-block;
  491. }
  492. .logo {
  493. height: 60px;
  494. }
  495. .project-name {
  496. font-size: 32px; /* 适当调整字体大小 */
  497. font-weight: bold;
  498. color: #333;
  499. white-space: nowrap; /* 防止标题换行 */
  500. }
  501. /* 响应式设计:在小屏幕上调整布局 */
  502. @media (max-width: 1200px) {
  503. .project-name {
  504. font-size: 20px;
  505. }
  506. .welcome-text {
  507. font-size: 14px;
  508. }
  509. }
  510. @media (max-width: 768px) {
  511. .logo-title-row {
  512. flex-wrap: wrap;
  513. gap: 12px;
  514. }
  515. .left-section {
  516. order: 1;
  517. width: 100%;
  518. justify-content: center;
  519. }
  520. .right-section {
  521. order: 2;
  522. width: 100%;
  523. justify-content: center;
  524. }
  525. .project-name {
  526. font-size: 18px;
  527. text-align: center;
  528. }
  529. }
  530. .layout-main-container {
  531. flex: 1;
  532. display: flex;
  533. overflow: hidden;
  534. min-height: 0;
  535. /* 确保在背景层上方 */
  536. position: relative;
  537. /* 修改点:增大 z-index 确保在背景层之上 */
  538. z-index: 10; /* 增大 z-index */
  539. }
  540. /* 侧边栏 - 白色背景 */
  541. .layout-aside {
  542. width: 280px;
  543. background: linear-gradient(to bottom, #b7f1fc, #fff8f0);
  544. border-right: 1px solid;
  545. overflow-y: auto;
  546. color: #000000;
  547. padding-top: 8px;
  548. height: 100%;
  549. position: relative;
  550. /* 修改点:增大 z-index 确保在背景层之上 */
  551. z-index: 10; /* 增大 z-index */
  552. }
  553. /* 隐藏侧边栏滚动条 */
  554. .layout-aside::-webkit-scrollbar {
  555. display: none;
  556. }
  557. .layout-aside .el-menu-item,
  558. .layout-aside .el-sub-menu__title {
  559. font-size: 18px;
  560. font-weight: 500;
  561. color: #000000;
  562. background-color: transparent;
  563. transition: all 0.2s ease;
  564. border-radius: 6px;
  565. padding: 12px 16px !important;
  566. }
  567. .layout-aside .el-menu-item:hover,
  568. .layout-aside .el-sub-menu__title:hover {
  569. background-color: rgba(16, 146, 216, 0.1);
  570. color: #1092d8;
  571. }
  572. .layout-aside .el-menu-item.is-active,
  573. .layout-aside .el-sub-menu__title.is-active {
  574. background: linear-gradient(to right, #1092d8, #02c3ad);
  575. color: #000000 !important;
  576. border-radius: 8px;
  577. font-weight: 600;
  578. box-shadow: 0 2px 8px rgba(16, 146, 216, 0.25);
  579. /* 修改点:增大 z-index 确保在背景层之上 */
  580. z-index: 11; /* 激活项可以更高一点 */
  581. }
  582. .layout-content-wrapper {
  583. flex: 1;
  584. overflow: hidden;
  585. display: flex;
  586. flex-direction: column;
  587. position: relative;
  588. /* 修改点:增大 z-index 确保在背景层之上 */
  589. z-index: 10; /* 增大 z-index */
  590. }
  591. /* 强制重置 el-tabs header 高度/边距/背景/阴影,避免背景层穿透错位 */
  592. .el-tabs__header.is-top {
  593. height: 48px !important;
  594. margin: 0 !important;
  595. padding: 0 !important;
  596. border: none !important;
  597. background: transparent !important;
  598. box-shadow: none !important;
  599. /* 修改点:增大 z-index 确保在背景层之上 */
  600. z-index: 10 !important; /* 增大 z-index */
  601. }
  602. /* 全屏页面特殊处理 */
  603. .layout-wrapper.full-screen .layout-main-container {
  604. height: 100vh;
  605. }
  606. .scrollable-content {
  607. flex: 1;
  608. overflow: auto;
  609. padding: 0 20px;
  610. box-sizing: border-box;
  611. background-color: white; /* 默认背景色 */
  612. position: relative; /* 确保它可以参与 z-index 计算 */
  613. /* 修改点:增大 z-index 确保在背景层之上 */
  614. z-index: 10; /* 增大 z-index */
  615. }
  616. .scrollable-content.transparent-scroll {
  617. background-color: transparent;
  618. /* 修改点:增大 z-index 确保在背景层之上 */
  619. z-index: 10; /* 即使透明也应保持在上层 */
  620. }
  621. /* 左侧区域 */
  622. .left-section {
  623. display: flex;
  624. align-items: center;
  625. gap: 24px;
  626. flex-shrink: 0; /* 防止缩小 */
  627. }
  628. /* 右侧区域 */
  629. .right-section {
  630. display: flex;
  631. align-items: center;
  632. justify-content: flex-end;
  633. flex-shrink: 0; /* 防止缩小 */
  634. }
  635. /* 语言切换按钮样式 */
  636. .lang-toggle-btn {
  637. display: flex;
  638. align-items: center;
  639. gap: 6px;
  640. padding: 8px 16px;
  641. border: 2px solid rgba(255, 255, 255, 0.6);
  642. border-radius: 20px;
  643. background: rgba(255, 255, 255, 0.15);
  644. backdrop-filter: blur(8px);
  645. color: #ffffff;
  646. font-size: 14px;
  647. font-weight: 500;
  648. cursor: pointer;
  649. transition: all 0.3s ease;
  650. outline: none;
  651. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  652. }
  653. .lang-toggle-btn:hover {
  654. background: rgba(255, 255, 255, 0.25);
  655. border-color: rgba(255, 255, 255, 0.9);
  656. transform: translateY(-2px);
  657. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  658. }
  659. .lang-toggle-btn:active {
  660. transform: translateY(0);
  661. box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  662. }
  663. .lang-toggle-btn .el-icon-globe {
  664. font-size: 18px;
  665. color: #ffffff;
  666. }
  667. .lang-toggle-btn .lang-label {
  668. font-size: 13px;
  669. font-weight: 600;
  670. letter-spacing: 0.5px;
  671. }
  672. /* 浅色文字模式(特殊背景页面) */
  673. .lang-toggle-btn.light-text {
  674. border-color: rgba(255, 255, 255, 0.6);
  675. color: #ffffff;
  676. }
  677. .lang-toggle-btn.light-text .el-icon-globe {
  678. color: #ffffff;
  679. }
  680. /* 响应式设计 */
  681. @media (max-width: 768px) {
  682. .lang-toggle-btn {
  683. padding: 6px 12px;
  684. font-size: 12px;
  685. }
  686. .lang-toggle-btn .el-icon-globe {
  687. font-size: 16px;
  688. }
  689. .lang-toggle-btn .lang-label {
  690. font-size: 11px;
  691. }
  692. }
  693. </style>