portal html css js resource

common.js 33KB

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