portal html css js resource

common.js 29KB

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