messageList.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  6. <meta name="apple-mobile-web-app-capable" content="yes">
  7. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  8. <title>党建系统</title>
  9. <link href="../../css/mui.min.css" rel="stylesheet" />
  10. <link href="../../css/OA-style.css" rel="stylesheet" />
  11. </head>
  12. <body>
  13. <header class="mui-bar mui-bar-nav ">
  14. <a href="" class="mui-action-back back mui-pull-left"><img src="../../images/back.png"></a>
  15. <h1 id="title" class="mui-title">我的消息</h1>
  16. <a class="mui-icon mui-pull-right" id="save" onclick="batchRead()">
  17. <img src="../../images/batchRead.png" style="width: 24px;" />
  18. </a>
  19. </header>
  20. <div class="mui-content">
  21. <div id="pullrefresh" class="mui-content mui-scroll-wrapper" style="">
  22. <!--<div class="mui-card" v-for="item in items">
  23. <a href="javascript:;" :data-id="item.id" @tap="open_detail(item)" style="color: black;">
  24. <div class="mui-card-header tongzhi_title" style="height: 20px;overflow: hidden;">
  25. <span class="tongzhi_div" v-if="item.isread=='N'"><img class="tongzhi_img2" src="../../images/newt.png"></span>
  26. <span class="tongzhi_div3"><b id="messtitle">{{item.title}}</b></span>
  27. </div>
  28. <div class="mui-card-content">
  29. <div class="mui-card-content-inner">
  30. <div >
  31. <div class="tongzhi_div2">{{item.content}}</div><p></p>
  32. <div class="tongzhi_div4">
  33. <span class="tongzhi_div" ><img class="tongzhi_img" src="../../images/zhibanshijian.png"></span>
  34. <span class="tongzhi_div1" >{{item.sendTime}}</span>
  35. </div><br>
  36. </div>
  37. </div>
  38. </div>
  39. </a>
  40. </div>-->
  41. <div class="mui-card" v-for="item in items">
  42. <a href="javascript:;" v-if="item.status=='0'" :data-id="item.id" @tap="open_detail(item)" style="color: black;">
  43. <div class="mui-card-content" style="background-color: aliceblue;">
  44. <div class="mui-card-content-inner mui-ellipsis tongzhi_title tongzhi_xian">
  45. <span class="tongzhi_div" v-if="item.isread=='N'"><img class="tongzhi_img2" src="../../images/newt.png"></span>
  46. <b id="messtitle">{{item.title}}</b>
  47. </div>
  48. </div>
  49. <div class="mui-card-content-inner">
  50. <div >
  51. <div class="tongzhi_div2">{{item.content}}</div><p></p>
  52. <div class="tongzhi_div4">
  53. <span class="tongzhi_div" ><img class="tongzhi_img" src="../../images/zhibanshijian.png"></span>
  54. <span class="tongzhi_div1" >{{item.sendTime}}</span>
  55. </div><br>
  56. </div>
  57. </div>
  58. </a>
  59. <a href="javascript:;" v-if="item.status=='2'" :data-id="item.id" style="color: black;">
  60. <div class="mui-card-content" style="background-color: #ececec;">
  61. <div class="mui-card-content-inner mui-ellipsis tongzhi_title tongzhi_xian">
  62. <span class="tongzhi_div" v-if="item.isread=='N'"><img class="tongzhi_img2" src="../../images/newt.png"></span>
  63. <b id="messtitle">{{item.title}}</b>
  64. </div>
  65. </div>
  66. <div class="mui-card-content-inner" style="background-color: #ececec;">
  67. <div >
  68. <div class="tongzhi_div2">{{item.content}}</div><p></p>
  69. <div class="tongzhi_div4">
  70. <span class="tongzhi_div" ><img class="tongzhi_img" src="../../images/zhibanshijian.png"></span>
  71. <span class="tongzhi_div1" >{{item.sendTime}}</span>
  72. </div><br>
  73. </div>
  74. </div>
  75. </a>
  76. </div>
  77. <div></div>
  78. </div>
  79. </div>
  80. <script type="text/javascript" src="../../js/jquery-1.11.2.min.js"></script>
  81. <script src="../../js/mui.min.js"></script>
  82. <script src="../../js/config.js"></script>
  83. <script src="../../js/app.js"></script>
  84. <script src="../../js/vue.min.js"></script>
  85. <script src="../../js/mui.pullToRefresh.js"></script>
  86. <script src="../../js/mui.pullToRefresh.material.js"></script>
  87. <script>
  88. var pageDetail = null;
  89. mui.init({
  90. pullRefresh: {
  91. container: '#pullrefresh',
  92. down: {
  93. style: 'circle', //必选,下拉刷新样式,目前支持原生5+ ‘circle’ 样式
  94. color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
  95. height: '50px', //可选,默认50px.下拉刷新控件的高度,
  96. range: '100px', //可选 默认100px,控件可下拉拖拽的范围
  97. offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
  98. // auto: true, //可选,默认false.首次加载自动上拉刷新一次
  99. callback: reloadNews //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
  100. // callback: function() {
  101. // var self = this;
  102. // setTimeout(function() {
  103. // reloadNews(self);
  104. // self.endPullDownToRefresh();
  105. // }, 1000); //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
  106. // }
  107. },
  108. up: {
  109. contentrefresh: '正在加载...',
  110. auto: true, //可选,默认false.自动上拉加载一次
  111. callback: pullupRefresh
  112. // callback: function() {
  113. // var self = this;
  114. // setTimeout(function() {
  115. // //var ul = self.element.querySelector('.mui-table-view');
  116. // //console.log(pullRefreshEl.id);
  117. // pullupRefresh(self);
  118. // //self.endPullUpToRefresh();
  119. // }, 1000);
  120. // }
  121. }
  122. }
  123. });
  124. var vmA = new Vue({
  125. el: '#pullrefresh',
  126. data: {
  127. items: [] //列表信息流数据
  128. }
  129. });
  130. /**
  131. * 下拉刷新具体业务实现
  132. */
  133. function reloadNews() {
  134. pageNo = 1;
  135. vmA.items = [];
  136. // var table = document.body.querySelector('.mui-table-view');
  137. // table.innerHTML = "";
  138. addData();
  139. }
  140. var pageNo = 1;
  141. var jump_type = 0;
  142. var ids = ''; //批量已阅所需ID
  143. /**
  144. * 上拉加载具体业务实现
  145. */
  146. function pullupRefresh() {
  147. addData();
  148. }
  149. function addData() {
  150. var url = API.API_URL();
  151. var serviceId = "oa_2017V001PHONE_messageList";
  152. var state = app.getState(); //获取登陆信息
  153. var staffId = state.user.useId;
  154. var obj = {
  155. currentUser: staffId,
  156. type: jump_type,
  157. pSize: APP.PageSize,
  158. p: pageNo
  159. };
  160. app.ajax(serviceId, obj, function(data) {
  161. //服务器返回响应
  162. // console.log(JSON.stringify(data))
  163. var result = data.returnParams;
  164. var totalRow = data.total;
  165. var totalPage = Math.ceil(totalRow / APP.PageSize);
  166. var list = data.list;
  167. if(totalPage == 0){
  168. totalPage =1;
  169. }
  170. if(list.length > 0) {
  171. vmA.items = vmA.items.concat(convert(list));
  172. }
  173. ids = data.ids;
  174. mui('#pullrefresh').pullRefresh().endPullupToRefresh(totalPage == pageNo); //参数为true代表没有更多数据了。
  175. if(pageNo == 1 && totalPage>1) {
  176. mui('#pullrefresh').pullRefresh().endPulldown();
  177. mui('#pullrefresh').pullRefresh().refresh(true);
  178. }
  179. if(totalPage == 1 ){
  180. mui('#pullrefresh').pullRefresh().endPulldown();
  181. }
  182. pageNo = pageNo + 1;
  183. });
  184. }
  185. /**
  186. * 1、将服务端返回数据,转换成前端需要的格式
  187. * 2、若服务端返回格式和前端所需格式相同,则不需要改功能
  188. *
  189. * @param {Array} items
  190. */
  191. function convert(items) {
  192. var newItems = [];
  193. items.forEach(function(item) {
  194. newItems.push({
  195. id: item.universalid,
  196. title: item.title,
  197. sendTime: item.sendtime,
  198. content: item.content == null ? "" : item.content.substr(0, 70),
  199. name: item.name,
  200. messageId: item.messageid,
  201. isread: item.isread,
  202. jump_id: item.jump_id,
  203. status: item.status
  204. });
  205. });
  206. return newItems;
  207. }
  208. mui.plusReady(function() {
  209. var self = plus.webview.currentWebview();
  210. jump_type = self.jump_type;
  211. var title1 = mui('#title');
  212. title1[0].innerHTML = self.name;
  213. //接收上个界面传递的参数
  214. window.addEventListener('listEvent', function(event) {
  215. });
  216. // pageDetail = mui.preload({
  217. // url: 'detailList.html',
  218. // id: 'detailList.html',
  219. // })
  220. });
  221. /**
  222. * 打开详情
  223. *
  224. * @param {Object} item
  225. */
  226. function open_detail(item) {
  227. //触发子窗口变更详情
  228. // mui.fire(pageDetail, 'newsEvent', {
  229. // articleId: item.articleId
  230. // });
  231. // setTimeout(function() {
  232. // pageDetail.show("slide-in-right", 300);
  233. // }, 150);
  234. readMessage(item.id);
  235. // console.log(JSON.stringify(item));
  236. if(jump_type == 1) { //消息
  237. mui.openWindow({
  238. url: 'messageInfo.html',
  239. id: 'messageInfo.html',
  240. extras: {
  241. 'universalid': item.id,
  242. 'message_id': item.messageId
  243. }
  244. })
  245. } else if(jump_type == 2) { //通知公告
  246. mui.openWindow({
  247. url: '../../page/notice/noticeInfo.html',
  248. id: 'noticeInfo.html',
  249. extras: {
  250. 'notice_id': item.jump_id
  251. }
  252. })
  253. } else if(jump_type == 3) { //流程审批
  254. // var jsonJump = item.jump_id;
  255. // var modelId = jsonJump.modelId;
  256. // var opType = jsonJump.opType;
  257. // var page = "";
  258. // if("process" == opType) {
  259. // if(modelId == "3491569617311") { //请假流程
  260. // page = "../flow/leave/leave_approve.html";
  261. // } else if(modelId == "22949635069506") {
  262. // page = "../flow/monthwork_list/monthwork_approve.html";
  263. // } else if(modelId == "1153464975439") {
  264. // page = "../flow/ign_in/sign_in_approve.html"
  265. // } else if(modelId == "3566186048856") {
  266. // page = "../flow/enforce_work/enforce_work_approve.html"
  267. // } else if(modelId == "499452409010") {
  268. // page = "../flow/article_check/article_check_approve.html"
  269. // } else if(modelId == "10941763609871") {
  270. // page = "../flow/use_car/use_car_approve.html"
  271. // } else if(modelId == "30172009712867") {
  272. // page = "../flow/Nonciphertext/nonciphertext_approve.html"
  273. // }
  274. // } else {
  275. // if(modelId == "3491569617311") {
  276. // page = "../flow/leave/leave_view.html"
  277. // } else if(modelId == "22949635069506") {
  278. // page = "../flow/monthwork_list/monthwork_view.html"
  279. // } else if(modelId == "1153464975439") {
  280. // page = "../flow/sign_in/sign_in_view.html"
  281. // } else if(modelId == "3566186048856") {
  282. // page = "../flow/enforce_work/enforce_work_view.html"
  283. // } else if(modelId == "499452409010") {
  284. // page = "../flow/article_check/article_check_view.html"
  285. // } else if(modelId == "10941763609871") {
  286. // page = "../flow/use_car/use_car_view.html"
  287. // } else if(modelId == "30172009712867") {
  288. // page = "../flow/Nonciphertext/nonciphertext_view.html"
  289. // }
  290. // }
  291. // mui.openWindow({
  292. // createNew: true,
  293. // url: "../../page/flow/flow_deal_list.html",
  294. // extras: {
  295. // // tinsId: jsonJump.tinsId,
  296. // // insId: jsonJump.insId
  297. // }
  298. // });
  299. var status = item.status;
  300. //触发子窗口变更新闻详情
  301. var msgId = item.id;
  302. var jump = item.jump_id;
  303. var modelId = jump.modelId;
  304. var tinsId = jump.tinsId;
  305. var insId = jump.insId;
  306. var modelName = jump.modelName;
  307. var page = "";
  308. if(status == "0") {
  309. page = "../flow/dynamic/flow_approve.html";
  310. } else {
  311. page = "../flow/flow_view.html";
  312. }
  313. mui.openWindow({
  314. createNew: true,
  315. url: page,
  316. extras: {
  317. tinsId: tinsId,
  318. insId: insId,
  319. modelName: modelName,
  320. modelId: modelId,
  321. msgId: msgId
  322. }
  323. });
  324. } else if(jump_type == 6) { //效率管理
  325. var jsonJump = item.jump_id;
  326. var fankui_id = jsonJump.fankui_id;
  327. var url = API.API_URL();
  328. var serviceId = "oa_efficiency_2018V0010PHONE011";
  329. var obj = {
  330. fankui_id: fankui_id
  331. };
  332. app.ajax(serviceId,obj, function(data) {
  333. //服务器返回响应
  334. console.log(JSON.stringify(data))
  335. //mui.toast(data.state);
  336. if(data.state == "0") {
  337. mui.openWindow({
  338. url: '../../page/efficiency/efficiencySignInfo.html',
  339. id: 'efficiencySignInfo.html',
  340. extras: {
  341. xiaolv_id: jsonJump.xiaolv_id,
  342. fankui_id: jsonJump.fankui_id,
  343. }
  344. })
  345. } else {
  346. mui.openWindow({
  347. url: '../../page/efficiency/efficiencyBanjieInfo.html',
  348. id: 'efficiencyBanjieInfo.html',
  349. extras: {
  350. xiaolv_id: jsonJump.xiaolv_id,
  351. fankui_id: jsonJump.fankui_id,
  352. }
  353. })
  354. }
  355. });
  356. } else if(jump_type == 7) { //出差审批管理
  357. mui.openWindow({
  358. url: '../../page/trip/trip_approve_list.html',
  359. id: 'trip_approve_list.html',
  360. extras: {
  361. }
  362. })
  363. } else if(jump_type == 8) { //非密文件传阅
  364. }
  365. }
  366. mui.init({
  367. beforeback: function() {
  368.      //获得父页面的webview
  369. var list = plus.webview.currentWebview().opener();
  370.      //触发父页面的自定义事件(refresh),从而进行刷新
  371. mui.fire(list, 'refresh',{flagBatchRead:flagBatchRead});
  372. //返回true,继续页面关闭逻辑
  373. return true;
  374. }
  375. });
  376. var flagBatchRead = false; //是否刷新父页面
  377. /**
  378. * 消息设置为已读
  379. */
  380. function readMessage(id) {
  381. var url = API.API_URL();
  382. var serviceId = "oa_2017V002PHONE_messageRead";
  383. var obj = { ids: id };
  384. app.ajax(serviceId, obj, function(data) {
  385. //服务器返回响应
  386. //console.log(JSON.stringify(data))
  387. flagBatchRead = true;
  388. });
  389. }
  390. /**
  391. * 消息设置为已读(批量)
  392. */
  393. function batchRead(){
  394. var btnArray = ['否', '是'];
  395. mui.confirm('将消息全部置为已阅?', '消息', btnArray, function(e) {
  396. if (e.index == 1) {
  397. var url = API.API_URL();
  398. var serviceId = "oa_2017V002PHONE_messageRead";
  399. var obj = {
  400. ids: ids
  401. };
  402. //console.log(ids);
  403. app.ajax(serviceId, obj, function(data) {
  404. //服务器返回响应
  405. console.log(JSON.stringify(data));
  406. if(data.num > 0){
  407. vmA.items = [];
  408. pageNo = 1;
  409. addData();
  410. mui.toast('标记已阅成功');
  411. flagBatchRead = true; //是否刷新父页面
  412. }
  413. });
  414. }
  415. })
  416. }
  417. </script>
  418. </body>
  419. </html>