zhongshujie
2025-08-08 401ed176c9f1bdd97ccdf827d9454b11a3891f79
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<template>
  <div class="pageHeader">
    <div class="header-box">
      <ul class="page-title">
        <img @click="goHome()" class="zylogo" src="../../assets/images/home/zylogo.png" alt="">
        <li class="separator"></li>
        <img class="sylogo" src="../../assets/images/home/sylogo.svg" alt="">
        <li class="title-text">{{ t('message.logoTitle') }}</li>
      </ul>
      <div class="page-select">
        <el-select v-model="currentLocale" placeholder="Language" style="width: 120px">
          <el-option v-for="item in availableLocales" :key="item.value" :label="t(item.label)" :value="item.value" />
        </el-select>
      </div>
    </div>
 
  </div>
  <!-- 导航栏 -->
</template>
 
<script setup lang="ts">
import { useRouter } from 'vue-router'
import { inject, reactive, computed } from 'vue'
const config: any = inject('config')
const router = useRouter()
import { useI18n } from 'vue-i18n';
const { locale, t } = useI18n();
 
const availableLocales = [
  { value: 'zh', label: 'langSelector.chinese' },
  { value: 'en', label: 'langSelector.english' },
];
 
const currentLocale = computed({
  get: () => locale.value,
  set: (value) => {
    locale.value = value;
    // (可选) 将语言偏好保存到 localStorage,以便下次记住用户选择
    localStorage.setItem('user-locale', value);
  },
});
 
const goHome = () => {
  router.push({ path: '/' });
};
 
 
 
</script>
 
 
<style lang="less" scoped>
.pageHeader {
  display: flex;
  justify-content: center;
  width: 100%;
  background-color: #ecf9f6;
  height: 78px;
}
 
.header-box {
  width: 65%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
 
 
.page-title {
  display: flex;
  align-items: center;
  justify-content: center;
}
 
.zylogo {
  width: 21%;
  cursor: pointer;
}
 
.separator {
  list-style: none;
  width: 20px;
  height: 20px;
  margin-right: 15px;
  position: relative;
}
 
/* 2. 创建第一个伪元素('\' 斜杠) */
.separator::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  /* 和容器一样宽 */
  height: 1px;
  /* 线条粗细 */
  border-top: 1px dashed #ccc;
  /* 虚线样式 */
  transform: translateY(-50%) rotate(45deg);
  /* 先垂直居中,再旋转45度 */
}
 
/* 3. 创建第二个伪元素('/' 斜杠) */
.separator::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  /* 和容器一样宽 */
  height: 1px;
  /* 线条粗细 */
  border-top: 1px dashed #ccc;
  /* 虚线样式 */
  transform: translateY(-50%) rotate(-45deg);
  /* 先垂直居中,再反向旋转45度 */
}
 
.sylogo {
  padding-right: 18px;
  border-right: 1px solid #0c73b8;
  width: 21%;
}
 
.title-text {
  width: 450px;
  padding-left: 14px;
  font-weight: bold;
  font-size: 20px;
}
</style>