browseMore.js 5.0 KB
$(document).ready(function() {
    //判断右上角
    var token = localStorage.getItem('token')
    if (token == null) {
        let loginTit1 = `
            <a href='login.html'>
                <div class="header-loginBtn" id="loginTitle">&nbsp;&nbsp;</div>
            </a>`
        $("#login-btn").html(loginTit1)
    } else {
        let loginTit2 = `
                <a href='login.html'>
                    <div class="header-loginBtn" id="loginTitle">退出登录</div>
                </a>`
        $("#login-btn").html(loginTit2)
    }
    //首页底部二维码
    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)
    })

    //浏览更多首页头部内容
    var url = "/warrantyFour/warrantyFourList";
    var header = {
        "Content-Type": "application/x-www-form-urlencoded",
        // "token": localStorage.getItem('token'),
    }
    ajax(url, "GET", header, function(res) {
        console.log(res);
    }, function(res) {
        console.log(res);
        $('#title-one').html(res.data.title)
        $('#subtitle').html(res.data.subtitle)
    })
    var pages = ''
    var page = 1
    var size = 4
       // xlPaging.js 使用方法
    $("#page").paging({
        nowPage: page, // 当前页码
        pageNum: pages, // 总页码
        buttonNum: size, //要展示的页码数量
        callback: function (num) { //回调函数
            console.log(num);
            page = num
            aaaa()
        }
    });
    //浏览更多企业实习项目
    aaaa()
    function aaaa(){

    var header1 = {
        "Content-Type": "application/json",
        // "token": localStorage.getItem('token'),
    }
    var params = JSON.stringify({
        current: page,//开始页
        size: size,//展示条数
    })
    var title
    ajax("/warrantyTwo/warrantyTwoList", "POST", header1, params, function(res) {
        console.log(res);
        pages = res.data.pages
        $('#enterpriseProject').html("")
        $.each(res.data.records, function(key, value) {
            console.log(value)
             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);
    })
}
})

//获取用户VIP信息判断是否是VIP
function setPersonal() {
    var url2 = "/login/userInfo"; // 接口    
    var header2 = {
        "Content-Type": "application/json",
        "token": localStorage.getItem('token'),
    }
    ajax(url2, "GET", header2, function(res) {

    }, function(res) {
        if (res.data.status1 == 2) {
            window.location.href = 'personalCenter2.html'
        } else {
            window.location.href = 'personalCenter.html'
        }
    }, function(res) {
        if (res) {
            alert("请您先登录!")
        }
    })
}
//浏览更多跳转
function morebro() {
    window.location.href = 'browseMore.html'
}
//进入项目页
function setProfileId(id) {
    // location.href()
    console.log('1111', id);
    window.location.href = 'profile.html?id=' + id

}