From 0750f86b69763c6bec0e7e6807d248dd8567a87d Mon Sep 17 00:00:00 2001
From: lxl <lixuliang_hd@126.com>
Date: 星期一, 19 九月 2022 16:16:23 +0800
Subject: [PATCH] 1111

---
 src/assets/lang/zh.js      |   99 ++++++++++++++++
 src/main.js                |    6 
 package.json               |    1 
 src/assets/lang/index.js   |   21 +++
 src/assets/lang/en.js      |   85 ++++++++++++++
 src/components/navMenu.vue |   23 +++
 src/assets/lang/fr.js      |   85 ++++++++++++++
 7 files changed, 316 insertions(+), 4 deletions(-)

diff --git a/package.json b/package.json
index 29e8146..29c8f1d 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
     "sqlite3": "^5.0.2",
     "vant": "^2.12.25",
     "vue": "^2.6.11",
+    "vue-i18n": "^8.27.2",
     "vue-router": "^3.2.0",
     "vuex": "^3.4.0"
   },
diff --git a/src/assets/lang/en.js b/src/assets/lang/en.js
new file mode 100644
index 0000000..62a2163
--- /dev/null
+++ b/src/assets/lang/en.js
@@ -0,0 +1,85 @@
+const en = {
+  common: {
+    confirm: "confirm",
+    choose: "please choose",
+    emptydata: "No data",
+    Distributionmap: "Distribution map",
+    Selectdate: "Select date",
+    name: "Name",
+    high: "high",
+    Medium: "Medium",
+    low: "low",
+    reName: "rename",
+    edit: "edit",
+    copy: "copy",
+    delete: "delete",
+    location: "location",
+    coordinate: "coordinate",
+    latLon: "Latitude and Longitude",
+    pleaseEnter: "Please Enter...",
+  },
+  nav: {
+    SerManage: "DUTY MANAGEMENT",
+    digitalMap: "DIGITALMAP",
+    PerManage: "MAN-MANAGEMENT",
+    EquManage: "EQUIPMENT MANAGEMENT",
+    NewsSite: "NEWS SITE",
+    Logout: "Logout",
+    Newtask: "Newtask",
+    Tasklist: "Tasklist",
+    Tasksummary: "Tasksummary",
+    Distributionlist: "Distributionlist",
+    MaterialManage: "Material management",
+    LivingMaterials: "Living materials",
+    EquipmentMaterials: "Equipment materials",
+  },
+  taskList: {
+    Listregions: "List of regions",
+    EnterAreaName: "Please enter the area name",
+    taskTotal: "Total number of tasks statistics",
+    Tasklevel: "Task risk level statistics",
+    addTaskArea: "New task area",
+    editTaskArea: "Edit task area",
+    DegreeDanger: "Degree of danger",
+    Introduction: "Introduction",
+  },
+  addTask: {
+    newTask: "New task",
+    Details: "Details",
+    taskName: "Task name",
+    taskId: "Task number",
+    getTime: "Receiving time",
+    taskcon: "Task content",
+    resoucepai: "Resource allocation",
+    lifesub: "Living matter",
+    equisub: "Equipment material",
+    people: "personnel",
+    collmodel: "Collection template",
+    doIssued: "Confirm to issue",
+    storage: "Temporary storage",
+  },
+  electronicMap: {
+    customMap: "Custom Map",
+    mapAnalyse: "Map Analyse",
+    mapPlotting: "Map Plotting",
+    layerData: "Layer Data",
+    peripheralQuery: "Peripheral query",
+    text: "text",
+    polyline: "Polyline",
+    modelLibrary: "Model Library",
+    polygon: "Polygon",
+    militaryLibrary: "Military Standard Library",
+    flattailarrow: "Flat tail arrow",
+    dovetailarrow: "Dovetail arrow",
+    assemblyPlace: "Assembly place",
+    car: "car",
+    rocketlauncher: "Rocket launcher",
+    missile: "missile",
+    rectangle: "Rounded Rectangle",
+    sector: "sector",
+    arched: "Arched",
+    bezierarrow: "Bezier Arrow",
+  },
+};
+
+export default en;
diff --git a/src/assets/lang/fr.js b/src/assets/lang/fr.js
new file mode 100644
index 0000000..a19aa0a
--- /dev/null
+++ b/src/assets/lang/fr.js
@@ -0,0 +1,85 @@
+const fr = {
+  common: {
+    confirm: "confirmer",
+    choose: "Choisissez s'il vous pla卯t",
+    emptydata: "Pas de donn茅es",
+    Distributionlist: "Liste de distribution",
+    Selectdate: "S茅lectionner une date",
+    name: "Nom",
+    high: "haute",
+    Medium: "dans",
+    low: "faible",
+    reName: "Renommer",
+    edit: "脡dition",
+    copy: "Copier",
+    delete: "Supprimer",
+    location: "emplacement",
+    coordinate: "coordonner",
+    latLon: "Latitude et longitude",
+    pleaseEnter: "Entrez s'il vous plait...",
+  },
+  nav: {
+    SerManage: "Gestion des devoirs",
+    digitalMap: "carte num茅rique",
+    PerManage: "Gestion du personnel",
+    EquManage: "Gestion des 茅quipements",
+    NewsSite: "Site d'actualit茅s",
+    Logout: "Se d茅connecter",
+    Newtask: "Nouvelle t芒che",
+    Tasklist: "Liste de t芒ches",
+    Tasksummary: "R茅sum茅 des t芒ches",
+    MaterialManage: "La gestion du mat茅riel",
+    LivingMaterials: "Mat茅riel de subsistance",
+    EquipmentMaterials: "Mat茅riel et fournitures",
+  },
+  taskList: {
+    Listregions: "Liste des r茅gions",
+    EnterAreaName: "Veuillez saisir le nom de la zone",
+    taskTotal: "Statistiques du nombre total de t芒ches",
+    Tasklevel: "Statistiques du niveau de risque de la t芒che",
+    addTaskArea: "Nouvelle zone de t芒ches",
+    editTaskArea: "Modifier la zone de t芒ches",
+    DegreeDanger: "Degr茅 de danger",
+    Distributionmap: "Carte de distribution",
+    Introduction: "introduction",
+  },
+  addTask: {
+    newTask: "Nouvelle t芒che",
+    Details: "Des d茅tails",
+    taskName: "nom de la mission",
+    taskId: "Num茅ro de t芒che",
+    getTime: "R茅ception du temps",
+    taskcon: "Contenu de la t芒che",
+    resoucepai: "Allocation des ressources",
+    lifesub: "Mati猫re vivante",
+    equisub: "Mat茅riel d'茅quipement",
+    people: "personnel",
+    collmodel: "Mod猫le de collection",
+    doIssued: "Confirmer pour 茅mettre",
+    storage: "Stockage temporaire",
+  },
+  electronicMap: {
+    customMap: "Carte personnalis茅e",
+    mapAnalyse: "Analyse de la carte",
+    mapPlotting: "Ic么ne de la carte",
+    layerData: "Donn茅es de couche",
+    peripheralQuery: "Requ锚te p茅riph茅rique",
+    text: "texte",
+    polyline: "Polyligne",
+    modelLibrary: "Biblioth猫que de mod猫les",
+    polygon: "Polygone",
+    militaryLibrary: "Biblioth猫que de normes militaires",
+    flattailarrow: "Fl猫che de queue plate",
+    dovetailarrow: "Fl猫che en queue d'aronde",
+    assemblyPlace: "Lieu de rassemblement",
+    car: "voiture",
+    rocketlauncher: "Lance-roquettes",
+    missile: "missile",
+    rectangle: "Rectangle arrondi",
+    sector: "secteur",
+    arched: "Arqu茅",
+    bezierarrow: "Fl猫che de B茅zier",
+  },
+};
+
+export default fr;
diff --git a/src/assets/lang/index.js b/src/assets/lang/index.js
new file mode 100644
index 0000000..0e150af
--- /dev/null
+++ b/src/assets/lang/index.js
@@ -0,0 +1,21 @@
+import Vue from "vue";
+import VueI18n from "vue-i18n";
+
+import ElementLocale from "element-ui/lib/locale";
+import enLocale from "element-ui/lib/locale/lang/en";
+import zhLocale from "element-ui/lib/locale/lang/zh-CN";
+import langZh from "@/assets/lang/zh.js";
+import langEN from "@/assets/lang/en.js";
+
+Vue.use(VueI18n);
+
+const i18n = new VueI18n({
+  locale: "zh",
+  messages: {
+    zh: { ...langZh, ...zhLocale },
+    en: { ...langEN, ...enLocale },
+  },
+});
+ElementLocale.i18n((key, value) => i18n.t(key, value));
+
+export default i18n;
diff --git a/src/assets/lang/zh.js b/src/assets/lang/zh.js
new file mode 100644
index 0000000..5083c76
--- /dev/null
+++ b/src/assets/lang/zh.js
@@ -0,0 +1,99 @@
+const zh = {
+  common: {
+    confirm: "纭",
+    choose: "璇烽�夋嫨",
+    emptydata: "鏆傛棤鏁版嵁",
+    name: "鍚嶇О",
+    Distributionmap: "閰嶅彂鍦板浘",
+    lon: "缁忓害鍧愭爣",
+    lat: "绾害鍧愭爣",
+    Selectdate: "閫夋嫨鏃ユ湡",
+    high: "楂�",
+    Medium: "涓�",
+    low: "浣�",
+    reName: "閲嶅懡鍚�",
+    edit: "缂栬緫",
+    copy: "澶嶅埗",
+    delete: "鍒犻櫎",
+    location: "鍦板悕",
+    coordinate: "鍧愭爣",
+    latLon: "缁忕含搴�",
+    pleaseEnter: "璇疯緭鍏�...",
+    geocoding: "鍦扮悊缂栫爜",
+    reverseGeocoding: "閫嗗湴鐞嗙紪鐮�",
+  },
+  nav: {
+    SerManage: "鍕ゅ姟绠$悊",
+    digitalMap: "鐢靛瓙鍦板浘",
+    PerManage: "浜哄憳绠$悊",
+    EquManage: "瑁呭绠$悊",
+    NewsSite: "鏂伴椈缃戠珯",
+    Logout: "娉ㄩ攢",
+    Newtask: "鏂板缓浠诲姟",
+    Tasklist: "浠诲姟娓呭崟",
+    Tasksummary: "浠诲姟鎬荤粨",
+    taskStatistic: "浠诲姟缁熻",
+    Distributionlist: "鐗╄祫鍛婅",
+    MaterialManage: "鐢熸椿鐗╄祫绠$悊",
+    EquipManage: "瑁呭鐗╄祫绠$悊",
+    LivingMaterials: "鐢熸椿鐗╄祫",
+    EquipmentMaterials: "瑁呭鐗╄祫",
+    system: "绯荤粺绠$悊",
+    personmanage: "浜哄憳绠$悊",
+    equiplable: "鏍囩搴撶鐞�",
+  },
+  taskList: {
+    Listregions: "鍦板尯鍒楄〃",
+    EnterAreaName: "璇疯緭鍏ュ尯鍩熷悕绉�",
+    taskTotal: "浠诲姟鎬绘暟缁熻",
+    Tasklevel: "浠诲姟鍗遍櫓搴︾骇鍒粺璁�",
+    addTaskArea: "鏂板浠诲姟鍖�",
+    editTaskArea: "缂栬緫浠诲姟鍖�",
+    DegreeDanger: "鍗遍櫓绋嬪害",
+    Introduction: "绠�浠�",
+  },
+  addTask: {
+    newTask: "鏂板缓浠诲姟",
+    taskLevel: "浠诲姟绾у埆",
+    Details: "璇︽儏",
+    taskName: "浠诲姟鍚嶇О",
+    taskId: "浠诲姟缂栧彿",
+    getTime: "鎺ユ姤鏃堕棿",
+    taskcon: "浠诲姟鍐呭",
+    resoucepai: "璧勬簮鍒嗛厤",
+    lifesub: "鐗╄祫",
+    equisub: "瑁呭",
+    people: "浜哄憳",
+    collmodel: "閲囬泦妯℃澘",
+    doIssued: "纭涓嬪彂",
+    storage: "鏆傚瓨",
+  },
+  electronicMap: {
+    customMap: "鑷畾涔夊湴鍥�",
+    mapAnalyse: "鍦板浘鍒嗘瀽",
+    mapPlotting: "鍦板浘鏍囩粯",
+    layerData: "鍥惧眰鏁版嵁",
+    peripheralQuery: "鐩戞帶鏌ヨ",
+    text: "鏂囨湰",
+    polyline: "鎶樼嚎",
+    modelLibrary: "妯″瀷搴�",
+    polygon: "澶氳竟褰�",
+    militaryLibrary: "鍐涙爣搴�",
+    flattailarrow: "骞冲熬绠ご",
+    dovetailarrow: "鐕曞熬绠ご",
+    flattail2arrow: "骞冲熬鍙岀澶�",
+    assemblyPlace: "闆嗙粨鍦�",
+    car: "杞﹁締",
+    rocketlauncher: "鐏鍙戝皠鏋�",
+    missile: "瀵煎脊",
+    rectangle: "鍦嗚鐭╁舰",
+    sector: "鎵囧舰",
+    arched: "寮撳舰",
+    bezierarrow: "璐濆灏旂澶�",
+    mapImagery: "鍦板浘褰卞儚",
+    pointposition: "鐐逛綅",
+    electronicFence: "鐢靛瓙鍥存爮",
+  },
+};
+
+export default zh;
diff --git a/src/components/navMenu.vue b/src/components/navMenu.vue
index 62d2345..a96f107 100644
--- a/src/components/navMenu.vue
+++ b/src/components/navMenu.vue
@@ -18,7 +18,7 @@
         >
           <el-submenu index="1" class="faSub">
             <template slot="title">
