问题模块 框架类型 问题类型 操作系统 工具版本
开发者工具 微信小程序 Bug Windows 1.02.1807120
我http,https也加了,也取消了“使用系统代理”,开发者工具也重启了。。为什么还是报错。
//app.js
App({
d: {
ceshiUrl: `https://127.0.0.1/dyxcx/public/index.php`,
userId: 0,
appId: "*************",
appKey: "*************"
},
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
this.getUserInfo();
},
getUserInfo: function(cb){
var that = this;
if (that.globalData.userInfo){
typeof cb == "function" && cb(this.globalData.userInfo)
}else{
//调用登录接口
wx.login({
success: function(res){
var code = res.code;
//查看是否授权
wx.getSetting({
success: function(res){
if (res.authSetting['scope.userInfo']){
// 已经授权,可以直接调用 getUserInfo 获取头像昵称
wx.getUserInfo({
success: function(res){
that.globalData.userInfo = res.userInfo;
typeof cb == "function" && cb(that.globalData.userInfo);
//get user sessionKey
//get sessionKey
//再判断执行支付管理
that.getUserSessionKey(code);
}
})
}
},
fail: function(e){
console.log(111);
}
});
},
});
}
},
getUserSessionKey: function(code){
//用户订单状态
var that = this;
wx.request({
url: that.d.ceshiUrl + '/Api/Login/getsessionkeys',
method: 'post',
data: {
code : code
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function(res){
var data = res.data;
if(data.status == 0){
wx.showToast({
title: data.err,
duration: 2000
});
return false;
}
that.globalData.userInfo['sessionId'] = data.session_key;
that.globalData.userInfo['openid'] = data.openid;
//将openid存入授权的用户
that.onLoginUser();
},
fail: function(e){
wx.showToast({
title: '网络异常!err:e',
duration: 2000
});
}
})
},
onLoginUser: function(){
var that = this;
var user = that.globalData.userInfo;
wx.request({
url: that.d.ceshiUrl + '/Api/Login/authlogin',
method: 'post',
data: {
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function(res){
console.log(111);
}
});
},
globalData: {
userInfo: null
}
})
微信小程序开发问题解答
微信小程序开发者回答:
我也是。。。取消了验证检查还是会报错fail invalid url,重启了也是
微信小程序开发者回答:
麻烦给个相关的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html),我们定位下问题
本文网址:http://www.91bianli.com/weixinxiaochengxu/49760.html