<template>
	<view class="article-details">
		<rich-text :nodes="nodes"></rich-text>
	</view>
</template>
<script>
import common from '@/static/js/common.js'
export default {
	data() {
		return {
			nodes: '',
		}
	},
	onLoad(option) {
		// type: 1 证件中心 2: 关于我们
		// console.log(option);
		if(option.id) this.getUseHelpInfo(option.id);
		if(option.type == 1) this.certificateInfo();
		if(option.type == 2) this.getAboutUsInfo();
	},
	methods: {
		setTitle(title){
			uni.setNavigationBarTitle({
				title: title
			});
		},
		getUseHelpInfo(id) {
			this.$u.api.getUseHelpInfo({
			    launch_id: id,
			}).then(res => {
				if (res.errCode == 0) {
					this.nodes = common.unescapeHTML(res.data.info[0].help_info);
					this.setTitle(res.data.info[0].help_title);
				}
			})
		},
		getAboutUsInfo() {
			this.$u.api.aboutUsInfo().then(res => {
				if (res.errCode == 0) {
					this.nodes = common.unescapeHTML(res.data.info.value);
					this.setTitle(res.data.info.remark);
				}
			})
		},
		certificateInfo() {
			this.$u.api.certificateInfo().then(res => {
				if (res.errCode == 0) {
					this.nodes = common.unescapeHTML(res.data.info.value);
					this.setTitle(res.data.info.remark);
				}
			})
		},
	},
}
</script>
<style lang="scss" scoped>
.article-details {
	min-height: calc(100vh - var(--window-top));
	background: #ECECEC;
	padding: 20rpx 35rpx 0;
	line-height: 45rpx;
}
</style>