<template>
	<view class="page">
		<navBar :backType="navBarTitle" :title="navBarTitle?navBarTitle:'详情'" :back="true" color="black"
			background="white" />

		<view class="con">
			<u-parse :content="content.content"></u-parse>
		</view>

		<view class="btnBox" v-if="showBtn">
			<button open-type="share" class="rBtn">
				一键分享
			</button>
		</view>
	</view>
</template>

<script>
	import {
		getActivityDataDetailReq,
	} from '@/api/test/index.js'
	export default {
		components: {},
		data() {
			return {
				content: '',
				showBtn: true,
				picBase: this.$picBase,
				navBarTitle: '',
				actId: -1
			}
		},
		async onLoad(o) {
			this.actId = getApp().actId
			// o.id = 10
			if (o.id) {
				this.showBtn = false
				this.navBarTitle = '首页'
				let res = await getActivityDataDetailReq({
					id: o.id
				})
				if (res.code == 0) {
					console.log('活动详情返回值2：', res);

					this.content = res.data
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				}
			} else {
				let res = await getActivityDataDetailReq({
					id: getApp().actId
				})
				if (res.code == 0) {
					console.log('活动详情返回值1：', res);
					this.content = res.data
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				}
			}
		},

		onShareAppMessage(params) {
			if (params.from === 'button' || params.from === 'menu') {
				return {
					title: this.content.title,
					imageUrl: this.$picBase + this.content.image,
					path: '/pages/my/actDetail2/index?id=' + this.content.id,
					mpId: this.$appId,
					type: this.$shareType,
				}
			}
		},
		methods: {

		}
	}
</script>

<style lang="scss" scoped>
	@import "./index.scss";
</style>