<template>
    <div class="rencaifuwu">
        <div class="topbane">
            <img style="width: 100%; height: 100%; object-fit: cover" src="/assets/ability/userBanner.png" alt="" />
            <div class="container ruzhu">
                <div class="ruzhuBox">
                    <div class="ruzhuBoxtext">关键云员工，助力<span>软件测试人才</span></div>
                    <div class="ruzhuBoxbtn" @click="goRuzhu">立即入驻</div>
                </div>
            </div>
        </div>
        <div class="content container">
            <div class="titlePeo" style="margin-top: 60px; margin-bottom: 50px">
                <div class="titletopt">
                    <img src="/assets/homepage/rihhj.png" alt="" />
                    <p>优选企业岗位</p>
                    <img src="/assets/homepage/lesftt.png" alt="" />
                </div>
            </div>
            <div class="itemBox">
                <div class="itemb" v-for="it in jobList" :key="it.jobId" @click="dodetail(it)">
                    <div class="itembT">
                        <div class="itembTT">
                            <div class="itembTTL">{{ it.title }}</div>
                            <div class="itembTTR">{{ it.emolument }}</div>
                        </div>
                        <div class="itembTB">
                            <div class="itembTBit">{{ it.city }}</div>
                            <div class="itembTBit">{{ it.experience }}</div>
                            <div class="itembTBit">{{ it.education }}</div>
                        </div>
                    </div>
                    <div class="itembB">
                        <div class="itembBL">{{ it.company }}</div>
                        <div class="itembBR">计算机软件</div>
                    </div>
                </div>
            </div>
        </div>

        <div class="pavan container">
            <el-pagination
                background
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="queryParams.pageNum"
                :page-sizes="[10, 20, 30, 50]"
                :page-size="queryParams.pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total"
            >
            </el-pagination>
        </div>
    </div>
</template>
<script>
import { mapGetters } from 'vuex'
import { getJobList } from '@/api/ability'
export default {
    data() {
        return {
            total: 0,
            jobList: [],
            queryParams: {
                pageNum: 1,
                pageSize: 10,
            },
        }
    },
    mounted() {},
    beforeDestroy() {},
    computed: {
        ...mapGetters(['token']),
    },
    created() {
        this.getList()
    },
    methods: {
        getList() {
            getJobList(this.queryParams).then((res) => {
                this.total = res.total
                this.jobList = res.rows
            })
        },
        handleSizeChange(val) {
            this.queryParams.pageSize = val
            this.getList()
        },
        handleCurrentChange(val) {
            this.queryParams.pageNum = val
            this.getList()
        },
        dodetail(it) {
            this.$router.push({
                path: '/ability/detail',
                query: {
                    id: it.job_id,
                },
            })
        },
        // 申请入驻
        goRuzhu() {
            if (!this.token) {
                this.$confirm('您未登录,请您先去登录', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                }).then(() => {
                    this.$router.push('/login?type=log')
                })
            } else {
                this.$router.push('/ability/apply')
            }
        },
    },
}
</script>

<style scoped>
.container {
    width: 1200px;
    margin: auto;
}
.topbane {
    width: 100%;
    height: 450px;
    position: relative;
}
.ruzhu {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: flex-end;
}
.ruzhuBox {
    width: 532px;
    height: 241px;
    background: url('/assets/ability/applybanner2.png') no-repeat 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.ruzhuBoxtext {
    font-weight: 500;
    font-size: 30px;
    color: #000000;
    margin-bottom: 30px;
}
.ruzhuBoxtext span {
    color: #d4393c;
}
.ruzhuBoxbtn {
    width: 150px;
    height: 40px;
    background: linear-gradient(90deg, #6b3af8, #2080fe);
    border-radius: 4px;
    font-weight: 500;
    font-size: 18px;
    color: #f4f5f7;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
}

.titlePeo p {
    font-weight: bold !important;
    font-size: 32px !important;
    color: #1a1a1a;
    margin: 0 15px;
}
.titletopt {
    display: flex;
    justify-content: center;
    align-items: center;
}

.pavan {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 60px;
    margin-top: 35px;
}
.itemBox {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}
.itemb {
    width: 585px;
    height: 185px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0px 4px 27px 3px rgba(16, 60, 117, 0.1);
    border-radius: 6px;
    margin-bottom: 30px;
    cursor: pointer;
    transition: all 0.2s linear;
}
.itemb:hover {
    transform: scale(1.02);
}
.itembB {
    width: 585px;
    height: 60px;
    background: linear-gradient(270deg, rgba(253, 238, 1235, 0.65), rgba(234, 241, 252, 0.65));
    border-radius: 6px;
    font-weight: 500;
    font-size: 15px;
    color: #666666;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    box-sizing: border-box;
}
.itembT {
    width: 100%;
    height: calc(100% - 60px);
    padding: 30px 28px 0 28px;
    box-sizing: border-box;
}
.itembTT {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}
.itembTTL {
    font-weight: bold;
    font-size: 18px;
    color: #000000;
}
.itembTTR {
    font-weight: bold;
    font-size: 18px;
    color: #fb3838;
}
.itembTB {
    display: flex;
    align-items: center;
}
.itembTBit {
    height: 30px;
    line-height: 30px;
    background: rgba(230, 231, 235, 0.3);
    border-radius: 3px;
    padding: 0 15px;
    box-sizing: border-box;
    margin-right: 20px;
    font-weight: 500;
    font-size: 15px;
    color: #666666;
}
</style>