portal html css js resource

patentShow.js 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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"),$(".attenSpan").eq(0),4);
  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. async:false,
  44. success: function(data) {
  45. if(data.success) {
  46. obj.Fun(data.data, $this);
  47. }
  48. },
  49. error: function() {
  50. $this.Fail();
  51. }
  52. });
  53. }
  54. Patent.prototype.Fail = function() {
  55. $.MsgBox.Alert('提示', "服务器链接超时");
  56. }
  57. Patent.prototype.keyword = function($key) {
  58. for(var i in $key.split(",")) {
  59. if(GetQueryString("flag")== 1) {
  60. if($key.split(",").length>=5) {
  61. $(".oinput").parents(".col-w-12").hide();
  62. }
  63. $("#paperSList").append("<li><p class='h2Font'>" + $key.split(",")[i] + "</p><div class='closeThis'></div></li>");
  64. } else {
  65. $(".tagList").append("<li><p class='h2Font'>" + $key.split(",")[i] + "</p></li>");
  66. }
  67. }
  68. }
  69. Patent.prototype.patentMess = function($data, $obj) {
  70. if(GetQueryString("flag") == 1) {
  71. $(".advertItem,.tagList").hide();
  72. hotKey(".oinput", 10);
  73. if($data.keywords) {
  74. $obj.keyword($data.keywords);
  75. }
  76. } else {
  77. $(".oinput").parents(".form-item").hide();
  78. $(".conItem").hide();
  79. if($data.keywords) {
  80. $obj.keyword($data.keywords);
  81. } else {
  82. $(".tagList").hide();
  83. }
  84. }
  85. if($data.name) {
  86. $("#paperName").text($data.name);
  87. document.title=$data.name;
  88. }
  89. $("#pageview").text($data.pageViews);
  90. if($data.reqCode) {
  91. $(".showCon").eq(0).text($data.reqCode);
  92. } else {
  93. $(".showCon").eq(0).parents("li").hide();
  94. }
  95. if($data.code) {
  96. $(".showCon").eq(1).text($data.code);
  97. } else {
  98. $(".showCon").eq(1).parents("li").hide();
  99. }
  100. $(".showCon").eq(2).text(TimeTr($data.reqDay));
  101. $(".showCon").eq(3).text(TimeTr($data.pubDay));
  102. $(".showCon").eq(4).text($data.reqPerson);
  103. if($data.summary) {
  104. $(".showCon").eq(5).text($data.summary);
  105. }
  106. var weibotitle = $data.name;
  107. var weibourl = window.location.href;
  108. var weibopic = "http://" + window.location.host + "/images/default-patent.jpg";
  109. $("#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");
  110. $obj.bindEvent($obj);
  111. }
  112. Patent.prototype.patentAuth = function($data, $obj) {
  113. for(var i in $data) {
  114. if($data[i].professorId.substring(0, 1) == "#") {
  115. var otr = '<li class="flexCenter"><a data-id="'+ $data[i].professorId +'">' +
  116. '<div class="madiaHead useHead" id="userimg"></div>' +
  117. '<div class="madiaInfo">' +
  118. '<p class="ellipsisSty">' +
  119. '<span class="h1Font" id="name">' + $data[i].name + '</span>' +
  120. '</p>' +
  121. '</div></a>'
  122. if($data[i].name==$.cookie("userName")){
  123. otr += '<div class="goSpan"><span class="ifMe" nflag="1">是我本人</span></div>'
  124. }else{
  125. otr += '<div class="goSpan"><span class="yaoqing">邀请'+
  126. '<div class="shareCode clearfix"><div class="floatL qrcodeUser"></div>'+
  127. '<div class="shareWord floatR"><p>打开微信“扫一扫”,<br/>打开网页后点击屏幕右上角“分享”按钮</p></div>'+
  128. '</div></span></div>'
  129. }
  130. otr += '</li>'
  131. $("#faM .lastBtn").before(otr);
  132. } else {
  133. $obj.ajax({
  134. url: "/ajax/professor/editBaseInfo/" + $data[i].professorId,
  135. data: {},
  136. type: "get",
  137. Fun: $obj.profess
  138. });
  139. }
  140. if($data.length<5){
  141. $("#faM li").css("display","block");
  142. $(".lastBtn").hide();
  143. }else{
  144. $(".lastBtn").find("span").text($data.length);
  145. $("#faM li:lt(3)").css("display","block");
  146. }
  147. if(GetQueryString("flag") == 1){
  148. $("#faM li").css("display","block");
  149. $("#faM li .goSpan").hide();
  150. $(".lastBtn").hide();
  151. }
  152. }
  153. //邀请
  154. $(".goSpan").on("mouseenter",".yaoqing",function(){
  155. $(this).find('.shareCode').stop(true,false).fadeIn();
  156. }).on("mouseleave",".yaoqing",function(){
  157. $(this).find('.shareCode').stop(true,false).fadeOut();
  158. });
  159. //邀请作者
  160. var Qcu=document.getElementsByClassName("qrcodeUser");
  161. for(var i=0;i<Qcu.length;i++){
  162. var qrcode= new QRCode(Qcu[i], {
  163. width : 100,
  164. height : 100
  165. });
  166. makeCode();
  167. }
  168. function makeCode(){
  169. var hurl = window.location.host;
  170. if(userid) {
  171. var elurl = "http://" + hurl + "/e/I.html?i=" + s16to64(GetQueryString("patentId"))+"&d="+s16to64(userid);
  172. } else{
  173. var elurl = "http://" + hurl + "/e/I.html?i=" + s16to64(GetQueryString("patentId"));
  174. }
  175. qrcode.makeCode(elurl);
  176. }
  177. //是我本人
  178. $(".goSpan").on("click",".ifMe",function(){
  179. var oF=$(this).attr("nflag");
  180. if(oF==1){
  181. $.MsgBox.Confirm("提示", "确认这是您发表的专利?", daoRuPatent);
  182. $(this).attr("nflag","0");
  183. }else{
  184. return;
  185. }
  186. });
  187. function daoRuPatent(){
  188. $.ajax({
  189. "url": "/ajax/ppatent/ass",
  190. "type": "POST",
  191. "data": {
  192. id:GetQueryString("patentId"),
  193. uid:$.cookie("userid"),
  194. author:$.cookie("userName")
  195. },
  196. dataType: "json",
  197. "success": function(data) {
  198. if(data.success) {
  199. if(data.data){
  200. $(".ifMe").text("导入成功").css("background","#ccc");
  201. }
  202. }
  203. },
  204. 'error': function() {
  205. $.MsgBox.Alert('提示', '服务器连接超时!');
  206. }
  207. });
  208. }
  209. }
  210. Patent.prototype.profess = function($data, $obj) {
  211. var img;
  212. var oClass = autho($data.authType, $data.orgAuth, $data.authStatus);
  213. var csAuto, oId;
  214. var arr = [];
  215. arr[0] = $data.title || $data.office;
  216. arr[1] = $data.orgName || "";
  217. if(arr[0]) {
  218. if(arr[1]) {
  219. arr[2] = arr[0] + "," + arr[1]
  220. } else {
  221. arr[2] = arr[0];
  222. }
  223. } else {
  224. arr[2] = "";
  225. }
  226. if($data.hasHeadImage) {
  227. img = "/images/head/" + $data.id + "_l.jpg";
  228. } else {
  229. img = "../images/default-photo.jpg"
  230. }
  231. oId = $data.id;
  232. var otr = '<li class="flexCenter"><a href="" data-id="' + oId + '">' +
  233. '<div class="madiaHead useHead" id="userimg" style="background-image:url(' + img + ')"></div>' +
  234. '<div class="madiaInfo" style="margin-top:-8px">' +
  235. '<p class="ellipsisSty">' +
  236. '<span class="h1Font" id="name">' + $data.name + '</span><em class="authiconNew ' + oClass.sty + '" title="' + oClass.title + '"></em>' +
  237. '</p>' +
  238. '<p class="h2Font ellipsisSty">' + arr[2] + '<p>' +
  239. '</div></a>'
  240. if(oId==userid){
  241. otr += ''
  242. }else{
  243. otr += '<div class="goSpan"><span class="attenSpan">关注</span></div>'
  244. }
  245. otr += '</li>'
  246. var $otr=$(otr);
  247. $("#faM .lastBtn").before($otr);
  248. ifcollectionAbout(oId,$otr.find(".attenSpan"),1);
  249. }
  250. Patent.prototype.bindEvent = function($obj) {
  251. $("#faM").on("click", "li>a", function() {
  252. if(GetQueryString("flag") !=1){
  253. var oDataId = $(this).attr("data-id");
  254. if(oDataId.substring(0,1)!="#"){
  255. $(this).attr("href","userInforShow.html?professorId="+oDataId);
  256. }else{
  257. $(this).attr("href","javascript:void(0)");
  258. }
  259. }else{
  260. $(this).attr("href","javascript:void(0)");
  261. }
  262. })
  263. $('#attention em').click(function() {
  264. if(userid && userid != "null" && userid != null) {
  265. if($(this).is('.icon-collected')) {
  266. cancelCollectionAbout(GetQueryString("patentId"),$(this), 4);
  267. } else {
  268. collectionAbout(GetQueryString("patentId"),$(this), 4);
  269. }
  270. } else {
  271. $.MsgBox.Alert('提示', "请先登录再进行收藏");
  272. $("#mb_btn_ok").val("去登录");
  273. var aele = document.createElement('a');
  274. $("#mb_btnbox").append(aele);
  275. $("#mb_btnbox a").css({
  276. 'display': "block",
  277. 'width': '100%',
  278. 'height': '40px',
  279. 'position': 'absolute',
  280. 'bottom': '-6px',
  281. 'left': '0'
  282. });
  283. aele.setAttribute('href', '../login.html');
  284. }
  285. })
  286. $("body").on("click", ".closeThis", function() {
  287. if($(this).parent().length < 5) {
  288. $(this).parents(".keyResult").siblings("div").show();
  289. }
  290. $(this).parent().remove();
  291. });
  292. $("#release").on("click", function() {
  293. $.MsgBox.Confirm("提示", "确认发布该专利?", $obj.pubPatent);
  294. });
  295. $("#delete").on("click", function() {
  296. $.MsgBox.Confirm("提示", "确认删除该专利?", $obj.delePatent);
  297. });
  298. $(".lastBtn").on("click", function() {
  299. $("#faM li").css("display","block");
  300. $(this).hide();
  301. });
  302. $(".tagList").on("click","li",function() {
  303. location.href = "searchNew.html?searchContent=" + $(this).text() + "&tagflag=5";
  304. });
  305. //点击关注按钮
  306. $("#faM").on('click',"span.attenSpan", function() {
  307. var pId=$(this).parent().siblings("a").attr("data-id");
  308. if(userid && userid != null && userid != "null") {
  309. if($(this).is('.attenedSpan')){
  310. cancelCollectionAbout(pId, $(this),1)
  311. } else {
  312. collectionAbout(pId, $(this),1);
  313. }
  314. }else{
  315. $.MsgBox.Alert("提示", "请先登录再进行关注");
  316. $("#mb_btn_ok").val("去登录");
  317. var aele = document.createElement('a');
  318. $("#mb_btnbox").append(aele);
  319. $("#mb_btnbox a").css({
  320. 'display': "block",
  321. 'width': '100%',
  322. 'height': '40px',
  323. 'position': 'absolute',
  324. 'bottom': '-6px',
  325. 'left': '0'
  326. });
  327. aele.setAttribute('href', '../login.html');
  328. }
  329. });
  330. }
  331. Patent.prototype.pageview = function() {};
  332. Patent.prototype.captiureSubInd = function(subIndu) {
  333. var industrys = $("#" + subIndu + "").find("li");
  334. var industryAll = "";
  335. if(industrys.size() > 0) {
  336. for(var i = 0; i < industrys.size(); i++) {
  337. industryAll += industrys[i].innerText;
  338. industryAll += ',';
  339. };
  340. industryAll = industryAll.substring(0, industryAll.length - 1);
  341. }
  342. return industryAll;
  343. }
  344. Patent.prototype.pubPatent = function() {
  345. var $key = oPent.captiureSubInd("paperSList");
  346. oPent.ajax({
  347. url: "/ajax/ppatent/kw",
  348. data: {
  349. id: GetQueryString("patentId"),
  350. keywords: $key
  351. },
  352. type: "post",
  353. Fun: oPent.pubsucess
  354. });
  355. }
  356. Patent.prototype.pubsucess = function() {
  357. $.MsgBox.Alert('提示', '专利发布成功!');
  358. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  359. location.href = "patentList.html"
  360. }
  361. Patent.prototype.delePatent = function() {
  362. oPent.ajax({
  363. url: "/ajax/ppatent/cAss",
  364. data: {
  365. id: GetQueryString("patentId"),
  366. uid:$.cookie("userid")
  367. },
  368. type: "post",
  369. Fun: oPent.delsucess
  370. });
  371. }
  372. Patent.prototype.delsucess = function() {
  373. location.href = "patentList.html"
  374. }
  375. var oPent = new Patent();
  376. //纠错反馈
  377. $(".footer_tools").hide();
  378. $(".correctSubmit").on("click",function(){
  379. var cntCon=$(this).siblings(".correctCon").val();
  380. var cntUser="";
  381. if(userid && userid != null && userid != "null") {
  382. cntUser = userid;
  383. }
  384. if(cntCon.length>500){
  385. $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
  386. return;
  387. }else{
  388. $.ajax({
  389. "url": "/ajax/feedback/error/patent",
  390. "type": "POST",
  391. "dataType": "json",
  392. "async": true,
  393. "data": {
  394. "id":GetQueryString("patentId"),
  395. "cnt":cntCon,
  396. "user":cntUser
  397. },
  398. "success": function(data) {
  399. if(data.success) {
  400. console.log(data);
  401. backSuccessed();
  402. }
  403. },
  404. "error": function() {
  405. $.MsgBox.Alert('提示', '链接服务器超时')
  406. }
  407. });
  408. }
  409. })
  410. if( GetQueryString("flag")==1){
  411. $(".feedBack").click(function(){
  412. $("#feedbackBox").fadeToggle();
  413. })
  414. $(".closeFeed").click(function(){
  415. $("#feedbackBox").fadeOut();
  416. })
  417. }else{
  418. $(".footer_tools").show();
  419. }
  420. })