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

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

		},
		data() {
			return {
				tTitle: '',
				title: '',
				content: null,

				showBtn: true,
				navBarTitle: ''
			}
		},
		async onLoad(o) {
			// o.id = 1
			if (o.id) {
				this.showBtn = false
				this.navBarTitle = '首页'
				this.tTitle = '换新流程'
				let res = await getChangeStepReq()
				if (res.code == 0) {
					console.log('换新流程返回值: ', res, res.data.content);
					this.title = res.data.title
					this.content = res.data
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				}
			} else {
				this.tTitle = getApp().stepName
				if (getApp().stepName == '换新流程') {
					let res = await getChangeStepReq()
					if (res.code == 0) {
						console.log('换新流程返回值: ', res, res.data.content);
						this.title = res.data.title
						this.content = res.data
					} else {
						uni.showToast({
							title: res.message,
							icon: 'none'
						})
					}
				}
			}
		},
		onShareAppMessage(params) {
			if (params.from === 'button' || params.from === 'menu') {
				return {
					title: this.tTitle,
					imageUrl: this.$picUrl + '/static/other/noMain_img3.png',
					path: '/pages/my/changeNewStep/index?id=1',
					mpId: this.$appId,
					type: this.$shareType,
				}
			}
		},
		methods: {

		}
	}
</script>

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