国际化设置

This commit is contained in:
2025-05-28 16:32:15 +08:00
parent ecd60fb413
commit c2470f8c23
12 changed files with 820 additions and 18 deletions

View File

@@ -3,27 +3,37 @@
<nav-bar title="设置" :inner2="true" @goIn="goIn" :show="false"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="input-wrap">
<view class="input-label">服务器地址</view>
<input type="text" class="setup-input" placeholder="请输入服务器地址" v-model="addrip">
<view class="zd-row">
<view class="zd-col-8 input-label">{{$t('setting.language')}}</view>
<view class="zd-col-16">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
</view>
</view>
</view>
<view class="zd_wrapper">
<view class="input-wrap">
<view class="input-label">刷新时间(s)</view>
<input type="text" class="setup-input" placeholder="请输入刷新时间" v-model="setTime">
<view class="zd-row">
<view class="zd-col-8 input-label">{{$t('setting.server')}}</view>
<view class="zd-col-16"><input type="text" class="setup-input" v-model="addrip"></view>
</view>
</view>
<view class="zd_wrapper">
<view class="input-wrap">
<view class="input-label" style="margin-right: 20upx;">客户标签打印</view>
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
<view class="zd-row">
<view class="zd-col-8 input-label">{{$t('setting.refresh')}}(s)</view>
<view class="zd-col-16"><input type="text" class="setup-input" v-model="setTime"></view>
</view>
</view>
<view class="zd_wrapper">
<view class="zd-row">
<view class="zd-col-8 input-label">{{$t('setting.customer-label-printing')}}</view>
<view class="zd-col-16">
<uni-data-select v-model="index" :placeholder="$t('uni.dataSelect.placeholder')" :emptyTips="$t('uni.dataSelect.emptyTips')" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
</view>
</view>
<view class="zd-row submitbar">
<button class="zd-col-11 btn-submit btn-success letter-30" @click="_submit">确认</button>
<button class="zd-col-11 btn-submit btn-success letter-30" @click="_virtualprintType">查询</button>
<button class="zd-col-11 btn-submit btn-success letter-30" @click="_submit">{{$t('button.confirm')}}</button>
<button class="zd-col-11 btn-submit btn-success letter-30" @click="_virtualprintType">{{$t('button.search')}}</button>
</view>
</view>
</template>
@@ -40,13 +50,43 @@
options: [],
index: '',
addrip: this.$store.getters.baseUrl,
setTime: this.$store.getters.setTime / 1000
setTime: this.$store.getters.setTime / 1000,
options1: [{text: '中文',value: 'zh-Hans'}, {text: 'English', value: 'en'}, {text: 'Indonesia', value: 'id'}],
index1: '',
systemLocale: '',
applicationLocale: ''
};
},
created () {
// this._virtualprintType()
onLoad() {
let systemInfo = uni.getSystemInfoSync();
this.systemLocale = systemInfo.language;
this.applicationLocale = uni.getLocale();
this.index1 = this.applicationLocale.split('-')[0]
this.isAndroid = systemInfo.platform.toLowerCase() === 'android';
uni.onLocaleChange((e) => {
this.applicationLocale = e.locale;
})
},
methods: {
onLocaleChange(e) {
if (this.isAndroid) {
uni.showModal({
content: this.$t('setting.language-change-confirm'),
success: (res) => {
if (res.confirm) {
uni.setLocale(e);
}
}
})
} else {
uni.setLocale(e);
this.$i18n.locale = e;
}
},
selectChange1(e) {
this.onLocaleChange(e)
this.index1 = e
},
goIn () {
uni.redirectTo({
url: '/pages/login/login'
@@ -91,14 +131,11 @@
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.input-wrap
width 100%
_fj()
.input-label
wh(200rpx, 58rpx)
_font(28rpx,58rpx,#464646)
.setup-input
_wh(calc(100% - 200rpx), 58rpx)
_wh(100%, 58rpx)
background #fff
_font(28rpx,58rpx,#323232)
padding 0 10rpx