Browse Source

全局参数 2022年11月14日 sxm

master
[li_she] 3 years ago
parent
commit
37025a385b
  1. 10
      src/store/modules/user.js
  2. 71
      src/views/main.vue

10
src/store/modules/user.js

@ -7,8 +7,8 @@ export default {
languageDefault: '',
userDisplay: '',
userDev: false,
multiLanguage: JSON.parse(localStorage.getItem('configParams')).multiLanguage,
authControl: JSON.parse(localStorage.getItem('configParams')).authControl,
multiLanguage: '',
authControl: '',
},
mutations: {
updateId (state, id) {
@ -25,6 +25,12 @@ export default {
},
updateUserDisplay (state,userDisplay){
state.userDisplay = userDisplay
},
updateMultiLanguage (state,multiLanguage){
state.userDisplay = multiLanguage
},
updateAuthControl (state,authControl){
state.userDisplay = authControl
}
}
}

71
src/views/main.vue

@ -19,6 +19,7 @@
import MainNavbar from './main-navbar'
import MainSidebar from './main-sidebar'
import MainContent from './main-content'
export default {
provide() {
return {
@ -43,31 +44,73 @@
},
computed: {
documentClientHeight: {
get () { return this.$store.state.common.documentClientHeight },
set (val) { this.$store.commit('common/updateDocumentClientHeight', val) }
get() {
return this.$store.state.common.documentClientHeight
},
set(val) {
this.$store.commit('common/updateDocumentClientHeight', val)
}
},
sidebarFold: {
get () { return this.$store.state.common.sidebarFold }
get() {
return this.$store.state.common.sidebarFold
}
},
userId: {
get () { return this.$store.state.user.id },
set (val) { this.$store.commit('user/updateId', val) }
get() {
return this.$store.state.user.id
},
set(val) {
this.$store.commit('user/updateId', val)
}
},
userName: {
get () { return this.$store.state.user.name },
set (val) { this.$store.commit('user/updateName', val) }
get() {
return this.$store.state.user.name
},
set(val) {
this.$store.commit('user/updateName', val)
}
},
site: {
get () { return this.$store.state.user.site },
set (val) { this.$store.commit('user/updateSite', val) }
get() {
return this.$store.state.user.site
},
set(val) {
this.$store.commit('user/updateSite', val)
}
},
languageDefault: {
get () { return this.$store.state.user.languageDefault },
set (val) { this.$store.commit('user/updateLanguageDefault', val) }
get() {
return this.$store.state.user.languageDefault
},
set(val) {
this.$store.commit('user/updateLanguageDefault', val)
}
},
userDisplay: {
get () { return this.$store.state.user.userDisplay },
set (val) { this.$store.commit('user/updateUserDisplay', val) }
get() {
return this.$store.state.user.userDisplay
},
set(val) {
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.updateAuthControl
},
set(val) {
this.$store.commit('user/updateUserDisplay', val)
}
}
},
created() {
@ -108,6 +151,8 @@
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
}
})
}

Loading…
Cancel
Save