There is no problem in the local test of the applet, Apple is normal, but Android cannot send the request?

There is no problem in the local test of the applet, Apple is normal, Android cannot send requests, and the https ssl certificate is normal.

 

  1. Page({
  2.   data:{
  3.     height:height,
  4.     width:width,
  5.   },
  6.   onLoad:function(options){
  7.     // The page initialization options are the parameters brought by the page jump
  8.         wx.login({
  9.           success: function (loginres) {
  10.             code = loginres.code;
  11.             wx.getUserInfo({
  12.               withCredentials:true,
  13.               success: function (getuserinfores) {
  14.                 //The applet determines whether to bind the user account
  15.                 var data = {
  16.                     encryptedData: getuserinfores.encryptedData,
  17.                     iv: getuserinfores.iv,
  18.                     code: code,
  19.                     agencyid: agencyid,
  20.                   }
  21.                        wx.request({
  22.                   url: apphost+'/applet/login',
  23.                   method:'POST',
  24.                   dataType:'json',
  25.                   date: date,
  26.                   header: {
  27.                     "Content-Type": "application/x-www-form-urlencoded"
  28.                   },
  29.                   success: function(res) {
  30.                     console.log(res)
  31.                     if(res.data.code == 200){
  32.                       // Log in successfully, return user information and token, and jump to the home page
  33.                       getApp().globalData.wxuserinfo = res.data.data;
  34.                       app.globalData.interval = 0
  35.                       getdata()
  36.                       setTimeout(function(){
  37.                         wx.switchTab({
  38.                           url: '/pages/index/index'
  39.                         })
  40.                       },1000)
  41.                     }else if(res.data.code == 202){
  42.                       // Unbound user account
  43.                       getApp().globalData.wxuserinfo = res.data.data;
  44.                       console.log(getApp().globalData.wxuserinfo)
  45.                       setTimeout(function(){
  46.                         wx.redirectTo({
  47.                           url: '/pages/login/index'
  48.                         })
  49.                       },1000)
  50.                      
  51.                     }else{
  52.                       console.log(res.data.msg)
  53.                     }
  54.                   },
  55.                   fail: function(res){
  56.                     console.log(res)
  57.                   }
  58.                 })
  59.               }
  60.             })
  61.           },
  62.           // fail: function(){
  63.           //   wx.showToast({
  64.           // title: 'Login failed',
  65.           //     icon: 'loadding',
  66.           //     duration: 2000
  67.           //   })
  68.           // }
  69.         })
  70.   },
  71.   onReady:function(){
  72.     // page rendering is complete
  73.   },
  74.   onShow:function(){
  75.     // page display
  76.   },
  77.   onHide:function(){
  78.     // page hide
  79.   },
  80.   onUnload:function(){
  81.     // page close
  82.   }
  83. })
copy code

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326325669&siteId=291194637