老产品前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.3 KiB

4 years ago
import Vue from "vue";
import Vuex from "vuex";
import cloneDeep from "lodash/cloneDeep";
import user from "./modules/user";
import app from "./modules/app";
import tagsView from "./modules/tagsView";
3 years ago
import { requestPost } from "@/js/dai/request";
4 years ago
4 years ago
Vue.use(Vuex);
4 years ago
export default new Vuex.Store({
namespaced: true,
state: {
// 导航条, 布局风格, defalut(白色) / colorful(鲜艳)
4 years ago
navbarLayoutType: "colorful",
4 years ago
// 侧边栏, 布局皮肤, default(白色) / dark(黑色)
4 years ago
sidebarLayoutSkin: "dark",
4 years ago
// 侧边栏, 折叠状态
sidebarFold: false,
// 侧边栏, 菜单
sidebarMenuList: [],
4 years ago
sidebarMenuActiveName: "",
LevelOneMenuActiveName: "",
4 years ago
sidebarActiveSubMenuList: [],
// 内容, 是否需要刷新
contentIsNeedRefresh: false,
// 内容, 标签页(默认添加首页)
contentTabs: [
{
4 years ago
...window.SITE_CONFIG["contentTabDefault"],
4 years ago
name: "indexWork",
4 years ago
title: "首页",
4 years ago
},
4 years ago
],
4 years ago
contentTabsActiveName: "indexWork",
4 years ago
mainShuju: {
menuList: [],
activeName: "",
},
3 years ago
tipsList: [],
3 years ago
tipsTime: [],
4 years ago
inIframe: window.self !== window.top,
4 years ago
},
modules: {
user,
app,
4 years ago
tagsView,
4 years ago
},
mutations: {
// 重置vuex本地储存状态
4 years ago
resetStore(state) {
4 years ago
Object.keys(state).forEach((key) => {
4 years ago
state[key] = cloneDeep(window.SITE_CONFIG["storeState"][key]);
});
},
3 years ago
SET_TIPS_LIST(state, tipsList) {
let _list = state.tipsList
state.tipsList = _list.concat(tipsList)
},
SET_TIPS_TIME(state, time) {
state.tipsTime = time
}
4 years ago
},
3 years ago
actions: {
setTipsList({ commit }, time) {
return new Promise(async (resolve, reject) => {
const url = '/gov/project/memoAttr/memosToRemind'
const params = {
remindTime: time || ''
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
commit('SET_TIPS_LIST', data)
resolve()
} else reject(msg)
})
},
setTipsTime({ commit }) {
return new Promise(async (resolve, reject) => {
const url = '/gov/project/memoAttr/memoTime'
const { data, code, msg } = await requestPost(url)
if (code === 0) {
commit('SET_TIPS_TIME', data)
resolve()
} else reject(msg)
})
}
}
4 years ago
});