portal html css js resource

common.js 32KB

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