123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- var ozixun = document.getElementById("zixun");
- var yesExpert = document.getElementById("yesExpert");
- var noExpert = document.getElementById("noExpert");
- var personalMaterial = document.getElementsByClassName('personalMaterial');
- var personSummary = document.getElementsByClassName("breifinfo")[0];
- mui.plusReady(function() {
- var userid = plus.storage.getItem('userid');
- var self = plus.webview.currentWebview();
- var proId = self.proid;
- console.log(userid);
-
- if(userid) {
- ozixun.addEventListener('tap', function() {
- var flag = 'professor';
- var nwaiting = plus.nativeUI.showWaiting();
- webviewShow = plus.webview.create("../html/consultapply.html", 'consultapply.html', {}, {
- 'proId': proId,
- 'flag': flag
- });
- webviewShow.addEventListener("loaded", function() {
- }, false);
- });
- } else if(userid == '' || userid == undefined) {
- ozixun.addEventListener('tap', function() {
-
- mui.openWindow({
- url: '../html/login.html',
- id: 'html/login.html',
- show: {
- aniShow: "slide-in-left"
- }
- });
- });*/
- plus.nativeUI.toast("请先登录");
- });
- }
-
- var professorResource = function(odata) {
- var $data = odata;
- var html = [];
- for(var i = 0; i < odata.length; i++) {
- var string = '<li class="mui-table-view-cell mui-media" resouseId=' + $data[i].resourceId + '>'
- string += '<a class="proinfor"><div class="mui-media-object mui-pull-left ResImgBox ResImgBox2">'
- if($data[i].images.length) {
- string += '<img class="resImg headRadius" src="' + baseUrl + '/images/resource/' + $data[i].resourceId + '.jpg">'
- } else {
- string += '<img class="resImg headRadius" src="../images/default-resource.jpg">'
- }
- string += '</div><div class="mui-media-body">'
- string += '<span class="listtit">' + $data[i].resourceName + '</span>'
- string += '<p class="listtit2">' + $data[i].supportedServices + '</p>'
- string += '<p class="listtit3 resbrief">'
- if($data[i].descp) {
- string += $data[i].descp;
- }
- string += '</p></div></a></li>'
- html.push(string);
- }
- document.getElementById("resourceList").innerHTML = html.join('');
- }
-
- function personalMessage() {
- mui.ajax(baseUrl + "/ajax/professor/info/" + proId, {
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- success: function(data) {
- plus.nativeUI.closeWaiting();
- plus.webview.currentWebview().show("slide-in-right", 150);
- var $data = data.data;
- personalMaterial[0].innerText = $data.name;
- document.getElementById("professorName").innerText=$data.name;
-
- if($data.consultCount){
- document.getElementsByClassName("consultCount")[0].innerText = $data.consultCount;
- }else{
- document.getElementById("accessHistory").style.display="none";
- }
- var startLeval = parseInt($data.starLevel);
- var start = document.getElementsByClassName("start");
- for(var i = 0; i < startLeval; i++) {
- start[i].classList.add("icon-favorfill");
- start[i].classList.remove("icon-favor");
- }
- if($data.hasHeadImage) {
- document.getElementsByClassName("headimg")[0].src = baseUrl + "/images/head/" + $data.id + "_l.jpg";
- } else {
- document.getElementsByClassName("headimg")[0].src = "../images/default-photo.jpg";
- }
- if($data.authType) {
- nameli.classList.add('icon-vip');
- nameli.classList.add('authicon-cu');
- } else {
- if($data.authStatus){
- if($data.authentication==1){
- nameli.classList.add('icon-renzheng');
- nameli.classList.add('authicon-mana');
-
- }else if($data.authentication==2){
- nameli.classList.add('icon-renzheng');
- nameli.classList.add('authicon-staff');
-
- }else{
- nameli.classList.add('icon-renzheng');
- nameli.classList.add('authicon-stu');
-
- }
- }
- }
- if($data.orgName) {
- if($data.department) {
- personalMaterial[1].innerText = $data.orgName + ",";
- } else {
- if($data.address) {
- personalMaterial[1].innerText = $data.orgName+ " | ";
- } else {
- personalMaterial[1].innerText = $data.orgName
- }
- }
- }
- if($data.department) {
- if($data.address) {
- personalMaterial[2].innerText = $data.department + " | ";
- } else {
- personalMaterial[2].innerText = $data.department;
- }
- }
- if($data.address) {
- personalMaterial[3].innerText = $data.address;
- }
-
- if($data.descp) {
- personSummary.innerHTML = $data.descp;
- } else {
- document.getElementById("professorBreifinfo").style.display = "none";
- }
-
- if($data.resources.length) {
- professorResource($data.resources);
- } else {
- document.getElementById("professorresourceList").style.display = "none";
- }
-
- if(!$data.edus.length && !$data.jobs.length && !$data.projects.length && !$data.papers.length && !$data.patents.length && !$data.honors.length) {
- document.getElementById("detailProfessor").style.display = "none";
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- return;
- }
- });
- }
-
- document.getElementsByClassName("gotonext")[0].addEventListener("tap", function() {
- var nwaiting = plus.nativeUI.showWaiting();
- var web = plus.webview.create("../html/proinforbrow-more.html", "proinforbrow-more.html", {}, {
- pro: proId
- });
- web.addEventListener("loaded", function() {}, false);
- });
-
- personalMessage();
-
- mui("#resourceList").on('tap', 'li', function() {
- var resouId = this.getAttribute("resouseId");
- plus.nativeUI.showWaiting();
- plus.webview.create("../html/resinforbrow.html", 'resinforbrow.html', {}, {
- resourceId: resouId
- });
- });
-
- window.addEventListener('backproinfo', function(event) {
- var proid = event.detail.proId;
- console.log(proid);
-
- });
- ifCollection();
- yesExpert.addEventListener('tap', function() {
- var $this = this;
- if(userid && userid != null && userid != "null") {
- collectionExpert($this);
- } else {
- plus.nativeUI.toast("请先登录");
- }
- });
- noExpert.addEventListener('tap', function() {
- var $this = this;
- cancelCollectionExpert($this);
- });
-
- function ifCollection() {
- mui.ajax(baseUrl + '/ajax/watch/hasWatch', {
- data: {
- "professorId": userid,
- "watchObject": proId
- },
- dataType: 'json',
- type: 'get',
- timeout: 10000,
- async: false,
- success: function(data) {
- if(data.success && data.data != null) {
- yesExpert.style.display = "none";
- noExpert.style.display = "block";
- returnId = data.data.watchObject;
- } else {
- yesExpert.style.display = "block";
- noExpert.style.display = "none";
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- }
- });
- }
-
- function collectionExpert($this) {
- mui.ajax(baseUrl + '/ajax/watch', {
- data: {
- "professorId": userid,
- "watchObject": proId,
- "watchType": 1
- },
- dataType: 'json',
- type: 'POST',
- timeout: 10000,
- async: false,
- success: function(data) {
- console.log(data.success)
- if(data.success) {
- $this.style.display = "none";
- noExpert.style.display = "block";
- returnId = data.data;
-
- plus.nativeUI.toast("专家关注成功", toastStyle);
- }
- },
- error: function() {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- }
- });
- }
-
- function cancelCollectionExpert($this) {
-
-
- mui.ajax({
- url: baseUrl + '/ajax/watch/delete',
- data: {
- professorId: userid,
- watchObject: returnId
- },
- dataType: 'json',
- type: 'post',
- timeout: 10000,
- async: true,
- success: function(data) {
- console.log(data.success)
- if(data.success) {
- $this.style.display = "none";
- yesExpert.style.display = "block";
- plus.nativeUI.toast("取消关注成功", toastStyle);
- }
- },
- error: function(data) {
- plus.nativeUI.toast("服务器链接超时", toastStyle);
- }
- });
- }
-
- document.getElementById("accessHistory").addEventListener('tap', function() {
- mui.openWindow({
- url: '../html/coophistory-other.html',
- id: 'html/coophistory-other.html',
- show: {
- autoShow: false,
- },
- extras: {
- professorId: proId
- }
- });
- })
- });
|