Commit 8ae4cb17 by 无尘

feat: 增加企业公告读取分页

parent 66676e16
......@@ -26,7 +26,9 @@ For a detailed explanation on how things work, check out the [guide](http://vuej
>由于自定义 header 头增加 haobanSign 字段(即企业id),本地调试有些请求会有 options 预检请求,可以先注释下面代码, build 时候在放开注释;
```
# src/api/api.js
let haobanSign = JSON.parse(localStorage.getItem('userInfo')).enterpriseId;
Vue.axios.defaults.headers.post['haobansign'] = haobanSign;
Vue.axios.defaults.headers.get['haobansign'] = haobanSign;
if (!!localStorage.getItem('userInfo')) {
let haobanSign = JSON.parse(localStorage.getItem('userInfo')).enterpriseId;
Vue.axios.defaults.headers.post['haobansign'] = haobanSign;
Vue.axios.defaults.headers.get['haobansign'] = haobanSign;
}
```
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>好办管理平台</title><link href=./static/css/app.456f686fd36b581d8941f1642a71075b.css rel=stylesheet></head><body style="min-width: 1400px;"><div id=app></div><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script>// Raven.config('https://3715a345910d4c768e7a1ec14619c2d5@sentry.io/1413672').install();</script><script type=text/javascript src=./static/js/manifest.5a4aeba0826746615a03.js></script><script type=text/javascript src=./static/js/vendor.7bffa30b60868871b0ad.js></script><script type=text/javascript src=./static/js/app.51c76e71c88dc2980026.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>好办管理平台</title><link href=./static/css/app.a74de1e4acc64d1e7d795e82966e84d1.css rel=stylesheet></head><body style="min-width: 1400px;"><div id=app></div><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script>// Raven.config('https://3715a345910d4c768e7a1ec14619c2d5@sentry.io/1413672').install();</script><script type=text/javascript src=./static/js/manifest.ee01fc99144cac6a7ade.js></script><script type=text/javascript src=./static/js/vendor.7bffa30b60868871b0ad.js></script><script type=text/javascript src=./static/js/app.3748901c008e64050655.js></script></body></html>
\ No newline at end of file
webpackJsonp([29],{AejC:function(t,s,i){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var e=i("Minx"),a=i.n(e),n={name:"page404",data:function(){return{img_404:a.a}},computed:{message:function(){return"抱歉,你访问的页面不存在"}},mounted:function(){}},r={render:function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticStyle:{background:"#f0f2f5","margin-top":"-20px",height:"100%"}},[s("div",{staticClass:"wscn-http404"},[s("div",{staticClass:"pic-404"},[s("img",{staticClass:"pic-404__parent",attrs:{src:this.img_404,alt:"404"}})]),this._v(" "),s("div",{staticClass:"bullshit"},[s("div",{staticClass:"bullshit__headline"},[this._v(this._s(this.message))]),this._v(" "),s("a",{staticClass:"bullshit__return-home",attrs:{href:"#/companyGroup"}},[this._v("返回首页")])])])])},staticRenderFns:[]};var c=i("VU/8")(n,r,!1,function(t){i("AsY3")},"data-v-18a2f51c",null);s.default=c.exports},AsY3:function(t,s){},Minx:function(t,s,i){t.exports=i.p+"static/img/error_404.bf58747.svg"}});
\ No newline at end of file
webpackJsonp([28],{AejC:function(t,s,i){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var e=i("Minx"),a=i.n(e),n={name:"page404",data:function(){return{img_404:a.a}},computed:{message:function(){return"抱歉,你访问的页面不存在"}},mounted:function(){}},r={render:function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticStyle:{background:"#f0f2f5","margin-top":"-20px",height:"100%"}},[s("div",{staticClass:"wscn-http404"},[s("div",{staticClass:"pic-404"},[s("img",{staticClass:"pic-404__parent",attrs:{src:this.img_404,alt:"404"}})]),this._v(" "),s("div",{staticClass:"bullshit"},[s("div",{staticClass:"bullshit__headline"},[this._v(this._s(this.message))]),this._v(" "),s("a",{staticClass:"bullshit__return-home",attrs:{href:"#/companyGroup"}},[this._v("返回首页")])])])])},staticRenderFns:[]};var c=i("VU/8")(n,r,!1,function(t){i("AsY3")},"data-v-18a2f51c",null);s.default=c.exports},AsY3:function(t,s){},Minx:function(t,s,i){t.exports=i.p+"static/img/error_404.bf58747.svg"}});
\ No newline at end of file
!function(e){var f=window.webpackJsonp;window.webpackJsonp=function(c,d,n){for(var r,t,o,i=0,u=[];i<c.length;i++)t=c[i],a[t]&&u.push(a[t][0]),a[t]=0;for(r in d)Object.prototype.hasOwnProperty.call(d,r)&&(e[r]=d[r]);for(f&&f(c,d,n);u.length;)u.shift()();if(n)for(i=0;i<n.length;i++)o=b(b.s=n[i]);return o};var c={},a={77:0};function b(f){if(c[f])return c[f].exports;var a=c[f]={i:f,l:!1,exports:{}};return e[f].call(a.exports,a,a.exports,b),a.l=!0,a.exports}b.e=function(e){var f=a[e];if(0===f)return new Promise(function(e){e()});if(f)return f[2];var c=new Promise(function(c,b){f=a[e]=[c,b]});f[2]=c;var d=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.charset="utf-8",n.async=!0,n.timeout=12e4,b.nc&&n.setAttribute("nonce",b.nc),n.src=b.p+"static/js/"+e+"."+{0:"a6553e90a839b62ce0cc",1:"0ebe3ead93207dc78a78",2:"58edd50ac6edf9ffe74d",3:"516fd1892569e7db9611",4:"52322e24f504fe1dd346",5:"8593888f86a3714ccbf7",6:"fd94cb41ad0ccfae8743",7:"7e0164566e8e00575481",8:"17cbbf226d1dd6a9aae7",9:"7dc467d5cfcb4cfb033f",10:"5aa39cededdd868bd5b7",11:"0a7059ea2e15c5acf938",12:"18b04a93b9e2b30572d3",13:"99eba27757bf881d6c39",14:"70a11e50ec358505e2b6",15:"982c7f877d4d88d1d93b",16:"8f8e20ce84faa7e6b5e6",17:"4bddcee2555ecc9bae86",18:"092fe3ab141c75954a1a",19:"5c39f2f7f01d99cfe267",20:"8f48037229efe39f46f1",21:"5fdd2f8e839af6b9b1f3",22:"4d875b19fa0bbbe1f2cd",23:"e273f78a0b7240689906",24:"9d547e5255fc6330d24b",25:"88cb7eac0ef5b295254c",26:"f4379b6101b36ecad43c",27:"2ea724b0442e927bfdf5",28:"9a558c8ef26760ba85d7",29:"0155355dd99fffcb77d7",30:"4cadfac284beef63d405",31:"af46f102606343be3a92",32:"41a1620b882cbd77f621",33:"98c9f8f46aabb33952e1",34:"a870a2a95752c259fbcb",35:"099779ba05a964ff1dfe",36:"b943c9b9ac95922ad369",37:"9e050e6e5ae12e825639",38:"7da020455236ec9cc0e6",39:"e89aa19926c766c37a0c",40:"d492e0196e79144717b9",41:"e5670f9f0f45baf785be",42:"6b54254cbfb8eceab3c2",43:"dd9e90d8053228b68228",44:"deb9f07fde1e218414cf",45:"d9ca6bb21dcab104ec12",46:"011006c03affa7d4bc69",47:"9f65654f0a6e86bed8b2",48:"8cf9a95e5b563198f587",49:"33530ea069fc872b0d5f",50:"41ab2fd5d45bfc3d5c23",51:"9b495f511b712db255a7",52:"10599ff77c8e1dc5cb61",53:"8802335b18fef4b4450b",54:"c71b318f4cd731decf77",55:"7220e26fa501cf0cb4c5",56:"7946f7a323ee3865eac1",57:"594fe3f9a553b253aa93",58:"7c09b86e733d28528679",59:"cb4188665202f50664bc",60:"458477eb661d504e2ede",61:"913b2d83a393af57a8c3",62:"89c9af9b531991549047",63:"b802ff4df2e6424f55ef",64:"f997dcd71fcb0cd6467b",65:"50e7967b55e6217b3e3a",66:"6b5fc386ec869d82a1dc",67:"2d8e5c7eef8491a3cdba",68:"ba49712f562eff6edbc3",69:"e65d327b559f8fae7f73",70:"f19cdcc96fb03261fca5",71:"87a6af69154348344f0b",72:"82c73b5000810385ba93",73:"b425861e41d7dea6bf2e",76:"fd376da7cdbac115205f"}[e]+".js";var r=setTimeout(t,12e4);function t(){n.onerror=n.onload=null,clearTimeout(r);var f=a[e];0!==f&&(f&&f[1](new Error("Loading chunk "+e+" failed.")),a[e]=void 0)}return n.onerror=n.onload=t,d.appendChild(n),c},b.m=e,b.c=c,b.d=function(e,f,c){b.o(e,f)||Object.defineProperty(e,f,{configurable:!1,enumerable:!0,get:c})},b.n=function(e){var f=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(f,"a",f),f},b.o=function(e,f){return Object.prototype.hasOwnProperty.call(e,f)},b.p="./",b.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
!function(e){var c=window.webpackJsonp;window.webpackJsonp=function(f,d,n){for(var r,t,o,i=0,u=[];i<f.length;i++)t=f[i],a[t]&&u.push(a[t][0]),a[t]=0;for(r in d)Object.prototype.hasOwnProperty.call(d,r)&&(e[r]=d[r]);for(c&&c(f,d,n);u.length;)u.shift()();if(n)for(i=0;i<n.length;i++)o=b(b.s=n[i]);return o};var f={},a={77:0};function b(c){if(f[c])return f[c].exports;var a=f[c]={i:c,l:!1,exports:{}};return e[c].call(a.exports,a,a.exports,b),a.l=!0,a.exports}b.e=function(e){var c=a[e];if(0===c)return new Promise(function(e){e()});if(c)return c[2];var f=new Promise(function(f,b){c=a[e]=[f,b]});c[2]=f;var d=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.charset="utf-8",n.async=!0,n.timeout=12e4,b.nc&&n.setAttribute("nonce",b.nc),n.src=b.p+"static/js/"+e+"."+{0:"a6553e90a839b62ce0cc",1:"0ebe3ead93207dc78a78",2:"58edd50ac6edf9ffe74d",3:"516fd1892569e7db9611",4:"52322e24f504fe1dd346",5:"8593888f86a3714ccbf7",6:"fd94cb41ad0ccfae8743",7:"7e0164566e8e00575481",8:"17cbbf226d1dd6a9aae7",9:"7dc467d5cfcb4cfb033f",10:"5aa39cededdd868bd5b7",11:"0a7059ea2e15c5acf938",12:"18b04a93b9e2b30572d3",13:"99eba27757bf881d6c39",14:"70a11e50ec358505e2b6",15:"982c7f877d4d88d1d93b",16:"8f8e20ce84faa7e6b5e6",17:"4bddcee2555ecc9bae86",18:"092fe3ab141c75954a1a",19:"5c39f2f7f01d99cfe267",20:"8f48037229efe39f46f1",21:"5fdd2f8e839af6b9b1f3",22:"4d875b19fa0bbbe1f2cd",23:"e273f78a0b7240689906",24:"9d547e5255fc6330d24b",25:"88cb7eac0ef5b295254c",26:"8f0bb144b5e757399727",27:"aab2e5e06ca20a7a7fd5",28:"140ad99228544036c969",29:"11d63b982452da045e98",30:"3c6ecc51205b6dc310ea",31:"1216a85c15743155d70d",32:"41a1620b882cbd77f621",33:"98c9f8f46aabb33952e1",34:"a870a2a95752c259fbcb",35:"099779ba05a964ff1dfe",36:"b943c9b9ac95922ad369",37:"9e050e6e5ae12e825639",38:"7da020455236ec9cc0e6",39:"e89aa19926c766c37a0c",40:"d492e0196e79144717b9",41:"e5670f9f0f45baf785be",42:"6b54254cbfb8eceab3c2",43:"dd9e90d8053228b68228",44:"deb9f07fde1e218414cf",45:"d9ca6bb21dcab104ec12",46:"011006c03affa7d4bc69",47:"9f65654f0a6e86bed8b2",48:"8cf9a95e5b563198f587",49:"33530ea069fc872b0d5f",50:"41ab2fd5d45bfc3d5c23",51:"9b495f511b712db255a7",52:"10599ff77c8e1dc5cb61",53:"8802335b18fef4b4450b",54:"c71b318f4cd731decf77",55:"7220e26fa501cf0cb4c5",56:"7946f7a323ee3865eac1",57:"594fe3f9a553b253aa93",58:"7c09b86e733d28528679",59:"cb4188665202f50664bc",60:"458477eb661d504e2ede",61:"913b2d83a393af57a8c3",62:"89c9af9b531991549047",63:"b802ff4df2e6424f55ef",64:"f997dcd71fcb0cd6467b",65:"50e7967b55e6217b3e3a",66:"6b5fc386ec869d82a1dc",67:"2d8e5c7eef8491a3cdba",68:"ba49712f562eff6edbc3",69:"e65d327b559f8fae7f73",70:"f19cdcc96fb03261fca5",71:"87a6af69154348344f0b",72:"82c73b5000810385ba93",73:"b425861e41d7dea6bf2e",76:"fd376da7cdbac115205f"}[e]+".js";var r=setTimeout(t,12e4);function t(){n.onerror=n.onload=null,clearTimeout(r);var c=a[e];0!==c&&(c&&c[1](new Error("Loading chunk "+e+" failed.")),a[e]=void 0)}return n.onerror=n.onload=t,d.appendChild(n),f},b.m=e,b.c=f,b.d=function(e,c,f){b.o(e,c)||Object.defineProperty(e,c,{configurable:!1,enumerable:!0,get:f})},b.n=function(e){var c=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(c,"a",c),c},b.o=function(e,c){return Object.prototype.hasOwnProperty.call(e,c)},b.p="./",b.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
......@@ -53,17 +53,19 @@
<div class="read-list-wrap">
<div class="read-list-lt">
<div class="read-list-title">已读({{ readCount }})</div>
<ul v-if="readList.length > 0" class="read-list">
<ul v-if="!!readList.length" class="read-list">
<li v-for="(item, index) in readList" :key="index">{{ item }}</li>
</ul>
<div v-else class="no-read-list-data">暂无数据</div>
<div class="load-data load-read-data" @click="loadMore(1)">{{ readCount == readList.length ? '已加载全部已读人员' : '点击加载更多' }}</div>
</div>
<div class="read-list-rt">
<div class="read-list-title">未读({{ noReadCount }})</div>
<ul v-if="noReadList.length > 0" class="read-list">
<ul v-if="!!noReadList.length" class="read-list">
<li v-for="(item, index) in noReadList" :key="index">{{ item }}</li>
</ul>
<div v-else class="no-read-list-data">暂无数据</div>
<div class="load-data load-unread-data" @click="loadMore(0)">{{ noReadCount == noReadList.length ? '已加载全部未读人员' : '点击加载更多' }}</div>
</div>
</div>
</el-dialog>
......@@ -123,7 +125,14 @@ export default {
defaultImg: require('../../../../static/img/head_default.jpg'),
// 预览
imgUrl: '',
imgShowFlag: false
imgShowFlag: false,
// 读取分页参数
readId: '',
readPageSize: 20,
readPageNum: 1,
unreadPageSize: 20,
unreadPageNum: 1
};
},
filters: {
......@@ -250,20 +259,81 @@ export default {
})
.catch(() => {});
},
// 加载更多读取人数
loadMore(readStatus) {
let that = this;
if (readStatus == 1) {
if (that.readList.length >= that.readCount) {
return false;
}
that.readPageNum++;
that.getDetailApi(that.readId, {
pageSize: that.readPageSize,
pageNum: that.readPageNum,
readStatus: 1 // 0 未读; 1 已读
});
} else {
if (that.noReadList.length >= that.noReadCount) {
return false;
}
that.unreadPageNum++;
that.getDetailApi(that.readId, {
pageSize: that.unreadPageSize,
pageNum: that.unreadPageNum,
readStatus: 0 // 0 未读; 1 已读
});
}
},
// 读取详情
readDetail(id) {
let that = this;
that.readList = [];
that.noReadList = [];
that.readPageNum = 1;
that.unreadPageNum = 1;
that.readId = id;
that.dialogNoticeVisible = true;
// 获取已读取人数和未读人数
Promise.all([
that.getDetailApi(id, {
pageSize: that.readPageSize,
pageNum: that.readPageNum,
readStatus: 1 // 0 未读; 1 已读
})
]).then(function() {
that.getDetailApi(id, {
pageSize: that.unreadPageSize,
pageNum: that.unreadPageNum,
readStatus: 0 // 0 未读; 1 已读
});
});
},
getDetailApi(id, data) {
let that = this;
let para = {
announcementId: id
announcementId: id,
pageSize: data.pageSize,
pageNum: data.pageNum,
readStatus: data.readStatus
};
getRequest('/haoban-app-announcement-web/announcement-detail', para).then(res => {
let data = res.data;
if (data.errorCode == 1) {
that.noReadList = data.result.noReadEmployeeList;
that.readList = data.result.employeeList;
that.readCount = data.result.readCount;
that.noReadCount = data.result.noReadCount;
if (para.readStatus == 1) {
if (!!data.result.list && !!data.result.list.length) {
data.result.list.forEach(ele => {
that.readList.push(ele);
});
}
that.readCount = data.result.total;
} else {
if (!!data.result.list && !!data.result.list.length) {
data.result.list.forEach(ele => {
that.noReadList.push(ele);
});
}
that.noReadCount = data.result.total;
}
} else {
that.$message.error(data.message);
}
......@@ -291,6 +361,13 @@ export default {
components: {
commonDetailTop,
qrcodeDialog
},
beforeDestroy() {
let that = this;
that.readList = [];
that.noReadList = [];
that.readPageNum = 1;
that.unreadPageNum = 1;
}
};
</script>
......@@ -338,6 +415,7 @@ export default {
width: 100%;
margin-bottom: 20px;
.read-list {
position: relative;
padding: 15px 0 15px 10px;
height: 346px;
overflow: auto;
......@@ -360,7 +438,20 @@ export default {
text-align: center;
color: #303133;
}
.load-data {
position: absolute;
bottom: 0;
left: 0;
right: 0;
line-height: 24px;
text-align: center;
font-size: 14px;
color: #606266;
background: #f3f6f9;
cursor: pointer;
}
.read-list-lt {
position: relative;
flex: 0 0 283px;
width: 283px;
border: 1px solid #e4e7ed;
......@@ -370,6 +461,7 @@ export default {
}
}
.read-list-rt {
position: relative;
flex: 1;
border-bottom: 1px solid #e4e7ed;
border-right: 1px solid #e4e7ed;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment