participated.js 6.1 KB
$(document).ready(function() {

    //首页
    var header = {
        "Content-Type": "application/x-www-form-urlencoded",
        "token": localStorage.getItem('token'),
    }
    ajax("/warranty/warrantyList", "GET", header, function(res) {
        console.log(res);
    }, function(res) {
        // console.log(res);
        // $('#threefield1').html(res.data.threefield1)
        // $('#threefield2').html(res.data.threefield2)
        let EWM = `<img src="${res.data.sevenimg4}" style='width:100%;height:100%'>`
        $('#ewm-footer').html(EWM)
    })

    //企业实习项目
    var header1 = {
        "Content-Type": "application/json",
        "token": localStorage.getItem('token'),
    }
    var params = JSON.stringify({
        current: 1,
        size: 4
    })
    ajax("/warrantyTwo/warrantyTwoList", "POST", header1, params, 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" 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%'class='noticeimg-head'>
                            </div>
                            <div class='par-headImg-all' >
                                <div class='par-headImg1'>
                                    <img src="${value.img1}" >
                                </div>
                                <div class='par-headTitle'>
                                    <div class='par-headTitle1'>${value.title}</div>
                                    <div class='par-headTitle2'>${value.yyTitle}</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.yyTitle}</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </article>
                </div> `
                $('#enterpriseProject').append(title)
            })
        }, function(res) {
            console.log(res);
        })
        //已完成项目
    var url2 = "/userProgram/userProgramById";

    ajax(url2, "GET", header1, function(res) {
            console.log(res);
        }, function(res) {
            // console.log(res);
            if (res.data === null) {
                let a = ' 0 '
                $("#finish-num").html(a)
            } else {
                $("#finish-num").html(res.data.length)
            }
        })
        //查看已推荐的项目
    var url3 = "/warrantyTwo/warrantyTwos";
    // 调用公共ajax
    ajax(url3, "POST", header1, params, function(res) {
            console.log(res);
            $("#recommend-num").html(res.data.records.length)
        }, function(res) {
            console.log(res);
        })
        //查看个人信息赋值名字
    var url4 = "/login/userInfo"; // 接口    
    // 调用公共ajax
    ajax(url4, "GET", header1, function(res) {
        console.log(res);
    }, function(res) {
        // console.log(res);
        localStorage.setItem("name", res.data.surname + res.data.userName);
        $("#header-name").html(res.data.surname + res.data.userName)
        $("#title-name").html(res.data.surname + res.data.userName)
    })

    //查看进行中的项目
    var url5 = "/userProgram/userPrograms";
    ajax(url5, "GET", header, function(res) {
        console.log(res);
    }, function(res) {
        console.log(res);
        $.each(res.data, function(key, value) {
            let title = `
            <div class="col-lg-32 col-sm-60 par-pro-one" onClick='learnCenter(${value.id})'>
                <a class="portfolio-box3" style="display: flex;width:100%">
                    <div class="par-pro-img1">
                        <img src="${value.img2}" alt="" style="width:100%">
                    </div>
                    <div class="par-proing-title-one">
                        <div>${value.field}</div>
                        <p>${value.futitle}</p>
                    </div>
                </a>
            </div>`
            $("#canyu-project").append(title)
        })
    })
});


//获取用户VIP信息判断是否是VIP
function setPersonal() {
    var url = "/login/userInfo";
    var header = {
        "Content-Type": "application/json",
        "token": localStorage.getItem('token'),
    }
    ajax(url, "GET", header, function(res) {
        console.log(res);
    }, function(res) {
        console.log(res);
        if (res.data.status1 == 2) {
            window.location.href = 'personalCenter2.html'
        } else {
            window.location.href = 'personalCenter.html'
        }
    }, function(res) {
        if (res) {
            alert("请您先登录!")
        }
    })
}
//跳转实习内容首页
function learnCenter(id) {
    window.location.href = 'learningContent.html?id=' + id
}
//浏览更多跳转
function morebro() {
    window.location.href = 'browseMore.html'
}
//进入项目页
function setProfileId(id) {
    // location.href()
    console.log('1111', id);
    window.location.href = 'profile.html?id=' + id

}