language
This commit is contained in:
@@ -60,7 +60,7 @@
|
||||
<script>
|
||||
import { encrypt } from '@/utils/rsaEncrypt'
|
||||
import Config from '@/settings'
|
||||
// import { getCodeImg } from '@/api/login'
|
||||
import { getCodeImg } from '@/api/login'
|
||||
import Cookies from 'js-cookie'
|
||||
import Background from '@/assets/images/background.jpg'
|
||||
import i18n from '@/i18n'
|
||||
@@ -114,12 +114,13 @@ export default {
|
||||
// 如果已经加载过该语言,可以直接设置,避免重复请求
|
||||
if (!this.$i18n.getLocaleMessage(locale)) {
|
||||
const messages = await fetchMessages(locale)
|
||||
this.$i18n.setLocaleMessage(locale, messages)
|
||||
this.$i18n.setLocaleMessage(locale, messages.content)
|
||||
}
|
||||
this.$i18n.locale = locale
|
||||
// 可以将当前语言保存到本地存储,以便下次使用
|
||||
localStorage.setItem('lang', locale)
|
||||
this.setLang(locale)
|
||||
location.reload()
|
||||
},
|
||||
// 中英文切换
|
||||
langChange(command) {
|
||||
@@ -138,10 +139,10 @@ export default {
|
||||
}
|
||||
},
|
||||
getCode() {
|
||||
// getCodeImg().then(res => {
|
||||
// this.codeUrl = res.img
|
||||
// this.loginForm.uuid = res.uuid
|
||||
// })
|
||||
getCodeImg().then(res => {
|
||||
this.codeUrl = res.img
|
||||
this.loginForm.uuid = res.uuid
|
||||
})
|
||||
},
|
||||
getCookie() {
|
||||
const username = Cookies.get('username')
|
||||
|
||||
Reference in New Issue
Block a user