|
@@ -33,7 +33,7 @@ const mutations = {
|
|
userInfo && uni.setStorageSync('openId', userInfo.openId)
|
|
userInfo && uni.setStorageSync('openId', userInfo.openId)
|
|
},
|
|
},
|
|
// 设置邀请用户id
|
|
// 设置邀请用户id
|
|
- setInviteUserId(state, id){
|
|
|
|
|
|
+ setInviteUserId(state, id) {
|
|
state.inviteUserId = parseInt(id)
|
|
state.inviteUserId = parseInt(id)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -42,7 +42,7 @@ const actions = {
|
|
async wechatlogin({ commit, dispatch, state }) {
|
|
async wechatlogin({ commit, dispatch, state }) {
|
|
// 获取code
|
|
// 获取code
|
|
const code = await authorize.getCode('weixin')
|
|
const code = await authorize.getCode('weixin')
|
|
- userService.UserWechatAuthorLogin({ code })
|
|
|
|
|
|
+ return userService.UserWechatAuthorLogin({ code })
|
|
.then(response => {
|
|
.then(response => {
|
|
console.log('登录成功')
|
|
console.log('登录成功')
|
|
commit('LOGIN', response.data)
|
|
commit('LOGIN', response.data)
|
|
@@ -58,6 +58,7 @@ const actions = {
|
|
},
|
|
},
|
|
// 手机号注册登录
|
|
// 手机号注册登录
|
|
customLogin({ commit, state, dispatch }, params) {
|
|
customLogin({ commit, state, dispatch }, params) {
|
|
|
|
+ const redirectUrl = uni.getStorageSync('login_redirect_url') || ''
|
|
params.shareUserId = state.inviteUserId
|
|
params.shareUserId = state.inviteUserId
|
|
return userService.UserMobileLogin(params)
|
|
return userService.UserMobileLogin(params)
|
|
.then(response => {
|
|
.then(response => {
|
|
@@ -68,9 +69,15 @@ const actions = {
|
|
dispatch('coupon/initReceiveCouponCount', null, { root: true }) // 获取已领取优惠券数量
|
|
dispatch('coupon/initReceiveCouponCount', null, { root: true }) // 获取已领取优惠券数量
|
|
// 登录成功提示
|
|
// 登录成功提示
|
|
showMsg('登录成功', 1500, false, 'success')
|
|
showMsg('登录成功', 1500, false, 'success')
|
|
- // setTimeout(() => {
|
|
|
|
- // switchTabTo('/pages/tabBar/index/index')
|
|
|
|
- // }, 1500)
|
|
|
|
|
|
+ if (redirectUrl) {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ uni.redirectTo({ url: redirectUrl })
|
|
|
|
+ }, 1500)
|
|
|
|
+ } else {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ switchTabTo('/pages/tabBar/index/index')
|
|
|
|
+ }, 1500)
|
|
|
|
+ }
|
|
})
|
|
})
|
|
.catch(error => {
|
|
.catch(error => {
|
|
showMsg(error.msg, 2000)
|
|
showMsg(error.msg, 2000)
|