+
@@ -9,7 +26,8 @@
radial-gradient(circle at center, rgb(255 255 255 / 80%), #f000) -200% 50% /
200% 100% no-repeat,
#000;
- animation: shine 3s linear infinite;
+
+ /* animation: shine 3s linear infinite; */
}
.dark .vben-spine-text {
diff --git a/packages/effects/common-ui/package.json b/packages/effects/common-ui/package.json
index a89e9e39ccd..3cb4bf42c75 100644
--- a/packages/effects/common-ui/package.json
+++ b/packages/effects/common-ui/package.json
@@ -23,6 +23,7 @@
"@vben-core/form-ui": "workspace:*",
"@vben-core/popup-ui": "workspace:*",
"@vben-core/shadcn-ui": "workspace:*",
+ "@vben-core/shared": "workspace:*",
"@vben/constants": "workspace:*",
"@vben/icons": "workspace:*",
"@vben/locales": "workspace:*",
diff --git a/packages/effects/common-ui/src/components/captcha/index.ts b/packages/effects/common-ui/src/components/captcha/index.ts
index 54b6db2bf96..6ad68c49647 100644
--- a/packages/effects/common-ui/src/components/captcha/index.ts
+++ b/packages/effects/common-ui/src/components/captcha/index.ts
@@ -1,3 +1,6 @@
-export { default as PointSelectionCaptcha } from './point-selection-captcha.vue';
-export { default as PointSelectionCaptchaCard } from './point-selection-captcha-card.vue';
+export { default as PointSelectionCaptcha } from './point-selection-captcha/index.vue';
+export { default as PointSelectionCaptchaCard } from './point-selection-captcha/index.vue';
+
+export { default as SliderCaptcha } from './slider-captcha/index.vue';
+export { default as SliderRotateCaptcha } from './slider-rotate-captcha/index.vue';
export type * from './types';
diff --git a/packages/effects/common-ui/src/components/captcha/point-selection-captcha.vue b/packages/effects/common-ui/src/components/captcha/point-selection-captcha/index.vue
similarity index 89%
rename from packages/effects/common-ui/src/components/captcha/point-selection-captcha.vue
rename to packages/effects/common-ui/src/components/captcha/point-selection-captcha/index.vue
index 57ddbb1cf50..63ce6c2233e 100644
--- a/packages/effects/common-ui/src/components/captcha/point-selection-captcha.vue
+++ b/packages/effects/common-ui/src/components/captcha/point-selection-captcha/index.vue
@@ -1,11 +1,11 @@
diff --git a/packages/effects/common-ui/src/components/captcha/slider-captcha/slider-captcha-action.vue b/packages/effects/common-ui/src/components/captcha/slider-captcha/slider-captcha-action.vue
new file mode 100644
index 00000000000..fc002bd8b19
--- /dev/null
+++ b/packages/effects/common-ui/src/components/captcha/slider-captcha/slider-captcha-action.vue
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/effects/common-ui/src/components/captcha/slider-captcha/slider-captcha-bar.vue b/packages/effects/common-ui/src/components/captcha/slider-captcha/slider-captcha-bar.vue
new file mode 100644
index 00000000000..eacf6842d3d
--- /dev/null
+++ b/packages/effects/common-ui/src/components/captcha/slider-captcha/slider-captcha-bar.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
diff --git a/packages/effects/common-ui/src/components/captcha/slider-captcha/slider-captcha-content.vue b/packages/effects/common-ui/src/components/captcha/slider-captcha/slider-captcha-content.vue
new file mode 100644
index 00000000000..5c481f2e618
--- /dev/null
+++ b/packages/effects/common-ui/src/components/captcha/slider-captcha/slider-captcha-content.vue
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+ {{ isPassing ? successText : text }}
+
+
+
+
+
+
diff --git a/packages/effects/common-ui/src/components/verify/rotate-verify/index.vue b/packages/effects/common-ui/src/components/captcha/slider-rotate-captcha/index.vue
similarity index 60%
rename from packages/effects/common-ui/src/components/verify/rotate-verify/index.vue
rename to packages/effects/common-ui/src/components/captcha/slider-rotate-captcha/index.vue
index 1678961a22d..e855900af3f 100644
--- a/packages/effects/common-ui/src/components/verify/rotate-verify/index.vue
+++ b/packages/effects/common-ui/src/components/captcha/slider-rotate-captcha/index.vue
@@ -1,22 +1,37 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/effects/common-ui/src/components/verify/drag-verify/bar.vue b/packages/effects/common-ui/src/components/verify/drag-verify/bar.vue
deleted file mode 100644
index f607550f59e..00000000000
--- a/packages/effects/common-ui/src/components/verify/drag-verify/bar.vue
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
diff --git a/packages/effects/common-ui/src/components/verify/drag-verify/content.vue b/packages/effects/common-ui/src/components/verify/drag-verify/content.vue
deleted file mode 100644
index 21a82c28f0e..00000000000
--- a/packages/effects/common-ui/src/components/verify/drag-verify/content.vue
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-
-
-
-
- {{ isPassing ? successText : text }}
-
-
-
-
-
diff --git a/packages/effects/common-ui/src/components/verify/index.ts b/packages/effects/common-ui/src/components/verify/index.ts
deleted file mode 100644
index b96f54ec124..00000000000
--- a/packages/effects/common-ui/src/components/verify/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export { default as DragVerify } from './drag-verify/index.vue';
-export { default as RotateVerify } from './rotate-verify/index.vue';
-
-export * from './typing';
diff --git a/packages/effects/common-ui/src/components/verify/props.ts b/packages/effects/common-ui/src/components/verify/props.ts
deleted file mode 100644
index 6f65144a989..00000000000
--- a/packages/effects/common-ui/src/components/verify/props.ts
+++ /dev/null
@@ -1,133 +0,0 @@
-import type { CSSProperties } from 'vue';
-
-export interface VerifyProps {
- /**
- * @description 滑块的样式
- * @default {}
- */
- actionStyle?: CSSProperties;
-
- /**
- * @description 滑块条的样式
- * @default {}
- */
- barStyle?: CSSProperties;
-
- /**
- * @description 内容的样式
- * @default {}
- */
- contentStyle?: CSSProperties;
-
- /**
- * @description 组件的样式
- * @default {}
- */
- wrapStyle?: CSSProperties;
-
- /**
- * @description 组件是否为圆角
- * @default false
- */
- circle?: boolean;
-
- /**
- * @description 组件宽度
- * @default 220px
- */
- width?: number | string;
- /**
- * @description 组件高度
- * @default 40px
- */
- height?: number | string;
-
- /**
- * @description 是否作为插槽使用,用于联动组件,可参考旋转校验组件
- * @default false
- */
- isSlot?: boolean;
-
- /**
- * @description 验证成功的提示
- * @default '验证通过'
- */
- successText?: string;
-
- /**
- * @description 提示文字
- * @default '请按住滑块拖动'
- */
- text?: string;
-
- /**
- * @description 是否验证成功
- * @default false
- */
- value?: boolean;
-}
-
-export interface RotateProps extends VerifyProps {
- /**
- * @description 旋转的角度
- * @default 20
- */
- diffDegree?: number;
-
- /**
- * @description 图片的宽度
- * @default 260
- */
- imgWidth?: number;
-
- /**
- * @description 图片的样式
- * @default {}
- */
- imgWrapStyle?: CSSProperties;
-
- /**
- * @description 最大旋转角度
- * @default 270
- */
- maxDegree?: number;
-
- /**
- * @description 最小旋转角度
- * @default 90
- */
- minDegree?: number;
-
- /**
- * @description 图片的地址
- */
- src?: string;
-}
-
-export function defaultDragVerifyProps() {
- return {
- actionStyle: () => ({}),
- barStyle: () => ({}),
- circle: false,
- contentStyle: () => ({}),
- height: '40',
- isSlot: false,
- successText: '验证通过',
- text: '请按住滑块拖动',
- value: false,
- width: '220',
- wrapStyle: () => ({}),
- };
-}
-
-export function defaultRotateVerifyProps() {
- return {
- ...defaultDragVerifyProps(),
- diffDegree: 20,
- imgWidth: 260,
- imgWrapStyle: () => ({}),
- maxDegree: 270,
- minDegree: 90,
- src: '',
- };
-}
diff --git a/packages/effects/common-ui/src/components/verify/typing.ts b/packages/effects/common-ui/src/components/verify/typing.ts
deleted file mode 100644
index 42256968bef..00000000000
--- a/packages/effects/common-ui/src/components/verify/typing.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-export interface DragVerifyActionType {
- resume: () => void;
-}
-
-export interface VerifyPassingData {
- isPassing: boolean;
- time: number;
-}
-
-export interface VerifyMoveData {
- event: MouseEvent | TouchEvent;
- moveDistance: number;
- moveX: number;
-}
diff --git a/packages/locales/src/langs/en-US.json b/packages/locales/src/langs/en-US.json
index 338a6a81fcb..ae5e5b3c434 100644
--- a/packages/locales/src/langs/en-US.json
+++ b/packages/locales/src/langs/en-US.json
@@ -313,13 +313,20 @@
"lockScreen": "Enable Lock Screen"
}
},
- "captcha": {
- "alt": "Supports img tag src attribute value",
- "title": "Please complete the security verification",
- "refreshAriaLabel": "Refresh captcha",
- "confirmAriaLabel": "Confirm selection",
- "confirm": "Confirm",
- "pointAriaLabel": "Click point",
- "clickInOrder": "Please click in order"
+ "ui": {
+ "captcha": {
+ "title": "Please complete the security verification",
+ "sliderSuccessText": "Passed",
+ "sliderDefaultText": "Slider and drag",
+ "alt": "Supports img tag src attribute value",
+ "sliderRotateDefaultTip": "Click picture to refresh",
+ "sliderRotateFailTip": "Validation failed",
+ "sliderRotateSuccessTip": "Validation successful, time {0} seconds",
+ "refreshAriaLabel": "Refresh captcha",
+ "confirmAriaLabel": "Confirm selection",
+ "confirm": "Confirm",
+ "pointAriaLabel": "Click point",
+ "clickInOrder": "Please click in order"
+ }
}
}
diff --git a/packages/locales/src/langs/zh-CN.json b/packages/locales/src/langs/zh-CN.json
index 816170cdf82..8d4ac6a06fa 100644
--- a/packages/locales/src/langs/zh-CN.json
+++ b/packages/locales/src/langs/zh-CN.json
@@ -313,13 +313,20 @@
"lockScreen": "启用锁屏"
}
},
- "captcha": {
- "alt": "支持img标签src属性值",
- "title": "请完成安全验证",
- "refreshAriaLabel": "刷新验证码",
- "confirmAriaLabel": "确认选择",
- "confirm": "确认",
- "pointAriaLabel": "点击点",
- "clickInOrder": "请依次点击"
+ "ui": {
+ "captcha": {
+ "title": "请完成安全验证",
+ "sliderSuccessText": "验证通过",
+ "sliderDefaultText": "请按住滑块拖动",
+ "sliderRotateDefaultTip": "点击图片可刷新",
+ "sliderRotateFailTip": "验证失败",
+ "sliderRotateSuccessTip": "验证成功,耗时{0}秒",
+ "alt": "支持img标签src属性值",
+ "refreshAriaLabel": "刷新验证码",
+ "confirmAriaLabel": "确认选择",
+ "confirm": "确认",
+ "pointAriaLabel": "点击点",
+ "clickInOrder": "请依次点击"
+ }
}
}
diff --git a/playground/src/locales/langs/en-US.json b/playground/src/locales/langs/en-US.json
index a128204dc4b..9e926ca89b7 100644
--- a/playground/src/locales/langs/en-US.json
+++ b/playground/src/locales/langs/en-US.json
@@ -83,6 +83,9 @@
},
"captcha": {
"title": "Captcha",
+ "pointSelection": "Point Selection Captcha",
+ "sliderCaptcha": "Slider Captcha",
+ "sliderRotateCaptcha": "Rotate Captcha",
"captchaCardTitle": "Please complete the security verification",
"pageDescription": "Verify user identity by clicking on specific locations in the image.",
"pageTitle": "Captcha Component Example",
@@ -103,15 +106,6 @@
"timestamp": "Timestamp:",
"x": "x:",
"y": "y:"
- },
- "verify": {
- "title": "Verify",
- "drag-verify": {
- "title": "Drag Verify"
- },
- "rotate-verify": {
- "title": "Rotate Verify"
- }
}
}
}
diff --git a/playground/src/locales/langs/zh-CN.json b/playground/src/locales/langs/zh-CN.json
index 3edd99bd3d5..08a2c38f4a3 100644
--- a/playground/src/locales/langs/zh-CN.json
+++ b/playground/src/locales/langs/zh-CN.json
@@ -83,6 +83,9 @@
},
"captcha": {
"title": "验证码",
+ "pointSelection": "点选验证",
+ "sliderCaptcha": "滑块验证",
+ "sliderRotateCaptcha": "旋转验证",
"captchaCardTitle": "请完成安全验证",
"pageDescription": "通过点击图片中的特定位置来验证用户身份。",
"pageTitle": "验证码组件示例",
@@ -103,15 +106,6 @@
"timestamp": "时间戳:",
"x": "x:",
"y": "y:"
- },
- "verify": {
- "title": "验证组件",
- "drag-verify": {
- "title": "拖动验证"
- },
- "rotate-verify": {
- "title": "旋转校验"
- }
}
}
}
diff --git a/playground/src/router/routes/modules/examples.ts b/playground/src/router/routes/modules/examples.ts
index 5286d75ae6f..954c1154c34 100644
--- a/playground/src/router/routes/modules/examples.ts
+++ b/playground/src/router/routes/modules/examples.ts
@@ -42,15 +42,7 @@ const routes: RouteRecordRaw[] = [
title: $t('page.examples.ellipsis.title'),
},
},
- {
- name: 'CaptchaExample',
- path: '/examples/captcha',
- component: () => import('#/views/examples/captcha/index.vue'),
- meta: {
- icon: 'logos:recaptcha',
- title: $t('page.examples.captcha.title'),
- },
- },
+
{
name: 'FormExample',
path: '/examples/form',
@@ -110,29 +102,38 @@ const routes: RouteRecordRaw[] = [
],
},
{
- name: 'VerifyExample',
- path: '/examples/verify',
+ name: 'CaptchaExample',
+ path: '/examples/captcha',
meta: {
- icon: 'arcticons:okta-verify',
- title: $t('page.examples.verify.title'),
+ icon: 'logos:recaptcha',
+ title: $t('page.examples.captcha.title'),
},
children: [
{
name: 'DragVerifyExample',
- path: '/examples/verify/drag-verify',
+ path: '/examples/captcha/slider',
component: () =>
- import('#/views/examples/verify/drag-verify/index.vue'),
+ import('#/views/examples/captcha/slider-captcha.vue'),
meta: {
- title: $t('page.examples.verify.drag-verify.title'),
+ title: $t('page.examples.captcha.sliderCaptcha'),
},
},
{
name: 'RotateVerifyExample',
- path: '/examples/verify/rotate-verify',
+ path: '/examples/captcha/slider-rotate',
+ component: () =>
+ import('#/views/examples/captcha/slider-rotate-captcha.vue'),
+ meta: {
+ title: $t('page.examples.captcha.sliderRotateCaptcha'),
+ },
+ },
+ {
+ name: 'CaptchaPointSelectionExample',
+ path: '/examples/captcha/point-selection',
component: () =>
- import('#/views/examples/verify/rotate-verify/index.vue'),
+ import('#/views/examples/captcha/point-selection-captcha.vue'),
meta: {
- title: $t('page.examples.verify.rotate-verify.title'),
+ title: $t('page.examples.captcha.pointSelection'),
},
},
],
diff --git a/playground/src/views/examples/captcha/index.vue b/playground/src/views/examples/captcha/point-selection-captcha.vue
similarity index 98%
rename from playground/src/views/examples/captcha/index.vue
rename to playground/src/views/examples/captcha/point-selection-captcha.vue
index 483154698e0..4a247c4b2b6 100644
--- a/playground/src/views/examples/captcha/index.vue
+++ b/playground/src/views/examples/captcha/point-selection-captcha.vue
@@ -9,7 +9,7 @@ import { Card, Input, InputNumber, message, Switch } from 'ant-design-vue';
import { $t } from '#/locales';
-const DEFAULT_CAPATCHA_IMAGE =
+const DEFAULT_CAPTCHA_IMAGE =
'https://unpkg.com/@vbenjs/static-source@0.1.7/source/default-captcha-image.jpeg';
const DEFAULT_HINT_IMAGE =
@@ -18,7 +18,7 @@ const DEFAULT_HINT_IMAGE =
const selectedPoints = ref
([]);
const params = reactive({
captchaImage: '',
- captchaImageUrl: DEFAULT_CAPATCHA_IMAGE,
+ captchaImageUrl: DEFAULT_CAPTCHA_IMAGE,
height: undefined,
hintImage: '',
hintImageUrl: DEFAULT_HINT_IMAGE,
diff --git a/playground/src/views/examples/captcha/slider-captcha.vue b/playground/src/views/examples/captcha/slider-captcha.vue
new file mode 100644
index 00000000000..e6b4c99fd54
--- /dev/null
+++ b/playground/src/views/examples/captcha/slider-captcha.vue
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 成功
+
+
+ 拖动
+
+
+
+
+
+
+
+
+
diff --git a/playground/src/views/examples/verify/rotate-verify/index.vue b/playground/src/views/examples/captcha/slider-rotate-captcha.vue
similarity index 50%
rename from playground/src/views/examples/verify/rotate-verify/index.vue
rename to playground/src/views/examples/captcha/slider-rotate-captcha.vue
index 12a7f9d4067..23775774192 100644
--- a/playground/src/views/examples/verify/rotate-verify/index.vue
+++ b/playground/src/views/examples/captcha/slider-rotate-captcha.vue
@@ -1,8 +1,7 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/playground/src/views/examples/verify/drag-verify/index.vue b/playground/src/views/examples/verify/drag-verify/index.vue
deleted file mode 100644
index 218005972c6..00000000000
--- a/playground/src/views/examples/verify/drag-verify/index.vue
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 成功
-
-
- 拖动
-
-
-
-
-
-
-
-
-
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 8d42d949646..8fd7f75e381 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1448,6 +1448,9 @@ importers:
'@vben-core/shadcn-ui':
specifier: workspace:*
version: link:../../@core/ui-kit/shadcn-ui
+ '@vben-core/shared':
+ specifier: workspace:*
+ version: link:../../@core/base/shared
'@vben/constants':
specifier: workspace:*
version: link:../../constants