微信小程序调用wx.joinVoIPChat api一直显示签名错误问题?
发布于 5 年前 作者 gang73 4267 次浏览 来自 问答
//index.js  验证文档上默认的参数返回签名一致,点击调用的时候一直出现  签名错误问题  
//获取应用实例
const app = getApp()

Page({
  data: {
    motto'Hello World',
    userInfo: {},
    hasUserInfofalse,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    data:{}
  },
  onLoad:function(){

    var t = this
    wx.login({
      complete(res) => {
        if(res.code){
            wx.request({
              data:{code:res.code},
              url'https://www.lefakeji.com/api/user/getwxuserinfo',
              success:(re)=>{
                var data = re.data
                wx.checkSession({
                  complete(res) => {
                    console.log(res)
                  },
                })
                console.log(re)
                  t.setData({
                    data:data
                  })
              }
            })
        }
      },
    })
    
  },
  joinVoIPChat:function(){
    
    var t = this
    wx.getSetting({ 
        success:function(r){
           if(r.authSetting['scope.record']){
            var data = t.data.data
            console.log(data.sign)
            console.log(data.nonceStr)
            console.log(data.timeStamp)
            console.log(data.groupId)
            wx.joinVoIPChat({
              signature:data.sign,
              nonceStr:data.nonceStr,
              timeStamp:parseInt(data.timeStamp),
              groupId:data.groupId,
              complete:(re)=>{
                console.log(re)
                wx.showModal({
                  title'提示',
                  content: re.errMsg,
                  success (res) {
                    if (res.confirm) {
                      console.log('用户点击确定')
                    } else if (res.cancel) {
                      console.log('用户点击取消')
                    }
                  }
                })
              }
            })
           }else{
             wx.startRecord({
               complete(res) => {
                 wx.stopRecord({
                   complete(res) => {},
                 })
               },
             })
           }
        }
    })

    return
    wx.startRecord({
      success(res) => {
          
      },
      fail:(re)=>{
        console.log(re)
      }
    })
    
  }
})

回到顶部