participated.js 7.1 KB
$(document).ready(function() {
    //首页
    $.ajax({
            type: 'GET',
            url: "http://192.168.1.241:9004/warranty/warrantyList",
            headers: {
                "Content-Type": "application/x-www-form-urlencoded",
                "token": localStorage.getItem('token'),
            },
            success: function(res) {
                console.log('1', res);
                $('#threefield1').html(res.data.threefield1)
                $('#threefield2').html(res.data.threefield2)
            }
        })
        //企业实习项目
    $.ajax({
        type: 'POST',
        url: 'http://192.168.1.241:9004/warrantyTwo/warrantyTwoList',
        headers: {
            "Content-Type": "application/json",
            "token": localStorage.getItem('token'),
        },
        data: JSON.stringify({
            current: 1,
            size: 4
        }),
        success: function(res) {
            console.log('企业', res);

            $.each(res.data.records, function(key, value) {
                console.log(value)
                let title = `<div class="col-xs-6 col-lg-33 portfolio-post contentClick" style="margin-bottom: 2%;height:35%" id=${value.id} onClick="setProfileId(${value.id})">
                        <article class="portfolio-post-item" style='height:100%'>
                            <div style="position: relative;height:100%">
                                <div style="position: relative;" style='height:100%'>
                                    <img src="${value.img}" alt="" style='height:100%'>
                                </div>
                                <div style="position: absolute;bottom: 4%;right: 2%;line-height: 1;display: flex;width: 40%;place-items:center">
                                    <div style="position: relative;margin-right: 2%;width: 25%;">
                                        <img src="${value.img1}">
                                    </div>
                                    <div style="position: relative;">
                                        <div style="font-size: 1.4em;color: #fff;padding-bottom:5%">${value.title}</div>
                                        <div style="font-size: 1.4em;color: #fff; ">${value.futitle}</div>
                                    </div>
                                </div>
                            </div>
    
                            <div class="portfolio-content-wrapper ">
                                <div class="portfolio-content ">
                                    <h3 class="portfolio-title "><a>${value.content}</a></h3>
                                    <div style="display: flex;text-align: left;place-items: center;padding-top: 6%; ">
                                        <img src="${value.img1} " style="width: 10%;height: 1%; ">
                                        <div style="display: flex;flex-direction: column;padding-left: 2%; ">
                                            <div class="portfolio-cat" style='padding-bottom:5%'>${value.title}</div>
                                            <div class="portfolio-cat">${value.futitle}</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </article>
                    </div>`
                $('#enterpriseProject').append(title)
            })

        }
    })

    //已完成项目
    $.ajax({
            type: 'GET',
            url: 'http://192.168.1.241:9004/userProgram/userProgramById',
            headers: {
                "Content-Type": "application/json",
                "token": localStorage.getItem('token'),
            },
            success: function(res) {
                console.log(res);
                console.log(res.data);
                if (res.data === null) {
                    let a = ' 0 '
                    $("#finish-num").html(a)
                } else {
                    $("#finish-num").html(res.data.length)
                }
            }
        })
        //查看已推荐的项目
    $.ajax({
            type: 'POST',
            url: 'http://192.168.1.241:9004/warrantyTwo/warrantyTwos',
            headers: {
                "Content-Type": "application/json",
                "token": localStorage.getItem('token'),
            },
            data: JSON.stringify({
                current: 1,
                size: 4
            }),
            success: function(res) {
                console.log(res.data.records.length);

                $("#recommend-num").html(res.data.records.length)
            }
        })
        //查看个人信息赋值名字
    $.ajax({
            type: 'GET',
            url: 'http://192.168.1.241:9004/login/userInfo',
            headers: {
                "Content-Type": "application/json",
                "token": localStorage.getItem('token'),
            },
            success: function(res) {
                console.log(res);
                console.log(res.data.surname + res.data.userName);
                $("#header-name").html(res.data.surname + res.data.userName)
                $("#title-name").html(res.data.surname + res.data.userName)
            }
        })
        //查看参与的项目
    $.ajax({
        type: 'GET',
        url: 'http://192.168.1.241:9004/userProgram/userPrograms',
        headers: {
            "Content-Type": "application/x-www-form-urlencoded",
            "token": localStorage.getItem('token'),
        },
        success: function(res) {
            console.log(res);
            $.each(res.data, function(key, value) {
                let title = `
                <div class="col-lg-32 col-sm-60" style="display: flex;place-content: center;background-color: #fff;">
                    <a onclick='learnCenter()' class="portfolio-box3" style="display: flex;" >
                        <img src="${value.img2}" alt="" style="width:25%;margin-right: 5%;">
                        <div style="display: flex; flex-direction: column;">
                            <h5 style="color: #323232;padding: 30px 30px 40px;">${value.futitle}</h5>
                            <p style="color: #5a5a5a;">${value.field}</p>
                        </div>
                    </a>
                </div>`
                $("#canyu-project").append(title)
            })
        }
    })


});


//获取用户VIP信息判断是否是VIP
function setPersonal() {
    $.ajax({
        type: 'GET',
        url: 'http://192.168.1.241:9004/login/userInfo',
        headers: {
            "Content-Type": "application/json",
            "token": localStorage.getItem('token'),
        },
        success: function(res) {
            console.log(res);
            if (res.data.status1 == 1) {
                window.location.href = 'personalCenter.html'
            } else {
                window.location.href = 'personalCenter2.html'
            }
        }
    })
}
//跳转实习内容首页
function learnCenter() {

}
//浏览更多跳转
function morebro() {
    window.location.href = 'browseMore.html'
}
//进入项目页
function setProfileId(id) {
    // location.href()
    console.log('1111', id);
    window.location.href = 'profile.html?id=' + id

}