123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- var pageIndex = 1;
- var allPages = 1;
- var table = document.body.querySelector('.list');
- var search = document.getElementById("search");
- search.addEventListener('focus', function() {
- var searchpage = mui.preload({
- url: '../html/search.html',
- id: '../html/search.html',
- });
- searchpage.show("slide-in-right",150);
- });
- getOnePase();
- mui.init({
- pullRefresh: {
- container: '#pullrefresh',
- up: {
- contentrefresh: '正在加载...',
- callback: pullupRefresh
- }
- }
- });
- function pullupRefresh() {
- pageIndex = ++pageIndex;
- setTimeout(function() {
- getaData()
- }, 1000);
- }
- if(mui.os.plus) {
- mui.plusReady(function() {
- setTimeout(function() {
- mui('#pullrefresh').pullRefresh().pulldownLoading();
- }, 500);
- });
- } else {
- mui.ready(function() {
- mui('#pullrefresh').pullRefresh().pulldownLoading();
- });
- }
- function getaData() {
- mui.plusReady(function() {
- mui.ajax(baseUrl + '/ajax/professor/pqHot', {
- data: {
- "pageNo": pageIndex,
- "pageSize": 10,
- },
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- success: function(data) {
- if(data.success) {
-
- var dice1 = data.data.total;
- var dice2 = data.data.pageSize;
- var result = '';
- if(pageIndex == 1) {
- table.innerHTML = '';
- }
- allPages = dice1 / dice2;
- var datalist = data.data.data;
- datalistEach(datalist);
- if(pageIndex < allPages) {
- mui('#pullrefresh').pullRefresh().endPullupToRefresh(false);
- } else {
- mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
- }
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
- }
- });
- });
- }
- function getOnePase() {
- mui.plusReady(function() {
- mui.ajax(baseUrl + '/ajax/professor/pqHot', {
- data: {
- "pageNo": 1,
- "pageSize": 10,
- },
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- success: function(data) {
- if(data.success) {
- var datalist = data.data.data;
- datalistEach(datalist);
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- }
- });
- });
- }
- function datalistEach(datalist) {
- mui.each(datalist, function(index, item) {
-
- if(item.hasHeadImage == 1) {
- var img = "../images/head/" + item.id + "_m.jpg";
- } else {
- var img = "../images/default-photo.jpg";
- }
-
- var researchAreas = item.researchAreas;
- var rlist = ''
- for(var n = 0; n < researchAreas.length; n++) {
-
- rlist = '<span>' + researchAreas[n].caption + '</span>、';
- }
-
- var resources = item.resources;
- var zlist = ''
- for(var m = 0; m < resources.length; m++) {
-
- zlist = '<span>' + resources[m].resourceName + '</span>、';
- }
- var title = item.title || "";
- var office = item.office || "";
- var orgName = item.orgName || "";
- var address = item.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 = '<a class="proinfor" ' +
- '<p><img class="mui-media-object mui-pull-left headimg" src="' + img + '"></p>' +
- '<div class="mui-media-body">' +
- '<span class="listtit">' + item.name + '<em class="mui-icon iconfont icon-vip authicon"></em></span>' +
- '<p class="listtit2"><span>' + title + '</span><span>' + office + '</span><span>' + orgName + '</span><span>' + address + '</span></p>' +
- '<p class="mui-ellipsis listtit3">' + rlist + '</p>' +
- '<p class="mui-ellipsis listtit3">' + zlist + '</p>' +
- '</div></a></li>';
- table.appendChild(li, table.firstChild);
- });
- }
|