Browse Source

全局参数 2022年11月14日 sxm

master
[li_she] 3 years ago
parent
commit
add522e9a1
  1. 30
      src/views/common/login.vue
  2. 30
      src/views/main.vue

30
src/views/common/login.vue

@ -24,6 +24,7 @@
<script>
import { getUUID } from '@/utils'
import {getConfigParams} from '@/api/sysConfig.js'
export default {
data () {
return {
@ -45,6 +46,24 @@
captchaPath: ''
}
},
computed: {
multiLanguage: {
get() {
return this.$store.state.user.multiLanguage
},
set(val) {
this.$store.commit('user/updateMultiLanguage', val)
}
},
authControl: {
get() {
return this.$store.state.user.authControl
},
set(val) {
this.$store.commit('user/updateAuthControl', val)
}
}
},
created () {
this.userName();
},
@ -73,6 +92,7 @@
localStorage.setItem('locale', data.language)
localStorage.setItem('refresh', "0")
localStorage.setItem('userName', this.dataForm.userName)
this.getConfigParams()
} else {
this.$message.error(data.msg)
}
@ -80,6 +100,16 @@
}
})
},
//
getConfigParams() {
getConfigParams().then(({data}) => {
if (data && data.code == 0) {
localStorage.setItem('configParams', JSON.stringify(data.data))
this.multiLanguage = JSON.parse(localStorage.getItem('configParams')).multiLanguage
this.authControl = JSON.parse(localStorage.getItem('configParams')).authControl
}
})
}
}
}
</script>

30
src/views/main.vue

@ -15,7 +15,7 @@
</template>
<script>
import {getConfigParams} from '@/api/sysConfig.js'
import MainNavbar from './main-navbar'
import MainSidebar from './main-sidebar'
import MainContent from './main-content'
@ -96,26 +96,9 @@
this.$store.commit('user/updateUserDisplay', val)
}
},
multiLanguage: {
get() {
return this.$store.state.user.multiLanguage
},
set(val) {
this.$store.commit('user/updateMultiLanguage', val)
}
},
authControl: {
get() {
return this.$store.state.user.authControl
},
set(val) {
this.$store.commit('user/updateAuthControl', val)
}
}
},
created() {
this.getUserInfo()
this.getConfigParams()
},
mounted() {
this.resetDocumentClientHeight()
@ -146,16 +129,7 @@
}
})
},
//
getConfigParams() {
getConfigParams().then(({data}) => {
if (data && data.code == 0) {
localStorage.setItem('configParams', JSON.stringify(data.data))
this.multiLanguage = JSON.parse(localStorage.getItem('configParams')).multiLanguage
this.authControl = JSON.parse(localStorage.getItem('configParams')).authControl
}
})
}
}
}
</script>
Loading…
Cancel
Save