小程序保险行业投保,小程序支付需要先跳微支保实名处理问题

  • Post author:
  • Post category:小程序


刚处理的时候,直接页面加载的时候就直接跳转微支保小程序。发现安卓还是可以,苹果就会报错

提示 需要有操作动作才能跳转

处理方式

wx.showModal({
  title: '温馨提示',
  content: '小程序支付需要微跳转微支保实名认证',
  showCancel: false,//是否显示取消按钮
  cancelText: "取消",//默认是“取消”
  cancelColor: '#000000',//取消文字的颜色
  confirmText: "确定",//默认是“确定”
  confirmColor: '#3cc51f',//确定文字的颜色
  success: function (res) {
    if (res.cancel) {
      //点击取消,wx.navigateBack
    } else {
      // 使用wx.navigateToMiniProgram跳转到小程序
          wx.navigateToMiniProgram({
            appId: 'wx0891f9079fc2561b', // 微信实名小程序 APPID
            path: typeString == '1' ? 'pages/index/index?sandbox=true' : 'pages/index/index', // 生产地址pages/index/index 需要打开微信实名小程序的目标pages/index/index?sandbox=true 测试地址 URL  env: "trial"
           extraData: {
           openId: openId, // 请提交保险公司小程序的用户的 OpenId
           env: typeString == '1' ? "trial" : 'release', // 需要回跳的微信小程序的版本 develop(开发版),trial(体验版),release(正式版)
           },
            envVersion: 'release', // 要打开微信小程序的版本 develop(开发版),trial(体验版),release(正式版)
            success(res) {
              console.log('跳微支保成功',res)
            },fail(res){
              console.log('跳微支保失败',res)
            }
          })
    }
  },
  fail: function (res) { 
    //接口调用失败的回调函数,wx.navigateBack
  },
  complete: function (res) { 
    //接口调用结束的回调函数(调用成功、失败都会执行)
  },
})



版权声明:本文为qq_45950523原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。