portal html css js resource

patentShow.js 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. $(document).ready(function() {
  2. var userid=$.cookie("userid");
  3. var hurl = window.location.host;
  4. if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){
  5. location.href="http://" + window.location.host + "/e/z.html?id="+GetQueryString("patentId");
  6. }
  7. //分享关注按钮
  8. $('.shareWeixin').hover(function(){$(this).find('.shareCode').stop(true,false).fadeToggle();});
  9. //微信分享
  10. var qrcode = new QRCode(document.getElementById("qrcode"), {
  11. width : 100,
  12. height : 100
  13. });
  14. function makeCode(){
  15. var elurl = "http://" + hurl + "/e/z.html?id=" + GetQueryString("patentId") ;
  16. qrcode.makeCode(elurl);
  17. }
  18. makeCode();
  19. $(".commentList").parent().append('<button class="js-load-more displayNone"></button>')
  20. pageViewLog(GetQueryString("patentId"),4)
  21. module.lWord(GetQueryString("patentId"),3,1);
  22. function Patent() {
  23. this.init();
  24. this.flag = GetQueryString("flag");
  25. }
  26. Patent.prototype.init = function() {
  27. loginStatus();
  28. ifcollectionAbout(GetQueryString("patentId"),$("#collectBtn"),4);
  29. this.ajax({
  30. url: "/ajax/ppatent/qo",
  31. data: {
  32. id: GetQueryString("patentId")
  33. },
  34. type: "get",
  35. Fun: this.patentMess
  36. });
  37. this.ajax({
  38. url: "/ajax/ppatent/authors",
  39. data: {
  40. id: GetQueryString("patentId")
  41. },
  42. type: "get",
  43. Fun: this.patentAuth
  44. });
  45. }
  46. Patent.prototype.ajax = function(obj) {
  47. var $this = this;
  48. $.ajax({
  49. url: obj.url,
  50. data: obj.data,
  51. dataType: 'json', //服务器返回json格式数据
  52. type: obj.type, //HTTP请求类型
  53. timeout: 10000, //超时时间设置为10秒;
  54. traditional: true,
  55. async:false,
  56. success: function(data) {
  57. if(data.success) {
  58. obj.Fun(data.data, $this);
  59. }
  60. },
  61. error: function() {
  62. $this.Fail();
  63. }
  64. });
  65. }
  66. Patent.prototype.Fail = function() {
  67. $.MsgBox.Alert('提示', "服务器链接超时");
  68. }
  69. Patent.prototype.keyword = function($key) {
  70. for(var i in $key.split(",")) {
  71. if(GetQueryString("flag")== 1) {
  72. if($key.split(",").length>=5) {
  73. $(".oinput").parents(".col-w-12").hide();
  74. }
  75. $("#paperSList").append("<li><p class='h2Font'>" + $key.split(",")[i] + "</p><div class='closeThis'></div></li>");
  76. } else {
  77. paperRelatedList($key.split(","));
  78. $(".tagList").append("<li><p class='h2Font'>" + $key.split(",")[i] + "</p></li>");
  79. }
  80. }
  81. }
  82. Patent.prototype.patentMess = function($data, $obj) {
  83. if(GetQueryString("flag") == 1) {
  84. $(".advertItem,.form-show").hide();
  85. hotKey(".oinput", 1);
  86. if($data.keywords) {
  87. $obj.keyword($data.keywords);
  88. }
  89. if($data.$data.cooperation) {
  90. $("#remarkContent").val($data.cooperation)
  91. }
  92. } else {
  93. $(".oinput").parents(".form-item").hide();
  94. $(".conItem").hide();
  95. if($data.keywords) {
  96. $obj.keyword($data.keywords);
  97. } else {
  98. $(".form-show").hide();
  99. }
  100. }
  101. if($data.name) {
  102. $("#paperName").text($data.name);
  103. document.title=$data.name;
  104. }
  105. $("#pageview").text($data.pageViews);
  106. if($data.reqCode) {
  107. $(".showCon").eq(0).text($data.reqCode);
  108. } else {
  109. $(".showCon").eq(0).parents("li").hide();
  110. }
  111. if($data.code) {
  112. $(".showCon").eq(1).text($data.code);
  113. } else {
  114. $(".showCon").eq(1).parents("li").hide();
  115. }
  116. $(".showCon").eq(2).text(TimeTr($data.reqDay));
  117. $(".showCon").eq(3).text(TimeTr($data.pubDay));
  118. $(".showCon").eq(4).text($data.reqPerson);
  119. if($data.summary) {
  120. $(".showCon").eq(5).text($data.summary);
  121. }
  122. if($data.cooperation){
  123. $("#noteCo").parent().show()
  124. $("#noteCo").text($data.cooperation)
  125. }
  126. var weibotitle = $data.name;
  127. var weibourl = window.location.href;
  128. var weibopic = "http://" + window.location.host + "/images/default-patent.jpg";
  129. $("#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");
  130. $obj.bindEvent($obj);
  131. }
  132. Patent.prototype.patentAuth = function($data, $obj) {
  133. for(var i in $data) {
  134. if($data[i].professorId.substring(0, 1) == "#") {
  135. var otr = '<li class="flexCenter"><a data-id="'+ $data[i].professorId +'">' +
  136. '<div class="madiaHead useHead" id="userimg"></div>' +
  137. '<div class="madiaInfo">' +
  138. '<p class="ellipsisSty">' +
  139. '<span class="h1Font" id="name">' + $data[i].name + '</span>' +
  140. '</p>' +
  141. '</div></a>'
  142. if($data[i].name==$.cookie("userName")){
  143. otr += '<div class="goSpan"><span class="ifMe" nflag="1">是我本人</span></div>'
  144. }else{
  145. otr += '<div class="goSpan"><span class="yaoqing">邀请'+
  146. '<div class="shareCode clearfix"><div class="floatL qrcodeUser"></div>'+
  147. '<div class="shareWord floatR"><p>打开微信“扫一扫”,<br/>打开网页后点击屏幕右上角“分享”按钮</p></div>'+
  148. '</div></span></div>'
  149. }
  150. otr += '</li>'
  151. $("#faM .lastBtn").before(otr);
  152. } else {
  153. $obj.ajax({
  154. url: "/ajax/professor/editBaseInfo/" + $data[i].professorId,
  155. data: {},
  156. type: "get",
  157. Fun: $obj.profess
  158. });
  159. }
  160. if($data.length<5){
  161. $("#faM li").css("display","block");
  162. $(".lastBtn").hide();
  163. }else{
  164. $(".lastBtn").find("span").text($data.length);
  165. $("#faM li:lt(3)").css("display","block");
  166. }
  167. if(GetQueryString("flag") == 1){
  168. $("#faM li").css("display","block");
  169. $("#faM li .goSpan").hide();
  170. $(".lastBtn").hide();
  171. }
  172. }
  173. //邀请
  174. $(".goSpan").on("mouseenter",".yaoqing",function(){
  175. $(this).find('.shareCode').stop(true,false).fadeIn();
  176. }).on("mouseleave",".yaoqing",function(){
  177. $(this).find('.shareCode').stop(true,false).fadeOut();
  178. });
  179. //邀请作者
  180. var Qcu=document.getElementsByClassName("qrcodeUser");
  181. for(var i=0;i<Qcu.length;i++){
  182. var qrcode= new QRCode(Qcu[i], {
  183. width : 100,
  184. height : 100
  185. });
  186. makeCodePat();
  187. }
  188. function makeCodePat(){
  189. if(userid) {
  190. var elurl = "http://" + hurl + "/e/I.html?i=" + s16to64(GetQueryString("patentId"))+"&d="+s16to64(userid);
  191. } else{
  192. var elurl = "http://" + hurl + "/e/I.html?i=" + s16to64(GetQueryString("patentId"));
  193. }
  194. qrcode.makeCode(elurl);
  195. }
  196. //是我本人
  197. $(".goSpan").on("click",".ifMe",function(){
  198. var oF=$(this).attr("nflag");
  199. if(oF==1){
  200. $.MsgBox.Confirm("提示", "确认这是您发表的专利?", daoRuPatent);
  201. $(this).attr("nflag","0");
  202. }else{
  203. return;
  204. }
  205. });
  206. function daoRuPatent(){
  207. $.ajax({
  208. "url": "/ajax/ppatent/ass",
  209. "type": "POST",
  210. "data": {
  211. id:GetQueryString("patentId"),
  212. uid:$.cookie("userid"),
  213. author:$.cookie("userName")
  214. },
  215. dataType: "json",
  216. "success": function(data) {
  217. if(data.success) {
  218. if(data.data){
  219. $(".ifMe").text("导入成功").css("background","#ccc");
  220. }
  221. }
  222. },
  223. 'error': function() {
  224. $.MsgBox.Alert('提示', '服务器连接超时!');
  225. }
  226. });
  227. }
  228. }
  229. Patent.prototype.profess = function($data, $obj) {
  230. var img;
  231. var oClass = autho($data.authType, $data.orgAuth, $data.authStatus);
  232. var csAuto, oId;
  233. var arr = [];
  234. arr[0] = $data.title || $data.office;
  235. arr[1] = $data.orgName || "";
  236. if(arr[0]) {
  237. if(arr[1]) {
  238. arr[2] = arr[0] + "," + arr[1]
  239. } else {
  240. arr[2] = arr[0];
  241. }
  242. } else {
  243. arr[2] = "";
  244. }
  245. if($data.hasHeadImage) {
  246. img = "/images/head/" + $data.id + "_l.jpg";
  247. } else {
  248. img = "../images/default-photo.jpg"
  249. }
  250. oId = $data.id;
  251. var otr = '<li class="flexCenter"><a href="" data-id="' + oId + '">' +
  252. '<div class="madiaHead useHead" id="userimg" style="background-image:url(' + img + ')"></div>' +
  253. '<div class="madiaInfo" style="margin-top:-4px">' +
  254. '<p class="ellipsisSty">' +
  255. '<span class="h1Font" id="name">' + $data.name + '</span><em class="authiconNew ' + oClass.sty + '" title="' + oClass.title + '"></em>' +
  256. '</p>' +
  257. '<p class="h2Font ellipsisSty">' + arr[2] + '<p>' +
  258. '</div></a>'
  259. if(oId==userid){
  260. otr += ''
  261. }else{
  262. otr += '<div class="goSpan"><span class="attenSpan">关注</span></div>'
  263. }
  264. otr += '</li>'
  265. var $otr=$(otr);
  266. $("#faM .lastBtn").before($otr);
  267. ifcollectionAbout(oId,$otr.find(".attenSpan"),1);
  268. }
  269. Patent.prototype.bindEvent = function($obj) {
  270. $("#faM").on("click", "li>a", function() {
  271. if(GetQueryString("flag") !=1){
  272. var oDataId = $(this).attr("data-id");
  273. if(oDataId.substring(0,1)!="#"){
  274. $(this).attr("href","userInforShow.html?professorId="+oDataId);
  275. }else{
  276. $(this).attr("href","javascript:void(0)");
  277. }
  278. }else{
  279. $(this).attr("href","javascript:void(0)");
  280. }
  281. })
  282. $('#attention em').click(function() {
  283. if(userid && userid != "null" && userid != null) {
  284. if($(this).is('.icon-collected')) {
  285. cancelCollectionAbout(GetQueryString("patentId"),$(this), 4);
  286. } else {
  287. collectionAbout(GetQueryString("patentId"),$(this), 4);
  288. }
  289. } else {
  290. quickLog();
  291. operatTab();
  292. closeLog();
  293. }
  294. })
  295. $("body").on("click", ".closeThis", function() {
  296. if($(this).parent().length < 5) {
  297. $(this).parents(".keyResult").siblings("div").show();
  298. }
  299. $(this).parent().remove();
  300. });
  301. $("#release").on("click", function() {
  302. $.MsgBox.Confirm("提示", "确认发布该专利?", $obj.pubPatent);
  303. });
  304. $("#delete").on("click", function() {
  305. $.MsgBox.Confirm("提示", "确认删除该专利?", $obj.delePatent);
  306. });
  307. $(".lastBtn").on("click", function() {
  308. $("#faM li").css("display","block");
  309. $(this).hide();
  310. });
  311. $(".tagList").on("click","li",function() {
  312. location.href = "searchNew.html?searchContent=" + $(this).text() + "&tagflag=5";
  313. });
  314. //点击关注按钮
  315. $("#faM").on('click',"span.attenSpan", function() {
  316. var pId=$(this).parent().siblings("a").attr("data-id");
  317. if(userid && userid != null && userid != "null") {
  318. if($(this).is('.attenedSpan')){
  319. cancelCollectionAbout(pId, $(this),1)
  320. } else {
  321. collectionAbout(pId, $(this),1);
  322. }
  323. }else{
  324. quickLog();
  325. operatTab();
  326. closeLog();
  327. }
  328. });
  329. }
  330. Patent.prototype.captiureSubInd = function(subIndu) {
  331. var industrys = $("#" + subIndu + "").find("li");
  332. var industryAll = "";
  333. if(industrys.size() > 0) {
  334. for(var i = 0; i < industrys.size(); i++) {
  335. industryAll += industrys[i].innerText.trim();
  336. industryAll += ',';
  337. };
  338. industryAll = industryAll.substring(0, industryAll.length - 1);
  339. }
  340. return industryAll;
  341. }
  342. Patent.prototype.pubPatent = function() {
  343. var $key = oPent.captiureSubInd("paperSList");
  344. oPent.ajax({
  345. url: "/ajax/ppatent/update",
  346. data: {
  347. id: GetQueryString("patentId"),
  348. keywords: $key,
  349. cooperation:$("#remarkContent").val()
  350. },
  351. type: "post",
  352. Fun: oPent.pubsucess
  353. });
  354. }
  355. Patent.prototype.pubsucess = function() {
  356. $.MsgBox.Alert('提示', '专利发布成功!');
  357. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  358. location.href = "patentList.html"
  359. }
  360. Patent.prototype.delePatent = function() {
  361. oPent.ajax({
  362. url: "/ajax/ppatent/cAss",
  363. data: {
  364. id: GetQueryString("patentId"),
  365. uid:$.cookie("userid")
  366. },
  367. type: "post",
  368. Fun: oPent.delsucess
  369. });
  370. }
  371. Patent.prototype.delsucess = function() {
  372. location.href = "patentList.html"
  373. }
  374. var oPent = new Patent();
  375. //纠错反馈
  376. $(".footer_tools").hide();
  377. $(".correctSubmit").on("click",function(){
  378. var cntCon=$(this).siblings(".correctCon").val();
  379. var cntUser="";
  380. if(userid && userid != null && userid != "null") {
  381. cntUser = userid;
  382. }
  383. if(cntCon.length>500){
  384. $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
  385. return;
  386. }else{
  387. $.ajax({
  388. "url": "/ajax/feedback/error/patent",
  389. "type": "POST",
  390. "dataType": "json",
  391. "async": true,
  392. "data": {
  393. "id":GetQueryString("patentId"),
  394. "cnt":cntCon,
  395. "user":cntUser
  396. },
  397. "success": function(data) {
  398. if(data.success) {
  399. console.log(data);
  400. backSuccessed();
  401. }
  402. },
  403. "error": function() {
  404. $.MsgBox.Alert('提示', '链接服务器超时')
  405. }
  406. });
  407. }
  408. })
  409. if( GetQueryString("flag")==1){
  410. $(".feedBack").click(function(){
  411. $("#feedbackBox").fadeToggle();
  412. })
  413. $(".closeFeed").click(function(){
  414. $("#feedbackBox").fadeOut();
  415. })
  416. }else{
  417. var patentId=GetQueryString("patentId");
  418. $(".footer_tools").show();
  419. $("#messagego").show();
  420. $(".thumbBlock").show();
  421. isAgreeNum()
  422. function isAgreeNum() {
  423. var data = {"id": patentId}
  424. $.ajax({
  425. url:"/ajax/ppatent/agreeCount",
  426. data:data,
  427. dataType: 'json', //数据格式类型
  428. type: 'get', //http请求类型
  429. timeout: 10000,
  430. async: true,
  431. success: function(data) {
  432. if(data.success){
  433. if(userid && userid != "null" && userid != null) {
  434. isAgree(data.data) //文章点赞
  435. } else {
  436. $(".thumbBtn").html("赞 <span>" + data.data + "</span>");
  437. }
  438. }
  439. },
  440. error: function() {
  441. $.MsgBox.Alert('提示',"服务器链接超时");
  442. }
  443. });
  444. }
  445. /*判断论文是否被赞*/
  446. function isAgree(articleAgree) {
  447. var data = {"id": patentId,"uid":userid,"uname":$.cookie("userName") }
  448. $.ajax({
  449. url:"/ajax/ppatent/agree",
  450. data:data,
  451. dataType: 'json', //数据格式类型
  452. type: 'get', //http请求类型
  453. timeout: 10000,
  454. async: true,
  455. success: function(data) {
  456. if(data.success){
  457. if(data.data){
  458. $(".thumbBtn").html("已赞 <span>"+articleAgree+"</span>");
  459. $(".thumbBtn").addClass("thumbedBtn").css("cursor","auto");
  460. }else{
  461. $(".thumbBtn").html("赞 <span>"+articleAgree+"</span>");
  462. $(".thumbBtn").addClass("thunbgo");
  463. }
  464. }
  465. },
  466. error: function() {
  467. $.MsgBox.Alert('提示',"服务器链接超时");
  468. }
  469. });
  470. }
  471. //论文点击点赞
  472. $('.thumbBlock').on("click",".thunbgo",function(){
  473. if (userid && userid != "null" && userid != null) {
  474. addAgree();
  475. }else{
  476. quickLog();
  477. operatTab();
  478. closeLog();
  479. }
  480. })
  481. /*点赞*/
  482. function addAgree() {
  483. var data = {"uid": userid,"id": patentId,"uname":$.cookie("userName")}
  484. $.ajax({
  485. url:"/ajax/ppatent/agree",
  486. data:data,
  487. dataType: 'json', //数据格式类型
  488. type: 'POST', //http请求类型
  489. timeout: 10000,
  490. async: true,
  491. success: function(data) {
  492. if(data.success){
  493. var articleAgreeval = $(".thumbBtn span").text();
  494. $(".thumbBtn").html("已赞 <span>"+(parseInt(articleAgreeval)+1)+"</span>");
  495. $(".thumbBtn").addClass("thumbedBtn").css("cursor","auto");
  496. $(".thumbBtn").removeClass("thunbgo");
  497. }
  498. },
  499. error: function() {
  500. $.MsgBox.Alert('提示',"服务器链接超时");
  501. }
  502. });
  503. }
  504. if(userid && userid != "null" && userid != null){
  505. $(".ifLoginOn").removeClass("displayNone");
  506. }else{
  507. $(".ifLoginUn").removeClass("displayNone");
  508. $(".ifLoginUn").on('click',".loginGo", function() {
  509. quickLog();
  510. operatTab();
  511. closeLog();
  512. })
  513. }
  514. //您可能感兴趣的论文
  515. paperInterestingList()
  516. function paperInterestingList(){
  517. $.ajax({
  518. "url" : "/ajax/ppatent/ralatePatents",
  519. "type" : "GET" ,
  520. "dataType" : "json",
  521. "data" :{
  522. "patentId":patentId
  523. },
  524. //"async":false,
  525. "traditional": true, //传数组必须加这个
  526. "success" : function(data) {
  527. if(data.success) {
  528. console.log(data);
  529. var dataStr=data.data
  530. if(dataStr.length > 0){
  531. $("#interPatent").show();
  532. var itemlist = '';
  533. $("#patentList").html("");
  534. for(var i = 0; i < dataStr.length; i++) {
  535. var itemlist = '<li>';
  536. itemlist += '<a class="flexCenter" target="_blank" href="/' + pageUrl("pt",dataStr[i]) +'"><div class="madiaHead patentHead"></div>';
  537. itemlist += '<div class="madiaInfo">';
  538. itemlist += '<p class="h1Font ellipsisSty">'+ dataStr[i].name +'</p>';
  539. itemlist += '<p class="h2Font ellipsisSty">发明人:'+ dataStr[i].authors.substring(0, dataStr[i].authors.length - 1) +'</p>';
  540. itemlist += '<p class="h2Font ellipsisSty">申请人:'+ dataStr[i].reqPerson +'</p>';
  541. itemlist += '</div></a></li>';
  542. $itemlist = $(itemlist);
  543. $("#patentList").append($itemlist);
  544. }
  545. }
  546. }
  547. },
  548. "error":function(){
  549. $.MsgBox.Alert('提示','链接服务器超时')
  550. }
  551. });
  552. }
  553. }
  554. //根据关键词查询查找相关论文
  555. function paperRelatedList(array){
  556. $.ajax({
  557. "url" : "/ajax/ppaper/assPapers",
  558. "type" : "GET" ,
  559. "dataType" : "json",
  560. "data" :{
  561. "kws":array
  562. },
  563. //"async":false,
  564. "traditional": true, //传数组必须加这个
  565. "success" : function(data) {
  566. if(data.success) {
  567. console.log(data);
  568. var dataStr=data.data
  569. if(dataStr.length > 0){
  570. $("#paperList").show();
  571. for(var i = 0; i < dataStr.length; i++) {
  572. var itemlist ='<li style="min-height:56px;"><a href="/'+pageUrl("pp",dataStr[i])+'"><p class="h2Font ellipsisSty-2" style="line-height:20px;"><em class="circlePre"></em>'+ dataStr[i].name +'</p></a></li>'
  573. $(".recentlyList").append(itemlist);
  574. }
  575. }
  576. }
  577. },
  578. "error":function(){
  579. $.MsgBox.Alert('提示', '链接服务器超时')
  580. }
  581. });
  582. }
  583. })