From 5eda100d4589832f9a03ca3bc7976d88f09141e4 Mon Sep 17 00:00:00 2001 From: yufei_wang <2267742828@qq.com> Date: Wed, 4 Sep 2024 13:09:06 +0800 Subject: [PATCH] =?UTF-8?q?HL-5269SCP=E7=9A=84=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E6=94=B9=E6=88=90=E7=82=B9=E5=87=BB=E6=96=87?= =?UTF-8?q?=E5=AD=97=EF=BC=88B=E7=AB=99=EF=BC=89=E6=88=96=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=9B=BE=E5=9D=97=EF=BC=88=E4=BA=AC=E4=B8=9C=EF=BC=89?= =?UTF-8?q?=E7=AD=89=E6=9B=B4=E6=98=93=E7=94=A8=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/login/index.ts | 11 ++++- src/components/Verifition/src/Verify.vue | 3 +- .../Verifition/src/Verify/VerifySlide.vue | 30 ++++++++---- src/views/login/components/LoginForm.vue | 46 +++++++++++-------- 4 files changed, 61 insertions(+), 29 deletions(-) diff --git a/src/api/login/index.ts b/src/api/login/index.ts index d6a7af2a5..7f30be37e 100644 --- a/src/api/login/index.ts +++ b/src/api/login/index.ts @@ -60,6 +60,11 @@ export const getCode = (data) => { return request.postOriginal({ url: 'system/captcha/get', data }) } +// 获取验证图片以及 token +export const getCodeCaptchaImage = (params) => { + return request.get({ url: 'system/captcha/captchaImage', params }) +} + // 滑动或者点选验证 export const reqCheck = (data) => { return request.postOriginal({ url: 'system/captcha/check', data }) @@ -71,4 +76,8 @@ export const getCodeImg = () => { url: 'system/captcha/captchaImage', headers: { isToken: false }}) -} \ No newline at end of file +} +// PDA下载地址 +export const downloadApk = (params) => { + return request.get({ url: '/wms/system-install-package/downloadApk', params }) +} diff --git a/src/components/Verifition/src/Verify.vue b/src/components/Verifition/src/Verify.vue index b7b504861..40881e59a 100644 --- a/src/components/Verifition/src/Verify.vue +++ b/src/components/Verifition/src/Verify.vue @@ -137,7 +137,8 @@ export default { instance, showBox, closeBox, - show + show, + refresh } } } diff --git a/src/components/Verifition/src/Verify/VerifySlide.vue b/src/components/Verifition/src/Verify/VerifySlide.vue index aa11ad132..33ed40ab0 100644 --- a/src/components/Verifition/src/Verify/VerifySlide.vue +++ b/src/components/Verifition/src/Verify/VerifySlide.vue @@ -11,7 +11,9 @@ alt="" style="display: block; width: 100%; height: 100%" /> -
+ + +
@@ -78,7 +80,7 @@ * */ import { aesEncrypt } from './../utils/ase' import { resetSize } from './../utils/util' -import { getCode, reqCheck } from '@/api/login' +import { getCode, getCodeCaptchaImage,reqCheck } from '@/api/login' const props = defineProps({ captchaType: { @@ -388,14 +390,24 @@ const getPictrue = async () => { let data = { captchaType: captchaType.value } - const res = await getCode(data) - if (res.repCode == '0000') { - backImgBase.value = res.repData.originalImageBase64 - blockBackImgBase.value = res.repData.jigsawImageBase64 - backToken.value = res.repData.token - secretKey.value = res.repData.secretKey + const res = await getCodeCaptchaImage(data) + console.log('res',res) + if(res){ + backImgBase.value = res.originalImageBase64 + blockBackImgBase.value = res.jigsawImageBase64 + backToken.value = res.token + secretKey.value = res.secretKey } else { - tipWords.value = res.repMsg + tipWords.value = res } + + // if (res.repCode == '0000') { + // backImgBase.value = res.repData.originalImageBase64 + // blockBackImgBase.value = res.repData.jigsawImageBase64 + // backToken.value = res.repData.token + // secretKey.value = res.repData.secretKey + // } else { + // tipWords.value = res.repMsg + // } } diff --git a/src/views/login/components/LoginForm.vue b/src/views/login/components/LoginForm.vue index 9dde5c918..f9b31784c 100644 --- a/src/views/login/components/LoginForm.vue +++ b/src/views/login/components/LoginForm.vue @@ -34,6 +34,11 @@ + + + + + @@ -70,13 +75,6 @@ @click="handleLogin()" /> - @@ -84,6 +82,7 @@ import { ElLoading } from 'element-plus' import LoginFormTitle from './LoginFormTitle.vue' import type { RouteLocationNormalizedLoaded } from 'vue-router' + import { Verify } from '@/components/Verifition' import { useIcon } from '@/hooks/web/useIcon' @@ -113,8 +112,7 @@ const permissionStore = usePermissionStore() const redirect = ref('') const loginLoading = ref(false) - const verify = ref() - const captchaType = ref('blockPuzzle') // blockPuzzle 滑块 clickWord 点击文字 + const VerifySlide = ref() const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN) @@ -185,13 +183,14 @@ if(!needCode.value){ return } - getCodeImg().then(res => { - captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled; - if (captchaEnabled.value) { - codeUrl.value = "data:image/gif;base64," + res.img; - loginData.loginForm.uuid = res.uuid; - } - }); + VerifySlide.value.refresh() + // getCodeImg().then(res => { + // captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled; + // if (captchaEnabled.value) { + // codeUrl.value = "data:image/gif;base64," + res.img; + // loginData.loginForm.uuid = res.uuid; + // } + // }); } //获取租户ID const getTenantId = async () => { @@ -220,9 +219,20 @@ }) }; + // 滑块校验成功 + const capctchaCheckSuccess = ({captchaVerification})=>{ + console.log('capctchaCheckSuccess',captchaVerification) + loginData.loginForm.code = captchaVerification + handleLogin() + } + // 滑块校验失败 + const capctchaCheckError = ()=>{ + VerifySlide.value.refresh() + } + const loading = ref() // ElLoading.service 返回的实例 // 登录 - const handleLogin = async (params) => { + const handleLogin = async () => { console.log('登录-185') if(getSystermUpdateAlert()=='true'||getSystermUpdateAlert()===true){ await ElMessageBox.alert(