const user = {
	state: {
		token: '',
		userInfo: null,
		isLogin: false, //是否登录
		isUserSetting: false, //用户是否配置了模板
		startTime: "",
		endTime: "",
		yqInfo: {}, //舆情详情数据
		keepLiiveRoute: []
	},
	mutations: {
		setYqinfo: (state, data) => {
			state.yqInfo = data
		},
		userStatus: (state, user) => {
			setStorage('userInfo', JSON.stringify(user))
			window.localStorage.setItem('userInfo', JSON.stringify(user))
			state.userInfo = user
			state.isLogin = true
		},
		setToken: (state, token) => {
			setStorage('token', token)
			window.localStorage.setItem('token', token)
			state.token = token
		},
		loginOut: (state, value) => {
			state.userInfo = null
			state.token = ''
			state.isLogin = false
		},
		setUserSettiing: (state, set) => {
			state.isUserSetting = set
		},
		setStartTime: (state, time) => {
			state.startTime = time
		},
		setEndTime: (state, time) => {
			state.endTime = time
		},
	},
	actions: {
		setUser: ({
			commit
		}, user) => {
			commit('userStatue', user)
		},
		setToken: ({
			commit
		}, token) => {
			commit('setToken', token)
		},
		setUserSettiing: ({
			commit
		}, set) => {
			commit('setUserSettiing', set)
		},
		setStartTime: ({
			commit
		}, time) => {
			commit('setStartTime', time)
		},
		setEndTime: ({
			commit
		}, time) => {
			commit('setEndTime', time)
		},
		setYqinfo: ({
			commit
		}, data) => {
			commit('setYqinfo', data)
		},
	}
}
export default user