From 884e6d2de6017073fd37ef320c3a54715691c008 Mon Sep 17 00:00:00 2001 From: linju Date: Wed, 13 Nov 2024 16:59:35 +0800 Subject: [PATCH] Update chat.vue --- pages/chat/chat.vue | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pages/chat/chat.vue b/pages/chat/chat.vue index 8f3c762..6411f5e 100644 --- a/pages/chat/chat.vue +++ b/pages/chat/chat.vue @@ -411,18 +411,19 @@ setTimeout(() => { this.$refs["chat-input"]?.focus() }, 100) - } - const {is_temp,friend_uid} = this.conversation - if(is_temp && friend_uid){ - // 为了避免在web端刷新页面之后,本地单聊临时会话丢失,将地址栏中的会话id参数替换为好友的uid,以此来确保在刷新页面之后,本地能够再次创建临时会话。 - const {route:path,options} = getCurrentPages().pop() - delete options.conversation_id - options.user_id = friend_uid - let paramSrt - for (const key in options) { - paramSrt = `${key}=${options[key]}` + }else{ + const {is_temp,friend_uid} = this.conversation + if(is_temp && friend_uid){ + // 为了避免在web端刷新页面之后,本地单聊临时会话丢失,将地址栏中的会话id参数替换为好友的uid,以此来确保在刷新页面之后,本地能够再次创建临时会话。 + const {route:path,options} = getCurrentPages().pop() + delete options.conversation_id + options.user_id = friend_uid + let paramSrt + for (const key in options) { + paramSrt = `${key}=${options[key]}` + } + history.replaceState(null, '', `/#/${path}?${paramSrt}`) } - history.replaceState(null, '', `/#/${path}?${paramSrt}`) } // #endif }, -- GitLab