老师,我的登录功能和检查登录功能正常,但是就是数据库中nickname和avatar
来源:8-3 小程序会员登录和注册3
巴赫
2020-04-04
老师,我的登录功能和检查登录功能正常,但是就是数据库中nickname和avatar,mobile显示没有插入成功


6回答
-
编程浪子
2020-04-04
你好
如下图你看看我截图是的是什么代码
00 -
巴赫
提问者
2020-04-04
//login.js
//获取应用实例
var app = getApp();
Page({
data: {
remind: '加载中',
angle: 0,
userInfo: {},
regFlag: true
},
goToIndex: function () {
wx.switchTab({
url: '/pages/food/index',
});
},
onLoad: function () {
wx.setNavigationBarTitle({
title: app.globalData.shopName
});
this.checkLogin();
},
onShow: function () {
},
onReady: function () {
var that = this;
setTimeout(function () {
that.setData({
remind: ''
});
}, 1000);
wx.onAccelerometerChange(function (res) {
var angle = -(res.x * 30).toFixed(1);
if (angle > 14) {
angle = 14;
}
else if (angle < -14) {
angle = -14;
}
if (that.data.angle !== angle) {
that.setData({
angle: angle
});
}
});
},
checkLogin: function () {
var that = this;
wx.login({
success: function (res) {
if (!res.code) {
app.alert({'content': '登陆失败,请再次点击~~'});
return;
}
wx.request({
url: app.WXbulidUrl('/member/check-reg'),
header: app.getRequestHeader(),
method: 'POST',
data: {code: res.code},
success: function (res) {
if (res.data.code != 200) {
that.setData({
regFlag: false
});
return;
}
app.setCache("token",res.data.data.token);
//that.goToIndex();
}
});
}
});
},
login: function (e) {
var that = this;
if (!e.detail.userInfo) {
app.alert({'content': '登陆失败,请再次点击~~'});
return;
}
var data = e.detail.userInfo;
console.log(data);
wx.login({
success: function (res) {
if (!res.code) {
app.alert({'content': '登陆失败,请再次点击~~'});
return;
}
data['code'] = res.code;
wx.request({
url: app.WXbulidUrl('/member/login'),
header: app.getRequestHeader(),
method: 'POST',
data: {code: res.code},
success: function (res) {
if (res.data.code != 200) {
app.alert({'content': res.data.msg});
return;
}
that.goToIndex();
}
})
}
});
}
});00 -
编程浪子
2020-04-04
你好
根据打印是有的,所以不可能只有code。你把你这块js代码截图出来我看看
012020-04-04 -
编程浪子
2020-04-04
你好
如下图
012020-04-04 -
巴赫
提问者
2020-04-04


在这里
00 -
巴赫
提问者
2020-04-04

点击授权登录,里面只返回了code,没有返回其他信息
022020-04-04
相似问题




