2020-08-04 21:50:59 +08:00
|
|
|
import { isServer } from '~/environment'
|
|
|
|
|
2020-07-02 23:45:27 +08:00
|
|
|
export const state = () => {
|
|
|
|
return {
|
2020-07-03 11:04:25 +08:00
|
|
|
activeMenu: 'index',
|
2020-07-31 16:17:12 +08:00
|
|
|
oauth: null,
|
2020-08-06 15:44:29 +08:00
|
|
|
userInfo: null,
|
2020-08-02 19:25:40 +08:00
|
|
|
locale: 'zh_CN',
|
2022-01-14 10:38:55 +08:00
|
|
|
uploadHeaders: '',
|
|
|
|
fingerprint: ''
|
2020-07-02 23:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
2020-07-03 11:04:25 +08:00
|
|
|
|
|
|
|
export const mutations = {
|
|
|
|
setActiveMenu (state, activeMenu) {
|
|
|
|
state.activeMenu = activeMenu
|
2020-08-02 19:25:40 +08:00
|
|
|
},
|
|
|
|
setUploadHeaders(state, data){
|
|
|
|
state.uploadHeaders = data
|
2020-08-02 19:40:28 +08:00
|
|
|
},
|
2022-01-14 10:38:55 +08:00
|
|
|
setFingerprint (state, fingerprint) {
|
|
|
|
state.fingerprint = fingerprint
|
2020-07-03 11:04:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-22 17:13:42 +08:00
|
|
|
export const actions = {
|
2020-06-21 21:56:34 +08:00
|
|
|
nuxtServerInit(store, {req}) {
|
|
|
|
// 初始化时的全局任务
|
2023-08-31 22:03:44 +08:00
|
|
|
const initFetchAppData = [
|
2020-06-21 21:56:34 +08:00
|
|
|
// 内容数据
|
2020-08-11 22:39:59 +08:00
|
|
|
store.dispatch('topic/fetchNavList'),
|
2021-05-20 22:02:49 +08:00
|
|
|
store.dispatch('article/fetchList')
|
2020-06-21 21:56:34 +08:00
|
|
|
]
|
2020-08-02 00:25:44 +08:00
|
|
|
|
2020-06-21 21:56:34 +08:00
|
|
|
return Promise.all(initFetchAppData)
|
2020-06-19 17:10:44 +08:00
|
|
|
}
|
2020-06-22 17:13:42 +08:00
|
|
|
}
|