feat:完成权限相关、全局配置、优化细节
This commit is contained in:
22
Yi.BBS.Vue3/src/stores/config.js
Normal file
22
Yi.BBS.Vue3/src/stores/config.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import {getAll} from '@/apis/configApi'
|
||||
import { defineStore } from 'pinia'
|
||||
const useConfigStore = defineStore('config',
|
||||
{
|
||||
state: () => ({
|
||||
data: []
|
||||
}),
|
||||
getters: {
|
||||
name:(state)=>state.data.filter(s=> s.configKey=='bbs.site.name').map(x=>x.configValue)[0],
|
||||
author:(state)=>state.data.filter(s=> s.configKey=='bbs.site.author').map(x=>x.configValue)[0],
|
||||
icp:(state)=>state.data.filter(s=> s.configKey=='bbs.site.icp').map(x=>x.configValue)[0],
|
||||
bottom:(state)=>state.data.filter(s=>s.configKey=='bbs.site.bottom').map(x=>x.configValue)[0]
|
||||
},
|
||||
actions: {
|
||||
// 登录
|
||||
async getConfig() {
|
||||
const response = await getAll();
|
||||
this.data = response.data.items;
|
||||
},
|
||||
},
|
||||
})
|
||||
export default useConfigStore;
|
||||
Reference in New Issue
Block a user