completed.js 2.6 KB
$(document).ready(function() {
        //查看已完成的项目
        $.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);
                    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" style="display: flex;place-content: center;background-color: #fff;">
                    <a href="#" 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;">${value.field}</h5>
                            <p style="padding-top: 10%;color: #5a5a5a;">${value.futitle}</p>
                        </div>
                    </a>
                </div>`
                        $('#completeProject').append(title)
                    })


                }
            })
            //查看个人信息赋值名字
        $.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)
            }
        })
    })
    //获取用户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'
            }
        }
    })
}