修改登录

This commit is contained in:
caoqianming 2021-07-05 14:21:03 +08:00
parent ad1e964359
commit ac5f82223d
5 changed files with 33 additions and 14 deletions

View File

@ -10,6 +10,7 @@ Page({
password:'',
mpopenid:'',
isExists:false,
userInfo:null,
msg:''
},
usernameChange: function (e) {
@ -23,7 +24,8 @@ Page({
var postdata = {
username: that.data.username,
password: that.data.password,
mpopenid: getApp().globalData.userInfo.mpopenid
mpopenid: getApp().globalData.userInfo.mpopenid,
userinfo: that.data.userInfo
}
wx.request({
url: getApp().globalData.serverUrl + 'bindmp',
@ -127,11 +129,27 @@ Page({
},
onGetInfo:function(e){
this.setData({
userInfo:e.detail.userInfo
})
this.denglu()
},
getUserProfile: function(e){
wx.getUserProfile({
desc: '获取头像和昵称', //
success: (res) => {
this.setData({
userInfo: res.userInfo
})
this.denglu()
},
fail:(res)=>{
this.denglu()
}
})
},
onGetInfo2:function(e){
this.setData({
userInfo:e.detail.userInfo

View File

@ -25,7 +25,7 @@
</view>
</view>
</view>
<button class="weui-btn" type="primary" open-type="getUserInfo" bindgetuserinfo="onGetInfo">授权并绑定登陆</button>
<button class="weui-btn" type="primary" bindtap="getUserProfile">授权并绑定登陆</button>
<view style="text-align:center;color:gray" bindtap="showPw">账号错误或忘记密码?</view>
<!-- <view style="text-align:center;color:gray">获取测试账户请致电15810169371</view> -->
<!-- <button class="weui-btn" bindtap="denglu2">测试账户登录</button> -->

View File

@ -33,8 +33,8 @@ Page({
*/
onShow: function () {
var that = this;
that.getRatelist(1)
this.data.page = 1;
that.getRatelist()
},
/**
@ -56,9 +56,10 @@ Page({
*/
onPullDownRefresh: function () {
var that = this;
that.getRatelist(1);
wx.stopPullDownRefresh();
this.data.page = 1;
that.getRatelist();
wx.stopPullDownRefresh();
},
/**
@ -77,9 +78,9 @@ Page({
onShareAppMessage: function () {
},
getRatelist: function (page) {
getRatelist: function () {
var that = this;
if (page != 1) { page = that.data.page }
let page = that.data.page
wx.showLoading({
title: '加载中',
}),
@ -108,7 +109,7 @@ Page({
} else {
let list
if (page == 1) {
list = res.data.rows.slice(0,10)
list = res.data.rows
} else {
list = this.data.ratelist.concat(res.data.rows)
}

View File

@ -82,8 +82,9 @@ Page({
})
},
showRate: function () {
wx.navigateTo({
url: 'rate?examtestid=' + this.data.examtestid,
})
wx.navigateTo({
url: 'rate?examtestid=' + this.data.examtestid,
})
}
})

View File

@ -99,9 +99,9 @@ Page({
onShareAppMessage: function () {
},
getRatelist: function (page) {
getRatelist: function () {
var that = this;
if (page != 1) { page = that.data.page }
let page = that.data.page
wx.showLoading({
title: '加载中',
}),
@ -113,7 +113,6 @@ Page({
},
success: res => {
if (res.statusCode === 200) {
console.log(res.data)
if (res.data.rows.length == 0) {
if (page == 1) {
this.setData({