<script setup>
	/**
	 * 各种文章展示页面
	 */
	import {
		reactive,
		ref,
	} from 'vue'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	// 工具库
	import util from '@/common/js/util';
	// api
	import api from '@/api';

	// 内容
	const wrap = reactive({
		content: ``
	})
	// 对应内容id
	const wrapId = ref('')

	onLoad((option) => {
		if (option.id) wrapId.value = option.id
		// 获取详情
		getDetail()
	})

	// 获取详情
	function getDetail() {
		api.getArticle({
			query: {
				agreementId: wrapId.value,
			},
		}).then(rs => {
			if (rs.code == 200) {
				Object.assign(wrap, rs.data)
				// 设置标题
				uni.setNavigationBarTitle({
					title: rs.data.agreementType
				})
				return
			}
			util.alert({
				content: rs.msg,
				showCancel: false,
			})
		})
	}
</script>

<template>
	<view class="appbw">
		<view class="container">
			<view class="title mt30 tac c333 f40">{{wrap.name}}</view>

			<view class="main mt30 mlr30">
				<rich-text :nodes="wrap.content" />
			</view>

			<view class="fill" style="height: 30rpx;"></view>
		</view>
	</view>
</template>

<style lang="scss">
	// 
</style>