Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
51c3a2a2f1
@ -121,7 +121,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(axiosConfig: AxiosRequest
|
||||
options.loading && closeLoading(options) // 关闭loading
|
||||
|
||||
if (response.config.responseType == 'json') {
|
||||
if (response.data && response.data.code !== 200) {
|
||||
if (response.data && response.data.code == 401) {
|
||||
// if (response.data.code == 409) {
|
||||
// if (!window.tokenRefreshing) {
|
||||
// window.tokenRefreshing = true
|
||||
@ -161,21 +161,16 @@ function createAxios<Data = any, T = ApiPromise<Data>>(axiosConfig: AxiosRequest
|
||||
// if (response.data.code == 302) {
|
||||
// router.push({ path: response.data.data.routePath ?? '', name: response.data.data.routeName ?? '' })
|
||||
// }
|
||||
if (response.data.code == 400) {
|
||||
|
||||
// if (response.data.code == 401) {
|
||||
let routerPath = adminBaseRoute.path
|
||||
userInfo.removeToken()
|
||||
routerPath += '/login'
|
||||
router.push({ path: routerPath })
|
||||
}
|
||||
if (response.data.code == 401) {
|
||||
let routerPath = adminBaseRoute.path
|
||||
userInfo.removeToken()
|
||||
routerPath += '/login'
|
||||
router.push({ path: routerPath })
|
||||
}
|
||||
// }
|
||||
// code不等于1, 页面then内的具体逻辑就不执行了
|
||||
return Promise.reject(response.data)
|
||||
} else if (options.showSuccessMessage && response.data && response.data.code == 1) {
|
||||
} else if (options.showSuccessMessage && response.data && response.data.code == 200) {
|
||||
ElNotification({
|
||||
message: response.data.msg ? response.data.msg : i18n.global.t('axios.Operation successful'),
|
||||
type: 'success',
|
||||
|
@ -52,18 +52,12 @@
|
||||
</el-form-item>
|
||||
<el-form-item v-if="state.showCaptcha" prop="captcha">
|
||||
<el-space>
|
||||
<el-input
|
||||
ref="captchaRef"
|
||||
v-model="form.code"
|
||||
type="text"
|
||||
:placeholder="t('login.Please input a captcha')"
|
||||
clearable
|
||||
>
|
||||
<el-input ref="captchaRef" v-model="form.code" type="text" :placeholder="t('login.Please input a captcha')">
|
||||
<template #prefix>
|
||||
<Icon name="fa fa-unlock-alt" class="form-item-icon" size="16" color="var(--el-input-icon-color)" />
|
||||
</template>
|
||||
</el-input>
|
||||
<img class="captcha-img" @click.prevent="load()" :src="state.captcha" />
|
||||
<img @click.prevent="load()" :src="state.captcha" />
|
||||
</el-space>
|
||||
</el-form-item>
|
||||
<!-- <el-checkbox v-model="form.keep" :label="t('login.Hold session')" size="default"></el-checkbox> -->
|
||||
@ -92,6 +86,7 @@ import { onMounted, onBeforeUnmount, reactive, ref, nextTick } from 'vue'
|
||||
import { getCaptchaData } from '/@/api/common'
|
||||
import * as pageBubble from '/@/utils/pageBubble'
|
||||
import type { FormInstance, InputInstance } from 'element-plus'
|
||||
import { ElNotification } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { editDefaultLang } from '/@/lang/index'
|
||||
import { useConfig } from '/@/stores/config'
|
||||
@ -133,7 +128,7 @@ const { t } = useI18n()
|
||||
const rules = reactive({
|
||||
username: [buildValidatorData({ name: 'required', message: t('login.Please enter an account') }), buildValidatorData({ name: 'account' })],
|
||||
password: [buildValidatorData({ name: 'required', message: t('login.Please input a password') }), buildValidatorData({ name: 'password' })],
|
||||
code: [buildValidatorData({ name: 'required', message: t('login.Please input a captcha') }), buildValidatorData({ name: 'required' })],
|
||||
code: [buildValidatorData({ name: 'required', message: t('login.Please input a captcha') })],
|
||||
})
|
||||
|
||||
const focusInput = () => {
|
||||
@ -189,6 +184,7 @@ const onSubmit = () => {
|
||||
state.submitLoading = true
|
||||
login(form)
|
||||
.then((res) => {
|
||||
if (res.code == 200) {
|
||||
adminInfo.dataFill({
|
||||
id: res.data.sysUser.id,
|
||||
username: res.data.sysUser.account,
|
||||
@ -201,6 +197,13 @@ const onSubmit = () => {
|
||||
super: false,
|
||||
})
|
||||
router.push({ path: adminBaseRoutePath })
|
||||
} else {
|
||||
ElNotification({
|
||||
message: res.msg,
|
||||
type: 'error',
|
||||
})
|
||||
load()
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
state.submitLoading = false
|
||||
|
Loading…
Reference in New Issue
Block a user