本地记录范围内屏蔽(ban
This commit is contained in:
parent
da2c1ef8c8
commit
367bc51c64
12
src/chat.js
12
src/chat.js
@ -133,7 +133,9 @@ export default class Chat {
|
|||||||
}
|
}
|
||||||
async 从本地载入消息() {
|
async 从本地载入消息() {
|
||||||
const data = await values(this.store)
|
const data = await values(this.store)
|
||||||
data.map(item => ({ timestamp: new Date(item.time).getTime(), ...item })).sort((a, b) => a.timestamp - b.timestamp).forEach(item => {
|
data.map(item => ({ timestamp: new Date(item.time).getTime(), ...item }))
|
||||||
|
.filter(item => !item.ban)
|
||||||
|
.sort((a, b) => a.timestamp - b.timestamp).forEach(item => {
|
||||||
this.添加元素(item)
|
this.添加元素(item)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -141,7 +143,7 @@ export default class Chat {
|
|||||||
const data = await values(this.store)
|
const data = await values(this.store)
|
||||||
return data.map(item => ({ timestamp: new Date(item.time).getTime(), ...item })).filter(item => {
|
return data.map(item => ({ timestamp: new Date(item.time).getTime(), ...item })).filter(item => {
|
||||||
const timestamp = new Date(item.time).getTime()
|
const timestamp = new Date(item.time).getTime()
|
||||||
return timestamp >= start && timestamp <= end
|
return timestamp >= start && timestamp <= end && !item.ban
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 检查本地不存在的id,存储消息
|
// 检查本地不存在的id,存储消息
|
||||||
@ -199,10 +201,12 @@ export default class Chat {
|
|||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
color: '#555'
|
color: '#555'
|
||||||
},
|
},
|
||||||
textContent: '删除',
|
textContent: '移除',
|
||||||
|
title: '加入屏蔽列表不再被渲染',
|
||||||
onclick: event => {
|
onclick: event => {
|
||||||
event.target.parentNode.remove()
|
event.target.parentNode.remove()
|
||||||
del(data.id, this.store)
|
update(data.id, item => ({ ban: true, ...item }), this.store)
|
||||||
|
//del(data.id, this.store)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user