portal html css js resource

patentShow1.js 17KB

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