优化:用户登录 - 个人中心登录弹框点击确认登录后报错,导致不能正常登录。
优化:绑定手机号时,如果选择一键获取微信绑定手机号进行绑定则在成功获取手机号后自动绑定,不用发送验证码后在绑定手机号
This commit is contained in:
parent
60a5b586a7
commit
5576c6adef
4
host.js
4
host.js
|
|
@ -1,4 +1,4 @@
|
||||||
// var host = 'https://ht.cdwwzc.com/', uniacid = '1'; module.exports = {host, uniacid};
|
// var host = 'https://ht.cdwwzc.com/', uniacid = '1'; module.exports = {host, uniacid};
|
||||||
//var host = 'https://tsgjx.cdlfjy.com', uniacid = '104',store_id = '258';
|
var host = 'https://tsgjx.cdlfjy.com', uniacid = '104',store_id = '258';
|
||||||
var host = 'https://gjx.cdlfjy.com', uniacid = '104',store_id = '258';// 生产环境
|
//var host = 'https://gjx.cdlfjy.com', uniacid = '104',store_id = '258';// 生产环境
|
||||||
module.exports = {host, uniacid,store_id};
|
module.exports = {host, uniacid,store_id};
|
||||||
|
|
@ -375,7 +375,8 @@ Component({
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (app.globalData.store_alone_temp == 1 || pathName == pageName) {
|
}
|
||||||
|
else if (app.globalData.store_alone_temp == 1 || pathName == pageName) {
|
||||||
// 门店独立模块
|
// 门店独立模块
|
||||||
that.setData({
|
that.setData({
|
||||||
menu_button: that.data.storeData.button_item.menu_button,
|
menu_button: that.data.storeData.button_item.menu_button,
|
||||||
|
|
@ -397,7 +398,8 @@ Component({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// 其他页面
|
// 其他页面
|
||||||
wx.getStorage({
|
wx.getStorage({
|
||||||
key: 'yz_basic_info',
|
key: 'yz_basic_info',
|
||||||
|
|
@ -488,16 +490,13 @@ Component({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
pageLifetimes: {
|
pageLifetimes: {
|
||||||
// 组件所在页面的生命周期函数
|
// 组件所在页面的生命周期函数
|
||||||
show() {},
|
show() {},
|
||||||
hide() {},
|
hide() {},
|
||||||
resize() {},
|
resize() {},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getTemp() {
|
getTemp() {
|
||||||
// 缓存获取不到请求接口
|
// 缓存获取不到请求接口
|
||||||
|
|
@ -821,5 +820,13 @@ Component({
|
||||||
url: '/packageG/member_v2/member_v2'
|
url: '/packageG/member_v2/member_v2'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,9 @@ Page({
|
||||||
'form.invite_code': this.data.default_invite
|
'form.invite_code': this.data.default_invite
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// 获取授权手机号 ============= start =============
|
||||||
getPhoneNumber(e) {
|
getPhoneNumber(e) {
|
||||||
let info = e.detail;
|
let info = e.detail;
|
||||||
console.log("手机信息获取",info);
|
console.log("手机信息获取",info);
|
||||||
|
|
@ -189,11 +192,98 @@ Page({
|
||||||
this.getPhoneM(info);
|
this.getPhoneM(info);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
back() {
|
async getPhoneM(info) {
|
||||||
wx.navigateBack({
|
let _this = this;
|
||||||
delta: 1,
|
let keys = await this.getSessionKey(info);
|
||||||
|
let mobile = await this.getPhone_index(info, keys);
|
||||||
|
this.setData({
|
||||||
|
'form.mobile': mobile
|
||||||
|
},async function () {
|
||||||
|
await _this.putPrepBind(mobile);
|
||||||
|
await _this.setBindPhone(mobile);
|
||||||
|
_this.back();
|
||||||
|
wx.hideLoading();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
putPrepBind(mobile) {
|
||||||
|
let urlStr = app.getNetAddresss("member.member.prepBind");
|
||||||
|
return new Promise((resolve,reject) => {
|
||||||
|
app._postNetWork({
|
||||||
|
url: urlStr,
|
||||||
|
showToastIn: false,
|
||||||
|
data: {
|
||||||
|
mobile: mobile
|
||||||
|
},
|
||||||
|
validateBol: 2,
|
||||||
|
success: (resdata)=> {
|
||||||
|
var res = resdata.data;
|
||||||
|
if (res.result == 1) {
|
||||||
|
if (res.data.is_show) {
|
||||||
|
// 显示 导致会员id变更 弹窗
|
||||||
|
this.setData({
|
||||||
|
showChangeID: true,
|
||||||
|
changidInfo: {
|
||||||
|
uid: res.data.uid,
|
||||||
|
change_uid: res.data.change_uid
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
wx.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: res.msg,
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
reject(res);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
reject(res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setBindPhone(mobile){
|
||||||
|
let urlStr = app.getNetAddresss('member.member.bindMobile');
|
||||||
|
return new Promise((resolve,reject) => {
|
||||||
|
app._postNetWork({
|
||||||
|
url: urlStr,
|
||||||
|
data: {
|
||||||
|
mobile: mobile,
|
||||||
|
mini_first_time_bind: 1, // 首次绑定
|
||||||
|
},
|
||||||
|
success: function (resdata) {
|
||||||
|
var res = resdata.data;
|
||||||
|
wx.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: res.msg,
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
resolve();
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
reject(res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
back() {
|
||||||
|
// 判断:如果存在上一页则返回上一页 否则进入个人中心
|
||||||
|
let pages = getCurrentPages();
|
||||||
|
console.log('上一页路径:' + pages[pages.length - 2]);
|
||||||
|
if(pages[pages.length - 2]){
|
||||||
|
wx.navigateBack({//返回
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
wx.reLaunch({
|
||||||
|
url: "/packageG/member_v2/member_v2",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
//详细地址值绑定
|
//详细地址值绑定
|
||||||
addressinp(e) {
|
addressinp(e) {
|
||||||
let val = e.detail.value;
|
let val = e.detail.value;
|
||||||
|
|
@ -201,43 +291,6 @@ Page({
|
||||||
'form.address': val
|
'form.address': val
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async getPhoneM(info) {
|
|
||||||
let keys = await this.getSessionKey(info);
|
|
||||||
let mobile = await this.getPhone_index(info, keys);
|
|
||||||
this.setData({
|
|
||||||
'form.mobile': mobile
|
|
||||||
},function () {
|
|
||||||
wx.hideLoading();
|
|
||||||
});
|
|
||||||
/* return false;
|
|
||||||
let that = this;
|
|
||||||
app._postNetWork({
|
|
||||||
url: app.getNetAddresss('member.member.mobileDecode'),//miniMemberMobile
|
|
||||||
data: {
|
|
||||||
encryptedData: info.encryptedData,
|
|
||||||
iv: info.iv,
|
|
||||||
not_validate_page: '0'
|
|
||||||
},
|
|
||||||
showToastIn: false,
|
|
||||||
success: function (resdata) {
|
|
||||||
var res = resdata.data;
|
|
||||||
if (res.result == 1) {
|
|
||||||
that.setData({
|
|
||||||
'form.mobile': res.data.phone_info.purePhoneNumber
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
wx.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: res.msg,
|
|
||||||
duration: 1500
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: function (res) {
|
|
||||||
console.log('手机号解码失败',res);
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
},
|
|
||||||
getSessionKey() {
|
getSessionKey() {
|
||||||
let key = wx.getStorageSync('session');
|
let key = wx.getStorageSync('session');
|
||||||
console.log(key, '缓存的session');
|
console.log(key, '缓存的session');
|
||||||
|
|
|
||||||
|
|
@ -1932,6 +1932,125 @@ Page({
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
// 用户点击了登录按钮
|
||||||
|
loginbtn(_info) {
|
||||||
|
console.log(this.data.logintap, '状态');
|
||||||
|
var that = this;
|
||||||
|
wx.login({
|
||||||
|
success: (_json)=> {
|
||||||
|
console.log(_info, _json.code,"login登录成功,获取用户info");
|
||||||
|
if (_json.code) {
|
||||||
|
// 请求登录接口
|
||||||
|
wx.request({
|
||||||
|
url: app.getNetAddresss("plugin.store-cashier.frontend.login.login.index"),
|
||||||
|
header: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
code: _json.code,
|
||||||
|
info: _info,
|
||||||
|
ver: '2'
|
||||||
|
},
|
||||||
|
success: (res)=> {
|
||||||
|
setTimeout(() => {
|
||||||
|
that.setData({
|
||||||
|
logintap: false
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
var _data = res.data;
|
||||||
|
console.log("登录接口", res);
|
||||||
|
if (_data.result == 1) {
|
||||||
|
try {
|
||||||
|
// 存储key
|
||||||
|
if (_data.data.user_info) {
|
||||||
|
wx.setStorageSync("nickname", _data.data.user_info.nickname);
|
||||||
|
}
|
||||||
|
if(_data.data.session){
|
||||||
|
wx.setStorageSync('session', _data.data.session);
|
||||||
|
}
|
||||||
|
if(_data.data.openid) {
|
||||||
|
wx.setStorageSync('openid', _data.data.openid);
|
||||||
|
}
|
||||||
|
if(_data.data.wx_token){
|
||||||
|
wx.setStorageSync('wx_token', _data.data.wx_token);
|
||||||
|
}
|
||||||
|
if(_info){
|
||||||
|
wx.setStorageSync('userInfo', _info);
|
||||||
|
}
|
||||||
|
if(_data.data.uid){
|
||||||
|
wx.setStorageSync('yz_uid', _data.data.uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
wx.hideLoading();
|
||||||
|
if( _data.data.is_first_time_bind){
|
||||||
|
// 首次授权登录自动绑定手机号
|
||||||
|
that.setData({
|
||||||
|
showAutoBindPhone: true
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
that.getInviteData();
|
||||||
|
}
|
||||||
|
|
||||||
|
wx.removeStorageSync("new_decorate"); //登录之后清除首页缓存数据重新请求
|
||||||
|
} catch (e) {
|
||||||
|
wx.reLaunch({
|
||||||
|
url: "/packageG/index/index",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
wx.hideLoading();
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: _data.msg,
|
||||||
|
success(res) {
|
||||||
|
console.log(res);
|
||||||
|
// if (res.confirm) {
|
||||||
|
// } else if (res.cancel) {
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log("第三方登录数据错误" + res.errMsg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (res)=> {
|
||||||
|
wx.hideLoading();
|
||||||
|
wx.showToast({
|
||||||
|
title: "第三方登录失败session、wx_token获取失败" + res.errMsg,
|
||||||
|
duration:3000,
|
||||||
|
icon:'none'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
that.setData({
|
||||||
|
logintap: false
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
console.log("第三方登录失败session、wx_token获取失败" + res.errMsg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setData({
|
||||||
|
logintap: false
|
||||||
|
});
|
||||||
|
wx.showToast({
|
||||||
|
title: "获取用户登录态失败!" + res.errMsg,
|
||||||
|
duration:3000,
|
||||||
|
icon:'none'
|
||||||
|
});
|
||||||
|
console.log("获取用户登录态失败!" + res.errMsg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (res)=> {
|
||||||
|
wx.hideLoading();
|
||||||
|
this.setData({
|
||||||
|
logintap: false
|
||||||
|
});
|
||||||
|
console.log("登录失败,请求被拒绝!获取用户登录态失败!" + res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/* 旧版本登录 由问题 目前弃用
|
||||||
loginbtn(_info) {
|
loginbtn(_info) {
|
||||||
if (this.data.logintap) {
|
if (this.data.logintap) {
|
||||||
// 正在请求 return
|
// 正在请求 return
|
||||||
|
|
@ -2045,7 +2164,7 @@ Page({
|
||||||
console.log("登录失败,请求被拒绝!获取用户登录态失败!" + res);
|
console.log("登录失败,请求被拒绝!获取用户登录态失败!" + res);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},*/
|
||||||
//是否开启邀请页面
|
//是否开启邀请页面
|
||||||
getInvite() {
|
getInvite() {
|
||||||
let urlStr = app.getNetAddresss("member.member.isValidatePage");
|
let urlStr = app.getNetAddresss("member.member.isValidatePage");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue