intelligentGroup/store/index.js

115 lines
2.0 KiB
JavaScript

import Vue from 'vue'
import Vuex from 'vuex'
import actions from './actions.js'
Vue.use(Vuex)
export default new Vuex.Store({
// state: 存储基本数据
state: {
user: {
avatarurl: "",
name: "",
sex: 1,
birthday: "",
id: "",
industryid: "",
industryname: null,
interests: "",
orgid: "",
orgname: "",
phone: "",
place: "",
posid: "",
posname: "",
provide: "",
vipendtime: "",
vipname: null,
email: "",
codeurl: "",
codeurl: "",
authlist: [],
cominfo: {
pics: []
}
},
HomeContent: {
appdesc: "",
appimg: "",
qyappid: "",
qyserviceurl: "",
centerbannerlist: [],
bannerlist: [],
noticelist: [],
todayviewer: 0,
orgList: [],
poslist: [],
industrylist: [],
officialqrcode: "",
secrataryphone: "",
secrataryqrcode: "",
privacydesc: "",
},
InfoList: {},
navbarlist: [],
isLogout: true,
isSecratary: false,
},
// mutations: Store中更改state数据状态的唯一方法(必须是同步函数)
mutations: {
/* 用户信息 */
changeUserInfo(state, newData) {
state.user = newData
},
// 首页信息
changeHomeContent(state, newData) {
state.HomeContent = newData
},
// 导航栏列表
changeNavbarlist(state, newData) {
state.navbarlist = newData
},
// 资讯列表
changeInfoList(state, newData) {
state.InfoList = newData
},
// 联系人弹框
changeSecratary(state, newData) {
state.isSecratary = newData
},
// 退出登录
changeLogout(state, newData) {
if (newData == false) {
state.user = {
avatarurl: "",
name: "",
sex: 1,
birthday: "",
id: "",
industryid: "",
industryname: null,
interests: "",
orgid: "",
orgname: "",
phone: "",
place: "",
posid: "",
posname: "",
provide: "",
vipendtime: "",
vipname: null,
email: "",
codeurl: "",
codeurl: "",
authlist: [],
cominfo: {
pics: []
}
}
}
state.isLogout = newData
},
},
// 模块化vuex
modules: {},
actions
})