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.
- Page({
- data:{
- height:height,
- width:width,
- },
- onLoad:function(options){
- // The page initialization options are the parameters brought by the page jump
- wx.login({
- success: function (loginres) {
- code = loginres.code;
- wx.getUserInfo({
- withCredentials:true,
- success: function (getuserinfores) {
- //The applet determines whether to bind the user account
- var data = {
- encryptedData: getuserinfores.encryptedData,
- iv: getuserinfores.iv,
- code: code,
- agencyid: agencyid,
- }
- wx.request({
- url: apphost+'/applet/login',
- method:'POST',
- dataType:'json',
- date: date,
- header: {
- "Content-Type": "application/x-www-form-urlencoded"
- },
- success: function(res) {
- console.log(res)
- if(res.data.code == 200){
- // Log in successfully, return user information and token, and jump to the home page
- 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){
- // Unbound user account
- 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: 'Login failed',
- // icon: 'loadding',
- // duration: 2000
- // })
- // }
- })
- },
- onReady:function(){
- // page rendering is complete
- },
- onShow:function(){
- // page display
- },
- onHide:function(){
- // page hide
- },
- onUnload:function(){
- // page close
- }
- })