|
window.onload=function(){
var loadFlag ={
ex: true,
co: true,
rs: true,
pt: true,
pp: true,
ar: true
};
var tabitem=1;//默认在第一个
var keyt,subject,industry,address
authType = 1,
pageSize = 20,
pageNo = {
ex: 1,
co: 1,
rs: 1,
pt: 1,
pp: 1,
ar: 1
}
var keyt = document.getElementById("searchval").value;
var tabFlag=GetQueryString("flag");
var searchContent=GetQueryString("key");
if(searchContent!=""){
keyt=searchContent;
document.getElementById("searchval").value=searchContent;
}
//============open swiper================
var mySwiperTab = new Swiper('.swiper-container-tab',{
freeMode : true,
slidesPerView : 'auto',
freeModeSticky : true ,
})
var mySwiper = new Swiper('.swiper-container-main',{
direction: 'vertical',
scrollbar: '.swiper-scrollbar',
autoplay : 500,
mode : 'vertical',
slidesPerView: 'auto',
mousewheelControl: true,
freeMode: true,
onTouchMove: function(swiper){ //手动滑动中触发
var _viewHeight = document.getElementsByClassName('swiper-wrapper-main')[0].offsetHeight;
var _contentHeight = document.getElementsByClassName('swiper-slide')[0].offsetHeight;
// if(mySwiper.translate < 50 && mySwiper.translate > 0) {
// $(".init-loading").html('下拉刷新...').show();
// }else if(mySwiper.translate > 50 ){
// $(".init-loading").html('释放刷新...').show();
// }
},
onTouchEnd: function(swiper) {
var _viewHeight = document.getElementsByClassName('swiper-wrapper-main')[0].offsetHeight;
var _contentHeight = document.getElementsByClassName('swiper-slide')[0].offsetHeight;
// 上拉加载
if(mySwiper.translate <= _viewHeight - _contentHeight - 50 && mySwiper.translate < 0) {
setTimeout(function() {
if(tabitem==1){
if(loadFlag.ex){
++pageNo.ex;
extFilter()
expertListVal(keyt,subject,industry,address,authType,pageSize,pageNo.ex)
$(".loadtip").html('上拉加载更多...');
mySwiper.update(); // 重新计算高度;
}
}else if(tabitem==2){
if(loadFlag.rs){
++pageNo.rs;
resourceListVal(keyt,pageSize,pageNo.rs)
$(".loadtip").html('上拉加载更多...');
mySwiper.update(); // 重新计算高度;
}
}else if(tabitem==3){
if(loadFlag.ar){
++pageNo.ar;
articalListVal(keyt,pageSize,pageNo.ar)
$(".loadtip").html('上拉加载更多...');
mySwiper.update(); // 重新计算高度;
}
}else if(tabitem==4){
if(loadFlag.pt){
++pageNo.pt;
patentListVal(keyt,pageSize,pageNo.pt)
$(".loadtip").html('上拉加载更多...');
mySwiper.update(); // 重新计算高度;
}
}else if(tabitem==5){
if(loadFlag.pp){
++pageNo.pp;
paperListVal(keyt,pageSize,pageNo.pp)
$(".loadtip").html('上拉加载更多...');
mySwiper.update(); // 重新计算高度;
}
}else if(tabitem==6){
if(loadFlag.co){
++pageNo.co;
companyListVal(keyt,pageSize,pageNo.co)
$(".loadtip").html('上拉加载更多...');
mySwiper.update(); // 重新计算高度;
}
}
}, 300);
}
// 下拉刷新
if(mySwiper.translate >= 50) {
// $(".init-loading").html('正在刷新...').show();
// $(".loadtip").html('上拉加载更多');
setTimeout(function() {
// $(".refreshtip").show(0);
// $(".init-loading").html('刷新成功');
// setTimeout(function(){
// $(".init-loading").html('').hide();
// },800);
// $(".loadtip").show(0);
//刷新操作
mySwiper.update(); // 重新计算高度;
}, 1000);
}else if(mySwiper.translate >= 0 && mySwiper.translate < 50){
// $(".init-loading").html('').hide();
}
return false;
}
});
var mySwiper2 = new Swiper('.swiper-container2',{
onTransitionEnd: function(swiper){
$('.w').css('transform', 'translate3d(0px, 0px, 0px)')
$('.swiper-container2 .swiper-slide-active').css('height','auto').siblings('.swiper-slide').css('height','0px');
mySwiper.update();
$('.swiper-slide-tab').eq(mySwiper2.activeIndex).addClass('active-tab').siblings('.swiper-slide-tab').removeClass('active-tab');
tabitem=$('.swiper-slide-tab').eq(mySwiper2.activeIndex).attr("data-tab");
mySwiperTab.slideTo(mySwiper2.activeIndex, 500, false);
pageNo = {
ex: 1,
co: 1,
rs: 1,
pt: 1,
pp: 1,
ar: 1
}
if(tabitem==1){
extFilter()
expertListVal(keyt,subject,industry,address,authType,pageSize,1)
}else if(tabitem==2){
resourceListVal(keyt,pageSize,1)
}else if(tabitem==3){
articalListVal(keyt,pageSize,1)
}else if(tabitem==4){
patentListVal(keyt,pageSize,1)
}else if(tabitem==5){
paperListVal(keyt,pageSize,1)
}else if(tabitem==6){
companyListVal(keyt,pageSize,1)
}
if(mySwiper2.activeIndex==0){
$("#sele").removeClass("displayNone");
$("#searB").addClass("searchboxNewT");
}else{
$("#sele").addClass("displayNone");
$("#searB").removeClass("searchboxNewT");
}
}
});
$('.swiper-slide-tab').click(function(){
if($(this).index()==0){
$("#sele").removeClass("displayNone");
$("#searB").addClass("searchboxNewT");
}else{
$("#sele").addClass("displayNone");
$("#searB").removeClass("searchboxNewT");
}
$(this).addClass('active-tab').siblings('.swiper-slide-tab').removeClass('active-tab');
tabitem=$(this).attr("data-tab");
mySwiper2.slideTo($(this).index(), 500, false)
mySwiperTab.slideTo($(this).index(), 500, false)
pageNo = {
ex: 1,
co: 1,
rs: 1,
pt: 1,
pp: 1,
ar: 1
}
if(tabitem==1){
extFilter()
expertListVal(keyt,subject,industry,address,authType,pageSize,1)
}else if(tabitem==2){
resourceListVal(keyt,pageSize,1)
}else if(tabitem==3){
articalListVal(keyt,pageSize,1)
}else if(tabitem==4){
patentListVal(keyt,pageSize,1)
}else if(tabitem==5){
paperListVal(keyt,pageSize,1)
}else if(tabitem==6){
companyListVal(keyt,pageSize,1)
}
$('.w').css('transform', 'translate3d(0px, 0px, 0px)')
$('.swiper-container2 .swiper-slide-active').css('height','auto').siblings('.swiper-slide').css('height','0px');
mySwiper.update();
});
//============end swiper================
//============open首次数据获取================
if(tabFlag==""){
tabitem = 1
expertListVal(keyt,subject,industry,address,authType,pageSize,1);
}else{
tabitem = tabFlag;
if(tabitem==1){
expertListVal(keyt,subject,industry,address,authType,pageSize,1)
}else if(tabitem==2){
$('.swiper-slide-tab').eq(2).addClass('active-tab').siblings('.swiper-slide-tab').removeClass('active-tab');
mySwiperTab.slideTo(2, 0, false);
mySwiper2.slideTo(2, 100, false)
$("#sele").addClass("displayNone");
$("#searB").removeClass("searchboxNewT");
resourceListVal(keyt,pageSize,1)
}else if(tabitem==3){
$('.swiper-slide-tab').eq(5).addClass('active-tab').siblings('.swiper-slide-tab').removeClass('active-tab');
mySwiperTab.slideTo(5, 0, false);
mySwiper2.slideTo(5, 100, false)
$("#sele").addClass("displayNone");
$("#searB").removeClass("searchboxNewT");
articalListVal(keyt,pageSize,1)
}else if(tabitem==4){
$('.swiper-slide-tab').eq(3).addClass('active-tab').siblings('.swiper-slide-tab').removeClass('active-tab');
mySwiperTab.slideTo(3, 0, false);
mySwiper2.slideTo(3, 100, false)
$("#sele").addClass("displayNone");
$("#searB").removeClass("searchboxNewT");
patentListVal(keyt,pageSize,1)
}else if(tabitem==5){
$('.swiper-slide-tab').eq(4).addClass('active-tab').siblings('.swiper-slide-tab').removeClass('active-tab');
mySwiperTab.slideTo(4, 0, false);
mySwiper2.slideTo(4, 100, false)
$("#sele").addClass("displayNone");
$("#searB").removeClass("searchboxNewT");
paperListVal(keyt,pageSize,1)
}else if(tabitem==6){
$('.swiper-slide-tab').eq(1).addClass('active-tab').siblings('.swiper-slide-tab').removeClass('active-tab');
mySwiperTab.slideTo(1, 0, false);
mySwiper2.slideTo(1, 100, false)
$("#sele").addClass("displayNone");
$("#searB").removeClass("searchboxNewT");
companyListVal(keyt,pageSize,1)
}
}
//============end首次数据获取================
//============open搜索================
document.getElementById("searchval").addEventListener("keypress", function() {
var e = event || window.event;
if(e.keyCode == 13) {
e.preventDefault();
var searchval = document.getElementById("searchval").value;
if(searchval.replace(/^\s*|\s*$/,"")) {
wlog("kw", searchval);
}
keyt=searchval;
if(tabitem==1){
extFilter()
expertListVal(keyt,subject,industry,address,authType,pageSize,1)
}else if(tabitem==2){
resourceListVal(keyt,pageSize,1)
}else if(tabitem==3){
articalListVal(keyt,pageSize,1)
}else if(tabitem==4){
patentListVal(keyt,pageSize,1)
}else if(tabitem==5){
paperListVal(keyt,pageSize,1)
}else if(tabitem==6){
companyListVal(keyt,pageSize,1)
}
}
});
//============end搜索================
//============open筛选条件================
//筛选条件的选择
$(".filterUl").on("click", "li", function() {
this.parentNode.querySelector('li.filterCurrent').classList.remove("filterCurrent");
this.classList.add("filterCurrent");
this.parentNode.parentNode.querySelector(".spantext").innerText = this.innerText;
})
//筛选条件的展开关闭
$(".filterListNew").on("click", ".rightbtn", function() {
if(this.className == "rightbtn filterActive") {
this.classList.remove("filterActive");
this.parentNode.querySelector(".filterUl").classList.remove("filterUlactive");
this.querySelector("em").classList.remove("unfoldtr");
this.querySelector("em").classList.add("foldtr");
} else {
this.classList.add("filterActive");
this.parentNode.querySelector(".filterUl").classList.add("filterUlactive");
this.querySelector("em").classList.remove("foldtr");
this.querySelector("em").classList.add("unfoldtr");
}
})
var tagm=0;
document.getElementById("oRes").addEventListener("click", function() {
expertProfessor.res("industry");
expertProfessor.res("subject");
expertProfessor.res("address");
})
var expertProfessor = {
oAjaxGet: function(url, obj, oType, oFun) {
$.ajax({
url:url,
data: obj,
dataType: 'json', //服务器返回json格式数据
type: oType, //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
traditional: true,
success: function(data) {
if(data.success) {
oFun(data.data);
}
},
error: {
}
});
},
ind: function($data) {
if($data.length == 0) {
return;
}
var li1 = document.createElement("li");
li1.className = "filterCurrent"
li1.innerHTML = "不限";
document.getElementById('industry').appendChild(li1);
for(var i = 0; i < $data.length; i++) {
var li = document.createElement("li");
li.innerHTML = $data[i].caption;
document.getElementById('industry').appendChild(li);
}
},
sub: function($data) {
if($data.length == 0) {
return;
}
var li1 = document.createElement("li");
li1.className = "filterCurrent"
li1.innerHTML = "不限";
document.getElementById('subject').appendChild(li1);
for(var i = 0; i < $data.length; i++) {
var li = document.createElement("li");
li.innerHTML = $data[i].caption;
document.getElementById('subject').appendChild(li);
}
},
add: function($data) {
if($data.length == 0) {
return;
}
var li1 = document.createElement("li");
li1.className = "filterCurrent"
li1.innerHTML = "不限";
document.getElementById('address').appendChild(li1);
for(var i = 0; i < $data.length; i++) {
var li = document.createElement("li");
li.innerHTML = $data[i].caption;
document.getElementById('address').appendChild(li);
}
},
res: function(aa) {
var t = document.getElementById(aa).getElementsByTagName("li");
for(var i in t) {
if(t[i].innerHTML == "不限") {
t[i].className = "filterCurrent"
} else {
t[i].className = ""
}
}
for(var n = 0; n < 3; n++) {
document.getElementsByClassName('spantext')[n].innerHTML = "不限";
}
tagm=0;
document.getElementById("sele").getElementsByTagName("span")[0].innerHTML="";
}
}
expertProfessor.oAjaxGet('/ajax/dataDict/qaDictCode', {
"dictCode": "INDUSTRY"
}, "get", expertProfessor.ind);
expertProfessor.oAjaxGet('/ajax/dataDict/qaDictCode', {
"dictCode": "SUBJECT"
}, "get", expertProfessor.sub);
expertProfessor.oAjaxGet('/ajax/dataDict/qaCity', {
"dictCode": "ADDRESS"
}, "get", expertProfessor.add);
document.getElementById("com").addEventListener('click', function() {
var arr = [],tagm=0;
for(var n = 0; n < 3; n++) {
if(document.getElementsByClassName('spantext')[n].innerHTML == "不限") {
arr[n] = "";
} else {
arr[n] = document.getElementsByClassName('spantext')[n].innerHTML;
tagm++;
}
}
if(tagm>0){
document.getElementById("sele").getElementsByTagName("span")[0].innerHTML=tagm;
}
extFilter();
expertListVal(keyt,subject,industry,address,authType,pageSize,1);
$('html').removeClass('mmenu-opening');
setTimeout(
function()
{
$('html').removeClass('mmenu-opened').removeClass('mmenu-right');
$('#menu').removeClass('mmenu-opened');
$(window).unbind('resize.mmenu');
},525
);
})
function extFilter(){//获取筛选条件的值
keyt=keyt;
var subjectVal= $("#subject li.filterCurrent").text();
if(subjectVal=="不限"){
subject = "";
}else{
subject = subjectVal;
}
var industryVal= $("#industry li.filterCurrent").text();
if(industryVal=="不限"){
industry = "";
}else{
industry = industryVal;
}
var addressVal= $("#address li.filterCurrent").text();
if(addressVal=="不限"){
address = "";
}else{
address = addressVal;
}
console.log(keyt,subject,industry,address)
}
//============end筛选条件================
//============open模块链接跳转================
$("#proList").on("click", "li", function() {
var id = this.getAttribute("data-id");
location.href="http://" + window.location.host + "/e/p.html?id=" + id;
})
$("#resourceList").on("click", "li", function() {
var id = this.getAttribute("data-id");
location.href="http://" + window.location.host + "/e/r.html?id=" + id;
})
$("#articleList").on("click", "li", function() {
var id = this.getAttribute("data-id");
location.href="http://" + window.location.host + "/e/a.html?id=" + id;
})
$("#paperList").on("click", "li", function() {
var id = this.getAttribute("data-id");
location.href="http://" + window.location.host + "/e/l.html?id=" + id;
})
$("#patentList").on("click", "li", function() {
var id = this.getAttribute("data-id");
location.href="http://" + window.location.host + "/e/z.html?id=" + id;
})
$("#companyList").on("click", "li", function() {
var id = this.getAttribute("data-id");
location.href="http://" + window.location.host + "/e/c.html?id=" + id;
})
//============end模块链接跳转================
//============open不同模块填充函数================
//专家
function expertListVal(keyt,subject,industry,address,authType,pageSize,pageNo) {
$.ajax({
"url": "/ajax/professor/pqBaseInfo",
"type": "get",
"data": {
"key":keyt,
"subject":subject,
"industry":industry,
"address":address,
"authType":authType,
"pageSize": pageSize,
"pageNo": pageNo
},
"success": function(data) {
if(data.success) {
var obj = data.data.data;
var thisObj=document.getElementById("proList");
if(pageNo!=data.data.pageNo) {
data.data.data=[];
loadFlag.ex=false;
$(".loadtip").html('没有更多数据了');
return;
}
if(pageNo==1){
thisObj.innerHTML="";
var noNum = thisObj.parentNode.querySelectorAll("div");
for(var i = 0;i <noNum.length;i++){
if(noNum[i].getAttribute("class")=='nodatabox'){
thisObj.parentNode.removeChild(noNum[i])
}
}
}
if(obj.length>0){
for(var i = 0; i < obj.length; i++) {
var liItem = document.createElement("li");
liItem.className = "mui-table-view-cell"
liItem.setAttribute("data-id",obj[i].id)
var userType = autho(obj[i].authType, obj[i].orgAuth, obj[i].authStatus);
var rlist=""
if( obj[i].researchAreas.length > 0){/*获取研究方向信息*/
rlist = '研究方向:';
for(var n = 0; n < obj[i].researchAreas.length; n++) {
rlist += obj[i].researchAreas[n].caption
if(n < obj[i].researchAreas.length - 1) {
rlist += ";"
}
}
}
var os = "";
if(obj[i].title) {
if(obj[i].orgName) {
os = obj[i].title + "," + obj[i].orgName;
} else {
os = obj[i].title;
}
} else {
if(obj[i].office) {
if(obj[i].orgName) {
os = obj[i].office + "," + obj[i].orgName;
} else {
os = obj[i].office;
}
} else {
if(obj[i].orgName) {
os = obj[i].orgName;
}
}
}
var baImg = "../images/default-photo.jpg";
if(obj[i].hasHeadImage == 1) {
baImg = "/images/head/" + obj[i].id + "_l.jpg";
}
var oString = '<div class="flexCenter clearfix">'
oString += '<div class="madiaHead useHead" style="background-image:url('+baImg+')"></div>'
oString += '<div class="madiaInfo">'
oString += '<p class="ellipsisSty"><span class="h1Font">'+obj[i].name+'</span><em class="authiconNew '+userType.sty+'" title="'+userType.title+'"></em></p>'
oString += '<p class="h2Font ellipsisSty">'+os+'</p>'
oString += '<p class="h2Font ellipsisSty">'+rlist+'</p>'
oString += '</div></div>'
liItem.innerHTML = oString;
thisObj.appendChild(liItem);
}
if(pageNo < Math.ceil(data.data.total / pageSize)) {
loadFlag.ex=true;
}else{
loadFlag.ex=false;
}
}else{
defaultShow(thisObj);
loadFlag.ex=false;
}
}
},
"error": function() {
}
});
}
//企业
function companyListVal(keyt,pageSize,pageNo) {
$.ajax({
"url": "/ajax/org/find/pq",
"type": "get",
"async": true,
"data": {
"kw":keyt,
"pageSize": pageSize,
"pageNo": pageNo
},
"success": function(data) {
if(data.success) {
var obj = data.data.data;
var thisObj=document.getElementById("companyList");
if(pageNo!=data.data.pageNo) {
data.data.data=[];
loadFlag.co=false;
$(".loadtip").html('没有更多数据了');
return;
}
if(pageNo==1){
thisObj.innerHTML="";
var noNum = thisObj.parentNode.querySelectorAll("div");
for(var i = 0;i <noNum.length;i++){
if(noNum[i].getAttribute("class")=='nodatabox'){
thisObj.parentNode.removeChild(noNum[i])
}
}
}
if(obj.length>0){
for(var i = 0; i < obj.length; i++) {
var liItem = document.createElement("li");
liItem.className = "mui-table-view-cell"
liItem.setAttribute("data-id",obj[i].id)
var imgL,thisName,thisAuth,thisTitle,otherI="";
if(obj[i].hasOrgLogo == 1) {
imgL="/images/org/" + obj[i].id + ".jpg";
}else{
imgL='../images/default-icon.jpg'
}
if(obj[i].forShort){
thisName=obj[i].forShort
}else{
thisName=obj[i].name
}
if(obj[i].industry){
otherI=obj[i].industry.replace(/,/gi, " | ");
}
if(obj[i].authStatus==3){
thisAuth="authicon-com-ok"
thisTitle="科袖认证企业"
}
var oString = '<div class="flexCenter OflexCenter clearfix">'
oString += '<div class="madiaHead cmpHead"><div class="boxBlock"><img class="boxBlockimg" src="'+imgL+'" /></div></div>'
oString += '<div class="madiaInfo OmadiaInfo">'
oString += '<p class="ellipsisSty"><span class="h1Font">'+thisName+'</span><em class="authiconNew '+thisAuth+'" title="'+thisTitle+'"></em></p>'
oString += '<p class="ellipsisSty h2Font">'+otherI+'</p>'
oString += '</div></div>'
liItem.innerHTML = oString;
thisObj.appendChild(liItem);
}
if(pageNo < Math.ceil(data.data.total / pageSize)) {
loadFlag.co=true;
}else{
loadFlag.co=false;
}
}else{
defaultShow(thisObj);
loadFlag.co=false;
}
}
},
"error": function() {
}
});
}
//资源
function resourceListVal(keyt,pageSize, pageNo) {
$.ajax({
"url": "/ajax/resource/firstpq",
"type": "get",
"async": true,
"data": {
"key":keyt,
"pageSize": pageSize,
"pageNo": pageNo
},
"success": function(data) {
if(data.success) {
console.log(data)
var obj = data.data.data;
var thisObj=document.getElementById("resourceList");
if(pageNo!=data.data.pageNo) {
data.data.data=[];
loadFlag.rs=false;
$(".loadtip").html('没有更多数据了');
return;
}
if(pageNo==1){
thisObj.innerHTML="";
var noNum = thisObj.parentNode.querySelectorAll("div");
for(var i = 0;i <noNum.length;i++){
if(noNum[i].getAttribute("class")=='nodatabox'){
thisObj.parentNode.removeChild(noNum[i])
}
}
}
if(obj.length>0){
for(var i = 0; i < obj.length; i++) {
var liItem = document.createElement("li");
liItem.className = "mui-table-view-cell"
liItem.setAttribute("data-id",obj[i].resourceId)
var name="",userType={};
if(obj[i].resourceType == 1) { //个人
userType = autho(obj[i].editProfessor.authType, obj[i].editProfessor.orgAuth, obj[i].editProfessor.authStatus);
name=obj[i].editProfessor.name;
} else if(obj[i].resourceType == 2) { //企业
if(obj[i].organization.forShort) {
name=obj[i].organization.forShort;
}else{
name=obj[i].organization.name;
}
if(obj[i].organization.authStatus==3){
userType.sty="authicon-com-ok";
userType.title="科袖认证企业"
}
}
var oString = '<div class="flexCenter OflexCenter clearfix">'
if(obj[i].images.length) {
oString += '<div class="madiaHead resouseHead" style="background-image:url(../data/resource/' + obj[i].images[0].imageSrc +')"></div>'
} else {
oString += '<div class="madiaHead resouseHead"></div>'
}
oString += '<div class="madiaInfo OmadiaInfo"><p class="ellipsisSty h1Font">' + obj[i].resourceName + '</p>'
oString += '<p class="h2Font ellipsisSty"><span>' + name + '</span><em class="authiconNew '+userType.sty+'" title="'+userType.title+'"></em></p>'
oString += '<p class="h2Font ellipsisSty">用途:' + obj[i].supportedServices + '</p>'
oString += '</div></div>'
liItem.innerHTML = oString;
thisObj.appendChild(liItem);
}
if(pageNo < Math.ceil(data.data.total / pageSize)) {
loadFlag.rs=true;
}else{
loadFlag.rs=false;
}
}else{
defaultShow(thisObj);
loadFlag.rs=false;
}
}
},
"error": function() {
}
});
}
//专利
function patentListVal(keyt,pageSize, pageNo) {
$.ajax({
"url": "/ajax/ppatent/pq",
"type": "get",
"async": true,
"data": {
"qw":keyt,
"pageSize": pageSize,
"pageNo": pageNo
},
"success": function(data) {
if(data.success) {
var obj = data.data.data;
var thisObj=document.getElementById("patentList");
if(pageNo!=data.data.pageNo) {
data.data.data=[];
loadFlag.pt=false;
$(".loadtip").html('没有更多数据了');
return;
}
if(pageNo==1){
thisObj.innerHTML="";
var noNum = thisObj.parentNode.querySelectorAll("div");
for(var i = 0;i <noNum.length;i++){
if(noNum[i].getAttribute("class")=='nodatabox'){
thisObj.parentNode.removeChild(noNum[i])
}
}
}
if(obj.length>0){
for(var i = 0; i < obj.length; i++) {
var liItem = document.createElement("li");
liItem.setAttribute("data-id",obj[i].id);
liItem.className = "mui-table-view-cell"
var oString = '<div class="flexCenter OflexCenter clearfix">'
oString += '<div class="madiaHead patentHead"></div>'
oString += '<div class="madiaInfo OmadiaInfo"><p class="ellipsisSty-2 h1Font">' + obj[i].name + '</p>'
oString += '<p class="ellipsisSty h2Font">' + obj[i].authors.substring(0, obj[i].authors.length - 1) + '</p>'
oString += '</div></div>'
liItem.innerHTML = oString;
thisObj.appendChild(liItem);
}
if(pageNo < Math.ceil(data.data.total / pageSize)) {
loadFlag.pt=true;
}else{
loadFlag.pt=false;
}
}else{
defaultShow(thisObj);
loadFlag.pt=false;
}
}
},
"error": function() {
}
});
}
//论文
function paperListVal(keyt,pageSize, pageNo) {
$.ajax({
"url": "/ajax/ppaper/pq",
"type": "get",
"async": true,
"data": {
"qw":keyt,
"pageSize": pageSize,
"pageNo": pageNo
},
"success": function(data) {
if(data.success) {
var obj = data.data.data;
var thisObj=document.getElementById("paperList");
if(pageNo!=data.data.pageNo) {
data.data.data=[];
loadFlag.pp=false;
$(".loadtip").html('没有更多数据了');
return;
}
if(pageNo==1){
thisObj.innerHTML="";
var noNum = thisObj.parentNode.querySelectorAll("div");
for(var i = 0;i <noNum.length;i++){
if(noNum[i].getAttribute("class")=='nodatabox'){
thisObj.parentNode.removeChild(noNum[i])
}
}
}
if(obj.length>0){
for(var i = 0; i < obj.length; i++) {
var liItem = document.createElement("li");
liItem.setAttribute("data-id",obj[i].id);
liItem.className = "mui-table-view-cell"
var oString = '<div class="flexCenter OflexCenter clearfix">'
oString += '<div class="madiaHead paperHead"></div>'
oString += '<div class="madiaInfo OmadiaInfo"><p class="ellipsisSty-2 h1Font">' + obj[i].name + '</p>'
oString += '<p class="ellipsisSty h2Font">' + obj[i].authors.substring(0, obj[i].authors.length - 1) + '</p>'
oString += '</div></div>'
liItem.innerHTML = oString;
thisObj.appendChild(liItem);
}
if(pageNo < Math.ceil(data.data.total / pageSize)) {
loadFlag.pp=true;
}else{
loadFlag.pp=false;
}
}else{
defaultShow(thisObj);
loadFlag.pp=false;
}
}
},
"error": function() {
}
});
}
//文章
function articalListVal(keyt,pageSize, pageNo) {
$.ajax({
"url": "/ajax/article/firstpq",
"type": "get",
"async": true,
"data": {
"key":keyt,
"pageSize": pageSize,
"pageNo": pageNo
},
"success": function(data) {
if(data.success) {
var obj = data.data.data;
var thisObj=document.getElementById("articleList");
if(pageNo!=data.data.pageNo) {
data.data.data=[];
loadFlag.ar=false;
$(".loadtip").html('没有更多数据了');
return;
}
if(pageNo==1){
thisObj.innerHTML="";
var noNum = thisObj.parentNode.querySelectorAll("div");
for(var i = 0;i <noNum.length;i++){
if(noNum[i].getAttribute("class")=='nodatabox'){
thisObj.parentNode.removeChild(noNum[i])
}
}
}
if(obj.length>0){
for(var i = 0; i < obj.length; i++) {
var liItem = document.createElement("li");
liItem.setAttribute("data-id",obj[i].articleId);
liItem.setAttribute("owner-id",obj[i].orgId);
liItem.className = "mui-table-view-cell"
var oString = '<div class="flexCenter OflexCenter clearfix">'
if(obj[i].articleImg) {
oString += '<div class="madiaHead artHead" style="background-image:url(../data/article/' + obj[i].articleImg + ')"></div>'
} else {
oString += '<div class="madiaHead artHead"></div>'
}
var name="";
if(obj[i].articleType == 1) { //个人文章
name=obj[i].professor.name;
} else if(obj[i].articleType == 2) { //企业文章
if(obj[i].editOrganization.forShort) {
name=obj[i].editOrganization.forShort;
}else{
name=obj[i].editOrganization.name;
}
}
oString += '<div class="madiaInfo OmadiaInfo"><p class="ellipsisSty-2 h1Font">' + obj[i].articleTitle + '</p>'
oString += '<p class="h2Font ellipsisSty"><span style="margin-right:10px">' + name + '</span><span class="time">'+commenTime(obj[i].publishTime)+'</span></p>'
oString += '</div></div>'
liItem.innerHTML = oString;
thisObj.appendChild(liItem);
}
if(pageNo < Math.ceil(data.data.total / pageSize)) {
loadFlag.ar=true;
}else{
loadFlag.ar=false;
}
}else{
defaultShow(thisObj);
loadFlag.ar=false;
}
}
},
"error": function() {
}
});
}
//缺省模块
function defaultShow(obj){
var noNum = obj.parentNode.querySelectorAll("div");
obj.innerHTML='';
for(var i = 0;i <noNum.length;i++){
if(noNum[i].getAttribute("class")=='nodatabox'){
return;
}
}
var liItem = document.createElement("div");
liItem.className = "nodatabox"
var strCon ='<div class="nodata"><div class="picbox picNull"></div>'
strCon +='<div class="txtbox"><p class="noContip">暂时没有符合该搜索条件的内容</p></div>'
strCon +='</div>'
liItem.innerHTML = strCon;
obj.parentNode.appendChild(liItem);
}
//============end不同模块填充函数================
}
|