用户权限授权修改
This commit is contained in:
@@ -268,20 +268,24 @@ Page({
|
||||
|
||||
// 授权微信
|
||||
getUserInfo(e) {
|
||||
app.$pay.payWxLoing(e.detail).then(res => {
|
||||
wx.showToast({
|
||||
title: '绑定成功',
|
||||
duration: 2000,
|
||||
|
||||
})
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
}, err => {
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
})
|
||||
wx.getUserProfile({
|
||||
desc: '用于完善会员资料',
|
||||
success: (res) => {
|
||||
app.$pay.payWxLoing(res).then(res => {
|
||||
wx.showToast({
|
||||
title: '绑定成功',
|
||||
duration: 2000,
|
||||
})
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
}, err => {
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
@@ -307,21 +307,24 @@ Page({
|
||||
|
||||
// 授权微信
|
||||
getUserInfo(e) {
|
||||
console.log(e.detail);
|
||||
app.$pay.payWxLoing(e.detail).then(res => {
|
||||
wx.showToast({
|
||||
title: '绑定成功',
|
||||
duration: 2000,
|
||||
|
||||
})
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
}, err => {
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
})
|
||||
wx.getUserProfile({
|
||||
desc: '用于完善会员资料',
|
||||
success: (res) => {
|
||||
app.$pay.payWxLoing(res).then(res => {
|
||||
wx.showToast({
|
||||
title: '绑定成功',
|
||||
duration: 2000,
|
||||
})
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
}, err => {
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 选中支付方式
|
||||
@@ -330,4 +333,4 @@ Page({
|
||||
payType: e.currentTarget.dataset.type
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -217,19 +217,23 @@ Page({
|
||||
|
||||
// 授权微信
|
||||
getUserInfo(e) {
|
||||
app.$pay.payWxLoing(e.detail).then(res => {
|
||||
wx.showToast({
|
||||
title: '绑定成功',
|
||||
duration: 2000,
|
||||
|
||||
})
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
}, err => {
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
})
|
||||
wx.getUserProfile({
|
||||
desc: '用于完善会员资料',
|
||||
success: (res) => {
|
||||
app.$pay.payWxLoing(res).then(res => {
|
||||
wx.showToast({
|
||||
title: '绑定成功',
|
||||
duration: 2000,
|
||||
})
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
}, err => {
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -121,42 +121,52 @@ Page({
|
||||
showUnclickMask: true
|
||||
})
|
||||
let that = this;
|
||||
wx.login({
|
||||
success: function(res) {
|
||||
app.$api.memberLoginWX({
|
||||
avatar: e.detail.userInfo.avatarUrl,
|
||||
code: res.code,
|
||||
nickname: e.detail.userInfo.nickName
|
||||
}).then(res => {
|
||||
wx.setStorageSync('information', res.information);
|
||||
if (!res.authorization) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/register/index?codeType=' + 1,
|
||||
wx.getUserProfile({
|
||||
desc: '用于完善会员资料',
|
||||
success: (res) => {
|
||||
wx.login({
|
||||
success: function(r){
|
||||
app.$api.memberLoginWX({
|
||||
avatar: res.userInfo.avatarUrl,
|
||||
code: r.code,
|
||||
nickname: res.userInfo.nickName
|
||||
}).then(res => {
|
||||
wx.setStorageSync('information', res.information);
|
||||
if (!res.authorization) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/register/index?codeType=' + 1,
|
||||
})
|
||||
return;
|
||||
}
|
||||
wx.setStorageSync('accessToken', res.authorization.accessToken);
|
||||
let route = wx.getStorageSync('history');
|
||||
wx.removeStorageSync('history');
|
||||
if (!route || route == '/pages/login/index') {
|
||||
return wx.redirectTo({
|
||||
url: '/pages/mine/index',
|
||||
})
|
||||
}
|
||||
wx.redirectTo({
|
||||
url: route,
|
||||
})
|
||||
}, err => {
|
||||
that.setData({
|
||||
showUnclickMask: false
|
||||
})
|
||||
});
|
||||
},
|
||||
fail: function(res) {
|
||||
that.setData({
|
||||
showUnclickMask: false
|
||||
})
|
||||
return;
|
||||
}
|
||||
wx.setStorageSync('accessToken', res.authorization.accessToken);
|
||||
let route = wx.getStorageSync('history');
|
||||
wx.removeStorageSync('history');
|
||||
if (!route || route == '/pages/login/index') {
|
||||
return wx.redirectTo({
|
||||
url: '/pages/mine/index',
|
||||
})
|
||||
}
|
||||
wx.redirectTo({
|
||||
url: route,
|
||||
})
|
||||
}, err => {
|
||||
that.setData({
|
||||
showUnclickMask: false
|
||||
})
|
||||
});
|
||||
},
|
||||
})
|
||||
},
|
||||
fail: function(res) {
|
||||
fail: (res) => {
|
||||
that.setData({
|
||||
showUnclickMask: false
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
<view class='line-between-text'>快速微信登录</view>
|
||||
</view>
|
||||
<view class='wechat-btn'>
|
||||
<button open-type='getUserInfo' bindgetuserinfo='wxLogin' ></button>
|
||||
<image src='../../images/47@3x.png' bindtap='wxLogin'></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='unclick-mask' wx:if="{{showUnclickMask}}"></view>
|
||||
<view class='unclick-mask' wx:if="{{showUnclickMask}}"></view>
|
||||
|
||||
@@ -153,19 +153,23 @@ Page({
|
||||
|
||||
// 授权微信
|
||||
getUserInfo(e) {
|
||||
app.$pay.payWxLoing(e.detail).then(res => {
|
||||
wx.showToast({
|
||||
title: '绑定成功',
|
||||
duration: 2000,
|
||||
|
||||
})
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
}, err => {
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
})
|
||||
wx.getUserProfile({
|
||||
desc: '用于完善会员资料',
|
||||
success: (res) => {
|
||||
app.$pay.payWxLoing(res).then(res => {
|
||||
wx.showToast({
|
||||
title: '绑定成功',
|
||||
duration: 2000,
|
||||
})
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
}, err => {
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user