<template>
	<view class="container">
		<navBar :title="title" :back="true" color="#333333" background="#FFFFFF" />

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

<script>
	// import navBar from '@/components/navBar/index.vue'

	import {
		getyonghu,
		getyinsi,
		getKefu,
		getPosterBg,
	} from '@/api/index/index.js'
	export default {
		// components: {
		// 	navBar
		// },
		data() {
			return {
				title: '使用协议',
				content: ''
			}
		},
		onLoad(o) {
			if (o.type == 1) {
				// this.title='使用协议'
			} else if (o.type == 2) {
				this.title = '隐私协议'
			} else {
				this.title = '推广员功能服务协议'
			}
			this.getxieyi(o.type)
		},
		methods: {
			async getxieyi(type) {
				if (type == 1) {
					let res1 = await getyonghu()
					console.log('用户协议返回值--------2', res1);
					if (res1.code == 0) {
						this.content = res1.data.value
					} else {
						this.$toast(res1.message)
					}
				} else if (type == 2) {
					let res1 = await getyinsi()
					console.log('隐私协议返回值--------2', res1);
					if (res1.code == 0) {
						this.content = res1.data.value
					} else {
						this.$toast(res1.message)
					}
				} else {
					// this.content = '推广员功能服务协议'
					// let res1 = await getKefu()
					// console.log('推广协议返回值--------2', res1);
					// if (res1.code == 0) {
					// 	this.content = res1.data.push.value
					// } else {
					// 	this.$toast(res1.message)
					// }
					let res1 = await getPosterBg({
						key: 'agreement_share'
					})
					console.log('推广协议返回值--------2', res1);
					if (res1.code == 0) {
						this.content = res1.data.value
					} else {
						this.$toast(res1.message)
					}

				}
			},
		}
	}
</script>

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