portal html css js resource

discover.js 6.5KB

    //发现模块 $(function() { $(".headnav li").eq(1).addClass("navcurrent"); loginStatus();//判断个人是否登录 var userid = $.cookie("userid"); discover(10, 1,true); /*发现列表显示*/ function discover(pageSize, pageNo,isbind) { $.ajax({ "url": "/ajax/article/findHot", "type": "get", "async": true, "data": { "pageSize": pageSize, "pageNo": pageNo }, "beforeSend": function() { $("#table-item").append('<img src="../images/loading.gif" class="loading" style="position: absolute;left: 50%; top: 50%;" />'); }, "success": function(data) { console.log(data); if(data.success && data.data != null) { var itemlist = ''; $("#table-item").html(""); for(var i = 0; i < data.data.data.length; i++) { var itemlist = '<li><div class="table-item-media">'; itemlist += '<a href="" class="table-item-logo" id="userimg"></a>'; itemlist += '<div class="table-item-name clearfix">'; itemlist += '<a href="" id="userUrl"><span class="nameSpan" id="nameSpan"></span></a><em class="authiconNew " title=""></em>'; itemlist += '<p><span class="timeLabel" id="time"></span></p></div></div>'; itemlist += '<div class="table-item-cell"><a href="" id="newsurl">'; itemlist += '<div class="table-item-img" id="newsimg"></div>'; itemlist += '<div class="table-item-body">'; itemlist += '<p class="ellipsisSty" id="centent"></p>'; itemlist += '<p><em class="cmpLable" id="newstype"></em></p>'; itemlist += '</div></a></div></li>'; $itemlist = $(itemlist); $("#table-item").append($itemlist); var datalist = data.data.data[i]; var type = datalist.type; $itemlist.find("#centent").text(datalist.name); $itemlist.find("#time").text(commenTime(datalist.createTime)); if(type == 1) { //专家文章 $itemlist.find("#newstype").text("文章"); $itemlist.find("#newstype").addClass("articalLabel"); $itemlist.find("#newsimg").addClass("artical-default"); $itemlist.find("#userimg").addClass("userhead"); $itemlist.find("#newsurl").attr("href", "articalShow.html?articleId=" + datalist.id ); if(datalist.image) { $itemlist.find("#newsimg").attr("style", "background-image: url(/data/article/" + datalist.image + ");"); } userFun(datalist.owner, $itemlist); } else if(type == 2) { //企业文章 $itemlist.find("#newstype").text("文章"); $itemlist.find("#newstype").addClass("articalLabel"); $itemlist.find("#newsimg").addClass("artical-default"); $itemlist.find("#userimg").addClass("cmplogohead"); $itemlist.find("#newsurl").attr("href", "articalShow.html?oFlag=1&articleId=" + datalist.id ); if(datalist.image) { $itemlist.find("#newsimg").attr("style", "background-image: url(/data/article/" + datalist.image + ");"); } cmpFun(datalist.owner, $itemlist) } else if(type == 3) { //专家资源 $itemlist.find("#newstype").text("资源"); $itemlist.find("#newstype").addClass("resourceLabel"); $itemlist.find("#newsimg").addClass("resource-default"); $itemlist.find("#userimg").addClass("userhead"); $itemlist.find("#newsurl").attr("href", "resourceShow.html?resourceId=" + datalist.id); if(datalist.image) { $itemlist.find("#newsimg").attr("style", "background-image: url(/data/resource/" + datalist.image + ");"); } userFun(datalist.owner, $itemlist); } else if(type == 4) { //企业资源 $itemlist.find("#newstype").text("资源"); $itemlist.find("#newstype").addClass("resourceLabel"); $itemlist.find("#newsimg").addClass("resource-default"); $itemlist.find("#userimg").addClass("cmplogohead"); $itemlist.find("#newsurl").attr("href", "resourceShow.html?resourceId=" + datalist.id); if(datalist.image) { $itemlist.find("#newsimg").attr("style", "background-image: url(/data/resource/" + datalist.image + ");"); } cmpFun(datalist.owner, $itemlist) } } //分页 if(isbind==true){ $(".tcdPageCode").createPage({ pageCount: Math.ceil(data.data.total / 10), current: data.data.pageNo, backFn: function(p) { $("#table-item").html(""); discover(10, p,false); document.body.scrollTop = document.documentElement.scrollTop = 0; } }); } $(".loading").remove(); } }, "error": function() { $.MsgBox.Alert('提示', '链接服务器超时') } }); } /*用户信息*/ function userFun(id, $itemlist) { $.ajax({ "url": "/ajax/professor/baseInfo/" + id, "type": "get", "async": true, "success": function(data) { console.log(data); if(data.success && data.data) { $itemlist.find("#nameSpan").text(data.data.name); if(data.data.hasHeadImage == 1) { $itemlist.find("#userimg").attr("style", "background-image: url(/images/head/" + data.data.id + "_m.jpg);"); } $itemlist.find("#userimg").attr("href", "information-brow.html?professorId=" + data.data.id); $itemlist.find("#userUrl").attr("href", "information-brow.html?professorId=" + data.data.id); var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus); $itemlist.find(".authiconNew").attr("title", userType.title); $itemlist.find(".authiconNew").addClass(userType.sty); } }, "error": function() { $.MsgBox.Alert('提示', '链接服务器超时') } }); } /*企业用户信息*/ function cmpFun(id, $itemlist) { $.ajax({ "url": "/ajax/org/" + id, "type": "get", "async": true, "success": function(data) { console.log(data); if(data.success && data.data) { $itemlist.find("#nameSpan").text(data.data.name); if(data.data.hasOrgLogo) { $itemlist.find("#userimg").attr("style", "background-image: url(/images/org/" + data.data.id + ".jpg);"); } $itemlist.find("#userimg").attr("href", "companybrowinfor.html?orgid=" + data.data.id); $itemlist.find("#userUrl").attr("href", "companybrowinfor.html?orgid=" + data.data.id); if(data.data.authStatus==3){ $itemlist.find(".authiconNew").addClass("authicon-com-ok").attr("title", "认证企业");; }/*else{ $itemlist.find(".authiconNew").addClass("authicon-com-no").attr("title", "未认证企业");; }*/ } }, "error": function() { $.MsgBox.Alert('提示', '链接服务器超时') } }); } })