<template>
  <div id="backColo">
    <div class="right">
      <div class="showTitle">
        <el-icon id="primeTitle"><Tickets /></el-icon>
        <h2>家政人员详情</h2>
      </div>
      <table class="bigtable">
        <tr class="headPortrait">
          <td class="title">
            <div>
              <el-icon><PictureFilled /></el-icon>
              <h3>头像</h3>
            </div>
          </td>
          <td class="avatarParent">
            <div class="avatar"><img :src="this.avatar" /></div>
          </td>
        </tr>
        <tr>
          <td class="title">
            <div>
              <el-icon><User /></el-icon>
              <h3>用户名</h3>
            </div>
          </td>
          <td class="input">
            <input type="text" v-model="this.nickName" disabled />
          </td>
          <td class="title">
            <div>
              <el-icon><Paperclip /></el-icon>
              <h3>分类范围</h3>
            </div>
          </td>
          <td class="input">
            <input v-model="this.categoryName" type="text" disabled />
          </td>
        </tr>
        <tr>
          <td class="title">
            <div>
              <el-icon><Clock /></el-icon>
              <h3>年龄</h3>
            </div>
          </td>
          <td class="input">
            <input type="text" disabled v-model="this.age" />
          </td>
          <td class="title">
            <div>
              <el-icon><Male /></el-icon>
              <h3>性别</h3>
            </div>
          </td>
          <td>
            <select id="gender" disabled v-model="this.sex">
              <option value="">请选择</option>
              <option value="1">男</option>
              <option value="2">女</option>
            </select>
          </td>
        </tr>
        <tr>
          <td class="title">
            <div>
              <el-icon><Iphone /></el-icon>
              <h3>联系方式</h3>
            </div>
          </td>
          <td class="input">
            <input v-model="this.phone" type="text" disabled />
          </td>
          <td class="title">
            <div>
              <el-icon><Location /></el-icon>
              <h3>地区</h3>
            </div>
          </td>
          <td class="input">
            <input v-model="this.area" type="text" disabled />
          </td>
        </tr>
        <tr>
          <td class="title">
            <div>
              <el-icon><Coin /></el-icon>
              <h3>薪酬(次/日)</h3>
            </div>
          </td>
          <td class="input">
            <input v-model="this.salary" type="text" disabled />
          </td>
          <td class="title">
            <div>
              <el-icon><Calendar /></el-icon>
              <h3>上岗日期</h3>
            </div>
          </td>
          <td class="input">
            <input v-model="this.serverTime" type="text" disabled />
          </td>
        </tr>
        <tr>
          <td class="title">
            <div>
              <el-icon><HomeFilled /></el-icon>
              <h3>是否住家</h3>
            </div>
          </td>
          <td class="input">
            <input v-model="this.stay" type="text" disabled />
          </td>
          <td class="title">
            <div>
              <el-icon><Operation /></el-icon>
              <h3>聘请类别</h3>
            </div>
          </td>
          <td class="input">
            <input v-model="this.serverType" type="text" disabled />
          </td>
        </tr>
        <tr>
          <td class="title">
            <div>
              <el-icon><Present /></el-icon>
              <h3>待遇</h3>
            </div>
          </td>
          <td class="input">
            <input v-model="this.treatment" type="text" disabled />
          </td>
          <td class="title">
            <div>
              <el-icon><Message /></el-icon>
              <h3>邮箱</h3>
            </div>
          </td>
          <td class="input">
            <input v-model="this.email" type="text" disabled />
          </td>
        </tr>
      </table>
      <div class="smallTitle"><h4 id="secondTitle">家政经历</h4></div>
      <table class="bigtable">
        <tr>
          <td class="title">
            <div>
              <h3>个人特点</h3>
            </div>
          </td>
          <td class="input">
            <input type="text" v-model="this.characteristic" disabled />
          </td>
        </tr>
        <tr>
          <td class="title">
            <div>
              <h3>证书</h3>
            </div>
          </td>
          <td class="input">
            <input type="text" v-model="this.cert" disabled />
          </td>
        </tr>
        <tr>
          <td class="title">
            <div>
              <h3>擅长技能</h3>
            </div>
          </td>
          <td class="input">
            <input type="text" v-model="this.skill" disabled />
          </td>
        </tr>
        <tr>
          <td class="title">
            <div>
              <h3>工作范围</h3>
            </div>
          </td>
          <td class="input">
            <input type="text" v-model="this.workRange" disabled />
          </td>
        </tr>
        <tr class="expirence">
          <td class="title">
            <div>
              <h3>工作经验</h3>
            </div>
          </td>
          <td class="input">
            <textarea class="exep" disabled v-model="this.workExp"></textarea>
          </td>
        </tr>
        <tr class="introduction">
          <td class="title">
            <div>
              <h3>简介</h3>
            </div>
          </td>
          <td class="input">
            <textarea class="introduction" disabled v-model="this.introduction"></textarea>
          </td>
        </tr>
      </table>
    </div>
  </div>
</template>

