<template>
    <view class="clauseCont" v-if="loaded">
	  <u-parse :html="clauseData"></u-parse>
    </view>
</template>

<script>
  import {
    secretService
  } from '@/apis/interfaces/auth'
  export default {
    data() {
      return {
        clauseData: '' ,//服务条款,
		loaded:false
      };
    },
    onLoad(e) {
		if(e.name === 'service'){
			uni.setNavigationBarTitle({
				title:'用户服务协议'
			})
		}else{
			uni.setNavigationBarTitle({
				title:'用户隐私协议'
			})
		}
      // 获取服务条款
      this.clauseInfo(e.name)
    },
    methods: {
      // 服务条款
      clauseInfo(name) {
        secretService(name).then(res => {
          this.clauseData = res.content.replace(/\<img/gi,
            '<img style="max-width:100%; height:auto; vertical-align: top;"')
			this.loaded = true
        }).catch(err => {
          uni.showToast({
            icon: 'none',
            title: err.message
          })
        })
      },
    }
  }
</script>

<style lang="scss">
  page {
    background-color: $uni-bg-color;
  }

  .clauseCont {
    padding: $padding ;
    width: 100%;
    box-sizing: border-box;
  }
</style>
