portal html css js resource

baseUtil.js 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. var wlogurl="http://192.168.3.233:8080"
  2. //var wlogurl="http://www.ekexiu.com:8082";
  3. function GetQueryString(name) {
  4. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  5. var r = window.location.search.substr(1).match(reg);
  6. var context = "";
  7. if(r != null)
  8. context = r[2];
  9. reg = null;
  10. r = null;
  11. return context == null || context == "" || context == "undefined" ? "" : decodeURI(context);
  12. }
  13. function listConCut(str){//**回答内容过滤html标签**//
  14. var regTag =/<\/?[a-zA-Z]+[^><]*?>/g;
  15. var strTo=str.replace(/<img(.*?)>/g, "[图片]").replace(regTag,"")
  16. return strTo
  17. }
  18. //字符串string转换为数组[]
  19. function strToAry(str){
  20. var subs = new Array();
  21. if(str.indexOf(',')) {
  22. subs = str.split(',');
  23. } else {
  24. subs[0] = str;
  25. }
  26. return subs
  27. }
  28. /*标志*/
  29. function autho() {
  30. if(arguments[0] == 1) {
  31. return {
  32. "sty": "authicon-pro",
  33. "title": "科袖认证专家"
  34. }
  35. } else {
  36. if(arguments[1] == 1) {
  37. return {
  38. "sty": "authicon-staff-ok",
  39. "title": "企业认证员工"
  40. }
  41. } else {
  42. if(arguments[2] == 3) {
  43. return {
  44. "sty": "authicon-real",
  45. "title": "实名认证用户"
  46. }
  47. } else {
  48. return {
  49. "sty": "e",
  50. "title": " "
  51. }
  52. }
  53. }
  54. }
  55. }
  56. //转换格式
  57. function changeTime(dealtime) {
  58. var s = dealtime;
  59. if(dealtime.length == 8) {
  60. var y = s.substr(0, 4);
  61. var m = s.substr(4, 2);
  62. var d = s.substr(6, 2);
  63. var formatTime = y + "-" + m + "-" + d;
  64. return formatTime;
  65. } else {
  66. var y = s.substr(0, 4);
  67. var m = s.substr(4, 2);
  68. var d = s.substr(6, 2);
  69. var h = s.substr(8, 2);
  70. var minute = s.substr(10, 2);
  71. var formatTime = y + "-" + m + "-" + d + " " + h + ":" + minute;
  72. return formatTime;
  73. }
  74. }
  75. //时间显示规则
  76. function commenTime(startTime) {
  77. var nowTimg = new Date();
  78. var startdate = new Date();
  79. startdate.setFullYear(parseInt(startTime.substring(0, 4)));
  80. startdate.setMonth(parseInt(startTime.substring(4, 6)) - 1);
  81. startdate.setDate(parseInt(startTime.substring(6, 8)));
  82. startdate.setHours(parseInt(startTime.substring(8, 10)));
  83. startdate.setMinutes(parseInt(startTime.substring(10, 12)));
  84. startdate.setSeconds(parseInt(startTime.substring(12, 14)));
  85. var date3 = nowTimg.getTime() - startdate.getTime(); //时间差的毫秒数
  86. var hours = parseInt((date3 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  87. var minutes = parseInt((date3 % (1000 * 60 * 60)) / (1000 * 60));
  88. if(date3 < 60000) {
  89. return "刚刚";
  90. } else if(date3 >= 60000 && date3 < 3600000) {
  91. return minutes + "分钟前";
  92. } else if(date3 >= 3600000 && date3 < 86400000) {
  93. return hours + "小时前";
  94. } else if(date3 >= 86400000) {
  95. if(nowTimg.getFullYear() == startTime.substring(0, 4)) {
  96. return startTime.substring(4, 6).replace(/\b(0+)/gi, "") + "月" + startTime.substring(6, 8).replace(/\b(0+)/gi, "") + "日 " + startTime.substring(8, 10) + ":" + startTime.substring(10, 12);
  97. } else {
  98. return startTime.substring(0, 4) + "年" + startTime.substring(4, 6).replace(/\b(0+)/gi, "") + "月" + startTime.substring(6, 8).replace(/\b(0+)/gi, "") + "日 " + startTime.substring(8, 10) + ":" + startTime.substring(10, 12);
  99. }
  100. }
  101. }
  102. function TimeTr(dealtime) {
  103. var myDate = new Date();
  104. var s = dealtime;
  105. var y = s.substr(0, 4);
  106. var m = s.substr(4, 2);
  107. var d = s.substr(6, 2);
  108. var h = s.substr(8, 2);
  109. var minute = s.substr(10, 2);
  110. var formatTime;
  111. if(s.length <= 6) {
  112. formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月";
  113. } else if(s.length > 6 && s.length <= 8) {
  114. formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 ";
  115. if(y != myDate.getFullYear()) {
  116. formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 ";
  117. }
  118. } else {
  119. formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 " + h + ":" + minute;
  120. if(y != myDate.getFullYear()) {
  121. formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 " + h + ":" + minute;
  122. }
  123. }
  124. return formatTime;
  125. }
  126. var currentdate;
  127. function getNowFormatDate(num) {
  128. var date = new Date();
  129. var seperator1 = "-";
  130. var seperator2 = ":";
  131. var month = date.getMonth() + 1;
  132. var strDate = date.getDate();
  133. var getHours = date.getHours();
  134. var getMinutes = date.getMinutes();
  135. if (month >= 1 && month <= 9) {
  136. month = "0" + month;
  137. }
  138. if (strDate >= 0 && strDate <= 9) {
  139. strDate = "0" + strDate;
  140. }
  141. if (getMinutes >= 0 && getMinutes <= 9) {
  142. getMinutes = "0" + getMinutes;
  143. }
  144. if (getHours >= 0 && getHours <= 9) {
  145. getHours = "0" + getHours;
  146. }
  147. var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
  148. + " " + getHours + seperator2 + getMinutes
  149. if(num==1){
  150. currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
  151. }
  152. return currentdate;
  153. }
  154. function hotKey(sel, num) {
  155. $(sel).bind({
  156. paste: function(e) {
  157. var pastedText;
  158. if (window.clipboardData  &&  window.clipboardData.getData)  {  // IE
  159. pastedText  = $(this).val() +  window.clipboardData.getData('Text');          
  160. }else{            
  161. pastedText  = $(this).val() +  e.originalEvent.clipboardData.getData('Text'); //e.clipboardData.getData('text/plain');
  162. }
  163. $(this).val(pastedText);
  164. var $this = $(this);
  165. setTimeout(function() {
  166. if($this.val().trim()) {
  167. $this.siblings("button").show();
  168. } else {
  169. $this.siblings("button").hide();
  170. }
  171. }, 1);
  172. e.preventDefault();
  173. },
  174. cut: function(e) {
  175. var $this = $(this);
  176. setTimeout(function() {
  177. if($this.val().trim()) {
  178. $this.siblings("button").show();
  179. } else {
  180. $this.siblings("button").hide();
  181. }
  182. }, 1);
  183. },
  184. blur: function() {
  185. var $this = $(this);
  186. setTimeout(function() {
  187. $this.siblings(".keydrop").hide();
  188. }, 500)
  189. },
  190. focus: function() {
  191. $(this).siblings(".keydrop").show();
  192. },
  193. keyup: function(e) {
  194. var ti=$(this).val();
  195. var $t=this;
  196. $t.comr=ti;
  197. var $this=$(this);
  198. if($(this).val().trim()) {
  199. $(this).siblings("button").show();
  200. var lNum = $.trim($(this).val()).length;
  201. if(0 < lNum) {
  202. setTimeout(function(){
  203. if( ti===$t.comr && ti!== $t.comrEnd) {
  204. var tt=ti;
  205. $t.comrEnd=tt;
  206. $("#addKeyword").show();
  207. $.ajax({
  208. "url": "/ajax/dataDict/qaHotKey",
  209. "type": "GET",
  210. "success": function(data) {
  211. console.log(data);
  212. if(data.success) {
  213. if($t.comrEnd==tt) {
  214. if(data.data.length == 0) {
  215. $this.siblings(".keydrop").addClass("displayNone");
  216. $this.siblings(".keydrop").find("ul").html("");
  217. } else {
  218. $this.siblings(".keydrop").removeClass("displayNone");
  219. var oSr = "";
  220. for(var i = 0; i < Math.min(data.data.length,5); i++) {
  221. oSr += '<li>' + data.data[i].caption + '<div class="closeThis"></div></li>';
  222. }
  223. $this.siblings(".keydrop").find("ul").html(oSr);
  224. }
  225. }
  226. } else {
  227. $this.siblings(".keydrop").addClass("displayNone");
  228. $this.siblings(".keydrop").find("ul").html("");
  229. }
  230. },
  231. "data": {
  232. "key": $this.val()
  233. },
  234. dataType: "json",
  235. 'error': function() {
  236. $.MsgBox.Alert('提示', '服务器连接超时!');
  237. }
  238. });
  239. }
  240. },500);
  241. }
  242. } else {
  243. $(this).siblings("button").hide();
  244. $(this).siblings(".keydrop").addClass("displayNone");
  245. $(this).siblings(".keydrop").find("ul").html("");
  246. }
  247. }
  248. })
  249. $(".keydrop").on("click", "li", function() {
  250. var oValue = $(this).text();
  251. var oJudge = $(this).parents(".col-w-12").siblings().find("ul.ulspace li");
  252. var addNum = $(this).parents(".keydrop").siblings("input").attr("data-num");
  253. for(var i = 0; i < oJudge.length; i++) {
  254. if(oValue == oJudge[i].innerText) {
  255. $.MsgBox.Alert('提示', '添加内容不能重复');
  256. return;
  257. }
  258. }
  259. $(this).parents(".col-w-12").siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
  260. $(this).parents(".keydrop").siblings("input").val("");
  261. $(this).parents(".keydrop").siblings("button").hide();
  262. if(oJudge.length == addNum - 1) {
  263. $(this).parents(".keydrop").siblings("input").val("");
  264. $(this).parents(".col-w-12").hide();
  265. }
  266. $(this).parent("ul").html("")
  267. })
  268. if(num == 1) {
  269. return;
  270. } else {
  271. $(".addButton").siblings("input").keypress(function(){/*添加*/
  272. var e = event || window.event;
  273. if(e.keyCode == 13) {
  274. var oValue = $(this).val().trim();
  275. var oJudge = $(this).parent().siblings().find("ul.ulspace li");
  276. var addContent = $(this).attr("data-pro");
  277. var addNum = $(this).attr("data-num");
  278. var addfontSizeNum = $(this).attr("data-fontSizeN");
  279. if(!oValue) {
  280. $.MsgBox.Alert('提示', '请先填写内容');
  281. return;
  282. }
  283. if(oValue.length > addfontSizeNum) {
  284. $.MsgBox.Alert('提示', addContent);
  285. return;
  286. }
  287. for(var i = 0; i < oJudge.length; i++) {
  288. if(oValue == oJudge[i].innerText) {
  289. $.MsgBox.Alert('提示', '添加内容不能重复');
  290. return;
  291. }
  292. }
  293. $(this).parent().siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
  294. $(this).siblings(".addButton").hide();
  295. $(this).val("");
  296. if(oJudge.length == addNum - 1) {
  297. $(this).val("").parents(".col-w-12").hide();
  298. }
  299. $(this).siblings(".keydrop").find("ul").html("");
  300. }
  301. })
  302. $(".addButton").click(function() {
  303. var oValue = $(this).siblings("input").val().trim();
  304. var oJudge = $(this).parent().siblings().find("ul.ulspace li");
  305. var addContent = $(this).siblings("input").attr("data-pro");
  306. var addNum = $(this).siblings("input").attr("data-num");
  307. var addfontSizeNum = $(this).siblings("input").attr("data-fontSizeN");
  308. if(!oValue) {
  309. $.MsgBox.Alert('提示', '请先填写内容');
  310. return;
  311. }
  312. if(oValue.length > addfontSizeNum) {
  313. $.MsgBox.Alert('提示', addContent);
  314. return;
  315. }
  316. for(var i = 0; i < oJudge.length; i++) {
  317. if(oValue == oJudge[i].innerText) {
  318. $.MsgBox.Alert('提示', '添加内容不能重复');
  319. return;
  320. }
  321. }
  322. $(this).parent().siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
  323. $(this).hide();
  324. $(this).siblings("input").val("");
  325. if(oJudge.length == addNum - 1) {
  326. $(this).val("").parents(".col-w-12").hide();
  327. }
  328. $(this).siblings(".keydrop").find("ul").html("");
  329. })
  330. }
  331. }
  332. //带有限制字数的多行文本框
  333. function limitObj(obj,maxNum){
  334. $(obj).bind({
  335. paste: function(e) {
  336. if($(this).val().length==""){
  337. $(this).parent().siblings(".btnModel").attr("disabled", true);
  338. }else{
  339. $(this).parent().siblings(".btnModel").attr("disabled", false);
  340. }
  341. var pastedText;
  342. if (window.clipboardData  &&  window.clipboardData.getData)  {  // IE
  343. pastedText  = $(this).val() +  window.clipboardData.getData('Text');          
  344. else  {            
  345. pastedText  = $(this).val() +  e.originalEvent.clipboardData.getData('Text'); //e.clipboardData.getData('text/plain');
  346. }
  347. $(this).val(pastedText);
  348. setTimeout(function() {
  349. $(this).siblings().find("em").text($(obj).val().length);
  350. }, 1);
  351. e.preventDefault();
  352. },
  353. cut: function(e) {
  354. if($(this).val().length==""){
  355. $(this).parent().siblings(".btnModel").attr("disabled", true);
  356. }else{
  357. $(this).parent().siblings(".btnModel").attr("disabled", false);
  358. }
  359. setTimeout(function() {
  360. $(obj).siblings().find("em").text($(obj).val().length);
  361. }, 1);
  362. },
  363. focus: function(e) {
  364. $(obj).parents("li").find(".frmconmsg").show();
  365. $(obj).siblings().find("em").text($(obj).val().length);
  366. },
  367. blur: function(e) {
  368. $(obj).parents("li").find(".frmconmsg").hide();
  369. },
  370. keyup: function(e) {
  371. if($(this).val().length==""){
  372. $(this).parent().siblings(".btnModel").attr("disabled", true);
  373. }else{
  374. $(this).parent().siblings(".btnModel").attr("disabled", false);
  375. }
  376. if($(this).val().length > maxNum) {
  377. $(obj).val($(obj).val().substring(0, maxNum));
  378. e.preventDefault();
  379. }
  380. setTimeout(function() {
  381. $(obj).siblings().find("em").text($(obj).val().length);
  382. }, 1);
  383. }
  384. });
  385. }
  386. var r64 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "-", "_"];
  387. var d64 = {
  388. "0": 0,
  389. "1": 1,
  390. "2": 2,
  391. "3": 3,
  392. "4": 4,
  393. "5": 5,
  394. "6": 6,
  395. "7": 7,
  396. "8": 8,
  397. "9": 9,
  398. "A": 10,
  399. "B": 11,
  400. "C": 12,
  401. "D": 13,
  402. "E": 14,
  403. "F": 15,
  404. "G": 16,
  405. "H": 17,
  406. "I": 18,
  407. "J": 19,
  408. "K": 20,
  409. "L": 21,
  410. "M": 22,
  411. "N": 23,
  412. "O": 24,
  413. "P": 25,
  414. "Q": 26,
  415. "R": 27,
  416. "S": 28,
  417. "T": 29,
  418. "U": 30,
  419. "V": 31,
  420. "W": 32,
  421. "X": 33,
  422. "Y": 34,
  423. "Z": 35,
  424. "a": 36,
  425. "b": 37,
  426. "c": 38,
  427. "d": 39,
  428. "e": 40,
  429. "f": 41,
  430. "g": 42,
  431. "h": 43,
  432. "i": 44,
  433. "j": 45,
  434. "k": 46,
  435. "l": 47,
  436. "m": 48,
  437. "n": 49,
  438. "o": 50,
  439. "p": 51,
  440. "q": 52,
  441. "r": 53,
  442. "s": 54,
  443. "t": 55,
  444. "u": 56,
  445. "v": 57,
  446. "w": 58,
  447. "x": 59,
  448. "y": 60,
  449. "z": 61,
  450. "-": 62,
  451. "_": 63
  452. };
  453. function s16to64(s) {
  454. var out, idx, n1, n2, n3;
  455. idx = s.length - 1;
  456. out = "";
  457. while(idx >= 0) {
  458. n1 = d64[s.charAt(idx--)];
  459. if(idx < 0) {
  460. out = r64[n1] + out;
  461. break;
  462. }
  463. n2 = d64[s.charAt(idx--)];
  464. if(idx < 0) {
  465. out = r64[(n2 >>> 2)] + r64[((n2 & 0x3) << 4) + n1] + out;
  466. break;
  467. }
  468. n3 = d64[s.charAt(idx--)];
  469. out = r64[(n2 >>> 2) + (n3 << 2)] + r64[((n2 & 0x3) << 4) + n1] + out;
  470. }
  471. return out;
  472. }
  473. function s64to16(s) {
  474. var out, idx, n1, n2;
  475. idx = s.length - 1;
  476. out = "";
  477. while(idx >= 0) {
  478. n1 = d64[s.charAt(idx--)];
  479. if(idx < 0) {
  480. out = r64[n1 >>> 4] + r64[n1 & 0xF] + out;
  481. break;
  482. }
  483. n2 = d64[s.charAt(idx--)];
  484. out = r64[(n2 >>> 2)] + r64[(n1 >>> 4) + ((n2 & 0x3) << 2)] + r64[n1 & 0xF] + out;
  485. }
  486. if(out.length>32) {
  487. return out.substring(1);
  488. }
  489. return out;
  490. }
  491. //根据用户输入的Email跳转到相应的电子邮箱首页
  492. var hash = {
  493. 'qq.com': 'http://mail.qq.com',
  494. 'gmail.com': 'http://mail.google.com',
  495. 'sina.com': 'http://mail.sina.com.cn',
  496. '163.com': 'http://mail.163.com',
  497. '126.com': 'http://mail.126.com',
  498. 'yeah.net': 'http://www.yeah.net/',
  499. 'sohu.com': 'http://mail.sohu.com/',
  500. 'tom.com': 'http://mail.tom.com/',
  501. 'sogou.com': 'http://mail.sogou.com/',
  502. '139.com': 'http://mail.10086.cn/',
  503. 'hotmail.com': 'http://www.hotmail.com',
  504. 'live.com': 'http://login.live.com/',
  505. 'live.cn': 'http://login.live.cn/',
  506. 'live.com.cn': 'http://login.live.com.cn',
  507. '189.com': 'http://webmail16.189.cn/webmail/',
  508. 'yahoo.com.cn': 'http://mail.cn.yahoo.com/',
  509. 'yahoo.cn': 'http://mail.cn.yahoo.com/',
  510. 'eyou.com': 'http://www.eyou.com/',
  511. '21cn.com': 'http://mail.21cn.com/',
  512. '188.com': 'http://www.188.com/',
  513. 'ustb.edu.cn': 'http://mail.ustb.edu.cn/',
  514. 'foxmail.coom': 'http://www.foxmail.com'
  515. };
  516. //企业规模
  517. var orgSizeShow = {
  518. '1': '50人以内',
  519. '2': '50-100人',
  520. '3': '100-200人',
  521. '4': '200-500人',
  522. '5': '500-1000人',
  523. '6': '1000人以上'
  524. }
  525. //企业类型
  526. var orgTypeShow = {
  527. "2": "上市企业",
  528. "3": "外资企业",
  529. "4": "合资企业",
  530. "5": "独资企业",
  531. "6": "个体经营",
  532. "7": "政府机构",
  533. "8": "公益组织",
  534. "9": "协会学会",
  535. "10": "新闻媒体",
  536. "11": "教育机构",
  537. "undefined":""
  538. }
  539. //学位
  540. var eduDegree = {
  541. "1": "博士",
  542. "2": "硕士",
  543. "3": "学士",
  544. "4": "大专",
  545. "5": "其他"
  546. }
  547. //栏目
  548. var columnType = {
  549. "1":{
  550. fullName:"个人原创",
  551. shortName:"原创"
  552. },
  553. "2":{
  554. fullName:"企业原创",
  555. shortName:"原创"
  556. },
  557. "3":{
  558. fullName:"科研",
  559. shortName:"科研"
  560. },
  561. "4":{
  562. fullName:"智库",
  563. shortName:"智库"
  564. },
  565. "5":{
  566. fullName:"检测",
  567. shortName:"检测"
  568. },
  569. "6":{
  570. fullName:"会议",
  571. shortName:"会议"
  572. },
  573. "7":{
  574. fullName:"企业",
  575. shortName:"企业"
  576. },
  577. "8":{
  578. fullName:"招聘",
  579. shortName:"招聘"
  580. },
  581. "9":{
  582. fullName:"新闻",
  583. shortName:"新闻"
  584. },
  585. "10":{
  586. fullName:"问答",
  587. shortName:"问答"
  588. }
  589. }
  590. //需求的费用预算
  591. var demandCost = {
  592. '1': '1万元以内',
  593. '2': '1-5万元',
  594. '3': '5-10万元',
  595. '4': '10-20万元',
  596. '5': '20-50万元',
  597. '6': '50万元以上'
  598. }
  599. //需求的预期时长
  600. var demandDuration = {
  601. '1': '1个月内',
  602. '2': '1-3个月',
  603. '3': '3-6个月',
  604. '4': '6-12个月',
  605. '5': '1年以上'
  606. }
  607. function seleCo(obj){//下拉select选择js
  608. var sleTd=$(obj).val();
  609. if(sleTd==0){
  610. $(obj).css("color","#999");
  611. }else{
  612. $(obj).css("color","#666");
  613. }
  614. }
  615. function leaveMsgCount(id,type, $str) {//查看留言数
  616. $.ajax({
  617. "url":"/ajax/leavemsg/count",
  618. "type": "GET",
  619. "dataType": "json",
  620. "data": {
  621. sid:id,
  622. stype: type
  623. },
  624. "success": function(data) {
  625. if(data.success) {
  626. if(data.data > 0) {
  627. $str.find(".leaveMsgCount").html("留言 " + data.data);
  628. $str.find(".leaveMsgCount2").html(data.data);
  629. }
  630. }
  631. }
  632. });
  633. }
  634. function pageUrl(type,datalist) {
  635. return ("shtml/"+type+"/"+datalist.createTime.substring(0,8)+"/"+datalist.shareId+".html");
  636. }
  637. function wlog(dt, id, src) {
  638. var src = src || "1";
  639. var $img=$("<img src='"+wlogurl+"/log/img?__lt="+dt+"&src="+src+"&id="+id+"&_t="+(new Date().getTime())+"' style='display:none;' ></img>");
  640. $img.appendTo($("body"));
  641. setTimeout(function(){
  642. $img.remove();
  643. },5000);
  644. }
  645. function pageViewLog(id,type){//增加浏览量
  646. var str = {
  647. "1": {//专家
  648. url: '/ajax/professor/incPageViews',
  649. data: { 'id': id }
  650. },
  651. "2": {//资源
  652. url: '/ajax/resource/pageViews',
  653. data: { 'resourceId': id }
  654. },
  655. "3": {//文章
  656. url: '/ajax/article/pageViews',
  657. data: { 'articleId': id }
  658. },
  659. "4": {//专利
  660. url: '/ajax/ppatent/incPageViews',
  661. data: { 'id': id }
  662. },
  663. "5": {//论文
  664. url: '/ajax/ppaper/incPageViews',
  665. data: { 'id': id }
  666. },
  667. "6": {//企业
  668. url: '/ajax/org/incPageViews',
  669. data: { 'id': id }
  670. },
  671. "7":{//需求
  672. url: '/ajax/demand/incPageViews',
  673. data: { 'id': id }
  674. },
  675. "8":{//问题
  676. url: '/ajax/question/pageViews',
  677. data: { 'qid': id }
  678. },
  679. "9":{//回答
  680. url: '',
  681. data: {}
  682. },
  683. "10":{//服务
  684. url: '/ajax/ware/incPageViews',
  685. data: { 'id': id }
  686. }
  687. };
  688. var datastr = str[type].data,
  689. url = str[type].url;
  690. $.ajax({
  691. url: url,
  692. data: datastr,
  693. type: "POST",
  694. success: function (data) {
  695. console.log(data);
  696. }
  697. });
  698. }
  699. //广告相关操作
  700. function addscript(that){
  701. var script=document.createElement("script");
  702. script.setAttribute("type", "text/javascript");
  703. var srclink= "https://www.ekexiu.com/data/inc/ad/"+ that +".js?r=" + new Date().getTime();
  704. script.setAttribute("src", srclink);
  705. var heads = document.getElementsByTagName("head");
  706. if(heads.length){
  707. heads[0].appendChild(script);
  708. }else{
  709. document.documentElement.appendChild(script);
  710. }
  711. }