<!--
 * @Description: 招生简章
 * @Author: 空白格
 * @Date: 2022-08-26 17:56:21
 * @LastEditors: 空白格
 * @LastEditTime: 2022-08-29 14:05:10
 * @FilePath: \veterans_client_web\src\views\EducationPromote\RecruitStudents\RecruitStudentsIndex.vue
 * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
-->
<template>
  <div class="app-main details">
    <BannerBreadcrumb title="招生简章" :isRouter="true" />
    <div class="app-main-box details-box">
      <div class="app-main-box-content details-box-content">
        <div class="details-box-content-title">
          {{ schoolName || "-" }}
        </div>
        <div class="details-box-content-subtitle">
          <p v-if="detainsInfo.regulation_file" @click="downloadFile">
            <span class="el-icon-paperclip"></span>
            <span>下载附件</span>
          </p>
        </div>
        <div class="details-box-content-des">
          <div class="dbcd-content ql-editor" v-html="detainsInfo.regulation"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import BannerBreadcrumb from "@/components/BannerBreadcrumb";
import { getSchoolRecruitstudents } from "@/api/EducationPromote";
export default {
  name: "WorkGuideDetailsIndex",
  components: {
    BannerBreadcrumb,
  },
  data() {
    return {
      detainsInfo: {},
      id: undefined,
      schoolName: "",
    };
  },
  created() {
    const { id, name } = this.$route.query;
    if (id) {
      this.id = id;
      this.schoolName = name;
      this.getDetails();
    }
  },
  methods: {
    /**
     * 获取详情
     * @date 2022-08-25
     * @returns {any}
     */
    getDetails() {
      getSchoolRecruitstudents({ id: this.id }).then((res) => {
        if (res.code === 200) {
          this.detainsInfo = res?.data;
        }
      });
    },
    /**
     * 预览pdf
     * @date 2022-08-25
     * @param {any} pdfUrl
     * @returns {any}
     */
    previewPdf(pdfUrl) {
      if (pdfUrl) {
        window.open("http://www.gjtool.cn/pdfh5/pdf.html?file=" + pdfUrl);
      }
    },
    /**
     * 下载附件
     * @date 2022-08-29
     * @returns {any}
     */
    downloadFile() {
      if (this.detainsInfo.regulation_file) {
        window.open(this.detainsInfo.regulation_file)
      }
    }
  },
};
</script>

<style lang="scss" scoped>
.details {
  &-box {
    margin: 0 auto;
    &-content {
      &-title {
        padding: 10px 0;
        text-align: center;
        font-size: 24px;
        color: #1a1a1a;
        border-bottom: 1px solid #d5d5d5;
      }
      &-subtitle {
        text-align: center;
        margin: 20px 0 40px;
        font-size: 14px;
        color: #999999;
        span {
          cursor: pointer;
        }
        .no-reply {
          color: #ef6622;
        }
        .has-reply {
          color: #3ca7fe;
        }
      }
      &-des {
        .dbcd-label {
          font-size: 20px;
          color: #1a1a1a;
          margin-bottom: 20px;
          font-family: SourceHanSansCN;
        }
        .dbcd-content {
          color: #666666;
          font-size: 14px;
        }
      }
      &-pdf {
        text-align: center;
        margin: 20px auto 30px;
        div {
          display: inline-block;
          padding: 0 100px;
          max-width: 700px;
          cursor: pointer;
          height: 50px;
          line-height: 50px;
          text-align: center;
          font-size: 14px;
          color: #008fff;
          border: dashed 1px #0091ff;
          border-radius: 5px;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          word-break: break-all;
        }
      }
      &-reply {
        .dbcr-label {
          font-size: 20px;
          color: #1a1a1a;
          margin-bottom: 20px;
          font-family: SourceHanSansCN;
        }
        .dbcr-content {
          color: #666666;
          font-size: 14px;
        }
      }
    }
  }
}
</style>
