<template>
    <div style="background: #f2f3f7; overflow: hidden">
        <div class="userDetail container">
            <div class="topNA">
                <div class="topNAT">
                    <span class="topNAT1">{{ userInfo.name }}</span>
                    <span class="topNAT2">{{ userInfo.testSkills || '未填写' }}</span>
                </div>
                <div class="topNAB">
                    <div class="topNABit">
                        <img src="/assets/ability/det1.png" alt="" />
                        {{ city }}
                    </div>
                    <div class="topNABit">
                        <img src="/assets/ability/det2.png" alt="" />
                        {{ educationList[0].name }}
                    </div>
                    <div class="topNABit">
                        <img src="/assets/ability/det3.png" alt="" />
                        {{ educationList[0].major }}
                    </div>
                    <div class="topNABit">
                        <img src="/assets/ability/det4.png" alt="" />
                        {{ educationList[0].education }}({{
                            educationList[0].startTime + '-' + educationList[0].endTime
                        }})
                    </div>
                </div>
            </div>
            <div class="content">
                <div class="contentitem">
                    <div class="contentitemT">
                        <div class="contentTline"></div>
                        个人优势
                    </div>
                    <div class="contentitemB">
                        {{ userInfo.personalAdvantage || '未填写' }}
                    </div>
                </div>
                <div class="contentitem">
                    <div class="contentitemT">
                        <div class="contentTline"></div>
                        工作经历
                    </div>
                    <template v-if="workList.length">
                        <div v-for="it in workList" :key="it.caseId" style="margin-bottom: 30px">
                            <div class="contentitemM">
                                <div class="contentitemML">公司名称：{{ it.name }}</div>
                                <div class="contentitemML">职位：{{ it.title }}</div>
                                <div class="contentitemMR">{{ it.startTime }}-{{ it.endTime }}</div>
                            </div>
                            <div class="contentitemB"><span class="contentitemBF">工作内容：</span>{{ it.intro }}</div>
                        </div>
                    </template>
                    <div class="contentitemTBook" v-else>未填写</div>
                </div>
                <div class="contentitem">
                    <div class="contentitemT">
                        <div class="contentTline"></div>
                        项目经历
                    </div>
                    <template v-if="projectList.length">
                        <div v-for="it in projectList" :key="it.caseId" style="margin-bottom: 30px">
                            <div class="contentitemM">
                                <div class="contentitemML">公司名称：{{ it.name }}</div>
                                <div class="contentitemML">担任角色：{{ it.title }}</div>
                                <div class="contentitemMR">{{ it.startTime }}-{{ it.endTime }}</div>
                            </div>
                            <div class="contentitemB" style="margin-bottom: 20px">
                                <span class="contentitemBF">应用技术：</span>{{ it.applyTech }}
                            </div>
                            <div class="contentitemB"><span class="contentitemBF">工作内容：</span>{{ it.intro }}</div>
                        </div>
                    </template>
                    <div class="contentitemTBook" v-else>未填写</div>
                </div>
                <div class="contentitem">
                    <div class="contentitemT">
                        <div class="contentTline"></div>
                        资格证书
                    </div>
                    <div class="contentitemTBook" v-if="certificateList.length">
                        <div class="contentitemTBookit" v-for="it in certificateList" :key="it.fileId">
                            <div class="contentitemTBookitT">{{ it.fileName }}</div>
                            <img class="contentitemTBookitTimg" :src="it.fileUrl" alt="" />
                        </div>
                    </div>
                    <div class="contentitemTBook" v-else>未填写</div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import { mapGetters } from 'vuex'
import { getCloudAll } from '@/api/tester/TesterApply'
export default {
    data() {
        return {
            userInfo: {},
            base: process.env.VUE_APP_BASE_API,
            projectList: [],
            workList: [],
            educationList: [],
            certificateList: [],
            city: '',
        }
    },
    mounted() {},
    created() {
        this.getCloudAllList()
    },

    computed: {
        ...mapGetters(['userinform', 'token']),
    },
    methods: {
        getCloudAllList() {
            getCloudAll(this.$route.query.id).then((res) => {
                // 经历
                this.projectList = res.experience.filter((it) => it.type == 0)

                this.workList = res.experience.filter((it) => it.type == 1)

                this.educationList = res.experience.filter((it) => it.type == 2)
                if (!this.educationList.length) {
                    this.educationList = [
                        {
                            name: '未填写',
                            major: '未填写',
                            education: '未填写',
                            startTime: '未填写',
                            endTime: '未填写',
                        },
                    ]
                }
                // 证书
                this.certificateList = res.credentials
                // 个人简介
                if (res.personalInfo) {
                    this.userInfo = res.personalInfo
                    this.city = this.userInfo.city.split('-')[1] || '无'
                }
            })
        },
    },
}
</script>

<style scoped>
.container {
    width: 1200px;
    margin: auto;
}
.topNA {
    height: 130px;
    background: linear-gradient(270deg, #fdeeeb, #eaf1fc);
    border-radius: 8px 8px 0 0;
    margin-top: 18px;
    padding: 0 40px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.topNAT1 {
    font-weight: bold;
    font-size: 28px;
    color: #1a1a1a;
    margin-right: 50px;
}
.topNAT2 {
    font-weight: bold;
    font-size: 22px;
    color: #de8423;
}
.topNAB {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 20px;
}
.topNABit {
    display: flex;
    align-items: center;
    margin-right: 30px;
    font-weight: 500;
    font-size: 15px;
    color: #4d4d4d;
}
.topNABit img {
    margin-right: 5px;
}
.content {
    border-radius: 0 0 8px 8px;
    padding: 0 40px;
    box-sizing: border-box;
    margin-bottom: 30px;
    background: #ffffff;
    overflow: hidden;
}
.contentitem {
    border-bottom: 1px solid #f2f2f2;
    padding-bottom: 25px;
    box-sizing: border-box;
}
.contentitemT {
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 20px;
    color: #1a1a1a;
    margin: 25px 0;
}
.contentTline {
    width: 4px;
    height: 17px;
    background: #0066eb;
    border-radius: 2px;
    margin-right: 6px;
}
.contentitemB {
    font-weight: 500;
    font-size: 16px;
    color: #666666;
}
.contentitemM {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}
.contentitemML {
    font-weight: bold;
    font-size: 18px;
    color: #333333;
}
.contentitemMR {
    font-weight: 500;
    font-size: 16px;
    color: #999999;
}
.contentitemBF {
    font-weight: bold;
    font-size: 16px;
    color: #333333;
}
.contentitemTBook {
    display: flex;
    flex-wrap: wrap;
}
.contentitemTBookit {
    margin-right: 30px;
    margin-bottom: 20px;
}
.contentitemTBookitT {
    font-weight: 500;
    font-size: 16px;
    color: #4d4d4d;
    margin-bottom: 10px;
}
.contentitemTBookitTimg {
    width: 313px;
    height: 220px;
}
</style>