uniapp h5 点击超链接跳转到qq客服聊天窗口 微信小程序联系客服,联系企业微信客服;字节跳动小程序联系客服

70 阅读2分钟

   1.H5:  //

${qqNumber}为qq号码

注意:需开通qq推广服务,否则在微信内部浏览器无法成功跳转​编辑

2.在代码中做限制在微信小程序中显示小程序按钮 uniapp中button组件 open-type="contact"方法(open-type:开放能力)可以联系微信后台设置的客服

	<view class="service_box">
//微信小程序
			<!--#ifdef MP-WEIXIN -->
			<button class="service" plain open-type="contact"><image src="../../../static/ic_service.png" mode="aspectFill"></image></button>
			<!--#endif -->
//h5
			<!--#ifdef H5 -->
			<a target="_blank" :href="`https://wpa.qq.com/msgrd?v=3&uin=${qqNumber}&site=qq&menu=yes`" style="text-decoration: none;">
				<button class="service" plain @tap="isShow = true"><image src="../../../static/ic_service.png" mode="aspectFill"></image></button>
			</a>
			<!--#endif -->
		</view>

​编辑

3.微信小程序中调用微信的客服api 在点击事件中调用api对应的微信客服url一起企业id 即可联系企业微信客服,需要在微信公众平台设置中关联企业微信。

	/* extInfo:微信给的客服链接
corpId:企业微信企业id */
wx.openCustomerServiceChat({
			extInfo: {
				url: ''
			},
			corpId: '',
			success(res) {}
		})

4.字节跳动小程序

还是利用button的开放能力,前提是

在开发者平台=》功能管理=》客服 管理设置

  5.app打开企业微信客服 (备份)

移动应用开发者使用该功能,需同时满足以下条件:

  1. 微信开放平台账号已认证
  2. 移动应用审核通过并上架

注意:若移动应用未上架,则最多只能拉起微信客服100次/天,用于满足调试需求。

关联说明

移动应用仅可拉起具有绑定关系的微信客服,开发者需前往微信客服官网完成移动应用(appid)和企业id的绑定。

注意:一个移动应用(appid)最多绑定15个企业id

app端打开微信客服 - DCloud问答

微信客服官方文档 APP拉起微信客服功能 | 微信开放文档

//app打开微信客服代码  
 let sweixin = null  
	            plus.share.getServices(res=>{  
	                sweixin = res.find(i => i.id === 'weixin')  
	                if(sweixin){  
	                    sweixin.openCustomerServiceChat({  
	                        // corpid: '企业ID',  
                            //url微信客服提供的链接
							corpid: '',
	                        url: '',  
	                    },suc=>{  
	                        console.log("success",JSON.stringify(res))  
	                    },err=>{  
	                        console.log("error",JSON.stringify(err))  
	                    })  
	                }else{  
	                    plus.nativeUI.alert('当前环境不支持微信操作!')  
	                }  
	            },function(){  
	                uni.showToast({title: "获取服务失败,不支持该操作。"+JSON.stringify(e), icon: 'error'})  
	            })  

​​