fzxz-jumingim.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. // TODO 临时构造plus对象,使得能够在浏览器中进行调试
  2. //var plus = null;
  3. // 登录者相关信息(包括userAgent)
  4. var loginerInfo = null,
  5. // 基础环境信息(包括当前webview)
  6. baseEnv = null,
  7. docInfo = null,
  8. self = null,
  9. activeItem = null,
  10. isInit;
  11. var $queryTab = $('#query_tab'),
  12. $doingView = $('#search_result'),
  13. $doingViewList = $doingView.find('.c-list'),
  14. // 搜索无结果时显示
  15. $noResultWrap = $('#no_result_wrap'),
  16. $searchbar = $(".searchbar-input");
  17. var orginalData = [];
  18. var zdList, zdListKey = "",
  19. msg_del_list, msg_del_list_key = "",
  20. msg_cache_key = "";
  21. var first = true;
  22. var pageIndex = 1; // 分页
  23. var unreadCount = 0;
  24. mui.plusReady(function() {
  25. self = plus.webview.currentWebview();
  26. docInfo = JSON.parse(plus.storage.getItem("docInfo"));
  27. zdListKey = "fzxz_jm_zdList_"+ docInfo.code;
  28. msg_del_list_key = "fzxz_jm_msg_del_list_"+ docInfo.code;
  29. msg_cache_key = "fzxz_jm_msg_cache_key"+ docInfo.code;
  30. zdList = plus.storage.getItem(zdListKey);
  31. zdList = zdList? JSON.parse(zdList) : [];
  32. msg_del_list = plus.storage.getItem(msg_del_list_key);
  33. msg_del_list = msg_del_list? JSON.parse(msg_del_list) : {};
  34. plus.storage.removeItem(msg_cache_key);
  35. });
  36. // ”医生im”列表分页查询最后一条记录Id
  37. var doingLastId = 0,
  38. // ”医生im”列表iscroll 滚动条实例
  39. doingIscroller;
  40. // 获取登录相关信息
  41. var getLoginerInfo = function() {
  42. // 登录的相关信息
  43. var userAgent = plus && JSON.parse(plus.storage.getItem("userAgent"))
  44. return {
  45. userAgent: userAgent
  46. }
  47. },
  48. // 获取基础环境信息
  49. getBaseEnvPromise = function () {
  50. var env = {
  51. webview: plus&&plus.webview.currentWebview()
  52. };
  53. return Promise.resolve().then(function(res) {
  54. return env;
  55. });
  56. },
  57. formatDate = function(timestamp){
  58. var date = new Date(timestamp);
  59. Y = date.getFullYear() + '-';
  60. M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
  61. D = date.getDate() < 10 ?'0'+date.getDate():date.getDate();
  62. return Y+M+D;
  63. },
  64. setPhoto = function(groupPhoto){
  65. var images = '';
  66. var cssArr=null;
  67. for(var i in groupPhoto){
  68. if(groupPhoto[i].ispatient=="1"){//患者信息
  69. cssArr = ["position: absolute;width: 50px !important;height: 50px !important;border-radius: 50px;background-size: 50px;overflow: hidden;"];
  70. images+='<div class="div-image" style="'+cssArr+'">'+
  71. '<img src="'+getImgUrl(groupPhoto[i].avatar)+'"/>'+
  72. '</div>';
  73. break;
  74. }
  75. }
  76. return images;
  77. return false;
  78. var images = '';
  79. var cssArr=null;
  80. if(groupPhoto.length>=5){
  81. cssArr = ["top: 0;left: 50%;margin-left: -8px;","top: 12px;left: 2px;","top: 12px;left: 28px;","top: 27px;left: 5px;","top: 27px;left: 24px;"];
  82. }else if(groupPhoto.length==4){
  83. cssArr = ["top: 5px;left: 3px;","top: 5px;left: 25px;","top: 27px;left: 3px;"," top: 27px;left: 25px;"];
  84. }else if(groupPhoto.length==3){
  85. cssArr = ["top: 5px;left: 50%;margin-left: -10px;","top: 20px;left: 3px;","top: 20px;left: 25px;"];
  86. }else if(groupPhoto.length==2){
  87. cssArr = ["top: 5px;left: 50%;margin-left: -10px;"," top: 19px;left: 24px;"];
  88. }else if(groupPhoto.length==1 || groupPhoto.length==0){
  89. cssArr = ["position: absolute;width: 50px !important;height: 50px !important;border-radius: 50px;background-size: 50px;overflow: hidden;"];
  90. }
  91. for(var i in groupPhoto){
  92. if(i>4) break;
  93. if(groupPhoto[i].avatar){
  94. images+='<div class="div-image" style="'+cssArr[i]+'">'+
  95. '<img src="'+getImgUrl(groupPhoto[i].avatar)+'"/>'+
  96. '</div>';
  97. }else{
  98. if(groupPhoto[i].role=="doctor"){
  99. images+='<div class="div-image" style="'+cssArr[i]+'">'+
  100. '<img src="../../../images/d-default.png"/>'+
  101. '</div>';
  102. }else{
  103. images+='<div class="div-image" style="'+cssArr[i]+'">'+
  104. '<img src="../../../images/p-default.png"/>'+
  105. '</div>';
  106. }
  107. }
  108. }
  109. return images;
  110. },
  111. initPage = function(){
  112. var msg = plus.storage.getItem(msg_cache_key);
  113. if(msg && msg!="[]"){
  114. msg = JSON.parse(msg);
  115. render(msg, true, false);
  116. getData(false, false);
  117. } else {
  118. getData(false, false);
  119. }
  120. },
  121. render= function(data, isInit, isPullDown, isPullUp){
  122. plus.storage.setItem(msg_cache_key, JSON.stringify(data));
  123. if(pageIndex==1 && data.length==0){
  124. $doingView.hide();
  125. $doingViewList.hide();
  126. $noResultWrap.show();
  127. $(".lin-search").hide();
  128. if(myScroll){
  129. myScroll.refresh();
  130. myScroll.endPulldownToRefresh();
  131. }
  132. mui.later(function(){
  133. $(".l-pullDown").hide();
  134. }, 200)
  135. } else {
  136. if(isInit){
  137. //初始化
  138. $doingViewList.html( template("jm_li_tmpl", {list: data}));
  139. } else if(isPullUp) {
  140. for(var i=data.length-1; i>=0; i--){
  141. v = data[i];
  142. $doingViewList.append( template('jm_li_tmpl', {list: [v]}));
  143. }
  144. myScroll.endPullupToRefresh(data.length<50);
  145. } else {
  146. //更新
  147. var v;
  148. var $lastDom = $('#doing_list li.zd');
  149. $lastDom = $lastDom.length? $($lastDom[$lastDom.length-1]) : undefined;
  150. for(var i=data.length-1; i>=0; i--){
  151. v = data[i];
  152. var $dom = $('#doing_list li[data-code="'+ v.code +'"]');
  153. if($dom.length){
  154. if($dom.attr('data-timestamp')==v.timestamp){
  155. $dom.find('.last-content').text(v.content);
  156. $dom.find('.red-dot').text(v.count).toggle(v.count>0&&v.my_role==0);
  157. } else {
  158. $dom.remove();
  159. $lastDom ? $lastDom.after( template('jm_li_tmpl', {list: [v]}))
  160. : $doingViewList.prepend( template('jm_li_tmpl', {list: [v]}) );
  161. }
  162. } else {
  163. $lastDom ? $lastDom.after( template('jm_li_tmpl', {list: [v]}) )
  164. : $doingViewList.prepend( template('jm_li_tmpl', {list: [v]}));
  165. }
  166. }
  167. if($('#doing_list:hidden').length){
  168. $doingViewList.show();
  169. $noResultWrap.hide();
  170. $(".lin-search").show();
  171. $(".l-pullDown").show();
  172. }
  173. }
  174. if(isPullDown)
  175. myScroll.endPulldownToRefresh();
  176. else
  177. myScroll.refresh();
  178. loadPhoto();
  179. }
  180. },
  181. getData = function(isInit, isPullDown, isPullUp) {
  182. var resultArr = [];
  183. imClient.Sessions.getSessionsWithPatient(docInfo.code, pageIndex, 50, 1 ,function(rs){
  184. if(!isPullUp) {
  185. $('#doing_list').find('li').remove();
  186. }
  187. var d, isNoRs = true;
  188. if(rs && rs.length) {
  189. pageIndex++;
  190. }
  191. for(var k in rs){
  192. d = rs[k];
  193. if(d.type!=0 && d.type!=3){
  194. isNoRs = false;
  195. var dateStr = asessTime(d.create_date);
  196. var p = {
  197. count: d.unread_count || 0,
  198. time: d.last_content==""? "" : dateStr,
  199. code: d.id,
  200. name: d.name,
  201. last_content: formatMsg( d.last_content, d.last_content_type),
  202. timestamp: d.create_date,
  203. photo:"",
  204. type: d.type,
  205. my_role: d.my_role,
  206. sex:d.sender_sex,
  207. birthday:d.sender_birthday,
  208. senderName:d.sender_name,
  209. senderId: d.sender_id,
  210. userLevel:docInfo.level,
  211. is_invite:d.is_invite,
  212. last_content_type:d.last_content_type=="5"?JSON.stringify(d.last_content_type):d.last_content_type
  213. }
  214. if(p.my_role != "1"){ //旁听的消息未读数不记录count
  215. unreadCount += p.count;
  216. }
  217. resultArr.push(p);
  218. }
  219. }
  220. if(isPullUp) {
  221. render(soreByTimeStamp(resultArr), isInit, isPullDown,isPullUp);
  222. } else {
  223. unreadCount = 0;
  224. if(isNoRs){
  225. render([], isInit, isPullDown);
  226. } else {
  227. render(soreByTimeStamp(resultArr), isInit, isPullDown);
  228. //刷新未读消息数
  229. mui.fire(plus.webview.getWebviewById("xiaoxi.html"), "imMsgCount", {patient: unreadCount});
  230. }
  231. $('#doing_list').find('li[data-type="link"]').remove();
  232. $('#doing_list').prepend($(".div-fzxzjm").html())
  233. }
  234. }, function(msg){
  235. console.error("e:"+JSON.stringify(msg))
  236. errHandle(isPullDown);
  237. })
  238. },
  239. loadPhoto = function(){
  240. $.each($('#doing_list li[data-load!="1"]'), function(i, v) {
  241. imClient.Sessions.getParticipantsAvatars($(v).attr('data-code'), function(rs){
  242. $(v).attr('data-load', 1);
  243. if(rs.length>0){
  244. var $photo = $(v).find('.c-avatar-m');
  245. if($(v).attr('data-type')==2){
  246. for(var k in rs){
  247. if(docInfo.code != rs[k].id){
  248. $photo.html('<img src="'+ getImgUrl(rs[k].avatar) +'">');
  249. break;
  250. }
  251. }
  252. } else {
  253. $photo.html(setPhoto(rs));
  254. }
  255. }
  256. }, function(){
  257. })
  258. });
  259. },
  260. errHandle = function(isPullDown){
  261. if(isPullDown) myScroll.endPulldownToRefresh();
  262. mui.toast("数据加载失败,请检查网络无误后下拉刷新。");
  263. },
  264. soreByTimeStamp = function(resultArr){
  265. orginalData = resultArr;
  266. var resArr = [];
  267. if(!isEmpty(msg_del_list)){
  268. _.each(resultArr,function(v){
  269. var isAdd = false;
  270. _.each(msg_del_list,function(val){
  271. if(msg_del_list[v.code]!=v.timestamp.toString()){
  272. if(!isAdd){
  273. resArr.push(v);
  274. isAdd = true;
  275. }
  276. }
  277. })
  278. })
  279. }else{
  280. resArr = resultArr;
  281. }
  282. var aArr = [];
  283. var bArr = [];
  284. for(var x=0;x<resultArr.length;x++){
  285. resultArr[x].isZD = false;
  286. for(var i=zdList.length-1;i>=0;i--){
  287. if(zdList[i]==resultArr[x].code){
  288. resultArr[x].isZD = true;
  289. aArr.push(resultArr[x]);
  290. break;
  291. }
  292. }
  293. }
  294. _.chain(resArr)
  295. // 根据date日期字段排序
  296. .sortBy("timestamp").reverse()
  297. .each(function(v){
  298. if(!(_.contains(zdList,v.code))){
  299. bArr.push(v);
  300. }
  301. });
  302. var formatResult = aArr.concat(bArr);
  303. return formatResult;
  304. },
  305. isEmpty = function(value){
  306. return (Array.isArray(value) && value.length === 0)
  307. || (Object.prototype.isPrototypeOf(value) && Object.keys(value).length === 0);
  308. },
  309. //返回刷新时间
  310. backToZdzx = function () {
  311. var old_back = mui.back;
  312. mui.back = function() {
  313. var wv = plus.webview.getWebviewById("jumingim.html");
  314. if(wv) {
  315. mui.fire(wv, "update");
  316. }
  317. old_back();
  318. }
  319. },
  320. // 绑定页面事件
  321. bindEvents = function () {
  322. $('#doing_list')
  323. /*屏蔽置顶和删除功能
  324. .on('touchstart', 'div.zdan', function(){ // 置顶按钮
  325. $zdDom = $(this);
  326. })
  327. .on('touchstart', 'div.qxzdan', function(){ // 取消置顶按钮
  328. var $li = $(this).closest('li');
  329. var code = $li.attr('data-code');
  330. zdList = _.without(zdList,code);
  331. plus.storage.setItem(zdListKey, JSON.stringify(zdList));
  332. var data = soreByTimeStamp(orginalData);
  333. var v;
  334. for(var i=0; i<data.length; i++){
  335. v =data[i];
  336. if(v.code == code){
  337. $li.remove();
  338. var $aLi = $doingViewList.find("li:eq("+ i +")");
  339. if($aLi.length>0){
  340. $aLi.before( template('jm_li_tmpl', {list: [v]}) );
  341. } else {
  342. $doingViewList.append( template('jm_li_tmpl', {list: [v]}) );
  343. }
  344. break;
  345. }
  346. }
  347. })
  348. .on('touchstart', 'div.scan', function(){ // 删除按钮
  349. var $li = $(this).closest('li');
  350. var code = $li.attr('data-code');
  351. msg_del_list[code] = $li.attr('data-timestamp');
  352. var newList = [];
  353. if(zdList){
  354. for(var i=0; i<zdList.length; i++){
  355. if(zdList[i] != code){
  356. newList.push(zdList[i]);
  357. }
  358. }
  359. }
  360. zdList = newList;
  361. plus.storage.setItem(zdListKey, JSON.stringify(zdList));
  362. saveMsgDelList();
  363. $li.remove();
  364. myScroll.refresh();
  365. return false;
  366. })
  367. .on('touchstart', 'li', function(e){ //左滑动作开始
  368. e.preventDefault();
  369. startScrollX = e.originalEvent.targetTouches[0].screenX;
  370. })
  371. .on('touchmove', 'li', function(e){ //左滑动作移动
  372. if(xScroll != true) return;
  373. e.preventDefault();
  374. scrollX = e.originalEvent.targetTouches[0].screenX - startScrollX;
  375. var offLeft = $(e.currentTarget).find('div.operate').children('div').length * (-70);
  376. if(scrollX<0 && scrollX >= offLeft)
  377. $(e.currentTarget).css('left', scrollX + 'px');
  378. })
  379. .on('touchend', 'li', function(e){ //左滑动作结束
  380. e.preventDefault();
  381. if(scrollX<-50){
  382. $scrollDom = $(e.currentTarget);
  383. var offLeft = $(e.currentTarget).find('div.operate').children('div').length * (-70);
  384. $scrollDom.animate({left: offLeft}, "fast");
  385. } else{
  386. startScrollX = undefined;
  387. $scrollDom = undefined;
  388. $(e.currentTarget).animate({left: '0px'}, "fast");
  389. }
  390. scrollX = undefined;
  391. xScroll = false;
  392. myScroll.options.isLeftScroll = false;
  393. })
  394. */
  395. .on('tap','li',function() {
  396. var $this = $(this),
  397. code = $this.attr('data-code'),
  398. name = $this.find('.c-name').html(),
  399. type = $this.attr('data-type');
  400. if(type == '8'){
  401. //续方咨询
  402. openWebview('../../message/html/xufangzixun.html',{
  403. type: type,
  404. sessionId: code,
  405. sessionName: name
  406. });
  407. return false;
  408. }
  409. openWebview("../../message/html/p2dzixun.html",{type: type, sessionId: code, sessionName: name});
  410. // if(type=="patients"){//医生对居民1对1
  411. // openWebview("../../message/html/p2dzixun.html",{otherCode: code,otherName: name,otherPhoto: photo,otherSex: sex});
  412. // }else{//健康咨询讨论组
  413. // openWebview("../../message/html/qiuzhuqunliao.html",{groupName: name, groupCode: code});
  414. // }
  415. })
  416. /**
  417. * 取消左移块的事件
  418. */
  419. $('body').on('touchstart', function(e){
  420. if($scrollDom){
  421. $scrollDom.animate({left: '0px'}, "fast", undefined, function(){
  422. if($zdDom){
  423. var code = $zdDom.closest('li').prependTo("#doing_list").addClass("zd").attr('data-code');
  424. $zdDom.html("取消<br/>置顶").removeClass("zdan").addClass("qxzdan");
  425. $zdDom = undefined;
  426. var newList = [];
  427. if(zdList){
  428. for(var i=0; i<zdList.length; i++){
  429. if(zdList[i] != code){
  430. newList.push(zdList[i]);
  431. }
  432. }
  433. newList.push(code);
  434. } else {
  435. newList = [code];
  436. }
  437. zdList = newList;
  438. plus.storage.setItem(zdListKey, JSON.stringify(zdList));
  439. }
  440. });
  441. return false;
  442. }
  443. }).on('touchmove', function(e){
  444. e.preventDefault();
  445. })
  446. };
  447. // 页面业务处理流程开始
  448. new Promise(function(resolve, reject) {
  449. // TODO 临时放开
  450. //resolve(true);
  451. mui.plusReady(function() {
  452. // plus已经准备好,可以往下执行
  453. resolve(true);
  454. });
  455. }).then(function() {
  456. // 获取基础环境信息
  457. return getBaseEnvPromise().then(function(env) {
  458. baseEnv = env;
  459. }).then(function() {
  460. // 获取登录医生信息
  461. loginerInfo = getLoginerInfo();
  462. loaded();
  463. initPage();
  464. backToZdzx();
  465. bindEvents();// 绑定页面事件
  466. })
  467. });
  468. //.catch(function(e) {
  469. // plus.nativeUI.closeWaiting();
  470. // console && console.error(e);
  471. //});
  472. var xScroll = 0;
  473. var yOff = 0, xOff = 0, myScroll;
  474. var $scrollDom, $zdDom;
  475. /**
  476. * 初始化iscroll
  477. */
  478. function loaded () {
  479. var deceleration = mui.os.ios?0.003:0.0009;
  480. mui('.mui-scroll-wrapper').scroll({
  481. bounce: false,
  482. indicators: true, //是否显示滚动条
  483. deceleration:deceleration
  484. });
  485. myScroll = mui(".mui-scroll-wrapper").pullRefresh({
  486. up: {
  487. callback: function() {
  488. getData(false, false,true);
  489. }
  490. },
  491. down: {
  492. callback: function() {
  493. pageIndex = 1;
  494. getData(false, true);
  495. }
  496. },
  497. scrollLeft: function(){
  498. xScroll = true;
  499. }
  500. });
  501. return;
  502. }
  503. function saveMsgDelList(){
  504. plus.storage.setItem(msg_del_list_key, JSON.stringify(msg_del_list));
  505. }
  506. template.helper("setAge", function(timestamp) {
  507. return calcAge(timestamp)+"岁";
  508. });
  509. /**
  510. * 获取最后一个置顶元素,如无置顶元素,返回false
  511. */
  512. function getTopDom(){
  513. var $d;
  514. for(var i=0; i<zdList.length; i++){
  515. $d = $('#doing_list li[data-code="'+ zdList[i] +'"]');
  516. if($d.length > 0)
  517. return $d;
  518. }
  519. return false;
  520. }
  521. function formatMsg(msg, type){
  522. switch(parseInt(type)){
  523. case 0:
  524. case 1: return msg;
  525. case 2: return "[图片]";
  526. case 3: return "[语音]";
  527. case 4:
  528. msg = msg.replace(/\n/g, "\\n");
  529. msg = msg.replace(/\r/g, "\\r");
  530. msg = msg.replace(/\t/g, "\\t");
  531. // //解决线上出现特殊符号,JSON没办法转义问题
  532. // var num = msg.indexOf(',"type":');
  533. // var tag = msg.substring(num+8,num+9)*1;
  534. // var msgType = tag || 0;
  535. msg = JSON.parse(msg);
  536. var msgType = msg.type||0;
  537. if(msgType==0){
  538. return "[健康教育]";
  539. }else if(msgType==1){
  540. return "[健康记录]";
  541. }else{
  542. return "[健康指导]";
  543. }
  544. case 5:
  545. msg = JSON.parse(msg);
  546. return "已向"+msg.doctor_name+"求助";
  547. case 6: return msg;
  548. case 7: return msg;
  549. case 11: return msg;
  550. case 12: return "[视频]";
  551. case 13: return msg;
  552. case 14: return msg;
  553. case 15: return msg?JSON.parse(msg).result:'';
  554. case 16: return function(){
  555. if(msg){
  556. var obj = JSON.parse(msg);
  557. return obj.needUpload == 'true'?obj.tzAlert:obj.tzMsg
  558. }else{
  559. return ''
  560. }
  561. }();
  562. case 17: return msg?JSON.parse(msg).doctorremind:'';
  563. default: return "";
  564. }
  565. }
  566. /**
  567. * 往指定元素后面添加
  568. */
  569. function appendAfterZd($lastZd, appendDom){
  570. if($lastZd != false){
  571. $lastZd.after(appendDom);
  572. } else {
  573. $('#doing_list').prepend(appendDom);
  574. }
  575. }
  576. function asessTime(timestamp){
  577. var today = new Date().format('yyyy-MM-dd');
  578. var date = new Date();
  579. date.setTime(timestamp);
  580. var dateStr = date.format('yyyy-MM-dd');
  581. if(!today.substring(0,4) == dateStr.substring(0,4)){
  582. return dateStr;
  583. }
  584. if(today == dateStr){
  585. return date.format('hh:mm');
  586. }
  587. return date.format('MM-dd');
  588. }
  589. function calcAge(timestamp){
  590. var date = new Date(timestamp);
  591. Y = date.getFullYear() + '-';
  592. M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
  593. D = date.getDate() < 10 ?'0'+date.getDate():date.getDate();
  594. var birthday = Y+M+D;
  595. var r = birthday.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
  596. if(r==null)return false;
  597. var d= new Date(r[1], r[3]-1, r[4]);
  598. if(d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]){
  599. var Y = new Date().getFullYear();
  600. if((Y-r[1])<=0){
  601. return "<1";
  602. }
  603. return (Y-r[1]);
  604. }
  605. }
  606. window.addEventListener("update", function(){
  607. pageIndex = 1;
  608. getData(false, false);
  609. });
  610. window.addEventListener("xiaoxiUpdate", function(){
  611. pageIndex = 1;
  612. getData(false, false);
  613. });