portal html css js resource

common.js 30KB

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