|
@@ -11,7 +11,7 @@ definePage({
|
|
|
navigationStyle: 'custom',
|
|
navigationStyle: 'custom',
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
-const { token, redirectName, userInfo } = storeToRefs(useUserStore())
|
|
|
|
|
|
|
+const { token, redirectName } = storeToRefs(useUserStore())
|
|
|
const { thirdPartyName, thirdPartyLogo } = storeToRefs(useSysStore())
|
|
const { thirdPartyName, thirdPartyLogo } = storeToRefs(useSysStore())
|
|
|
const { data, send } = useRequest((code, phoneCode) => Apis.sys.auth({ params: {
|
|
const { data, send } = useRequest((code, phoneCode) => Apis.sys.auth({ params: {
|
|
|
grant_type: 'wechat',
|
|
grant_type: 'wechat',
|
|
@@ -71,24 +71,24 @@ async function handleLogin() {
|
|
|
uni.showLoading({ mask: true })
|
|
uni.showLoading({ mask: true })
|
|
|
try {
|
|
try {
|
|
|
const res = await Apis.general.post_smqjh_auth_oauth2_token({ params: { grant_type: 'sms_code', mobile: phone.value, code: code.value } })
|
|
const res = await Apis.general.post_smqjh_auth_oauth2_token({ params: { grant_type: 'sms_code', mobile: phone.value, code: code.value } })
|
|
|
- uni.hideLoading()
|
|
|
|
|
token.value = `Bearer ${res.data.access_token}`
|
|
token.value = `Bearer ${res.data.access_token}`
|
|
|
|
|
+ useUserStore().getUserInfo()
|
|
|
|
|
+ uni.hideLoading()
|
|
|
useGlobalToast().show('登录成功')
|
|
useGlobalToast().show('登录成功')
|
|
|
- const user = await Apis.general.get_smqjh_system_app_api_v1_members_me()
|
|
|
|
|
- userInfo.value = user.data as Api.userInfo
|
|
|
|
|
- console.log(redirectName.value, '==========redirectName.value')
|
|
|
|
|
-
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
- if (tabList.includes(redirectName.value)) {
|
|
|
|
|
- router.pushTab({ path: redirectName.value })
|
|
|
|
|
|
|
+ const path = redirectName.value || '/pages/index/index'
|
|
|
|
|
+ if (tabList.includes(path)) {
|
|
|
|
|
+ router.pushTab({ path })
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- router.replace({ path: redirectName.value })
|
|
|
|
|
|
|
+ router.replace({ path })
|
|
|
}
|
|
}
|
|
|
}, 1000)
|
|
}, 1000)
|
|
|
}
|
|
}
|
|
|
catch {
|
|
catch {
|
|
|
|
|
+ token.value = ''
|
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
|
|
|
+ useGlobalToast().show('登录失败')
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
async function handleGetPhone(e: UniHelper.ButtonOnGetphonenumberDetail) {
|
|
async function handleGetPhone(e: UniHelper.ButtonOnGetphonenumberDetail) {
|
|
@@ -100,8 +100,8 @@ async function handleGetPhone(e: UniHelper.ButtonOnGetphonenumberDetail) {
|
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
|
await send(res.code, e.code)
|
|
await send(res.code, e.code)
|
|
|
token.value = `Bearer ${data.value.data.access_token}`
|
|
token.value = `Bearer ${data.value.data.access_token}`
|
|
|
- useGlobalToast().show({ msg: '登录成功' })
|
|
|
|
|
useUserStore().getUserInfo()
|
|
useUserStore().getUserInfo()
|
|
|
|
|
+ useGlobalToast().show({ msg: '登录成功' })
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
if (tabList.includes(redirectName.value)) {
|
|
if (tabList.includes(redirectName.value)) {
|