123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635 |
- var ifdiv = false;
- var bigClass = 1,
- allPages = 1;
- var key = "",
- subject = "",
- industry = "",
- province = "",
- address = "",
- authentication = "",
- pageSize = 0,
- pageNo = 1;
- var showblock = document.getElementById("li_show");
- var selectblock = document.getElementById("div_select");
- var searchVal = document.getElementById("searchval");
- var table = document.body.querySelector('.list');
- var yyhy = document.getElementById("yyhy");
- var xsly = document.getElementById("xsly");
- var provinceVal = document.getElementById("provinceval");
- var addressVal = document.getElementById("addressval");
- var subjectid = document.getElementById("subjectid");
- var industryid = document.getElementById("industryid");
- mui.init({
- pullRefresh: {
- container: '#pullrefresh3',
- up: {
- contentrefresh: '正在加载...',
- callback: pullupRefresh,
-
- }
- }
- });
- function pullupRefresh() {
- pageNo = ++pageNo;
- console.log(pageNo)
- key = searchVal.value;
- setTimeout(function() {
- expert2(key, subject, industry, province, address, authentication, 10, pageNo)
- }, 1000);
- mui('#pullrefresh3').pullRefresh().refresh(true);
- }
- if(mui.os.plus) {
- mui.plusReady(function() {
- setTimeout(function() {
- mui('#pullrefresh3').pullRefresh().pulldownLoading();
- }, 500);
- });
- } else {
- mui.ready(function() {
- mui('#pullrefresh3').pullRefresh().pulldownLoading();
- });
- }
- mui.plusReady(function(){
-
-
- mui('.list').on('tap','a',function(){
- var id=this.getAttribute("data-id");
-
- plus.nativeUI.showWaiting();
- if(bigClass==1){
- plus.webview.create("../html/proinforbrow.html",'proinforbrow.html',{},{proid:id});
- }else{
- plus.webview.create("../html/resinforbrow.html",'resinforbrow.html',{},{resourceId:id});
- }
-
- })
-
- var self = plus.webview.currentWebview();
- if(self.key==undefined){
- self.key="";
- }else{
- key=self.key;
- searchVal.value=key;
- }
- if(self.subject==undefined){
- self.subject="学术领域";
-
- }else{
- subject=self.subject;
- subjectid.innerText = self.subject;
- }
-
- bigClass=self.bigClass;
- if(bigClass==1){
- selectblock.innerText='专家';
- }else{
- selectblock.innerText='资源';
- }
-
-
- expert(key, subject, industry, province, address, authentication, 10, 1);
- })
- selectblock.addEventListener('tap', function() {
- showblock.style.display = 'block';
- });
- mui("#li_show").on('tap', 'li', function() {
- pageNo = 1
- bigClass = this.getAttribute("data-num");
- selectblock.innerHTML = this.innerHTML;
- showblock.style.display = 'none';
- plus.nativeUI.showWaiting();
- expert(key, subject, industry, province, address, authentication, 10, 1);
- });
- searchval.addEventListener("keyup", function() {
- var e = event || window.event || arguments.caller.arguments[0];
- if(e.keyCode == 13) {
- pageNo = 1
- key = searchVal.value;
-
- console.log(subject);
- console.log(industry);
- console.log(address);
- console.log(province);
- console.log(authentication);*/
- plus.nativeUI.showWaiting();
-
- expert(key, subject, industry, province, address, authentication, 10, 1);
- }
- })
- mui(".provinceval").on('tap', 'a', function() {
- key = searchVal.value;
- province = this.innerText;
- document.getElementById("addressid").innerText = province;
- document.querySelector('#provinceval li a.active').classList.remove('active');
- this.classList.add("active");
- if(province == "全国") {
- province = "";
- address = "";
- addressVal.innerHTML = "";
- plus.nativeUI.showWaiting();
- mui('.mui-popover').popover('hide');
- expert(key, subject, industry, province, address, authentication, 10, 1);
- } else {
- mui.ajax(baseUrl + '/ajax/dataDict/qaCity', {
- data: {
- "dictCode": "ADDRESS",
- province: province
- },
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- success: function(data) {
- var finallist = '<li class="mui-table-view-cell"><a class="active">全省</a></li>';
- console.log(data.success)
- console.log(JSON.stringify(data.data))
- if(data.success && data.data != "") {
- mui.each(data.data, function(i, n) {
- finallist += '<li class="mui-table-view-cell"><a >' + n.caption + '</a></li>';
- });
- addressVal.innerHTML = finallist;
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- }
- });
- }
- });
- mui("#addressval").on('tap', 'a', function() {
- key = searchVal.value;
- address = this.innerText;
- document.querySelector('#addressval li a.active').classList.remove('active');
- this.classList.add("active");
- if(address == "全省") {
- address = "";
- }
-
-
- plus.nativeUI.showWaiting();
- mui('.mui-popover').popover('hide');
- expert(key, subject, industry, province, address, authentication, 10, 1);
- })
- mui(".yyhy").on('tap', 'a', function() {
- pageNo = 1
- key = searchVal.value;
- industry = this.innerText;
- industryid.innerText = industry;
- document.querySelector('#yyhy li a.active').classList.remove('active');
- this.classList.add("active");
- if(industry == "不限") {
- industry = "";
- industryid.innerText ="应用行业";
- }
- plus.nativeUI.showWaiting();
- mui('.mui-popover').popover('hide');
-
- console.log(subject);
- console.log(industry);
- console.log(address);
- console.log(province);
- console.log(authentication);*/
- expert(key, subject, industry, province, address, authentication, 10, 1);
- });
- mui(".xsly").on('tap', 'a', function() {
- pageNo = 1
- key = searchVal.value;
- subject = this.innerText;
- subjectid.innerText = subject;
- document.querySelector('#xsly li a.active').classList.remove('active');
- this.classList.add("active");
- if(subject == "不限") {
- subject = "";
- subjectid.innerText="学术领域";
- }
-
- console.log(subject);
- console.log(industry);
- console.log(address);
- console.log(province);
- console.log(authentication);*/
- plus.nativeUI.showWaiting();
- mui('.mui-popover').popover('hide');
- expert(key, subject, industry, province, address, authentication, 10, 1);
- });
- function expert(key, subject, industry, province, address, authentication, pageSize, pageNo) {
-
- if(bigClass == 1) {
- mui.ajax(baseUrl + '/ajax/professor/pqAPP', {
- data: {
- "key": key,
- "subject": subject,
- "industry": industry,
- "province": province,
- "address": address,
- "authentication": authentication,
- "pageSize": pageSize,
- "pageNo": pageNo,
- },
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- success: function(data) {
- table.innerHTML = '';
- plus.webview.currentWebview().show("slide-in-right",150);
- plus.nativeUI.closeWaiting();
- var perrid = plus.webview.getWebviewById('../html/search-home.html');
- if(perrid){
- setTimeout(function() {
- perrid.close();
- }, 1000);
- }
- if(data.success && data.data.data != '') {
- var datalist = data.data.data;
- console.log(data.data.total)
- datalistEach(datalist);
- mui('#pullrefresh3').pullRefresh().refresh(true);
- mui('#pullrefresh3').pullRefresh().scrollTo(0,0);
- if(data.data.total<data.data.pageSize){
- mui('#pullrefresh3').pullRefresh().disablePullupToRefresh();
- }
- } else {
- plus.nativeUI.toast("抱歉,没有找到对应的搜索", toastStyle);
- mui('#pullrefresh3').pullRefresh().disablePullupToRefresh();
- }
-
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- }
- });
- } else {
- mui.ajax(baseUrl + '/ajax/resource/pqRes', {
- data: {
- "key": key,
- "subject": subject,
- "industry": industry,
- "province": province,
- "address": address,
- "authentication": authentication,
- "pageSize": pageSize,
- "pageNo": pageNo,
- },
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- success: function(data) {
- table.innerHTML = '';
- plus.nativeUI.closeWaiting();
- plus.webview.currentWebview().show("slide-in-right",150);
- var perrid = plus.webview.getWebviewById('../html/search-home.html');
- if(perrid){
- setTimeout(function() {
- perrid.close();
- }, 1000);
- }
- if(data.success && data.data.data != '') {
- var datalist = data.data.data;
- resourcesEach(datalist);
- mui('#pullrefresh3').pullRefresh().refresh(true);
- mui('#pullrefresh3').pullRefresh().scrollTo(0,0,0);
- if(data.data.total<data.data.pageSize){
- mui('#pullrefresh3').pullRefresh().disablePullupToRefresh();
- }
- } else {
- plus.nativeUI.toast("抱歉,没有找到对应的搜索", toastStyle);
- mui('#pullrefresh3').pullRefresh().disablePullupToRefresh();
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- }
- });
- }
-
-
- }
- function expert2(key, subject, industry, province, address, authentication, pageSize, pageNo) {
-
-
- console.log(pageNo);
- if(bigClass == 1) {
- mui.ajax(baseUrl + '/ajax/professor/pqAPP', {
- data: {
- "key": key,
- "subject": subject,
- "industry": industry,
- "province": province,
- "address": address,
- "authentication": authentication,
- "pageSize": pageSize,
- "pageNo": pageNo,
- },
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- success: function(data) {
- plus.nativeUI.closeWaiting();
- if(data.success && data.data.data != '') {
- mui('#pullrefresh3').pullRefresh().enablePullupToRefresh();
- var datalist = data.data.data;
- var dice1 = data.data.total;
- var dice2 = data.data.pageSize;
- console.log(dice1);
- console.log(dice2);
- allPages = Math.ceil(dice1 / dice2);
- if(allPages == 1) {
- table.innerHTML = '';
- }
- console.log(allPages);
- var datalist = data.data.data;
- datalistEach(datalist);
- mui('#pullrefresh3').pullRefresh().refresh(true);
- if(pageNo < allPages) {
- mui('#pullrefresh3').pullRefresh().endPullupToRefresh(false);
- } else {
- mui('#pullrefresh3').pullRefresh().endPullupToRefresh(true);
- }
- } else {
- mui('#pullrefresh3').pullRefresh().disablePullupToRefresh();
- table.innerHTML = '';
- plus.nativeUI.toast("抱歉,没有找到对应的搜索", toastStyle);
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- mui('#pullrefresh3').pullRefresh().endPullupToRefresh(true);
- }
- });
- } else {
- mui.ajax(baseUrl + '/ajax/resource/pqRes', {
- data: {
- "key": key,
- "subject": subject,
- "industry": industry,
- "province": province,
- "address": address,
- "authentication": authentication,
- "pageSize": pageSize,
- "pageNo": pageNo,
- },
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- success: function(data) {
- plus.nativeUI.closeWaiting();
- if(data.success && data.data.data != '') {
- mui('#pullrefresh3').pullRefresh().enablePullupToRefresh();
- var datalist = data.data.data;
- var dice1 = data.data.total;
- var dice2 = data.data.pageSize;
- allPages = Math.ceil(dice1 / dice2);
- if(allPages == 1) {
- table.innerHTML = '';
- }
- var datalist = data.data.data;
- resourcesEach(datalist);
- mui('#pullrefresh3').pullRefresh().refresh(true);
- if(pageNo < allPages) {
- mui('#pullrefresh3').pullRefresh().endPullupToRefresh(false);
- } else {
- mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
- }
- } else {
- mui('#pullrefresh3').pullRefresh().disablePullupToRefresh();
- table.innerHTML = '';
- plus.nativeUI.toast("抱歉,没有找到对应的搜索", toastStyle);
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- mui('#pullrefresh3').pullRefresh().endPullupToRefresh(true);
- }
- });
- }
-
- }
- 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 icon = ''
- if(item.authentication == 1) {
- icon = '<em class="mui-icon iconfont icon-vip authicon"></em>';
- } else {
- icon = '<em class="mui-icon iconfont icon-vip unauthicon"></em>';
- }
-
- 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" data-id="'+item.id+'"' +
- '<p><img class="mui-media-object mui-pull-left headimg headRadius" src="' + img + '"></p>' +
- '<div class="mui-media-body">' +
- '<span class="listtit">' + item.name + icon + '</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);
- });
- }
- function resourcesEach(datalist) {
- mui.each(datalist, function(index, item) {
-
- if(item.images.length) {
- var img = baseUrl + "/images/resource/" + item.resourceId + ".jpg";
- } else {
- var img = "../images/default-resource.jpg";
- }
-
- var icon = ''
- if(item.professor.authentication == true) {
- icon = '<em class="mui-icon iconfont icon-vip authicon"></em>';
- } else {
- icon = '<em class="mui-icon iconfont icon-vip unauthicon"></em>';
- }
- 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 = '<a class="proinfor" data-id="'+item.resourceId+'"' +
- '<p><img class="mui-media-object mui-pull-left resimg" src="' + img + '"></p>' +
- '<div class="mui-media-body">' +
- '<span class="listtit">' + item.resourceName + '</span>' +
- '<p class="mui-ellipsis listtit2">' + item.supportedServices + '</p>' +
- '<span class="listtit">' + item.professor.name + icon + '</span>' +
- '<p class="listtit3"><span>' + title + '</span><span>' + office + '</span><span>' + orgName + '</span><span>' + address + '</span></p>' +
- '</div></a></li>';
- table.appendChild(li, table.firstChild);
- });
- }
- mui.plusReady(function(){
- mui.ajax(baseUrl + '/ajax/dataDict/qaCity', {
- data: {
- "dictCode": "PROVINCE"
- },
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- success: function(data) {
- var finallist = '<li class="mui-table-view-cell"><a class="active">全国</a></li>';
- console.log(data.success)
- console.log(JSON.stringify(data.data))
- if(data.success && data.data != "") {
- mui.each(data.data, function(i, n) {
- finallist += '<li class="mui-table-view-cell"><a >' + n.caption + '</a></li>';
- });
- provinceVal.innerHTML = finallist;
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- }
- });
- mui.ajax(baseUrl + '/ajax/dataDict/qaDictCode', {
- data: {
- "dictCode": "INDUSTRY"
- },
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- success: function(data) {
- var finallist = '<li class="mui-table-view-cell mui-col-xs-5"><a class="active">不限</a></li>';
- console.log(data.success)
- console.log(JSON.stringify(data.data))
- if(data.success && data.data != "") {
- mui.each(data.data, function(i, n) {
- finallist += '<li class="mui-table-view-cell mui-col-xs-5"><a >' + n.caption + '</a></li>';
- });
- yyhy.innerHTML = finallist;
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- }
- });
- mui.ajax(baseUrl + '/ajax/dataDict/qaDictCode', {
- data: {
- "dictCode": "SUBJECT"
- },
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- success: function(data) {
- var finallist = '<li class="mui-table-view-cell mui-col-xs-5"><a class="active" >不限</a></li>';
-
-
- if(data.success && data.data != "") {
- mui.each(data.data, function(i, n) {
- finallist += '<li class="mui-table-view-cell mui-col-xs-5"><a >' + n.caption + '</a></li>';
- });
- xsly.innerHTML = finallist;
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- }
- });
- })
-
|