<template>
  <div id="resumexq">
    <el-dialog
      :visible.sync="dialogBox"
      width="780px"
      :show-close="false"
      :destroy-on-close="true"
      :before-close="closeBefore"
      :fullscreen="fullscreen"
    >
      <div slot="title" class="hearders">
        <div class="leftTitle">详情</div>
        <div class="rightBoxs">
          <img
            src="@/assets/images/Max@2x.png"
            alt=""
            @click="fullscreen = !fullscreen"
          />
          <img src="@/assets/images/Close@2x.png" alt="" @click="closeBefore" />
        </div>
      </div>
      <el-row class="contentBox" :gutter="30">
        <div class="topLsBtn">
          <div
            class="lstext"
            :class="activeStatus === 1 ? 'activesSty' : ''"
            @click="activeChanges(1)"
          >
            {{pageInfo.realname || userVo.realname}}-在线简历
          </div>
          <div
            class="lstext"
            :class="activeStatus === 2 ? 'activesSty' : ''"
            @click="activeChanges(2)"
          >
            附件简历详情
          </div>
        </div>
        <div v-if="activeStatus === 1">
          <p class="pList">
            应聘岗位：{{ pageInfo.job }} | {{ pageInfo.jobType }}
          </p>
          <p class="pList">
            投递时间：{{ $methodsTools.onlyForma(pageInfo.createTime) }}
          </p>
          <div class="userBoxs">
            <div class="imgBoxsZing">
              <img
                style="width: 100%; height: 100%"
                :src="$methodsTools.splitImgHost(userVo.oneInchPhotos)"
                alt=""
              />
            </div>
            <div class="riglist">
              <h2 class="hesz">
                {{ pageInfo.realname || userVo.realname }}
                <i class="topRislz">简历完成度：{{ pageInfo.completeness }}%</i>
              </h2>
              <p>
                {{ pageInfo.sex === 1 ? "男" : "女" }} |
                {{ getYears(pageInfo.userBirth) }}岁 ({{ pageInfo.userBirth }})
                | 现居 {{ pageInfo.city + "-" + pageInfo.district }} |
                {{ getYearsNum(pageInfo.startYear) }}年工作经验 |
                {{ pageInfo.comeWorkTime }}
              </p>
              <p>邮箱号：{{ pageInfo.email }}</p>
              <p>手机号：{{ pageInfo.telphone }}</p>
              <div class="sdzz">
                <h3>个人视频</h3>
                <i
                  v-if="
                    pageInfo.introduceVideoUrl !== null &&
                    pageInfo.introduceVideoUrl !== ''
                  "
                  class="el-icon-video-play"
                  @click="openVideo"
                ></i>
                <span v-else>无</span>
              </div>
            </div>
          </div>
          <div class="qzyx">
            <div class="tyHeaderStyle">求职意向</div>
            <p style="font-weight: 600">
              {{ pageInfo.job }} {{ pageInfo.city + "-" + pageInfo.district }}
              {{ pageInfo.wantIncomeStart }}-{{ pageInfo.wantIncomeEnd }}/{{
                pageInfo.wantIncomeType === 1 ? "月" : "年"
              }}
            </p>
            <p>
              {{ pageInfo.jobType }} | 到岗时间：{{ pageInfo.comeWorkTime }}
            </p>
            <div class="dis_sf">
              <div>自我评价：</div>
              <div>{{ pageInfo.selfEvaluation }}</div>
            </div>
          </div>
          <div class="userInfosPres">
            <div class="tyHeaderStyle">个人信息</div>
            <p>
              户口/户籍：{{
                userVo.houseProvince + userVo.houseCity + userVo.houseDistrict
              }}
            </p>
            <p>政治面貌：{{ userVo.politic }}</p>
            <p>婚姻状况：{{ userVo.marry }}</p>
          </div>
          <div class="gzjl">
            <div class="tyHeaderStyle">工作经历</div>
            <div
              class="dis_fz"
              v-for="(item, index) in pageInfo.workExperienceJson"
              :key="index"
            >
              <div class="yearsSty">
                {{ item.startTime }} ~ {{ item.endTime }}
              </div>
              <div>{{ item.company }}</div>
              <div style="margin-left: 40px">{{ item.job }}</div>
            </div>
          </div>
          <div class="gzjl">
            <div class="tyHeaderStyle">项目经验</div>
            <div
              style="margin-bottom: 20px"
              v-for="(item, index) in pageInfo.projectExperienceJson"
              :key="index"
            >
              <div class="dis_fz">
                <div class="yearsSty">
                  {{ item.startTime }} ~ {{ item.endTime }}
                </div>
                <div>{{ item.job }}</div>
              </div>
              <div>项目描述：{{ item.projectDescription }}</div>
            </div>
          </div>
          <div class="gzjl">
            <div class="tyHeaderStyle">教育经历</div>
            <div
              class="dis_fz"
              v-for="(item, index) in pageInfo.eduExperienceJson"
              :key="index"
            >
              <div class="yearsSty">
                {{ item.startTime }} ~ {{ item.endTime }}
              </div>
              <div>{{ item.school }}</div>
              <div style="margin-left: 40px">{{ item.Professional }}</div>
              <div style="margin-left: 40px">{{ item.edu }}</div>
            </div>
          </div>
          <div class="zhengshu">
            <div class="tyHeaderStyle">证书</div>
            <div>
              <div class="hty">建筑资历证书</div>
              <div
                v-for="(item, index) in pageInfo.certificateJson"
                :key="index"
              >
                <div class="fiss" v-if="item.cfType === '0'">
                  <div class="YEARS_S">{{ item.endTime }}</div>
                  <div>{{ item.categoryName }}</div>
                </div>
              </div>
            </div>
            <div>
              <div class="hty">非建筑资历证书</div>
              <div
                v-for="(item, index) in pageInfo.certificateJson"
                :key="index"
              >
                <div class="fiss" v-if="item.cfType === '1'">
                  <div class="YEARS_S">{{ item.endTime }}</div>
                  <div>{{ item.cfName }}</div>
                </div>
              </div>
            </div>
          </div>
          <div>
            <div class="tyHeaderStyle">操作动态</div>
            <div style="max-height: 300px; overflow: auto">
              <el-steps direction="vertical" :active="voList.length">
                <el-step
                  v-for="(item, index) in voList"
                  :key="index"
                  :title="
                    item.status === 1
                      ? '邀请面试'
                      : item.status === 2
                      ? '查看简历'
                      : item.status === 3
                      ? '投递简历'
                      : '未知状态'
                  "
                  :description="
                    item.userName +
                    ' ' +
                    $methodsTools.onlyForma(item.createTime)
                  "
                  icon="el-icon-circle-check"
                ></el-step>
              </el-steps>
            </div>
          </div>
        </div>
        <div v-if="activeStatus === 2">
          <div
            class="die_s"
            v-if="pageInfo.attachUrl !== null && pageInfo.attachUrl !== ''"
          >
            <a
              :href="$methodsTools.splitImgHost(pageInfo.attachUrl)"
              target="_blank"
              class="img_pdf"
              ><img
                style="width: 100%; height: 100%"
                src="@/assets/images/pdf@3x.png"
                alt="PDF图"
            /></a>
            <div>{{ pageInfo.attachName }}</div>
          </div>
          <div style="text-align: center" v-else>暂无附件</div>
        </div>
        <div class="qusts" v-if="upPageInfos.userVo === 0">
          <el-button type="warning" @click="addClick(1)">拒绝</el-button
          ><el-button type="primary" @click="addClick(0)">邀请面试</el-button>
        </div>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeBefore">关闭</el-button>
      </div>

      <el-dialog
        :visible.sync="openVideoStatus"
        width="500px"
        :show-close="false"
        :append-to-body="true"
        :destroy-on-close="true"
      >
        <div slot="title" class="hearders">
          <div class="leftTitle">详情</div>
          <div class="rightBoxs">
            <img
              src="@/assets/images/Close@2x.png"
              alt=""
              @click="closeBeforefs"
            />
          </div>
        </div>
        <el-row class="contentBox" :gutter="30">
          <div style="width: 100%; height: 100%">
            <video
              controls
              preload
              style="width: 100%; height: 100%"
              :src="$methodsTools.splitImgHost(pageInfo.introduceVideoUrl)"
            ></video>
          </div>
        </el-row>
        <div slot="footer" class="dialog-footer">
          <el-button @click="closeBeforefs">关闭</el-button>
        </div>
      </el-dialog>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      activeStatus: 1,
      openVideoStatus: false,
      fullscreen: false,
      dialogBox: false,
      pageInfo: {},
      userVo: {},
      voList: [],
      upPageInfos: {},
    };
  },
  methods: {
    openVideo() {
      this.openVideoStatus = true;
    },
    init(v) {
      var self = this;
      this.$api.recruitinterview(v).then((res) => {
        if (res.code === 200) {
          if (res.data.recruitResumeVo.certificateJson) {
            res.data.recruitResumeVo.certificateJson = JSON.parse(
              res.data.recruitResumeVo.certificateJson
            );
          }
          if (res.data.recruitResumeVo.eduExperienceJson) {
            res.data.recruitResumeVo.eduExperienceJson = JSON.parse(
              res.data.recruitResumeVo.eduExperienceJson
            );
          }
          if (res.data.recruitResumeVo.projectExperienceJson) {
            res.data.recruitResumeVo.projectExperienceJson = JSON.parse(
              res.data.recruitResumeVo.projectExperienceJson
            );
          }
          if (res.data.recruitResumeVo.workExperienceJson) {
            res.data.recruitResumeVo.workExperienceJson = JSON.parse(
              res.data.recruitResumeVo.workExperienceJson
            );
          }
          if (res.data.recruitResumeVo.userBirth) {
            res.data.recruitResumeVo.userBirth =
              res.data.recruitResumeVo.userBirth.slice(
                0,
                res.data.recruitResumeVo.userBirth.indexOf("T")
              );
          }
          self.pageInfo = res.data.recruitResumeVo;
          self.userVo = res.data.userVo;
          self.voList = res.data.recruitInterviewLogVoList.reverse();
          self.dialogBox = true;
        }
      });
    },
    getCInfos(options) {
      this.upPageInfos = options;
    },
    addClick(int) {
      this.$emit("addClicks", this.upPageInfos, int);
    },
    activeChanges(int) {
      this.activeStatus = int;
    },
    closeBefore() {
      this.dialogBox = false;
    },
    closeBeforefs() {
      this.openVideoStatus = false;
    },
    getYearsNum(int) {
      var d = new Date();
      var nowYear = d.getFullYear();
      return nowYear - int;
    },
    getYears(strBirthday) {
      if (strBirthday === undefined || strBirthday === null) {
        return "-";
      }
      var returnAge;
      var strBirthdayArr = strBirthday.split("-");
      var birthYear = strBirthdayArr[0];
      var birthMonth = strBirthdayArr[1];
      var birthDay = strBirthdayArr[2];
      var d = new Date();
      var nowYear = d.getFullYear();
      var nowMonth = d.getMonth() + 1;
      var nowDay = d.getDate();

      if (nowYear == birthYear) {
        returnAge = 0; //同年 则为0岁
      } else {
        var ageDiff = nowYear - birthYear; //年之差
        if (ageDiff > 0) {
          if (nowMonth == birthMonth) {
            var dayDiff = nowDay - birthDay; //日之差
            if (dayDiff < 0) {
              returnAge = ageDiff - 1;
            } else {
              returnAge = ageDiff;
            }
          } else {
            var monthDiff = nowMonth - birthMonth; //月之差
            if (monthDiff < 0) {
              returnAge = ageDiff - 1;
            } else {
              returnAge = ageDiff;
            }
          }
        } else {
          returnAge = -1; //返回-1 表示出生日期输入错误 晚于今天
        }
      }
      return returnAge; //返回周岁年龄
    },
  },
};
</script>

