From fcf7fb4b9f6b5d35dadd909214a07307a1ee7317 Mon Sep 17 00:00:00 2001
From: kuaifan
Date: Sun, 23 Jan 2022 14:48:10 +0800
Subject: [PATCH] =?UTF-8?q?perf:=20=E6=B6=88=E6=81=AF=E9=A1=B5=E5=86=8D?=
=?UTF-8?q?=E6=AC=A1=E7=82=B9=E5=87=BB=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=BD=8D?=
=?UTF-8?q?=E5=88=B0=E6=9C=AA=E8=AF=BB=E6=B6=88=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../assets/js/pages/manage/messenger.vue | 23 ++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/resources/assets/js/pages/manage/messenger.vue b/resources/assets/js/pages/manage/messenger.vue
index a1f49d5c..6417bcbd 100644
--- a/resources/assets/js/pages/manage/messenger.vue
+++ b/resources/assets/js/pages/manage/messenger.vue
@@ -14,7 +14,7 @@
v-for="(item, key) in dialogType"
:key="key"
:class="{active:dialogActive==item.type}"
- @click="dialogActive=item.type">
+ @click="onActive(item.type)">
{{$L(item.name)}}
@@ -27,6 +27,7 @@
-
@@ -154,6 +155,8 @@ export default {
}
}
return true;
+ }).sort((a, b) => {
+ return $A.Date(a.last_at) - $A.Date(b.last_at);
})
},
@@ -219,6 +222,24 @@ export default {
}
},
+ onActive(type) {
+ if (this.dialogActive == type) {
+ // 再次点击滚动到未读条目
+ const dialog = this.dialogList.find(({unread}) => unread > 0)
+ if (dialog) {
+ try {
+ this.$refs[`dialog_${dialog.id}`][0].scrollIntoView({behavior: "smooth"});
+ } catch (e) {
+ scrollIntoView(this.$refs[`dialog_${dialog.id}`][0], {
+ behavior: 'smooth',
+ inline: 'end',
+ })
+ }
+ }
+ }
+ this.dialogActive = type
+ },
+
closeDialog() {
this.dialogId = 0;
$A.setStorage("messenger::dialogId", 0)