123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- $(document).ready(function() {
- $(".jqzoom").imagezoom();
- $("#thumblist").on("click", "li a", function() {
- $(this).parents("li").addClass("tb-selected").siblings().removeClass("tb-selected");
- $(".jqzoom").attr('src', $(this).find("img").attr("src"));
- $(".jqzoom").attr('rel', $(this).find("img").attr("src"));
- });
- $('.shareWeixin').hover(function() {
- $('.shareCode').stop(true, false).fadeToggle();
- });
- var resourceId = GetQueryString("resourceId");
- var professorId = "";
- getRecourceMe();
-
- function getRecourceMe() {
- $.ajax({
- "url": "/ajax/resource/queryOne",
- "type": "GET",
- "success": function(data) {
- console.log(data);
- if(data.success) {
- resourceHtml(data.data);
- }
- },
- "data": {
- "resourceId": resourceId
- },
- dataType: "json",
- 'error': function() {
- $.MsgBox.Alert('提示', '服务器连接超时!');
- }
- });
- }
-
- function outHTML(selecter) {
- var getValue = selecter;
- var aa = "";
- if(getValue) {
- var endValue = ((getValue.replace(/<(.+?)>/gi, "<$1>")).replace(/ /gi, " ")).replace(/\n/gi, "|");
- var cc = endValue.split("|");
- for(var i = 0; i < cc.length; i++) {
- aa += cc[i] + '<br/>'
- }
- }
- return aa;
- }
-
- function resourceHtml($da) {
- $("#resourceName").text($da.resourceName);
- $("#application").text($da.supportedServices);
- if($da.orgName) {
- $("#organizationName").text($da.orgName).parents("li").show();
- }
- $("#nameS").text($da.editProfessor.name);
- if($da.editProfessor.title) {
- $("#titleOffice").text($da.editProfessor.title);
- } else {
- if($da.editProfessor.office) {
- $("#titleOffice").text($da.editProfessor.office);
- }
- }
- if($da.editProfessor.orgName) {
- $("#orgType").text($da.editProfessor.orgName);
- }
- professorId = $da.editProfessor.id;
- var professorFlag = autho($da.editProfessor.authType, $da.editProfessor.orgAuth, $da.editProfessor.authStatus);
- $("#authFlag").addClass(professorFlag.sty).attr("title", professorFlag.title);
- if($da.editProfessor.hasHeadImage == 1) {
- $("#headImg").css("background-image", 'url(/images/head/' + $da.editProfessor.id + '_l.jpg)');
- }
- if($da.spec) {
- $("#modelNumber").text($da.spec).parents("li").show();
- }
- if($da.parameter) {
- $("#performancePa").html(outHTML($da.parameter)).parents("li").show();
- }
- if($da.cooperationNotes) {
- $("#remarkContent").html(outHTML($da.cooperationNotes)).parents("li").show();
- }
- if($da.subject) {
- var oSub = $da.subject.split(",");
- interestingResources(oSub);
- var oSt = "";
- for(var i = 0; i < oSub.length; i++) {
- oSt += '<li><p class="h2Font">' + oSub[i] + '</p></li>'
- }
- $(".tagList").html(oSt);
- }
- if($da.descp) {
- $("#descp").html($da.descp).parents("li").show();
- }
-
- if($da.images.length) {
- $("#firstFigure").attr({
- "src": "/data/resource/" + $da.images[0].imageSrc,
- "rel": "/data/resource/" + $da.images[0].imageSrc
- }).parent().attr("href", "/data/resource/" + $da.images[0].imageSrc);
- var arr = "";
- for(var i = 0; i < $da.images.length; i++) {
- if($da.images[i] == $da.images[0]) {
- var oString = '<li class="tb-selected">' +
- '<div class="tb-pic tb-s66">' +
- '<a href="javascript:void(0);">' +
- '<img src="/data/resource/' + $da.images[i].imageSrc + '"/>' +
- '</a>' +
- '</div>' +
- '</li>'
- } else {
- var oString = '<li >' +
- '<div class="tb-pic tb-s66">' +
- '<a href="javascript:void(0);">' +
- '<img src="/data/resource/' + $da.images[i].imageSrc + '"/>' +
- '</a>' +
- '</div>' +
- '</li>'
- }
- arr += oString;
- }
- $("#thumblist").html(arr);
- }
- }
-
- $("#nameS,#headImg").click(function() {
- location.href = "information-brow.html?professorId=" + professorId;
- })
-
- function relatedArticles() {
- $.ajax({
- "url": "/ajax/resource/articles",
- "type": "GET",
- "success": function(data) {
- console.log(data);
- if(data.success) {
- relatedArticlesHtml(data.data);
- }
- },
- "data": {
- "resourceId": resourceId,
- "rows": 5
- },
- dataType: "json",
- 'error': function() {
- $.MsgBox.Alert('提示', '服务器连接超时!');
- }
- });
- }
- relatedArticles();
-
- function relatedArticlesHtml($html) {
- for(var i = 0; i < $html.length; i++) {
- (function(n) {
- $.ajax({
- "url": "/ajax/professor/baseInfo/" + $html[i].article.professorId,
- "type": "GET",
- "success": function(data) {
- if(data.success) {
- var stl = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
- var str = ""
- str += '<li>'
- if($html[n].article.articleImg) {
- str += '<div class="madiaHead artHead" style="background-image: url(/data/article/' + $html[n].article.articleImg + ')"></div>'
- } else {
- str += '<div class="madiaHead artHead"></div>'
- }
- str += '<div class="madiaInfo">'
- str += '<p class="h1Font ellipsisSty-2">' + $html[n].article.articleTitle + '</p>'
- str += '<p><span class="h1Font">' + data.data.name + '</span><em class="authiconNew ' + stl.sty + '" title="' + stl.title + '"></em></p>'
- str += '</div></li>'
- $("#oArticle").append(str);
- }
- },
- 'dataType': "json",
- 'error': function() {
- $.MsgBox.Alert('提示', '服务器连接超时!');
- }
- });
- })(i);
- }
- }
-
- function interestingResources(arry) {
- $.ajax({
- "url": "/ajax/resource/ralateRes",
- "type": "GET",
- "success": function(data) {
- console.log(data);
- if(data.success) {
- interestingResourcesHtml(data.data);
- }
- },
- "data": {
- "keys": arry
- },
- "traditional":true,
- dataType: "json",
- 'error': function() {
- $.MsgBox.Alert('提示', '服务器连接超时!');
- }
- });
- }
-
- function interestingResourcesHtml($respond) {
- for(var i=0;i<$respond.length;i++) {
- var oStr='';
- if($respond[i].images.length) {
- oStr+='<li><div class="madiaHead resouseHead"style="background-image: url(/data/resource/'+$respond[i].images[0].imageSrc+')"></div>'
- }else {
- oStr+='<li><div class="madiaHead resouseHead"></div>'
- }
- oStr+='<div class="madiaInfo">'
- oStr+='<p class="h1Font">'+$respond[i].resourceName+'</p>'
- oStr+='<p class="h2Font ellipsisSty">用途:<span>'+$respond[i].supportedServices+'</span></p>'
-
- oStr+='</div></li>'
- $("#resourceList").append(oStr);
- }
- }
- })
|