默认语言

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(){ function setToken(){
axios.defaults.headers.common['Authorization'] = "Bearer " + getValue("token"); axios.defaults.headers.common['Authorization'] = "Bearer " + getValue("token");
} }
function setLanvuage(yuyan: string){
axios.defaults.headers.common['Language'] = yuyan;
}
export { export {
get, get,
post, post,
del, del,
put, put,
setToken setToken,
setLanvuage
} }

View File

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