From f511c392b0ee495502e7a107e4d8de081af6f2d2 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期日, 04 一月 2026 10:18:28 +0800
Subject: [PATCH] Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev

---
 main.js |   79 +++++++++++++++++++++++++--------------
 1 files changed, 51 insertions(+), 28 deletions(-)

diff --git a/main.js b/main.js
index 6bd543f..aade6d2 100644
--- a/main.js
+++ b/main.js
@@ -1,32 +1,37 @@
 // 瀵煎叆i18n鏂囦欢
 import en from "./locale/en.json"
 import ZhCN from "./locale/zh-Hans.json"
+import {
+    addMissingKeyToMap
+} from "@/utils/i18n.js"
 
 // 鍔犺浇鏈湴璇█鍖�
 const messages = {
-	"zh-Hans":ZhCN,
-	en,
+    "zh-Hans": ZhCN,
+    en,
 }
 
 let i18nConfig = {
-  locale: uni.getLocale(),// 鑾峰彇宸茶缃殑璇█
-  messages,
-  silentTranslationWarn: true,
-  missing: function(locale, key, vm, values){
-    // 椤甸潰涓惈鏈夎瑷�鍖呬腑涓嶅瓨鍦ㄧ殑瀛楁锛岄渶鍚屾鍒版暟鎹簱涓�
-      console.log("[i18n]: 椤甸潰涓璳ey涓�: ", key ,"鐨勫瓧娈靛湪缈昏瘧鏂囦欢涓笉瀛樺湪锛屽悓姝ュ埌鏁版嵁搴�...")
-  
-    // 涓洪檷浣庡悓姝ョ殑闅惧害锛孉PP涓� 瀵圭炕璇戞ā鍧楃殑key 涓嶉噰鐢ㄦ暟缁勭殑鍐欐硶锛岀粺涓�浣跨敤 妯″潡鍚�.瀛楁鍚嶇殑鍐欐硶
-  }
+    locale: uni.getLocale(), // 鑾峰彇宸茶缃殑璇█
+    messages,
+    silentTranslationWarn: true,
+    
+    // missing: function(locale, key, vm, values){
+    //   // 椤甸潰涓惈鏈夎瑷�鍖呬腑涓嶅瓨鍦ㄧ殑瀛楁锛岄渶鍚屾鍒版暟鎹簱涓�
+    //     console.log("[i18n]: 椤甸潰涓璳ey涓�: ", key ,"鐨勫瓧娈靛湪缈昏瘧鏂囦欢涓笉瀛樺湪锛屽悓姝ュ埌鏁版嵁搴�...")
+    // 
+    //   // 涓洪檷浣庡悓姝ョ殑闅惧害锛孉PP涓� 瀵圭炕璇戞ā鍧楃殑key 涓嶉噰鐢ㄦ暟缁勭殑鍐欐硶锛岀粺涓�浣跨敤 妯″潡鍚�.瀛楁鍚嶇殑鍐欐硶
+    //   let [HMouldName, HFieldKey] = key.split('.')
+    //   
+    //   
+    // }
 }
-
-
 
 import App from './App'
 import Printer from './plugins/printer'
 Vue.use(Printer);
 // 鐢熶骇鐜
- // Vue.prototype.serverUrl = "https://qqyapi.xinlinsoft.cn/qqy-api";
+// Vue.prototype.serverUrl = "https://qqyapi.xinlinsoft.cn/qqy-api";
 // 寮�鍙戠幆澧�
 // Vue.prototype.serverUrl = "http://47.96.97.237/API";
 
@@ -41,9 +46,23 @@
 // #ifndef VUE3
 import Vue from 'vue'
 import VueI18n from 'vue-i18n'
-
 Vue.use(VueI18n)
 const i18n = new VueI18n(i18nConfig)
+// TODO missing鍥炶皟鏃犳硶婊¤冻 鍔犺浇绾夸笂鍖� 鍚庣殑妫�楠屽姛鑳斤紝闇�閲嶅啓$t鍑芥暟
+const originalT = Vue.prototype.$t
+Vue.prototype.$t = function(key, ...args) {
+    // 璋冪敤鍘熷 $t 鎵ц缈昏瘧
+    const translated = originalT.call(this, key, args);
+    
+    // console.log(i18n.getLocaleMessage(i18n.locale))
+    if (translated == key) {
+        // 缈昏瘧鍚庣殑鏂囨湰涓庝紶鍏ョ殑key鐩稿悓锛屽垯琛ㄧず缈昏瘧鏂囨湰缂哄け 璁板綍缂哄け鐨勭炕璇戞枃鏈�
+        let [moduleName, fieldCode] = key.split(".")
+        addMissingKeyToMap(moduleName, fieldCode)
+    }
+
+    return translated
+}
 Vue.config.productionTip = false
 App.mpType = 'app'
 const app = new Vue({
@@ -55,25 +74,29 @@
 // #endif
 
 // #ifdef VUE3
-import { createSSRApp } from 'vue'
-import { createI18n } from 'vue-i18n'// v9.x
+import {
+    createSSRApp
+} from 'vue'
+import {
+    createI18n
+} from 'vue-i18n' // v9.x
 const i18n = createI18n(i18nConfig)
 export function createApp() {
-  const app = createSSRApp(App)
-  app.use(i18n)
-  return {
-    app
-  }
+    const app = createSSRApp(App)
+    app.use(i18n)
+    return {
+        app
+    }
 }
 export default i18n
 // #endif
 // main.js uni.showToast 瀹炵幇鍏ㄥ眬鎷︽埅璁剧疆榛樿鎻愮ず鏃堕棿涓�3.5绉�
 const originalShowToast = uni.showToast;
 uni.showToast = (options) => {
-  originalShowToast({
-    duration: options.duration || 3500, // 榛樿2绉�
-    icon: options.icon || 'none',
-	title: options.title || 'none',
-    ...options
-  });
+    originalShowToast({
+        duration: options.duration || 3500, // 榛樿2绉�
+        icon: options.icon || 'none',
+        title: options.title || 'none',
+        ...options
+    });
 };
\ No newline at end of file

--
Gitblit v1.9.1