<template>
    <div>
        <view bind:tap="jumpResumeDetail" @click="jumpResumeDetail">
            <view class="info felx-between">
                <view class="text-wrap">
                    <view class="name"> {{ data.realName }} <text>· 今日活跃</text> </view>
                    <view class="other"> {{ data.workExperience }}年 ｜ {{ educationLevelText }} ｜ {{ data.salary }} </view>
                </view>
                <image v-if="data.avatarPath" :src="evn.APP_IMAGE_BASE_API + data.avatarPath" mode="" />
                <image v-else src="@/static/image/user/default-avatar.png" mode="" />
            </view>
            <view class="education" v-if="educationExperience">
                {{ educationExperience ? educationExperience.schoolName : null }}·{{
                    educationExperience ? educationExperience.major : null
                }}
            </view>
            <view class="introduce">
                {{ data.personalAdvantage }}
            </view>
        </view>
    </div>
</template>

<script setup>
import { defineProps, computed } from "vue";
import evn from "@/utils/config";
import { getEnumText } from "@/utils/utils";
import { useAsync } from "@/hooks/useAsync";
let { data, jobId, type } = defineProps({
    data: {
        type: Object,
        default: () => ({})
    },
    jobId: {
        type: String,
        default: () => ""
    },
    type: {
        type: String,
        default: () => "recommend"
    }
});
const { data: educationLevelText } = useAsync(getEnumText("EnumEducation", data.educationLevel));
console.log("data", data);

const educationExperience = computed(() => {
    if (data.educationLevel) {
        return JSON.parse(data?.educationExperience)[0] || {};
    } else {
        return null;
    }
});

const jumpResumeDetail = () => {
    console.log("data", data);

    if (type == "recommend") {
        jobId = data.jobId;
    }

    uni.navigateTo({
        url: `/pages/user/resume/index?jobId=${jobId}&userId=${data.userId}&applicationId=${data.applicationId}&type=${type}`
    });
};
</script>

<style lang="scss" scoped>
.felx-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.info {
    .name {
        font-size: 32rpx;
        font-weight: 600;
        line-height: 48rpx;
        color: #1b2026;
        text {
            font-size: 24rpx;
            font-weight: normal;
            line-height: 36rpx;
            color: #77818f;
        }
    }
    .other {
        font-size: 24rpx;
        font-weight: normal;
        line-height: 36rpx;
        color: #77818f;
    }
    image {
        width: 84rpx;
        height: 84rpx;
        border-radius: 50%;
    }
}
.education {
    display: inline-block;
    padding: 20rpx 12rpx;
    margin: 16rpx 0;
    font-size: 24rpx;
    font-weight: normal;
    line-height: 36rpx;
    color: #1b2026;
    background: rgb(99 107 117 / 10%);
    border-radius: 8rpx;
}
.introduce {
    display: -webkit-box; // 将对象作为弹性伸缩盒子模型显示。
    overflow: hidden; // 超出的文本隐藏
    font-size: 24rpx;
    font-weight: normal;
    line-height: 36rpx;
    color: #77818f;
    text-overflow: ellipsis; // 溢出用省略号显示
    line-clamp: 2; // 这个属性不是css的规范属性，需要组合上面两个属性，表示显示的行数。
    /* stylelint-disable-next-line order/properties-order */
    -webkit-line-clamp: 2; // 这个属性不是css的规范属性，需要组合上面两个属性，表示显示的行数。
    -webkit-box-orient: vertical; // 从上到下垂直排列子元素（设置伸缩盒子的子元素排列方式）
}
</style>
