默认语言

This commit is contained in:
luyuan 2020-11-03 15:37:06 +08:00
parent 817a67b1ca
commit dd08807e8e
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
2 changed files with 12 additions and 2 deletions

View File

@ -80,11 +80,15 @@ const put: Get = async function (url: string, data?: unknown){
function setToken(){
axios.defaults.headers.common['Authorization'] = "Bearer " + getValue("token");
}
function setLanvuage(yuyan: string){
axios.defaults.headers.common['Language'] = yuyan;
}
export {
get,
post,
del,
put,
setToken
setToken,
setLanvuage
}

View File

@ -208,6 +208,7 @@ import { computed, defineComponent, onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
import axios from 'axios'
import { useI18n } from '@/utils/i18n';
import { setLanvuage } from '@/api/base';
export default defineComponent({
props:{
@ -318,8 +319,13 @@ export default defineComponent({
}
function setlanguage(e?: any){
console.log(e)
editsystemsetting({language:e})
if(store.state.islogin){
editsystemsetting({language:e})
}else {
setLanvuage(e)
}
lan.locale.value = e
}
function toindex(){
router.push("/")