answers.js 3.3 KB
var url1 = "/recommend/recommendTwoList"; // 接口 
var header = {
    "Content-Type": "application/x-www-form-urlencoded",
    "token": localStorage.getItem('token'),
}
var params = {
    id: newId
}
$(document).ready(function() {
    var url = window.location.search;
    console.log(url);
    if (url.indexOf('?') != -1) {
        newId = url.substr(4)
        console.log(newId);
        //获取左边实习内容list
        ajax(url1, "GET", header, params, function(res) {}, function(res) {
                console.log(res);
                for (let i in res.data) {
                    console.log(res.data);

                    let title = `<div>
                                <div id="title-head">${res.data[i].headline}</div>
                            </div>
                            <div id="content-l">
                            </div>`
                    $("#title-content").append(title)
                }
                for (let i in res.data) {
                    $.each(res.data[i].recommendThrees, function(index, val) {
                        console.log(val.subhead);
                        let title1 = `<p id="content-list" style='display:flex'><input type="radio" class="input-radio" name='input-radio'>${val.subhead}</input></p>`
                        $("#content-l").append(title1)
                    })
                }
            })
            // $.ajax({
            //     type: 'GET',
            //     url: 'http://192.168.1.241:9004/recommend/recommendTwoList',
            //     headers: {
            //         "Content-Type": "application/x-www-form-urlencoded",
            //         "token": localStorage.getItem('token'),
            //     },
            //     data: {
            //         id: newId
            //     },
            //     success: function(res) {
            //         console.log(res);
            //         for (let i in res.data) {
            //             console.log(res.data);

        //             let title = `<div>
        //                             <div id="title-head">${res.data[i].headline}</div>
        //                         </div>
        //                         <div id="content-l">
        //                         </div>`
        //             $("#title-content").append(title)
        //         }
        //         for (let i in res.data) {
        //             $.each(res.data[i].recommendThrees, function(index, val) {
        //                 console.log(val.subhead);
        //                 let title1 = `<p id="content-list" style='display:flex'><input type="radio" class="input-radio" name='input-radio'>${val.subhead}</input></p>`
        //                 $("#content-l").append(title1)
        //             })
        //         }

        //     }
        // })
    }

})






//获取用户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'
            }
        }
    })
}