From 29cf4490e10e848211288e38ff3de5848e5f1b16 Mon Sep 17 00:00:00 2001 From: xingyy <64720302+Concur-max@users.noreply.github.com> Date: Wed, 12 Mar 2025 11:13:46 +0800 Subject: [PATCH] =?UTF-8?q?refactor(components):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E6=BB=91=E5=9D=97=E9=AA=8C=E8=AF=81=E7=A0=81=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 YourPuzzleComponent.vue 文件 - 新增 puzzleComponent 目录及 index.vue 文件 - 优化验证码组件的结构和功能 - 更新 login 页面中验证码的使用方式 --- app/components/YourPuzzleComponent.vue | 367 ----------------------- app/components/puzzleComponent/index.vue | 195 ++++++++++++ app/pages/login/index.vue | 41 ++- 3 files changed, 215 insertions(+), 388 deletions(-) delete mode 100644 app/components/YourPuzzleComponent.vue create mode 100644 app/components/puzzleComponent/index.vue diff --git a/app/components/YourPuzzleComponent.vue b/app/components/YourPuzzleComponent.vue deleted file mode 100644 index 2a91174..0000000 --- a/app/components/YourPuzzleComponent.vue +++ /dev/null @@ -1,367 +0,0 @@ - - - - - diff --git a/app/components/puzzleComponent/index.vue b/app/components/puzzleComponent/index.vue new file mode 100644 index 0000000..5ba0714 --- /dev/null +++ b/app/components/puzzleComponent/index.vue @@ -0,0 +1,195 @@ + + + + + + + \ No newline at end of file diff --git a/app/pages/login/index.vue b/app/pages/login/index.vue index 424a1c2..9519ec5 100644 --- a/app/pages/login/index.vue +++ b/app/pages/login/index.vue @@ -8,7 +8,9 @@ import {authStore} from "@/stores/auth/index.js"; import {message} from '@/components/x-message/useMessage.js' import {fddCheck} from "~/api/goods/index.js"; import zu6020 from '@/static/images/zu6020@2x.png' -import YourPuzzleComponent from '@/components/YourPuzzleComponent.vue' + +import PuzzleComponent from '@/components/puzzleComponent/index.vue' +import { ref } from 'vue'; const {userInfo,token,selectedZone}= authStore() const router = useRouter(); const route = useRoute(); @@ -84,27 +86,26 @@ onMounted(()=>{ selectedCountry.value=route.query.countryName || defaultCountry.name }) const vanSwipeRef=ref(null) + const captcha=ref({ - "nonceStr": "397b5e08168c31c4", -"blockX": 256 + nonceStr: "", +blockX: 256 , +blockWidth:50, +blockHeight:50, +canvasWidth:320, +canvasHeight:191, +place:0, +canvasSrc:'', +blockSrc:'', +blockY:0 }) -const captchaUrl=ref('') -const captchaVerifyUrl=ref('') -const blockY=ref(0) const getCode =async () => { loadingRef.value.loading1=true - const res=await userCaptcha({ -"canvasWidth": 320, //画布的宽度(canvasWidth大于41并且(canvasWidth-10)/2 - 1> blockWidth) -"canvasHeight": 191, //画布的高度(canvasHeight大于26并且 canvasHeight - blockHeight > 11 -"blockWidth": 50, //块图像的宽度(blockWidth大于14) -"blockHeight": 50, //块图像的高度(blockHeight大于14) -// "blockRadius": 25, //块图像的圆角半径 -"place": 0 //图像来源标识,0表示URL下载,1表示本地文件 一般用0 - }) + const res=await userCaptcha(captcha.value) if (res.status===0){ - captchaUrl.value=`data:image/png;base64,${res.data.canvasSrc}` - captchaVerifyUrl.value=`data:image/png;base64,${res.data.blockSrc}` - blockY.value=res.data.blockY + captcha.value.canvasSrc=`data:image/png;base64,${res.data.canvasSrc}` + captcha.value.blockSrc=`data:image/png;base64,${res.data.blockSrc}` + captcha.value.blockY=res.data.blockY captcha.value.nonceStr=res.data.nonceStr isShow.value=true loadingRef.value.loading1=false @@ -286,10 +287,8 @@ const onLeave =async (moveX, callback) => { {{ $t('login.agreement') }}{{ $t('login.privacyPolicy') }} -