<style lang="less" scoped>
.trLists {
  td {
    background-color: rgb(249, 250, 252);
    font-weight: 600;
  }
}
td {
  padding: 10px;
}
th {
  padding: 10px;
  background-color: rgb(249, 250, 252);
}
.label {
  text-align: right;
  background-color: rgb(249, 250, 252);
  width: 15%;
}
.flex {
  width: 35%;
}
/deep/.el-button {
  border-radius: 8px;
}
/deep/.el-dialog {
  border-radius: 8px;
  .el-dialog__header {
    padding: 0;
    .hearders {
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0px 18px 0px 20px;
      border-bottom: 1px solid #e2e2e2;
      .leftTitle {
        font-size: 14px;
        font-weight: bold;
        color: #2f4378;
      }
      .rightBoxs {
        display: flex;
        align-items: center;
        img {
          width: 14px;
          height: 14px;
          margin-left: 13px;
          cursor: pointer;
        }
      }
    }
  }
  .el-dialog__footer {
    padding: 0;
    .dialog-footer {
      padding: 0px 40px;
      height: 70px;
      border-top: 1px solid #e2e2e2;
      display: flex;
      align-items: center;
      justify-content: flex-end;
    }
  }
}
.imgBox {
  width: 100%;
  // height: 210px;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 8px 8px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  .imgLabel {
    flex: 1;
    width: 100%;
    border: 1px dotted #e2e2e2;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    border-radius: 8px;
    .msPhoto {
      display: flex;
      justify-content: center;
      align-items: center;
      max-width: 100%;
      max-height: 270px;
      img {
        max-width: 100%;
        max-height: 270px;
      }
    }
    .imgbbx {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      i {
        font-weight: bold;
        margin: 14px 0;
        font-size: 24px;
      }
    }
  }
  p {
    margin: 5px 0px;
  }
}
.contentBox {
  padding: 0px 20px;
}
.topLsBtn {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  .lstext {
    font-weight: bold;
    margin-right: 40px;
    font-size: 16px;
    padding-bottom: 10px;
    cursor: pointer;
    color: #333;
    border-bottom: 3px solid transparent;
  }
  .activesSty {
    color: rgb(2, 167, 240);
    border-bottom-color: rgb(2, 167, 240);
  }
}
.pList {
  margin-bottom: 14px;
}
i {
  font-style: normal;
}
.userBoxs {
  display: flex;
  margin-bottom: 40px;
  .imgBoxsZing {
    width: 200px;
    height: 280px;
    border-radius: 8px;
    margin-right: 30px;
  }
  .riglist {
    .topRislz {
      margin-left: 40px;
      font-size: 16px;
      font-weight: 400;
    }
    .hesz {
      margin-bottom: 10px;
    }
    p {
      margin-bottom: 10px;
    }
    .sdzz {
      display: flex;
      align-items: center;
      h3 {
        color: rgb(2, 167, 240);
      }
      i {
        margin-left: 40px;
        font-size: 24px;
        cursor: pointer;
        color: #000;
        transition: all 0.2s;
      }
      i:hover {
        color: rgb(2, 167, 240);
      }
    }
  }
}
.tyHeaderStyle {
  color: rgb(2, 167, 240);
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 14px;
}
.qzyx {
  margin-bottom: 40px;
  p {
    margin-bottom: 10px;
  }
  .dis_sf {
    display: flex;
  }
}
.userInfosPres {
  margin-bottom: 40px;
  p {
    margin-bottom: 10px;
  }
}
.gzjl {
  margin-bottom: 40px;
  .dis_fz {
    display: flex;
    align-items: center;
    .yearsSty {
      width: 200px;
    }
  }
}
.zhengshu {
  margin-bottom: 40px;
  .hty {
    height: 30px;
    line-height: 30px;
    padding: 0px 15px;
    margin-bottom: 14px;
    background-color: rgb(242, 242, 242);
  }
  .fiss {
    padding-left: 15px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    .YEARS_S {
      width: 200px;
    }
  }
}
.qusts {
  display: flex;
  align-items: center;
  justify-content: center;
}
/deep/.el-step.is-vertical {
  min-height: 70px;
}
.die_s {
  display: flex;
  align-items: center;
  .img_pdf {
    display: block;
    width: 65px;
    height: 80px;
    margin-right: 20px;
    cursor: pointer;
    transition: all 0.3s;
  }
}
.img_pdf:hover {
  transform: scale(1.1);
}
</style>