chore: 优化公共端都支持打开企业微信客服的方法

This commit is contained in:
2025-12-16 15:41:15 +08:00
parent 88debacf8c
commit b945583857
2 changed files with 1026 additions and 995 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -89,7 +89,7 @@
switch (this.config.type) { switch (this.config.type) {
case 'wxwork': case 'wxwork':
this.openWxWorkService(); this.openWxWorkServiceChat();
break; break;
case 'third': case 'third':
location.href = this.config.third_url; location.href = this.config.third_url;
@@ -103,11 +103,11 @@
}, },
/** /**
* 打开企业微信客服 * 打开企业微信客服
* @param {boolean} useOriginalService 是否使用原有客服方式 * @param {boolean} useOpenCustomerServiceChat 是否使用原有客服方式
*/ */
openWxWorkService(useOriginalService = false) { openWxWorkServiceChat(useOpenCustomerServiceChat = false) {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
if (this.wxworkConfig?.contact_url && !useOriginalService) { if (this.wxworkConfig?.enable && this.wxworkConfig?.contact_url && !useOpenCustomerServiceChat) {
// 直接使用活码链接跳转 // 直接使用活码链接跳转
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: 'wxeb490c6f9b154ef9', // 是企业微信官方小程序的AppID固定值, 由腾讯企业微信团队维护, 不需要修改,用于展示"添加企业微信联系人"的官方页面) appId: 'wxeb490c6f9b154ef9', // 是企业微信官方小程序的AppID固定值, 由腾讯企业微信团队维护, 不需要修改,用于展示"添加企业微信联系人"的官方页面)
@@ -135,7 +135,7 @@
// #endif // #endif
// #ifdef H5 // #ifdef H5
if (this.wxworkConfig?.contact_url) { if (this.wxworkConfig?.enable && this.wxworkConfig?.contact_url) {
// H5环境直接跳转活码链接 // H5环境直接跳转活码链接
window.location.href = this.wxworkConfig.contact_url; window.location.href = this.wxworkConfig.contact_url;
} else { } else {
@@ -154,7 +154,7 @@
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
console.log('降级处理:使用原有客服方式'); console.log('降级处理:使用原有客服方式');
this.openWxWorkService(true); this.openWxWorkServiceChat(true);
} }
} }
}); });