<script>
import { serverDetailApi } from "@/api";
import { mapState } from "vuex";
export default {
  name: "ServeDetail",
  data() {
    return {
      serverId: null,
      avatar: "",
      nickName: "",
      serverType: "",
      age: "",
      sex: "",
      phone: "",
      area: "",
      salary: "",
      serverTime: "",
      treatment: "",
      categoryName: "",
      stay: "",
      email: "",
      characteristic: "",
      skill: "",
      cert: "",
      workRange: "",
      workExp: "",
      introduction: '',
    };
  },
  computed: {
    ...mapState("SearchStore", ["id"]),
  },
  created() {
    this.serverId = this.id;
    serverDetailApi(this.serverId).then((response) => {
      if (response.data.code === 200) {
        console.log(response.data.data)
        this.introduction = response.data.data.introduction
        this.avatar = response.data.data.avatar;
        this.nickName = response.data.data.nickName;
        this.serverType = response.data.data.serverType;
        this.age = response.data.data.age;
        this.sex = response.data.data.sex;
        this.phone = response.data.data.phone;
        this.area = response.data.data.area;
        this.salary = response.data.data.salary;
        this.serverTime = response.data.data.serverTime;
        this.categoryName = response.data.data.categoryName;
        this.stay = response.data.data.stay;
        this.email = response.data.data.email;
        this.characteristic = response.data.data.characteristic;
        this.skill = response.data.data.skill;
        this.cert = response.data.data.cert;
        this.workRange = response.data.data.workRange;
        this.workExp = response.data.data.workExp;
        this.treatment = response.data.data.treatment;
        if(this.serverType === 1){
          this.serverType = '长期工'
        }else if(this.serverType === 2){
          this.serverType = '短期工'
        }else{
          this.serverType = '出现错误'
        }
      }
    });
  },
};
</script>
<style scoped>
.right {
  width: 59rem;
  background-color: rgb(255, 255, 255);
  position: absolute;
  top: 5rem;
  left: 19rem;
  border: 1px solid gray;
  border-radius: 10px;
}
.showTitle {
  position: relative;
  width: 100%;
  height: 3rem;
  border-bottom: 1px solid rgb(165, 162, 162);
  box-sizing: border-box;
  text-align: start;
  padding-left: 2rem;
}
.showTitle h2 {
  display: inline-block;
  font-size: 1.3rem;
  text-align: left;
}
table {
  width: 95%;
  margin: 0 auto;
  margin-top: 3rem;
  font-size: small;
  font-weight: bolder;
  border-collapse: separate; /* 控制是否合并边框 */
  border-spacing: 0; /* 控制单元格之间的距离 */
  border: solid 2px rgb(215, 215, 215); /*控制外边框*/
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 3rem;
}
td {
  text-align: left;
  padding: 0.5rem;
  border-top: 1px solid rgb(213, 213, 213);
}
td:last-child,
th:last-child {
  border-right-color: transparent;
}
#primeTitle {
  position: absolute;
  top: 1.3rem;
  left: 0.5rem;
}
.exep{
  margin-top: 1.5rem;
  margin-bottom: 0.2rem;
}
.title {
  width: 6rem;
  background-color: rgb(245, 245, 245);
  padding-left: 1rem;
  margin: 0;
}
.headPortrait {
  height: 6rem;
}
td,
th {
  border-right: 2px solid rgb(213, 213, 213);
}

.el-icon {
  --color: inherit;
  height: 1em;
  width: 1em;
  line-height: 1em;
  fill: currentColor;
  color: var(--color);
  display: inline-block;
  font-size: 1.3rem;
  text-align: left;
  font-size: large;
  position: absolute;
  top: 1.1rem;
  left: -0.5rem;
}
table td h3 {
  display: inline-block;
  font-size: 1rem;
}
table td .el-icon[data-v-7641c14d] {
  --color: inherit;
  height: 1em;
  width: 1em;
  line-height: 1em;
  fill: currentColor;
  color: var(--color);
  font-size: 1.3rem;
  font-size: large;
  display: inline-block;
  position: absolute;
  top: 1.1rem;
  left: -0.2rem;
}
table td div {
  position: relative;
  text-align: justify;
  padding-left: 1rem;
}
input[type="button"] {
  background-color: #409eff;
  width: 6rem;
  height: 2rem;
  border-radius: 1rem;
  position: absolute;
  right: 2rem;
  border: none;
  top: 0.5rem;
  color: white;
  text-align: center;
  letter-spacing: 0.3rem;
  cursor: pointer;
}

/* 输入框的样式 */
input {
  display: inline-block;
  padding: 0;
  margin: 0;
  width: 90%;
  height: 2rem;
  border: none;
  /*   outline: none; */
  color: rgb(63, 62, 62);
  font-size: 1rem;
  font-weight: bold;
}
.input {
  padding: 0;
  padding-left: 0.4rem;
}
table select {
  width: 5rem;
  font-size: 1rem;
  border: none;
  color: black;
}
table select:disabled {
  width: 5rem;
  font-size: 1rem;
  border: none;
  font-weight: bold;
  color: black;
}
/* 头像样式 */
.avatarParent {
  position: relative;
}
.avatar {
  width: 5rem;
  height: 5rem;
  overflow: hidden;
}
table input[type="file"] {
  display: none;
  position: absolute;
  top: -1.5rem;
  left: 8rem;
  /*   background-color: #409eff;
  border: none;
  color: white; */
}
table img {
  width: 100%;
  height: auto;
}

/* 家政经历 */
#secondTitle {
  margin: 0;
  padding: 0;
  text-align: start;
  margin-left: 3rem;
  margin-bottom: -2rem;
}
/* 工作经历输入框 */
textarea.introduction {
  margin-top: 1rem;
  resize: none;
  width: 90%;
  height: 7rem;
  border: none;
  /*  outline: none; */
  color: rgb(63, 62, 62);
  font-size: 1.1rem;
  font-weight: bold;
}
textarea.exep{
  resize: none;
  width: 90%;
  height: 2.5rem;
  border: none;
  /*  outline: none; */
  color: rgb(63, 62, 62);
  font-size: 1.1rem;
  font-weight: bold;
}
</style>
