From f36f8ff4956054511790faaa93e6e5e7504b76df Mon Sep 17 00:00:00 2001 From: msh-agent Date: Sun, 3 May 2026 02:34:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(customer-service):=20=E5=AE=A2=E6=9C=8D=20c?= =?UTF-8?q?hatUrl=20=E5=9C=A8=E5=B0=8F=E7=A8=8B=E5=BA=8F=E4=B9=9F=E5=AD=98?= =?UTF-8?q?=E5=82=A8=EF=BC=9B=E7=A9=BA=E5=80=BC=E5=85=9C=E5=BA=95=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=EF=BC=88test-0415=20=E5=8F=8D=E9=A6=886-2=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 旧版 SET_CHATURL 套了 #ifdef H5 || APP-PLUS,小程序拿不到 chatUrl - wxChatService 在 chatUrl 为空时弹 toast 提示「客服暂未配置」,避免跳到空白 web 页 - chatConfig 缓存为 null 时回退默认值,防止模板 v-if 取属性报错 Co-Authored-By: Claude Opus 4.7 (1M context) --- msh_single_uniapp/pages/index/index.vue | 7 +++---- msh_single_uniapp/pages/user/index.vue | 10 ++++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/msh_single_uniapp/pages/index/index.vue b/msh_single_uniapp/pages/index/index.vue index 2b86c37..32bc362 100644 --- a/msh_single_uniapp/pages/index/index.vue +++ b/msh_single_uniapp/pages/index/index.vue @@ -548,10 +548,9 @@ let imgHost = res.data.logoUrl.split('crmebimage')[0]; that.imgHost = imgHost; that.$Cache.set('imgHost', imgHost + '/'); - // #ifdef H5 || APP-PLUS - that.$store.commit("SET_CHATURL", res.data.yzfUrl); - Cache.set('chatUrl', res.data.yzfUrl); - // #endif + // test-0415 反馈6-2:客服 chatUrl 在所有端均缓存(旧版仅 H5/APP-PLUS 设置,小程序客服按钮跳空白页) + that.$store.commit("SET_CHATURL", res.data.yzfUrl || ''); + Cache.set('chatUrl', res.data.yzfUrl || ''); that.$Cache.setItem({ name: 'categoryConfig', value: { diff --git a/msh_single_uniapp/pages/user/index.vue b/msh_single_uniapp/pages/user/index.vue index ec2a5a6..6f3a5c7 100644 --- a/msh_single_uniapp/pages/user/index.vue +++ b/msh_single_uniapp/pages/user/index.vue @@ -220,7 +220,8 @@ that.$set(that, 'pageHeight', app.globalData.windowHeight); // #endif that.$set(that, 'MyMenus', app.globalData.MyMenus); - that.$set(that,'chatConfig',Cache.getItem('chatConfig')); + // test-0415 反馈6-2:chatConfig 缓存可能为 null(用户未访问商城首页),保留空对象兜底避免 v-if 报错 + that.$set(that,'chatConfig', Cache.getItem('chatConfig') || { consumer_hotline:'', telephone_service_switch:'close', wx_chant_independent:'close' }); // #ifdef H5 that.shareApi(); // #endif @@ -372,9 +373,14 @@ } }, wxChatService(){ + // test-0415 反馈6-2:chatUrl 未配置时给出明确提示,避免跳到空白 web 页 + if (!this.chatUrl) { + uni.showToast({ title: '客服暂未配置,请稍后再试', icon: 'none' }) + return + } let chatUrlArr = this.chatUrl.split('?') uni.navigateTo({ - url:`/pages/users/web_page/index?webUel=${chatUrlArr[0]}&title=客服&${chatUrlArr[1]}` + url:`/pages/users/web_page/index?webUel=${chatUrlArr[0]}&title=客服&${chatUrlArr[1] || ''}` }) }, getOrderData() {