portal html css js resource

tidings.js 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. $(document).ready(function () {
  2. $(".onlogin .headnavbtn li.mymessage").addClass("navcurrent");
  3. loginStatus(); //判断个人是否登录
  4. $("#feedback").hide();
  5. var professorId = GetQueryString("id");
  6. var firstFlag;
  7. $(".list_body").niceScroll({
  8. cursorcolor: "#999999"
  9. });
  10. $(".chat_body.clearfix").niceScroll({
  11. cursorcolor: "#999999"
  12. });
  13. var userid = $.cookie("userid");
  14. if (userid == 'null') {
  15. location.href = "login.html";
  16. }
  17. function websocrket() {
  18. var ws = new WebSocket("ws://192.168.3.233:8081/portal/websocket/msg?id=" + userid + "&pm=www");
  19. ws.onopen = function () {
  20. // console.log(userid);
  21. };
  22. ws.onmessage = function (a) {
  23. var fol = true;
  24. var $info = JSON.parse(a.data);
  25. for (var i = 0; i < $(".list_body").find('.list_item').length; i++) {
  26. if ($(".list_body").find('.list_item').eq(i).attr('data-id') == $info.sender) {
  27. fol = false;
  28. $(".list_body").find('.list_item .last_news').eq(i).html(($info.cnt).replace(/\n/g, "<br />"));
  29. $(".list_body").find('.list_item .time').eq(i).text(commenTime($info.sendTime));
  30. if ($('.chat_content_nodata').css('display') == "none") {
  31. if ($(".list_body").find('.list_item .user_name').eq(i).text() == $(".usepro .user_name").text()) {
  32. setRead($info.sender, $info.sendTime);
  33. var time1 = $(".chat_body_list").find(".time").last().attr("data-createtime");
  34. if (time1) {
  35. var str1 = '<span class="time" data-createtime="' + $info.sendTime + '">' + compareTime(time1, $info.sendTime) + '</span>'
  36. } else {
  37. var str1 = '<span class="time" data-createtime="' + $info.sendTime + '">' + anTime($info.sendTime) + '</span>'
  38. }
  39. var oStr1 = '<div class="chat_item ">' +
  40. '<div class="clearfix">' +
  41. '<div class="item_avatar fl">' +
  42. '<img src="/images/head/' + $info.sender + '_l.jpg">' +
  43. '</div>' +
  44. '<div class="item_content fl">' +
  45. '<em class="is_readed"></em>' +
  46. '<div class="bubble message C_end">' + ($info.cnt).replace(/\n/g, "<br />") + '</div>' +
  47. '</div>' +
  48. '</div>' +
  49. '</div>'
  50. $(".chat_body_list").append(str1 + oStr1);
  51. $(".chat_body.clearfix").getNiceScroll().hide().show().resize();
  52. $(".chat_body.clearfix").getNiceScroll(0).doScrollTop($(".chat_body_list").height(), 100)
  53. } else {
  54. var oNu = Number($(".list_body").find('.list_item .tips_num').eq(i).text()) + 1;
  55. $(".list_body").find('.list_item .tips_num').eq(i).text(oNu).show();
  56. $('.mymessage .badge').text(Number($('.mymessage .badge').text()) + 1)
  57. getTotalMessage()
  58. }
  59. } else {
  60. var oNu = Number($(".list_body").find('.list_item .tips_num').eq(i).text()) + 1;
  61. $(".list_body").find('.list_item .tips_num').eq(i).text(oNu).show();
  62. $('.mymessage .badge').text(Number($('.mymessage .badge').text()) + 1)
  63. getTotalMessage()
  64. }
  65. if (i > 0)
  66. $(".list_body").find('.list_item').eq(i).remove().clone().prependTo($(".list_body"));
  67. } else {
  68. }
  69. }
  70. if (fol) {
  71. var ostr = '<div class="list_item clearfix active" data-id="' + $info.sender + '">' +
  72. '<i class="close_icon"></i>' +
  73. '<div class="avatar fl">' +
  74. '<img src="images/default-photo.jpg">' +
  75. '<span class="tips_num" >1</span>' +
  76. '</div>' +
  77. '<div class="list_item_info fl">' +
  78. '<div class="user_infos">' +
  79. '<span class="user_name"> </span><em class="authiconNew"></em>' +
  80. '</div>' +
  81. '<span class="time">' + commenTime($info.sendTime) + '</span><span class="last_news">' + ($info.cnt).replace(/\n/g, "<br />") + '</span>' +
  82. '</div>' +
  83. '</div>'
  84. var $str = $(ostr);
  85. $(".list_body").prepend($str);
  86. personMess($info.sender, $str.find('img'), $str.find(".user_name"), $str.find(".authiconNew"));
  87. $('.mymessage .badge').text(Number($('.mymessage .badge').text()) + 1)
  88. getTotalMessage()
  89. }
  90. };
  91. ws.onclose = function () {
  92. }
  93. }
  94. getPlatTotal()
  95. function getPlatTotal() {
  96. $.ajax({
  97. url: "/ajax/platform/msg/unread",
  98. type: "GET",
  99. timeout: 10000,
  100. dataType: "json",
  101. traditional: true,
  102. data: {
  103. provider: userid
  104. },
  105. success: function (data) {
  106. if (data.success) {
  107. if (data.data) {
  108. $('.mesTotal').text('(' + data.data + ')');
  109. }
  110. }
  111. },
  112. error: function () {
  113. $.MsgBox.Alert('提示', '链接服务器超时')
  114. }
  115. })
  116. }
  117. if (professorId) {
  118. firstFlag = 1;
  119. $(".chat_content_nodata").hide();
  120. $(".chat_content").show();
  121. angleMessageList(professorId);
  122. persons(professorId)
  123. } else {
  124. myMessageList()
  125. }
  126. /*消息内容*/
  127. function angleMessageList(opId) {
  128. $.ajax({
  129. "url": "/ajax/webMsg/cnt/load",
  130. "type": "get",
  131. "async": true,
  132. "data": {
  133. sender: opId,
  134. reciver: userid,
  135. both: true
  136. },
  137. "success": function (data) {
  138. // console.log(data)
  139. if (data.success) {
  140. $(".chat_body_list").html("")
  141. var $data = data.data;
  142. if ($data.length) {
  143. if (arguments[1]) {
  144. setRead(opId, $data[$data.length - 1].sendTime)
  145. getTotalMessage();
  146. }
  147. if (firstFlag == 1) {
  148. var ostr1 = '<div class="list_item clearfix active" data-id="' + professorId + '">' +
  149. '<i class="close_icon"></i>' +
  150. '<div class="avatar fl">' +
  151. '<img src="images/default-photo.jpg" >' +
  152. '<span class="tips_num" style="display:none;">0</span>' +
  153. '</div>' +
  154. '<div class="list_item_info fl">' +
  155. '<div class="user_infos">' +
  156. '<span class="user_name"> </span><em class="authiconNew"></em>' +
  157. '</div>' +
  158. '<span class="time">' + commenTime($data[$data.length - 1].sendTime) + '</span><span class="last_news">' + $data[$data.length - 1].cnt.replace(/\n/g, "<br />") + '</span>' +
  159. '</div>' +
  160. '</div>'
  161. var $str1 = $(ostr1);
  162. $(".list_body").prepend($str1);
  163. personMess(professorId, $str1.find('img'), $str1.find(".user_name"), $str1.find(".authiconNew"));
  164. var m = 0;
  165. for (var j = 0; j < $data.length; j++) {
  166. if (professorId == $data[j].sender) {
  167. m = m + 1;
  168. }
  169. }
  170. if (m == 0) {
  171. setRead(professorId, $data[$data.length - 1].sendTime)
  172. }
  173. myMessageList();
  174. }
  175. firstFlag = 0;
  176. for (var i = 0; i < $data.length; i++) {
  177. var le = "";
  178. var flo = 'fl';
  179. var wei = "";
  180. var fCo = "C_end";
  181. var timeG = '';
  182. if (userid == $data[i].sender) {
  183. le = "me";
  184. flo = "fr";
  185. if ($data[i].readed) {
  186. wei = '<em class="is_readed"></em>';
  187. } else {
  188. wei = '<em class="is_readed"></em>';
  189. }
  190. fCo = "B_end";
  191. }
  192. if (i == 0) {
  193. timeG = anTime($data[i].sendTime);
  194. } else {
  195. timeG = compareTime($data[i - 1].sendTime, $data[i].sendTime)
  196. }
  197. var oStr = '<span class="time" data-createtime="' + $data[i].sendTime + '">' + timeG + '</span>' +
  198. '<div class="chat_item ' + le + '">' +
  199. '<div class="clearfix">' +
  200. '<div class="item_avatar fl">' +
  201. '<img src="/images/head/' + $data[i].sender + '_l.jpg">' +
  202. '</div>' +
  203. '<div class="item_content ' + flo + '">' +
  204. wei +
  205. '<div class="bubble message ' + fCo + '">' + ($data[i].cnt).replace(/\n/g, "<br />") + '</div>' +
  206. '</div>' +
  207. '</div>' +
  208. '</div>'
  209. $(".chat_body_list").append(oStr);
  210. }
  211. $(".chat_body.clearfix").getNiceScroll().hide().show().resize();
  212. $(".chat_body.clearfix").getNiceScroll(0).doScrollTop($(".chat_body_list").height(), 100)
  213. } else {
  214. if (firstFlag) {
  215. firstFlag = 0;
  216. var ostr = '<div class="list_item clearfix active" data-id="' + professorId + '">' +
  217. '<i class="close_icon"></i>' +
  218. '<div class="avatar fl">' +
  219. '<img src="images/default-photo.jpg">' +
  220. '<span class="tips_num" style="display:none;"></span>' +
  221. '</div>' +
  222. '<div class="list_item_info fl">' +
  223. '<div class="user_infos">' +
  224. '<span class="user_name"> </span><em class="authiconNew"></em>' +
  225. '</div>' +
  226. '<span class="time"></span><span class="last_news"></span>' +
  227. '</div>' +
  228. '</div>'
  229. var $str = $(ostr);
  230. $(".list_body").prepend($str);
  231. personMess(professorId, $str.find('img'), $str.find(".user_name"), $str.find(".authiconNew"));
  232. $(".chat_content_nodata").hide();
  233. $(".chat_content").show();
  234. myMessageList();
  235. }
  236. }
  237. }
  238. },
  239. "error": function () {
  240. $.MsgBox.Alert('提示', '服务器连接超时');
  241. }
  242. });
  243. }
  244. /*关于我的消息列表*/
  245. function myMessageList(pageNum) {
  246. $.ajax({
  247. "url": "/ajax/webMsg/idx/qm",
  248. "type": "get",
  249. "async": true,
  250. "data": {
  251. id: userid,
  252. /*pageSize: 1,
  253. pageNo: pageNum*/
  254. },
  255. "success": function (data) {
  256. if (data.success) {
  257. var $data = data.data;
  258. /*if(pageNum != data.data.pageNo) {
  259. pa = false;
  260. return;
  261. }*/
  262. if ($data.length) {
  263. fillHtml($data);
  264. } else {
  265. return;
  266. }
  267. }
  268. },
  269. "error": function () {
  270. $.MsgBox.Alert('提示', '服务器连接超时');
  271. }
  272. });
  273. }
  274. /*填充页面*/
  275. function fillHtml($data) {
  276. for (var i in $data) {
  277. var num = "none"
  278. var cNumber = $data[i].num;
  279. if ($data[i].num) {
  280. num = "block";
  281. }
  282. //这里
  283. cNumber = $data[0].num
  284. var ostr = '<div class="list_item clearfix" data-id="' + $data[i].id + '">' +
  285. '<i class="close_icon"></i>' +
  286. '<div class="avatar fl">' +
  287. '<img src="images/default-photo.jpg">' +
  288. '<span class="tips_num" style="display:' + num + '">' + $data[i].num + '</span>' +
  289. '</div>' +
  290. '<div class="list_item_info fl">' +
  291. '<div class="user_infos">' +
  292. '<span class="user_name"> </span><em class="authiconNew"></em>' +
  293. '</div>' +
  294. '<span class="time">' + commenTime($data[i].timeStr) + '</span><span class="last_news">' + ($data[i].cnt).replace(/\n/g, "<br />") + '</span>' +
  295. '</div>' +
  296. '</div>'
  297. var $str = $(ostr);
  298. if (professorId) {
  299. if (professorId == $data[i].id) {
  300. } else {
  301. $(".list_body").append($str);
  302. }
  303. } else {
  304. $(".list_body").append($str);
  305. }
  306. personMess($data[i].id, $str.find('img'), $str.find(".user_name"), $str.find(".authiconNew"));
  307. }
  308. $(".list_body").getNiceScroll().hide().show().resize();
  309. websocrket();
  310. $('.mymessage .badge').text(cNumber); //渲染header头部 消息数量
  311. if ($('.mymessage .badge').text() == 0) { //如果0条信息 隐藏
  312. $('.mymessage .badge').css('display', 'none')
  313. }
  314. }
  315. //专家信息
  316. function personMess(id, pImg, pName, pTitle) {
  317. $.ajax({
  318. "url": "/ajax/professor/baseInfo/" + id,
  319. "type": "GET",
  320. "traditional": true,
  321. "dataType": "json",
  322. "success": function (data) {
  323. if (data.success) {
  324. // console.log(data);
  325. var $data = data.data;
  326. var userType = autho($data.authType, $data.orgAuth, $data.authStatus);
  327. pTitle.attr("title", userType.title).addClass(userType.sty);
  328. pName.text($data.name);
  329. if ($data.hasHeadImage) {
  330. pImg.attr("src", "/images/head/" + $data.id + "_l.jpg");
  331. }
  332. var str = '';
  333. if ($data.title) {
  334. if ($data.orgName) {
  335. if ($data.office) {
  336. str = $data.title + " " + $data.orgName + "," + $data.office;
  337. } else {
  338. str = $data.title + " " + $data.orgName;
  339. }
  340. } else {
  341. if ($data.office) {
  342. str = $data.title + " " + $data.office;
  343. } else {
  344. str = $data.title;
  345. }
  346. }
  347. } else {
  348. if ($data.orgName) {
  349. if ($data.office) {
  350. str = $data.orgName + "," + $data.office;
  351. } else {
  352. str = $data.orgName;
  353. }
  354. } else {
  355. if ($data.office) {
  356. str = $data.office;
  357. }
  358. }
  359. }
  360. var oMess = {
  361. "name": $data.name,
  362. "idf": userType,
  363. "id": $data.id,
  364. "duties": str
  365. }
  366. pImg.parents(".list_item").attr("data", JSON.stringify(oMess))
  367. }
  368. },
  369. "error": function () {
  370. $.MsgBox.Alert('提示', '服务器连接超时');
  371. }
  372. });
  373. }
  374. /*个人信息*/
  375. function persons(id) {
  376. $.ajax({
  377. "url": "/ajax/professor/baseInfo/" + id,
  378. "type": "GET",
  379. "traditional": true,
  380. "dataType": "json",
  381. "success": function (data) {
  382. if (data.success) {
  383. console.log(data);
  384. var $data = data.data;
  385. var userType = autho($data.authType, $data.orgAuth, $data.authStatus);
  386. $(".usepro").find('.authiconNew').attr("title", userType.title).addClass(userType.sty);
  387. $(".usepro").find('.user_name').text($data.name);
  388. $("#cUserPage").attr("href", "userInforShow.html?professorId=" + $data.id)
  389. var str = '';
  390. if ($data.title) {
  391. if ($data.orgName) {
  392. if ($data.office) {
  393. str = $data.title + " " + $data.orgName + "," + $data.office;
  394. } else {
  395. str = $data.title + " " + $data.orgName;
  396. }
  397. } else {
  398. if ($data.office) {
  399. str = $data.title + " " + $data.office;
  400. } else {
  401. str = $data.title;
  402. }
  403. }
  404. } else {
  405. if ($data.orgName) {
  406. if ($data.office) {
  407. str = $data.orgName + "," + $data.office;
  408. } else {
  409. str = $data.orgName;
  410. }
  411. } else {
  412. if ($data.office) {
  413. str = $data.office;
  414. }
  415. }
  416. }
  417. $('.chating_resume_status').text(str);
  418. }
  419. },
  420. "error": function () {
  421. $.MsgBox.Alert('提示', '服务器连接超时');
  422. }
  423. });
  424. }
  425. /*发送信息*/
  426. function sendMessage() {
  427. $.ajax({
  428. "url": "/ajax/webMsg",
  429. "type": "POST",
  430. "traditional": true,
  431. "data": {
  432. sender: userid,
  433. reciver: professorId,
  434. cnt: $(".messContent").val()
  435. },
  436. "dataType": "json",
  437. "success": function (data) {
  438. if (data.success) {
  439. console.log(data);
  440. $(".btnModel").attr("disabled", "disabled");
  441. var time1 = $(".chat_body_list").find(".time").last().attr("data-createtime");
  442. if (time1) {
  443. var str1 = '<span class="time" data-createtime="' + data.data + '" style="">' + compareTime(time1, data.data) + '</span>'
  444. } else {
  445. var str1 = '<span class="time" data-createtime="' + data.data + '" style="">' + anTime(data.data) + '</span>'
  446. }
  447. var oStr = '<div class="chat_item me">' +
  448. '<div class="clearfix">' +
  449. '<div class="item_avatar fl">' +
  450. '<a href="#" ><img src="/images/head/' + userid + '_l.jpg"></a>' +
  451. '</div>' +
  452. '<div class="item_content fr">' +
  453. '<em class="is_readed"></em>' +
  454. '<div class="bubble message B_end">' + $(".messContent").val().replace(/\n/g, "<br />") + '</div>' +
  455. '</div>' +
  456. '</div>' +
  457. '</div>'
  458. $(".chat_body_list").append(str1 + oStr);
  459. $(".chat_body.clearfix").getNiceScroll().hide().show().resize();
  460. $(".chat_body.clearfix").getNiceScroll(0).doScrollTop($(".chat_body_list").height(), 100)
  461. for (var i = 0; i < $(".list_body").find('.list_item').length; i++) {
  462. if ($(".list_body").find('.list_item .user_name').eq(i).text() == $(".usepro .user_name").text()) {
  463. $(".list_body").find('.list_item .last_news').eq(i).text($(".messContent").val());
  464. $(".list_body").find('.list_item .time').eq(i).text(commenTime(data.data));
  465. if (i != 0) {
  466. $(".list_body").find('.list_item').eq(i).remove().clone().prependTo($(".list_body"))
  467. }
  468. }
  469. }
  470. $(".messContent").val("");
  471. }
  472. },
  473. "error": function () {
  474. $.MsgBox.Alert('提示', '服务器连接超时');
  475. }
  476. });
  477. }
  478. $(".btnModel").click(function () {
  479. sendMessage();
  480. })
  481. $(".messContent").on("input", function () {
  482. if ($.trim($(this).val()) == "") {
  483. $('.btnModel').attr("disabled", "disabled");
  484. } else {
  485. $('.btnModel').removeAttr("disabled");
  486. }
  487. })
  488. function ci(e) {
  489. var elem = e.target;
  490. if (elem.tagName.toLowerCase() === 'img') {
  491. var $this = $(elem);
  492. $this.attr("src", "/images/default-photo.jpg");
  493. }
  494. }
  495. document.addEventListener("error", ci, true /*指定事件处理函数在捕获阶段执行*/ );
  496. getTotalMessage()
  497. function getTotalMessage() {
  498. $.ajax({
  499. url: "ajax/webMsg/unReadedCount",
  500. type: "GET",
  501. timeout: 10000,
  502. dataType: "json",
  503. traditional: true,
  504. data: {
  505. id: userid
  506. },
  507. success: function (data) {
  508. if (data.success) {
  509. if (data.data) {
  510. $('.kexiuTotal').text('(' + data.data + ')');
  511. } else {
  512. $('.kexiuTotal').text('');
  513. }
  514. }
  515. },
  516. error: function () {
  517. $.MsgBox.Alert('提示', '链接服务器超时')
  518. }
  519. })
  520. }
  521. /*切换*/
  522. $(".list_body").on("click", ".list_item", function () {
  523. $(this).addClass("active").siblings().removeClass("active");
  524. if ($(this).find(".tips_num").css("display") == "block") {
  525. // $('.mymessage .badge').text(Number($('.mymessage .badge').text())-Number($(this).find(".tips_num").text()));
  526. $('.mymessage .badge').text(Number($(this).find(".tips_num").text()));
  527. // if ($(this).find('.tips_num').text() == 0) {
  528. // console.log(1)
  529. // $(".mymessage .badge").text('');
  530. // }
  531. if ($('.mymessage .badge').text() != 0) { // 消息联动
  532. $(".mymessage .badge").text('');
  533. }
  534. }
  535. $(this).find(".tips_num").text(0).hide();
  536. if ($(".usepro .user_name").css("display") == "block") {
  537. if ($(this).find(".user_name").text() == $(".usepro .user_name").text()) {
  538. return;
  539. }
  540. }
  541. $(".chat_content_nodata").hide();
  542. $(".chat_content").show();
  543. var pro = JSON.parse($(this).attr("data"));
  544. $("#cUserPage").attr("href", "userInforShow.html?professorId=" + pro.id)
  545. $(".usepro").find(".user_name").text(pro.name).siblings(".authiconNew").addClass(pro.idf.sty).attr("title", pro.idf.title).parent().siblings(".chating_resume_status").text(pro.duties);
  546. professorId = pro.id;
  547. if (Number($(this).find(".tips_num").text())) {
  548. angleMessageList(pro.id, true);
  549. } else {
  550. angleMessageList(pro.id);
  551. }
  552. getTotalMessage()
  553. });
  554. /*让消息置为已读*/
  555. function setRead(opid, time) {
  556. $.ajax({
  557. "url": "/ajax/webMsg/readed",
  558. "type": "POST",
  559. "traditional": true,
  560. "data": {
  561. sender: opid,
  562. reciver: userid,
  563. time: time
  564. },
  565. "dataType": "json",
  566. "success": function (data) {
  567. if (data.success) {
  568. }
  569. },
  570. "error": function () {
  571. $.MsgBox.Alert('提示', '服务器连接超时');
  572. }
  573. });
  574. }
  575. /*超过时间10min*/
  576. function timeC(startTime) {
  577. var startdate = new Date();
  578. startdate.setFullYear(parseInt(startTime.substring(0, 4)));
  579. startdate.setMonth(parseInt(startTime.substring(4, 6)) - 1);
  580. startdate.setDate(parseInt(startTime.substring(6, 8)));
  581. startdate.setHours(parseInt(startTime.substring(8, 10)));
  582. startdate.setMinutes(parseInt(startTime.substring(10, 12)));
  583. startdate.setSeconds(parseInt(startTime.substring(12, 14)));
  584. startdate.setMilliseconds(parseInt(startTime.substring(14, 17)));
  585. return startdate.getTime();
  586. }
  587. function compareTime(startTime, secondTime) {
  588. var date3 = timeC(secondTime) - timeC(startTime); //时间差的毫秒数
  589. if (date3 >= 600000) {
  590. if (new Date().getFullYear() == secondTime.substring(0, 4)) {
  591. return secondTime.substring(4, 6).replace(/\b(0+)/gi, "") + "月" + secondTime.substring(6, 8).replace(/\b(0+)/gi, "") + "日 " + secondTime.substring(8, 10) + ":" + secondTime.substring(10, 12);
  592. } else {
  593. return secondTime.substring(0, 4) + "年" + secondTime.substring(4, 6).replace(/\b(0+)/gi, "") + "月" + secondTime.substring(6, 8).replace(/\b(0+)/gi, "") + "日 " + secondTime.substring(8, 10) + ":" + secondTime.substring(10, 12);
  594. }
  595. } else {
  596. return '';
  597. }
  598. }
  599. function anTime(secondTime) {
  600. if (new Date().getFullYear() == secondTime.substring(0, 4)) {
  601. return secondTime.substring(4, 6).replace(/\b(0+)/gi, "") + "月" + secondTime.substring(6, 8).replace(/\b(0+)/gi, "") + "日 " + secondTime.substring(8, 10) + ":" + secondTime.substring(10, 12);
  602. } else {
  603. return secondTime.substring(0, 4) + "年" + secondTime.substring(4, 6).replace(/\b(0+)/gi, "") + "月" + secondTime.substring(6, 8).replace(/\b(0+)/gi, "") + "日 " + secondTime.substring(8, 10) + ":" + secondTime.substring(10, 12);
  604. }
  605. }
  606. /*滚动加载
  607. $('.list_body').scroll(function() {
  608. var $me = $(this);
  609. var scrollTop = $me.scrollTop();
  610. var height = $me.height();
  611. var scrollHeight = $me.prop('scrollHeight');
  612. /*console.log(scrollTop)
  613. console.log(height)
  614. console.log(scrollHeight)*/
  615. /*if(scrollHeight - scrollTop - height < 1) {
  616. if(pa) {
  617. pageNo++;
  618. myMessageList(pageNo)
  619. }
  620. }
  621. });*/
  622. /*删除会话*/
  623. var $that;
  624. $(".list_body").on("click", ".close_icon", function () {
  625. $that = $(this)
  626. $.MsgBox.Confirm("提示", "确定删除?", deleChat);
  627. return false;
  628. })
  629. /*会话删除函数*/
  630. function deleChat() {
  631. $.ajax({
  632. "url": "/ajax/webMsg/disable/show",
  633. "type": "POST",
  634. "traditional": true,
  635. "data": {
  636. owner: userid,
  637. actor: $that.parents(".list_item").attr('data-id')
  638. },
  639. "context": $that.parents(".list_item"),
  640. "dataType": "json",
  641. "success": function (data) {
  642. if (data.success) {
  643. $(this).remove();
  644. $(".chat_content_nodata").show();
  645. $(".chat_content").hide();
  646. unReadedCount(userid);
  647. }
  648. },
  649. "error": function () {
  650. $.MsgBox.Alert('提示', '服务器连接超时');
  651. }
  652. });
  653. }
  654. $("#repo").click(function () {
  655. $("#report").toggle();
  656. })
  657. $("#report").on("click", function () {
  658. $(".cBacktit>span").text("举报")
  659. $(".correctCon")[0].placeholder = "请具体说明举报对方的原因,以便我们为您快速解决";
  660. $("#correctBlock").fadeToggle();
  661. $(this).hide();
  662. })
  663. /*纠错反馈*/
  664. $(".correctSubmit").on("click", function () {
  665. var cntCon = $(this).siblings(".correctCon").val();
  666. if (cntCon.length > 500) {
  667. $.MsgBox.Alert('提示', '举报内容不得超过500个字');
  668. return;
  669. } else {
  670. $.ajax({
  671. "url": "/ajax/feedback/error/professor",
  672. "type": "POST",
  673. "dataType": "json",
  674. "async": true,
  675. "data": {
  676. "id": professorId,
  677. "cnt": cntCon,
  678. "user": userid
  679. },
  680. "success": function (data) {
  681. if (data.success) {
  682. backSuccessed();
  683. $("#mb_msgcontent").text("很抱歉为您带来不好的体验我们会为您尽快解决");
  684. }
  685. },
  686. "error": function () {
  687. $.MsgBox.Alert('提示', '链接服务器超时')
  688. }
  689. });
  690. }
  691. })
  692. })