chenhaozhe
2025-12-10 6e03ec14818ddb59f41b09a0b5e22883f04c4c70
添加国际化目录 local 完成 登录页面改造
5个文件已修改
2个文件已添加
126 ■■■■ 已修改文件
components/BillListPopup/BillListPopup.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
locale/en.json 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
locale/zh-Hans.json 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.js 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/login.vue 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/zhijiediaobo/MoveStockBill.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 {
locale/en.json
New file
@@ -0,0 +1,11 @@
{
    "login": {
        "title": "智云LMES制造执行系统En",
        "Language": "Language",
        "CurrentOrganization": "Org",
        "UserName": "UserName",
        "PassWord": "PassWord",
        "Login": "Login",
        "ServiceSetting": "Server Settings"
    }
}
locale/zh-Hans.json
New file
@@ -0,0 +1,11 @@
{
    "login": {
        "title": "智云LMES制造执行系统",
        "Language": "语言",
        "CurrentOrganization": "当前组织",
        "UserName": "用户名",
        "PassWord": "密码",
        "Login": "登录",
        "ServiceSetting": "服务器设置"
    }
}
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
  }
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"
  }
}
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;
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',