<template>
  <!-- #ifdef H5 -->
	<view class="app-container">
		<view class="content">
			<u-parse :content="content"></u-parse>
		</view>
	</view>
  <!-- #endif -->
  <!-- #ifndef H5 -->
  <web-view :src="webViewHref(`/packageMine/pages/agreement`, pam,crossPagePam)" @message="crossPage.$listener"></web-view>
  <!-- #endif -->
</template>

<script>
  // #ifdef H5
	export default {
		data() {
			return {
				type: 1,
				content: '',
			}
		},
		onLoad({type}) {
			this.type = type;

			uni.setNavigationBarTitle({
			　　title: {1: '用户协议', 2: '隐私声明', 3: '服务协议', 4: '以旧换新协议'}[type]
			})

			this.getDetail();
		},
		methods: {
			getDetail() {
				this.$api.get('/common/wechat/detail')
        .then(res => {
					if(this.type == 1) {
						this.content = res.data.adminCompanyWechatOther.userAgreementContent;
					}else if(this.type == 2) {
						this.content = res.data.adminCompanyWechatOther.privacyStatementContent;
					}else if(this.type == 3){
						this.content = res.data.adminCompanyWechatOther.serviceContent;
					}else if(this.type == 4){
						this.content = res.data.adminCompanyWechatOther.tradeContent;
					}
				})
			},
		}
	}
  // #endif
  // #ifndef H5
  export default {
    data() {
      return {
        pam: {},
      }
    },

    onLoad(pam) {
      this.pam = pam;
    },
  }
  // #endif
</script>

<style lang="scss">
	.app-container {
		background: #ffffff;
		padding: 0 30rpx;
		box-sizing: border-box;
	}
	.content {
		image {
			width: 100%;
		}
	}
</style>
