|
$(document).ready(function() {
/*获取资源ID*/
var resourceId = GetQueryString("resourceId");
/*判断是否登录*/
loginStatus();
//填充学术领域
var subjectShow = function(data) {
if(data != undefined && data.length != 0) {
var subs = new Array();
if(data.indexOf(',')) {
subs = data.split(',');
} else {
subs[0] = data;
}
if(subs.length > 0) {
for(var i = 0; i < subs.length; i++) {
$("#subjectList").append("<li>" + subs[i] + "</li>")
};
}
}
}
//填充应用行业
var industryShow = function(data) {
if(data != undefined && data.length != 0) {
var subs = new Array();
if(data.indexOf(',')) {
subs = data.split(',');
} else {
subs[0] = data;
}
if(subs.length > 0) {
for(var i = 0; i < subs.length; i++) {
$("#industryList").append("<li>" + subs[i] + "</li>")
};
}
}
}
/*获取资源的数据的函数*/
var resourceData = function() {
$.ajax({
"url": "/ajax/resource/resourceInfo",
data: {
'resourceId': resourceId
},
"type": "get",
"async": true,
"success": function(info) {
if(info.success) {
var $info = info.data;
console.log(info);
$(".h2Font").text($info.resourceName);
$("#application").text($info.supportedServices);
if($info.subject) {
subjectShow($info.subject)
}else{
$("span:contains('学术领域')").hide();
}
if($info.industry) {
industryShow($info.industry)
}else{
$("span:contains('应用行业')").hide();
}
if($info.cooperationNotes) {
$("#cooperationNote").text($info.cooperationNotes);
}else{
$("span:contains('合作备注')").hide();
}
if(!$info.subject&&!$info.industry&&!$info.cooperationNotes){
$(".resAbout").hide();
}
if($info.images) {
$("#resouImg").attr("src", "/images/resource/" + $info.resourceId + ".jpg")
}
if($info.descp) {
$(".resMore").html($info.descp)
}
$("#nameS").text($info.professor.name);
if($info.professor.title) {
if($info.professor.office) {
$("#title").text($info.professor.title + ",");
} else {
$("#title").text($info.professor.title);
}
}
if($info.professor.office) {
$("#office").text($info.professor.office);
}
if($info.professor.department) {
$("#department").text($info.professor.department);
}
if($info.professor.orgName) {
$("#orgName").text($info.professor.orgName);
}
if($info.professor.address) {
$("#address").text($info.professor.address);
}
if($info.professor.hasHeadImage) {
$("#headImg").attr("src", "/images/head/" + $info.professorId + "_l.jpg")
}
} else {
$.MsgBox.Alert('消息提醒', "系统异常!");
}
},
"error": function() {
$.MsgBox.Alert('message', 'failed')
}
});
}
resourceData();
})
|