<template>
  <div class="exjumper-dialog-wrraper" v-if="isShowDialog">
    <div class="dialog-mask"></div>
    <div class="dialog-container">
      <div class="title" v-html="title"></div>
      <!-- <div class="dialog-content">{{content}}</div> -->
      <div class="sub-wrapper">
        <div v-show="needSubContent" class="dialog-sub-content">1.跳转后点击“购买学习”，注册登录“中华医学教育在线”平台（首次登录需用手机号注册）</div>
        <img class="dialog-img-1" src="https://file.yunqueyi.com/h5/images/tinified/II-tips-1.png" alt="">
        <div v-show="needSubContent" class="dialog-sub-content">2.支付方式选择 “学习卡支付”，输入您的学习卡激活码，即可参加考试、申请学分。</div>
        <img class="dialog-img-2" src="https://file.yunqueyi.com/h5/images/tinified/II-tips-2.png" alt="">
      </div>
      <div class="dialog-footer v-hairline-top">
        <span :class="{'single-btn': isSingle}" @click.stop.prevent="handlerAction(1)">{{cancleBtnText}}</span>
        <span v-show="!isSingle" class="confirm-btn v-hairline-left" @click.stop.prevent="handlerAction(2)">{{confirmBtnText}}</span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "common-dialog",
  data() {
    return {

    };
  },
  props: {
    title: {
      type: String,
      default: '即将打开<br/> “中华医学教育在线”平台'
    },
    content: {
      type: String,
      default: ''
    },
    needSubContent: {
      type: Boolean,
      default: false
    },
    subContent: {
      type: String,
      default: ''
    },
    cancleBtnText: {
      type: String,
      default: '取消'
    },
    confirmBtnText: {
      type: String,
      default: '确定'
    },
    isShowDialog: {
      type: Boolean,
      default: false
    },
    isSingle: {
      type: Boolean,
      default: false
    },
  },
  methods: {
    handlerAction(type) {
      this.$emit("handlerAction", type);
    },
  }
};
</script>
<style lang="less" scoped>
.exjumper-dialog-wrraper {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 2019;
  .dialog-mask {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2020;
  }
  .dialog-container {
    z-index: 2021;
    position: absolute;
    top: 50%;
    left: 50%;
    overflow: hidden;
    width: 300px;
    font-size: 18px;
    -webkit-transition: 0.3s;
    transition: 0.3s;
    border-radius: 4px;
    background-color: #fff;
    -webkit-transform: translate3d(-50%, -50%, 0);
    transform: translate3d(-50%, -50%, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    .title {
      margin: 30px 0 20px;
      text-align: center;
      font-size: 18px;
      font-weight: 700;
      color: #373839;
    }
    .dialog-content {
      // margin: 30px 22px;
      margin: 20px 16px 30px;
      text-align: left;
      font-size: 14px;
      font-weight: 400;
      color: #373839;
    }
    .sub-wrapper {
      margin-right: 5px;
      max-height: 300px;
      overflow: auto;
      .dialog-sub-content {
        margin: 0 8px 20px 16px;
        text-align: left;
        font-size: 14px;
        line-height: 24px;
        font-weight: 400;
        color: #979899;
      }
      .dialog-img-1 {
        width: 268px;
        height: 165px;
        margin-left: 16px;
        margin-bottom: 20px;
      }
      .dialog-img-2 {
        width: 268px;
        height: 145px;
        margin-left: 16px;
        margin-bottom: 20px;
      }

      &::-webkit-scrollbar-track-piece {
        background-color: rgba(0, 0, 0, 0);
        border-left: 1px solid rgba(0, 0, 0, 0);
      }
      &::-webkit-scrollbar {
        width: 5px;
        height: 13px;
        -webkit-border-radius: 3px;
        -moz-border-radius: 3px;
        border-radius: 3px;
      }
      &::-webkit-scrollbar-thumb {
        background-color: #C7C8C9;
        background-clip: padding-box;
        -webkit-border-radius: 3px;
        -moz-border-radius: 3px;
        border-radius: 3px;
        min-height: 28px;
      }
      &::-webkit-scrollbar-thumb:hover {
        background-color: #C7C8C9;
        -webkit-border-radius: 3px;
        -moz-border-radius: 3px;
        border-radius: 3px;
      }
    }

    .dialog-footer {
      height: 50px;
      display: flex;
      align-items: center;
      &.v-hairline-top::after {
        border-top-width: 1px;
      }
      span {
        display: inline-block;
        // width: 50%;
        flex: 1;
        height: 50px;
        line-height: 50px;
        font-size: 17px;
        text-align: center;
        color: #979899;
        &.v-hairline-left::after {
          border-left-width: 1px;
        }
        &.confirm-btn {
          color: #449284;
        }
        &.single-btn {
          color: #449284;
        }
      }
    }
  }

  [class*="v-hairline"] {
    position: relative;
    &::after {
      content: " ";
      position: absolute;
      pointer-events: none;
      box-sizing: border-box;
      top: -50%;
      left: -50%;
      right: -50%;
      bottom: -50%;
      -webkit-transform: scale(0.5);
      transform: scale(0.5);
      border: 0 solid #f0f1f2;
    }
  }
}
</style>
