perf: verify

pull/91/MERGE
xingyu4j 2025-05-06 22:59:15 +08:00
parent c05c3281db
commit d29c71414e
6 changed files with 17 additions and 61 deletions

View File

@ -1,3 +0,0 @@
export { default as VerifyPoints } from './VerifyPoints.vue';
export { default as VerifySlide } from './VerifySlide.vue';

View File

@ -3,11 +3,11 @@
* Verify 验证码组件
* @description 分发验证码使用
*/
import type { VerificationProps } from './types';
import type { VerificationProps } from './typing';
import { defineAsyncComponent, markRaw, ref, toRefs, watchEffect } from 'vue';
import './style/verify.css';
import './verify.css';
defineOptions({
name: 'Verification',
@ -36,12 +36,8 @@ const props = withDefaults(defineProps<VerificationProps>(), {
const emit = defineEmits(['onSuccess', 'onError', 'onClose', 'onReady']);
const VerifyPoints = defineAsyncComponent(
() => import('./Verify/VerifyPoints.vue'),
);
const VerifySlide = defineAsyncComponent(
() => import('./Verify/VerifySlide.vue'),
);
const VerifyPoints = defineAsyncComponent(() => import('./verify-points.vue'));
const VerifySlide = defineAsyncComponent(() => import('./verify-slide.vue'));
const { captchaType, mode, checkCaptchaApi, getCaptchaApi } = toRefs(props);
const verifyType = ref();

View File

@ -1,7 +1,7 @@
<script lang="ts" setup>
import type { ComponentInternalInstance } from 'vue';
import type { VerificationProps } from '../types';
import type { VerificationProps } from './typing';
import {
getCurrentInstance,
@ -14,51 +14,14 @@ import {
import { $t } from '@vben/locales';
import { aesEncrypt } from '../utils/ase';
import { resetSize } from '../utils/util';
import { aesEncrypt } from './utils/ase';
import { resetSize } from './utils/util';
/**
* VerifyPoints
* @description 点选
*/
// const props = defineProps({
// barSize: {
// default() {
// return {
// height: '40px',
// width: '310px',
// };
// },
// type: Object,
// },
// captchaType: {
// default() {
// return 'VerifyPoints';
// },
// type: String,
// },
// imgSize: {
// default() {
// return {
// height: '155px',
// width: '310px',
// };
// },
// type: Object,
// },
// // popfixed
// mode: {
// default: 'fixed',
// type: String,
// },
// //
// vSpace: {
// default: 5,
// type: Number,
// },
// });
defineOptions({
name: 'VerifyPoints',
});
@ -104,8 +67,8 @@ const bindingClick = ref(true);
function init() {
//
fontPos.splice(0, fontPos.length);
checkPosArr.splice(0, checkPosArr.length);
fontPos.splice(0);
checkPosArr.splice(0);
num.value = 1;
getPictrue();
nextTick(() => {
@ -150,12 +113,12 @@ const pointTransfrom = function (pointArr: any, imgSize: any) {
};
const refresh = async function () {
tempPoints.splice(0, tempPoints.length);
tempPoints.splice(0);
barAreaColor.value = '#000';
barAreaBorderColor.value = '#ddd';
bindingClick.value = true;
fontPos.splice(0, fontPos.length);
checkPosArr.splice(0, checkPosArr.length);
fontPos.splice(0);
checkPosArr.splice(0);
num.value = 1;
await getPictrue();
showRefresh.value = true;
@ -191,7 +154,7 @@ function canvasClick(e: any) {
if (res.repCode === '0000') {
barAreaColor.value = '#4cae4c';
barAreaBorderColor.value = '#5cb85c';
text.value = $t('ui.captcha.success');
text.value = $t('ui.captcha.sliderSuccessText');
bindingClick.value = false;
if (mode.value === 'pop') {
setTimeout(() => {
@ -228,7 +191,7 @@ async function getPictrue() {
backToken.value = res.data.repData.token;
secretKey.value = res.data.repData.secretKey;
poinTextList.value = res.data.repData.wordList;
text.value = `${$t('ui.captcha.point')}${poinTextList.value.join(',')}`;
text.value = `${$t('ui.captcha.clickInOrder')}${poinTextList.value.join(',')}`;
} else {
text.value = res?.data?.repMsg;
}

View File

@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { VerificationProps } from '../types';
import type { VerificationProps } from './typing';
/**
* VerifySlide
@ -17,8 +17,8 @@ import {
import { $t } from '@vben/locales';
import { aesEncrypt } from './../utils/ase';
import { resetSize } from './../utils/util';
import { aesEncrypt } from './utils/ase';
import { resetSize } from './utils/util';
const props = withDefaults(defineProps<VerificationProps>(), {
barSize: () => ({