portal html css js resource

common.js 34KB

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