<template>
  <!-- 《服务条款》与《隐私政策》 -->
  <div class="terms-container">
    <div class="r-header">
      <div class="content">
        <nuxt-link to="/" tag="a" class="logo">
          <img class="logo-img" v-if="webConfigData.pcLogoImgText" :src="webConfigData.pcLogoImgText"/>
        </nuxt-link>
        <div class="go-login">
          <nuxt-link to="/login" class="login-btn">{{$t('register.goToLogin')}}</nuxt-link>
        </div>
      </div>
    </div>
    <div class="terms-box">
      <div v-if="content" v-rich="content"></div>
    </div>
  </div>
</template>

<script>
import util from '~/plugins/util.js'
export default {
  layout: 'policy',
  data () {
    return {
      showFirstTerma: true,
      sts: this.$route.query.sts,
      content: '',
      webConfigData: {}
    }
  },
  methods: {

  },
  beforeMount () {
    // key = 'service-terms'代表服务条款，key = 'service-policy'代表隐私策略
    if (this.sts == 0) {
      this.$axios.get('/sys/config/info/serviceTerms')
      .then(({ data }) => {
        this.content =  data.content
      })
    } else if (this.sts == 1) {
      this.$axios.get('/sys/config/info/servicePolicy')
      .then(({ data }) => {
        this.content = data.content
      })
    }
  },
  mounted () {
    this.$emit('hideLoginPop')
    // 获取网站配置信息
    this.webConfigData = JSON.parse(localStorage.getItem('webConfig') || '{}')
  },
  methods: {
    privacyPolicy: function () {
      this.showFirstTerma = false
    },
    servicePolicy: function () {
      this.showFirstTerma = true
    },
  }
}
</script>

<style scoped>
.logo-img {
  width: 190px;
  height: 48px;
}
.terms-box {
  width: 60%;
  margin: 30px auto;
  font-size: 15px;
}
.article-tit {
  text-align: center;
  font-size: 16px;
  font-weight: bold;
}
.cont,
.cont-tit {
  margin: 15px 0;
  text-align: justify;
  line-height: 1.6em;
}
.cont {
  text-indent: 2em;
}
.blod {
  font-weight: bold;
}
.signature {
  text-align: right;
  margin-top: 50px;
}
.jump {
  color: #1588ca;
  text-decoration: underline;
}
</style>
