<template>
	<view class='rule-box'>
		<u-parse :content="ruleHtmlParse"></u-parse>
	</view>
</template>

<script>
var md5 = require('../../../common/md5.js');
import uParse from '@/components/gaoyia-parse/parse.vue'
export default {
	data() {
		return {
			inviteId: getApp().globalData.user_id,
			ruleHtmlParse: ''
		};
	},
	components: {
		uParse,
	},
	onLoad(options) {
		this.getRuleRequest();
	},
	onShow() {
		//this.getUserTimes();
	},
	onShareAppMessage() {
		return {
			title: '阿拉灯神丁',
			path: '/pages/index/index?inviteId=' + getApp().globalData.user_id
		};
	},
	methods: {
		getRuleRequest() {
			let that = this;
			uni.showLoading({
				title: '加载中'
			});
			uni.request({
				url: getApp().globalData.shareUrl, //需要设置为全局
				method: 'POST',
				header: {
					'content-type': 'application/x-www-form-urlencoded'
				},
				data: {
					method: 'get_protocal',
					timestamp: getApp().globalData.globalTimestamp, //Date.now()
					sign: md5('get_protocal' + getApp().globalData.globalTimestamp)
				},
				success: res => {
					uni.hideLoading();
					if (res.data.code === 200) {
						that.ruleHtmlParse = res.data.msg;
					} else {
						uni.showToast({
							title: res.data.msg,
							icon: 'none'
						});
					}
				}
			});
		},
	}
};
</script>

<style>
page {
	height: 100%;
}
.rule-box {
	text-align: left;
	padding: 20upx;
}
</style>
