<template>
	<view class="share-btn-box" :style="{padding:padding}">
		<view class="share-btn" @click.stop="onShare">
			<text class="share-icon iconfont_yige">&#xe69d;</text>
			<text>分享活动</text>
		</view>
		<sharePoster ref="sharePosterRef" :code-url="codeurl" :posterUrl="sharePoster" />
	</view>
</template>

<script>
	import CONFIG from "@/config/global.config.js"
	export default {
		props: {
			padding: {
				type: String,
				default: '20rpx 0'
			},
			sharePoster: {
				type: String,
				default: ""
			},
			taskId: {
				type: Number,
				default: -1
			}
		},
		data() {
			return {
				codeurl: null,

			}
		},
		methods: {
			onShare() {
				this.codeurl = `${CONFIG.hostUrl}?URLType=Task&taskId=${this.taskId}`
				this.$refs.sharePosterRef.open();
			},

		}
	}
</script>

<style lang="scss" scoped>
	.share-btn-box {

		width: 100%;

		.share-btn {
			display: inline-flex;
			align-items: center;
			font-size: 24rpx;
			font-weight: Light;
			color: #808080;
			line-height: 1;

			.share-icon {
				font-size: 40rpx;
				color: #3eb8d0;
				margin-right: 15rpx;
			}
		}
	}
</style>