messageList.html 13 KB

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