Commit ae8ee0d6 by 李伟康

提交登录

1 parent e13c521e
......@@ -149,13 +149,22 @@ Component({
password: formData.password
}
this.setBtnLoading()
console.log(target)
USERAPI[target](obj).then(({
code,
data,
message
}) => {
this.setBtnLoading(false)
if (code == '0') {} else {
if (code == '0') {
if (loginType == 1) this.selectAccountLogin({
id: data.loginUserInfoList[0].uuid,
sessionId: data.sessionId
})
else {
console.log(data)
}
} else {
if (loginType == 1) this.setData({
smsError: true
})
......@@ -180,29 +189,13 @@ Component({
const {
loginUserInfoList,
sessionId
} = data, {
options: {
targetPath
}
} = thisPage
} = data
if (loginUserInfoList.length > 1) {
wx.$router.go('login.accountItems')
} else {
USERAPI.selectAccountLogin({
id: loginUserInfoList[0].uuid,
sessionId
}).then(res => {
setUserInfo(loginUserInfoList[0])
setSessionId(sessionId)
if (targetPath) {
const {
url,
obj
} = setRouteData(targetPath)
wx.$router.reLaunch(url, obj)
} else wx.$router.go('pages.index')
})
}
} else this.selectAccountLogin({
id: loginUserInfoList[0].uuid,
sessionId
})
} else wx.$api.showToast(message || '系统异常')
this.setBtnLoading(false)
}).catch(({
......@@ -253,6 +246,40 @@ Component({
}) => {
if (confirm) this.init()
})
},
selectAccountLogin({
id,
sessionId
}) {
const {
options: {
targetPath
}
} = thisPage
USERAPI.selectAccountLogin({
id,
sessionId
}).then(({
code,
data,
message
}) => {
if (code == '0') {
setUserInfo(data.loginUserInfoList[0])
setSessionId(data.sessionId)
if (targetPath) {
const {
url,
obj
} = setRouteData(targetPath)
wx.$router.reLaunch(url, obj)
} else wx.$router.go('pages.index')
} else wx.$api.showToast(message || '系统异常')
}).catch(({
errMsg
}) => {
wx.$api.showToast(errMsg || '系统异常')
})
}
},
lifetimes: {
......
......@@ -25,8 +25,6 @@ class Request {
'content-type': 'application/x-www-form-urlencoded'
} :
{}
const merchantId = wx.$storage.get('srcm_shopmall_merchant_id')
if (merchantId) header.merchantId = merchantId
let projectName = this.getRopProject(params.method)
if (!projectName) projectName = this.getRopProject(params.method)
const path = pathEnum[projectName]
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!