completed.js 2.8 KB
$(document).ready(function() {
        //查看已完成的项目
        var url = "/userProgram/userProgramById"; // 接口    
        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 === null) {
                    let a = ' 0 '
                    $("#finish-num").html(a)
                } else {
                    $("#finish-num").html(res.data.length)
                }
                $.each(res.data, function(key, value) {
                    let title = `
                    <div class="col-lg-32 col-sm-60 par-pro-one">
                        <a class="portfolio-box3" style="display: flex;">
                            <div class="par-pro-img1">
                                <img src="${value.img2}" alt="" style="width:100%">
                            </div>
                            <div class="par-proing-title-one">
                                <h5>${value.field}</h5>
                                <p>${value.futitle}</p>
                            </div>
                        </a>
                    </div>`
                    $('#completeProject').append(title)
                })
            })
            //查看个人信息赋值名字
        var url1 = '/login/userInfo'
        ajax(url1, "GET", header, function(res) {
                console.log(res);
            }, 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)
            })
            //首页
        var url3 = "/warranty/warrantyList";
        var header3 = {
            "Content-Type": "application/x-www-form-urlencoded"
        }
        ajax(url3, "GET", header3, function(res) {
            console.log('1', res);
        }, function(res) {
            console.log(res);
            let EWM = `<img src="${res.data.sevenimg4}" width="100%">`
            $('#ewm-footer').html(EWM)
        })
    })
    //获取用户VIP信息判断是否是VIP
function setPersonal() {
    var url2 = '/login/userInfo'
    var header = {
        "Content-Type": "application/json",
        "token": localStorage.getItem('token'),
    }
    ajax(url2, "GET", header, function(res) {
        console.log(res);
    }, function(res) {
        console.log(res);
        if (res.data.status1 == 1) {
            window.location.href = 'personalCenter.html'
        } else {
            window.location.href = 'personalCenter2.html'
        }
    })
}