Files
hht-ftdl-uni/pages/login/setup2.vue
2025-09-26 15:22:04 +08:00

126 lines
3.2 KiB
Vue

<template>
<view class="zd_container">
<nav-bar title="设置" :inner2="true" @goIn="goIn" :show="false"></nav-bar>
<view class="zd_content">
<!-- <view class="zd_wrapper">
<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="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="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>
<view class="zd-row submit-bar">
<button class="zd-col-24 button-primary" @click="_submit">{{$t('button.confirm')}}</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
export default {
components: {
NavBar
},
data() {
return {
options: [],
index: '',
addrip: this.$store.getters.baseUrl,
setTime: this.$store.getters.setTime / 1000,
// options1: [{text: '中文',value: 'zh-Hans'}, {text: 'English', value: 'en'}, {text: 'Japanese', value: 'jp'}],
options1: [{text: '中文',value: 'zh-Hans'}, {text: 'Japanese', value: 'jp'}],
index1: '',
systemLocale: '',
applicationLocale: ''
};
},
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'
})
},
/** 选择器 */
selectChange(e) {
this.index = e
},
_submit () {
if (this.addrip === '') {
uni.showToast({
title: '服务器地址',
icon: 'none'
})
return
}
if (this.setTime === '') {
uni.showToast({
title: '请填写刷新时间',
icon: 'none'
})
return
}
// 存值
this.$store.dispatch('setConfig',{baseUrl: this.addrip, setTime: this.setTime * 1000, setPrintName: this.index})
uni.redirectTo({
url: '/pages/login/login'
})
}
}
}
</script>
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.input-label
wh(200rpx, 58rpx)
_font(28rpx,58rpx,#464646)
.setup-input
_wh(100%, 58rpx)
background #fff
_font(28rpx,58rpx,#323232)
padding 0 10rpx
</style>