$(document).ready(function() {
loginStatus(); //判断个人是否登录
var userid = $.cookie("userid");
var sevriceId = GetQueryString("sevriceId");
if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {
location.href = "http://" + window.location.host + "/e/r.html?id=" + sevriceId;
}
$(".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();
});
function ajaxRequist(url, obj, type, fn) {
$.ajax({
url: url,
data: obj,
dataType: 'json', //服务器返回json格式数据
type: type, //支持'GET'和'POST'
traditional: true,
success: function(data) {
if(data.success) {
fn(data)
}
},
error: function(xhr, type, errorThrown) {
$.MsgBox.Alert('提示', '服务器请求失败');
}
});
}
ifcollectionAbout(sevriceId, $("#attention").find("em"), 2)
var professorId = "";
getRecourceMe();
//热门资源
/*获取服务信息*/
function getRecourceMe() {
$.ajax({
"url": "/ajax/ware/qo",
"type": "GET",
"success": function(data) {
if(data.success) {
resourceHtml(data.data);
var resourceName = data.data.name + "-科袖网";
document.title = resourceName;
}
},
"data": {
"id": sevriceId
},
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] + '
'
}
}
return aa;
}
/*处理资源html代码*/
function resourceHtml($da) {
$("#resourceName").text($da.name); //名字
if($da.cnt){
$("#application").text($da.cnt); //应用用途
}else{
$("#application").parent().hide();
}
if($da.category == 1) {
ajaxRequist("/ajax/professor/baseInfo/" + $da.owner, {}, "get", function(data) {
$da.editProfessor = data.data;
$("#person").show();
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;
if(userid != professorId) {
ifcollectionAbout(professorId, $("#person").find(".attenSpan"), 1)
$(".goSpan").show();
}
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)');
} else {
$("#headImg").css("background-image", 'url(../images/default-photo.jpg)');
}
})
} else {
ajaxRequist("/ajax/org/" + $da.owner, {}, "get", function(data) {
$da.organization = data.data;
$("#enterprise").show();
if($da.organization.hasOrgLogo) {
$("#companyImg").attr("src", "/images/org/" + $da.organization.id + ".jpg");
} else {
$("#companyImg").attr("src", "/images/default-icon.jpg");
}
if($da.organization.authStatus == 3) {
$("#QauthFlag").addClass("authicon-com-ok").attr("title", "认证企业");
}
if($da.organization.forShort) {
$("#Qname").text($da.organization.forShort).attr("href", "cmpInforShow.html?orgId=" + $da.organization.id);
} else {
$("#Qname").text($da.organization.name).attr("href", "cmpInforShow.html?orgId=" + $da.organization.id);
}
if($da.organization.industry) {
$("#Qindustry").text($da.organization.industry.replace(/,/gi, " | "));
}
if(userid) {
ifcollectionAbout($da.organization.id, $("#enterprise").find(".attenSpan"), 6)
}
})
}
if($da.cooperation) { //合作备注
$("#remarkContent").html(outHTML($da.cooperation)).parents("li").show();
}
if($da.keywords) {
var oSub = $da.keywords.split(",");
var oSt = "";
for(var i = 0; i < oSub.length; i++) {
oSt += '
' + oSub[i] + '
' + $respond.resourceName + '
'; itemlist += '用途:' + $respond.supportedServices + '
'; itemlist += '' oSt += '' + $res.name + '' oSt += '
' oSt += '' + oTitle + '
' oSt += '