fix(customer-service): 客服 chatUrl 在小程序也存储;空值兜底提示(test-0415 反馈6-2)

- 旧版 SET_CHATURL 套了 #ifdef H5 || APP-PLUS,小程序拿不到 chatUrl
- wxChatService 在 chatUrl 为空时弹 toast 提示「客服暂未配置」,避免跳到空白 web 页
- chatConfig 缓存为 null 时回退默认值,防止模板 v-if 取属性报错

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
msh-agent
2026-05-03 02:34:34 +08:00
parent 33602ea013
commit f36f8ff495
2 changed files with 11 additions and 6 deletions

View File

@@ -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-2chatConfig 缓存可能为 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-2chatUrl 未配置时给出明确提示,避免跳到空白 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() {