| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <title>党建系统</title>
- <link href="../../css/mui.min.css" rel="stylesheet" />
- <link href="../../css/OA-style.css" rel="stylesheet" />
- </head>
- <body>
- <header class="mui-bar mui-bar-nav ">
- <a href="" class="mui-action-back back mui-pull-left"><img src="../../images/back.png"></a>
- <h1 id="title" class="mui-title">我的消息</h1>
- <a class="mui-icon mui-pull-right" id="save" onclick="batchRead()">
- <img src="../../images/batchRead.png" style="width: 24px;" />
- </a>
- </header>
- <div class="mui-content">
- <div id="pullrefresh" class="mui-content mui-scroll-wrapper" style="">
- <!--<div class="mui-card" v-for="item in items">
- <a href="javascript:;" :data-id="item.id" @tap="open_detail(item)" style="color: black;">
- <div class="mui-card-header tongzhi_title" style="height: 20px;overflow: hidden;">
- <span class="tongzhi_div" v-if="item.isread=='N'"><img class="tongzhi_img2" src="../../images/newt.png"></span>
- <span class="tongzhi_div3"><b id="messtitle">{{item.title}}</b></span>
- </div>
- <div class="mui-card-content">
- <div class="mui-card-content-inner">
- <div >
- <div class="tongzhi_div2">{{item.content}}</div><p></p>
- <div class="tongzhi_div4">
- <span class="tongzhi_div" ><img class="tongzhi_img" src="../../images/zhibanshijian.png"></span>
- <span class="tongzhi_div1" >{{item.sendTime}}</span>
- </div><br>
- </div>
- </div>
- </div>
- </a>
- </div>-->
- <div class="mui-card" v-for="item in items">
- <a href="javascript:;" v-if="item.status=='0'" :data-id="item.id" @tap="open_detail(item)" style="color: black;">
- <div class="mui-card-content" style="background-color: aliceblue;">
- <div class="mui-card-content-inner mui-ellipsis tongzhi_title tongzhi_xian">
- <span class="tongzhi_div" v-if="item.isread=='N'"><img class="tongzhi_img2" src="../../images/newt.png"></span>
- <b id="messtitle">{{item.title}}</b>
- </div>
- </div>
- <div class="mui-card-content-inner">
- <div >
- <div class="tongzhi_div2">{{item.content}}</div><p></p>
- <div class="tongzhi_div4">
- <span class="tongzhi_div" ><img class="tongzhi_img" src="../../images/zhibanshijian.png"></span>
- <span class="tongzhi_div1" >{{item.sendTime}}</span>
- </div><br>
- </div>
- </div>
- </a>
- <a href="javascript:;" v-if="item.status=='2'" :data-id="item.id" style="color: black;">
- <div class="mui-card-content" style="background-color: #ececec;">
- <div class="mui-card-content-inner mui-ellipsis tongzhi_title tongzhi_xian">
- <span class="tongzhi_div" v-if="item.isread=='N'"><img class="tongzhi_img2" src="../../images/newt.png"></span>
- <b id="messtitle">{{item.title}}</b>
- </div>
- </div>
- <div class="mui-card-content-inner" style="background-color: #ececec;">
- <div >
- <div class="tongzhi_div2">{{item.content}}</div><p></p>
- <div class="tongzhi_div4">
- <span class="tongzhi_div" ><img class="tongzhi_img" src="../../images/zhibanshijian.png"></span>
- <span class="tongzhi_div1" >{{item.sendTime}}</span>
- </div><br>
- </div>
- </div>
- </a>
- </div>
- <div></div>
- </div>
- </div>
- <script type="text/javascript" src="../../js/jquery-1.11.2.min.js"></script>
- <script src="../../js/mui.min.js"></script>
- <script src="../../js/config.js"></script>
- <script src="../../js/app.js"></script>
- <script src="../../js/vue.min.js"></script>
- <script src="../../js/mui.pullToRefresh.js"></script>
- <script src="../../js/mui.pullToRefresh.material.js"></script>
- <script>
- var pageDetail = null;
- mui.init({
- pullRefresh: {
- container: '#pullrefresh',
- down: {
- style: 'circle', //必选,下拉刷新样式,目前支持原生5+ ‘circle’ 样式
- color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
- height: '50px', //可选,默认50px.下拉刷新控件的高度,
- range: '100px', //可选 默认100px,控件可下拉拖拽的范围
- offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
- // auto: true, //可选,默认false.首次加载自动上拉刷新一次
- callback: reloadNews //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
- // callback: function() {
- // var self = this;
- // setTimeout(function() {
- // reloadNews(self);
- // self.endPullDownToRefresh();
- // }, 1000); //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
- // }
- },
- up: {
- contentrefresh: '正在加载...',
- auto: true, //可选,默认false.自动上拉加载一次
- callback: pullupRefresh
- // callback: function() {
- // var self = this;
- // setTimeout(function() {
- // //var ul = self.element.querySelector('.mui-table-view');
- // //console.log(pullRefreshEl.id);
- // pullupRefresh(self);
- // //self.endPullUpToRefresh();
- // }, 1000);
- // }
- }
- }
- });
- var vmA = new Vue({
- el: '#pullrefresh',
- data: {
- items: [] //列表信息流数据
- }
- });
- /**
- * 下拉刷新具体业务实现
- */
- function reloadNews() {
- pageNo = 1;
- vmA.items = [];
- // var table = document.body.querySelector('.mui-table-view');
- // table.innerHTML = "";
- addData();
- }
- var pageNo = 1;
- var jump_type = 0;
- var ids = ''; //批量已阅所需ID
- /**
- * 上拉加载具体业务实现
- */
- function pullupRefresh() {
- addData();
- }
- function addData() {
- var url = API.API_URL();
- var serviceId = "oa_2017V001PHONE_messageList";
- var state = app.getState(); //获取登陆信息
- var staffId = state.user.useId;
- var obj = {
- currentUser: staffId,
- type: jump_type,
- pSize: APP.PageSize,
- p: pageNo
- };
- app.ajax(serviceId, obj, function(data) {
- //服务器返回响应
- // console.log(JSON.stringify(data))
- var result = data.returnParams;
- var totalRow = data.total;
- var totalPage = Math.ceil(totalRow / APP.PageSize);
- var list = data.list;
- if(totalPage == 0){
- totalPage =1;
- }
- if(list.length > 0) {
- vmA.items = vmA.items.concat(convert(list));
- }
- ids = data.ids;
- mui('#pullrefresh').pullRefresh().endPullupToRefresh(totalPage == pageNo); //参数为true代表没有更多数据了。
- if(pageNo == 1 && totalPage>1) {
- mui('#pullrefresh').pullRefresh().endPulldown();
- mui('#pullrefresh').pullRefresh().refresh(true);
- }
- if(totalPage == 1 ){
- mui('#pullrefresh').pullRefresh().endPulldown();
- }
- pageNo = pageNo + 1;
- });
- }
- /**
- * 1、将服务端返回数据,转换成前端需要的格式
- * 2、若服务端返回格式和前端所需格式相同,则不需要改功能
- *
- * @param {Array} items
- */
- function convert(items) {
- var newItems = [];
- items.forEach(function(item) {
- newItems.push({
- id: item.universalid,
- title: item.title,
- sendTime: item.sendtime,
- content: item.content == null ? "" : item.content.substr(0, 70),
- name: item.name,
- messageId: item.messageid,
- isread: item.isread,
- jump_id: item.jump_id,
- status: item.status
- });
- });
- return newItems;
- }
- mui.plusReady(function() {
- var self = plus.webview.currentWebview();
- jump_type = self.jump_type;
- var title1 = mui('#title');
- title1[0].innerHTML = self.name;
- //接收上个界面传递的参数
- window.addEventListener('listEvent', function(event) {
- });
- // pageDetail = mui.preload({
- // url: 'detailList.html',
- // id: 'detailList.html',
- // })
- });
- /**
- * 打开详情
- *
- * @param {Object} item
- */
- function open_detail(item) {
- //触发子窗口变更详情
- // mui.fire(pageDetail, 'newsEvent', {
- // articleId: item.articleId
- // });
- // setTimeout(function() {
- // pageDetail.show("slide-in-right", 300);
- // }, 150);
- readMessage(item.id);
- // console.log(JSON.stringify(item));
- if(jump_type == 1) { //消息
- mui.openWindow({
- url: 'messageInfo.html',
- id: 'messageInfo.html',
- extras: {
- 'universalid': item.id,
- 'message_id': item.messageId
- }
- })
- } else if(jump_type == 2) { //通知公告
- mui.openWindow({
- url: '../../page/notice/noticeInfo.html',
- id: 'noticeInfo.html',
- extras: {
- 'notice_id': item.jump_id
- }
- })
- } else if(jump_type == 3) { //流程审批
- // var jsonJump = item.jump_id;
- // var modelId = jsonJump.modelId;
- // var opType = jsonJump.opType;
- // var page = "";
- // if("process" == opType) {
- // if(modelId == "3491569617311") { //请假流程
- // page = "../flow/leave/leave_approve.html";
- // } else if(modelId == "22949635069506") {
- // page = "../flow/monthwork_list/monthwork_approve.html";
- // } else if(modelId == "1153464975439") {
- // page = "../flow/ign_in/sign_in_approve.html"
- // } else if(modelId == "3566186048856") {
- // page = "../flow/enforce_work/enforce_work_approve.html"
- // } else if(modelId == "499452409010") {
- // page = "../flow/article_check/article_check_approve.html"
- // } else if(modelId == "10941763609871") {
- // page = "../flow/use_car/use_car_approve.html"
- // } else if(modelId == "30172009712867") {
- // page = "../flow/Nonciphertext/nonciphertext_approve.html"
- // }
- // } else {
- // if(modelId == "3491569617311") {
- // page = "../flow/leave/leave_view.html"
- // } else if(modelId == "22949635069506") {
- // page = "../flow/monthwork_list/monthwork_view.html"
- // } else if(modelId == "1153464975439") {
- // page = "../flow/sign_in/sign_in_view.html"
- // } else if(modelId == "3566186048856") {
- // page = "../flow/enforce_work/enforce_work_view.html"
- // } else if(modelId == "499452409010") {
- // page = "../flow/article_check/article_check_view.html"
- // } else if(modelId == "10941763609871") {
- // page = "../flow/use_car/use_car_view.html"
- // } else if(modelId == "30172009712867") {
- // page = "../flow/Nonciphertext/nonciphertext_view.html"
- // }
- // }
- // mui.openWindow({
- // createNew: true,
- // url: "../../page/flow/flow_deal_list.html",
- // extras: {
- // // tinsId: jsonJump.tinsId,
- // // insId: jsonJump.insId
- // }
- // });
- var status = item.status;
- //触发子窗口变更新闻详情
- var msgId = item.id;
- var jump = item.jump_id;
- var modelId = jump.modelId;
- var tinsId = jump.tinsId;
- var insId = jump.insId;
- var modelName = jump.modelName;
- var page = "";
- if(status == "0") {
- page = "../flow/dynamic/flow_approve.html";
- } else {
- page = "../flow/flow_view.html";
- }
-
- mui.openWindow({
- createNew: true,
- url: page,
- extras: {
- tinsId: tinsId,
- insId: insId,
- modelName: modelName,
- modelId: modelId,
- msgId: msgId
- }
- });
- } else if(jump_type == 6) { //效率管理
- var jsonJump = item.jump_id;
- var fankui_id = jsonJump.fankui_id;
- var url = API.API_URL();
- var serviceId = "oa_efficiency_2018V0010PHONE011";
- var obj = {
- fankui_id: fankui_id
- };
- app.ajax(serviceId,obj, function(data) {
- //服务器返回响应
- console.log(JSON.stringify(data))
- //mui.toast(data.state);
- if(data.state == "0") {
- mui.openWindow({
- url: '../../page/efficiency/efficiencySignInfo.html',
- id: 'efficiencySignInfo.html',
- extras: {
- xiaolv_id: jsonJump.xiaolv_id,
- fankui_id: jsonJump.fankui_id,
- }
- })
- } else {
- mui.openWindow({
- url: '../../page/efficiency/efficiencyBanjieInfo.html',
- id: 'efficiencyBanjieInfo.html',
- extras: {
- xiaolv_id: jsonJump.xiaolv_id,
- fankui_id: jsonJump.fankui_id,
- }
- })
- }
- });
- } else if(jump_type == 7) { //出差审批管理
- mui.openWindow({
- url: '../../page/trip/trip_approve_list.html',
- id: 'trip_approve_list.html',
- extras: {
- }
- })
- } else if(jump_type == 8) { //非密文件传阅
- }
- }
- mui.init({
- beforeback: function() {
- //获得父页面的webview
- var list = plus.webview.currentWebview().opener();
- //触发父页面的自定义事件(refresh),从而进行刷新
- mui.fire(list, 'refresh',{flagBatchRead:flagBatchRead});
- //返回true,继续页面关闭逻辑
- return true;
- }
- });
- var flagBatchRead = false; //是否刷新父页面
- /**
- * 消息设置为已读
- */
- function readMessage(id) {
- var url = API.API_URL();
- var serviceId = "oa_2017V002PHONE_messageRead";
- var obj = { ids: id };
- app.ajax(serviceId, obj, function(data) {
- //服务器返回响应
- //console.log(JSON.stringify(data))
- flagBatchRead = true;
- });
- }
- /**
- * 消息设置为已读(批量)
- */
- function batchRead(){
- var btnArray = ['否', '是'];
- mui.confirm('将消息全部置为已阅?', '消息', btnArray, function(e) {
- if (e.index == 1) {
- var url = API.API_URL();
- var serviceId = "oa_2017V002PHONE_messageRead";
- var obj = {
- ids: ids
- };
- //console.log(ids);
- app.ajax(serviceId, obj, function(data) {
- //服务器返回响应
- console.log(JSON.stringify(data));
- if(data.num > 0){
- vmA.items = [];
- pageNo = 1;
- addData();
- mui.toast('标记已阅成功');
- flagBatchRead = true; //是否刷新父页面
- }
- });
- }
- })
- }
- </script>
- </body>
- </html>
|