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: {
...mapState(['fileLists']),
...mapState(['fileLists', 'messengerSearchKey']),
style() {
const offset = 135;
@ -119,6 +119,17 @@ export default {
if (this.fileFolderId > 0) {
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;
},
@ -138,6 +149,19 @@ export default {
this.goForward({name: 'manage-file'});
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();
},

View File

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

View File

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