portal html css js resource

common.js 25KB

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