import QuickStorage from '@/plugins/QuickStorage/index'

const getters = {
	status(state){
		return state.status;
	},
	type(state){
		return state.type;
	},
	corpId(state){
		return state.corpId;
	},
	welcomeInfo(state){
		return state.welcomeInfo;
	},
	channelInfo(state){
		let info = state.channelInfo || {};
        if(!info.defaultUserAva){
            info.defaultUserAva = require(`@/assets/img/default-head.jpg`);
        }
        if(!info.chatAdminAvaUrl){
            info.chatAdminAvaUrl = require(`@/assets/img/default-head.jpg`);
        }
        info.defaultPhoneHeadAva = require(`@/assets/img/phone-head.png`);
		return  info;
	},
	menuList(state){
		return state.menuList
	},
	menuListPc(state){
		return state.menuList.filter((obj) => {
			return 	obj.menuType != 'chat' 
				&& obj.menuType != 'draw' 
				&& obj.menuType != 'share' 
				&& obj.menuType != 'vote' 
				&& obj.menuType != 'shop'
				&& obj.menuType != 'coupon';
		})
	},
	advertTop(state){
		return state.advertTop
	},
	advertMiddle(state){
		return state.advertMiddle
	},
	advertText(state){
		return state.advertText
	},
	playerInfo(state){
		return state.playerInfo
	},
	wechatInfo(state){
		return state.wechatInfo
	},
	userInfo(state){
        let info = JSON.parse(JSON.stringify(state.userInfo || {}));
        info.userHeadImg = info.userHeadImg || require('@/assets/img/phone-head.png');
        return info;
	},
	showRed(state){
		return state.showRed
	},
	showRedInfo(state){
		return state.showRedInfo
	},
	jumpUrls(state){
		if(process.client){
			let info = state.channelInfo;
			let uin = info.uin;
			let id = info.id;
			let backUrl = encodeURIComponent(window.location.href);
			let origin = process.env.NODE_ENV == 'development' ? 'http://192.168.2.33:3004' : window.location.origin;
			return {
				login: `${origin}/my/login?uin=${uin}&backUrl=${backUrl}`,
				login_binding: `${origin}/my/login/binding?uin=${uin}&backUrl=${backUrl}`,
				center: `${origin}/my/center?uin=${uin}&backUrl=${backUrl}`,
				center_wallet: `${origin}/my/center/wallet?uin=${uin}&backUrl=${backUrl}`,
				pay_redPacket: `${origin}/my/pay/redPacket?uin=${uin}&id=${id}&backUrl=${backUrl}`,
				auth_pay: `${origin}/my/auth/pay?uin=${uin}&id=${id}&backUrl=${backUrl}`,
				auth_password: `${origin}/my/auth/password?uin=${uin}&id=${id}&backUrl=${backUrl}`,
			}
		}
	},
}
export default getters;