diff --git a/pages/login/setup.vue b/pages/login/setup.vue index 1aa37df..55f1034 100644 --- a/pages/login/setup.vue +++ b/pages/login/setup.vue @@ -4,20 +4,24 @@ - 服务器地址 - + {{$t('setting.language')}} +
+ +
-
- - 刷新时间(s) - + {{$t('setting.server')}} + - - - 客户标签打印 - + {{$t('setting.refresh')}}(s) + + + + {{$t('setting.customer-label-printing')}} +
+ +
@@ -40,13 +44,42 @@ options: [], index: '', addrip: this.$store.getters.baseUrl, - setTime: this.$store.getters.setTime / 1000 + setTime: this.$store.getters.setTime / 1000, + options1: [{text: '中文',value: 'zh'}, {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('index.language-change-confirm'), + success: (res) => { + if (res.confirm) { + uni.setLocale(e); + } + } + }) + } else { + uni.setLocale(e); + this.$i18n.locale = e; + } + }, goIn () { uni.redirectTo({ url: '/pages/login/login' @@ -56,6 +89,10 @@ selectChange(e) { this.index = e }, + selectChange1(e) { + this.onLocaleChange(e) + this.index1 = e + }, /** 打印机类型下拉框查询 */ async _virtualprintType () { let res = await virtualprintType(this.addrip) @@ -92,14 +129,23 @@