xbx #97

Merged
theluyuan merged 9 commits from xbx into master 2020-10-30 07:09:14 +00:00
3 changed files with 29 additions and 1 deletions
Showing only changes of commit 8ded17d754 - Show all commits

View File

@ -25,6 +25,8 @@ export default defineComponent({
store.commit("login", true)
store.dispatch("setUserInfo");
}else{
console.log('ip')
store.dispatch("getip");
router.push("/")
}
return{

View File

@ -985,6 +985,16 @@ export async function luzhi(roomid: string){
console.log(res)
}
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', '美元$']
}
}
// export async function StopMCUMixTranscode(roomid: number) {
// const res = await get('StopMCUMixTranscode', {roomid});
// console.log(res)

View File

@ -1,4 +1,5 @@
import { userinfo } from '@/api';
import { getaddr, userinfo } from '@/api';
import { isProxy } from 'vue';
import { createStore } from 'vuex'
export default createStore({
@ -57,6 +58,14 @@ export default createStore({
},
login(state, islogin: boolean){
state.islogin = islogin;
},
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];
}
},
actions: {
@ -64,7 +73,14 @@ export default createStore({
const user = await userinfo();
if(user != '未登录'){
commit('setUserInfo', user);
} else {
const info = await getaddr();
commit("setLanguage", info)
}
},
async getip({ commit }){
const info = await getaddr();
commit("setLanguage", info)
}
},
modules: {