阅读背景:

小程序本地测试没有问题,苹果正常,安卓无法发送请求?

来源:互联网 

小程序本地测试没有问题,苹果正常,安卓无法发送请求,https ssl证书正常。

Page({   data:{     height:height,     width:width,   },   onLoad:function(options){     // 页面初始化 options为页面跳转所带来的参数         wx.login({           success: function (loginres) {             code = loginres.code;             wx.getUserInfo({               withCredentials:true,               success: function (getuserinfores) {                 //小程序判断是否绑定用户账号                 var data = {                     encryptedData: getuserinfores.encryptedData,                     iv: getuserinfores.iv,                     code: code,                     agencyid: agencyid,                   }                        wx.request({                   url: apphost+'/applet/login',                   method:'POST',                   dataType:'json',                   data: data,                   header: {                     "Content-Type": "application/x-www-form-urlencoded"                   },                   success: function(res) {                     console.log(res)                     if(res.data.code == 200){                       // 登陆成功,返回用户信息和token,跳转到首页                       getApp().globalData.wxuserinfo = res.data.data;                       app.globalData.interval = 0                       getdata()                       setTimeout(function(){                         wx.switchTab({                           url: '/pages/index/index'                         })                       },1000)                     }else if(res.data.code == 202){                       // 未绑定用户账号                       getApp().globalData.wxuserinfo = res.data.data;                       console.log(getApp().globalData.wxuserinfo)                       setTimeout(function(){                         wx.redirectTo({                           url: '/pages/login/index'                         })                       },1000)                                           }else{                       console.log(res.data.msg)                     }                   },                   fail: function(res){                     console.log(res)                   }                 })               }             })           },           // fail: function(){           //   wx.showToast({           //     title: '登陆失败',           //     icon: 'loadding',           //     duration: 2000           //   })           // }         })   },   onReady:function(){     // 页面渲染完成   },   onShow:function(){     // 页面显示   },   onHide:function(){     // 页面隐藏   },   onUnload:function(){     // 页面关闭   } }) Page({   



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: