|
/*文章预览*/
$(function() {
loginStatus();//判断个人是否登录
valUser();
var articleId = GetQueryString("articleId");
articleshow();
relevantExperts();
relevantResources();
//文章内容
function articleshow(){
$.ajax({
"url" : "/ajax/article/query",
"type" : "GET" ,
"dataType" : "json",
"data" :{"articleId":articleId},
"success" : function(data) {
if (data.success){
$("#articleTitle").text(data.data.articleTitle);
$("#articleContent").html(data.data.articleContent);
$("#articleImg").attr("style", "background-image: url(/data/article/" + data.data.articleImg + ");");
$("#tagList").text(industryShow(data.data.subject));
if(data.data.articleType==1){
$("#expert").removeClass("displayNone");
expert(data.data.professorId);
}
if(data.data.articleType==2){
$("#enterprise").removeClass("displayNone");
cmpFun(data.data.orgId);
}
}
var articletitle = data.data.articleTitle + "-科袖网";
window.setTimeout(function() {
document.title = articletitle;
}, 500);
},
"error":function(){
$.MsgBox.Alert('提示','链接服务器超时')
}
});
}
//专家信息
function expert(professorId){
$.ajax({
"url" : "/ajax/professor/baseInfo/"+professorId,
"type" : "GET" ,
"dataType" : "json",
"success" : function(data) {
if (data.success && data.data){
if(data.data.hasHeadImage==1) {
$("#Zimg").attr("style", "background-image: url(/images/head/" + data.data.id + "_l.jpg);");
}
if(data.data.title==""){
var title = data.data.office;
}else{
var title = data.data.title;
}
$("#Zname").text(data.data.name);
$("#Ztitle").text(title);
$("#ZorgName").text(data.data.orgName);
var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
$("#ZauthFlag").attr("title", userType.title);
$("#ZauthFlag").addClass(userType.sty);
}
},
"error":function(){
$.MsgBox.Alert('提示','链接服务器超时')
}
});
}
/*企业用户信息*/
function cmpFun(orgId) {
$.ajax({
"url": "/ajax/org/" + orgId,
"type": "get",
"dataType" : "json",
"success": function(data) {
if(data.success && data.data) {
$("#Qname").text(data.data.name);
if(data.data.hasOrgLogo) {
$("#Qimg").attr("style", "background-image: url(/images/org/" + data.data.id + ".jpg);");
}
if(data.data.authStatus==3){
$("#QauthFlag").addClass("authicon-com-ok").attr("title", "认证企业");;
}
$("#Qindustry").text(QindustryShow(data.data.industry));
if(data.data.orgType==2){
$("#QorgType").text("上市企业");
}else if(data.data.orgType==3){
$("#QorgType").text("国有企业");
}else if(data.data.orgType==4){
$("#QorgType").text("合资企业");
}else if(data.data.orgType==5){
$("#QorgType").text("私人企业");
}else if(data.data.orgType==6){
$("#QorgType").text("外资企业");
}else if(data.data.orgType==7){
$("#QorgType").text("初创企业");
}else{
$("#QorgType").text("");
}
}
},
"error": function() {
$.MsgBox.Alert('提示', '链接服务器超时')
}
});
}
//相关专家
function relevantExperts(){
$.ajax({
"url": "/ajax/article/ralatePro",
"type": "get",
"dataType" : "json",
"data" :{"articleId":articleId},
"success": function(data) {
if(data.success && data.data) {
for(var i = 0; i < data.data.length; i++) {
var professorId = data.data[i].professorId;
relevantExpertsList(professorId)
}
}
},
"error": function() {
$.MsgBox.Alert('提示', '链接服务器超时')
}
});
}
//相关专家信息
function relevantExpertsList(professorId){
$.ajax({
"url" : "/ajax/professor/info/"+professorId,
"type" : "GET" ,
"dataType" : "json",
"success" : function(data) {
if (data.success && data.data!=""){
$("#relevantExperts").parent().parent().removeClass("displayNone");
var itemlist = '';
$("#trelevantExperts").html("");
var itemlist = '<li><a class="flexCenter">';
itemlist += '<div class="madiaHead useHead" id="userimg"></div>';
itemlist += '<div class="madiaInfo">';
itemlist += '<p><span class="h1Font" id="userName"></span><em class="authiconNew" title=""></em></p>';
itemlist += '<p class="ellipsisSty h2Font" id="usertitle"></p>';
itemlist += '<p class="h2Font ellipsisSty" id="researchAreas"></p>';
itemlist += '</div></a></li>';
$itemlist = $(itemlist);
$("#relevantExperts").append($itemlist);
var title = data.data.title || "";
var office = data.data.office || "";
if(title != "") {
title = title + " , ";
}
$itemlist.find("#userName").text(data.data.name);
$itemlist.find("#usertitle").text(title + office);
/*获取研究方向信息*/
var researchAreas = data.data.researchAreas;
if(researchAreas != ""){
var rlist = '研究方向:';
}else{
var rlist = '';
}
for(var n = 0; n < researchAreas.length; n++) {
//console.log(researchAreas[n].caption);
rlist += researchAreas[n].caption
if(n < researchAreas.length - 1) {
rlist += ";"
}
}
$itemlist.find("#researchAreas").text(rlist);
if(data.data.hasHeadImage == 1) {
$itemlist.find("#userimg").attr("style", "background-image: url(/images/head/" + data.data.id + "_l.jpg);");
}
var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
$itemlist.find(".authiconNew").attr("title", userType.title);
$itemlist.find(".authiconNew").addClass(userType.sty);
}
},
"error":function(){
$.MsgBox.Alert('提示','链接服务器超时')
}
});
}
//相关资源
function relevantResources(){
$.ajax({
"url": "/ajax/article/ralateRes",
"type": "get",
"dataType" : "json",
"data" :{"articleId":articleId},
"success": function(data) {
if(data.success && data.data) {
for(var i = 0; i < data.data.length; i++) {
var resourceId = data.data[i].resourceId;
relevantResourcesList(resourceId)
}
}
},
"error": function() {
$.MsgBox.Alert('提示', '链接服务器超时')
}
});
}
//相关资源信息
function relevantResourcesList(resourceId){
$.ajax({
"url" : "/ajax/resource/queryOne",
"type" : "GET" ,
"dataType" : "json",
"data" :{"resourceId":resourceId},
"success" : function(data) {
console.log(data);
if (data.success && data.data!=""){
$("#resources").parent().parent().removeClass("displayNone");
var itemlist = '<li><a href="" class="flexCenter urlgo">';
itemlist += '<div class="madiaHead resouseHead" id="userimg"></div>';
itemlist += '<div class="madiaInfo">';
itemlist += '<p class="h1Font" id="resourceName"></p>';
itemlist += '<p class="h2Font ellipsisSty" id="name"></p>';
itemlist += '<p><span class="h2Font uname"></span><em class="authiconNew" title="科袖认证专家"></em></p>';
itemlist += '</div></a></li>';
$itemlist = $(itemlist);
$("#resources").append($itemlist);
var datalist = data.data;
$itemlist.find("#resourceName").text(datalist.resourceName);
$itemlist.find("#name").text("用途:"+datalist.supportedServices);
$itemlist.find(".urlgo").attr("href", "resourceShow.html?resourceId="+datalist.resourceId);
if(datalist.images.length > 0) {
$itemlist.find("#userimg").attr("style", "background-image: url(/data/resource/" + datalist.images[0].imageSrc + ");");
}
if(datalist.resourceType==1){
$itemlist.find(".uname").text(datalist.editProfessor.name);
var userType = autho(datalist.editProfessor.authType, datalist.editProfessor.orgAuth, datalist.editProfessor.authStatus);
$itemlist.find(".authiconNew").attr("title", userType.title);
$itemlist.find(".authiconNew").addClass(userType.sty);
}
if(datalist.resourceType==2){
$itemlist.find(".uname").text(datalist.organization.name);
if(datalist.organization.authStatus==3){
$itemlist.find(".authiconNew").addClass("authicon-com-ok").attr("title", "认证企业");
}
}
}
},
"error":function(){
$.MsgBox.Alert('提示','链接服务器超时')
}
});
}
//拆解关键字
function industryShow(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++)
{
$("#tagList").append('<li><p class="h2Font">'+ subs[i] +'</p></li>');
};
}
}
}
//拆解企业应用行业
function QindustryShow(data){
if(data != undefined && data.length != 0 ){
var subs = new Array();
subs = data.replace(',',' | ');
if(subs.length>0){
for (var i = 0; i < subs.length; i++)
{
$("#Qindustry").append(subs[i]);
};
}
}
}
});
|