Browse Source
fix(type): 修复几个 ts 报错,和文件引用位置 (#1283)
* fix(type): 删除多余的类型定义
* fix(login): 删除登录时的 toRaw 包裹参数
* fix(type): 修复几个 ts 报错,和文件引用位置
pull/1288/head
miofly
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
11 additions and
13 deletions
-
src/router/constant.ts
-
src/utils/http/axios/Axios.ts
-
src/utils/http/axios/index.ts
-
src/views/sys/login/LoginForm.vue
|
|
|
@ -4,7 +4,7 @@ export const PARENT_LAYOUT_NAME = 'ParentLayout'; |
|
|
|
|
|
|
|
export const PAGE_NOT_FOUND_NAME = 'PageNotFound'; |
|
|
|
|
|
|
|
export const EXCEPTION_COMPONENT = () => import('../views/sys/exception/Exception.vue'); |
|
|
|
export const EXCEPTION_COMPONENT = () => import('/@/views/sys/exception/Exception.vue'); |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: default layout |
|
|
|
|
|
|
|
@ -1,5 +1,5 @@ |
|
|
|
import type { AxiosRequestConfig, AxiosInstance, AxiosResponse, AxiosError } from 'axios'; |
|
|
|
import type { RequestOptions, Result, UploadFileParams } from '../../../../types/axios'; |
|
|
|
import type { RequestOptions, Result, UploadFileParams } from '/#/axios'; |
|
|
|
import type { CreateAxiosOptions } from './axiosTransform'; |
|
|
|
import axios from 'axios'; |
|
|
|
import qs from 'qs'; |
|
|
|
|
|
|
|
@ -140,7 +140,7 @@ const transform: AxiosTransform = { |
|
|
|
const token = getToken(); |
|
|
|
if (token && (config as Recordable)?.requestOptions?.withToken !== false) { |
|
|
|
// jwt token
|
|
|
|
config.headers.Authorization = options.authenticationScheme |
|
|
|
(config as Recordable).headers.Authorization = options.authenticationScheme |
|
|
|
? `${options.authenticationScheme} ${token}` |
|
|
|
: token; |
|
|
|
} |
|
|
|
@ -184,7 +184,7 @@ const transform: AxiosTransform = { |
|
|
|
return Promise.reject(error); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
throw new Error(error); |
|
|
|
throw new Error(error as unknown as string); |
|
|
|
} |
|
|
|
|
|
|
|
checkStatus(error?.response?.status, msg, errorMessageMode); |
|
|
|
|
|
|
|
@ -82,7 +82,7 @@ |
|
|
|
</Form> |
|
|
|
</template> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { reactive, ref, toRaw, unref, computed } from 'vue'; |
|
|
|
import { reactive, ref, unref, computed } from 'vue'; |
|
|
|
|
|
|
|
import { Checkbox, Form, Input, Row, Col, Button, Divider } from 'ant-design-vue'; |
|
|
|
import { |
|
|
|
@ -134,13 +134,11 @@ |
|
|
|
if (!data) return; |
|
|
|
try { |
|
|
|
loading.value = true; |
|
|
|
const userInfo = await userStore.login( |
|
|
|
{ |
|
|
|
password: data.password, |
|
|
|
username: data.account, |
|
|
|
mode: 'none', //不要默认的错误提示 |
|
|
|
}, |
|
|
|
); |
|
|
|
const userInfo = await userStore.login({ |
|
|
|
password: data.password, |
|
|
|
username: data.account, |
|
|
|
mode: 'none', //不要默认的错误提示 |
|
|
|
}); |
|
|
|
if (userInfo) { |
|
|
|
notification.success({ |
|
|
|
message: t('sys.login.loginSuccessTitle'), |
|
|
|
@ -151,7 +149,7 @@ |
|
|
|
} catch (error) { |
|
|
|
createErrorModal({ |
|
|
|
title: t('sys.api.errorTip'), |
|
|
|
content: error.message || t('sys.api.networkExceptionMsg'), |
|
|
|
content: (error as unknown as Error).message || t('sys.api.networkExceptionMsg'), |
|
|
|
getContainer: () => document.body.querySelector(`.${prefixCls}`) || document.body, |
|
|
|
}); |
|
|
|
} finally { |
|
|
|
|