no message

This commit is contained in:
kuaifan 2022-07-03 17:25:51 +08:00
parent b73e1c27eb
commit 6cf9c1f4f2
2 changed files with 41 additions and 30 deletions

View File

@ -75,7 +75,7 @@
active: msgType === item.type, active: msgType === item.type,
}" }"
@click="msgType=item.type"> @click="msgType=item.type">
<i></i> <i class="no-dark-content"></i>
<span>{{$L(item.label)}}</span> <span>{{$L(item.label)}}</span>
</li> </li>
</ul> </ul>
@ -573,11 +573,12 @@ export default {
dialogId: { dialogId: {
handler(dialog_id) { handler(dialog_id) {
if (dialog_id) { if (dialog_id) {
this.msgNew = 0; this.tempMsgs = []
this.msgNew = 0
// //
if (this.allMsgList.length > 0) { if (this.allMsgList.length > 0) {
this.allMsgs = this.allMsgList; this.allMsgs = this.allMsgList
requestAnimationFrame(this.onToBottom); requestAnimationFrame(this.onToBottom)
} }
this.msgType = ''; this.msgType = '';
this.$store.dispatch("getDialogMsgs", { this.$store.dispatch("getDialogMsgs", {
@ -602,9 +603,6 @@ export default {
}, },
msgType(msg_type) { msgType(msg_type) {
this.tempMsgs = this.tempMsgs.filter(({is_msg_type}) => is_msg_type !== true)
requestAnimationFrame(this.onToBottom)
//
if (msg_type) { if (msg_type) {
this.$store.dispatch("getDialogMsgs", { this.$store.dispatch("getDialogMsgs", {
dialog_id: this.dialogId, dialog_id: this.dialogId,
@ -613,12 +611,19 @@ export default {
save_cancel: true, save_cancel: true,
}).then(({data}) => { }).then(({data}) => {
if (data.list.length > 0) { if (data.list.length > 0) {
this.tempMsgs.push(...data.list.map(item => Object.assign(item, { const ids = this.tempMsgs.map(item => item.id)
is_msg_type: true const list = data.list.filter(item => !ids.includes(item.id))
if (list.length > 0) {
this.tempMsgs.push(...list.map(item => Object.assign(item, {
isMsgType: true
}))) })))
} }
}).catch(_ => {});
} }
}).catch(_ => {});
} else {
this.tempMsgs = this.tempMsgs.filter(({isMsgType}) => isMsgType !== true)
}
requestAnimationFrame(this.onToBottom)
}, },
dialogSearchMsgId() { dialogSearchMsgId() {
@ -644,11 +649,12 @@ export default {
}, },
wsOpenNum(num) { wsOpenNum(num) {
if (num <= 1) return if (num <= 1 || this.msgType) {
return
}
this.$store.dispatch("getDialogMsgs", { this.$store.dispatch("getDialogMsgs", {
dialog_id: this.dialogId, dialog_id: this.dialogId,
msg_id: this.msgId, msg_id: this.msgId,
msg_type: this.msgType,
}).catch(_ => {}); }).catch(_ => {});
}, },
@ -1103,22 +1109,20 @@ export default {
msg_id: this.msgId, msg_id: this.msgId,
msg_type: this.msgType, msg_type: this.msgType,
prev_id: this.prevId, prev_id: this.prevId,
save_before: _ => { save_before: _ => this.scrollDisabled = true
this.scrollDisabled = true
}
}).then(({data}) => { }).then(({data}) => {
const ids = data.list.map(item => item.id) const ids = data.list.map(item => item.id)
this.$nextTick(() => { this.$nextTick(() => {
const scroller = this.$refs.scroller const scroller = this.$refs.scroller
const offset = ids.reduce((previousValue, currentId) => { const reducer = ids.reduce((previousValue, currentId) => {
const previousSize = typeof previousValue === "object" ? previousValue.size : scroller.getSize(previousValue) const previousSize = typeof previousValue === "object" ? previousValue.size : scroller.getSize(previousValue)
return {size: previousSize + scroller.getSize(currentId)} return {size: previousSize + scroller.getSize(currentId)}
}) })
let size = scroller.getOffset() + offset.size; let offset = scroller.getOffset() + reducer.size
if (this.prevId === 0) { if (this.prevId === 0) {
size -= 36 offset -= 52
} }
this.onToOffset(size) this.onToOffset(offset)
this.scrollDisabled = false this.scrollDisabled = false
}); });
}).catch(() => {}) }).catch(() => {})

View File

@ -210,15 +210,16 @@
.nav-tags { .nav-tags {
position: absolute; position: absolute;
top: 78px; top: 68px;
left: 0; left: 12px;
width: 100%; right: 12px;
z-index: 2; z-index: 2;
padding: 4px 0; height: 56px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
overflow-x: auto; overflow-x: auto;
background-color: #ffffff;
> ul { > ul {
margin: 0 auto; margin: 0 auto;
@ -240,6 +241,14 @@
cursor: pointer; cursor: pointer;
box-shadow: 0 1px 6px rgba(255, 255, 255, 0.2); box-shadow: 0 1px 6px rgba(255, 255, 255, 0.2);
@media (max-width: 640px) {
margin: 0 6px;
}
@media (max-width: 375px) {
margin: 0 4px;
}
> i { > i {
width: 14px; width: 14px;
height: 14px; height: 14px;
@ -843,6 +852,7 @@
height: 20px; height: 20px;
box-sizing: content-box; box-sizing: content-box;
justify-content: center; justify-content: center;
padding-top: 16px;
.common-loading { .common-loading {
margin: 0; margin: 0;
@ -1336,13 +1346,10 @@
} }
} }
} }
.nav-tags { .nav-tags {
top: 58px; top: 52px;
> ul { height: 46px;
> li {
margin: 0 5px;
}
}
} }
} }
.dialog-scroller { .dialog-scroller {
@ -1353,7 +1360,7 @@
background-color: #ffffff; background-color: #ffffff;
&.default-header { &.default-header {
padding-top: 48px; padding-top: 46px;
} }
.dialog-item { .dialog-item {