修改登录
This commit is contained in:
parent
ad1e964359
commit
ac5f82223d
|
@ -10,6 +10,7 @@ Page({
|
||||||
password:'',
|
password:'',
|
||||||
mpopenid:'',
|
mpopenid:'',
|
||||||
isExists:false,
|
isExists:false,
|
||||||
|
userInfo:null,
|
||||||
msg:''
|
msg:''
|
||||||
},
|
},
|
||||||
usernameChange: function (e) {
|
usernameChange: function (e) {
|
||||||
|
@ -23,7 +24,8 @@ Page({
|
||||||
var postdata = {
|
var postdata = {
|
||||||
username: that.data.username,
|
username: that.data.username,
|
||||||
password: that.data.password,
|
password: that.data.password,
|
||||||
mpopenid: getApp().globalData.userInfo.mpopenid
|
mpopenid: getApp().globalData.userInfo.mpopenid,
|
||||||
|
userinfo: that.data.userInfo
|
||||||
}
|
}
|
||||||
wx.request({
|
wx.request({
|
||||||
url: getApp().globalData.serverUrl + 'bindmp',
|
url: getApp().globalData.serverUrl + 'bindmp',
|
||||||
|
@ -127,11 +129,27 @@ Page({
|
||||||
|
|
||||||
},
|
},
|
||||||
onGetInfo:function(e){
|
onGetInfo:function(e){
|
||||||
|
|
||||||
this.setData({
|
this.setData({
|
||||||
userInfo:e.detail.userInfo
|
userInfo:e.detail.userInfo
|
||||||
})
|
})
|
||||||
this.denglu()
|
this.denglu()
|
||||||
},
|
},
|
||||||
|
getUserProfile: function(e){
|
||||||
|
wx.getUserProfile({
|
||||||
|
desc: '获取头像和昵称', //
|
||||||
|
success: (res) => {
|
||||||
|
this.setData({
|
||||||
|
userInfo: res.userInfo
|
||||||
|
})
|
||||||
|
this.denglu()
|
||||||
|
},
|
||||||
|
fail:(res)=>{
|
||||||
|
this.denglu()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
onGetInfo2:function(e){
|
onGetInfo2:function(e){
|
||||||
this.setData({
|
this.setData({
|
||||||
userInfo:e.detail.userInfo
|
userInfo:e.detail.userInfo
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</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" bindtap="showPw">账号错误或忘记密码?</view>
|
||||||
<!-- <view style="text-align:center;color:gray">获取测试账户请致电15810169371</view> -->
|
<!-- <view style="text-align:center;color:gray">获取测试账户请致电15810169371</view> -->
|
||||||
<!-- <button class="weui-btn" bindtap="denglu2">测试账户登录</button> -->
|
<!-- <button class="weui-btn" bindtap="denglu2">测试账户登录</button> -->
|
||||||
|
|
|
@ -33,8 +33,8 @@ Page({
|
||||||
*/
|
*/
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
that.getRatelist(1)
|
|
||||||
this.data.page = 1;
|
this.data.page = 1;
|
||||||
|
that.getRatelist()
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,9 +56,10 @@ Page({
|
||||||
*/
|
*/
|
||||||
onPullDownRefresh: function () {
|
onPullDownRefresh: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
that.getRatelist(1);
|
|
||||||
wx.stopPullDownRefresh();
|
|
||||||
this.data.page = 1;
|
this.data.page = 1;
|
||||||
|
that.getRatelist();
|
||||||
|
wx.stopPullDownRefresh();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,9 +78,9 @@ Page({
|
||||||
onShareAppMessage: function () {
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
getRatelist: function (page) {
|
getRatelist: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
if (page != 1) { page = that.data.page }
|
let page = that.data.page
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '加载中',
|
title: '加载中',
|
||||||
}),
|
}),
|
||||||
|
@ -108,7 +109,7 @@ Page({
|
||||||
} else {
|
} else {
|
||||||
let list
|
let list
|
||||||
if (page == 1) {
|
if (page == 1) {
|
||||||
list = res.data.rows.slice(0,10)
|
list = res.data.rows
|
||||||
} else {
|
} else {
|
||||||
list = this.data.ratelist.concat(res.data.rows)
|
list = this.data.ratelist.concat(res.data.rows)
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,5 +85,6 @@ Page({
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: 'rate?examtestid=' + this.data.examtestid,
|
url: 'rate?examtestid=' + this.data.examtestid,
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -99,9 +99,9 @@ Page({
|
||||||
onShareAppMessage: function () {
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
getRatelist: function (page) {
|
getRatelist: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
if (page != 1) { page = that.data.page }
|
let page = that.data.page
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '加载中',
|
title: '加载中',
|
||||||
}),
|
}),
|
||||||
|
@ -113,7 +113,6 @@ Page({
|
||||||
},
|
},
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
console.log(res.data)
|
|
||||||
if (res.data.rows.length == 0) {
|
if (res.data.rows.length == 0) {
|
||||||
if (page == 1) {
|
if (page == 1) {
|
||||||
this.setData({
|
this.setData({
|
||||||
|
|
Loading…
Reference in New Issue