<template>
  <h-view class="privacy public-style">
    <h-header :proportion="[5,1,1]" class="bar-custom">
      <div slot="left" class="h-header-btn" @click="$routeGo()">
        <img src="@/assets/userBind/arrow.png">
        <span>隐私政策</span>
      </div>
    </h-header>
    <h-content>
      <iframe
        :src= "privacyPath" width="100%" height="100%"
        frameborder="0" scrolling="auto"/>
    </h-content>
    <bottom-tab v-if="buttonFlag">
      <tab-button @click.native="privacyNo">不同意</tab-button>
      <tab-button class="agreeBtn" @click.native="privacyAgree">同意</tab-button>
    </bottom-tab>
  </h-view>
</template>

<script>
export default {
  name: 'PrivacyPolicy',
  data () {
    return {
      buttonFlag: this.$route.params.button,
      privacyPath: process.env.privacyPath,
    }
  },
  activated () {
    this.buttonFlag = this.$route.params.button
  },
  methods: {
    privacyNo () {
      window.localStorage.setItem('isReadPolicy', false)
      navigator.app && navigator.app.exitApp && navigator.app.exitApp()
      this.$routeGo()
    },
    privacyAgree () {
      window.localStorage.setItem('isReadPolicy', true)
      this.$routeGo()
    },
  },
}
</script>

<style lang="less">
  .privacy {
    .content {
      padding: 15px;
      .title {
        font-weight: 500;
        text-indent: 0px;
      }
      hr {
        background-color: #666;
      }
      p {
        text-indent: 2em;
        font-size: 14px;
        margin-bottom: 5px;
        line-height: 18px;
      }
    }
    .agreeBtn{
     background-color: @headerColor;
      color: #fff;
    }
  }

</style>
