<template>
	<view class="content">
		<u-parse :content="content"></u-parse>
	</view>
</template>

<script>
	import $api from '@/static/js/api.js'
	export default {
		data() {
			return {
				content: '',
			}
		},
		onLoad(options) {
			if (options.type == 'rule') {
				uni.setNavigationBarTitle({
					title: '积分规则'
				})
				this.getdata('rule')
			}
			if (options.type == 'user') {
				uni.setNavigationBarTitle({
					title: '用户协议'
				})
				this.getdata('user')
			}
			if (options.type == 'yinsi') {
				uni.setNavigationBarTitle({
					title: '隐私政策'
				})
				this.getdata('private')
			}
			if (options.type == 'geren') {
				uni.setNavigationBarTitle({
					title: '个人信息收集清单'
				})
				this.getdata('personal')
			}
			if (options.type == 'shengming') {
				uni.setNavigationBarTitle({
					title: '开源软件声明'
				})
				this.getdata('software')
			}
		},
		methods: {
			getdata(val) {
				var _this = this
				$api.req({
					url: 'agreement/detail',
					method: 'GET',
					data: {
						code: val
					}
				}, function(res) {
					if (res.code == 10000) {
						_this.content = res.data.content
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.content {
		background-color: #fff;
		min-height: 100vh;
		box-sizing: border-box;
		padding: 0 30rpx;
	}
</style>