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

		<view class="content">
			<view class="title">
				{{title}}
			</view>
			<u-parse :content="content"></u-parse>
		</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 {
		postOrderReq,
		getConfigTextByIdReq,
	} from '@/api/test/index.js'
	export default {
		components: {

		},
		data() {
			return {
				picUrl: this.$picUrl,
				content: null,
				title: '',
				detail: null,
				showBtn: true,
				navBarTitle: '',
				loading: true
			}
		},
		async onLoad(o) {
			// o.id = 1
			if (o.id) {
				this.showBtn = false
				this.navBarTitle = '首页'
				let res = await getConfigTextByIdReq({
					id: o.id
				})
				if (res.code == 0) {
					console.log('服务详情返回值: ', res);
					this.datail = res.data
					this.content = res.data.content
					this.title = res.data.title
					this.loading = false
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				}
			} else {
				this.content = getApp().serCon
				this.title = getApp().sTitle

				this.datail = getApp().Sdetail
				this.loading = false
			}
		},
		onShareAppMessage(params) {
			if (params.from === 'button' || params.from === 'menu') {
				return {
					title: this.title,
					imageUrl: this.$picBase + this.datail.image,
					path: '/pages/service/detail/index?id=' + this.datail.id,
					mpId: this.$appId,
					type: this.$shareType,
				}
			}
		},
		methods: {

		}
	}
</script>

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