//我的关注 var allPages = 1, // 总页数; pageSize = 0, pageNo = 1; var table = document.body.querySelector('.list'); var nodatabox1 = document.getElementById("nodatabox1"); mui.init({ pullRefresh: { container: '#pullrefresh', /*down: { callback: pulldownRefresh },*/ up: { contentrefresh: '正在加载...', callback: pullupRefresh, // auto:true } } }); function pullupRefresh() { pageNo = ++pageNo; setTimeout(function() { expert2(pageNo, 10) }, 1000); mui('#pullrefresh').pullRefresh().refresh(true); } /*function pulldownRefresh() { setTimeout(function() { getOneExpert(1, 10); mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); }, 1000); } */ mui.plusReady(function(){ mui('.list').on('tap','a',function(){ var id=this.getAttribute("data-id"); plus.nativeUI.showWaiting(); plus.webview.create("../html/proinforbrow.html",'proinforbrow.html',{},{proid:id}); console.log(id) }) }) getOneExpert(1, 10); /*获取第一页专家数据*/ function getOneExpert(pageNo, pageSize) { mui.plusReady(function() { var userId = plus.storage.getItem('userid'); mui.ajax(baseUrl + '/ajax/watch/qaPro', { data: { "professorId": userId, "watchType": 1, "pageNo": pageNo, "pageSize": pageSize }, dataType: 'json', //数据格式类型 type: 'GET', //http请求类型 //timeout: 10000, //async:false, success: function(data) { plus.nativeUI.closeWaiting(); plus.webview.currentWebview().show("fade-in", 150); table.innerHTML = ''; mui('#pullrefresh').pullRefresh().refresh(true); //重置上拉加载 if(data.success && data.data.data != "") { var datalist = data.data.data; datalistEach(datalist); mui('#pullrefresh').pullRefresh().refresh(true); if(data.data.total= allPages) { mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); //能上拉 } } }, error: function() { plus.nativeUI.toast("服务器链接超时", toastStyle); } }); }); } /*专家数据遍历*/ function datalistEach(datalist) { mui.each(datalist, function(index, item) { /*获取头像*/ //console.log(JSON.stringify(item)); if(item.professor.hasHeadImage == 1) { var img = baseUrl + "/images/head/" + item.professor.id + "_l.jpg"; } else { var img = "../images/default-photo.jpg"; } /*获取研究方向信息*/ var researchAreas = item.professor.researchAreas; //console.log(JSON.stringify(item.professor.researchAreas)) var rlist = ''; for(var n = 0; n < researchAreas.length; n++) { //console.log(researchAreas[n].caption); rlist += '' + researchAreas[n].caption if(n < researchAreas.length-1){ rlist += " , " } rlist += ''; } /*判断用户是否认证*/ var icon = ''; var oSty = autho(item.professor.authType, item.professor.orgAuth, item.professor.authStatus); icon='' /*获取资源信息*/ var resources = item.professor.resources; var zlist = ''; for(var m = 0; m < resources.length; m++) { //console.log(resources[m].caption); zlist += '' + resources[m].resourceName if(m < resources.length-1){ zlist += " , " } zlist += ''; } var title = item.professor.title || ""; var office = item.professor.office || ""; var orgName = item.professor.orgName || ""; var address = item.professor.address || ""; if(title != "") { title = title + " , "; } if(office != "") { office = office + " , "; } if(orgName != "") { orgName = orgName; } if(address != "") { address = " | " + address; } var li = document.createElement('li'); li.className = 'mui-table-view-cell mui-media'; li.innerHTML = '

' + '
' + '' + item.professor.name + icon + '' + '

' + title + '' + office + '' + orgName + '' + address + '

' + '

' + rlist + '

' + '

' + zlist + '

' + '
'; table.appendChild(li, table.firstChild); }); }