diff --git a/os/auto-imports.d.ts b/os/auto-imports.d.ts index 9d24007..76e1ee6 100644 --- a/os/auto-imports.d.ts +++ b/os/auto-imports.d.ts @@ -6,5 +6,5 @@ // biome-ignore lint: disable export {} declare global { - + const ElMessage: typeof import('element-plus/es')['ElMessage'] } diff --git a/os/src/api/auth.ts b/os/src/api/auth.ts index 82e9941..59946ab 100644 --- a/os/src/api/auth.ts +++ b/os/src/api/auth.ts @@ -3,13 +3,7 @@ import { get, getToken, setToken,post } from '@/utils/request' import { getClientId } from '@/utils/uuid' import { errMsg } from '@/utils/msg'; export function loginIn(params: any) { - return fetch('user/login', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()).then(res => { + return post('user/login', params).then(res => { if (res.success) { setToken(res.data.token) } @@ -72,11 +66,5 @@ export async function getSmsCode(phone: string) { return await res.json() } export async function register(params: any) { - return fetch('/user/register', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) + return post('/user/register', params) } \ No newline at end of file diff --git a/os/src/api/captcha.ts b/os/src/api/captcha.ts index dc359de..6b365e4 100644 --- a/os/src/api/captcha.ts +++ b/os/src/api/captcha.ts @@ -1,10 +1,10 @@ -import {noticeMsg,successMsg} from "@/utils/msg"; -import {get,post} from '@/utils/request' +import { noticeMsg} from "@/utils/msg"; +import { get, post } from '@/utils/request' import { onMounted, reactive, watch } from 'vue' -export const useHandler = (domRef:any) => { - const state = reactive({popoverVisible: false, type: "default"}) - const cData = reactive({image: "", thumb: "", captKey: "", thumbX: 0, thumbY: 0, thumbWidth: 0, thumbHeight: 0}) +export const useHandler = (domRef: any) => { + const state = reactive({ popoverVisible: false, type: "default" }) + const cData = reactive({ image: "", thumb: "", captKey: "", thumbX: 0, thumbY: 0, thumbWidth: 0, thumbHeight: 0 }) const clickEvent = () => { state.popoverVisible = true @@ -21,9 +21,9 @@ export const useHandler = (domRef:any) => { const requestCaptchaData = () => { domRef.value.clear && domRef.value.clear() - get('user/getcaptcha').then((response)=>{ - console.log(response) - const {data = {}} = response; + get('user/getcaptcha').then((response) => { + //console.log(response) + const { data = {} } = response; if (response.code === 0) { cData.image = data['image_base64'] || '' cData.thumb = data['tile_base64'] || '' @@ -31,11 +31,11 @@ export const useHandler = (domRef:any) => { cData.thumbX = data['tile_x'] || 0 cData.thumbY = data['tile_y'] || 0 cData.thumbWidth = data['tile_width'] || 0 - cData.thumbHeight =data['tile_height'] || 0 + cData.thumbHeight = data['tile_height'] || 0 } else { - noticeMsg(`获取验证码失败`,'提示','error') + noticeMsg(`获取验证码失败`, '提示', 'error') } - }).catch((e)=>{ + }).catch((e) => { console.warn(e) }) } @@ -44,27 +44,28 @@ export const useHandler = (domRef:any) => { requestCaptchaData() } - const confirmEvent = (point:any, clear:any) => { - console.log(cData) - post('user/checkcaptcha',{ - point: [point.x, point.y].join(','), - key: cData.captKey || '' - }).then((response)=>{ - console.log(response) - if (response.success) { - successMsg(`check data success`) + const confirmEvent = (point: any, clear: any) => { + //console.log(cData) + post('user/checkcaptcha', { + point: [point.x, point.y].join(','), + key: cData.captKey || '' + }).then((response) => { + //console.log(response) + if (response.success) { + //successMsg(`check data success`) state.popoverVisible = false state.type = "success" - }else{ - noticeMsg(`校验失败`,'提示','error') - //warningMsg(`check data failed`) - state.type = "error" - } + return; + } else { + noticeMsg(`校验失败`, '提示', 'error') + //warningMsg(`check data failed`) + state.type = "error" + } setTimeout(() => { requestCaptchaData() }, 1000) - }).catch((e)=>{ + }).catch((e) => { console.warn(e) }) } @@ -75,7 +76,7 @@ export const useHandler = (domRef:any) => { } }) - onMounted(( ) => { + onMounted(() => { requestCaptchaData() }) diff --git a/os/src/components/auth/PasswordLogin.vue b/os/src/components/auth/PasswordLogin.vue index c4aad14..1e308ab 100644 --- a/os/src/components/auth/PasswordLogin.vue +++ b/os/src/components/auth/PasswordLogin.vue @@ -42,15 +42,16 @@ const submitForm = () => { }); }; const showCaptcha = ref(false); // 控制是否显示验证码 -const captchaPassed = ref(false); // 验证码是否通过 +//const captchaPassed = ref(false); // 验证码是否通过 const handleCaptchaConfirm = (success: boolean) => { if (success) { - captchaPassed.value = true; + //captchaPassed.value = true; + showCaptcha.value = false; store.onLogin({ loginType: "password", params: store.loginForm, }); - showCaptcha.value = false; // 隐藏验证码 + // 隐藏验证码 } else { ElMessage.error("验证码验证失败,请重试"); showCaptcha.value = false; @@ -81,12 +82,7 @@ const closeCaptcha = () => { -
-
-
- -
-
+
@@ -110,31 +106,5 @@ const closeCaptcha = () => { border-radius: 50px; } -.custom-captcha-dialog { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 99; - display: flex; - align-items: center; - justify-content: center; -} -.overlay { - position: fixed; - top: 0; - left: 0; - width: 100vw; - height: 100vh; - background-color: rgba(0, 0, 0, 0.5); - z-index: 9998; -} - -.dialog-content { - padding: 20px; - z-index: 9998; - width: 350px; -} diff --git a/os/src/components/auth/SlideCaptcha.vue b/os/src/components/auth/SlideCaptcha.vue index 2b7e51e..88368ed 100644 --- a/os/src/components/auth/SlideCaptcha.vue +++ b/os/src/components/auth/SlideCaptcha.vue @@ -1,23 +1,27 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/os/src/components/auth/UserRegister.vue b/os/src/components/auth/UserRegister.vue index 1595d9a..df47868 100644 --- a/os/src/components/auth/UserRegister.vue +++ b/os/src/components/auth/UserRegister.vue @@ -1,5 +1,6 @@