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

<script>
	import {
		agreement
	} from "@/api/all.js";
	export default {
		data() {
			return {
				content: '',
				type: ''
			};
		},
		onLoad(e) {
			uni.setNavigationBarTitle({
				title: e.type === "service_user_agreement" ? "用户服务协议" : "隐私权政策",
			});
			this.type = e.type
			this.agreement(e.type);




		},
		methods: {
			async agreement(type) {

				const res = await agreement({
					type,
					end: 2,
					store_id: uni.getStorageSync('store_id') || '11001',
				});
				console.log(res);
				if (res.errcode == 0) {

					if (this.type == 'service_user_agreement') {
						this.content = res.data[0].content
					} else {
						this.content = res.data[1].content
					}




				} else {
					this.$toast(res.msg);
				}

			},
		},
	};
</script>
