中英文

This commit is contained in:
luyuan 2020-11-10 09:33:40 +08:00
parent 3874f6ab2e
commit 73eceefbf0
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
6 changed files with 48 additions and 17 deletions

View File

@ -29,6 +29,7 @@ export default defineComponent({
console.log('ip')
store.dispatch("getip");
store.commit('setWlan')
len.locale.value = !getValue("Lanvuage") ? 'zh' : getValue("Lanvuage");
router.push("/")
}
const zh = zhCN

View File

@ -1,7 +1,7 @@
import router from '@/router';
import store from '@/store';
import { LiveList, LivelistInfo, LoginData, UserInfo } from '@/types';
import { saveValue } from '@/utils/common';
import { getValue, saveValue } from '@/utils/common';
import { message } from 'ant-design-vue';
import { del, get, post, put, setToken } from './base'
@ -1014,11 +1014,21 @@ export async function luzhi(roomid: string){
export async function getaddr() {
const res = await get<any>('ip');
const gj = res.data.address.split("|")[0];
if(gj == "CN"){
return ["zh", "中文", '人民币¥'];
}else {
return ['en', 'English', '美元$']
const lan = getValue("Lanvuage");
if(lan != null && lan){
if(gj == "CN"){
return ['人民币¥'];
}else {
return [ '美元$']
}
}else{
if(gj == "CN"){
return ["zh", "中文", '人民币¥'];
}else {
return ['en', 'English', '美元$']
}
}
}
// export async function StopMCUMixTranscode(roomid: number) {

View File

@ -307,7 +307,7 @@ export default defineComponent({
languagelist.value=await getlanguages()
console.log(routes.path)
nowroute.value=routes.path
lan.locale.value = userinfo.value.languageValue
// lan.locale.value = userinfo.value.languageValue
})
function zonechange(e?: any){

View File

@ -2,7 +2,7 @@ import { getValue } from '@/utils/common';
import axios from 'axios'
axios.defaults.baseURL = 'https://case.sy-my.net/beelink/public/home/';
axios.defaults.headers.common['Authorization'] = "Bearer " + getValue("token");
axios.defaults.headers.common['Language'] = "Bearer " + getValue("Lanvuage");
axios.defaults.headers.common['Language'] = !getValue("Lanvuage") ? 'zh' : getValue("Lanvuage");
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
export default axios

View File

@ -10,10 +10,10 @@ getset().then((res: any)=>{
en.shichangtishi = `Minimum ${res.lowerLimit} person, maximum ${res.numberCeiling} people`
zh.tixianzhu = `注:每笔提现收取${res.sxf}服务费,最低${ res.symbol + res.minmoney }`
en.tixianzhu = `Note: ${res.sxf} service fee will be charged for each withdrawal, with a minimum of ${ res.symbol + res.minmoney }`
const i18n = geti18n();
const loc = i18n.locale.value;
i18n.locale.value = '';
i18n.locale.value = loc;
// const i18n = geti18n();
// const loc = i18n.locale.value;
// i18n.locale.value = '';
// i18n.locale.value = loc;
console.log('i18n')
})

View File

@ -1,5 +1,6 @@
import { getaddr, userinfo } from '@/api';
import { getValue } from '@/utils/common';
import { setLanvuage } from '@/api/base';
import { getValue, saveValue } from '@/utils/common';
import { isProxy } from 'vue';
import { createStore } from 'vuex'
@ -64,13 +65,32 @@ export default createStore({
setLanguage(state, data){
const split = new Date().toString().split(" ");
const timeZoneFormatted = split[split.length - 2] + " " + split[split.length - 1];
state.userinfo.language = data[1] // English 中文
state.userinfo.languageValue = data[0] // 'en' 'zh'
state.userinfo.zoneStr = timeZoneFormatted;
state.userinfo.currency = data[2];
const lan = getValue("Lanvuage");
if(lan != null && lan){
// state.userinfo.language = data[1] // English 中文
// state.userinfo.languageValue = data[0] // 'en' 'zh'
state.userinfo.zoneStr = timeZoneFormatted;
state.userinfo.currency = data[0];
}else{
console.log(data, 111)
state.userinfo.language = data[1] // English 中文
state.userinfo.languageValue = data[0] // 'en' 'zh'
state.userinfo.zoneStr = timeZoneFormatted;
state.userinfo.currency = data[2];
saveValue("Lanvuage", data[0]);
if( data[0] != 'zh'){
location.reload()
}
// setLanvuage(data[0]);
}
},
setWlan(state){
state.userinfo.languageValue = getValue("Lanvuage")
const lan = getValue("Lanvuage");
if(lan != null && lan){
state.userinfo.languageValue = !getValue("Lanvuage") ? 'zh' : getValue("Lanvuage");
state.userinfo.language = (!getValue("Lanvuage") ? 'zh' : getValue("Lanvuage")) == 'zh' ? '中文' : 'English';
}
}
},
actions: {