From 6e03ec14818ddb59f41b09a0b5e22883f04c4c70 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期三, 10 十二月 2025 16:17:01 +0800
Subject: [PATCH] 添加国际化目录 local 完成 登录页面改造
---
locale/zh-Hans.json | 11 +++
package.json | 3
main.js | 21 +++++++
pages/zhijiediaobo/MoveStockBill.vue | 4 +
locale/en.json | 11 +++
pages/index/login.vue | 70 +++++++++++++++-------
components/BillListPopup/BillListPopup.vue | 6 +-
7 files changed, 99 insertions(+), 27 deletions(-)
diff --git a/components/BillListPopup/BillListPopup.vue b/components/BillListPopup/BillListPopup.vue
index e89e689..3b6f437 100644
--- a/components/BillListPopup/BillListPopup.vue
+++ b/components/BillListPopup/BillListPopup.vue
@@ -201,9 +201,9 @@
HBilltype: this.HBillType,
HSourceBillType: this.HSourceBillType,
HStockOrgID: this.HStockOrgID,
- HSourceBillNo: this.HSourceBillNo || "",
- HMater: this.HMater || "",
- HCustom: this.HCustom || ""
+ HSourceBillNo: this.HSourceBillNo || '',
+ HMater: this.HMater || '',
+ HCustom: this.HCustom || ''
},
(res) => {
let {
diff --git a/locale/en.json b/locale/en.json
new file mode 100644
index 0000000..225cd84
--- /dev/null
+++ b/locale/en.json
@@ -0,0 +1,11 @@
+{
+ "login": {
+ "title": "鏅轰簯LMES鍒堕�犳墽琛岀郴缁烢n",
+ "Language": "Language",
+ "CurrentOrganization": "Org",
+ "UserName": "UserName",
+ "PassWord": "PassWord",
+ "Login": "Login",
+ "ServiceSetting": "Server Settings"
+ }
+}
\ No newline at end of file
diff --git a/locale/zh-Hans.json b/locale/zh-Hans.json
new file mode 100644
index 0000000..dee8739
--- /dev/null
+++ b/locale/zh-Hans.json
@@ -0,0 +1,11 @@
+{
+ "login": {
+ "title": "鏅轰簯LMES鍒堕�犳墽琛岀郴缁�",
+ "Language": "璇█",
+ "CurrentOrganization": "褰撳墠缁勭粐",
+ "UserName": "鐢ㄦ埛鍚�",
+ "PassWord": "瀵嗙爜",
+ "Login": "鐧诲綍",
+ "ServiceSetting": "鏈嶅姟鍣ㄨ缃�"
+ }
+}
\ No newline at end of file
diff --git a/main.js b/main.js
index 75e4530..4ca7fb7 100644
--- a/main.js
+++ b/main.js
@@ -1,3 +1,17 @@
+// 瀵煎叆i18n鏂囦欢
+import en from "./locale/en.json"
+import ZhCN from "./locale/zh-Hans.json"
+
+const messages = {
+ "zh-Hans":ZhCN,
+ en,
+}
+
+let i18nConfig = {
+ locale: uni.getLocale(),// 鑾峰彇宸茶缃殑璇█
+ messages
+}
+
import App from './App'
import Printer from './plugins/printer'
Vue.use(Printer);
@@ -16,9 +30,13 @@
// #ifndef VUE3
import Vue from 'vue'
+import VueI18n from 'vue-i18n'
+Vue.use(VueI18n)
+const i18n = new VueI18n(i18nConfig)
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
+ i18n,
...App
})
app.$mount()
@@ -26,8 +44,11 @@
// #ifdef VUE3
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
}
diff --git a/package.json b/package.json
index 4c2978e..ec2a779 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
"i": "^0.3.7",
"npm": "^9.5.1",
"qrcode": "^1.5.4",
- "uqrcodejs": "^4.0.7"
+ "uqrcodejs": "^4.0.7",
+ "vue-i18n": "^9.1.9"
}
}
diff --git a/pages/index/login.vue b/pages/index/login.vue
index fe50272..ada1ec5 100644
--- a/pages/index/login.vue
+++ b/pages/index/login.vue
@@ -2,7 +2,7 @@
<view class="content">
<image class="bg-img" src="../../static/login.jpg"></image>
<view class="container">
- <view class="title">鏅轰簯L-MES鍒堕�犳墽琛岀郴缁�</view>
+ <view class="title">{{ $t("login.title") }}</view>
<view class="box">
<view class="logo">
<image src="../../static/logo.png" mode=""></image>
@@ -18,7 +18,17 @@
</picker>
</view> -->
<view class="item">
- <view class="left">褰撳墠缁勭粐锛�</view>
+ <view class="left">{{ $t("login.Language") }}锛�</view>
+ <picker :range="['涓枃','English']" :value="Language" @change="onLanguageChangeHandler">
+ <view class="right" style="display: flex;align-items: center;">
+ <input type="text" disabled v-model="Language" placeholder="璇烽�夋嫨璇█">
+ <uni-icons type="forward" color="#808080"
+ style="border-left: 1px solid #aaaaaa;padding: 0 8rpx;" size="18"></uni-icons>
+ </view>
+ </picker>
+ </view>
+ <view class="item">
+ <view class="left">{{ $t("login.CurrentOrganization") }}锛�</view>
<picker :range="arrayOrganization" :value="Organization" @change="OrganizationChange">
<view class="right" style="display: flex;align-items: center;">
<input type="text" disabled v-model="Organization" placeholder="璇烽�夋嫨褰撳墠缁勭粐">
@@ -27,14 +37,15 @@
</view>
</picker>
</view>
+
<view class="item">
- <view class="left">鐢ㄦ埛鍚嶏細</view>
+ <view class="left">{{ $t("login.UserName") }}锛�</view>
<view class="right">
<input type="text" v-model="UserName">
</view>
</view>
<view class="item">
- <view class="left">瀵� 鐮侊細</view>
+ <view class="left">{{ $t("login.PassWord") }}锛�</view>
<view class="right">
<input type="password" v-model="PassWord">
</view>
@@ -46,16 +57,16 @@
</view>
</view>
<uni-popup ref="popup" type="center">
- <uni-popup-dialog title="鏈嶅姟鍣ㄨ缃�" mode="input" @confirm="confirmHandler" :before-close="true"
- @close="close">
+ <uni-popup-dialog :title="$t('login.ServiceSetting')" mode="input" @confirm="confirmHandler"
+ :before-close="true" @close="close">
<view class="popup-content">
<input type="text" v-model="serverUrlName" placeholder="璇疯緭鍏ユ湇鍔″櫒鍚嶇О">
</view>
</uni-popup-dialog>
</uni-popup>
- <view class="btn" @tap="submit">鐧� 褰�</view>
- <view class="btn apibtn" @click="openServerSettingHandler">鏈嶅姟鍣ㄨ缃�</view>
+ <view class="btn" @tap="submit">{{$t("login.Login")}}</view>
+ <view class="btn apibtn" @click="openServerSettingHandler">{{$t("login.ServiceSetting")}}</view>
</view>
</view>
@@ -74,27 +85,30 @@
components: {
hFormAlert
},
+ mounted() {
+ console.log(uni.getLocale())
+ },
data() {
return {
CommonUtils,
arrayDataBases: [],
DataBases: '',
-
+ Language: '涓枃',
serverUrlandName: {
"娴欐睙鏅轰簯杩堟��": 'http://47.96.97.237/API/',
"娓╁窞娴疯瘹鍏夊": 'http://122.228.39.234:7177/API/',
"瀹佹尝鎯犲悍宸ヤ笟": 'http://172.16.72.30:6699/API/',
"浣欏鍏磋揪璧峰姩鍣�": 'http://121.37.133.104/API/',
- "鏉庢灄淇婃湰鍦版祴璇�": 'http://localhost:8082/LuBaoAPI/',
- "鏉窞鍑礉濂堢壒": 'http://192.168.50.253:8080/API/',
- "鏉窞鍑礉濂堢壒澶栫綉": 'http://erp.hzcabinet.cn:9090/API/',
- "缈佹稕娑涙湰鍦版祴璇�": 'http://localhost:81/API/',
- "闄堥晲鍝叉湰鍦版祴璇�": 'http://localhost:81/API/',
- "寮犵憺骞挎湰鍦版祴璇�": 'http://localhost:8082/API/',
- "浣欐�濇澃鏈湴娴嬭瘯": 'http://localhost:8082/LuBaoAPI/',
+ "鏉庢灄淇婃湰鍦版祴璇�": 'http://localhost:8082/LuBaoAPI/',
+ "鏉窞鍑礉濂堢壒": 'http://192.168.50.253:8080/API/',
+ "鏉窞鍑礉濂堢壒澶栫綉": 'http://erp.hzcabinet.cn:9090/API/',
+ "缈佹稕娑涙湰鍦版祴璇�": 'http://localhost:81/API/',
+ "闄堥晲鍝叉湰鍦版祴璇�": 'http://localhost:81/API/',
+ "寮犵憺骞挎湰鍦版祴璇�": 'http://localhost:8082/API/',
+ "浣欐�濇澃鏈湴娴嬭瘯": 'http://localhost:8082/LuBaoAPI/',
// 灏忓崼鍐呭缃�
- "鑻忓窞鍗櫤绉戞妧-澶栫綉": 'http://221.224.60.42:8082/API_WW/',
- "鑻忓窞鍗櫤绉戞妧-鍐呯綉": 'http://172.16.20.233:8082/API_NW/',
+ "鑻忓窞鍗櫤绉戞妧-澶栫綉": 'http://221.224.60.42:8082/API_WW/',
+ "鑻忓窞鍗櫤绉戞妧-鍐呯綉": 'http://172.16.20.233:8082/API_NW/',
// 鍥涚淮灏斿唴澶栫綉
"瀹佹尝鍥涚淮灏�-鍐呯綉": "http://192.168.0.236:9010/API/",
"瀹佹尝鍥涚淮灏�-澶栫綉": "http://220.189.218.155:9010/API/",
@@ -128,6 +142,17 @@
this.getDataBases()
},
methods: {
+ onLanguageChangeHandler(e) {
+ console.log('e: ', e.detail.value);
+ if (e.detail.value == 0) {
+ this.Language = '涓枃'
+ this.$i18n.locale = 'zh-Hans'
+ }
+ if (e.detail.value == 1) {
+ this.Language = 'English'
+ this.$i18n.locale = 'en'
+ }
+ },
async InitOrgination() {
console.log("鍒濆鍖栫粍缁�")
await this.$nextTick(() => {
@@ -240,14 +265,13 @@
title: '鐧诲綍涓�...',
mask: true
})
- var data =
- {
+ var data = {
HUserNumber: this.UserName,
HPassWord: this.PassWord,
HStockOrgID: this.HOrgName,
HStockOrgName: this.Organization
}
-
+
// UserName: this.UserName,
// PassWord: this.PassWord,
// HOrgName: this.HOrgName,
@@ -289,7 +313,7 @@
})
},
});
-
+
// uni.request({
// url: this.serverUrl + '/Web/GetUser',
// method: 'GET',
@@ -382,7 +406,7 @@
.login {
width: 100%;
- height: 480rpx;
+ height: 520rpx;
position: absolute;
top: 90rpx;
z-index: 0;
diff --git a/pages/zhijiediaobo/MoveStockBill.vue b/pages/zhijiediaobo/MoveStockBill.vue
index 9b58421..43ad36f 100644
--- a/pages/zhijiediaobo/MoveStockBill.vue
+++ b/pages/zhijiediaobo/MoveStockBill.vue
@@ -672,6 +672,10 @@
console.log('浠撲綅鐮�: ', e);
let index = this.HStockPlaceNameList.findIndex(elem => elem['鏉$爜缂栧彿'] == e)
console.log('index: ', index);
+ // 涓嶅厛缃┖鐨勮瘽锛屾暟鎹啀娆℃壂鎻忕浉鍚岀殑浠撲綅鐮� 涓嶄細瑙﹀彂缁勪欢鍐呯殑鍒锋柊
+ this.hform.HStockPlaceID = 0
+ this.hform.HStockPlaceName = ''
+ await this.$nextTick()
if (index == -1) {
uni.showToast({
icon: 'none',
--
Gitblit v1.9.1