<template>
  <div class="wrapper">
    <div class="card">
      <div class="post-info">
        <div class="post-name">
          <span>{{ detail.title }}</span>
          <span>{{ detail.salary }}</span>
        </div>
        <p>{{ detail.education }} | {{ detail.gender }} | {{ detail.age }}岁</p>
      </div>
      <div class="form">
        <div class="label">招聘企业</div>
        <div class="value">{{ detail.companyName }}</div>
      </div>
      <div class="form">
        <div class="label">招聘联系人</div>
        <div class="value">{{ detail.linkName }}</div>
      </div>
      <div class="form">
        <div class="label">联系方式</div>
        <div class="value phone" @click="phone">
          <u-icon name="phone-fill" color="#4181FF" size="32" :custom-stype="{marginRight:'8px'}"></u-icon>
          {{ detail.linkPhone }}
        </div>
      </div>
      <template v-if="detail.remark">
        <header>岗位要求</header>
        <div class="post-require">{{ detail.remark }}
        </div>
      </template>
    </div>
  </div>
</template>

<script>
export default {
  name: "compJob",
  data() {
    return {
      id: null,
      detail: {},
    }
  },
  onLoad({id}) {
    this.id = id;
    this.getDetail();
  },
  methods: {
    phone() {
      uni.makePhoneCall({phoneNumber: this.detail.linkPhone});
    },
    getDetail() {
      this.$instance.post("/app/appjob/detail", null, {
        params: {id: this.id}
      }).then(res => {
        if (res?.data) {
          this.detail = res.data;
        }
      })
    }
  },

  onShareAppMessage() {
    return {
      title: "企业招工",
      path: "/mods/AppJob/compJob?id=" + this.id
    }
  }
}
</script>

<style lang="scss" scoped>
.card {
  padding: 32px 0 32px 32px;
  background-color: #ffffff;

  .post-info {
    padding-right: 32px;

    .post-name {
      display: flex;
      justify-content: space-between;
      line-height: 56px;

      & > span:first-child {
        font-size: 40px;
        font-weight: 600;
        color: #333333;
      }

      & > span:last-child {
        font-size: 36px;
        font-weight: 600;
        color: #FF3521;
        flex-shrink: 0;
      }
    }

    & > p {
      font-size: 32px;
      font-weight: 400;
      color: #999999;
      margin: 16px 0 32px;
    }
  }

  .form {
    height: 112px;
    background: #FFFFFF;
    border-bottom: 1px solid #DDDDDD;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #DDDDDD;
    padding-right: 32px;

    .label {
      font-size: 32px;
      font-weight: 400;
      color: #999999;
    }

    .value {
      font-size: 32px;
      font-weight: 400;
      color: #333333;
    }

    .phone {
      font-size: 28px;
      color: #4181FF;
    }
  }

  header {
    font-size: 38px;
    font-weight: 600;
    color: #333333;
    padding: 32px 0;
  }

  .post-require {
    font-size: 32px;
    font-weight: 400;
    color: #333333;
    line-height: 56px;
    padding-right: 20px;
  }
}
</style>
