//首页 var pageIndex = 1; // 页数 var allPages = 1; // 总页数 var table = document.body.querySelector('.list'); var search = document.getElementById("search"); mui.plusReady(function() { //plus.nativeUI.showWaiting(); checkVersion(); }) document.addEventListener("resume", function() { checkVersion(); }, false) function orName() { mui.ajax(baseUrl + "/ajax/professor/baseInfo/" + plus.storage.getItem('userid'), { dataType: 'json', //数据格式类型 type: 'GET', //http请求类型 timeout: 10000, //超时设置 success: function(data) { if(data.success && data.data) { var $info = data.data || {}; dem($info.id, $info.orgId) } }, error: function() { plus.nativeUI.toast("服务器链接超时", toastStyle); return; } }); } function dem(uid, oid) { mui.ajax(baseUrl + "/ajax/demand/qc", { dataType: 'json', //数据格式类型 type: 'GET', //http请求类型 timeout: 10000, //超时设置 data: { "state": [0, 1], "uid": uid, "oid": oid }, traditional: true, success: function(data) { if(data.success) { var $data = data.data; if($data) { mui.openWindow({ url: '../html/demandPublish.html', id: 'demandPublish.html', show: { autoShow: true, aniShow: "slide-in-right" } }); } else { mui.openWindow({ url: '../html/sureOrg.html', id: 'sureOrg.html', show: { autoShow: true, aniShow: "slide-in-right", } }); } } }, error: function() { plus.nativeUI.toast("服务器链接超时", toastStyle); return; } }); } document.getElementById("demandP").addEventListener("tap", function() { var userid = plus.storage.getItem('userid'); if(userid == null) { mui.openWindow({ url: '../html/login.html', id: 'login.html' }) return; } orName() }) document.getElementById("improfessor").addEventListener("tap", function() { var userid = plus.storage.getItem('userid'); if(userid == null) { mui.openWindow({ url: '../html/login.html', id: 'login.html' }) return; } mui.ajax(baseUrl + "/ajax/professor/auth", { dataType: 'json', //数据格式类型 type: 'GET', //http请求类型 timeout: 10000, //超时设置 data: { "id": userid }, success: function(data) { if(data.success) { var $data = data.data; if($data.authType == 1) { mui.openWindow({ url: '../html/needSearch.html', id: '../html/needSearch.html', show: { autoShow: false, aniShow: "slide-in-right", } }); } else { if($data.authStatusExpert == 2) { plus.nativeUI.toast("我们正在对您的信息进行认证,请稍等片刻", { 'verticalAlign': 'center' }); } else if($data.authStatusExpert == 1) { plus.nativeUI.toast("我们将尽快对您的信息进行认证", { 'verticalAlign': 'center' }); } else if($data.authStatusExpert <= 0) { if($data.authStatus == 3) { mui.openWindow({ url: '../html/expert-authentication.html', id: 'expert-authentication.html', show: { autoShow: false, aniShow: "slide-in-right", } }); } else if($data.authStatus == 2) { plus.nativeUI.toast("我们正在对您的信息进行认证,请稍等片刻", { 'verticalAlign': 'center' }); } else if($data.authStatus == 1) { plus.nativeUI.toast("我们将尽快对您的信息进行认证", { 'verticalAlign': 'center' }); } else { mui.openWindow({ url: '../html/realname-authentication2.html', id: 'realname-authentication2.html', show: { autoShow: false, aniShow: "slide-in-right", } }); } } } } }, error: function() { plus.nativeUI.toast("服务器链接超时", toastStyle); return; } }); }) proShow() resShare() ruZhuCmp() mui('#hotPro').on('tap', 'li', function() { var id = this.getAttribute("data-id"); plus.nativeUI.showWaiting(); //显示原生等待框 webviewShow = plus.webview.create("../html/userInforShow.html", 'userInforShow.html', {}, { proid: id }); }) mui('#resShare').on('tap', 'li', function() { var id = this.getAttribute("data-id"); plus.nativeUI.showWaiting(); //显示原生等待框 webviewShow = plus.webview.create("../html/resourceShow.html", 'resourceShow.html', {}, { resourceId: id }); }) mui('#ruZhuCmp').on('tap', 'li', function() { var id = this.getAttribute("data-id"); plus.nativeUI.showWaiting(); //显示原生等待框 webviewShow = plus.webview.create("../html/cmpInforShow.html", 'cmpInforShow.html', {}, { cmpId: id }); }) document.getElementById("moreRcmp").addEventListener("tap",function(){//查看更多企业 plus.nativeUI.showWaiting(); var web = plus.webview.create("../html/searchListNew2.html?content=2", "../html/searchListNew2.html", {}, { key:"", qiFlag:6 }); }) document.getElementById("moreShare").addEventListener("tap",function(){//查看更多资源 plus.nativeUI.showWaiting(); var web = plus.webview.create("../html/searchListNew2.html?content=3", "../html/searchListNew2.html", {}, { key:"", qiFlag:2 }); }) document.getElementById("moreHotp").addEventListener("tap",function(){//查看更多专家 plus.nativeUI.showWaiting(); var web = plus.webview.create("../html/searchListNew2.html?content=1", "../html/searchListNew2.html", {}, { key:"", qiFlag:1 }); }) ///*点击轮播图*/ //mui('.artical-scroll').on('tap', 'a', function() { // var articalNum = this.getAttribute("data-title"); // mui.openWindow({ // url: '../html/artical_' + articalNum + '.html', // id: '../html/artical_' + articalNum + '.html', // show: { // aniShow: "slide-in-right", // } // }); //}) /*点击热门领域*/ mui('.gridbg').on('tap', 'li', function() { var subject = this.getAttribute("data-title"); //plus.nativeUI.showWaiting();//显示原生等待框 //webviewShow = plus.webview.create("../html/search.html",'search.html',{},{subject:subject,bigClass:1});//后台创建webview并打开show.html mui.openWindow({ url: '../html/searchListNew2.html?content=1', id: '../html/searchListNew2.html', show: { //autoShow:false, aniShow: "slide-in-right", }, extras: { key: subject, qiFlag: 1 } }); }) /*页面数据初始化*/ //getOnePase(); //mui.init({ // pullRefresh: { // container: '#pullrefresh', // down: { // callback: pulldownRefresh // }, // up: { // contentrefresh: '正在加载...', // //auto:true, // //height:100, // callback: pullupRefresh // } // } //}); // //function pullupRefresh() { // pageIndex = ++pageIndex; // setTimeout(function() { // getaData() // }, 1000); //} // //function pulldownRefresh() { // setTimeout(function() { // getOnePase(); // mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); // }, 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', //http请求类型 // timeout: 10000, // async: false, // success: function(data) { // if(data.success) { // //console.log("成功"); // 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', //http请求类型 // timeout: 10000, // async: false, // success: function(data) { // table.innerHTML = ""; // if(data.success) { // plus.nativeUI.closeWaiting(); // var datalist = data.data.data; // datalistEach(datalist); // } // }, // error: function() { // plus.nativeUI.toast("服务器链接超时", { // 'verticalAlign': 'center' // }); // } // }); // }); //} // ///*数据遍历*/ //function datalistEach(datalist) { // mui.each(datalist, function(index, item) { // // /*获取头像*/ // if(item.hasHeadImage == 1) { // var img = baseUrl + "/images/head/" + item.id + "_l.jpg"; // } else { // var img = "../images/default-photo.jpg"; // } // // /*获取研究方向信息*/ // var researchAreas = item.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 resources = item.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 otherIn = ""; // if(item.title) { // if(item.orgName) { // otherIn = item.title + "," + item.orgName; // } else { // otherIn = item.title; // } // } else { // if(item.office) { // if(item.orgName) { // otherIn = item.office + "," + item.orgName; // } else { // otherIn = item.office; // } // } else { // if(item.orgName) { // otherIn = item.orgName; // } // } // } // // var typeTname = ''; // var oSty = autho(item.authType, item.orgAuth, item.authStatus); // typeTname = '' // // var li = document.createElement('li'); // li.className = 'mui-table-view-cell flexCenter OflexCenter'; // li.setAttribute("data-id", item.id); // li.innerHTML = // '
' + // '' + item.name + typeTname + '
' + // '' + otherIn + '
' + // '' + rlist + '
' + // // '' + zlist + '
' + // '