portal html css js resource

patentShow1.js 17KB

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