mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-09 10:56:44 +08:00
修改已读设置
This commit is contained in:
@@ -44,10 +44,10 @@
|
||||
|
||||
|
||||
<div class="msg-list" v-for="(item, index) in data" :key="index">
|
||||
|
||||
|
||||
<div class="msg-top">
|
||||
<div>
|
||||
<span style="padding-right: 10px;"><el-checkbox v-model="item.checked" @change="setCheckAll"></el-checkbox></span>
|
||||
<span style="padding-right: 10px;"><el-checkbox v-model="item.checked" @change="setCheckAll(item)"></el-checkbox></span>
|
||||
<span v-if="!item.isRead" style="font-size:12px;padding:5px 7px; border-radius: 2px;background: #FF6562;color: #fff;margin-right: 5px">未读</span>
|
||||
<span v-else style="font-size:14px;padding:5px 7px; background: #eee; border-radius: 2px; color: #666666;margin-right: 5px">已读</span>
|
||||
<a :href="returnRouter(item)">
|
||||
@@ -56,7 +56,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="msg-body">
|
||||
<a :href="returnRouter(item)">
|
||||
<a :href="returnRouter(item)">
|
||||
<div class="msg-body-content">{{item.tip}}-{{ item.content }}</div>
|
||||
</a>
|
||||
<div class="msg-body-but">
|
||||
@@ -64,7 +64,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="msg-time">{{ item.msgTime }}</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: center;margin-top: 50px" v-if="total > queryData.pageSize">
|
||||
@@ -112,6 +112,7 @@ export default {
|
||||
checkAll: false,
|
||||
data: [],
|
||||
totalPages: '',
|
||||
checkedIds:[],
|
||||
isIndeterminate: false,
|
||||
url: ''
|
||||
};
|
||||
@@ -181,8 +182,14 @@ export default {
|
||||
// console.log(this.data,"点击加载中最后一次添加操作的data数据")
|
||||
// }
|
||||
// },
|
||||
setCheckAll(e) {
|
||||
let flag = !e;
|
||||
setCheckAll(item) {
|
||||
if(item.checked){
|
||||
this.checkedIds.push(item.id);
|
||||
}else{
|
||||
let obj = this.checkedIds.indexOf(item.id);
|
||||
this.checkedIds.splice(obj, 1)
|
||||
}
|
||||
let flag = !item.checked;
|
||||
let has = this.data.some(msg => {
|
||||
return msg.checked == flag;
|
||||
});
|
||||
@@ -191,7 +198,7 @@ export default {
|
||||
this.isIndeterminate = true;
|
||||
} else {
|
||||
this.isIndeterminate = false;
|
||||
this.checkAll = e;
|
||||
this.checkAll = item.checked;
|
||||
}
|
||||
},
|
||||
//改变已读状态的操作
|
||||
@@ -202,17 +209,27 @@ export default {
|
||||
if (!this.data[i].isRead) {
|
||||
ids.push(this.data[i].id);
|
||||
}
|
||||
|
||||
}
|
||||
if (ids.length !== 0) {
|
||||
if(this.checkedIds.length>0){
|
||||
apiMessage.updateIsRead(this.checkedIds).then(res => {
|
||||
if (res.status == 200) {
|
||||
this.$store.dispatch('refrashMsg');
|
||||
this.queryMessage(true)
|
||||
}
|
||||
});
|
||||
this.checkedIds = [];
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.checkAll){
|
||||
apiMessage.updateIsRead(ids).then(res => {
|
||||
if (res.status == 200) {
|
||||
this.$store.dispatch('refrashMsg');
|
||||
this.queryMessage(true)
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
// this.queryMessage();
|
||||
},
|
||||
delChooseList() {
|
||||
let list = this.data.filter(item => item.checked).map(v => v.id);
|
||||
|
||||
Reference in New Issue
Block a user