$(document).ready(function() { function Patent() { this.init(); } Patent.prototype.init = function() { this.ajax({ url: "/ajax/ppatent/qo", data: { id: GetQueryString("patentId") }, type: "get", Fun: this.patentMess }); this.ajax({ url: "/ajax/ppatent/authors", data: { id: GetQueryString("patentId") }, type: "get", Fun: this.patentAuth }); } Patent.prototype.ajax = function(obj) { var $this=this; $.ajax({ url: obj.url, data: obj.data, dataType: 'json', //服务器返回json格式数据 type: obj.type, //HTTP请求类型 timeout: 10000, //超时时间设置为10秒; traditional: true, success: function(data) { if(data.success) { obj.Fun(data.data,$this); } }, error: function() { $this.Fail(); } }); } Patent.prototype.Fail = function() { $.MsgBox.Alert('提示', "服务器链接超时"); } Patent.prototype.keyword = function($key) { for(var i in $key.split(",")) { $("#tagList").append("
  • " + $key.split(",")[i] + "
  • "); } } Patent.prototype.patentMess = function($data,$obj) { console.log($data); if($data.name) { $("#paperName").text($data.name); } $("#pageview").text($data.pageViews); if($data.reqCode) { $(".showCon").eq(0).text($data.reqCode); } else { $(".showCon").eq(0).parents("li").hide(); } if($data.code) { $(".showCon").eq(1).text($data.code); } else { $(".showCon").eq(1).parents("li").hide(); } $(".showCon").eq(2).text(TimeTr($data.reqDay)); $(".showCon").eq(3).text(TimeTr($data.pubDay)); $(".showCon").eq(4).text($data.authors.substring(0, $data.authors.length - 2)); if($data.summary) { $(".showCon").eq(5).text($data.summary); } if($data.keywords) { $obj.keyword($data.keywords); } } Patent.prototype.patentAuth = function($data,$obj) { for(var i in $data) { if($data[i].professorId.substring(0, 1) == "#") { var otr = '
  • ' + '
    ' + '
    ' + '

    ' + '' + $data[i].name + '' + '

    ' + '
    ' + '
  • ' $("#faM").append(otr); } else { $obj.ajax({ url: "/ajax/professor/editBaseInfo/" + $data[i].professorId, data: {}, type: "get", Fun: $obj.profess }); } } } Patent.prototype.profess = function($data) { console.log($data); var img; var oClass = autho($data.authType, $data.orgAuth, $data.authStatus); var arr=[]; arr[0] = $data.title||$data.office; arr[1]=$data.orgName||""; if(arr[0]) { if(arr[1]) { arr[2]=arr[0]+","+arr[1] }else{ arr[2]=arr[0]; } }else{ arr[2]=""; } if($data.hasHeadImage) { img = "/images/head/" + $data.id + "_l.jpg"; } else { img = "../images/default-photo.jpg" } var otr = '
  • ' + '
    ' + '
    ' + '

    ' + '' + $data.name + '' + '

    ' + '

    '+arr[2]+'

    '+ '

    ' + '
  • ' $("#faM").append(otr); } var oPent = new Patent(); })