<template>
	<view>
		<view class="agree-content" v-html="html"></view>
	</view>
</template>

<script>
	import { getPrivacyAgree, getUserAgree, getCancelAgree } from '@/api/user.js'
	export default {
		data() {
			return {
				html: '隐私政策'
			}
		},
		methods: {
			init(mode){
				if(mode==="privacy"){
					getPrivacyAgree().then(res=>{
						uni.setNavigationBarTitle({
							title: "小程序隐私政策"
						})
						this.html = res.data.content
					})
				}else if(mode==='user'){
					uni.setNavigationBarTitle({
						title: "小程序用户手册"
					})
					getUserAgree().then(res=>{
						this.html = res.data.content
					})
				}else if(mode==='cancel'){
					uni.setNavigationBarTitle({
						title: "会员中心小程序账号注销通知"
					})
					getCancelAgree().then(res=>{
						this.html = res.data.content
					})
				}
			}
		},
		onLoad(options) {
			let { mode } = options
			this.init(mode)
		}
	}
</script>

<style lang="scss" scoped>
.agree-title{
	text-align: center;
	font-size: 35rpx;
	font-weight: bold;
	line-height: 60rpx;
}
.agree-content {
	padding: 30rpx;
	margin-bottom: 20rpx;
	.content-text{
		display: block;
		text-indent: 2em;
		line-height: 60rpx;
	}
}
.agree-name{
	padding: 30rpx;
	margin-bottom: 20rpx;
	.name-text{
		text-align: right;
		display: block;
		// text-indent: 2em;
		line-height: 60rpx;
	}
}
</style>
