perf: 移动端搜索消息支持滑动取消搜索

This commit is contained in:
kuaifan 2023-03-16 09:04:58 +08:00
parent 16717b0acd
commit 7a7d97fd17
3 changed files with 41 additions and 4 deletions

View File

@ -44,7 +44,7 @@ export default {
}, },
computed: { computed: {
...mapState(['fileLists']), ...mapState(['fileLists', 'messengerSearchKey']),
style() { style() {
const offset = 135; const offset = 135;
@ -119,6 +119,17 @@ export default {
if (this.fileFolderId > 0) { if (this.fileFolderId > 0) {
return true; return true;
} }
if (this.routeName === 'manage-messenger') {
if (this.$route.params.dialogAction === 'contacts') {
if (this.messengerSearchKey.contacts) {
return true;
}
} else {
if (this.messengerSearchKey.dialog) {
return true;
}
}
}
return false; return false;
}, },
@ -138,6 +149,19 @@ export default {
this.goForward({name: 'manage-file'}); this.goForward({name: 'manage-file'});
return; return;
} }
if (this.routeName === 'manage-messenger') {
if (this.$route.params.dialogAction === 'contacts') {
if (this.messengerSearchKey.contacts) {
this.$store.state.messengerSearchKey.contacts = ""
return;
}
} else {
if (this.messengerSearchKey.dialog) {
this.$store.state.messengerSearchKey.dialog = ""
return;
}
}
}
this.goBack(); this.goBack();
}, },

View File

@ -257,7 +257,7 @@ export default {
}, },
computed: { computed: {
...mapState(['cacheDialogs', 'loadDialogs', 'dialogId', 'appNotificationPermission']), ...mapState(['cacheDialogs', 'loadDialogs', 'dialogId', 'messengerSearchKey', 'appNotificationPermission']),
routeName() { routeName() {
return this.$route.name return this.$route.name
@ -456,13 +456,22 @@ export default {
immediate: true immediate: true
}, },
messengerSearchKey: {
handler(obj) {
this.dialogSearchKey = obj.dialog
this.contactsKey = obj.contacts
},
deep: true
},
dialogSearchKey(val) { dialogSearchKey(val) {
this.$store.state.messengerSearchKey.dialog = val
switch (val) { switch (val) {
case 'log.o': case 'log.o':
$A.IDBSet("logOpen", "open").then(_ => $A.reloadUrl()); $A.IDBSet("logOpen", "open").then($A.reloadUrl);
break; break;
case 'log.c': case 'log.c':
$A.IDBSet("logOpen", "close").then(_ => $A.reloadUrl()); $A.IDBSet("logOpen", "close").then($A.reloadUrl);
break; break;
} }
// //
@ -477,6 +486,7 @@ export default {
}, },
contactsKey(val) { contactsKey(val) {
this.$store.state.messengerSearchKey.contacts = val
if (val == '') { if (val == '') {
return; return;
} }

View File

@ -86,6 +86,9 @@ export default {
dialogInputCache: [], dialogInputCache: [],
dialogMsgTransfer: {time: 0}, dialogMsgTransfer: {time: 0},
// 搜索关键词(主要用于移动端判断滑动返回)
messengerSearchKey: {dialog: '', contacts: ''},
// 文件 // 文件
fileLists: [], fileLists: [],
fileLinks: [], fileLinks: [],