@smallwei/avue 3.9.2 → 3.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -2
- package/dist/avue.js +14252 -5548
- package/dist/avue.js.map +1 -1
- package/dist/avue.min.js +2 -2
- package/dist/index.css +1 -1
- package/es/_virtual/_commonjs-dynamic-modules.mjs +1 -1
- package/es/_virtual/_commonjsHelpers.mjs +1 -1
- package/es/_virtual/axios.mjs +1 -1
- package/es/_virtual/axios2.mjs +1 -1
- package/es/_virtual/countUp.min.mjs +1 -1
- package/es/_virtual/countUp.min2.mjs +1 -1
- package/es/_virtual/dayjs.min.mjs +1 -1
- package/es/_virtual/dayjs.min2.mjs +1 -1
- package/es/index.css +1 -1
- package/es/locale/browser/en.mjs +299 -289
- package/es/locale/browser/zh-cn.mjs +299 -289
- package/es/locale/browser/zh.mjs +299 -289
- package/es/node_modules/.pnpm/countup.js@1.9.3/node_modules/countup.js/dist/countUp.min.mjs +1 -1
- package/es/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.mjs +1 -1
- package/es/node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs +2235 -0
- package/es/node_modules/axios/dist/axios.mjs +1 -1
- package/es/packages/core/common/event.mjs +1 -1
- package/es/packages/core/common/init.mjs +88 -13
- package/es/packages/core/common/props.mjs +1 -1
- package/es/packages/core/components/dialog-form/index.mjs +1 -1
- package/es/packages/core/components/dialog-form/index2.mjs +1 -1
- package/es/packages/core/components/dialog-form/index3.mjs +1 -1
- package/es/packages/core/components/dialog-form/index4.mjs +1 -1
- package/es/packages/core/components/form/custom.mjs +1 -1
- package/es/packages/core/components/form/index.mjs +1 -1
- package/es/packages/core/components/form/index2.mjs +1 -1
- package/es/packages/core/components/form/index3.mjs +1 -1
- package/es/packages/core/components/icon/index.mjs +1 -1
- package/es/packages/core/components/icon/index2.mjs +22 -1
- package/es/packages/core/components/icon/index3.mjs +19 -17
- package/es/packages/core/components/image-preview/index.mjs +1 -1
- package/es/packages/core/components/image-preview/index2.mjs +1 -1
- package/es/packages/core/components/image-preview/index3.mjs +1 -1
- package/es/packages/core/components/image-preview/index4.mjs +1 -1
- package/es/packages/core/directive/contextmenu.mjs +230 -89
- package/es/packages/core/directive/permission.mjs +1 -1
- package/es/packages/data/box/index.mjs +1 -1
- package/es/packages/data/box/index2.mjs +1 -1
- package/es/packages/data/box/index3.mjs +1 -1
- package/es/packages/data/card/index.mjs +1 -1
- package/es/packages/data/card/index2.mjs +1 -1
- package/es/packages/data/card/index3.mjs +1 -1
- package/es/packages/data/cardText/index.mjs +1 -1
- package/es/packages/data/cardText/index2.mjs +1 -1
- package/es/packages/data/cardText/index3.mjs +1 -1
- package/es/packages/data/countdown/index.mjs +1 -1
- package/es/packages/data/countdown/index2.mjs +1 -1
- package/es/packages/data/countdown/index3.mjs +1 -1
- package/es/packages/data/dashboard/index.mjs +1 -1
- package/es/packages/data/dashboard/index2.mjs +1 -1
- package/es/packages/data/dashboard/index3.mjs +1 -1
- package/es/packages/data/display/index.mjs +1 -1
- package/es/packages/data/display/index2.mjs +1 -1
- package/es/packages/data/display/index3.mjs +1 -1
- package/es/packages/data/icons/index.mjs +1 -1
- package/es/packages/data/icons/index2.mjs +1 -1
- package/es/packages/data/icons/index3.mjs +1 -1
- package/es/packages/data/imgText/index.mjs +1 -1
- package/es/packages/data/imgText/index2.mjs +1 -1
- package/es/packages/data/imgText/index3.mjs +1 -1
- package/es/packages/data/list/index.mjs +1 -1
- package/es/packages/data/list/index2.mjs +6 -1
- package/es/packages/data/list/index3.mjs +9 -6
- package/es/packages/data/notice/index.mjs +1 -1
- package/es/packages/data/notice/index2.mjs +1 -1
- package/es/packages/data/notice/index3.mjs +1 -1
- package/es/packages/data/operaText/index.mjs +1 -1
- package/es/packages/data/operaText/index2.mjs +1 -1
- package/es/packages/data/operaText/index3.mjs +1 -1
- package/es/packages/data/panel/index.mjs +1 -1
- package/es/packages/data/panel/index2.mjs +1 -1
- package/es/packages/data/panel/index3.mjs +1 -1
- package/es/packages/data/pay/index.mjs +1 -1
- package/es/packages/data/pay/index2.mjs +1 -1
- package/es/packages/data/pay/index3.mjs +1 -1
- package/es/packages/data/price/index.mjs +1 -1
- package/es/packages/data/price/index2.mjs +1 -1
- package/es/packages/data/price/index3.mjs +1 -1
- package/es/packages/data/product/index.mjs +1 -1
- package/es/packages/data/product/index2.mjs +1 -1
- package/es/packages/data/product/index3.mjs +1 -1
- package/es/packages/data/profile/index.mjs +1 -1
- package/es/packages/data/profile/index2.mjs +1 -1
- package/es/packages/data/profile/index3.mjs +1 -1
- package/es/packages/data/progress/index.mjs +1 -1
- package/es/packages/data/progress/index2.mjs +1 -1
- package/es/packages/data/progress/index3.mjs +1 -1
- package/es/packages/data/rank/index.mjs +1 -1
- package/es/packages/data/rank/index2.mjs +1 -1
- package/es/packages/data/rank/index3.mjs +1 -1
- package/es/packages/data/rotate/index.mjs +1 -1
- package/es/packages/data/rotate/index2.mjs +1 -1
- package/es/packages/data/rotate/index3.mjs +1 -1
- package/es/packages/data/statistic/index.mjs +1 -1
- package/es/packages/data/statistic/index2.mjs +15 -1
- package/es/packages/data/statistic/index3.mjs +9 -6
- package/es/packages/data/tabs/index.mjs +1 -1
- package/es/packages/data/tabs/index2.mjs +1 -1
- package/es/packages/data/tabs/index3.mjs +1 -1
- package/es/packages/data/task/index.mjs +1 -1
- package/es/packages/data/task/index2.mjs +1 -1
- package/es/packages/data/task/index3.mjs +1 -1
- package/es/packages/data/weather/index.mjs +1 -1
- package/es/packages/data/weather/index2.mjs +6 -1
- package/es/packages/data/weather/index3.mjs +7 -6
- package/es/packages/element-plus/array/index.mjs +1 -1
- package/es/packages/element-plus/array/index2.mjs +1 -1
- package/es/packages/element-plus/array/index3.mjs +1 -1
- package/es/packages/element-plus/article/index.mjs +1 -1
- package/es/packages/element-plus/article/index2.mjs +185 -20
- package/es/packages/element-plus/article/index3.mjs +98 -36
- package/es/packages/element-plus/captcha/index.mjs +8 -0
- package/es/packages/element-plus/captcha/index2.mjs +913 -0
- package/es/packages/element-plus/captcha/index3.mjs +519 -0
- package/es/packages/element-plus/cascader/index.mjs +1 -1
- package/es/packages/element-plus/cascader/index2.mjs +1 -1
- package/es/packages/element-plus/cascader/index3.mjs +1 -1
- package/es/packages/element-plus/chat/index.mjs +1 -1
- package/es/packages/element-plus/chat/index2.mjs +249 -203
- package/es/packages/element-plus/chat/index3.mjs +340 -264
- package/es/packages/element-plus/checkbox/index.mjs +1 -1
- package/es/packages/element-plus/checkbox/index2.mjs +1 -1
- package/es/packages/element-plus/checkbox/index3.mjs +1 -1
- package/es/packages/element-plus/comment/index.mjs +1 -1
- package/es/packages/element-plus/comment/index2.mjs +105 -32
- package/es/packages/element-plus/comment/index3.mjs +61 -22
- package/es/packages/element-plus/count-up/index.mjs +1 -1
- package/es/packages/element-plus/count-up/index2.mjs +1 -1
- package/es/packages/element-plus/count-up/index3.mjs +1 -1
- package/es/packages/element-plus/crud/column/column-default.mjs +1 -1
- package/es/packages/element-plus/crud/column/column-default2.mjs +1 -1
- package/es/packages/element-plus/crud/column/column-default3.mjs +1 -1
- package/es/packages/element-plus/crud/column/column-dynamic.mjs +1 -1
- package/es/packages/element-plus/crud/column/column-dynamic2.mjs +1 -1
- package/es/packages/element-plus/crud/column/column-dynamic3.mjs +1 -1
- package/es/packages/element-plus/crud/column/column-menu.mjs +1 -1
- package/es/packages/element-plus/crud/column/column-menu2.mjs +1 -1
- package/es/packages/element-plus/crud/column/column-menu3.mjs +1 -1
- package/es/packages/element-plus/crud/column/column-slot.mjs +1 -1
- package/es/packages/element-plus/crud/column/column-slot2.mjs +4 -4
- package/es/packages/element-plus/crud/column/column-slot3.mjs +1 -1
- package/es/packages/element-plus/crud/column/column.mjs +1 -1
- package/es/packages/element-plus/crud/column/column2.mjs +1 -1
- package/es/packages/element-plus/crud/column/column3.mjs +1 -1
- package/es/packages/element-plus/crud/column/menu.mjs +1 -1
- package/es/packages/element-plus/crud/column/menu2.mjs +1 -1
- package/es/packages/element-plus/crud/column/menu3.mjs +1 -1
- package/es/packages/element-plus/crud/config.mjs +1 -1
- package/es/packages/element-plus/crud/dialog/dialog-column.mjs +1 -1
- package/es/packages/element-plus/crud/dialog/dialog-column2.mjs +118 -40
- package/es/packages/element-plus/crud/dialog/dialog-column3.mjs +154 -72
- package/es/packages/element-plus/crud/dialog/dialog-excel.mjs +1 -1
- package/es/packages/element-plus/crud/dialog/dialog-excel2.mjs +2 -2
- package/es/packages/element-plus/crud/dialog/dialog-excel3.mjs +1 -1
- package/es/packages/element-plus/crud/dialog/dialog-filter.mjs +1 -1
- package/es/packages/element-plus/crud/dialog/dialog-filter2.mjs +1 -1
- package/es/packages/element-plus/crud/dialog/dialog-filter3.mjs +1 -1
- package/es/packages/element-plus/crud/dialog/dialog-form.mjs +1 -1
- package/es/packages/element-plus/crud/dialog/dialog-form2.mjs +1 -1
- package/es/packages/element-plus/crud/dialog/dialog-form3.mjs +1 -1
- package/es/packages/element-plus/crud/grid/index.mjs +1 -1
- package/es/packages/element-plus/crud/grid/index2.mjs +1 -1
- package/es/packages/element-plus/crud/grid/index3.mjs +1 -1
- package/es/packages/element-plus/crud/grid/item.mjs +1 -1
- package/es/packages/element-plus/crud/grid/item2.mjs +1 -1
- package/es/packages/element-plus/crud/grid/item3.mjs +1 -1
- package/es/packages/element-plus/crud/index.mjs +1 -1
- package/es/packages/element-plus/crud/index2.mjs +6 -3
- package/es/packages/element-plus/crud/index3.mjs +51 -20
- package/es/packages/element-plus/crud/menu/header-menu.mjs +1 -1
- package/es/packages/element-plus/crud/menu/header-menu2.mjs +14 -2
- package/es/packages/element-plus/crud/menu/header-menu3.mjs +123 -63
- package/es/packages/element-plus/crud/menu/header-search.mjs +1 -1
- package/es/packages/element-plus/crud/menu/header-search2.mjs +2 -1
- package/es/packages/element-plus/crud/menu/header-search3.mjs +1 -1
- package/es/packages/element-plus/crud/menu/table-page.mjs +1 -1
- package/es/packages/element-plus/crud/menu/table-page2.mjs +1 -1
- package/es/packages/element-plus/crud/menu/table-page3.mjs +1 -1
- package/es/packages/element-plus/date/index.mjs +1 -1
- package/es/packages/element-plus/date/index2.mjs +1 -1
- package/es/packages/element-plus/date/index3.mjs +1 -1
- package/es/packages/element-plus/draggable/index.mjs +1 -1
- package/es/packages/element-plus/draggable/index2.mjs +342 -294
- package/es/packages/element-plus/draggable/index3.mjs +37 -39
- package/es/packages/element-plus/dynamic/index.mjs +1 -1
- package/es/packages/element-plus/dynamic/index2.mjs +1 -1
- package/es/packages/element-plus/dynamic/index3.mjs +1 -1
- package/es/packages/element-plus/file-manager/index.mjs +8 -0
- package/es/packages/element-plus/file-manager/index2.mjs +574 -0
- package/es/packages/element-plus/file-manager/index3.mjs +814 -0
- package/es/packages/element-plus/filter-builder/index.mjs +8 -0
- package/es/packages/element-plus/filter-builder/index2.mjs +208 -0
- package/es/packages/element-plus/filter-builder/index3.mjs +290 -0
- package/es/packages/element-plus/flow/index.mjs +1 -1
- package/es/packages/element-plus/flow/index2.mjs +274 -232
- package/es/packages/element-plus/flow/index3.mjs +30 -19
- package/es/packages/element-plus/flow/node.mjs +1 -1
- package/es/packages/element-plus/flow/node2.mjs +23 -37
- package/es/packages/element-plus/flow/node3.mjs +20 -17
- package/es/packages/element-plus/form/config.mjs +1 -1
- package/es/packages/element-plus/form/index.mjs +1 -1
- package/es/packages/element-plus/form/index2.mjs +11 -8
- package/es/packages/element-plus/form/index3.mjs +20 -7
- package/es/packages/element-plus/form/menu.mjs +1 -1
- package/es/packages/element-plus/form/menu2.mjs +1 -1
- package/es/packages/element-plus/form/menu3.mjs +1 -1
- package/es/packages/element-plus/group/index.mjs +1 -1
- package/es/packages/element-plus/group/index2.mjs +6 -1
- package/es/packages/element-plus/group/index3.mjs +8 -5
- package/es/packages/element-plus/{card → iframe}/index.mjs +2 -2
- package/es/packages/element-plus/iframe/index2.mjs +190 -0
- package/es/packages/element-plus/iframe/index3.mjs +64 -0
- package/es/packages/element-plus/input/index.mjs +1 -1
- package/es/packages/element-plus/input/index2.mjs +1 -1
- package/es/packages/element-plus/input/index3.mjs +1 -1
- package/es/packages/element-plus/input-color/index.mjs +1 -1
- package/es/packages/element-plus/input-color/index2.mjs +1 -1
- package/es/packages/element-plus/input-color/index3.mjs +1 -1
- package/es/packages/element-plus/input-cron/index.mjs +1 -1
- package/es/packages/element-plus/input-cron/index2.mjs +7 -2
- package/es/packages/element-plus/input-cron/index3.mjs +8 -4
- package/es/packages/element-plus/input-icon/index.mjs +1 -1
- package/es/packages/element-plus/input-icon/index2.mjs +1 -1
- package/es/packages/element-plus/input-icon/index3.mjs +1 -1
- package/es/packages/element-plus/input-map/index.mjs +1 -1
- package/es/packages/element-plus/input-map/index2.mjs +1 -1
- package/es/packages/element-plus/input-map/index3.mjs +1 -1
- package/es/packages/element-plus/input-number/index.mjs +1 -1
- package/es/packages/element-plus/input-number/index2.mjs +1 -1
- package/es/packages/element-plus/input-number/index3.mjs +1 -1
- package/es/packages/element-plus/input-otp/index.mjs +8 -0
- package/es/packages/element-plus/input-otp/index2.mjs +67 -0
- package/es/packages/element-plus/input-otp/index3.mjs +41 -0
- package/es/packages/element-plus/input-table/index.mjs +1 -1
- package/es/packages/element-plus/input-table/index2.mjs +1 -1
- package/es/packages/element-plus/input-table/index3.mjs +1 -1
- package/es/packages/element-plus/input-tag/index.mjs +1 -1
- package/es/packages/element-plus/input-tag/index2.mjs +1 -1
- package/es/packages/element-plus/input-tag/index3.mjs +1 -1
- package/es/packages/element-plus/input-tree/index.mjs +1 -1
- package/es/packages/element-plus/input-tree/index2.mjs +1 -1
- package/es/packages/element-plus/input-tree/index3.mjs +1 -1
- package/es/packages/element-plus/license/index.mjs +1 -1
- package/es/packages/element-plus/license/index2.mjs +216 -106
- package/es/packages/element-plus/license/index3.mjs +45 -10
- package/es/packages/element-plus/login/index.mjs +1 -1
- package/es/packages/element-plus/login/index2.mjs +76 -50
- package/es/packages/element-plus/login/index3.mjs +57 -46
- package/es/packages/element-plus/mention/index.mjs +1 -1
- package/es/packages/element-plus/mention/index2.mjs +32 -8
- package/es/packages/element-plus/mention/index3.mjs +1 -1
- package/es/packages/element-plus/{verify → qrcode}/index.mjs +2 -2
- package/es/packages/element-plus/qrcode/index2.mjs +274 -0
- package/es/packages/element-plus/qrcode/index3.mjs +57 -0
- package/es/packages/element-plus/radio/index.mjs +1 -1
- package/es/packages/element-plus/radio/index2.mjs +1 -1
- package/es/packages/element-plus/radio/index3.mjs +1 -1
- package/es/packages/element-plus/rate/index.mjs +1 -1
- package/es/packages/element-plus/rate/index2.mjs +1 -1
- package/es/packages/element-plus/rate/index3.mjs +1 -1
- package/es/packages/element-plus/search/index.mjs +1 -1
- package/es/packages/element-plus/search/index2.mjs +1 -1
- package/es/packages/element-plus/search/index3.mjs +1 -1
- package/es/packages/element-plus/select/index.mjs +1 -1
- package/es/packages/element-plus/select/index2.mjs +31 -6
- package/es/packages/element-plus/select/index3.mjs +1 -1
- package/es/packages/element-plus/sign/index.mjs +1 -1
- package/es/packages/element-plus/sign/index2.mjs +266 -183
- package/es/packages/element-plus/sign/index3.mjs +71 -11
- package/es/packages/element-plus/slider/index.mjs +1 -1
- package/es/packages/element-plus/slider/index2.mjs +1 -1
- package/es/packages/element-plus/slider/index3.mjs +1 -1
- package/es/packages/element-plus/switch/index.mjs +1 -1
- package/es/packages/element-plus/switch/index2.mjs +1 -1
- package/es/packages/element-plus/switch/index3.mjs +1 -1
- package/es/packages/element-plus/tabs/index.mjs +1 -1
- package/es/packages/element-plus/tabs/index2.mjs +6 -1
- package/es/packages/element-plus/tabs/index3.mjs +23 -8
- package/es/packages/element-plus/text-ellipsis/index.mjs +1 -1
- package/es/packages/element-plus/text-ellipsis/index2.mjs +1 -1
- package/es/packages/element-plus/text-ellipsis/index3.mjs +1 -1
- package/es/packages/element-plus/time/index.mjs +1 -1
- package/es/packages/element-plus/time/index2.mjs +1 -1
- package/es/packages/element-plus/time/index3.mjs +1 -1
- package/es/packages/element-plus/title/index.mjs +1 -1
- package/es/packages/element-plus/title/index2.mjs +1 -1
- package/es/packages/element-plus/title/index3.mjs +1 -1
- package/es/packages/element-plus/tree/index.mjs +1 -1
- package/es/packages/element-plus/tree/index2.mjs +1 -1
- package/es/packages/element-plus/tree/index3.mjs +1 -1
- package/es/packages/element-plus/upload/index.mjs +1 -1
- package/es/packages/element-plus/upload/index2.mjs +1 -1
- package/es/packages/element-plus/upload/index3.mjs +1 -1
- package/es/packages/element-plus/video/index.mjs +1 -1
- package/es/packages/element-plus/video/index2.mjs +183 -32
- package/es/packages/element-plus/video/index3.mjs +65 -29
- package/es/src/core/column-state.mjs +1 -1
- package/es/src/core/create.mjs +1 -1
- package/es/src/core/dataformat.mjs +1 -1
- package/es/src/core/detail.mjs +1 -1
- package/es/src/core/dic.mjs +108 -136
- package/es/src/core/locale.mjs +1 -1
- package/es/src/core/option.mjs +3 -1
- package/es/src/core/packages.mjs +4 -4
- package/es/src/core/slot.mjs +1 -1
- package/es/src/global/variable.mjs +2 -2
- package/es/src/icon.mjs +1 -1
- package/es/src/index.mjs +13 -5
- package/es/src/locale/index.mjs +1 -1
- package/es/src/locale/lang/en.mjs +12 -2
- package/es/src/locale/lang/zh-cn.mjs +12 -2
- package/es/src/locale/lang/zh.mjs +12 -2
- package/es/src/plugin/ali/index.mjs +1 -1
- package/es/src/plugin/clipboard/index.mjs +42 -57
- package/es/src/plugin/export/_blob.mjs +1 -1
- package/es/src/plugin/export/_export2Excel.mjs +1 -1
- package/es/src/plugin/export/index.mjs +122 -67
- package/es/src/plugin/logs/index.mjs +1 -1
- package/es/src/plugin/print/index.mjs +205 -128
- package/es/src/plugin/qiniu/index.mjs +1 -1
- package/es/src/plugin/screenshot/index.mjs +26 -4
- package/es/src/plugin/video/index.mjs +117 -28
- package/es/src/plugin/watermark/index.mjs +58 -102
- package/es/src/plugin/watermark/watermark.mjs +123 -80
- package/es/src/ui/data/index.mjs +1 -1
- package/es/src/ui/element-plus/index.mjs +100 -88
- package/es/src/ui/index.mjs +1 -1
- package/es/src/utils/bem.mjs +1 -1
- package/es/src/utils/mock.mjs +1 -1
- package/es/src/utils/print.mjs +216 -0
- package/es/src/utils/util.mjs +1 -1
- package/es/src/utils/validate.mjs +1 -1
- package/es/src/version.mjs +2 -2
- package/lib/_virtual/_commonjsHelpers.js +1 -1
- package/lib/_virtual/dayjs.min.js +1 -1
- package/lib/_virtual/dayjs.min2.js +1 -1
- package/lib/index.css +1 -1
- package/lib/locale/browser/en.js +299 -289
- package/lib/locale/browser/zh-cn.js +299 -289
- package/lib/locale/browser/zh.js +299 -289
- package/lib/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js +1 -1
- package/lib/node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.js +2240 -0
- package/lib/packages/core/common/event.js +1 -1
- package/lib/packages/core/common/init.js +87 -12
- package/lib/packages/core/common/props.js +1 -1
- package/lib/packages/core/components/dialog-form/index.js +1 -1
- package/lib/packages/core/components/dialog-form/index2.js +1 -1
- package/lib/packages/core/components/dialog-form/index3.js +1 -1
- package/lib/packages/core/components/dialog-form/index4.js +1 -1
- package/lib/packages/core/components/form/custom.js +1 -1
- package/lib/packages/core/components/form/index.js +1 -1
- package/lib/packages/core/components/form/index2.js +1 -1
- package/lib/packages/core/components/form/index3.js +1 -1
- package/lib/packages/core/components/icon/index.js +1 -1
- package/lib/packages/core/components/icon/index2.js +22 -1
- package/lib/packages/core/components/icon/index3.js +18 -16
- package/lib/packages/core/components/image-preview/index.js +1 -1
- package/lib/packages/core/components/image-preview/index2.js +1 -1
- package/lib/packages/core/components/image-preview/index3.js +1 -1
- package/lib/packages/core/components/image-preview/index4.js +1 -1
- package/lib/packages/core/directive/contextmenu.js +230 -89
- package/lib/packages/core/directive/permission.js +1 -1
- package/lib/packages/data/box/index.js +1 -1
- package/lib/packages/data/box/index2.js +1 -1
- package/lib/packages/data/box/index3.js +1 -1
- package/lib/packages/data/card/index.js +1 -1
- package/lib/packages/data/card/index2.js +1 -1
- package/lib/packages/data/card/index3.js +1 -1
- package/lib/packages/data/cardText/index.js +1 -1
- package/lib/packages/data/cardText/index2.js +1 -1
- package/lib/packages/data/cardText/index3.js +1 -1
- package/lib/packages/data/countdown/index.js +1 -1
- package/lib/packages/data/countdown/index2.js +1 -1
- package/lib/packages/data/countdown/index3.js +1 -1
- package/lib/packages/data/dashboard/index.js +1 -1
- package/lib/packages/data/dashboard/index2.js +1 -1
- package/lib/packages/data/dashboard/index3.js +1 -1
- package/lib/packages/data/display/index.js +1 -1
- package/lib/packages/data/display/index2.js +1 -1
- package/lib/packages/data/display/index3.js +1 -1
- package/lib/packages/data/icons/index.js +1 -1
- package/lib/packages/data/icons/index2.js +1 -1
- package/lib/packages/data/icons/index3.js +1 -1
- package/lib/packages/data/imgText/index.js +1 -1
- package/lib/packages/data/imgText/index2.js +1 -1
- package/lib/packages/data/imgText/index3.js +1 -1
- package/lib/packages/data/list/index.js +1 -1
- package/lib/packages/data/list/index2.js +6 -1
- package/lib/packages/data/list/index3.js +8 -5
- package/lib/packages/data/notice/index.js +1 -1
- package/lib/packages/data/notice/index2.js +1 -1
- package/lib/packages/data/notice/index3.js +1 -1
- package/lib/packages/data/operaText/index.js +1 -1
- package/lib/packages/data/operaText/index2.js +1 -1
- package/lib/packages/data/operaText/index3.js +1 -1
- package/lib/packages/data/panel/index.js +1 -1
- package/lib/packages/data/panel/index2.js +1 -1
- package/lib/packages/data/panel/index3.js +1 -1
- package/lib/packages/data/pay/index.js +1 -1
- package/lib/packages/data/pay/index2.js +1 -1
- package/lib/packages/data/pay/index3.js +1 -1
- package/lib/packages/data/price/index.js +1 -1
- package/lib/packages/data/price/index2.js +1 -1
- package/lib/packages/data/price/index3.js +1 -1
- package/lib/packages/data/product/index.js +1 -1
- package/lib/packages/data/product/index2.js +1 -1
- package/lib/packages/data/product/index3.js +1 -1
- package/lib/packages/data/profile/index.js +1 -1
- package/lib/packages/data/profile/index2.js +1 -1
- package/lib/packages/data/profile/index3.js +1 -1
- package/lib/packages/data/progress/index.js +1 -1
- package/lib/packages/data/progress/index2.js +1 -1
- package/lib/packages/data/progress/index3.js +1 -1
- package/lib/packages/data/rank/index.js +1 -1
- package/lib/packages/data/rank/index2.js +1 -1
- package/lib/packages/data/rank/index3.js +1 -1
- package/lib/packages/data/rotate/index.js +1 -1
- package/lib/packages/data/rotate/index2.js +1 -1
- package/lib/packages/data/rotate/index3.js +1 -1
- package/lib/packages/data/statistic/index.js +1 -1
- package/lib/packages/data/statistic/index2.js +15 -1
- package/lib/packages/data/statistic/index3.js +8 -5
- package/lib/packages/data/tabs/index.js +1 -1
- package/lib/packages/data/tabs/index2.js +1 -1
- package/lib/packages/data/tabs/index3.js +1 -1
- package/lib/packages/data/task/index.js +1 -1
- package/lib/packages/data/task/index2.js +1 -1
- package/lib/packages/data/task/index3.js +1 -1
- package/lib/packages/data/weather/index.js +1 -1
- package/lib/packages/data/weather/index2.js +6 -1
- package/lib/packages/data/weather/index3.js +6 -5
- package/lib/packages/element-plus/array/index.js +1 -1
- package/lib/packages/element-plus/array/index2.js +1 -1
- package/lib/packages/element-plus/array/index3.js +1 -1
- package/lib/packages/element-plus/article/index.js +1 -1
- package/lib/packages/element-plus/article/index2.js +185 -20
- package/lib/packages/element-plus/article/index3.js +97 -35
- package/lib/packages/element-plus/captcha/index.js +12 -0
- package/lib/packages/element-plus/captcha/index2.js +917 -0
- package/lib/packages/element-plus/captcha/index3.js +521 -0
- package/lib/packages/element-plus/cascader/index.js +1 -1
- package/lib/packages/element-plus/cascader/index2.js +1 -1
- package/lib/packages/element-plus/cascader/index3.js +1 -1
- package/lib/packages/element-plus/chat/index.js +1 -1
- package/lib/packages/element-plus/chat/index2.js +249 -203
- package/lib/packages/element-plus/chat/index3.js +339 -263
- package/lib/packages/element-plus/checkbox/index.js +1 -1
- package/lib/packages/element-plus/checkbox/index2.js +1 -1
- package/lib/packages/element-plus/checkbox/index3.js +1 -1
- package/lib/packages/element-plus/comment/index.js +1 -1
- package/lib/packages/element-plus/comment/index2.js +105 -32
- package/lib/packages/element-plus/comment/index3.js +60 -21
- package/lib/packages/element-plus/count-up/index.js +1 -1
- package/lib/packages/element-plus/count-up/index2.js +1 -1
- package/lib/packages/element-plus/count-up/index3.js +1 -1
- package/lib/packages/element-plus/crud/column/column-default.js +1 -1
- package/lib/packages/element-plus/crud/column/column-default2.js +1 -1
- package/lib/packages/element-plus/crud/column/column-default3.js +1 -1
- package/lib/packages/element-plus/crud/column/column-dynamic.js +1 -1
- package/lib/packages/element-plus/crud/column/column-dynamic2.js +1 -1
- package/lib/packages/element-plus/crud/column/column-dynamic3.js +1 -1
- package/lib/packages/element-plus/crud/column/column-menu.js +1 -1
- package/lib/packages/element-plus/crud/column/column-menu2.js +1 -1
- package/lib/packages/element-plus/crud/column/column-menu3.js +1 -1
- package/lib/packages/element-plus/crud/column/column-slot.js +1 -1
- package/lib/packages/element-plus/crud/column/column-slot2.js +4 -4
- package/lib/packages/element-plus/crud/column/column-slot3.js +1 -1
- package/lib/packages/element-plus/crud/column/column.js +1 -1
- package/lib/packages/element-plus/crud/column/column2.js +1 -1
- package/lib/packages/element-plus/crud/column/column3.js +1 -1
- package/lib/packages/element-plus/crud/column/menu.js +1 -1
- package/lib/packages/element-plus/crud/column/menu2.js +1 -1
- package/lib/packages/element-plus/crud/column/menu3.js +1 -1
- package/lib/packages/element-plus/crud/config.js +1 -1
- package/lib/packages/element-plus/crud/dialog/dialog-column.js +1 -1
- package/lib/packages/element-plus/crud/dialog/dialog-column2.js +118 -40
- package/lib/packages/element-plus/crud/dialog/dialog-column3.js +153 -71
- package/lib/packages/element-plus/crud/dialog/dialog-excel.js +1 -1
- package/lib/packages/element-plus/crud/dialog/dialog-excel2.js +2 -2
- package/lib/packages/element-plus/crud/dialog/dialog-excel3.js +1 -1
- package/lib/packages/element-plus/crud/dialog/dialog-filter.js +1 -1
- package/lib/packages/element-plus/crud/dialog/dialog-filter2.js +1 -1
- package/lib/packages/element-plus/crud/dialog/dialog-filter3.js +1 -1
- package/lib/packages/element-plus/crud/dialog/dialog-form.js +1 -1
- package/lib/packages/element-plus/crud/dialog/dialog-form2.js +1 -1
- package/lib/packages/element-plus/crud/dialog/dialog-form3.js +1 -1
- package/lib/packages/element-plus/crud/grid/index.js +1 -1
- package/lib/packages/element-plus/crud/grid/index2.js +1 -1
- package/lib/packages/element-plus/crud/grid/index3.js +1 -1
- package/lib/packages/element-plus/crud/grid/item.js +1 -1
- package/lib/packages/element-plus/crud/grid/item2.js +1 -1
- package/lib/packages/element-plus/crud/grid/item3.js +1 -1
- package/lib/packages/element-plus/crud/index.js +1 -1
- package/lib/packages/element-plus/crud/index2.js +6 -3
- package/lib/packages/element-plus/crud/index3.js +51 -20
- package/lib/packages/element-plus/crud/menu/header-menu.js +1 -1
- package/lib/packages/element-plus/crud/menu/header-menu2.js +14 -2
- package/lib/packages/element-plus/crud/menu/header-menu3.js +122 -62
- package/lib/packages/element-plus/crud/menu/header-search.js +1 -1
- package/lib/packages/element-plus/crud/menu/header-search2.js +2 -1
- package/lib/packages/element-plus/crud/menu/header-search3.js +1 -1
- package/lib/packages/element-plus/crud/menu/table-page.js +1 -1
- package/lib/packages/element-plus/crud/menu/table-page2.js +1 -1
- package/lib/packages/element-plus/crud/menu/table-page3.js +1 -1
- package/lib/packages/element-plus/date/index.js +1 -1
- package/lib/packages/element-plus/date/index2.js +1 -1
- package/lib/packages/element-plus/date/index3.js +1 -1
- package/lib/packages/element-plus/draggable/index.js +1 -1
- package/lib/packages/element-plus/draggable/index2.js +342 -294
- package/lib/packages/element-plus/draggable/index3.js +36 -38
- package/lib/packages/element-plus/dynamic/index.js +1 -1
- package/lib/packages/element-plus/dynamic/index2.js +1 -1
- package/lib/packages/element-plus/dynamic/index3.js +1 -1
- package/lib/packages/element-plus/file-manager/index.js +12 -0
- package/lib/packages/element-plus/file-manager/index2.js +578 -0
- package/lib/packages/element-plus/file-manager/index3.js +816 -0
- package/lib/packages/element-plus/filter-builder/index.js +12 -0
- package/lib/packages/element-plus/filter-builder/index2.js +212 -0
- package/lib/packages/element-plus/filter-builder/index3.js +292 -0
- package/lib/packages/element-plus/flow/index.js +1 -1
- package/lib/packages/element-plus/flow/index2.js +274 -232
- package/lib/packages/element-plus/flow/index3.js +29 -18
- package/lib/packages/element-plus/flow/node.js +1 -1
- package/lib/packages/element-plus/flow/node2.js +23 -37
- package/lib/packages/element-plus/flow/node3.js +19 -16
- package/lib/packages/element-plus/form/config.js +1 -1
- package/lib/packages/element-plus/form/index.js +1 -1
- package/lib/packages/element-plus/form/index2.js +9 -6
- package/lib/packages/element-plus/form/index3.js +20 -7
- package/lib/packages/element-plus/form/menu.js +1 -1
- package/lib/packages/element-plus/form/menu2.js +1 -1
- package/lib/packages/element-plus/form/menu3.js +1 -1
- package/lib/packages/element-plus/group/index.js +1 -1
- package/lib/packages/element-plus/group/index2.js +6 -1
- package/lib/packages/element-plus/group/index3.js +7 -4
- package/lib/packages/element-plus/{card → iframe}/index.js +4 -4
- package/lib/packages/element-plus/iframe/index2.js +194 -0
- package/lib/packages/element-plus/iframe/index3.js +66 -0
- package/lib/packages/element-plus/input/index.js +1 -1
- package/lib/packages/element-plus/input/index2.js +1 -1
- package/lib/packages/element-plus/input/index3.js +1 -1
- package/lib/packages/element-plus/input-color/index.js +1 -1
- package/lib/packages/element-plus/input-color/index2.js +1 -1
- package/lib/packages/element-plus/input-color/index3.js +1 -1
- package/lib/packages/element-plus/input-cron/index.js +1 -1
- package/lib/packages/element-plus/input-cron/index2.js +7 -2
- package/lib/packages/element-plus/input-cron/index3.js +8 -4
- package/lib/packages/element-plus/input-icon/index.js +1 -1
- package/lib/packages/element-plus/input-icon/index2.js +1 -1
- package/lib/packages/element-plus/input-icon/index3.js +1 -1
- package/lib/packages/element-plus/input-map/index.js +1 -1
- package/lib/packages/element-plus/input-map/index2.js +1 -1
- package/lib/packages/element-plus/input-map/index3.js +1 -1
- package/lib/packages/element-plus/input-number/index.js +1 -1
- package/lib/packages/element-plus/input-number/index2.js +1 -1
- package/lib/packages/element-plus/input-number/index3.js +1 -1
- package/lib/packages/element-plus/input-otp/index.js +12 -0
- package/lib/packages/element-plus/input-otp/index2.js +71 -0
- package/lib/packages/element-plus/input-otp/index3.js +43 -0
- package/lib/packages/element-plus/input-table/index.js +1 -1
- package/lib/packages/element-plus/input-table/index2.js +1 -1
- package/lib/packages/element-plus/input-table/index3.js +1 -1
- package/lib/packages/element-plus/input-tag/index.js +1 -1
- package/lib/packages/element-plus/input-tag/index2.js +1 -1
- package/lib/packages/element-plus/input-tag/index3.js +1 -1
- package/lib/packages/element-plus/input-tree/index.js +1 -1
- package/lib/packages/element-plus/input-tree/index2.js +1 -1
- package/lib/packages/element-plus/input-tree/index3.js +1 -1
- package/lib/packages/element-plus/license/index.js +1 -1
- package/lib/packages/element-plus/license/index2.js +216 -106
- package/lib/packages/element-plus/license/index3.js +44 -9
- package/lib/packages/element-plus/login/index.js +1 -1
- package/lib/packages/element-plus/login/index2.js +76 -50
- package/lib/packages/element-plus/login/index3.js +56 -45
- package/lib/packages/element-plus/mention/index.js +1 -1
- package/lib/packages/element-plus/mention/index2.js +32 -8
- package/lib/packages/element-plus/mention/index3.js +1 -1
- package/lib/packages/element-plus/{verify → qrcode}/index.js +4 -4
- package/lib/packages/element-plus/qrcode/index2.js +278 -0
- package/lib/packages/element-plus/qrcode/index3.js +59 -0
- package/lib/packages/element-plus/radio/index.js +1 -1
- package/lib/packages/element-plus/radio/index2.js +1 -1
- package/lib/packages/element-plus/radio/index3.js +1 -1
- package/lib/packages/element-plus/rate/index.js +1 -1
- package/lib/packages/element-plus/rate/index2.js +1 -1
- package/lib/packages/element-plus/rate/index3.js +1 -1
- package/lib/packages/element-plus/search/index.js +1 -1
- package/lib/packages/element-plus/search/index2.js +1 -1
- package/lib/packages/element-plus/search/index3.js +1 -1
- package/lib/packages/element-plus/select/index.js +1 -1
- package/lib/packages/element-plus/select/index2.js +31 -6
- package/lib/packages/element-plus/select/index3.js +1 -1
- package/lib/packages/element-plus/sign/index.js +1 -1
- package/lib/packages/element-plus/sign/index2.js +266 -183
- package/lib/packages/element-plus/sign/index3.js +70 -10
- package/lib/packages/element-plus/slider/index.js +1 -1
- package/lib/packages/element-plus/slider/index2.js +1 -1
- package/lib/packages/element-plus/slider/index3.js +1 -1
- package/lib/packages/element-plus/switch/index.js +1 -1
- package/lib/packages/element-plus/switch/index2.js +1 -1
- package/lib/packages/element-plus/switch/index3.js +1 -1
- package/lib/packages/element-plus/tabs/index.js +1 -1
- package/lib/packages/element-plus/tabs/index2.js +6 -1
- package/lib/packages/element-plus/tabs/index3.js +22 -7
- package/lib/packages/element-plus/text-ellipsis/index.js +1 -1
- package/lib/packages/element-plus/text-ellipsis/index2.js +1 -1
- package/lib/packages/element-plus/text-ellipsis/index3.js +1 -1
- package/lib/packages/element-plus/time/index.js +1 -1
- package/lib/packages/element-plus/time/index2.js +1 -1
- package/lib/packages/element-plus/time/index3.js +1 -1
- package/lib/packages/element-plus/title/index.js +1 -1
- package/lib/packages/element-plus/title/index2.js +1 -1
- package/lib/packages/element-plus/title/index3.js +1 -1
- package/lib/packages/element-plus/tree/index.js +1 -1
- package/lib/packages/element-plus/tree/index2.js +1 -1
- package/lib/packages/element-plus/tree/index3.js +1 -1
- package/lib/packages/element-plus/upload/index.js +1 -1
- package/lib/packages/element-plus/upload/index2.js +1 -1
- package/lib/packages/element-plus/upload/index3.js +1 -1
- package/lib/packages/element-plus/video/index.js +1 -1
- package/lib/packages/element-plus/video/index2.js +183 -32
- package/lib/packages/element-plus/video/index3.js +64 -28
- package/lib/src/core/column-state.js +1 -1
- package/lib/src/core/create.js +1 -1
- package/lib/src/core/dataformat.js +1 -1
- package/lib/src/core/detail.js +1 -1
- package/lib/src/core/dic.js +108 -136
- package/lib/src/core/locale.js +1 -1
- package/lib/src/core/option.js +3 -1
- package/lib/src/core/packages.js +4 -4
- package/lib/src/core/slot.js +1 -1
- package/lib/src/global/variable.js +2 -2
- package/lib/src/icon.js +1 -1
- package/lib/src/index.js +77 -65
- package/lib/src/locale/index.js +1 -1
- package/lib/src/locale/lang/en.js +12 -2
- package/lib/src/locale/lang/zh-cn.js +12 -2
- package/lib/src/locale/lang/zh.js +12 -2
- package/lib/src/plugin/ali/index.js +1 -1
- package/lib/src/plugin/clipboard/index.js +42 -57
- package/lib/src/plugin/export/_blob.js +1 -1
- package/lib/src/plugin/export/_export2Excel.js +1 -1
- package/lib/src/plugin/export/index.js +122 -67
- package/lib/src/plugin/logs/index.js +1 -1
- package/lib/src/plugin/print/index.js +205 -128
- package/lib/src/plugin/qiniu/index.js +1 -1
- package/lib/src/plugin/screenshot/index.js +26 -4
- package/lib/src/plugin/video/index.js +117 -28
- package/lib/src/plugin/watermark/index.js +58 -102
- package/lib/src/plugin/watermark/watermark.js +123 -80
- package/lib/src/ui/data/index.js +1 -1
- package/lib/src/ui/element-plus/index.js +112 -96
- package/lib/src/ui/index.js +1 -1
- package/lib/src/utils/bem.js +1 -1
- package/lib/src/utils/mock.js +1 -1
- package/lib/src/utils/print.js +218 -0
- package/lib/src/utils/util.js +1 -1
- package/lib/src/utils/validate.js +1 -1
- package/lib/src/version.js +2 -2
- package/package.json +4 -2
- package/types/index.d.ts +74 -19
- package/es/packages/element-plus/card/index2.mjs +0 -65
- package/es/packages/element-plus/card/index3.mjs +0 -94
- package/es/packages/element-plus/verify/index2.mjs +0 -52
- package/es/packages/element-plus/verify/index3.mjs +0 -18
- package/lib/packages/element-plus/card/index2.js +0 -69
- package/lib/packages/element-plus/card/index3.js +0 -96
- package/lib/packages/element-plus/verify/index2.js +0 -56
- package/lib/packages/element-plus/verify/index3.js +0 -20
|
@@ -0,0 +1,917 @@
|
|
|
1
|
+
/*! Avue.js v3.9.4 | (c) 2017-2026 Smallwei | Released under the MIT License. */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var src_core_create = require('../../../src/core/create.js');
|
|
7
|
+
|
|
8
|
+
const CAPTCHA_TYPES = ['slider', 'text', 'math', 'rotate', 'icon', 'sequence', 'drag', 'code', 'path'];
|
|
9
|
+
const DEFAULT_TEXT_POOL = '春夏秋冬诚信安全智慧服务登录验证用户数据网络星辰山河风云花鸟';
|
|
10
|
+
const CHOICE_COLORS = ['#f72585', '#4361ee', '#4cc9f0', '#38b000', '#f77f00', '#8338ec'];
|
|
11
|
+
const PUZZLE_SHAPES = ['a', 'b'];
|
|
12
|
+
const DEFAULT_ICON_POOL = [
|
|
13
|
+
{ value: '★', label: '星星' },
|
|
14
|
+
{ value: '♥', label: '爱心' },
|
|
15
|
+
{ value: '☀', label: '太阳' },
|
|
16
|
+
{ value: '☁', label: '云朵' },
|
|
17
|
+
{ value: '✦', label: '闪光' },
|
|
18
|
+
{ value: '✿', label: '花朵' },
|
|
19
|
+
{ value: '◆', label: '菱形' },
|
|
20
|
+
{ value: '♣', label: '梅花' },
|
|
21
|
+
];
|
|
22
|
+
const SEQUENCE_COLORS = [
|
|
23
|
+
{ value: '#ef476f', label: '红色' },
|
|
24
|
+
{ value: '#4361ee', label: '蓝色' },
|
|
25
|
+
{ value: '#06b6a4', label: '绿色' },
|
|
26
|
+
{ value: '#f59e0b', label: '橙色' },
|
|
27
|
+
];
|
|
28
|
+
const SEQUENCE_SHAPES = [
|
|
29
|
+
{ value: 'circle', label: '圆形' },
|
|
30
|
+
{ value: 'square', label: '方形' },
|
|
31
|
+
{ value: 'triangle', label: '三角形' },
|
|
32
|
+
{ value: 'diamond', label: '菱形' },
|
|
33
|
+
];
|
|
34
|
+
const DRAG_SHAPES = ['circle', 'square', 'triangle', 'diamond'];
|
|
35
|
+
const PUZZLE_PATHS = {
|
|
36
|
+
a: 'M10,10H38C38,-2,62,-2,62,10H90V38C102,38,102,62,90,62V90H62C62,78,38,78,38,90H10V62C-2,62,-2,38,10,38Z',
|
|
37
|
+
b: 'M10,10H38C38,22,62,22,62,10H90V38C78,38,78,62,90,62V90H62C62,102,38,102,38,90H10V62C22,62,22,38,10,38Z',
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const randomInt = (min, max) => {
|
|
41
|
+
const start = Math.ceil(min);
|
|
42
|
+
const end = Math.floor(max);
|
|
43
|
+
return Math.floor(Math.random() * (end - start + 1)) + start;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const shuffle = (list) => {
|
|
47
|
+
const result = [...list];
|
|
48
|
+
for (let index = result.length - 1; index > 0; index -= 1) {
|
|
49
|
+
const randomIndex = randomInt(0, index);
|
|
50
|
+
[result[index], result[randomIndex]] = [result[randomIndex], result[index]];
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const toCssUrl = (value) => `url(${JSON.stringify(String(value))})`;
|
|
56
|
+
|
|
57
|
+
var script = src_core_create.default({
|
|
58
|
+
name: 'captcha',
|
|
59
|
+
emits: ['update:modelValue', 'change', 'success', 'fail', 'refresh'],
|
|
60
|
+
expose: ['refresh', 'reset', 'verify'],
|
|
61
|
+
props: {
|
|
62
|
+
modelValue: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
type: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: 'slider',
|
|
69
|
+
validator: (value) => CAPTCHA_TYPES.includes(value),
|
|
70
|
+
},
|
|
71
|
+
width: {
|
|
72
|
+
type: [Number, String],
|
|
73
|
+
default: 320,
|
|
74
|
+
},
|
|
75
|
+
height: {
|
|
76
|
+
type: Number,
|
|
77
|
+
default: 160,
|
|
78
|
+
},
|
|
79
|
+
pieceSize: {
|
|
80
|
+
type: Number,
|
|
81
|
+
default: 42,
|
|
82
|
+
},
|
|
83
|
+
tolerance: {
|
|
84
|
+
type: Number,
|
|
85
|
+
default: 6,
|
|
86
|
+
},
|
|
87
|
+
sliderTargetCount: {
|
|
88
|
+
type: Number,
|
|
89
|
+
default: 2,
|
|
90
|
+
},
|
|
91
|
+
rotateStep: {
|
|
92
|
+
type: Number,
|
|
93
|
+
default: 30,
|
|
94
|
+
},
|
|
95
|
+
image: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: '',
|
|
98
|
+
},
|
|
99
|
+
backgroundImage: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: '',
|
|
102
|
+
},
|
|
103
|
+
backgroundSize: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: 'cover',
|
|
106
|
+
},
|
|
107
|
+
backgroundPosition: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: 'center',
|
|
110
|
+
},
|
|
111
|
+
disabled: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false,
|
|
114
|
+
},
|
|
115
|
+
autoRefresh: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: true,
|
|
118
|
+
},
|
|
119
|
+
refreshDelay: {
|
|
120
|
+
type: Number,
|
|
121
|
+
default: 900,
|
|
122
|
+
},
|
|
123
|
+
targetText: {
|
|
124
|
+
type: [String, Array],
|
|
125
|
+
default: '',
|
|
126
|
+
},
|
|
127
|
+
textPool: {
|
|
128
|
+
type: [String, Array],
|
|
129
|
+
default: DEFAULT_TEXT_POOL,
|
|
130
|
+
},
|
|
131
|
+
textOptionCount: {
|
|
132
|
+
type: Number,
|
|
133
|
+
default: 8,
|
|
134
|
+
},
|
|
135
|
+
targetIcon: {
|
|
136
|
+
type: String,
|
|
137
|
+
default: '',
|
|
138
|
+
},
|
|
139
|
+
iconPool: {
|
|
140
|
+
type: Array,
|
|
141
|
+
default: () => DEFAULT_ICON_POOL,
|
|
142
|
+
},
|
|
143
|
+
iconOptionCount: {
|
|
144
|
+
type: Number,
|
|
145
|
+
default: 6,
|
|
146
|
+
},
|
|
147
|
+
sequenceLength: {
|
|
148
|
+
type: Number,
|
|
149
|
+
default: 3,
|
|
150
|
+
},
|
|
151
|
+
dragTolerance: {
|
|
152
|
+
type: Number,
|
|
153
|
+
default: 16,
|
|
154
|
+
},
|
|
155
|
+
mathQuestion: {
|
|
156
|
+
type: String,
|
|
157
|
+
default: '',
|
|
158
|
+
},
|
|
159
|
+
mathAnswer: {
|
|
160
|
+
type: [Number, String],
|
|
161
|
+
default: undefined,
|
|
162
|
+
},
|
|
163
|
+
mathOptions: {
|
|
164
|
+
type: Array,
|
|
165
|
+
default: () => [],
|
|
166
|
+
},
|
|
167
|
+
mathOptionCount: {
|
|
168
|
+
type: Number,
|
|
169
|
+
default: 4,
|
|
170
|
+
},
|
|
171
|
+
codeLength: {
|
|
172
|
+
type: Number,
|
|
173
|
+
default: 4,
|
|
174
|
+
},
|
|
175
|
+
codeCharacters: {
|
|
176
|
+
type: String,
|
|
177
|
+
default: '23456789ABCDEFGHJKLMNPQRSTUVWXYZ',
|
|
178
|
+
},
|
|
179
|
+
codeCaseSensitive: {
|
|
180
|
+
type: Boolean,
|
|
181
|
+
default: false,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
data() {
|
|
185
|
+
return {
|
|
186
|
+
verified: false,
|
|
187
|
+
status: 'ready',
|
|
188
|
+
message: '',
|
|
189
|
+
sliderOffset: 0,
|
|
190
|
+
sliderTarget: 0,
|
|
191
|
+
sliderTargets: [],
|
|
192
|
+
pieceTop: 24,
|
|
193
|
+
pieceShape: 'a',
|
|
194
|
+
puzzleId: `captcha-puzzle-${Math.random().toString(36).slice(2, 10)}`,
|
|
195
|
+
dragStartX: 0,
|
|
196
|
+
dragStartOffset: 0,
|
|
197
|
+
dragging: false,
|
|
198
|
+
selectedTextIds: [],
|
|
199
|
+
textOptions: [],
|
|
200
|
+
textTargets: [],
|
|
201
|
+
mathExpression: '',
|
|
202
|
+
expectedMathAnswer: '',
|
|
203
|
+
mathResultOptions: [],
|
|
204
|
+
rotation: 0,
|
|
205
|
+
iconOptions: [],
|
|
206
|
+
iconTarget: {},
|
|
207
|
+
sequenceOptions: [],
|
|
208
|
+
sequenceTargets: [],
|
|
209
|
+
selectedSequenceIds: [],
|
|
210
|
+
dragShape: 'circle',
|
|
211
|
+
dragColor: '#4361ee',
|
|
212
|
+
dragSource: { x: 20, y: 20 },
|
|
213
|
+
dragTarget: { x: 180, y: 80 },
|
|
214
|
+
dragOffset: { x: 0, y: 0 },
|
|
215
|
+
dragStartX: 0,
|
|
216
|
+
dragStartY: 0,
|
|
217
|
+
dragStartOffset: { x: 0, y: 0 },
|
|
218
|
+
dragActive: false,
|
|
219
|
+
pathProgress: 0,
|
|
220
|
+
pathDragStartX: 0,
|
|
221
|
+
pathDragStartProgress: 0,
|
|
222
|
+
pathActive: false,
|
|
223
|
+
codeValue: '',
|
|
224
|
+
codeInput: '',
|
|
225
|
+
codeInputId: `captcha-code-${Math.random().toString(36).slice(2, 10)}`,
|
|
226
|
+
refreshTimer: null,
|
|
227
|
+
};
|
|
228
|
+
},
|
|
229
|
+
computed: {
|
|
230
|
+
captchaType() {
|
|
231
|
+
return CAPTCHA_TYPES.includes(this.type) ? this.type : 'slider';
|
|
232
|
+
},
|
|
233
|
+
rootStyle() {
|
|
234
|
+
return { width: this.setPx(this.width) };
|
|
235
|
+
},
|
|
236
|
+
safeHeight() {
|
|
237
|
+
return Math.max(96, Number(this.height) || 160);
|
|
238
|
+
},
|
|
239
|
+
safePieceSize() {
|
|
240
|
+
return Math.min(Math.max(30, Number(this.pieceSize) || 42), this.safeHeight - 20);
|
|
241
|
+
},
|
|
242
|
+
sliderMax() {
|
|
243
|
+
return Math.max(1, this.getSceneWidth() - this.safePieceSize - 8);
|
|
244
|
+
},
|
|
245
|
+
sceneStyle() {
|
|
246
|
+
const style = { height: `${this.safeHeight}px` };
|
|
247
|
+
if (this.backgroundSource) {
|
|
248
|
+
style.backgroundImage = toCssUrl(this.backgroundSource);
|
|
249
|
+
style.backgroundSize = this.backgroundSize;
|
|
250
|
+
style.backgroundPosition = this.backgroundPosition;
|
|
251
|
+
}
|
|
252
|
+
return style;
|
|
253
|
+
},
|
|
254
|
+
backgroundSource() {
|
|
255
|
+
return this.backgroundImage || this.image;
|
|
256
|
+
},
|
|
257
|
+
pieceStyle() {
|
|
258
|
+
return {
|
|
259
|
+
width: `${this.safePieceSize}px`,
|
|
260
|
+
height: `${this.safePieceSize}px`,
|
|
261
|
+
top: `${this.pieceTop}px`,
|
|
262
|
+
transform: `translateX(${this.sliderOffset}px)`,
|
|
263
|
+
};
|
|
264
|
+
},
|
|
265
|
+
piecePath() {
|
|
266
|
+
return this.getPuzzlePath(this.pieceShape);
|
|
267
|
+
},
|
|
268
|
+
pieceClipId() {
|
|
269
|
+
return `${this.puzzleId}-clip`;
|
|
270
|
+
},
|
|
271
|
+
pieceGradientId() {
|
|
272
|
+
return `${this.puzzleId}-gradient`;
|
|
273
|
+
},
|
|
274
|
+
progressStyle() {
|
|
275
|
+
return { width: `${Math.min(100, ((this.sliderOffset + 20) / this.sliderMax) * 100)}%` };
|
|
276
|
+
},
|
|
277
|
+
sliderButtonStyle() {
|
|
278
|
+
return { transform: `translateX(${this.sliderOffset}px)` };
|
|
279
|
+
},
|
|
280
|
+
sliderTip() {
|
|
281
|
+
if (this.verified) return '验证通过';
|
|
282
|
+
if (this.dragging) return '松开以完成验证';
|
|
283
|
+
return '拖动滑块匹配正确缺口';
|
|
284
|
+
},
|
|
285
|
+
targetTextLabel() {
|
|
286
|
+
return this.textTargets.join(' ');
|
|
287
|
+
},
|
|
288
|
+
sequenceTargetLabel() {
|
|
289
|
+
return this.sequenceTargets.map((item) => item.label).join(' → ');
|
|
290
|
+
},
|
|
291
|
+
choiceFontSize() {
|
|
292
|
+
const width = this.getSceneWidth();
|
|
293
|
+
return Math.max(16, Math.min(22, Math.floor(Math.min(width / 14, this.safeHeight / 6.5))));
|
|
294
|
+
},
|
|
295
|
+
mathChoiceFontSize() {
|
|
296
|
+
const width = this.getSceneWidth();
|
|
297
|
+
return Math.max(14, Math.min(18, Math.floor(Math.min(width / 16, this.safeHeight / 8))));
|
|
298
|
+
},
|
|
299
|
+
rotateDialStyle() {
|
|
300
|
+
return { transform: `rotate(${this.rotation}deg)` };
|
|
301
|
+
},
|
|
302
|
+
dragSize() {
|
|
303
|
+
return 42;
|
|
304
|
+
},
|
|
305
|
+
dragCurrentPosition() {
|
|
306
|
+
return {
|
|
307
|
+
x: this.dragSource.x + this.dragOffset.x,
|
|
308
|
+
y: this.dragSource.y + this.dragOffset.y,
|
|
309
|
+
};
|
|
310
|
+
},
|
|
311
|
+
dragPieceStyle() {
|
|
312
|
+
return {
|
|
313
|
+
width: `${this.dragSize}px`,
|
|
314
|
+
height: `${this.dragSize}px`,
|
|
315
|
+
left: `${this.dragCurrentPosition.x}px`,
|
|
316
|
+
top: `${this.dragCurrentPosition.y}px`,
|
|
317
|
+
backgroundColor: this.dragColor,
|
|
318
|
+
};
|
|
319
|
+
},
|
|
320
|
+
dragTargetStyle() {
|
|
321
|
+
return {
|
|
322
|
+
width: `${this.dragSize}px`,
|
|
323
|
+
height: `${this.dragSize}px`,
|
|
324
|
+
left: `${this.dragTarget.x}px`,
|
|
325
|
+
top: `${this.dragTarget.y}px`,
|
|
326
|
+
borderColor: this.dragColor,
|
|
327
|
+
};
|
|
328
|
+
},
|
|
329
|
+
pathStartPoint() {
|
|
330
|
+
return this.getPathPoint(0);
|
|
331
|
+
},
|
|
332
|
+
pathEndPoint() {
|
|
333
|
+
return this.getPathPoint(1);
|
|
334
|
+
},
|
|
335
|
+
pathMarkerStyle() {
|
|
336
|
+
const point = this.getPathPoint(this.pathProgress);
|
|
337
|
+
return {
|
|
338
|
+
left: `${point.x - 15}px`,
|
|
339
|
+
top: `${point.y - 15}px`,
|
|
340
|
+
};
|
|
341
|
+
},
|
|
342
|
+
pathLine() {
|
|
343
|
+
const start = this.pathStartPoint;
|
|
344
|
+
const end = this.pathEndPoint;
|
|
345
|
+
const controlY = Math.max(16, this.safeHeight * 0.14);
|
|
346
|
+
return `M ${start.x} ${start.y} Q ${this.getSceneWidth() / 2} ${controlY} ${end.x} ${end.y}`;
|
|
347
|
+
},
|
|
348
|
+
safeCodeLength() {
|
|
349
|
+
return Math.min(Math.max(Number(this.codeLength) || 4, 3), 8);
|
|
350
|
+
},
|
|
351
|
+
codeChars() {
|
|
352
|
+
return this.codeValue.split('');
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
watch: {
|
|
356
|
+
modelValue(value) {
|
|
357
|
+
if (value === false && this.verified) this.refresh();
|
|
358
|
+
},
|
|
359
|
+
type() {
|
|
360
|
+
this.refresh();
|
|
361
|
+
},
|
|
362
|
+
targetText: {
|
|
363
|
+
handler() {
|
|
364
|
+
if (this.captchaType === 'text') this.refresh();
|
|
365
|
+
},
|
|
366
|
+
deep: true,
|
|
367
|
+
},
|
|
368
|
+
mathQuestion() {
|
|
369
|
+
if (this.captchaType === 'math') this.refresh();
|
|
370
|
+
},
|
|
371
|
+
mathAnswer() {
|
|
372
|
+
if (this.captchaType === 'math') this.refresh();
|
|
373
|
+
},
|
|
374
|
+
mathOptions: {
|
|
375
|
+
handler() {
|
|
376
|
+
if (this.captchaType === 'math') this.refresh();
|
|
377
|
+
},
|
|
378
|
+
deep: true,
|
|
379
|
+
},
|
|
380
|
+
sliderTargetCount() {
|
|
381
|
+
if (this.captchaType === 'slider') this.refresh();
|
|
382
|
+
},
|
|
383
|
+
targetIcon() {
|
|
384
|
+
if (this.captchaType === 'icon') this.refresh();
|
|
385
|
+
},
|
|
386
|
+
iconPool: {
|
|
387
|
+
handler() {
|
|
388
|
+
if (this.captchaType === 'icon') this.refresh();
|
|
389
|
+
},
|
|
390
|
+
deep: true,
|
|
391
|
+
},
|
|
392
|
+
sequenceLength() {
|
|
393
|
+
if (this.captchaType === 'sequence') this.refresh();
|
|
394
|
+
},
|
|
395
|
+
codeLength() {
|
|
396
|
+
if (this.captchaType === 'code') this.refresh();
|
|
397
|
+
},
|
|
398
|
+
codeCharacters() {
|
|
399
|
+
if (this.captchaType === 'code') this.refresh();
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
mounted() {
|
|
403
|
+
this.$nextTick(() => this.refresh());
|
|
404
|
+
},
|
|
405
|
+
beforeUnmount() {
|
|
406
|
+
this.clearRefreshTimer();
|
|
407
|
+
this.stopSlide();
|
|
408
|
+
this.stopDrag();
|
|
409
|
+
this.stopPath();
|
|
410
|
+
},
|
|
411
|
+
methods: {
|
|
412
|
+
getSceneWidth() {
|
|
413
|
+
const width = this.$refs.scene?.clientWidth;
|
|
414
|
+
if (width) return width;
|
|
415
|
+
const propWidth = Number(this.width);
|
|
416
|
+
return Number.isFinite(propWidth) && propWidth > 0 ? propWidth : 320;
|
|
417
|
+
},
|
|
418
|
+
refresh() {
|
|
419
|
+
this.clearRefreshTimer();
|
|
420
|
+
this.stopSlide();
|
|
421
|
+
this.stopDrag();
|
|
422
|
+
this.stopPath();
|
|
423
|
+
this.verified = false;
|
|
424
|
+
this.status = 'ready';
|
|
425
|
+
this.message = '';
|
|
426
|
+
this.sliderOffset = 0;
|
|
427
|
+
this.selectedTextIds = [];
|
|
428
|
+
this.selectedSequenceIds = [];
|
|
429
|
+
this.dragOffset = { x: 0, y: 0 };
|
|
430
|
+
this.pathProgress = 0;
|
|
431
|
+
if (this.captchaType === 'slider') this.createSliderChallenge();
|
|
432
|
+
if (this.captchaType === 'text') this.createTextChallenge();
|
|
433
|
+
if (this.captchaType === 'math') this.createMathChallenge();
|
|
434
|
+
if (this.captchaType === 'rotate') this.createRotateChallenge();
|
|
435
|
+
if (this.captchaType === 'icon') this.createIconChallenge();
|
|
436
|
+
if (this.captchaType === 'sequence') this.createSequenceChallenge();
|
|
437
|
+
if (this.captchaType === 'drag') this.createDragChallenge();
|
|
438
|
+
if (this.captchaType === 'code') this.createCodeChallenge();
|
|
439
|
+
this.updateValue(false);
|
|
440
|
+
this.$emit('refresh', { type: this.captchaType });
|
|
441
|
+
},
|
|
442
|
+
reset() {
|
|
443
|
+
this.refresh();
|
|
444
|
+
},
|
|
445
|
+
createSliderChallenge() {
|
|
446
|
+
const targetCount = Math.min(4, Math.max(1, Number(this.sliderTargetCount) || 2));
|
|
447
|
+
const correctShapeIndex = randomInt(0, PUZZLE_SHAPES.length - 1);
|
|
448
|
+
const targets = [];
|
|
449
|
+
for (let index = 0; index < targetCount; index += 1) {
|
|
450
|
+
let shapeIndex = correctShapeIndex;
|
|
451
|
+
if (index > 0) {
|
|
452
|
+
const shapeCandidates = PUZZLE_SHAPES.map((_, shapeIndex) => shapeIndex)
|
|
453
|
+
.filter((shapeIndex) => shapeIndex !== correctShapeIndex);
|
|
454
|
+
shapeIndex = shapeCandidates[randomInt(0, shapeCandidates.length - 1)];
|
|
455
|
+
}
|
|
456
|
+
const position = this.createSliderTargetPosition(targets);
|
|
457
|
+
targets.push({
|
|
458
|
+
id: `target-${index}`,
|
|
459
|
+
correct: index === 0,
|
|
460
|
+
shape: PUZZLE_SHAPES[shapeIndex],
|
|
461
|
+
...position,
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
const correctTarget = targets[0];
|
|
465
|
+
this.sliderTargets = shuffle(targets);
|
|
466
|
+
this.sliderTarget = correctTarget.x;
|
|
467
|
+
this.pieceTop = correctTarget.y;
|
|
468
|
+
this.pieceShape = correctTarget.shape;
|
|
469
|
+
},
|
|
470
|
+
createCodeChallenge() {
|
|
471
|
+
const characters = [...new Set(String(this.codeCharacters || '').split('').filter(Boolean))];
|
|
472
|
+
const pool = characters.length ? characters : '23456789ABCDEFGHJKLMNPQRSTUVWXYZ'.split('');
|
|
473
|
+
const values = new Uint32Array(this.safeCodeLength);
|
|
474
|
+
if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
|
|
475
|
+
crypto.getRandomValues(values);
|
|
476
|
+
}
|
|
477
|
+
this.codeValue = Array.from({ length: this.safeCodeLength }, (_, index) => {
|
|
478
|
+
const random = values[index] || Math.floor(Math.random() * 0x100000000);
|
|
479
|
+
return pool[random % pool.length];
|
|
480
|
+
}).join('');
|
|
481
|
+
this.codeInput = '';
|
|
482
|
+
},
|
|
483
|
+
createSliderTargetPosition(targets) {
|
|
484
|
+
const maxX = this.sliderMax;
|
|
485
|
+
const minTarget = Math.min(Math.max(20, Math.round(maxX * 0.28)), maxX);
|
|
486
|
+
const minY = 10;
|
|
487
|
+
const maxY = Math.max(minY, this.safeHeight - this.safePieceSize - 10);
|
|
488
|
+
const minDistance = this.safePieceSize * 1.55;
|
|
489
|
+
for (let attempt = 0; attempt < 100; attempt += 1) {
|
|
490
|
+
const position = {
|
|
491
|
+
x: randomInt(minTarget, maxX),
|
|
492
|
+
y: randomInt(minY, maxY),
|
|
493
|
+
};
|
|
494
|
+
const available = targets.every((target) => {
|
|
495
|
+
const xDistance = target.x - position.x;
|
|
496
|
+
const yDistance = target.y - position.y;
|
|
497
|
+
return xDistance * xDistance + yDistance * yDistance >= minDistance * minDistance;
|
|
498
|
+
});
|
|
499
|
+
if (available) return position;
|
|
500
|
+
}
|
|
501
|
+
const index = targets.length;
|
|
502
|
+
return {
|
|
503
|
+
x: Math.max(minTarget, maxX - index * (this.safePieceSize + 8)),
|
|
504
|
+
y: minY + ((maxY - minY) * (index % 2)),
|
|
505
|
+
};
|
|
506
|
+
},
|
|
507
|
+
getSliderTargetStyle(target) {
|
|
508
|
+
return {
|
|
509
|
+
width: `${this.safePieceSize}px`,
|
|
510
|
+
height: `${this.safePieceSize}px`,
|
|
511
|
+
left: `${target.x}px`,
|
|
512
|
+
top: `${target.y}px`,
|
|
513
|
+
};
|
|
514
|
+
},
|
|
515
|
+
getPuzzlePath(shape) {
|
|
516
|
+
return PUZZLE_PATHS[shape] || PUZZLE_PATHS.a;
|
|
517
|
+
},
|
|
518
|
+
createTextChallenge() {
|
|
519
|
+
const pool = Array.isArray(this.textPool) ? this.textPool : String(this.textPool).split('');
|
|
520
|
+
const uniquePool = [...new Set(pool.filter(Boolean))];
|
|
521
|
+
const providedTargets = Array.isArray(this.targetText)
|
|
522
|
+
? this.targetText
|
|
523
|
+
: String(this.targetText || '').split('').filter(Boolean);
|
|
524
|
+
const targetCount = Math.min(3, Math.max(1, providedTargets.length || 2));
|
|
525
|
+
this.textTargets = providedTargets.length
|
|
526
|
+
? providedTargets.slice(0, targetCount)
|
|
527
|
+
: shuffle(uniquePool).slice(0, targetCount);
|
|
528
|
+
const optionCount = Math.max(this.textTargets.length, Number(this.textOptionCount) || 8);
|
|
529
|
+
const options = [...this.textTargets];
|
|
530
|
+
shuffle(uniquePool).forEach((item) => {
|
|
531
|
+
if (options.length < optionCount && !options.includes(item)) options.push(item);
|
|
532
|
+
});
|
|
533
|
+
this.textOptions = this.createChoiceOptions(shuffle(options), 16);
|
|
534
|
+
},
|
|
535
|
+
createMathChallenge() {
|
|
536
|
+
if (this.mathQuestion && this.mathAnswer !== undefined) {
|
|
537
|
+
this.mathExpression = this.mathQuestion;
|
|
538
|
+
this.expectedMathAnswer = String(this.mathAnswer).trim();
|
|
539
|
+
this.createMathOptions();
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
const first = randomInt(5, 20);
|
|
543
|
+
const second = randomInt(1, 9);
|
|
544
|
+
const isSubtraction = Math.random() > 0.5;
|
|
545
|
+
this.mathExpression = isSubtraction ? `${first} − ${second} = ?` : `${first} + ${second} = ?`;
|
|
546
|
+
this.expectedMathAnswer = String(isSubtraction ? first - second : first + second);
|
|
547
|
+
this.createMathOptions();
|
|
548
|
+
},
|
|
549
|
+
createMathOptions() {
|
|
550
|
+
const answer = this.expectedMathAnswer;
|
|
551
|
+
const providedOptions = this.mathOptions.map((item) => String(item).trim()).filter(Boolean);
|
|
552
|
+
const optionCount = Math.max(2, Number(this.mathOptionCount) || 4);
|
|
553
|
+
const options = [...new Set(providedOptions)];
|
|
554
|
+
if (!options.includes(answer)) options.push(answer);
|
|
555
|
+
const answerNumber = Number(answer);
|
|
556
|
+
let attempts = 0;
|
|
557
|
+
while (options.length < optionCount && Number.isFinite(answerNumber) && attempts < 100) {
|
|
558
|
+
attempts += 1;
|
|
559
|
+
const offset = randomInt(-8, 8) || 1;
|
|
560
|
+
const result = String(Math.max(0, answerNumber + offset));
|
|
561
|
+
if (!options.includes(result)) options.push(result);
|
|
562
|
+
}
|
|
563
|
+
this.mathResultOptions = this.createChoiceOptions(shuffle(options), 20);
|
|
564
|
+
},
|
|
565
|
+
createRotateChallenge() {
|
|
566
|
+
const step = Math.max(1, Number(this.rotateStep) || 30);
|
|
567
|
+
this.rotation = randomInt(1, Math.max(1, Math.floor(360 / step) - 1)) * step;
|
|
568
|
+
},
|
|
569
|
+
createIconChallenge() {
|
|
570
|
+
const pool = this.iconPool
|
|
571
|
+
.map((item) => (typeof item === 'string' ? { value: item, label: item } : item))
|
|
572
|
+
.filter((item) => item && item.value && item.label);
|
|
573
|
+
const options = shuffle(pool).slice(0, Math.max(2, Number(this.iconOptionCount) || 6));
|
|
574
|
+
const target = pool.find((item) => item.value === this.targetIcon || item.label === this.targetIcon)
|
|
575
|
+
|| options[0]
|
|
576
|
+
|| DEFAULT_ICON_POOL[0];
|
|
577
|
+
if (!options.some((item) => item.value === target.value)) options[0] = target;
|
|
578
|
+
const positions = [];
|
|
579
|
+
this.iconTarget = target;
|
|
580
|
+
this.iconOptions = shuffle(options).map((item, index) => {
|
|
581
|
+
const position = this.createChoicePosition(positions, 16, options.length, index, 46);
|
|
582
|
+
positions.push(position);
|
|
583
|
+
return {
|
|
584
|
+
id: `icon-${item.value}-${index}`,
|
|
585
|
+
...item,
|
|
586
|
+
...position,
|
|
587
|
+
color: CHOICE_COLORS[randomInt(0, CHOICE_COLORS.length - 1)],
|
|
588
|
+
rotate: randomInt(-15, 15),
|
|
589
|
+
};
|
|
590
|
+
});
|
|
591
|
+
},
|
|
592
|
+
createSequenceChallenge() {
|
|
593
|
+
const options = [];
|
|
594
|
+
while (options.length < 6) {
|
|
595
|
+
const color = SEQUENCE_COLORS[randomInt(0, SEQUENCE_COLORS.length - 1)];
|
|
596
|
+
const shape = SEQUENCE_SHAPES[randomInt(0, SEQUENCE_SHAPES.length - 1)];
|
|
597
|
+
const id = `${color.value}-${shape.value}`;
|
|
598
|
+
if (!options.some((item) => item.id === id)) {
|
|
599
|
+
options.push({ id, color: color.value, shape: shape.value, label: `${color.label}${shape.label}` });
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
const targetLength = Math.min(options.length, Math.max(2, Number(this.sequenceLength) || 3));
|
|
603
|
+
this.sequenceTargets = shuffle(options).slice(0, targetLength);
|
|
604
|
+
const positions = [];
|
|
605
|
+
this.sequenceOptions = shuffle(options).map((item, index) => {
|
|
606
|
+
const position = this.createChoicePosition(positions, 16, options.length, index, 48);
|
|
607
|
+
positions.push(position);
|
|
608
|
+
return { ...item, ...position };
|
|
609
|
+
});
|
|
610
|
+
},
|
|
611
|
+
createDragChallenge() {
|
|
612
|
+
const size = this.dragSize;
|
|
613
|
+
const sceneWidth = this.getSceneWidth();
|
|
614
|
+
const maxX = Math.max(16, sceneWidth - size - 16);
|
|
615
|
+
const maxY = Math.max(16, this.safeHeight - size - 16);
|
|
616
|
+
this.dragShape = DRAG_SHAPES[randomInt(0, DRAG_SHAPES.length - 1)];
|
|
617
|
+
this.dragColor = CHOICE_COLORS[randomInt(0, CHOICE_COLORS.length - 1)];
|
|
618
|
+
this.dragSource = { x: randomInt(16, Math.max(16, Math.round(maxX * 0.35))), y: randomInt(16, maxY) };
|
|
619
|
+
let target = { x: maxX, y: maxY };
|
|
620
|
+
for (let attempt = 0; attempt < 80; attempt += 1) {
|
|
621
|
+
const candidate = { x: randomInt(16, maxX), y: randomInt(16, maxY) };
|
|
622
|
+
const xDistance = candidate.x - this.dragSource.x;
|
|
623
|
+
const yDistance = candidate.y - this.dragSource.y;
|
|
624
|
+
if (xDistance * xDistance + yDistance * yDistance >= (size * 1.7) ** 2) {
|
|
625
|
+
target = candidate;
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
this.dragTarget = target;
|
|
630
|
+
},
|
|
631
|
+
createChoiceOptions(values, top, optionSize) {
|
|
632
|
+
const positions = [];
|
|
633
|
+
return values.map((value, index) => {
|
|
634
|
+
const position = this.createChoicePosition(positions, top, values.length, index, optionSize);
|
|
635
|
+
positions.push(position);
|
|
636
|
+
return {
|
|
637
|
+
id: `${value}-${index}`,
|
|
638
|
+
value,
|
|
639
|
+
...position,
|
|
640
|
+
color: CHOICE_COLORS[randomInt(0, CHOICE_COLORS.length - 1)],
|
|
641
|
+
rotate: randomInt(-18, 18),
|
|
642
|
+
};
|
|
643
|
+
});
|
|
644
|
+
},
|
|
645
|
+
createChoicePosition(positions, top, count, index, optionSize) {
|
|
646
|
+
const fontSize = optionSize || (this.captchaType === 'math' ? this.mathChoiceFontSize : this.choiceFontSize);
|
|
647
|
+
const hitAreaSize = Math.max(fontSize, 42);
|
|
648
|
+
const sceneWidth = this.getSceneWidth();
|
|
649
|
+
const sidePadding = 18;
|
|
650
|
+
const minX = sidePadding;
|
|
651
|
+
const maxX = Math.max(minX, sceneWidth - hitAreaSize - sidePadding);
|
|
652
|
+
const minY = Math.min(top, this.safeHeight - hitAreaSize - 8);
|
|
653
|
+
const maxY = Math.max(minY, this.safeHeight - hitAreaSize - 10);
|
|
654
|
+
const minDistance = Math.max(hitAreaSize, 34);
|
|
655
|
+
|
|
656
|
+
for (let attempt = 0; attempt < 100; attempt += 1) {
|
|
657
|
+
const position = {
|
|
658
|
+
x: randomInt(minX, maxX),
|
|
659
|
+
y: randomInt(minY, maxY),
|
|
660
|
+
};
|
|
661
|
+
const available = positions.every((item) => {
|
|
662
|
+
const xDistance = item.x - position.x;
|
|
663
|
+
const yDistance = item.y - position.y;
|
|
664
|
+
return xDistance * xDistance + yDistance * yDistance >= minDistance * minDistance;
|
|
665
|
+
});
|
|
666
|
+
if (available) return position;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
const columns = Math.min(4, Math.max(2, Math.ceil(Math.sqrt(count * 1.5))));
|
|
670
|
+
const rows = Math.ceil(count / columns);
|
|
671
|
+
const column = index % columns;
|
|
672
|
+
const row = Math.floor(index / columns);
|
|
673
|
+
return {
|
|
674
|
+
x: Math.round(minX + ((maxX - minX) * (column + 0.5)) / columns),
|
|
675
|
+
y: Math.round(minY + ((maxY - minY) * (row + 0.5)) / Math.max(1, rows)),
|
|
676
|
+
};
|
|
677
|
+
},
|
|
678
|
+
getChoiceOptionStyle(item) {
|
|
679
|
+
const isMath = this.captchaType === 'math';
|
|
680
|
+
return {
|
|
681
|
+
left: `${item.x}px`,
|
|
682
|
+
top: `${item.y}px`,
|
|
683
|
+
color: item.color,
|
|
684
|
+
fontSize: `${isMath ? this.mathChoiceFontSize : this.choiceFontSize}px`,
|
|
685
|
+
transform: `rotate(${item.rotate}deg)`,
|
|
686
|
+
};
|
|
687
|
+
},
|
|
688
|
+
getIconOptionStyle(item) {
|
|
689
|
+
return {
|
|
690
|
+
left: `${item.x}px`,
|
|
691
|
+
top: `${item.y}px`,
|
|
692
|
+
color: item.color,
|
|
693
|
+
transform: `rotate(${item.rotate}deg)`,
|
|
694
|
+
};
|
|
695
|
+
},
|
|
696
|
+
getSequenceOptionStyle(item) {
|
|
697
|
+
return {
|
|
698
|
+
left: `${item.x}px`,
|
|
699
|
+
top: `${item.y}px`,
|
|
700
|
+
backgroundColor: item.color,
|
|
701
|
+
};
|
|
702
|
+
},
|
|
703
|
+
getPathPoint(progress) {
|
|
704
|
+
const width = this.getSceneWidth();
|
|
705
|
+
const startX = 30;
|
|
706
|
+
const endX = Math.max(startX, width - 30);
|
|
707
|
+
const t = Math.min(1, Math.max(0, progress));
|
|
708
|
+
return {
|
|
709
|
+
x: startX + (endX - startX) * t,
|
|
710
|
+
y: this.safeHeight - 28 - Math.sin(Math.PI * t) * this.safeHeight * 0.42,
|
|
711
|
+
};
|
|
712
|
+
},
|
|
713
|
+
rotateCaptcha(direction) {
|
|
714
|
+
if (this.disabled || this.verified) return;
|
|
715
|
+
const step = Math.max(1, Number(this.rotateStep) || 30);
|
|
716
|
+
this.rotation = ((this.rotation + direction * step) % 360 + 360) % 360;
|
|
717
|
+
this.status = 'ready';
|
|
718
|
+
this.message = '';
|
|
719
|
+
if (this.rotation === 0) this.succeed();
|
|
720
|
+
},
|
|
721
|
+
selectIcon(item) {
|
|
722
|
+
if (this.disabled || this.verified) return;
|
|
723
|
+
if (item.value === this.iconTarget.value) {
|
|
724
|
+
this.succeed();
|
|
725
|
+
} else {
|
|
726
|
+
this.fail('图标不正确,请重试');
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
selectSequence(item) {
|
|
730
|
+
if (this.disabled || this.verified || this.selectedSequenceIds.includes(item.id)) return;
|
|
731
|
+
const selectedIndex = this.selectedSequenceIds.length;
|
|
732
|
+
if (item.id !== this.sequenceTargets[selectedIndex]?.id) {
|
|
733
|
+
this.fail('点击顺序不正确,请重试');
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
this.selectedSequenceIds.push(item.id);
|
|
737
|
+
if (this.selectedSequenceIds.length === this.sequenceTargets.length) this.succeed();
|
|
738
|
+
},
|
|
739
|
+
startDrag(event) {
|
|
740
|
+
if (this.disabled || this.verified) return;
|
|
741
|
+
this.dragActive = true;
|
|
742
|
+
this.status = 'ready';
|
|
743
|
+
this.message = '';
|
|
744
|
+
this.dragStartX = event.clientX;
|
|
745
|
+
this.dragStartY = event.clientY;
|
|
746
|
+
this.dragStartOffset = { ...this.dragOffset };
|
|
747
|
+
window.addEventListener('pointermove', this.moveDrag);
|
|
748
|
+
window.addEventListener('pointerup', this.finishDrag);
|
|
749
|
+
window.addEventListener('pointercancel', this.finishDrag);
|
|
750
|
+
},
|
|
751
|
+
moveDrag(event) {
|
|
752
|
+
if (!this.dragActive) return;
|
|
753
|
+
const sceneWidth = this.getSceneWidth();
|
|
754
|
+
const maxX = Math.max(0, sceneWidth - this.dragSize - this.dragSource.x);
|
|
755
|
+
const maxY = Math.max(0, this.safeHeight - this.dragSize - this.dragSource.y);
|
|
756
|
+
const minX = -this.dragSource.x;
|
|
757
|
+
const minY = -this.dragSource.y;
|
|
758
|
+
this.dragOffset = {
|
|
759
|
+
x: Math.min(maxX, Math.max(minX, this.dragStartOffset.x + event.clientX - this.dragStartX)),
|
|
760
|
+
y: Math.min(maxY, Math.max(minY, this.dragStartOffset.y + event.clientY - this.dragStartY)),
|
|
761
|
+
};
|
|
762
|
+
},
|
|
763
|
+
finishDrag() {
|
|
764
|
+
if (!this.dragActive) return;
|
|
765
|
+
const position = this.dragCurrentPosition;
|
|
766
|
+
const xDistance = position.x - this.dragTarget.x;
|
|
767
|
+
const yDistance = position.y - this.dragTarget.y;
|
|
768
|
+
const tolerance = Math.max(4, Number(this.dragTolerance) || 16);
|
|
769
|
+
this.stopDrag();
|
|
770
|
+
if (xDistance * xDistance + yDistance * yDistance <= tolerance * tolerance) {
|
|
771
|
+
this.succeed();
|
|
772
|
+
} else {
|
|
773
|
+
this.fail('位置不正确,请重试');
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
stopDrag() {
|
|
777
|
+
this.dragActive = false;
|
|
778
|
+
if (typeof window === 'undefined') return;
|
|
779
|
+
window.removeEventListener('pointermove', this.moveDrag);
|
|
780
|
+
window.removeEventListener('pointerup', this.finishDrag);
|
|
781
|
+
window.removeEventListener('pointercancel', this.finishDrag);
|
|
782
|
+
},
|
|
783
|
+
startPath(event) {
|
|
784
|
+
if (this.disabled || this.verified) return;
|
|
785
|
+
this.pathActive = true;
|
|
786
|
+
this.status = 'ready';
|
|
787
|
+
this.message = '';
|
|
788
|
+
this.pathDragStartX = event.clientX;
|
|
789
|
+
this.pathDragStartProgress = this.pathProgress;
|
|
790
|
+
window.addEventListener('pointermove', this.movePath);
|
|
791
|
+
window.addEventListener('pointerup', this.finishPath);
|
|
792
|
+
window.addEventListener('pointercancel', this.finishPath);
|
|
793
|
+
},
|
|
794
|
+
movePath(event) {
|
|
795
|
+
if (!this.pathActive) return;
|
|
796
|
+
const usableWidth = Math.max(1, this.getSceneWidth() - 60);
|
|
797
|
+
this.pathProgress = Math.min(1, Math.max(0, this.pathDragStartProgress + (event.clientX - this.pathDragStartX) / usableWidth));
|
|
798
|
+
},
|
|
799
|
+
finishPath() {
|
|
800
|
+
if (!this.pathActive) return;
|
|
801
|
+
const passed = this.pathProgress >= 0.95;
|
|
802
|
+
this.stopPath();
|
|
803
|
+
if (passed) {
|
|
804
|
+
this.pathProgress = 1;
|
|
805
|
+
this.succeed();
|
|
806
|
+
} else {
|
|
807
|
+
this.fail('请沿轨迹滑动到终点');
|
|
808
|
+
}
|
|
809
|
+
},
|
|
810
|
+
stopPath() {
|
|
811
|
+
this.pathActive = false;
|
|
812
|
+
if (typeof window === 'undefined') return;
|
|
813
|
+
window.removeEventListener('pointermove', this.movePath);
|
|
814
|
+
window.removeEventListener('pointerup', this.finishPath);
|
|
815
|
+
window.removeEventListener('pointercancel', this.finishPath);
|
|
816
|
+
},
|
|
817
|
+
startSlide(event) {
|
|
818
|
+
if (this.disabled || this.verified) return;
|
|
819
|
+
this.dragging = true;
|
|
820
|
+
this.status = 'ready';
|
|
821
|
+
this.message = '';
|
|
822
|
+
this.dragStartX = event.clientX;
|
|
823
|
+
this.dragStartOffset = this.sliderOffset;
|
|
824
|
+
window.addEventListener('pointermove', this.moveSlide);
|
|
825
|
+
window.addEventListener('pointerup', this.finishSlide);
|
|
826
|
+
window.addEventListener('pointercancel', this.finishSlide);
|
|
827
|
+
},
|
|
828
|
+
moveSlide(event) {
|
|
829
|
+
if (!this.dragging) return;
|
|
830
|
+
const offset = this.dragStartOffset + event.clientX - this.dragStartX;
|
|
831
|
+
this.sliderOffset = Math.min(this.sliderMax, Math.max(0, offset));
|
|
832
|
+
},
|
|
833
|
+
finishSlide() {
|
|
834
|
+
if (!this.dragging) return;
|
|
835
|
+
const passed = Math.abs(this.sliderOffset - this.sliderTarget) <= Math.max(1, Number(this.tolerance) || 6);
|
|
836
|
+
this.stopSlide();
|
|
837
|
+
if (passed) {
|
|
838
|
+
this.succeed();
|
|
839
|
+
} else {
|
|
840
|
+
this.fail('位置不正确,请重试');
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
stopSlide() {
|
|
844
|
+
this.dragging = false;
|
|
845
|
+
if (typeof window === 'undefined') return;
|
|
846
|
+
window.removeEventListener('pointermove', this.moveSlide);
|
|
847
|
+
window.removeEventListener('pointerup', this.finishSlide);
|
|
848
|
+
window.removeEventListener('pointercancel', this.finishSlide);
|
|
849
|
+
},
|
|
850
|
+
selectText(item) {
|
|
851
|
+
if (this.disabled || this.verified || this.selectedTextIds.includes(item.id)) return;
|
|
852
|
+
const selectedIndex = this.selectedTextIds.length;
|
|
853
|
+
if (item.value !== this.textTargets[selectedIndex]) {
|
|
854
|
+
this.fail('点击顺序不正确,请重试');
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
this.selectedTextIds.push(item.id);
|
|
858
|
+
if (this.selectedTextIds.length === this.textTargets.length) this.succeed();
|
|
859
|
+
},
|
|
860
|
+
selectMath(item) {
|
|
861
|
+
if (this.disabled || this.verified) return;
|
|
862
|
+
if (item.value === this.expectedMathAnswer) {
|
|
863
|
+
this.succeed();
|
|
864
|
+
} else {
|
|
865
|
+
this.fail('结果不正确,请重试');
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
verify(value) {
|
|
869
|
+
if (value === undefined) return;
|
|
870
|
+
if (this.captchaType === 'math') {
|
|
871
|
+
this.selectMath({ value: String(value).trim() });
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
if (this.captchaType !== 'code' || this.disabled || this.verified) return;
|
|
875
|
+
const input = String(value).trim();
|
|
876
|
+
const expected = this.codeCaseSensitive ? this.codeValue : this.codeValue.toUpperCase();
|
|
877
|
+
const actual = this.codeCaseSensitive ? input : input.toUpperCase();
|
|
878
|
+
if (actual === expected) this.succeed();
|
|
879
|
+
else this.fail('验证码不正确,请重试');
|
|
880
|
+
},
|
|
881
|
+
succeed() {
|
|
882
|
+
this.clearRefreshTimer();
|
|
883
|
+
this.verified = true;
|
|
884
|
+
this.status = 'success';
|
|
885
|
+
this.message = '验证通过';
|
|
886
|
+
this.updateValue(true);
|
|
887
|
+
this.$emit('success', { type: this.captchaType });
|
|
888
|
+
},
|
|
889
|
+
fail(message) {
|
|
890
|
+
this.status = 'error';
|
|
891
|
+
this.message = message;
|
|
892
|
+
this.$emit('fail', { type: this.captchaType, message });
|
|
893
|
+
if (!this.autoRefresh) return;
|
|
894
|
+
this.clearRefreshTimer();
|
|
895
|
+
this.refreshTimer = window.setTimeout(() => this.refresh(), Math.max(0, Number(this.refreshDelay) || 0));
|
|
896
|
+
},
|
|
897
|
+
clearRefreshTimer() {
|
|
898
|
+
if (this.refreshTimer === null) return;
|
|
899
|
+
clearTimeout(this.refreshTimer);
|
|
900
|
+
this.refreshTimer = null;
|
|
901
|
+
},
|
|
902
|
+
updateValue(value) {
|
|
903
|
+
if (this.modelValue === value) return;
|
|
904
|
+
this.$emit('update:modelValue', value);
|
|
905
|
+
this.$emit('change', { value, type: this.captchaType });
|
|
906
|
+
},
|
|
907
|
+
getCodeCharacterStyle(index) {
|
|
908
|
+
const rotations = [-8, 5, -3, 7, -6, 3, 8, -4];
|
|
909
|
+
const offsets = [3, -2, 1, -3, 2, -1, 3, -2];
|
|
910
|
+
return {
|
|
911
|
+
transform: `translateY(${offsets[index % offsets.length]}px) rotate(${rotations[index % rotations.length]}deg)`
|
|
912
|
+
};
|
|
913
|
+
},
|
|
914
|
+
},
|
|
915
|
+
});
|
|
916
|
+
|
|
917
|
+
exports.default = script;
|