收藏
回答

使用wx.requestPayment支付成功或失败时,怎样做跳转并关闭其他页面呢?


回答关注问题邀请回答
收藏

7 个回答

  •  أمس 
     أمس 
    2020-03-11

    写个定时器,监听回调,不知是否是蠢办法,但是解决了问题,20秒或设置更长的等待时间。num为调用次数,isJump标记是否已经跳转,在onUnload页面销毁时,标记为true,并清理定时器

    2020-03-11
    有用 1
    回复 1
    •  أمس 
       أمس 
      2020-03-13
      又找到了好办法,支付成功后做个标记,在onShow生命周期中监听跳转
      2020-03-13
      回复
  • Architect
    Architect
    2019-10-25

    加个定时器就好了,这个问题应该是只会在安卓端出现。

    setTimeout(function() {

        wx.reLaunch({

           url: 'XXX',

        })

    }, 200)


    2019-10-25
    有用 1
    回复 1
    • 越过山丘
      越过山丘
      2019-12-05
      微信现在有了更好的netTick
      2019-12-05
      回复
  • 初心
    初心
    2019-10-25

    跳转的页面是tabBar 页面吗?    

    2019-10-25
    有用 1
    回复
  • 正周
    正周
    2019-10-25

    是的

    2019-10-25
    有用 1
    回复 1
    • 文秋坊子镇
      文秋坊子镇
      2019-10-25
      但是这样提示报错errMsg: "reLaunch:fail can not invoke reLaunch in background"
      2019-10-25
      回复
  • 浅木
    浅木
    2019-10-25

    这个不行吗?

    2019-10-25
    有用
    回复 2
    • 文秋坊子镇
      文秋坊子镇
      2019-10-25
      errMsg: "reLaunch:fail can not invoke reLaunch in background"
      2019-10-25
      回复
    • 浅木
      浅木
      2019-10-25回复文秋坊子镇
      嗯嗯  你手速太快,他还没反应过来。  加延时就好。
      2019-10-25
      回复
  • 特治4
    特治4
    2019-10-25

    wx.showToast({

                                title: '充值成功',

                                icon: 'success',

                                duration: 2000,

                                success: function(res) {

                                  wx.reLaunch({

                                    url: ''

                                  });

                                }

                              })


    2019-10-25
    有用
    回复
  • 淼淼
    淼淼
    2019-10-25

    就是你贴的代码这样跳转的呀,是有什么问题么?

    2019-10-25
    有用
    回复 3
    • 文秋坊子镇
      文秋坊子镇
      2019-10-25
      errMsg: "reLaunch:fail can not invoke reLaunch in background"
      2019-10-25
      回复
    • 淼淼
      淼淼
      2019-10-25回复文秋坊子镇
      setTimeout(function() {
          wx.reLaunch({
             url: 'xxx',
          })
      }, 200)
      加个延时试试!
      2019-10-25
      回复
    • 文秋坊子镇
      文秋坊子镇
      2019-10-25
      加延时就可以了,谢谢
      2019-10-25
      回复
登录 后发表内容
问题标签