portal html css js resource

common.js 35KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267
  1. //var wlogurl="http://192.168.3.233:8080"
  2. var wlogurl="http://www.ekexiu.com:8082";
  3. $(document).ready(function() {
  4. $(".unlogin").show();
  5. $(".onlogin").hide();
  6. var footerHeight = $("footer").outerHeight(true);
  7. $('#container').css("padding-bottom", footerHeight + "px");
  8. $(".footer_tools").css("bottom", (footerHeight+10) + "px");
  9. //窗口大小变更事件
  10. $(window).resize(function() {
  11. footerHeight = $("footer").outerHeight(true);
  12. $('#container').css("padding-bottom", footerHeight + "px");
  13. //console.log(footerHeight)
  14. });
  15. //底部企业入驻
  16. var orgid = $.cookie('orgId');
  17. $("#cmpSet2").on("click", function() {
  18. if(orgid && orgid != "null" && orgid != null) {
  19. location.href = "cmp-portal/cmp-workspaces.html"
  20. } else {
  21. location.href = "cmp-portal/cmp-settled-reg.html"
  22. }
  23. })
  24. $("#cmpSet3").on("click", function() {
  25. if(orgid && orgid != "null" && orgid != null) {
  26. location.href = "/cmp-portal/cmp-workspaces.html"
  27. } else {
  28. location.href = "/cmp-portal/cmp-settled-reg.html"
  29. }
  30. })
  31. //搜索框跳转页面
  32. $("#search").on("click", function() {
  33. var searchContent = $("#searchContent").val();
  34. setTimeout(function(){location.href = "searchNew.html?searchContent=" + encodeURI(searchContent)},300);
  35. });
  36. $("#search").on("click", function() {
  37. var searchContent = $("#searchContent").val().replace(/^\s*|\s*$/,"");
  38. if(searchContent) {
  39. wlog("kw", searchContent)
  40. }
  41. });
  42. //enter绑定时间
  43. $("#searchContent").keydown(function(e) {
  44. if(e.which == 13) {
  45. var searchContent = $("#searchContent").val();
  46. console.log(searchContent);
  47. location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
  48. }
  49. })
  50. $("#hsearchContent").keydown(function(e) {
  51. if(e.which == 13) {
  52. var searchContent = $("#hsearchContent").val();
  53. if($(this).siblings()[0].id=="searchh") {
  54. location.href = "/searchNew.html?searchContent=" + encodeURI(searchContent);
  55. return;
  56. }
  57. location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
  58. }
  59. })
  60. $("#hsearch").on("click", function() {
  61. var searchContent = $("#hsearchContent").val();
  62. setTimeout(function(){
  63. location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
  64. },300)
  65. });
  66. $("#searchh").on("click", function() {
  67. var searchContent = $("#hsearchContent").val();
  68. setTimeout(function(){
  69. location.href = "/searchNew.html?searchContent=" + encodeURI(searchContent);
  70. },300)
  71. });
  72. $("#hsearch").on("click", function() {
  73. var searchContent = $("#hsearchContent").val().replace(/^\s*|\s*$/,"");
  74. if(searchContent) {
  75. wlog("kw", searchContent)
  76. }
  77. });
  78. /*向下滚动时,header背景变半透明*/
  79. $(document).scroll(function() {
  80. var top = $(document).scrollTop();
  81. if(top == 0) {
  82. $(".navheader").removeClass("navhdown");
  83. } else {
  84. $(".navheader").addClass("navhdown");
  85. }
  86. if(top >= 300) {
  87. $(".content-left").css({
  88. "position": "fixed",
  89. "top": "80px"
  90. })
  91. } else {
  92. $(".content-left").css({
  93. "position": "static"
  94. })
  95. }
  96. });
  97. /*选择省份*/
  98. $(document).on("click", "#Province li a", function() {
  99. var aVal = $(this).text();
  100. $(this).parent().parent().parent().find('.mr_show').text(aVal);
  101. $(this).parent().parent().parent().find('input[name=cho_Province]').val(aVal);
  102. if($("#oprovince").text() == "请选择省/直辖市") {
  103. $("#oprovince").removeClass("mr_select");
  104. $("#ocity").removeClass("mr_select");
  105. } else {
  106. $("#oprovince").addClass("mr_select");
  107. $("#ocity").removeClass("mr_select");
  108. }
  109. });
  110. /*选择城市填充js */
  111. $(document).on("click", "#City li a", function() {
  112. var aVal = $(this).text();
  113. $(this).parent().parent().parent().find('.mr_show').text(aVal);
  114. $(this).parent().parent().parent().find('input[name=cho_City]').val(aVal);
  115. if($("#ocity").text() == "请选择城市") {
  116. $("#ocity").removeClass("mr_select");
  117. } else {
  118. $("#ocity").addClass("mr_select");
  119. }
  120. });
  121. /*多行文本框样式(带有限制数字)模拟focus效果*/
  122. $(".msgContbox textarea").focus(function() {
  123. $(this).parent().css("border-color", "#ff9900");
  124. }).blur(function() {
  125. $(this).parent().css("border-color", "#E5E5E5");
  126. })
  127. });
  128. var userid;
  129. function exit() {
  130. $.cookie('userid', null);
  131. $.cookie('userAuth', null);
  132. $.cookie('userEmail', null);
  133. $.cookie('userMobilePhone', null);
  134. $.cookie('userName', null);
  135. $.cookie('userType', null);
  136. location.href = "index.html"
  137. }
  138. function exitStaticize() {
  139. $.cookie('userid', null,{ path: '/' });
  140. $.cookie('userAuth', null,{ path: '/' });
  141. $.cookie('userEmail', null,{ path: '/' });
  142. $.cookie('userMobilePhone', null,{ path: '/' });
  143. $.cookie('userName', null,{ path: '/' });
  144. $.cookie('userType', null,{ path: '/' });
  145. location.href = "/index.html"
  146. }
  147. function valUser() {
  148. var userid = $.cookie('userid');
  149. var userAuth = $.cookie('userAuth');
  150. if(userid == undefined || userid.length == 0 || userid == "null" || userAuth == false) {
  151. location.href = "login.html";
  152. }
  153. }
  154. function pageUrl(type,datalist) {
  155. return ("shtml/"+type+"/"+datalist.createTime.substring(0,8)+"/"+datalist.shareId+".html");
  156. }
  157. function GetQueryString(name) {
  158. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  159. var r = window.location.search.substr(1).match(reg);
  160. var context = "";
  161. if(r != null)
  162. context = r[2];
  163. reg = null;
  164. r = null;
  165. return context == null || context == "" || context == "undefined" ? "" : decodeURI(context);
  166. }
  167. function loginStatus() {
  168. userid = $.cookie('userid');
  169. userAuth = $.cookie('userAuth');
  170. authentication = $.cookie('authentication');
  171. if(userid && userid != "null" && userid != null) {
  172. if(userAuth == "false" && authentication == "null") {
  173. location.href = "loginInviteFirst.html";
  174. }
  175. if(userAuth == "true" && authentication == "null") {
  176. location.href = "fillinfo-select.html";
  177. }
  178. if(userAuth == "true" && authentication != "null") {
  179. $(".onlogin").show();
  180. $(".unlogin").hide();
  181. $(".portrait-p").attr("src", "/images/head/" + userid + "_m.jpg");
  182. $(".portrait-p").load(function() { //判断图片是否加载,加载不成功默认有默认的图像
  183. })
  184. .error(function() {
  185. $(".portrait-p").attr("src", "/images/default-photo.jpg");
  186. });
  187. unReadedCount(userid);
  188. }
  189. $(".portrait-p").on("click",function(){
  190. location.href="userInforShow.html?professorId="+userid;
  191. })
  192. $(".onlogin").on("click",".goMyInf",function(){
  193. $(this).attr("href","userInforShow.html?professorId="+userid)
  194. })
  195. } else {
  196. $(".unlogin").show();
  197. $(".onlogin").hide();
  198. }
  199. }
  200. function loginYesOrNo() {
  201. userid = $.cookie('userid');
  202. userAuth = $.cookie('userAuth');
  203. authentication = $.cookie('authentication');
  204. if(userid && userid != "null" && userid != null) {
  205. if(userAuth == "false" && authentication == "null") {
  206. location.href = "/loginInviteFirst.html";
  207. }
  208. if(userAuth == "true" && authentication == "null") {
  209. location.href = "/fillinfo-select.html";
  210. }
  211. if(userAuth == "true" && authentication != "null") {
  212. $(".onlogin").show();
  213. $(".unlogin").hide();
  214. $(".portrait-p").attr("src", "/images/head/" + userid + "_m.jpg");
  215. $(".portrait-p").load(function() { //判断图片是否加载,加载不成功默认有默认的图像
  216. })
  217. .error(function() {
  218. $(".portrait-p").attr("src", "/images/default-photo.jpg");
  219. });
  220. unReadedCount(userid);
  221. }
  222. $(".portrait-p").on("click",function(){
  223. location.href="/userInforShow.html?professorId="+userid;
  224. })
  225. $(".onlogin").on("click",".goMyInf",function(){
  226. $(this).attr("href","/userInforShow.html?professorId="+userid)
  227. })
  228. } else {
  229. $(".unlogin").show();
  230. $(".onlogin").hide();
  231. }
  232. }
  233. function unReadedCount(id){//查询指定用户的未读消息数量
  234. $.ajax({
  235. type:"get",
  236. url:"/ajax/webMsg/unReadedCount",
  237. async:true,
  238. data:{"id":id},
  239. success:function(data){
  240. console.log(data)
  241. if(data.success){
  242. if(data.data!=0){
  243. $(".mymessage .badge").text(data.data);
  244. }else{
  245. $(".mymessage .badge").text("");
  246. }
  247. }
  248. }
  249. });
  250. }
  251. //转换格式
  252. function changeTime(dealtime) {
  253. var s = dealtime;
  254. //console.log(s);
  255. if(dealtime.length == 8) {
  256. var y = s.substr(0, 4);
  257. var m = s.substr(4, 2);
  258. var d = s.substr(6, 2);
  259. var formatTime = y + "-" + m + "-" + d;
  260. return formatTime;
  261. } else {
  262. var y = s.substr(0, 4);
  263. var m = s.substr(4, 2);
  264. var d = s.substr(6, 2);
  265. var h = s.substr(8, 2);
  266. var minute = s.substr(10, 2);
  267. var formatTime = y + "-" + m + "-" + d + " " + h + ":" + minute;
  268. return formatTime;
  269. }
  270. }
  271. //******过滤特殊字符*******//
  272. function replaceStr(s) {
  273. var pattern = new RegExp("-");
  274. var rs = "";
  275. for(var i = 0; i < s.length; i++) {
  276. rs = rs + s.substr(i, 1).replace(pattern, '');
  277. }
  278. return rs;
  279. }
  280. //**********************//
  281. //根据用户输入的Email跳转到相应的电子邮箱首页
  282. var hash = {
  283. 'qq.com': 'http://mail.qq.com',
  284. 'gmail.com': 'http://mail.google.com',
  285. 'sina.com': 'http://mail.sina.com.cn',
  286. '163.com': 'http://mail.163.com',
  287. '126.com': 'http://mail.126.com',
  288. 'yeah.net': 'http://www.yeah.net/',
  289. 'sohu.com': 'http://mail.sohu.com/',
  290. 'tom.com': 'http://mail.tom.com/',
  291. 'sogou.com': 'http://mail.sogou.com/',
  292. '139.com': 'http://mail.10086.cn/',
  293. 'hotmail.com': 'http://www.hotmail.com',
  294. 'live.com': 'http://login.live.com/',
  295. 'live.cn': 'http://login.live.cn/',
  296. 'live.com.cn': 'http://login.live.com.cn',
  297. '189.com': 'http://webmail16.189.cn/webmail/',
  298. 'yahoo.com.cn': 'http://mail.cn.yahoo.com/',
  299. 'yahoo.cn': 'http://mail.cn.yahoo.com/',
  300. 'eyou.com': 'http://www.eyou.com/',
  301. '21cn.com': 'http://mail.21cn.com/',
  302. '188.com': 'http://www.188.com/',
  303. 'ustb.edu.cn': 'http://mail.ustb.edu.cn/',
  304. 'foxmail.coom': 'http://www.foxmail.com'
  305. };
  306. //轮播滚动函数
  307. function Carousel(inde, num, show, childcount, obj, next, prev) {
  308. var tapnum = 0; //按钮可点击次数
  309. if(childcount > num) {
  310. next.css("display", "block");
  311. prev.css("display", "none");
  312. } else {
  313. next.css("display", "none");
  314. prev.css("display", "none");
  315. }
  316. next.click(function() {
  317. if(!obj.is(":animated")) {
  318. if(num < childcount) {
  319. tapnum++;
  320. prev.css("display", "block");
  321. if(tapnum == childcount - show) {
  322. next.css("display", "none");
  323. }
  324. num++;
  325. obj.animate({
  326. left: "-=212px"
  327. }, 600);
  328. }
  329. }
  330. });
  331. prev.click(function() {
  332. if(!obj.is(":animated")) {
  333. if(num > inde) {
  334. tapnum--;
  335. next.css("display", "block");
  336. if(tapnum == 0) {
  337. prev.css("display", "none");
  338. }
  339. num--;
  340. obj.animate({
  341. left: "+=212px"
  342. }, 600);
  343. }
  344. }
  345. });
  346. }
  347. //评价字数限制
  348. //字数限制函数
  349. function limitTextCountFn(TextAreaId, countContainerId, count) {
  350. var curLength = $(TextAreaId).val().length;
  351. if(curLength > count) {
  352. var num = $(TextAreaId).val().substr(0, count);
  353. $(TextAreaId).val(num);
  354. } else {
  355. $(countContainerId).text(count - $(TextAreaId).val().length);
  356. }
  357. };
  358. //咨询申请主题字数限制函数
  359. function titleLimitFontCountFn() {
  360. var curLength = $("#consultTitle").val().length;
  361. if(curLength > 20) {
  362. var num = $("#consultTitle").val().substr(0, 20);
  363. $("#consultTitle").val(num);
  364. }
  365. };
  366. /*下拉select选择js */
  367. function seleCo(obj){
  368. var sleTd=$(obj).val();
  369. if(sleTd==0){
  370. $(obj).css("color","#999");
  371. }else{
  372. $(obj).css("color","#666");
  373. }
  374. }
  375. //咨询 专家信息接口函数
  376. function concultProInfo(professorId) {
  377. $.ajax({
  378. url: "/ajax/professor/editBaseInfo/" + professorId,
  379. type: "get",
  380. data: {
  381. "id": professorId
  382. },
  383. contentType: "application/x-www-form-urlencoded",
  384. success: function(response) {
  385. //console.log(response);
  386. var myData = response["data"];
  387. $("#professorName").html(myData["name"]);
  388. if(myData["title"]) {
  389. $("#professorTitle").html(myData["title"] + ' ');
  390. }
  391. if(myData["department"]) {
  392. $("#profDepartment").html(myData["department"] + ' ');
  393. }
  394. if(myData["orgName"]) {
  395. $("#profOrganization").html(myData["orgName"] + ' ');
  396. }
  397. if(myData["address"]) {
  398. $("#profAdress").html(myData["address"]);
  399. }
  400. console.log(myData["consultCount"])
  401. if(!myData["consultCount"]) {
  402. $("#starLevel").hide();
  403. }
  404. $("#byConsultConut").html(myData["consultCount"]);
  405. $("#sendConsultBtn").attr("proId", myData["id"]);
  406. //星级
  407. var startConut = parseInt(myData["starLevel"]);
  408. if(myData["consultCount"]) {
  409. if(!startConut) {
  410. $(".evastarbox2").hide();
  411. }
  412. }
  413. for(var i = 0; i < startConut; i++) {
  414. $("#starLevel .evastar2").eq(i).addClass("addStar");
  415. }
  416. //认证
  417. var oSty = autho(myData.authType, myData.orgAuth, myData.authStatus);
  418. $("#proModifyN").addClass(oSty.sty);
  419. $("#proModifyN").attr("title", oSty.title);
  420. //头像
  421. if(myData["hasHeadImage"] == 0) {
  422. $("#prohead").attr("src", "images/default-photo.jpg");
  423. } else {
  424. $("#prohead").attr("src", "images/head/" + myData["id"] + "_l.jpg");
  425. }
  426. },
  427. error: function(error) {
  428. $.MsgBox.Alert("message", "请求数据失败");
  429. }
  430. });
  431. };
  432. //发送咨询
  433. function sendConsultHandler(professorId) {
  434. var professorId = professorId;
  435. var consult_type = $(".clicknow").text(); //咨询类型
  436. var consult_title = $("#consultTitle").val(); //咨询主题
  437. var consult_content = $("#consultcontent").val(); //咨询内容
  438. var consultStr = {
  439. "consultType": consult_type,
  440. "consultTitle": consult_title,
  441. "consultContant": consult_content,
  442. "professorId": professorId,
  443. "consultantId": userid
  444. };
  445. if(consult_type == '' || consult_title == '' || consult_content == '') {
  446. $.MsgBox.Alert("消息提醒", "请填写完整");
  447. };
  448. if(consult_type == '') {
  449. $.MsgBox.Alert("消息提醒", "请选择联系目的");
  450. }
  451. if(consult_title == '') {
  452. $.MsgBox.Alert("消息提醒", "请填写咨询目的");
  453. }
  454. if(consult_content == '') {
  455. $.MsgBox.Alert("消息提醒", "请填写咨询内容");
  456. }
  457. if(userid && userid != null && userid != "null" && consult_type != '' &&
  458. consult_title != '' && consult_content != ''
  459. ) {
  460. $.ajax({
  461. "url": "/ajax/consult",
  462. "type": "post",
  463. //传值:咨询类型、主题、内容、专家id、申请人id
  464. "data": consultStr,
  465. "contentType": "application/x-www-form-urlencoded",
  466. "dataType": "json",
  467. "success": function(response) {
  468. console.log(response);
  469. },
  470. "error": function() {
  471. $.MsgBox.Alert("消息提醒", "咨询申请失败");
  472. },
  473. "complete": function() {
  474. //$(".consultapply").remove();
  475. $(".blackcover").remove();
  476. $("body").css("position", "");
  477. $.MsgBox.Alert("消息提醒", "咨询申请成功");
  478. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  479. },
  480. });
  481. }
  482. };
  483. /*标志*/
  484. function autho() {
  485. if(arguments[0] == 1) {
  486. return {
  487. "sty": "authicon-pro",
  488. "title": "科袖认证专家"
  489. }
  490. } else {
  491. if(arguments[1] == 1) {
  492. return {
  493. "sty": "authicon-staff-ok",
  494. "title": "企业认证员工"
  495. }
  496. } else {
  497. if(arguments[2] == 3) {
  498. return {
  499. "sty": "authicon-real",
  500. "title": "实名认证用户"
  501. }
  502. } else {
  503. return {
  504. "sty": "e",
  505. "title": " "
  506. }
  507. }
  508. }
  509. }
  510. }
  511. //时间显示规则
  512. function commenTime(startTime) {
  513. var nowTimg = new Date();
  514. var startdate = new Date();
  515. startdate.setFullYear(parseInt(startTime.substring(0, 4)));
  516. startdate.setMonth(parseInt(startTime.substring(4, 6)) - 1);
  517. startdate.setDate(parseInt(startTime.substring(6, 8)));
  518. startdate.setHours(parseInt(startTime.substring(8, 10)));
  519. startdate.setMinutes(parseInt(startTime.substring(10, 12)));
  520. startdate.setSeconds(parseInt(startTime.substring(12, 14)));
  521. var date3 = nowTimg.getTime() - startdate.getTime(); //时间差的毫秒数
  522. var hours = parseInt((date3 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  523. var minutes = parseInt((date3 % (1000 * 60 * 60)) / (1000 * 60));
  524. if(date3 < 60000) {
  525. return "刚刚";
  526. } else if(date3 >= 60000 && date3 < 3600000) {
  527. return minutes + "分钟前";
  528. } else if(date3 >= 3600000 && date3 < 86400000) {
  529. return hours + "小时前";
  530. } else if(date3 >= 86400000) {
  531. if(nowTimg.getFullYear() == startTime.substring(0, 4)) {
  532. 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);
  533. } else {
  534. 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);
  535. }
  536. }
  537. }
  538. /*时间转换*/
  539. function TimeTr(dealtime) {
  540. var myDate = new Date();
  541. var s = dealtime;
  542. var y = s.substr(0, 4);
  543. var m = s.substr(4, 2);
  544. var d = s.substr(6, 2);
  545. var h = s.substr(8, 2);
  546. var minute = s.substr(10, 2);
  547. var formatTime;
  548. if(s.length <= 6) {
  549. formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月";
  550. } else if(s.length > 6 && s.length <= 8) {
  551. formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 ";
  552. if(y != myDate.getFullYear()) {
  553. formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 ";
  554. }
  555. } else {
  556. formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 " + h + ":" + minute;
  557. if(y != myDate.getFullYear()) {
  558. formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 " + h + ":" + minute;
  559. }
  560. }
  561. return formatTime;
  562. }
  563. /*判断是否收藏资源文章或者是否关注专家*/
  564. function ifcollectionAbout(watchObject, sel,num) {
  565. var that=sel;
  566. $.ajax('/ajax/watch/hasWatch', {
  567. data: {
  568. "professorId": userid,
  569. "watchObject": watchObject
  570. },
  571. dataType: 'json', //数据格式类型
  572. type: 'get', //http请求类型
  573. timeout: 10000,
  574. async: false,
  575. success: function(data) {
  576. if(data.success && data.data != null) {
  577. if(num == "1" || num == "6") { //已关注专家
  578. $(that).addClass("attenedSpan");
  579. $(that).text("已关注");
  580. } else { //已收藏资源或文章
  581. $(that).removeClass("icon-collect");
  582. $(that).addClass("icon-collected");
  583. }
  584. } else {
  585. if(num == "1" || num == "6") { //关注专家
  586. $(that).removeClass("attenedSpan");
  587. $(that).text("关注");
  588. } else { //收藏资源或文章
  589. $(that).addClass("icon-collect");
  590. $(that).removeClass("icon-collected");//
  591. }
  592. }
  593. },
  594. error: function(data) {
  595. $.MsgBox.Alert('提示', "服务器链接超时");
  596. }
  597. });
  598. }
  599. /*收藏资源、文章或者关注专家*/
  600. function collectionAbout(watchObject,sel, num) {
  601. var that=sel;
  602. $.ajax('/ajax/watch', {
  603. data: {
  604. "professorId": userid,
  605. "watchObject": watchObject,
  606. "watchType": num
  607. },
  608. dataType: 'json', //数据格式类型
  609. type: 'POST', //http请求类型
  610. timeout: 10000,
  611. async: false,
  612. success: function(data) {
  613. if(data.success) {
  614. console.log(data)
  615. if(num == "1" || num == "6") {
  616. $(that).addClass("attenedSpan");
  617. $(that).text("已关注");
  618. } else {
  619. $(that).removeClass("icon-collect");
  620. $(that).addClass("icon-collected");
  621. }
  622. }
  623. },
  624. error: function(data) {
  625. $.MsgBox.Alert('提示', "服务器链接超时");
  626. }
  627. });
  628. }
  629. /*取消收藏资源、文章或者取消关注专家*/
  630. function cancelCollectionAbout(watchObject,sel,num) {
  631. var that=sel;
  632. $.ajax({
  633. url: '/ajax/watch/delete',
  634. data: {
  635. professorId: userid,
  636. watchObject: watchObject
  637. },
  638. dataType: 'json', //数据格式类型
  639. type: 'post', //http请求类型
  640. timeout: 10000,
  641. async: true,
  642. success: function(data) {
  643. console.log(data.success)
  644. if(num == "1" || num == "6") { //关注专家
  645. $(that).removeClass("attenedSpan");
  646. $(that).text("关注");
  647. } else { //收藏资源或文章
  648. $(that).addClass("icon-collect");
  649. $(that).removeClass("icon-collected");
  650. }
  651. },
  652. error: function(data) {
  653. $.MsgBox.Alert('提示', "服务器链接超时");
  654. }
  655. });
  656. }
  657. //企业规模
  658. var orgSizeShow = {
  659. '1': '50人以内',
  660. '2': '50-100人',
  661. '3': '100-200人',
  662. '4': '200-500人',
  663. '5': '500-1000人',
  664. '6': '1000人以上'
  665. }
  666. //企业类型
  667. var orgTypeShow = {
  668. "2": "上市企业",
  669. "3": "外资企业",
  670. "4": "合资企业",
  671. "5": "独资企业",
  672. "6": "个体经营",
  673. "7": "政府机构",
  674. "8": "公益组织",
  675. "9": "协会学会",
  676. "10": "新闻媒体",
  677. "11": "教育机构",
  678. "undefined":""
  679. }
  680. //学位
  681. var eduDegree = {
  682. "1": "博士",
  683. "2": "硕士",
  684. "3": "学士",
  685. "4": "大专",
  686. "5": "其他"
  687. }
  688. //栏目
  689. var columnType = {
  690. "1":{
  691. fullName:"个人原创",
  692. shortName:"原创"
  693. },
  694. "2":{
  695. fullName:"企业原创",
  696. shortName:"原创"
  697. },
  698. "3":{
  699. fullName:"科研",
  700. shortName:"科研"
  701. },
  702. "4":{
  703. fullName:"智库",
  704. shortName:"智库"
  705. },
  706. "5":{
  707. fullName:"检测",
  708. shortName:"检测"
  709. },
  710. "6":{
  711. fullName:"会议",
  712. shortName:"会议"
  713. },
  714. "7":{
  715. fullName:"企业",
  716. shortName:"企业"
  717. },
  718. "8":{
  719. fullName:"招聘",
  720. shortName:"招聘"
  721. },
  722. "9":{
  723. fullName:"新闻",
  724. shortName:"新闻"
  725. }
  726. }
  727. var sortColumn=["3","7","4","5","6","8"]//发现栏目显示顺序
  728. //需求的费用预算
  729. var demandCost = {
  730. '1': '1万元以内',
  731. '2': '1-5万元',
  732. '3': '5-10万元',
  733. '4': '10-20万元',
  734. '5': '20-50万元',
  735. '6': '50万元以上'
  736. }
  737. //需求的预期时长
  738. var demandDuration = {
  739. '1': '1个月内',
  740. '2': '1-3个月',
  741. '3': '3-6个月',
  742. '4': '6-12个月',
  743. '5': '1年以上'
  744. }
  745. //反馈意见成功
  746. function backSuccessed(){
  747. $(".correctCon").val("");
  748. $(".correctSubmit").attr("disabled",true);
  749. $(".correctSubmit").parents(".correctBlock").fadeOut();
  750. $.MsgBox.Alert('提示', '感谢您的反馈,我们马上处理。');
  751. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  752. }
  753. function suImg() {
  754. $("#mb_msgicon").css("background", 'url("/images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  755. $("#mb_ico").css("background",'url(/images/sign_icon_guanbi_nor.png) center center no-repeat');
  756. }
  757. function hotKey(sel, num) {
  758. $(sel).bind({
  759. paste: function(e) {
  760. var pastedText;
  761. if (window.clipboardData  &&  window.clipboardData.getData)  {  // IE
  762. pastedText  = $(this).val() +  window.clipboardData.getData('Text');          
  763. else  {            
  764. pastedText  = $(this).val() +  e.originalEvent.clipboardData.getData('Text'); //e.clipboardData.getData('text/plain');
  765. }
  766. $(this).val(pastedText);
  767. var $this = $(this);
  768. setTimeout(function() {
  769. if($this.val().trim()) {
  770. $this.siblings("button").show();
  771. } else {
  772. $this.siblings("button").hide();
  773. }
  774. }, 1);
  775. e.preventDefault();
  776. },
  777. cut: function(e) {
  778. var $this = $(this);
  779. setTimeout(function() {
  780. if($this.val().trim()) {
  781. $this.siblings("button").show();
  782. } else {
  783. $this.siblings("button").hide();
  784. }
  785. }, 1);
  786. },
  787. blur: function() {
  788. var $this = $(this);
  789. setTimeout(function() {
  790. $this.siblings(".keydrop").hide();
  791. }, 500)
  792. },
  793. focus: function() {
  794. $(this).siblings(".keydrop").show();
  795. },
  796. keyup: function(e) {
  797. var ti=$(this).val();
  798. var $t=this;
  799. $t.comr=ti;
  800. var $this=$(this);
  801. if($(this).val().trim()) {
  802. $(this).siblings("button").show();
  803. var lNum = $.trim($(this).val()).length;
  804. if(0 < lNum) {
  805. setTimeout(function(){
  806. if( ti===$t.comr && ti!== $t.comrEnd) {
  807. var tt=ti;
  808. $t.comrEnd=tt;
  809. $("#addKeyword").show();
  810. $.ajax({
  811. "url": "/ajax/dataDict/qaHotKey",
  812. "type": "GET",
  813. "success": function(data) {
  814. console.log(data);
  815. if(data.success) {
  816. if($t.comrEnd==tt) {
  817. if(data.data.length == 0) {
  818. $this.siblings(".keydrop").addClass("displayNone");
  819. $this.siblings(".keydrop").find("ul").html("");
  820. } else {
  821. $this.siblings(".keydrop").removeClass("displayNone");
  822. var oSr = "";
  823. for(var i = 0; i < Math.min(data.data.length,5); i++) {
  824. oSr += '<li>' + data.data[i].caption + '<div class="closeThis"></div></li>';
  825. }
  826. $this.siblings(".keydrop").find("ul").html(oSr);
  827. }
  828. }
  829. } else {
  830. $this.siblings(".keydrop").addClass("displayNone");
  831. $this.siblings(".keydrop").find("ul").html("");
  832. }
  833. },
  834. "data": {
  835. "key": $this.val()
  836. },
  837. dataType: "json",
  838. 'error': function() {
  839. $.MsgBox.Alert('提示', '服务器连接超时!');
  840. }
  841. });
  842. }
  843. },500);
  844. }
  845. } else {
  846. $(this).siblings("button").hide();
  847. $(this).siblings(".keydrop").addClass("displayNone");
  848. $(this).siblings(".keydrop").find("ul").html("");
  849. }
  850. }
  851. })
  852. $(".keydrop").on("click", "li", function() {
  853. var oValue = $(this).text();
  854. var oJudge = $(this).parents(".col-w-12").siblings().find("ul.ulspace li");
  855. var addNum = $(this).parents(".keydrop").siblings("input").attr("data-num");
  856. for(var i = 0; i < oJudge.length; i++) {
  857. if(oValue == oJudge[i].innerText) {
  858. $.MsgBox.Alert('提示', '添加内容不能重复');
  859. return;
  860. }
  861. }
  862. $(this).parents(".col-w-12").siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
  863. $(this).parents(".keydrop").siblings("input").val("");
  864. $(this).parents(".keydrop").siblings("button").hide();
  865. if(oJudge.length == addNum - 1) {
  866. $(this).parents(".keydrop").siblings("input").val("");
  867. $(this).parents(".col-w-12").hide();
  868. }
  869. $(this).parent("ul").html("")
  870. })
  871. if(num == 1) {
  872. return;
  873. } else {
  874. /*添加*/
  875. $(".addButton").siblings("input").keypress(function(){
  876. var e = event || window.event;
  877. if(e.keyCode == 13) {
  878. var oValue = $(this).val().trim();
  879. var oJudge = $(this).parent().siblings().find("ul.ulspace li");
  880. var addContent = $(this).attr("data-pro");
  881. var addNum = $(this).attr("data-num");
  882. var addfontSizeNum = $(this).attr("data-fontSizeN");
  883. if(!oValue) {
  884. $.MsgBox.Alert('提示', '请先填写内容');
  885. return;
  886. }
  887. if(oValue.length > addfontSizeNum) {
  888. $.MsgBox.Alert('提示', addContent);
  889. return;
  890. }
  891. for(var i = 0; i < oJudge.length; i++) {
  892. if(oValue == oJudge[i].innerText) {
  893. $.MsgBox.Alert('提示', '添加内容不能重复');
  894. return;
  895. }
  896. }
  897. $(this).parent().siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
  898. $(this).siblings(".addButton").hide();
  899. $(this).val("");
  900. if(oJudge.length == addNum - 1) {
  901. $(this).val("").parents(".col-w-12").hide();
  902. }
  903. $(this).siblings(".keydrop").find("ul").html("");
  904. }
  905. })
  906. $(".addButton").click(function() {
  907. var oValue = $(this).siblings("input").val().trim();
  908. var oJudge = $(this).parent().siblings().find("ul.ulspace li");
  909. var addContent = $(this).siblings("input").attr("data-pro");
  910. var addNum = $(this).siblings("input").attr("data-num");
  911. var addfontSizeNum = $(this).siblings("input").attr("data-fontSizeN");
  912. if(!oValue) {
  913. $.MsgBox.Alert('提示', '请先填写内容');
  914. return;
  915. }
  916. if(oValue.length > addfontSizeNum) {
  917. $.MsgBox.Alert('提示', addContent);
  918. return;
  919. }
  920. for(var i = 0; i < oJudge.length; i++) {
  921. if(oValue == oJudge[i].innerText) {
  922. $.MsgBox.Alert('提示', '添加内容不能重复');
  923. return;
  924. }
  925. }
  926. $(this).parent().siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
  927. $(this).hide();
  928. $(this).siblings("input").val("");
  929. if(oJudge.length == addNum - 1) {
  930. $(this).val("").parents(".col-w-12").hide();
  931. }
  932. $(this).siblings(".keydrop").find("ul").html("");
  933. })
  934. }
  935. }
  936. //带有限制字数的多行文本框
  937. function limitObj(obj,maxNum){
  938. $(obj).bind({
  939. paste: function(e) {
  940. if($(this).val().length==""){
  941. $(this).parent().siblings(".btnModel").attr("disabled", true);
  942. }else{
  943. $(this).parent().siblings(".btnModel").attr("disabled", false);
  944. }
  945. var pastedText;
  946. if (window.clipboardData  &&  window.clipboardData.getData)  {  // IE
  947. pastedText  = $(this).val() +  window.clipboardData.getData('Text');          
  948. else  {            
  949. pastedText  = $(this).val() +  e.originalEvent.clipboardData.getData('Text'); //e.clipboardData.getData('text/plain');
  950. }
  951. $(this).val(pastedText);
  952. setTimeout(function() {
  953. $(this).siblings().find("em").text($(obj).val().length);
  954. }, 1);
  955. e.preventDefault();
  956. },
  957. cut: function(e) {
  958. if($(this).val().length==""){
  959. $(this).parent().siblings(".btnModel").attr("disabled", true);
  960. }else{
  961. $(this).parent().siblings(".btnModel").attr("disabled", false);
  962. }
  963. setTimeout(function() {
  964. $(obj).siblings().find("em").text($(obj).val().length);
  965. }, 1);
  966. },
  967. keyup: function(e) {
  968. if($(this).val().length==""){
  969. $(this).parent().siblings(".btnModel").attr("disabled", true);
  970. }else{
  971. $(this).parent().siblings(".btnModel").attr("disabled", false);
  972. }
  973. if($(this).val().length > maxNum) {
  974. $(obj).val($(obj).val().substring(0, maxNum));
  975. e.preventDefault();
  976. }
  977. setTimeout(function() {
  978. $(obj).siblings().find("em").text($(obj).val().length);
  979. }, 1);
  980. }
  981. });
  982. }
  983. 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", "-", "_"];
  984. var d64 = {
  985. "0": 0,
  986. "1": 1,
  987. "2": 2,
  988. "3": 3,
  989. "4": 4,
  990. "5": 5,
  991. "6": 6,
  992. "7": 7,
  993. "8": 8,
  994. "9": 9,
  995. "A": 10,
  996. "B": 11,
  997. "C": 12,
  998. "D": 13,
  999. "E": 14,
  1000. "F": 15,
  1001. "G": 16,
  1002. "H": 17,
  1003. "I": 18,
  1004. "J": 19,
  1005. "K": 20,
  1006. "L": 21,
  1007. "M": 22,
  1008. "N": 23,
  1009. "O": 24,
  1010. "P": 25,
  1011. "Q": 26,
  1012. "R": 27,
  1013. "S": 28,
  1014. "T": 29,
  1015. "U": 30,
  1016. "V": 31,
  1017. "W": 32,
  1018. "X": 33,
  1019. "Y": 34,
  1020. "Z": 35,
  1021. "a": 36,
  1022. "b": 37,
  1023. "c": 38,
  1024. "d": 39,
  1025. "e": 40,
  1026. "f": 41,
  1027. "g": 42,
  1028. "h": 43,
  1029. "i": 44,
  1030. "j": 45,
  1031. "k": 46,
  1032. "l": 47,
  1033. "m": 48,
  1034. "n": 49,
  1035. "o": 50,
  1036. "p": 51,
  1037. "q": 52,
  1038. "r": 53,
  1039. "s": 54,
  1040. "t": 55,
  1041. "u": 56,
  1042. "v": 57,
  1043. "w": 58,
  1044. "x": 59,
  1045. "y": 60,
  1046. "z": 61,
  1047. "-": 62,
  1048. "_": 63
  1049. };
  1050. function s16to64(s) {
  1051. var out, idx, n1, n2, n3;
  1052. idx = s.length - 1;
  1053. out = "";
  1054. while(idx >= 0) {
  1055. n1 = d64[s.charAt(idx--)];
  1056. if(idx < 0) {
  1057. out = r64[n1] + out;
  1058. break;
  1059. }
  1060. n2 = d64[s.charAt(idx--)];
  1061. if(idx < 0) {
  1062. out = r64[(n2 >>> 2)] + r64[((n2 & 0x3) << 4) + n1] + out;
  1063. break;
  1064. }
  1065. n3 = d64[s.charAt(idx--)];
  1066. out = r64[(n2 >>> 2) + (n3 << 2)] + r64[((n2 & 0x3) << 4) + n1] + out;
  1067. }
  1068. return out;
  1069. }
  1070. function s64to16(s) {
  1071. var out, idx, n1, n2;
  1072. idx = s.length - 1;
  1073. out = "";
  1074. while(idx >= 0) {
  1075. n1 = d64[s.charAt(idx--)];
  1076. if(idx < 0) {
  1077. out = r64[n1 >>> 4] + r64[n1 & 0xF] + out;
  1078. break;
  1079. }
  1080. n2 = d64[s.charAt(idx--)];
  1081. out = r64[(n2 >>> 2)] + r64[(n1 >>> 4) + ((n2 & 0x3) << 2)] + r64[n1 & 0xF] + out;
  1082. }
  1083. if(out.length>32) {
  1084. return out.substring(1);
  1085. }
  1086. return out;
  1087. }
  1088. //发现上方轮播
  1089. var bannerRotate = {// banner rotating
  1090. _time: 3000,
  1091. _i: 0,
  1092. _interval: null,
  1093. _navId: "#slide-tab",
  1094. _navBox: "#slide-list",
  1095. bannerShow: function() {
  1096. $(this._navId).find("li").removeClass("slide-tab-item-active");
  1097. $(this._navId).find("li:eq("+this._i+")").addClass("slide-tab-item-active");
  1098. $(this._navBox).find("li").removeClass("slide-item-active");
  1099. $(this._navBox).find("li:eq("+this._i+")").addClass("slide-item-active");
  1100. },
  1101. bannerStart:function() {
  1102. var _this = this;
  1103. _this._interval = setInterval(function() {
  1104. if(_this._i >= 4) {
  1105. _this._i = 0;
  1106. }
  1107. else {
  1108. _this._i++;
  1109. }
  1110. _this.bannerShow();
  1111. }, _this._time);
  1112. },
  1113. bannerInit: function() {
  1114. var _this = this;
  1115. _this.bannerStart();
  1116. $(_this._navId).find("li").bind("mouseover", function() {
  1117. clearInterval(_this._interval);
  1118. _this._i = $(this).index();
  1119. _this.bannerShow();
  1120. _this.bannerStart();
  1121. });
  1122. }
  1123. };
  1124. var currentdate;
  1125. function getNowFormatDate(num) {
  1126. var date = new Date();
  1127. var seperator1 = "-";
  1128. var seperator2 = ":";
  1129. var month = date.getMonth() + 1;
  1130. var strDate = date.getDate();
  1131. var getHours = date.getHours();
  1132. var getMinutes = date.getMinutes();
  1133. if (month >= 1 && month <= 9) {
  1134. month = "0" + month;
  1135. }
  1136. if (strDate >= 0 && strDate <= 9) {
  1137. strDate = "0" + strDate;
  1138. }
  1139. if (getMinutes >= 0 && getMinutes <= 9) {
  1140. getMinutes = "0" + getMinutes;
  1141. }
  1142. if (getHours >= 0 && getHours <= 9) {
  1143. getHours = "0" + getHours;
  1144. }
  1145. var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
  1146. + " " + getHours + seperator2 + getMinutes
  1147. if(num==1){
  1148. currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
  1149. }
  1150. return currentdate;
  1151. }
  1152. function wlog(dt, id, src) {
  1153. var src = src || "1";
  1154. var $img=$("<img src='"+wlogurl+"/log/img?__lt="+dt+"&src="+src+"&id="+id+"&_t="+(new Date().getTime())+"' style='display:none;' ></img>");
  1155. $img.appendTo($("body"));
  1156. setTimeout(function(){
  1157. $img.remove();
  1158. },5000);
  1159. // $.ajax({
  1160. // url: "http://www.ekexiu.com:8082/log/jsonp/log",
  1161. // data: {
  1162. // "id": id,
  1163. // "src": src,
  1164. // "__lt": dt,
  1165. // },
  1166. // success:function(data) {
  1167. // },
  1168. // dataType: "jsonp"
  1169. // });
  1170. }
  1171. //广告相关操作
  1172. function addscript(that){
  1173. var script=document.createElement("script");
  1174. script.setAttribute("type", "text/javascript");
  1175. var srclink= "https://www.ekexiu.com/data/inc/ad/"+ that +".js?r=" + new Date().getTime();
  1176. script.setAttribute("src", srclink);
  1177. var heads = document.getElementsByTagName("head");
  1178. if(heads.length){
  1179. heads[0].appendChild(script);
  1180. }else{
  1181. document.documentElement.appendChild(script);
  1182. }
  1183. }
  1184. $(document).ready(function(){
  1185. //处理点击事件,需要打开原生浏览器
  1186. $("body").on("click","a.advertsub",function(){
  1187. var adId = this.getAttribute('data-id');
  1188. console.log(adId)
  1189. wlog("ad", adId ,"1");
  1190. return true;
  1191. })
  1192. })