<template>
	<view>
		<view style="color: #fff;">
		<tn-nav-bar :bottomShadow="false" backgroundColor="#26B3A0">{{title}}</tn-nav-bar>
		<view :style="{height: tobheight+'px'}"></view>
		</view>
		<view class="gy">
			<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 => {
					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;
}
</style>
