zhengzhou 3 vuotta sitten
vanhempi
commit
ec83ea3bc5
1 muutettua tiedostoa jossa 17 lisäystä ja 8 poistoa
  1. +17
    -8
      src/components/app-header/components/system-notify/index.vue

+ 17
- 8
src/components/app-header/components/system-notify/index.vue Näytä tiedosto

@@ -47,7 +47,7 @@
<div class="pxline"></div> <div class="pxline"></div>
<div class="flex_right_pain_body"> <div class="flex_right_pain_body">
<message-card <message-card
v-for="message in messageList.filter(m => m.status === messageStatus)"
v-for="message in (messageStatus === 1 ? messageList : hisMessageList)"
:key="message.id" :key="message.id"
:message="message" :message="message"
@mark-read="markMessageAsReaded" @mark-read="markMessageAsReaded"
@@ -58,7 +58,7 @@
v-if="messageStatus === 1" v-if="messageStatus === 1"
> >
<el-button <el-button
v-if="messageList.filter(m => m.status === 2).length"
v-if="hisMessageList.length"
class="bottom-button" class="bottom-button"
@click.stop="messageStatus = 2" @click.stop="messageStatus = 2"
>查看历史通知</el-button> >查看历史通知</el-button>
@@ -93,6 +93,7 @@ export default {
companyId: sessionStorage.companyId, companyId: sessionStorage.companyId,
panelVisible: false, panelVisible: false,
messageList: [], messageList: [],
hisMessageList: [],
messageStatus: 1, messageStatus: 1,
tickIns: null, tickIns: null,
}; };
@@ -100,7 +101,8 @@ export default {
mounted() { mounted() {
// const userInfo = await getUserInfo(this.$store.state.accountId); // const userInfo = await getUserInfo(this.$store.state.accountId);
// this.user = userInfo; // this.user = userInfo;
this.getMessageList();
this.getMessageList(1);
this.getMessageList(2);
}, },
destroyed() { destroyed() {
if (this.tickIns) { if (this.tickIns) {
@@ -115,6 +117,11 @@ export default {
document.body.removeChild(mask); document.body.removeChild(mask);
} }
}, },
messageStatus(v) {
if(v === 2) {
this.getMessageList(2);
}
},
yiyunAnimated(val) { yiyunAnimated(val) {
if (val) { if (val) {
let mask = document.querySelector(".notify-mask"); let mask = document.querySelector(".notify-mask");
@@ -131,18 +138,20 @@ export default {
closePanel() { closePanel() {
this.panelVisible = false; this.panelVisible = false;
}, },
async getMessageList() {
async getMessageList(status = 1) {
const res = await this.$fetchApi( const res = await this.$fetchApi(
"lockingmsg/queryLockingMsgListByFilter", "lockingmsg/queryLockingMsgListByFilter",
{ userId: this.userId }
{ userId: this.userId, status }
); );
wrapErrorHint(res); wrapErrorHint(res);
if (res.Code === 0) { if (res.Code === 0) {
const messageList = (res.Data || []).map(firstCharToLowerCase); const messageList = (res.Data || []).map(firstCharToLowerCase);
this.messageList = messageList;
// this.messageList = messageList;
this[status === 1 ? 'messageList' : 'hisMessageList'] = messageList;
}
if(status === 1) {
this.tickIns = setTimeout(this.getMessageList, 30000);
} }

this.tickIns = setTimeout(this.getMessageList, 30000);
}, },
async markMessageAsReaded(message) { async markMessageAsReaded(message) {
message.status = 2; message.status = 2;


Ladataan…
Peruuta
Tallenna