<template>
  <OutMask :bg="bg">
    <div class="argument" :class="bg ? 'mobile_a' : 'pc'">
      <div class="argumentBox">
        <div class="agreement-title">
          {{ title }}
        </div>
        <div class="contactTxt" v-html="content"></div>
      </div>
      <div class="close_btn" @click="closeArgument()"></div>
    </div>
  </OutMask>
</template>

<script>
export default {
  components: {
    OutMask: () => import("./outMask.vue"),
  },
  props: {
    argumentTitle: {
      type: String,
      default: () => {
        return "";
      },
    },
    bg: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      content: "",
      title: "",
    };
  },
  watch: {
    argumentTitle: {
      handler(val, oldval) {
        console.log(val);
        // const id2js = ["userAgreement", "platformAgreement", "privacyPolicy"];
        const CNF = require("../assets/js/" + val + ".js").CNF;
        this.content = CNF.content;
        this.title = CNF.header;
      },
      deep: true,
    },
  },
  mounted() {
    console.log(this.argumentTitle);
    const CNF = require("../assets/js/" + this.argumentTitle + ".js").CNF;
    this.content = CNF.content;
    this.title = CNF.header;
  },
  methods: {
    closeArgument() {
      this.$emit("closeArgument");
    },
  },
};
</script>

<style lang="scss">
.argument {
  width: 1249px;
  height: 78%;
  background-size: cover;
  background: url("@/assets/mask/argument_bg.png");
  background-position: bottom;
  position: absolute;
  bottom: 57px;
  left: 50%;
  transform: translate(-50%, 0);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 2;
  &.mobile_a {
    width: 100%;
    height: 100%;
    background: none;
    box-sizing: border-box;
    bottom: auto;
    top: 0;
    left: 0;
    transform: translate(0);
    display: flex;
    flex-direction: column;
    justify-content: center;
    .argumentBox {
      height: 928px;
      position: static;
    }
    .agreement-title {
      text-align: left;
      padding-bottom: 26px;
      border-bottom: 1px solid rgba(250, 250, 244, 0.5);
    }
    .close_btn {
      margin-top: 100px;
      position: static;
      top: 0;
      right: 0;
      transform: translateX(0);
      &::after {
        position: absolute;
        content: "";
        left: 50%;
        transform: translateX(-50%);
        top: -45px;
        width: 650px;
        border-bottom: 1px solid rgba(250, 250, 244, 0.5);
        height: 1px;
      }
    }
  }
  .argumentBox {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow: scroll;
    overflow-x: hidden;
    padding: 0 0.48rem;
    box-sizing: border-box;
    scroll-behavior: smooth;
    font-size: 18px;
    font-weight: 300;
    color: #ffe8d4;
  }
  .strong {
    font-weight: bold;
  }
  .agreement-title {
    font-size: 36px;
    font-family: "Noto Serif SC", serif;
    font-weight: bold;
    color: #ffe8d4;
    text-align: center;
    margin-top: 45px;
    margin-bottom: 26px;
  }
  p {
    font-size: 18px;
    font-weight: 300;
    color: #ffe8d4;
  }
  .close_btn {
    top: 0;
    right: -28px;
    transform: translateX(100%);
  }
}

.pc {
  .argumentBox::-webkit-scrollbar {
    /*滚动条整体样式*/
    width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
    height: 1px;
  }

  .argumentBox::-webkit-scrollbar-thumb {
    /*滚动条里面滑块*/
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 6px #70189d;
    background-color: #888;
  }

  .argumentBox::-webkit-scrollbar-track {
    /*滚动条里面轨道*/
    box-shadow: inset 0 0 2px RGBA(138, 99, 166, 1);
    background: RGBA(138, 99, 166, 1);
    border-radius: 4px;
  }
}
</style>
