
import { mapState } from 'vuex'

export default {
	data() {
		return {
			// 默认的全局分享内容
			share: {
				title: '瑶都万能墙',
				path: '/pages/index/index',    // 全局分享的路径，比如 首页
				// imageUrl: '/static/image/login/logo.png',    // 全局分享的图片(可本地可网络)
			}
		}
	},
	computed : {
		...mapState(['userInfo', 'configList']),
	},
	// 定义全局分享
	// 1.发送给朋友
    onShareAppMessage(res) {
		console.log('this.share', this.share);
		let o = {
			...this.share,
			imageUrl : this.share.imageUrl || this.configList.applet_logo
		}
		if(this.userInfo.id){
			o.path = this.share.path + '?shareId=' + this.userInfo.id
		}
        return o
    },
	//2.分享到朋友圈
    onShareTimeline(res) {
		let o = {
			...this.share,
		}
		if(this.userInfo.id){
			o.path = this.share.path + '?shareId=' + this.userInfo.id
		}
        return o
    },
}