123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- $(document).ready(function() {
- function Patent() {
- this.init();
- this.flag = GetQueryString("flag");
- }
- Patent.prototype.init = function() {
- loginStatus();
- ifcollectionAbout(GetQueryString("patentId"));
- 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
- });
- this.ajax({
- url: "/ajax/ppatent/incPageViews",
- data: {
- id: GetQueryString("patentId")
- },
- type: "post",
- Fun: this.pageview
- });
- }
- Patent.prototype.ajax = function(obj) {
- var $this = this;
- $.ajax({
- url: obj.url,
- data: obj.data,
- dataType: 'json',
- type: obj.type,
- timeout: 10000,
- 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) {
- console.log($key)
- for(var i in $key.split(",")) {
- if(this.flag == 1) {
- $("#paperSList").append("<li>" + $key.split(",")[i] + "<div class='closeThis'></div></li>");
- } else {
- $(".tagList").append("<li>" + $key.split(",")[i] + "</li>");
- }
- }
- }
- Patent.prototype.patentMess = function($data, $obj) {
- console.log($data);
- if($obj.flag == 1) {
- $(".advertItem,.tagList").hide();
- hotKey(".oinput", 10);
- if($data.keywords) {
- $obj.keyword($data.keywords);
- }
- } else {
- $(".oinput").parents(".form-item").hide();
- $(".conItem").hide();
- if($data.keywords) {
- $obj.keyword($data.keywords);
- } else {
- $(".tagList").hide();
- }
- }
- 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);
- }
- var weibotitle = $data.name;
- var weibourl = window.location.href;
- var weibopic = "http://" + window.location.host + "/images/default-resource.jpg";
- $("#weibo").attr("href", "http://service.weibo.com/share/share.php?appkey=3677230589&title=" + encodeURIComponent(weibotitle) + "&url=" + encodeURIComponent(weibourl) + "&pic=" + encodeURIComponent(weibopic) + "&content=utf-8" + "&ralateUid=6242830109&searchPic=false&style=simple");
- }
- Patent.prototype.patentAuth = function($data, $obj) {
- console.log($data);
- if($data.length < 4) {
- $(".lastBtn").hide();
- } else {
- $(".lastBtn").find("span").text($data.length);
- }
- for(var i in $data) {
- if($data[i].professorId.substring(0, 1) == "#") {
- var otr = '<li class="flexCenter">' +
- '<div class="madiaHead useHead" id="userimg"></div>' +
- '<div class="madiaInfo">' +
- '<p class="ellipsisSty">' +
- '<span class="h1Font" id="name">' + $data[i].name + '</span>' +
- '</p>' +
- '</div>' +
- '</li>'
- $("#faM").prepend(otr);
- } else {
- $obj.ajax({
- url: "/ajax/professor/editBaseInfo/" + $data[i].professorId,
- data: {},
- type: "get",
- Fun: $obj.profess
- });
- }
- $obj.bindEvent($obj);
- }
- }
- Patent.prototype.profess = function($data, $obj) {
- console.log($data);
- var img;
- var oClass = autho($data.authType, $data.orgAuth, $data.authStatus);
- var csAuto, oId;
- 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"
- }
- if($obj.flag == 1) {
- csAuto = "auto";
- oId = "#"
- } else {
- csAuto = "pointer";
- oId = $data.id;
- }
- var otr = '<li class="flexCenter" style="cursor:' + csAuto + ';" data-id="' + oId + '">' +
- '<div class="madiaHead useHead" id="userimg" style="background-image:url(' + img + ')"></div>' +
- '<div class="madiaInfo">' +
- '<p class="ellipsisSty">' +
- '<span class="h1Font" id="name">' + $data.name + '</span><em class="authiconNew ' + oClass.sty + '" title="' + oClass.title + '"></em>' +
- '</p>' +
- '<p class="h2Font ellipsisSty">' + arr[2] + '<p>' +
- '</div>' +
- '</li>'
- $("#faM").prepend(otr);
- }
- Patent.prototype.bindEvent = function($obj) {
- $("#faM").on("click", "li", function() {
- var oDataId = $(this).attr("data-id");
- if(oDataId.substring(0, 1) != "#")
- location.href = "userInforShow.html?professorId=" + oDataId
- })
- $('#attention em').click(function() {
- if(userid && userid != "null" && userid != null) {
- if($(this).is('.icon-collected')) {
- cancelCollectionAbout(GetQueryString("patentId"), 4)
- } else {
- collectionAbout(GetQueryString("patentId"), 4);
- }
- } else {
- $.MsgBox.Alert('提示', "请先登录再进行收藏");
- $("#mb_btn_ok").val("去登录");
- var aele = document.createElement('a');
- $("#mb_btnbox").append(aele);
- $("#mb_btnbox a").css({
- 'display': "block",
- 'width': '100%',
- 'height': '40px',
- 'position': 'absolute',
- 'bottom': '-6px',
- 'left': '0'
- });
- aele.setAttribute('href', '../login.html');
- }
- })
- $("body").on("click", ".closeThis", function() {
- if($(this).parent().length < 5) {
- $(this).parents(".keyResult").siblings("div").show();
- }
- $(this).parent().remove();
- });
- $("#release").on("click", function() {
- $.MsgBox.Confirm("提示", "确认发布该专利?", $obj.pubPatent);
- });
- $("#delete").on("click", function() {
- $.MsgBox.Confirm("提示", "确认删除该专利?", $obj.delePatent);
- });
- }
- Patent.prototype.pageview = function() {};
- Patent.prototype.captiureSubInd = function(subIndu) {
- var industrys = $("#" + subIndu + "").find("li");
- var industryAll = "";
- if(industrys.size() > 0) {
- for(var i = 0; i < industrys.size(); i++) {
- industryAll += industrys[i].innerText;
- industryAll += ',';
- };
- industryAll = industryAll.substring(0, industryAll.length - 1);
- }
- console.log(industryAll)
- return industryAll;
- }
- Patent.prototype.pubPatent = function() {
- var $key = oPent.captiureSubInd("paperSList");
- console.log($key)
- oPent.ajax({
- url: "/ajax/ppatent/kw",
- data: {
- id: GetQueryString("patentId"),
- keywords: $key
- },
- type: "post",
- Fun: oPent.pubsucess
- });
- }
- Patent.prototype.pubsucess = function() {
- $.MsgBox.Alert('提示', '资源发布成功!');
- $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
- location.href = "patentList.html"
- }
- Patent.prototype.delePatent = function() {
- oPent.ajax({
- url: "/ajax/ppatent/cAss",
- data: {
- id: GetQueryString("patentId"),
- uid:$.cookie("userid")
- },
- type: "post",
- Fun: oPent.delsucess
- });
- }
- Patent.prototype.delsucess = function() {
- location.href = "patentList.html"
- }
- var oPent = new Patent();
- })
|