-              <span>鏁版嵁绠$悊</span>
+              <span>{{ $t("common.confirm") }}</span>
             </template>
             <el-menu-item index="catalogueManage">鐩綍绠$悊</el-menu-item>
             <el-menu-item index="dataUpdata">鏁版嵁涓婁紶</el-menu-item>
@@ -56,7 +56,7 @@
             <template slot="title">
               <span>缁煎悎灞曠ず</span>
             </template>
-            <el-menu-item index="Synthesis" >缁煎悎灞曠ず</el-menu-item>
+            <el-menu-item index="Synthesis">缁煎悎灞曠ず</el-menu-item>
             <el-menu-item index="Thematic">涓撻鍦板浘</el-menu-item>
             <el-menu-item index="Archive">璧勬枡棣�</el-menu-item>
           </el-submenu>
@@ -80,6 +80,8 @@
         <img src="../assets/img/user.png" alt="" />
         <span>admin</span>
         <span>娉ㄩ攢</span>
+        &nbsp;
+        <span @click="switchLang"> 鍒囨崲璇█</span>
       </div>
       <div class="btnBox">
         <div><img src="../assets/img/leftBtn.png" alt="" /></div>
@@ -93,6 +95,11 @@
 export default {
   name: "navMenu",
   //import寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+  data() {
+    return {
+      lang: "en",
+    };
+  },
   methods: {
     handleOpen(key, keyPath) {
       if (
@@ -117,6 +124,15 @@
     },
     showChange() {
       this.$emit("shwoMapView", true);
+    },
+    switchLang() {
+      if (this.lang == "en") {
+        this.$i18n.locale = this.lang;
+        this.lang = "zh";
+      } else {
+        this.$i18n.locale = this.lang;
+        this.lang = "en";
+      }
     },
   },
 };
