portal html css js resource

common.js 30KB

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