Bläddra i källkod

完善停车区域

2545307760@qq.com 3 månader sedan
förälder
incheckning
c209b52494

+ 1 - 1
server/config.yaml

@@ -125,7 +125,7 @@ mysql:
     config: charset=utf8mb4&parseTime=True&loc=Local
     db-name: lc_garage
     username: root
-    password: root
+    password: 123456
 
     path: 127.0.0.1
     engine: ""

+ 9 - 4
web/src/lang/en.js

@@ -1,6 +1,11 @@
 export default {
-  welcome: 'Welcome to Vue3 Internationalization',
-  language: 'Language Switch',
-  home: 'Home',
-  about: 'About Us'
+  park: 'Parking Area',
+  booth: 'Guard Booth',
+  access: 'Passage',
+  device: 'Equipment',
+  modify: 'edit',
+  remove: 'delete',
+  new: 'add',
+  reload: 'refresh',
+  coding: 'code'
 }

+ 1 - 1
web/src/lang/index.js

@@ -1,5 +1,5 @@
 import { createI18n } from 'vue-i18n'
-import zh from './zh'
+import zh from './zh-CN'
 import en from './en'
 
 // 从本地缓存获取语言,默认中文

+ 16 - 0
web/src/lang/zh-CN.js

@@ -0,0 +1,16 @@
+export default {
+  park: '停车区域',
+  booth: '岗亭',
+  access: '通道',
+  device: '设备',
+  modify: '编辑',
+  remove: '删除',
+  new: '新增',
+  reload: '刷新',
+  coding: '编码',
+  Name: '名称', // 名稱 名稱 name
+  IpAddress: 'ip地址', // ip地址 ip地址 ipAddress
+  Remarks: '备注', // 備註 備註 remark
+  Action: '操作', // 操作 備註 action
+  Direction: '进出方向', // 進出方向 進出方向 InOutDirection
+}

+ 11 - 0
web/src/lang/zh-HK.js

@@ -0,0 +1,11 @@
+export default {
+  park: '停車區域',
+  booth: '崗亭',
+  access: '通道',
+  device: '設備',
+  modify: '編輯',
+  remove: '刪除',
+  new: '新增',
+  reload: '刷新',
+  coding: '編碼'
+}

+ 11 - 0
web/src/lang/zh-TW.js

@@ -0,0 +1,11 @@
+export default {
+  park: '停車區域',
+  booth: '崗亭',
+  access: '通道',
+  device: '設備',
+  modify: '編輯',
+  remove: '删除',
+  new: '新增',
+  reload: '刷新',
+  coding: '編碼',
+}

+ 0 - 6
web/src/lang/zh.js

@@ -1,6 +0,0 @@
-export default {
-  welcome: '欢迎使用 Vue3 国际化',
-  language: '语言切换',
-  home: '首页',
-  about: '关于我们'
-}

+ 1 - 0
web/src/main.js

@@ -15,6 +15,7 @@ import { store } from '@/pinia'
 import App from './App.vue'
 import { initDom } from './utils/positionToCode'
 import i18n from './lang'
+// import en from 'element-plus/es/locale/lang/en'
 
 initDom()
 /**

+ 23 - 3
web/src/view/layout/search/search.vue

@@ -1,9 +1,18 @@
 <template>
   <div class="search-component">
     <div style="height: 100%;width: 200px">
-      <el-select>
-        <el-option label="zh" value="zh"></el-option>
-        <el-option label="en" value="en"></el-option>
+      <el-select
+        v-model="languageType"
+        @change="changeLanguageType"
+      >
+        <el-option
+          label="zh"
+          value="zh"
+        />
+        <el-option
+          label="en"
+          value="en"
+        />
       </el-select>
     </div>
     <div
@@ -23,11 +32,22 @@
 import Screenfull from '@/view/layout/screenfull/index.vue'
 import { emitter } from '@/utils/bus.js'
 import { ref } from 'vue'
+import { useI18n } from 'vue-i18n'
+
+// 导入 i18n 实例
+const { locale } = useI18n()
 
 defineOptions({
   name: 'BtnBox',
 })
 
+const languageType = ref('zh')
+
+const changeLanguageType = (val) => {
+  languageType.value = val
+  localStorage.setItem('lang', val) // 持久化
+}
+
 const reload = ref(false)
 const handleReload = () => {
   reload.value = true