mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-08 08:05:07 +08:00
refactor: vue3 axios api ...
This commit is contained in:
@ -1,16 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import { useIcon } from '@/hooks/web/useIcon'
|
||||
import { reactive, ref, unref, watch, onMounted, computed } from 'vue'
|
||||
import { reactive, ref, unref, watch, computed } from 'vue'
|
||||
import LoginFormTitle from './LoginFormTitle.vue'
|
||||
import { ElForm, ElFormItem, ElInput, ElRow, ElCol, ElMessage } from 'element-plus'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { required } from '@/utils/formRules'
|
||||
import {
|
||||
getTenantIdByNameApi,
|
||||
getCodeImgApi,
|
||||
getAsyncRoutesApi,
|
||||
sendSmsCodeApi,
|
||||
smsLoginApi
|
||||
smsLoginApi,
|
||||
getInfoApi
|
||||
} from '@/api/login'
|
||||
import { useCache } from '@/hooks/web/useCache'
|
||||
import { usePermissionStore } from '@/store/modules/permission'
|
||||
@ -98,12 +98,6 @@ watch(
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
// 获取验证码 TODO @jinz:是不是可以去掉?手机这里暂时不用验证码
|
||||
const getCode = async () => {
|
||||
const res = await getCodeImgApi()
|
||||
loginData.codeImg = 'data:image/gif;base64,' + res.img
|
||||
loginData.loginForm.uuid = res.uuid
|
||||
}
|
||||
// 获取租户 ID
|
||||
const getTenantId = async () => {
|
||||
const res = await getTenantIdByNameApi(loginData.loginForm.tenantName)
|
||||
@ -120,7 +114,8 @@ const signIn = async () => {
|
||||
await smsLoginApi(smsVO.loginSms)
|
||||
.then(async (res) => {
|
||||
setToken(res?.token)
|
||||
await userStore.getUserInfoAction()
|
||||
const userInfo = await getInfoApi()
|
||||
await userStore.getUserInfoAction(userInfo)
|
||||
getRoutes()
|
||||
})
|
||||
.catch(() => {})
|
||||
@ -141,9 +136,6 @@ const getRoutes = async () => {
|
||||
permissionStore.setIsAddRouters(true)
|
||||
push({ path: redirect.value || permissionStore.addRouters[0].path })
|
||||
}
|
||||
onMounted(() => {
|
||||
getCode()
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<el-form
|
||||
|
Reference in New Issue
Block a user