Commit b8a85860 by 杨北旺

添加免登陆流程

1 parent 2fcf31cb
import {
setRouteData,
setLoginInfo,
loginModal
loginModal,
selectAccountLogin
} from '../lib/index'
import {
getSessionId,
......@@ -35,7 +36,8 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
this.init()
// this.init()
this.drectLogin()
},
/**
......@@ -127,5 +129,50 @@ Page({
})
} else wx.$router.reLaunch('login.index', obj)
} else wx.$router.reLaunch('login.index', obj)
}
},
// 判断是否是从其他小程序跳转过来
drectLogin(){
const params = wx.getLaunchOptionsSync()
if(params.referrerInfo.extraData&&params.referrerInfo.extraData.inType=='direct'){
const {phone,smscode} = params.referrerInfo.extraData
this.freeHandleLogin(phone,smscode)
}else{
this.init()
}
},
// 免登录操作流程
freeHandleLogin(phone,smscode){
const para = {
mobile: phone,
code: smscode
}
USERAPI.phoneSmsLogin(para).then(({
code,
data,
message,
errId
}) => {
if (code == '0') {
this.checkLoginUserInfo(data)
}else{
wx.$api.showToast(message || '系统异常')
}
}).catch(err => {
wx.$api.showToast('系统异常')
})
},
checkLoginUserInfo({
loginUserInfoList,
sessionId
}) {
if (loginUserInfoList.length > 1) wx.$router.go('/pages/authentication/accountItems/accountItems', {
sessionId,
...this.options
})
/**只有一个账号 */
else selectAccountLogin({
id: loginUserInfoList[0].uuid,
sessionId
})
},
})
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!