@@ -162,7 +178,7 @@
   justify-content: space-between;
   align-items: center;
   .userInfo {
-    width: 138px;
+    // width: 138px;
     font-size: 16px;
     font-family: Microsoft YaHei;
     font-weight: 400;
@@ -170,6 +186,7 @@
     display: flex;
     justify-content: space-between;
     align-items: center;
+    cursor: pointer;
   }
   .btnBox {
     width: 65px;
diff --git a/src/main.js b/src/main.js
index 8349af7..d886695 100644
--- a/src/main.js
+++ b/src/main.js
@@ -3,19 +3,23 @@
 import router from "./router";
 import store from "./store";
 import "./assets/css/global.css";
+import i18n from "./assets/lang/index";
 
 import axios from "./http";
 import ElementUI from "element-ui";
+import locale from "element-ui/lib/locale/lang/en";
+// import locale from 'element-ui/lib/locale/lang/zh-CN'
 import "element-ui/lib/theme-chalk/index.css";
 Vue.prototype.$echarts = echarts;
 import * as echarts from "echarts";
-Vue.use(ElementUI);
+Vue.use(ElementUI, { locale });
 Vue.prototype.$http = axios;
 Vue.prototype.$bus = new Vue();
 Vue.config.productionTip = false;
 
 new Vue({
   router,
+  i18n,
   store,
   render: (h) => h(App),
 }).$mount("#app");

--
Gitblit v1.9.3