NEZ-1164 fix: 登录页支持国际化
This commit is contained in:
@@ -112,6 +112,8 @@
|
||||
import { mapActions } from 'vuex'
|
||||
import QRCode from 'qrcodejs2'
|
||||
import bus from '@/libs/bus.js'
|
||||
import { get } from '@/http'
|
||||
import { loadI18n } from '@/components/common/i18n'
|
||||
export default {
|
||||
name: 'login',
|
||||
data () {
|
||||
@@ -149,7 +151,6 @@ export default {
|
||||
if (this.loading || !this.license.valid) {
|
||||
return
|
||||
}
|
||||
// if (this.license.valid && this.validateLogin() && (this.$route.path == '/' || this.$route.path == '/login')) {
|
||||
if (this.validateLogin() && (this.$route.path == '/' || this.$route.path == '/login')) {
|
||||
this.loading = true
|
||||
this.$post('/sys/login', this.loginData).then(res => {
|
||||
@@ -158,6 +159,14 @@ export default {
|
||||
this.authToken = res.data.authToken
|
||||
this.lang = res.data.user.lang
|
||||
this.$i18n.locale = this.lang
|
||||
// 获取可选语言
|
||||
get('/sys/dict/all?type=lang').then(response => {
|
||||
if (response.code === 200) {
|
||||
const langList = response.data.map(lang => ({ name: lang.name, value: lang.value }))
|
||||
this.$store.commit('setLangList', langList)
|
||||
localStorage.setItem('nz-language-list', JSON.stringify(langList))
|
||||
}
|
||||
})
|
||||
sessionStorage.setItem('nz-token', res.data.authToken)
|
||||
if (res.data.authFlag === 1) {
|
||||
if (res.data.authBind === 0) {
|
||||
|
||||
Reference in New Issue
Block a user