import config from "@/config";
import tool from "@/utils/tool";

export default {
	state: {
		//移动端布局
		ismobile: false,
		//布局
		layout: config.LAYOUT,
		//菜单是否折叠 toggle
		menuIsCollapse: tool.data.get('menuIsCollapse') || config.MENU_IS_COLLAPSE,
		//多标签栏
		layoutTags: config.LAYOUT_TAGS,
		//主题
		theme: config.THEME,
		// 获取聊天记录
		msg: "",
		// 用户消息总数
		msgNum:0,
		// 用户名
		login_name:'管理员',
		// 用户头像
		login_avatar:'https://dm-auto.oss-cn-shanghai.aliyuncs.com/mes-login/logo.png',
		// 我的文档路径
		docsRouter:[
			{name:'我的文档',id:''}
		],
		shareRouter:[
			{name:'我的文档',id:''}
		],
	},
	mutations: {
		SET_ismobile(state, key){
			state.ismobile = key
		},
		SET_layout(state, key){
			state.layout = key
		},
		SET_theme(state, key){
			state.theme = key
		},
		TOGGLE_menuIsCollapse(state){
			state.menuIsCollapse = !state.menuIsCollapse
			tool.data.set('menuIsCollapse',state.menuIsCollapse);
		},
		TOGGLE_layoutTags(state){
			state.layoutTags = !state.layoutTags
		},
		SET_LOGIN_NAME(state, key) {
			state.login_name = key
		},
		SET_LOGIN_AVATAR(state, key) {
			state.login_avatar = key
		},
		SET_WS_Msg_NUM(state, key) {
			state.msgNum = key
		},
		SET_docs_router(state, key){
			state.docsRouter = key
		},
		SET_share_router(state, key){
			state.shareRouter = key
		},
	}
}
