diff --git a/yudao-ui-admin-vue3/src/api/login/index.ts b/yudao-ui-admin-vue3/src/api/login/index.ts index 3f9c9a93f..36b7d01c4 100644 --- a/yudao-ui-admin-vue3/src/api/login/index.ts +++ b/yudao-ui-admin-vue3/src/api/login/index.ts @@ -62,3 +62,12 @@ export const socialAuthRedirectApi = (type: string, redirectUri: string) => { url: '/system/auth/social-auth-redirect?type=' + type + '&redirectUri=' + redirectUri }) } +// 获取验证图片 以及token +export const getCodeApi = (data) => { + return request.postOriginal({ url: 'system/captcha/get', data }) +} + +// 滑动或者点选验证 +export const reqCheckApi = (data) => { + return request.postOriginal({ url: 'system/captcha/check', data }) +} diff --git a/yudao-ui-admin-vue3/src/components/Verifition/src/Verify.vue b/yudao-ui-admin-vue3/src/components/Verifition/src/Verify.vue index 70bfce7ef..a24280b4c 100644 --- a/yudao-ui-admin-vue3/src/components/Verifition/src/Verify.vue +++ b/yudao-ui-admin-vue3/src/components/Verifition/src/Verify.vue @@ -2,7 +2,7 @@
{{ t('captcha.verification') }} @@ -10,7 +10,7 @@
-
+
{ + reqCheckApi(data).then((res) => { if (res.repCode == '0000') { barAreaColor.value = '#4cae4c' barAreaBorderColor.value = '#5cb85c' @@ -230,7 +230,7 @@ export default { let data = { captchaType: captchaType.value } - reqGet(data).then((res) => { + getCodeApi(data).then((res) => { if (res.repCode == '0000') { pointBackImgBase.value = res.repData.originalImageBase64 backToken.value = res.repData.token diff --git a/yudao-ui-admin-vue3/src/components/Verifition/src/Verify/VerifySlide.vue b/yudao-ui-admin-vue3/src/components/Verifition/src/Verify/VerifySlide.vue index 2d59023bd..4b18299b8 100644 --- a/yudao-ui-admin-vue3/src/components/Verifition/src/Verify/VerifySlide.vue +++ b/yudao-ui-admin-vue3/src/components/Verifition/src/Verify/VerifySlide.vue @@ -78,7 +78,7 @@ * */ import { aesEncrypt } from './../utils/ase' import { resetSize } from './../utils/util' -import { reqGet, reqCheck } from './../api/index' +import { getCodeApi, reqCheckApi } from '@/api/login' import { useI18n } from '@/hooks/web/useI18n' import { computed, @@ -302,7 +302,7 @@ export default { : JSON.stringify({ x: moveLeftDistance, y: 5.0 }), token: backToken.value } - reqCheck(data).then((res) => { + reqCheckApi(data).then((res) => { if (res.repCode == '0000') { moveBlockBackgroundColor.value = '#5cb85c' leftBarBorderColor.value = '#5cb85c' @@ -379,7 +379,7 @@ export default { let data = { captchaType: captchaType.value } - reqGet(data).then((res) => { + getCodeApi(data).then((res) => { if (res.repCode == '0000') { backImgBase.value = res.repData.originalImageBase64 blockBackImgBase.value = res.repData.jigsawImageBase64 diff --git a/yudao-ui-admin-vue3/src/components/Verifition/src/api/index.ts b/yudao-ui-admin-vue3/src/components/Verifition/src/api/index.ts deleted file mode 100644 index 78c7c335c..000000000 --- a/yudao-ui-admin-vue3/src/components/Verifition/src/api/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 此处可直接引用自己项目封装好的 axios 配合后端联调 - */ - -import request from './../utils/axios' //组件内部封装的axios -// import request from "@/api/axios.js" //调用项目封装的axios - -//获取验证图片 以及token -export function reqGet(data) { - return request({ - // url: '/captcha/get', - url: '/admin-api/system/captcha/get', // 使用项目自定义的 /admin-api/ 前缀 - method: 'post', - data - }) -} - -//滑动或者点选验证 -export function reqCheck(data) { - return request({ - // url: '/captcha/check', - url: '/admin-api/system/captcha/check', // 使用项目自定义的 /admin-api/ 前缀 - method: 'post', - data - }) -} diff --git a/yudao-ui-admin-vue3/src/components/Verifition/src/utils/axios.ts b/yudao-ui-admin-vue3/src/components/Verifition/src/utils/axios.ts deleted file mode 100644 index ca68097e7..000000000 --- a/yudao-ui-admin-vue3/src/components/Verifition/src/utils/axios.ts +++ /dev/null @@ -1,26 +0,0 @@ -import axios from 'axios' - -axios.defaults.baseURL = import.meta.env.VITE_BASE_URL - -const service = axios.create({ - timeout: 40000, - headers: { - 'X-Requested-With': 'XMLHttpRequest', - 'Content-Type': 'application/json; charset=UTF-8' - } -}) -service.interceptors.request.use( - (config) => { - return config - }, - (error) => { - Promise.reject(error) - } -) - -// response interceptor -service.interceptors.response.use((response) => { - const res = response.data - return res -}) -export default service diff --git a/yudao-ui-admin-vue3/src/config/axios/index.ts b/yudao-ui-admin-vue3/src/config/axios/index.ts index 28a546d83..c2a3344bf 100644 --- a/yudao-ui-admin-vue3/src/config/axios/index.ts +++ b/yudao-ui-admin-vue3/src/config/axios/index.ts @@ -26,6 +26,10 @@ export default { const res = await request({ method: 'POST', ...option }) return res.data as unknown as T }, + postOriginal: async (option: any) => { + const res = await request({ method: 'POST', ...option }) + return res + }, delete: async (option: any) => { const res = await request({ method: 'DELETE', ...option }) return res.data as unknown as T diff --git a/yudao-ui-admin-vue3/vite.config.ts b/yudao-ui-admin-vue3/vite.config.ts index 12d958c83..17c1804db 100644 --- a/yudao-ui-admin-vue3/vite.config.ts +++ b/yudao-ui-admin-vue3/vite.config.ts @@ -144,6 +144,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { 'vue-router', 'vue-types', 'vue-i18n', + 'vxe-table', + 'xe-utils', 'element-plus/es', 'element-plus/es/locale/lang/zh-cn', 'element-plus/es/locale/lang/en',