From 23331318dec24fc151a1b85f2391135b13236b38 Mon Sep 17 00:00:00 2001 From: landaiqing <3517283258@qq.com> Date: Fri, 15 Nov 2024 02:05:52 +0800 Subject: [PATCH] :sparkles: update api url --- .env.development | 4 ++-- src/api/captcha/index.ts | 2 +- src/api/oauth/gitee.ts | 2 +- src/api/oauth/github.ts | 2 +- src/api/oauth/index.ts | 2 +- src/api/oauth/qq.ts | 2 +- src/api/oauth/wechat.ts | 2 +- src/api/user/index.ts | 21 +++------------------ src/views/Forget/ForgetPage.vue | 4 ++-- src/views/Login/LoginPage.vue | 6 +++--- 10 files changed, 16 insertions(+), 31 deletions(-) diff --git a/.env.development b/.env.development index 7fc10aa..70cba19 100644 --- a/.env.development +++ b/.env.development @@ -16,6 +16,6 @@ VITE_TITLE_NAME='五味子云相册' VITE_APP_TOKEN_KEY='Bearer' # the websocket url -VITE_QR_SOCKET_URL='ws://127.0.0.1:80/api/ws/qr_ws' +VITE_QR_SOCKET_URL='ws://127.0.0.1:80/api/ws/qrcode' -VITE_MESSAGE_SOCKET_URL='ws://127.0.0.1:80/api/ws/message_ws' +VITE_MESSAGE_SOCKET_URL='ws://127.0.0.1:80/api/ws/message' diff --git a/src/api/captcha/index.ts b/src/api/captcha/index.ts index fac5fe9..bc04735 100644 --- a/src/api/captcha/index.ts +++ b/src/api/captcha/index.ts @@ -4,7 +4,7 @@ import {service} from "@/utils/alova/service.ts"; * 获取旋转验证码图片数据 */ export const getRotatedCaptchaData = () => { - return service.Get('/api/captcha/rotate/get', { + return service.Get('/api/captcha/rotate/generate', { meta: { ignoreToken: true }, diff --git a/src/api/oauth/gitee.ts b/src/api/oauth/gitee.ts index 2f8034f..225403b 100644 --- a/src/api/oauth/gitee.ts +++ b/src/api/oauth/gitee.ts @@ -4,7 +4,7 @@ import {service} from "@/utils/alova/service.ts"; * 获取Gitee登录链接 */ export const getGiteeUrl = () => { - return service.Get('/api/oauth/gitee/get_url', + return service.Get('/api/oauth/gitee/url', { meta: { ignoreToken: true, diff --git a/src/api/oauth/github.ts b/src/api/oauth/github.ts index efd263b..f9dfeee 100644 --- a/src/api/oauth/github.ts +++ b/src/api/oauth/github.ts @@ -4,7 +4,7 @@ import {service} from "@/utils/alova/service.ts"; * Get Github OAuth URL */ export const getGithubUrl = (state: string) => { - return service.Get('/api/oauth/github/get_url', + return service.Get('/api/oauth/github/url', { params: { state: state diff --git a/src/api/oauth/index.ts b/src/api/oauth/index.ts index a3c04fb..d9840fa 100644 --- a/src/api/oauth/index.ts +++ b/src/api/oauth/index.ts @@ -4,7 +4,7 @@ import {service} from "@/utils/alova/service.ts"; * 生成客户端id */ export const generateClientId = () => { - return service.Get('/api/client/generate_client_id', + return service.Get('/api/client/generate', { meta: { ignoreToken: true, diff --git a/src/api/oauth/qq.ts b/src/api/oauth/qq.ts index 9d7ba72..3ad86c5 100644 --- a/src/api/oauth/qq.ts +++ b/src/api/oauth/qq.ts @@ -1,7 +1,7 @@ import {service} from "@/utils/alova/service.ts"; export const getQQUrl = (state: string) => { - return service.Get('/api/oauth/qq/get_url', + return service.Get('/api/oauth/qq/url', { params: { state: state diff --git a/src/api/oauth/wechat.ts b/src/api/oauth/wechat.ts index 956c1f2..cd733b1 100644 --- a/src/api/oauth/wechat.ts +++ b/src/api/oauth/wechat.ts @@ -5,7 +5,7 @@ import {service} from "@/utils/alova/service.ts"; * @param clientId */ export const generateQrCode = (clientId: string) => { - return service.Get('/api/oauth/wechat/get_temp_qrcode', + return service.Get('/api/oauth/wechat/qrcode', { params: { client_id: clientId diff --git a/src/api/user/index.ts b/src/api/user/index.ts index 1c26dfa..0ef90c4 100644 --- a/src/api/user/index.ts +++ b/src/api/user/index.ts @@ -52,7 +52,7 @@ export const sendMessage = (params: any) => { * @param param */ export const phoneLoginApi = (param: PhoneLogin) => { - return service.Post('/api/user/phone_login', { + return service.Post('/api/user/phone/login', { phone: param.phone, captcha: param.captcha, auto_login: param.auto_login @@ -90,7 +90,7 @@ export const accountLoginApi = (param: AccountLogin) => { * @param param */ export const resetPasswordApi = (param: ResetPassword) => { - return service.Post('/api/user/reset_password', { + return service.Post('/api/user/reset/password', { phone: param.phone, captcha: param.captcha, password: param.password, @@ -103,28 +103,13 @@ export const resetPasswordApi = (param: ResetPassword) => { } ); }; -/** - * 获取用户权限 - * @param user_id - */ -export const getUserPermissions = (user_id: string) => { - return service.Post('/api/auth/permission/get_user_permissions', { - user_id: user_id - }, - { - meta: { - ignoreToken: false, - } - } - ); -}; /** * 获取用户设备信息 */ export const getUserDevice = () => { - return service.Get('/api/user/get_device', + return service.Get('/api/user/device', { params: {}, meta: { diff --git a/src/views/Forget/ForgetPage.vue b/src/views/Forget/ForgetPage.vue index 36d719a..d613963 100644 --- a/src/views/Forget/ForgetPage.vue +++ b/src/views/Forget/ForgetPage.vue @@ -257,7 +257,7 @@ async function resetPasswordSubmit() { .validate() .then(async () => { const res: any = await resetPasswordApi(ResetPasswordForm); - if (res.code === 200 && res.success) { + if (res.code === 200 && res.data) { message.success(t('login.resetPasswordSuccess')); await router.push('/login'); } else { @@ -295,7 +295,7 @@ async function getRotateCaptcha() { */ async function sendMessageByPhone(param: any): Promise { const res: any = await sendMessage(param); - if (res.code === 200 && res.success) { + if (res.code === 200 && res.data) { message.success(t('login.sendCaptchaSuccess')); return true; } else { diff --git a/src/views/Login/LoginPage.vue b/src/views/Login/LoginPage.vue index b36e7e5..e6796d6 100644 --- a/src/views/Login/LoginPage.vue +++ b/src/views/Login/LoginPage.vue @@ -378,7 +378,7 @@ async function phoneLoginSubmit() { .then(async () => { loginLoading.value = true; const res: any = await phoneLoginApi(phoneLoginForm); - if (res.code === 200 && res.success) { + if (res.code === 200 && res.data) { userStore.user.uid = res.data.uid; userStore.user.access_token = res.data.access_token; userStore.user.username = res.data.username; @@ -460,7 +460,7 @@ async function checkAccountLoginCaptcha(angle: number) { }; loginLoading.value = true; const res: any = await accountLoginApi(params); - if (res.code === 200 && res.success) { + if (res.code === 200 && res.data) { userStore.user.uid = res.data.uid; userStore.user.access_token = res.data.access_token; userStore.user.username = res.data.username; @@ -485,7 +485,7 @@ async function checkAccountLoginCaptcha(angle: number) { */ async function sendMessageByPhone(params: any): Promise { const res: any = await sendMessage(params); - if (res.code === 200 && res.success) { + if (res.code === 200) { message.success(t('login.sendCaptchaSuccess')); return true; } else {