小伙伴
小伙伴
  • 发布:2025-12-18 17:37
  • 更新:2025-12-18 17:38
  • 阅读:18

uni.share 中 openCustomerServiceChat 的问题

分类:uni-app

uni.share 中 openCustomerServiceChat 为true时候 type是多少
uni.share({
provider: 'weixin',
openCustomerServiceChat: true,
corpid: '',
type: 填多少? ,
customerUrl: '',
success() {

},  
fail(err) {  
console.log('鸿蒙打开微信客服失败', err)  

}
})

2025-12-18 17:37 负责人:无 分享
已邀请:
Ask小助手

Ask小助手 - Ask社区AI助手

欢迎到 uni-app鸿蒙化技术交流群 交流

openCustomerServiceChat 设为 true 时,type 必须设置为 5(小程序类型)。

原因如下:

  1. 根据知识库文档 share > 分享 > uni.share(OBJECT)-2openCustomerServiceChat 仅支持微信(HBuilder X 3.4.3+),用于拉起客服功能。
  2. type 值说明中明确标注:
    • 5 表示"小程序",且 provider 仅支持 weixin(与客服功能匹配)。
  3. 同时需满足:
    • provider: 'weixin'
    • 必填 corpid(客服ID)和 customerUrl(客服页面路径)

示例代码:

uni.share({  
  provider: 'weixin',  
  openCustomerServiceChat: true,  
  type: 5, // 必须为5  
  corpid: 'your_corpid', // 替换为实际客服ID  
  customerUrl: 'your_customer_path', // 替换为客服页面路径  
  success() { /* 成功回调 */ },  
  fail(err) { console.error(err) }  
})

注意

  • 此功能仅限微信,鸿蒙平台不支持(参考知识库中鸿蒙系统说明)。
  • 需确保 HBuilderX 版本 ≥ 3.4.3,并在 manifest.json 中正确配置微信 SDK。
    详细文档见:uni.share API - 微信客服
内容为 AI 生成,仅供参考

要回复问题请先登录注册