<template>
	<view>
		<view style="color: #fff;z-index: 99999999;position: relative;">
			<tn-nav-bar :bottomShadow="false" backgroundColor="#207CF7">{{title}}</tn-nav-bar>
			<view :style="{height: tobheight+'px'}"></view>
		</view>
		<view class="gy" style="z-index: 1;position: relative;">
			<u-parse :content="content"></u-parse>
		</view>
		<wike-loading-page :isLoading="isLoading"></wike-loading-page>
	</view>
</template>

<script>
	import {
		mapMutations,
		mapActions,
		mapState,
		mapGetters
	} from 'vuex';
	export default {
		data() {
			return {
				content: '',
				type: '',
				title: '',
				tobheight: 45,
				platform: this.$platform.get(),
				isLoading: true
			}
		},
		computed: {
			...mapGetters(['appInfo'])
		},
		onLoad(e) {
			if (e && e.type) {
				this.type = e.type

				this.title = e.type == 'privacy' ? '隐私政策' : e.type == 'aboutus' ? '关于我们' : '使用协议'
				if (this.platform == 'wxMiniProgram') {
					var menumtop = uni.getMenuButtonBoundingClientRect().top - uni.getSystemInfoSync().statusBarHeight
					var paddingtop = uni.getSystemInfoSync().statusBarHeight + menumtop
					this.tobheight = (menumtop + paddingtop + uni.getMenuButtonBoundingClientRect().height)
				}

				this.privacyabout()
			}

		},
		methods: {
			privacyabout() {
				this.$http('conf.getGroupConf', {
					group: 'system.agreement'
				}).then(res => {
					console.log('关于我们返回值：', res
						.data.aboutus);
					if (res.code == 0) {
						uni.setNavigationBarTitle({
							title: this.appInfo.site_name
						})
						this.content = this.type == 'privacy' ? res.data.privacy : this.type == 'aboutus' ? res
							.data.aboutus : res.data.use
						this.isLoading = false
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.gy {
		margin: 30rpx;
	}

	::v-deep ._p {
		display: flex;
		justify-content: center;
	}
</style>