Commit ae8ee0d6 by 李伟康

提交登录

1 parent e13c521e
...@@ -149,13 +149,22 @@ Component({ ...@@ -149,13 +149,22 @@ Component({
password: formData.password password: formData.password
} }
this.setBtnLoading() this.setBtnLoading()
console.log(target)
USERAPI[target](obj).then(({ USERAPI[target](obj).then(({
code, code,
data, data,
message message
}) => { }) => {
this.setBtnLoading(false) 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({ if (loginType == 1) this.setData({
smsError: true smsError: true
}) })
...@@ -180,29 +189,13 @@ Component({ ...@@ -180,29 +189,13 @@ Component({
const { const {
loginUserInfoList, loginUserInfoList,
sessionId sessionId
} = data, { } = data
options: {
targetPath
}
} = thisPage
if (loginUserInfoList.length > 1) { if (loginUserInfoList.length > 1) {
wx.$router.go('login.accountItems') wx.$router.go('login.accountItems')
} else { } else this.selectAccountLogin({
USERAPI.selectAccountLogin({ id: loginUserInfoList[0].uuid,
id: loginUserInfoList[0].uuid, sessionId
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 wx.$api.showToast(message || '系统异常') } else wx.$api.showToast(message || '系统异常')
this.setBtnLoading(false) this.setBtnLoading(false)
}).catch(({ }).catch(({
...@@ -253,6 +246,40 @@ Component({ ...@@ -253,6 +246,40 @@ Component({
}) => { }) => {
if (confirm) this.init() 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: { lifetimes: {
......
...@@ -25,8 +25,6 @@ class Request { ...@@ -25,8 +25,6 @@ class Request {
'content-type': 'application/x-www-form-urlencoded' '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) let projectName = this.getRopProject(params.method)
if (!projectName) projectName = this.getRopProject(params.method) if (!projectName) projectName = this.getRopProject(params.method)
const path = pathEnum[projectName] 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!