Commit 7333aca6 by 李嘉林

修改登录功能

parent 78f973bc
...@@ -6,7 +6,7 @@ console.log(process.env,'-----------------config------') ...@@ -6,7 +6,7 @@ console.log(process.env,'-----------------config------')
export default { export default {
//登录 //登录
miniLogin(options){ miniLogin(options){
return requestGET(`${process.env.OLSHOP_URL}/wx/mini_login`,options) return requestPOST(`${process.env.OLSHOP_URL}/wx/mini_login`,options)
}, },
//绑定 //绑定
bindUser(options){ bindUser(options){
......
...@@ -80,7 +80,8 @@ export default { ...@@ -80,7 +80,8 @@ export default {
test_unionId: "", test_unionId: "",
fromType:'',//来源类型 mini:小程序跳转到当前登录页 fromType:'',//来源类型 mini:小程序跳转到当前登录页
scene:'',//场景 scene:'',//场景
ossLink: ''//第三方点击进入链接 ossLink: '',//第三方点击进入链接
wxUserInfo:{},
}; };
}, },
onShow() { onShow() {
...@@ -165,12 +166,15 @@ export default { ...@@ -165,12 +166,15 @@ export default {
} }
}, },
init() { init() {
let _this = this;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
login login
.miniLogin({ code: this.code, .miniLogin({ code: this.code,
spokesmanRelId : '', spokesmanRelId : '',
spokesmanGroupId : '', spokesmanGroupId : '',
spokesmanShopId : '' spokesmanShopId : '',
nickname: _this.wxUserInfo.nickName,
headImgUrl: _this.wxUserInfo.avatarUrl
}) })
.then(res => { .then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
...@@ -204,6 +208,7 @@ export default { ...@@ -204,6 +208,7 @@ export default {
} }
}, },
getUserProfile() { getUserProfile() {
let _this = this;
if(this.content&&!this.checked) { if(this.content&&!this.checked) {
wx.showToast({ wx.showToast({
title: '您还未同意协议', title: '您还未同意协议',
...@@ -220,6 +225,7 @@ export default { ...@@ -220,6 +225,7 @@ export default {
wx.getUserProfile({ wx.getUserProfile({
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (e) => { success: (e) => {
_this.wxUserInfo = e.userInfo;
this.init() this.init()
.then(res => { .then(res => {
//存入openid //存入openid
...@@ -250,8 +256,10 @@ export default { ...@@ -250,8 +256,10 @@ export default {
}); });
} }
} else { } else {
if (res.data.data.isHaveUnion == "true") { // haveBindUserPhone
//有账号 // 是否必须绑定手机号(0必须绑定,1不需要绑定
//有账号或不需要绑定手机号
if (res.data.data.isHaveUnion == "true" || this.mpApp.globalData.shopInfo.haveBindUserPhone == '1') {
this.backParams += `&sessionid=${ this.backParams += `&sessionid=${
res.data.data.sessionId res.data.data.sessionId
}&needCertified=${res.data.data.NEED_CERTIFIED}`; }&needCertified=${res.data.data.NEED_CERTIFIED}`;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment