portal html css js resource

patentShow.js 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. $(document).ready(function() {
  2. function Patent() {
  3. this.init();
  4. this.flag = GetQueryString("flag");
  5. }
  6. Patent.prototype.init = function() {
  7. loginStatus();
  8. ifcollectionAbout(GetQueryString("patentId"));
  9. this.ajax({
  10. url: "/ajax/ppatent/qo",
  11. data: {
  12. id: GetQueryString("patentId")
  13. },
  14. type: "get",
  15. Fun: this.patentMess
  16. });
  17. this.ajax({
  18. url: "/ajax/ppatent/authors",
  19. data: {
  20. id: GetQueryString("patentId")
  21. },
  22. type: "get",
  23. Fun: this.patentAuth
  24. });
  25. this.ajax({
  26. url: "/ajax/ppatent/incPageViews",
  27. data: {
  28. id: GetQueryString("patentId")
  29. },
  30. type: "post",
  31. Fun: this.pageview
  32. });
  33. }
  34. Patent.prototype.ajax = function(obj) {
  35. var $this = this;
  36. $.ajax({
  37. url: obj.url,
  38. data: obj.data,
  39. dataType: 'json', //服务器返回json格式数据
  40. type: obj.type, //HTTP请求类型
  41. timeout: 10000, //超时时间设置为10秒;
  42. traditional: true,
  43. success: function(data) {
  44. if(data.success) {
  45. obj.Fun(data.data, $this);
  46. }
  47. },
  48. error: function() {
  49. $this.Fail();
  50. }
  51. });
  52. }
  53. Patent.prototype.Fail = function() {
  54. $.MsgBox.Alert('提示', "服务器链接超时");
  55. }
  56. Patent.prototype.keyword = function($key) {
  57. console.log($key)
  58. for(var i in $key.split(",")) {
  59. if(this.flag == 1) {
  60. $("#paperSList").append("<li>" + $key.split(",")[i] + "<div class='closeThis'></div></li>");
  61. } else {
  62. $(".tagList").append("<li>" + $key.split(",")[i] + "</li>");
  63. }
  64. }
  65. }
  66. Patent.prototype.patentMess = function($data, $obj) {
  67. console.log($data);
  68. if($obj.flag == 1) {
  69. $(".advertItem,.tagList").hide();
  70. hotKey(".oinput", 10);
  71. if($data.keywords) {
  72. $obj.keyword($data.keywords);
  73. }
  74. } else {
  75. $(".oinput").parents(".form-item").hide();
  76. $(".conItem").hide();
  77. if($data.keywords) {
  78. $obj.keyword($data.keywords);
  79. } else {
  80. $(".tagList").hide();
  81. }
  82. }
  83. if($data.name) {
  84. $("#paperName").text($data.name);
  85. }
  86. $("#pageview").text($data.pageViews);
  87. if($data.reqCode) {
  88. $(".showCon").eq(0).text($data.reqCode);
  89. } else {
  90. $(".showCon").eq(0).parents("li").hide();
  91. }
  92. if($data.code) {
  93. $(".showCon").eq(1).text($data.code);
  94. } else {
  95. $(".showCon").eq(1).parents("li").hide();
  96. }
  97. $(".showCon").eq(2).text(TimeTr($data.reqDay));
  98. $(".showCon").eq(3).text(TimeTr($data.pubDay));
  99. $(".showCon").eq(4).text($data.authors.substring(0, $data.authors.length - 2));
  100. if($data.summary) {
  101. $(".showCon").eq(5).text($data.summary);
  102. }
  103. var weibotitle = $data.name;
  104. var weibourl = window.location.href;
  105. var weibopic = "http://" + window.location.host + "/images/default-resource.jpg";
  106. $("#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");
  107. }
  108. Patent.prototype.patentAuth = function($data, $obj) {
  109. console.log($data);
  110. if($data.length < 4) {
  111. $(".lastBtn").hide();
  112. } else {
  113. $(".lastBtn").find("span").text($data.length);
  114. }
  115. for(var i in $data) {
  116. if($data[i].professorId.substring(0, 1) == "#") {
  117. var otr = '<li class="flexCenter">' +
  118. '<div class="madiaHead useHead" id="userimg"></div>' +
  119. '<div class="madiaInfo">' +
  120. '<p class="ellipsisSty">' +
  121. '<span class="h1Font" id="name">' + $data[i].name + '</span>' +
  122. '</p>' +
  123. '</div>' +
  124. '</li>'
  125. $("#faM").prepend(otr);
  126. } else {
  127. $obj.ajax({
  128. url: "/ajax/professor/editBaseInfo/" + $data[i].professorId,
  129. data: {},
  130. type: "get",
  131. Fun: $obj.profess
  132. });
  133. }
  134. $obj.bindEvent($obj);
  135. }
  136. }
  137. Patent.prototype.profess = function($data, $obj) {
  138. console.log($data);
  139. var img;
  140. var oClass = autho($data.authType, $data.orgAuth, $data.authStatus);
  141. var csAuto, oId;
  142. var arr = [];
  143. arr[0] = $data.title || $data.office;
  144. arr[1] = $data.orgName || "";
  145. if(arr[0]) {
  146. if(arr[1]) {
  147. arr[2] = arr[0] + "," + arr[1]
  148. } else {
  149. arr[2] = arr[0];
  150. }
  151. } else {
  152. arr[2] = "";
  153. }
  154. if($data.hasHeadImage) {
  155. img = "/images/head/" + $data.id + "_l.jpg";
  156. } else {
  157. img = "../images/default-photo.jpg"
  158. }
  159. if($obj.flag == 1) {
  160. csAuto = "auto";
  161. oId = "#"
  162. } else {
  163. csAuto = "pointer";
  164. oId = $data.id;
  165. }
  166. var otr = '<li class="flexCenter" style="cursor:' + csAuto + ';" data-id="' + oId + '">' +
  167. '<div class="madiaHead useHead" id="userimg" style="background-image:url(' + img + ')"></div>' +
  168. '<div class="madiaInfo">' +
  169. '<p class="ellipsisSty">' +
  170. '<span class="h1Font" id="name">' + $data.name + '</span><em class="authiconNew ' + oClass.sty + '" title="' + oClass.title + '"></em>' +
  171. '</p>' +
  172. '<p class="h2Font ellipsisSty">' + arr[2] + '<p>' +
  173. '</div>' +
  174. '</li>'
  175. $("#faM").prepend(otr);
  176. }
  177. Patent.prototype.bindEvent = function($obj) {
  178. $("#faM").on("click", "li", function() {
  179. var oDataId = $(this).attr("data-id");
  180. if(oDataId.substring(0, 1) != "#")
  181. location.href = "userInforShow.html?professorId=" + oDataId
  182. })
  183. $('#attention em').click(function() {
  184. if(userid && userid != "null" && userid != null) {
  185. if($(this).is('.icon-collected')) {
  186. cancelCollectionAbout(GetQueryString("patentId"), 4)
  187. } else {
  188. collectionAbout(GetQueryString("patentId"), 4);
  189. }
  190. } else {
  191. $.MsgBox.Alert('提示', "请先登录再进行收藏");
  192. $("#mb_btn_ok").val("去登录");
  193. var aele = document.createElement('a');
  194. $("#mb_btnbox").append(aele);
  195. $("#mb_btnbox a").css({
  196. 'display': "block",
  197. 'width': '100%',
  198. 'height': '40px',
  199. 'position': 'absolute',
  200. 'bottom': '-6px',
  201. 'left': '0'
  202. });
  203. aele.setAttribute('href', '../login.html');
  204. }
  205. })
  206. $("body").on("click", ".closeThis", function() {
  207. if($(this).parent().length < 5) {
  208. $(this).parents(".keyResult").siblings("div").show();
  209. }
  210. $(this).parent().remove();
  211. });
  212. $("#release").on("click", function() {
  213. $.MsgBox.Confirm("提示", "确认发布该专利?", $obj.pubPatent);
  214. });
  215. $("#delete").on("click", function() {
  216. $.MsgBox.Confirm("提示", "确认删除该专利?", $obj.delePatent);
  217. });
  218. }
  219. Patent.prototype.pageview = function() {};
  220. Patent.prototype.captiureSubInd = function(subIndu) {
  221. var industrys = $("#" + subIndu + "").find("li");
  222. var industryAll = "";
  223. if(industrys.size() > 0) {
  224. for(var i = 0; i < industrys.size(); i++) {
  225. industryAll += industrys[i].innerText;
  226. industryAll += ',';
  227. };
  228. industryAll = industryAll.substring(0, industryAll.length - 1);
  229. }
  230. console.log(industryAll)
  231. return industryAll;
  232. }
  233. Patent.prototype.pubPatent = function() {
  234. var $key = oPent.captiureSubInd("paperSList");
  235. console.log($key)
  236. oPent.ajax({
  237. url: "/ajax/ppatent/kw",
  238. data: {
  239. id: GetQueryString("patentId"),
  240. keywords: $key
  241. },
  242. type: "post",
  243. Fun: oPent.pubsucess
  244. });
  245. }
  246. Patent.prototype.pubsucess = function() {
  247. $.MsgBox.Alert('提示', '资源发布成功!');
  248. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  249. location.href = "patentList.html"
  250. }
  251. Patent.prototype.delePatent = function() {
  252. oPent.ajax({
  253. url: "/ajax/ppatent/cAss",
  254. data: {
  255. id: GetQueryString("patentId"),
  256. uid:$.cookie("userid")
  257. },
  258. type: "post",
  259. Fun: oPent.delsucess
  260. });
  261. }
  262. Patent.prototype.delsucess = function() {
  263. location.href = "patentList.html"
  264. }
  265. var oPent = new Patent();
  266. })