<template>
	<view class="page">
		
		<view class="info">
			<!-- 标题 -->
			<!-- <view class="info-title">
				{{title}}
			</view> -->
			
			<!-- 内容 -->
			<view class="info-content">
				<mp-html v-if="html1" :content="html1" :markdown="true" :lazy-load="true"/>
			</view>
		</view>
		
		
		<!-- service 客服-->
		<service ref="serviceId" @goservice="goservice"></service>
		
		<!-- top 返回顶部-->
		<top ref="topId"></top>
		
		
	</view>
</template>

<script>
	import top from "../components/top.vue";
	import service from "../components/service.vue";
	export default {
		components: {
			top,service
		},
		data() {
			return {
				id:1,
				title: "用户授权协议",
				html1:``,
			}
		},
		onShow(){
		},
		onLoad(options) {
			// 富文本不好二次赋值，或者再ready中赋值
			if(options.data){
				var info=JSON.parse(decodeURIComponent(options.data));
				this.id= info.id;
				this.title= info.content;
				this.html1= info.content;
			}
		},
		async onReady(){
			// 1、用户授权协议  2、用户隐私协议 3、用户注册协议 4、征信授权协议 5、租赁服务协议 6、
			if(this.title)
			{
				uni.setNavigationBarTitle({
				  title: this.title,
				});
				// this.getxy();
			}
		},
		onPageScroll(e) {
			//调用子组件方法
			this.$refs.topId.topData(e.scrollTop);
		},
		methods:{
			async getxy(){
				if(this.id){
					try{
						uni.showLoading({
							title: '数据加载中...'
						});
						const {data: res} = await uni.$http.post('/platform/getProtocol');
						if(res){
							this.html1=res.content;
							this.$forceUpdate();
						}
					}
					catch(e){
						console.log(e)
					}
				}
			},
			goservice(val){
				console.log(val);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.user{
		background-color: #FFFFFF;
		min-height: calc(100vh - var(--window-top)) !important;
	}
	.info{
		position: relative;
		display: block;
		overflow: hidden;
	}
	.info-content{
		padding: 24rpx 24rpx 40rpx 24rpx;
		line-height: 2;
		color:#0E1521;
		font-size: 28rpx;
		letter-spacing: 1rpx;
	}
</style>
