portal html css js resource

common.js 30KB

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