<template>
	<view>
		<web-view :webview-styles="webviewStyles" :src="url"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: "",
				webviewStyles: {
					progress: {
						color: '#F07423'
					}
				},
				type: "",
			};
		},
		onLoad(param) {
			this.type = param.type;
			let title = ""
			if (this.type == 1) {
				title = "用户使用协议"
			} else if (this.type == 2) {
				title = "隐私协议"
			} else if (this.type == 3) {
				title = "入驻协议"
			}
			uni.setNavigationBarTitle({
				title: title
			})
			this.webviewStyles.progress.color = getApp().globalData.color1;
			this.queryProtocolConfigView();
		},
		methods: {
			async queryProtocolConfigView() {
				let res = await this.$myRequest({
					url: "/project/queryProtocolConfigView",
					data: {},
				})
				if (res.data.success) {
					if (this.type == '1') { //使用协议
						this.url = res.data.single.userUseProtocol;
					} else if (this.type == '2') { //隐私协议
						this.url = res.data.single.userPrivacyProtocol;
					} else if (this.type == '3') { //业主注册协议
						this.url = res.data.single.ownerRegistProtocol;
					}
				}
			},
		}
	}
</script>

<style lang="scss">

</style>