From 66a9fc7a0065c4b1f0d488018659da98ee8594e7 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 09 三月 2026 13:57:11 +0800
Subject: [PATCH] #国际化i18n
---
src/main/webapp/views/index.html | 348 ++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 289 insertions(+), 59 deletions(-)
diff --git a/src/main/webapp/views/index.html b/src/main/webapp/views/index.html
index 37d2110..fad5958 100644
--- a/src/main/webapp/views/index.html
+++ b/src/main/webapp/views/index.html
@@ -340,6 +340,10 @@
flex-shrink: 0;
}
+ .lang-select {
+ width: 160px;
+ }
+
.header-right .el-tag {
border-radius: 999px;
}
@@ -540,7 +544,7 @@
size="small"
clearable
prefix-icon="el-icon-search"
- placeholder="鎼滅储鑿滃崟">
+ :placeholder="t('index.searchMenu')">
</el-input>
</div>
@@ -586,14 +590,14 @@
<div class="aside-empty" v-if="filteredMenus.length === 0">
<el-empty
:image-size="80"
- :description="menuKeyword ? '娌℃湁鍖归厤鑿滃崟' : '褰撳墠璐﹀彿娌℃湁鍙敤鑿滃崟'">
+ :description="menuKeyword ? t('index.noMatchedMenu') : t('index.noAvailableMenu')">
</el-empty>
</div>
</template>
</el-scrollbar>
<div class="aside-footer" v-show="!isCollapse">
- <div class="aside-footer-copy">漏 2026 娴欐睙涓壃绔嬪簱鎶�鏈湁闄愬叕鍙�</div>
+ <div class="aside-footer-copy">漏 2026 {{ t('app.company') }}</div>
<div class="aside-footer-version">
<span class="aside-footer-version-text">{{ versionText }}</span>
<el-tag
@@ -627,7 +631,7 @@
size="mini"
:type="licenseTagType"
effect="dark">
- 涓存椂璁稿彲璇佹湁鏁堟湡锛歿{ licenseDays }}澶�
+ {{ t('index.licenseDays', [licenseDays]) }}
</el-tag>
<el-tag
v-if="fakeVisible"
@@ -636,8 +640,20 @@
:type="fakeRunning ? 'danger' : 'info'"
effect="dark"
@click.native="toggleFakeSystem">
- {{ fakeRunning ? '浠跨湡杩愯涓�' : '浠跨湡鏈繍琛�' }}
+ {{ fakeRunning ? t('index.fakeRunning') : t('index.fakeStopped') }}
</el-tag>
+ <el-select
+ v-model="currentLocale"
+ size="mini"
+ class="lang-select"
+ @change="handleLocaleChange">
+ <el-option
+ v-for="item in localeOptions"
+ :key="item.tag"
+ :label="item.label"
+ :value="item.tag">
+ </el-option>
+ </el-select>
<el-button circle size="mini" icon="el-icon-refresh" @click="refreshActiveTab"></el-button>
<el-button circle size="mini" icon="el-icon-full-screen" @click="toggleFullScreen"></el-button>
@@ -648,8 +664,8 @@
<i class="el-icon-arrow-down"></i>
</span>
<el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="profile">鍩烘湰璧勬枡</el-dropdown-item>
- <el-dropdown-item command="logout" divided>閫�鍑虹櫥褰�</el-dropdown-item>
+ <el-dropdown-item command="profile">{{ t('common.profile') }}</el-dropdown-item>
+ <el-dropdown-item command="logout" divided>{{ t('common.logout') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
@@ -671,10 +687,10 @@
</el-tabs>
<div class="tabs-tools">
- <el-tooltip content="鍏抽棴鍏朵粬椤电" placement="top">
+ <el-tooltip :content="t('common.closeOtherTabs')" placement="top">
<el-button size="mini" icon="el-icon-close" @click="closeOtherTabs"></el-button>
</el-tooltip>
- <el-tooltip content="杩斿洖鎺у埗涓績" placement="top">
+ <el-tooltip :content="t('common.backHome')" placement="top">
<el-button size="mini" type="primary" icon="el-icon-house" @click="openHomeTab"></el-button>
</el-tooltip>
</div>
@@ -691,6 +707,7 @@
v-for="tab in tabs"
:key="'frame-' + tab.name"
class="page-frame"
+ :data-tab-name="tab.name"
v-show="activeTab === tab.name"
:src="tab.currentSrc"
@load="handleFrameLoad(tab.name)">
@@ -701,13 +718,13 @@
</el-container>
<el-dialog
- title="璁稿彲璇佸嵆灏嗚繃鏈�"
+ :title="t('index.licenseExpiring')"
:visible.sync="licenseDialogVisible"
width="420px"
:close-on-click-modal="false">
<div class="license-dialog-text">{{ licenseDialogText }}</div>
<span slot="footer">
- <el-button type="primary" @click="licenseDialogVisible = false">鐭ラ亾浜�</el-button>
+ <el-button type="primary" @click="licenseDialogVisible = false">{{ t('common.ok') }}</el-button>
</span>
</el-dialog>
@@ -742,6 +759,41 @@
};
var TAB_STORAGE_KEY = "wcs-element-home-tabs";
var USER_STORAGE_KEY = "username";
+ var INDEX_I18N_FALLBACKS = {
+ "app.title": "娴欐睙涓壃 - 鑷姩鍖栫珛浣撲粨搴� - WCS",
+ "app.company": "娴欐睙涓壃绔嬪簱鎶�鏈湁闄愬叕鍙�",
+ "common.loadingPage": "姝e湪鍔犺浇椤甸潰...",
+ "common.loadingTab": "姝e湪鍔犺浇 鈥渰0}鈥� ...",
+ "common.refreshingTab": "姝e湪鍒锋柊 鈥渰0}鈥� ...",
+ "common.ok": "鐭ラ亾浜�",
+ "common.prompt": "鎻愮ず",
+ "common.profile": "鍩烘湰璧勬枡",
+ "common.logout": "閫�鍑虹櫥褰�",
+ "common.closeOtherTabs": "鍏抽棴鍏朵粬椤电",
+ "common.backHome": "杩斿洖鎺у埗涓績",
+ "common.aiAssistant": "AI鍔╂墜",
+ "common.workPage": "宸ヤ綔椤甸潰",
+ "common.businessPage": "涓氬姟椤甸潰",
+ "index.searchMenu": "鎼滅储鑿滃崟",
+ "index.noMatchedMenu": "娌℃湁鍖归厤鑿滃崟",
+ "index.noAvailableMenu": "褰撳墠璐﹀彿娌℃湁鍙敤鑿滃崟",
+ "index.licenseDays": "涓存椂璁稿彲璇佹湁鏁堟湡锛歿0}澶�",
+ "index.fakeRunning": "浠跨湡杩愯涓�",
+ "index.fakeStopped": "浠跨湡鏈繍琛�",
+ "index.licenseExpiring": "璁稿彲璇佸嵆灏嗚繃鏈�",
+ "index.homeTab": "鎺у埗涓績",
+ "index.homeGroup": "瀹炴椂鐩戞帶",
+ "index.profileGroup": "璐︽埛涓績",
+ "index.versionLoading": "Version loading...",
+ "index.licenseExpireAt": "璁稿彲璇佸皢浜� {0} 杩囨湡锛屽墿浣欐湁鏁堟湡锛歿1} 澶┿��",
+ "index.confirmStopFake": "纭畾瑕佸仠姝豢鐪熸ā鎷熷悧锛�",
+ "index.confirmStartFake": "纭畾瑕佸惎鍔ㄤ豢鐪熸ā鎷熷悧锛�",
+ "index.fakeStoppedSuccess": "浠跨湡妯℃嫙宸插仠姝�",
+ "index.fakeStartedSuccess": "浠跨湡妯℃嫙宸插惎鍔�",
+ "index.operationFailed": "鎿嶄綔澶辫触",
+ "index.menuLoadFailed": "鑿滃崟鍔犺浇澶辫触",
+ "index.menuLoadFailedDetail": "鑿滃崟鍔犺浇澶辫触锛岃妫�鏌ユ帴鍙g姸鎬�"
+ };
new Vue({
el: "#app",
@@ -750,7 +802,7 @@
isCollapse: false,
menuLoading: true,
pageLoading: true,
- loadingText: "姝e湪鍔犺浇椤甸潰...",
+ loadingText: window.WCS_I18N ? window.WCS_I18N.tl("姝e湪鍔犺浇椤甸潰...") : "姝e湪鍔犺浇椤甸潰...",
menuKeyword: "",
menus: [],
defaultOpeneds: [],
@@ -762,12 +814,14 @@
licenseDays: null,
licenseDialogVisible: false,
licenseDialogText: "",
+ currentLocale: window.WCS_I18N ? window.WCS_I18N.getLocale() : "zh-CN",
+ localeOptions: [],
fakeVisible: false,
fakeRunning: false,
fakeStatusInterval: null,
menuSyncVersion: 0,
menuSyncTimer: null,
- userName: localStorage.getItem(USER_STORAGE_KEY) || "绠$悊鍛�",
+ userName: localStorage.getItem(USER_STORAGE_KEY) || (window.WCS_I18N ? window.WCS_I18N.tl("绠$悊鍛�") : "绠$悊鍛�"),
aiLayerIndex: null,
aiTipIndex: null
};
@@ -819,7 +873,7 @@
return result;
},
activeTabMeta: function () {
- return this.getTabByName(this.activeTab) || this.createTab(HOME_TAB_CONFIG);
+ return this.getTabByName(this.activeTab) || this.createTab(this.resolveHomeConfig());
},
activeTabTitle: function () {
return this.activeTabMeta.title;
@@ -829,7 +883,7 @@
},
versionText: function () {
if (!this.version) {
- return "Version loading...";
+ return this.t("index.versionLoading");
}
return "Version " + this.version;
},
@@ -861,18 +915,18 @@
return "info";
},
userShortName: function () {
- return (this.userName || "绠$悊鍛�").substring(0, 1);
+ return (this.userName || this.tl("绠$悊鍛�")).substring(0, 1);
}
},
watch: {
activeTab: function () {
var tab = this.getTabByName(this.activeTab);
- this.syncMenuStateByUrl(tab ? tab.url : HOME_TAB_CONFIG.url);
+ this.syncMenuStateByUrl(tab ? tab.url : this.resolveHomeConfig().url);
this.pageLoading = !!(tab && !tab.loaded);
if (this.pageLoading) {
- this.loadingText = "姝e湪鍔犺浇 鈥�" + tab.title + "鈥� ...";
+ this.loadingText = this.t("common.loadingTab", [tab.title]);
}
- document.title = (tab ? tab.title : HOME_TAB_CONFIG.title) + " - 娴欐睙涓壃 - 鑷姩鍖栫珛浣撲粨搴� - WCS";
+ this.updateDocumentTitle(tab ? tab.title : this.resolveHomeConfig().title);
this.persistTabs();
}
},
@@ -883,6 +937,7 @@
}
this.restoreTabs();
+ this.bindI18n();
this.installCompatBridge();
this.loadSystemVersion();
this.loadMenu();
@@ -892,7 +947,7 @@
},
mounted: function () {
$("#ai-assistant-btn").html(getAiIconHtml(60, 60));
- document.title = this.activeTabTitle + " - 娴欐睙涓壃 - 鑷姩鍖栫珛浣撲粨搴� - WCS";
+ this.updateDocumentTitle(this.activeTabTitle);
},
beforeDestroy: function () {
if (this.fakeStatusInterval) {
@@ -913,6 +968,98 @@
}
},
methods: {
+ t: function (key, params) {
+ var value = window.WCS_I18N ? window.WCS_I18N.t(key, params) : key;
+ if (value !== key) {
+ return value;
+ }
+ value = INDEX_I18N_FALLBACKS[key] || key;
+ if (!params) {
+ return value;
+ }
+ if (Object.prototype.toString.call(params) === "[object Array]") {
+ for (var i = 0; i < params.length; i++) {
+ value = value.replace(new RegExp("\\{" + i + "\\}", "g"), params[i]);
+ }
+ return value;
+ }
+ return value;
+ },
+ tl: function (text) {
+ return window.WCS_I18N ? window.WCS_I18N.tl(text) : text;
+ },
+ bindI18n: function () {
+ var that = this;
+ if (!window.WCS_I18N) {
+ return;
+ }
+ window.WCS_I18N.onReady(function (i18n) {
+ that.currentLocale = i18n.getLocale();
+ that.localeOptions = i18n.getLocaleOptions();
+ that.refreshI18nState();
+ });
+ },
+ refreshI18nState: function () {
+ var that = this;
+ var homeConfig = this.resolveHomeConfig();
+ var profileConfig = this.resolveProfileConfig();
+ var i;
+ HOME_TAB_CONFIG.title = homeConfig.title;
+ HOME_TAB_CONFIG.group = homeConfig.group;
+ PROFILE_TAB_CONFIG.title = profileConfig.title;
+ PROFILE_TAB_CONFIG.group = profileConfig.group;
+ for (i = 0; i < this.tabs.length; i++) {
+ if (this.isHomeTabUrl(this.tabs[i].url)) {
+ this.tabs[i].title = homeConfig.title;
+ this.tabs[i].group = homeConfig.group;
+ this.tabs[i].home = true;
+ } else if (this.resolveViewSrc(this.tabs[i].url) === this.resolveViewSrc(profileConfig.url)) {
+ this.tabs[i].title = profileConfig.title;
+ this.tabs[i].group = profileConfig.group;
+ } else {
+ this.tabs[i].title = this.translateTabTitle(this.tabs[i].title);
+ this.tabs[i].group = this.tl(this.tabs[i].group);
+ }
+ }
+ this.updateDocumentTitle(this.activeTabTitle);
+ this.persistTabs();
+ this.updateLicenseDialogText();
+ this.$nextTick(function () {
+ if (window.WCS_I18N) {
+ window.WCS_I18N.apply(document.body);
+ }
+ that.syncAllFramesI18n();
+ });
+ },
+ handleLocaleChange: function (locale) {
+ if (window.WCS_I18N) {
+ window.WCS_I18N.setLocale(locale);
+ }
+ },
+ resolveHomeConfig: function () {
+ return {
+ title: this.t("index.homeTab"),
+ url: HOME_TAB_CONFIG.url,
+ home: true,
+ group: this.t("index.homeGroup"),
+ menuKey: HOME_TAB_CONFIG.menuKey || ""
+ };
+ },
+ resolveProfileConfig: function () {
+ return {
+ title: this.t("common.profile"),
+ url: PROFILE_TAB_CONFIG.url,
+ home: false,
+ group: this.t("index.profileGroup"),
+ menuKey: PROFILE_TAB_CONFIG.menuKey || ""
+ };
+ },
+ translateTabTitle: function (title) {
+ return this.tl(title);
+ },
+ updateDocumentTitle: function (title) {
+ document.title = title + " - " + this.t("app.title");
+ },
resolveMenuIcon: function (code) {
var iconMap = {
index: "el-icon-s-home",
@@ -935,7 +1082,7 @@
title: config.title,
name: config.url,
url: config.url,
- currentSrc: config.url,
+ currentSrc: this.addNonce(config.url),
home: !!config.home,
group: config.group || "",
menuKey: config.menuKey || "",
@@ -944,17 +1091,17 @@
},
normalizeStoredTab: function (tab) {
var created = this.createTab({
- title: tab.title,
+ title: this.translateTabTitle(tab.title),
url: this.resolveViewSrc(tab.url),
home: !!tab.home,
- group: tab.group || "",
+ group: this.tl(tab.group || ""),
menuKey: tab.menuKey || ""
});
created.loaded = false;
return created;
},
restoreTabs: function () {
- var homeTab = this.createTab(HOME_TAB_CONFIG);
+ var homeTab = this.createTab(this.resolveHomeConfig());
var raw = localStorage.getItem(TAB_STORAGE_KEY);
var parsed;
var tabs = [];
@@ -996,9 +1143,9 @@
this.tabs = tabs;
this.activeTab = this.hasTab(active) ? active : homeTab.name;
- this.loadingText = "姝e湪鍔犺浇 鈥�" + this.activeTabTitle + "鈥� ...";
+ this.loadingText = this.t("common.loadingTab", [this.activeTabTitle]);
this.pageLoading = true;
- document.title = this.activeTabTitle + " - 娴欐睙涓壃 - 鑷姩鍖栫珛浣撲粨搴� - WCS";
+ this.updateDocumentTitle(this.activeTabTitle);
},
persistTabs: function () {
var tabs = [];
@@ -1021,7 +1168,8 @@
return !!this.getTabByName(name);
},
isHomeTabUrl: function (url) {
- return this.resolveViewSrc(url || HOME_TAB_CONFIG.url) === this.resolveViewSrc(HOME_TAB_CONFIG.url);
+ var homeUrl = this.resolveHomeConfig().url;
+ return this.resolveViewSrc(url || homeUrl) === this.resolveViewSrc(homeUrl);
},
getTabByName: function (name) {
var i;
@@ -1054,28 +1202,29 @@
}
}
- this.loadingText = "姝e湪鍔犺浇 鈥�" + tab.title + "鈥� ...";
+ this.loadingText = this.t("common.loadingTab", [tab.title]);
this.pageLoading = !tab.loaded;
this.activeTab = tab.name;
this.syncMenuStateByUrl(tab.url);
},
openHomeTab: function () {
- this.addOrActivateTab(HOME_TAB_CONFIG);
+ this.addOrActivateTab(this.resolveHomeConfig());
},
openProfileTab: function () {
- this.addOrActivateTab(PROFILE_TAB_CONFIG);
+ this.addOrActivateTab(this.resolveProfileConfig());
},
closeAllTabs: function () {
- this.tabs = [this.createTab(HOME_TAB_CONFIG)];
- this.activeTab = HOME_TAB_CONFIG.url;
- this.syncMenuStateByUrl(HOME_TAB_CONFIG.url);
+ var homeConfig = this.resolveHomeConfig();
+ this.tabs = [this.createTab(homeConfig)];
+ this.activeTab = homeConfig.url;
+ this.syncMenuStateByUrl(homeConfig.url);
this.pageLoading = true;
- this.loadingText = "姝e湪鍔犺浇 鈥滄帶鍒朵腑蹇冣�� ...";
+ this.loadingText = this.t("common.loadingTab", [homeConfig.title]);
this.persistTabs();
},
closeOtherTabs: function () {
var active = this.getTabByName(this.activeTab);
- var homeTab = this.createTab(HOME_TAB_CONFIG);
+ var homeTab = this.createTab(this.resolveHomeConfig());
var result = [homeTab];
if (active && active.name !== homeTab.name) {
@@ -1087,7 +1236,7 @@
},
removeTab: function (name) {
var i;
- var nextTabName = HOME_TAB_CONFIG.url;
+ var nextTabName = this.resolveHomeConfig().url;
for (i = 0; i < this.tabs.length; i++) {
if (this.tabs[i].name === name) {
@@ -1104,8 +1253,8 @@
}
if (this.tabs.length === 0) {
- this.tabs.push(this.createTab(HOME_TAB_CONFIG));
- nextTabName = HOME_TAB_CONFIG.url;
+ this.tabs.push(this.createTab(this.resolveHomeConfig()));
+ nextTabName = this.resolveHomeConfig().url;
}
this.activeTab = nextTabName;
@@ -1116,6 +1265,7 @@
if (tab) {
tab.loaded = true;
}
+ this.syncFrameI18n(name);
if (this.activeTab === name) {
this.pageLoading = false;
}
@@ -1127,11 +1277,84 @@
}
tab.loaded = false;
tab.currentSrc = this.addNonce(tab.url);
- this.loadingText = "姝e湪鍒锋柊 鈥�" + tab.title + "鈥� ...";
+ this.loadingText = this.t("common.refreshingTab", [tab.title]);
this.pageLoading = true;
},
addNonce: function (url) {
return url + (url.indexOf("?") === -1 ? "?" : "&") + "_t=" + new Date().getTime();
+ },
+ findFrameElement: function (name) {
+ var frames;
+ var i;
+ if (!this.$el) {
+ return null;
+ }
+ frames = this.$el.querySelectorAll("iframe[data-tab-name]");
+ for (i = 0; i < frames.length; i++) {
+ if (frames[i].getAttribute("data-tab-name") === name) {
+ return frames[i];
+ }
+ }
+ return null;
+ },
+ syncFrameI18n: function (name) {
+ var that = this;
+ var frame = this.findFrameElement(name);
+ var frameWindow;
+ var frameDocument;
+ var script;
+
+ function applyFrameI18n() {
+ try {
+ if (!frameWindow.WCS_I18N || typeof frameWindow.WCS_I18N.onReady !== "function") {
+ return;
+ }
+ frameWindow.WCS_I18N.setLocale(that.currentLocale || "zh-CN", false);
+ frameWindow.WCS_I18N.onReady(function (i18n) {
+ i18n.apply(frameDocument.body || frameDocument.documentElement);
+ if (frameDocument.title) {
+ frameDocument.title = i18n.tl(frameDocument.title);
+ }
+ });
+ } catch (e) {
+ }
+ }
+
+ if (!frame) {
+ return;
+ }
+ try {
+ frameWindow = frame.contentWindow;
+ frameDocument = frameWindow.document;
+ } catch (e) {
+ return;
+ }
+ try {
+ frameWindow.localStorage.setItem("wcs_lang", this.currentLocale || "zh-CN");
+ } catch (e) {
+ }
+ if (frameDocument && frameDocument.documentElement) {
+ frameDocument.documentElement.lang = this.currentLocale || "zh-CN";
+ }
+ if (frameWindow.WCS_I18N && typeof frameWindow.WCS_I18N.onReady === "function") {
+ applyFrameI18n();
+ return;
+ }
+ if (!frameDocument || !frameDocument.head || frameDocument.getElementById("wcs-i18n-bridge-script")) {
+ return;
+ }
+ script = frameDocument.createElement("script");
+ script.id = "wcs-i18n-bridge-script";
+ script.type = "text/javascript";
+ script.src = baseUrl + "/static/js/common.js";
+ script.onload = applyFrameI18n;
+ frameDocument.head.appendChild(script);
+ },
+ syncAllFramesI18n: function () {
+ var i;
+ for (i = 0; i < this.tabs.length; i++) {
+ this.syncFrameI18n(this.tabs[i].name);
+ }
},
toggleCollapse: function () {
this.isCollapse = !this.isCollapse;
@@ -1197,7 +1420,7 @@
item = group.subMenu[j];
subMenu.push({
id: item.id,
- name: item.name || item.code || "鏈懡鍚嶉〉闈�",
+ name: item.name || item.code || this.tl("鏈懡鍚嶉〉闈�"),
code: item.code || "",
url: this.buildMenuSrc(item.code, item.id),
tabKey: this.buildMenuSrc(item.code, item.id)
@@ -1206,7 +1429,7 @@
result.push({
menuId: group.menuId,
- menu: group.menu || "鏈懡鍚嶅垎缁�",
+ menu: group.menu || this.tl("鏈懡鍚嶅垎缁�"),
menuCode: group.menuCode || "",
subMenu: subMenu
});
@@ -1233,7 +1456,7 @@
},
resolveViewSrc: function (path) {
if (!path) {
- return HOME_TAB_CONFIG.url;
+ return this.resolveHomeConfig().url;
}
if (/^https?:\/\//.test(path) || path.indexOf(baseUrl) === 0) {
return path;
@@ -1266,7 +1489,7 @@
}
},
syncMenuStateByUrl: function (url) {
- var targetUrl = this.resolveViewSrc(url || HOME_TAB_CONFIG.url);
+ var targetUrl = this.resolveViewSrc(url || this.resolveHomeConfig().url);
var activeMenuKey = "";
var groupIndex = "";
var that = this;
@@ -1336,12 +1559,12 @@
} else if (res.code === 403) {
top.location.href = baseUrl + "/login";
} else {
- that.$message.error(res.msg || "鑿滃崟鍔犺浇澶辫触");
+ that.$message.error(res.msg || that.t("index.menuLoadFailed"));
}
},
error: function () {
that.menuLoading = false;
- that.$message.error("鑿滃崟鍔犺浇澶辫触锛岃妫�鏌ユ帴鍙g姸鎬�");
+ that.$message.error(that.t("index.menuLoadFailedDetail"));
}
});
},
@@ -1388,6 +1611,7 @@
showPopup: function (days) {
var currentDate;
var expiryDate;
+ var formattedDate;
if (days === "" || days === null || typeof days === "undefined") {
this.hidePopup();
@@ -1397,9 +1621,15 @@
currentDate = new Date();
expiryDate = new Date();
expiryDate.setDate(currentDate.getDate() + Number(days) + 1);
- this.licenseDialogText = "璁稿彲璇佸皢浜� " + new Intl.DateTimeFormat("zh-CN").format(expiryDate) +
- " 杩囨湡锛屽墿浣欐湁鏁堟湡锛�" + days + " 澶┿��";
+ formattedDate = new Intl.DateTimeFormat(this.currentLocale || "zh-CN").format(expiryDate);
+ this.licenseDialogText = this.t("index.licenseExpireAt", [formattedDate, days]);
this.licenseDialogVisible = true;
+ },
+ updateLicenseDialogText: function () {
+ if (this.licenseDays === "" || this.licenseDays === null || typeof this.licenseDays === "undefined" || this.licenseDays > 15) {
+ return;
+ }
+ this.showPopup(this.licenseDays);
},
hidePopup: function () {
this.licenseDialogVisible = false;
@@ -1447,17 +1677,17 @@
if (this.fakeRunning) {
url = baseUrl + "/openapi/stopFakeSystem";
- text = "纭畾瑕佸仠姝豢鐪熸ā鎷熷悧锛�";
- successMsg = "浠跨湡妯℃嫙宸插仠姝�";
+ text = this.t("index.confirmStopFake");
+ successMsg = this.t("index.fakeStoppedSuccess");
running = false;
} else {
url = baseUrl + "/openapi/startFakeSystem";
- text = "纭畾瑕佸惎鍔ㄤ豢鐪熸ā鎷熷悧锛�";
- successMsg = "浠跨湡妯℃嫙宸插惎鍔�";
+ text = this.t("index.confirmStartFake");
+ successMsg = this.t("index.fakeStartedSuccess");
running = true;
}
- this.$confirm(text, "鎻愮ず", {
+ this.$confirm(text, this.t("common.prompt"), {
type: "warning"
}).then(function () {
$.ajax({
@@ -1469,7 +1699,7 @@
that.fakeRunning = running;
that.$message.success(successMsg);
} else {
- that.$message.error(res.msg || "鎿嶄綔澶辫触");
+ that.$message.error(res.msg || that.t("index.operationFailed"));
}
}
});
@@ -1484,7 +1714,7 @@
},
showAiTip: function () {
this.hideAiTip();
- this.aiTipIndex = layer.tips("AI鍔╂墜", "#ai-assistant-btn", {
+ this.aiTipIndex = layer.tips(this.t("common.aiAssistant"), "#ai-assistant-btn", {
tips: [1, "#333"],
time: -1
});
@@ -1565,7 +1795,7 @@
startUserSync: function () {
var that = this;
this.userSyncTimer = setInterval(function () {
- that.userName = localStorage.getItem(USER_STORAGE_KEY) || "绠$悊鍛�";
+ that.userName = localStorage.getItem(USER_STORAGE_KEY) || that.tl("绠$悊鍛�");
}, 1000);
},
installCompatBridge: function () {
@@ -1588,10 +1818,10 @@
}
url = that.resolveViewSrc(param.menuPath);
that.addOrActivateTab({
- title: that.stripTags(param.menuName) || "宸ヤ綔椤甸潰",
+ title: that.stripTags(param.menuName) || that.t("common.workPage"),
url: url,
home: false,
- group: "涓氬姟椤甸潰",
+ group: that.t("common.businessPage"),
menuKey: that.findMenuKeyByUrl(url)
});
};
@@ -1603,10 +1833,10 @@
}
url = that.resolveViewSrc(param.menuPath);
that.addOrActivateTab({
- title: that.stripTags(param.menuName) || HOME_TAB_CONFIG.title,
+ title: that.stripTags(param.menuName) || that.resolveHomeConfig().title,
url: url,
home: true,
- group: HOME_TAB_CONFIG.group,
+ group: that.resolveHomeConfig().group,
menuKey: that.findMenuKeyByUrl(url)
});
};
--
Gitblit v1.9.1