<template>
	<view class="page">
		<navBar :backType="navBarTitle" :title="navBarTitle?navBarTitle:'产品指南'" :back="true" color="black"
			background="white" />

		<view class="content">
			<view class="title">
				{{content.title}}
			</view>
			<view class="p">
				<u-parse :content="content.content"></u-parse>
			</view>
			<image :src="picBase +content.image" mode="" style="margin-bottom: 64rpx;"></image>

		</view>

		<view class="btnBox" v-if="showBtn">
			<button open-type="share" class="rBtn">
				分享
			</button>
		</view>
		<u-loading-page :loading="loading" image="/static/index/logo.png" loading-text="页面加载中..."></u-loading-page>
	</view>
</template>

<script>
	import {
		getConfigTextByIdReq,
	} from '@/api/test/index.js'
	export default {
		components: {

		},
		data() {
			return {
				picUrl: this.$picUrl,
				picBase: this.$picBase,
				content: {
					title: ''
				},

				showBtn: true,
				navBarTitle: '',

				loading: true

			}
		},
		async onLoad(o) {
			// o.id = 13
			if (o.id) {
				this.showBtn = false
				this.navBarTitle = '首页'
				let res = await getConfigTextByIdReq({
					id: o.id
				})
				if (res.code == 0) {
					console.log('返回值: ', res);
					this.content = res.data
					this.loading = false
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				}
			} else {
				this.content = getApp().Litem
				this.loading = false
				console.log('传过来的指南详情：', this.content);
			}
		},
		onShareAppMessage(params) {
			if (params.from === 'button' || params.from === 'menu') {
				return {
					title: this.content.title,
					imageUrl: this.$picBase + this.content.image,
					path: '/pages/index/productLeadDetail/index?id=' + this.content.id,
					mpId: this.$appId,
					type: this.$shareType,
				}
			}
		},
		methods: {

		}
	}
</script>

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