<template>
  <div class="position-box">
    <h4 class="mb-3">{{ $t('position.similarPosition') }}</h4>
    <div v-for="(item, index) in props.list" :key="index" class="mb-2 cursor-pointer" @click="handlePosition(item)">
      <p class="recruit-name" :style="{'max-width': !item.payFrom && !item.payTo ? '230px' : '140px'}">{{ item.name }}</p>
      <span v-if="!item.payFrom && !item.payTo" class="recruit-salary">面议</span>
      <span v-else class="recruit-salary">{{ item.payFrom ? item.payFrom + '-' : '' }}{{ item.payTo }}{{ item.payName ? '/' + item.payName :'' }}</span>
      <div :class="['enterprise', {'border-bottom-dashed': index !== list.length - 1}]">
        <v-img class="float-left" :src="item.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'" :width="30" :height="30"></v-img>
        <span class="float-left enterprise-name">{{ item.anotherName }}</span>
        <span class="float-right enterprise-address">{{ !item.areaId ? '全国' : item.areaName }}</span>
      </div>
    </div>
  </div>
</template>

<script setup name="similarPositions">
const props = defineProps({
  list: {
    type: Array,
    default: () => []
  },
  info: {
    type: Object,
    default: () => {}
  }
})
const handlePosition = (item) => {
  window.open(`/recruit/personal/position/details/${item.id}`)
}
</script>

<style lang="scss" scoped>
.position-box {
  background-color: var(--color-f3);
  border-radius: 8px;
  padding: 20px 15px;
}
.recruit-name {
  font-weight: 500;
  display: inline-block;
  vertical-align: middle;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  &:hover {
    color: var(--v-primary-base);
  }
}
.recruit-salary {
  float: right;
  color: var(--v-error-base);
  font-weight: 500;
  height: auto;
  vertical-align: sub;
}
.enterprise {
  height: 40px;
  line-height: 30px;
  margin-top: 8px;
}
.enterprise-name {
  width: 150px;
  display: inline-block;
  max-width: 150px;
  vertical-align: middle;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  color: var(--color-666);
  font-size: 13px;
  margin-left: 5px;
  &:hover {
    color: var(--v-primary-base);
  }
}
.enterprise-address {
  color: #555;
  font-size: 13px;
}
.more-btn {
  // position: absolute;
  // bottom: 18px;
  // margin-top: 20px;
}
</style>