<template>
  <div class="protocol">
    <div class="protocol-name">
      《{{ name }}》
    </div>
    <div
      class="protocol-content"
      v-html="content"
    />
  </div>
</template>

<script>
import { getProtocolContentByType, getProtocolNameByType} from '@/api/login';
export default {
  data() {
    return {
      name: '',
      content: '',
      title:''
    };
  },
  mounted() {
    const { type } = this.$route.query;
    this.title = type == 5 ? '云鹊隐私声明' : '云鹊健康用户协议';
    document.querySelector('title').innerHTML = this.title;
    this.getProtocolNameByType(type);
    this.getProtocolContentByType(type);
  },
  methods: {
    getProtocolContentByType(type) {
      getProtocolContentByType(type).then(res => {
        console.log(res);
        this.content = res.data;
        console.log('1  ', this.content);
      });
    },
    getProtocolNameByType(type) {
      getProtocolNameByType(type).then(res => {
        console.log(res);
        this.name = res.data;
      });
    },
  }
};
</script>

<style lang="scss" scoped>
  .protocol{
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
  }
  .protocol-name{
    height: 20px;
    font-size: 20px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 600;
    color: #02120F;
    line-height: 20px;
    text-align: center;
    margin: 15px 0;
  }
  .protocol-content{
    font-size: 15px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #02120F;
    line-height: 23px;
    width: 345px;
    margin: 0 auto 50px auto;
  }
</style>
