收藏
回答

wx.getSetting 提示fail no data response?

requestSubscribeMessage: function (finish{
    wx.getSetting({
      withSubscriptionstrue,
      success(res) {
        console.log(res.subscriptionsSetting)
        //订阅消息 总开关被关闭
        if (!res.subscriptionsSetting.mainSwitch) {
          wx.showModal({
            title'提示',
            content'请在设置->消息订阅中打开接收订阅消息,并勾选“名片交换通知”',
            confirmText'去设置',
            showCancelfalse,
            success(res) {
              if (res.confirm) {
                wx.openSetting({
                  complete(res) => {},
                })
              }
            },
            fail(errMsg) {
              console.log(errMsg)
            }
          })
        } else {
          //订阅消息总开关已经打开 
          //但是未给交换名片通知授权 提示 并让用户打开设置进行授权
          if (res.subscriptionsSetting.itemSettings && res.subscriptionsSetting.itemSettings.kKwJfuu9ndnJmQILftGx5GDWNOn_0M5twq_O6c0AmGk === 'reject') {
            wx.showModal({
              title'提示',
              content'请在设置->消息订阅中勾选“名片交换通知”',
              showCancelfalse,
              confirmText'去设置',
              success(res) {
                if (res.confirm) {
                  wx.openSetting({
                    complete(res) => {},
                  })
                }
              }
            })
          } else {
            mta.Event.stat("10007", {})
            wx.showLoading({
              title'加载中',
              masktrue
            })
            wx.requestSubscribeMessage({
              tmplIds: ['xxxxxxxx'],
              success(res) {
                if (res.xxxxxxxx === 'accept' &&
                  res.errMsg === 'requestSubscribeMessage:ok') {
                  mta.Event.stat("10008", {})
                  console.log("微信订阅成功")
                } else {
                  console.log("用户取消订阅")
                }

              },
              fail(error) {
                mta.Event.stat("10010", {})
                console.log("微信订阅失败:" + error.errMsg)
              },
              complete() {
                if (typeof finish === 'function') {
                  finish()
                  console.log(typeof finish)
                }
                wx.hideLoading()
              }
            })
          }
        }
      },
      fail(error){
        console.log(error)
      },
      complete(res) => {

      },
    })
  },

最后一次编辑于  2020-04-27
回答关注问题邀请回答
收藏

2 个回答

  • 是小白啊
    是小白啊
    2020-04-27

    麻烦在手机微信那里上传下日志: 我->设置->帮助与反馈右上角有个上报日志的入口,麻烦提供一下微信号,时间点

    2020-04-27
    有用
    回复 1
    • 张硕
      张硕
      2020-04-27
      日志已上传 
      微信号:Braving_z
      时间点:04-27 (正午) 12:20 至 12:25
      2020-04-27
      回复
  • 张硕
    张硕
    2020-04-27

    删除小程序从新打开也不行

    苹果 8plus

    微信版本:7.0.12

    小程序基础库版本:2.10.4

    小程序appId:wx9d49b279a71b6681

    出现时间:2020-04-27 12:20左右

    复现步骤:连续执行上述方法30-50次左右

    2020-04-27
    有用
    回复
登录 后发表内容
问题标签