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:
@@ -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: {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user