@pubinfo/module-captcha 2.1.1

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.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/dist/api/modules/auth/index.d.ts +1 -0
  3. package/dist/api/modules/auth/renzhengfuwu.d.ts +78 -0
  4. package/dist/api/request.d.ts +1 -0
  5. package/dist/components/VerifyInput/PubinfoVerifyInput.vue.d.ts +17 -0
  6. package/dist/components/VerifyInput/authService.d.ts +9 -0
  7. package/dist/components/VerifyInput/captchaUtils.d.ts +6 -0
  8. package/dist/components/VerifyPoints/PubinfoFixedPoint.vue.d.ts +11 -0
  9. package/dist/components/VerifyPoints/PubinfoPopPoint.vue.d.ts +17 -0
  10. package/dist/components/VerifyPoints/PubinfoTouchPoint.vue.d.ts +30 -0
  11. package/dist/components/VerifyPoints/common/checkEvent.d.ts +5 -0
  12. package/dist/components/VerifyPoints/common/initFuns.d.ts +2 -0
  13. package/dist/components/VerifyPoints/common/touchService.d.ts +10 -0
  14. package/dist/components/VerifyPoints/common/variable.d.ts +39 -0
  15. package/dist/components/VerifyPoints/pubinfoPopPoint.d.ts +1 -0
  16. package/dist/components/VerifySlide/PubinfoFixedSlide.vue.d.ts +14 -0
  17. package/dist/components/VerifySlide/PubinfoPopSlide.vue.d.ts +17 -0
  18. package/dist/components/VerifySlide/PubinfoTouchSlide.vue.d.ts +35 -0
  19. package/dist/components/VerifySlide/common/init.d.ts +2 -0
  20. package/dist/components/VerifySlide/common/mouse.d.ts +9 -0
  21. package/dist/components/VerifySlide/common/touchService.d.ts +10 -0
  22. package/dist/components/VerifySlide/common/variable.d.ts +59 -0
  23. package/dist/components/VerifySlide/pubinfoPopSlide.d.ts +1 -0
  24. package/dist/components/aes.d.ts +1 -0
  25. package/dist/context.d.ts +2 -0
  26. package/dist/index.css +1 -0
  27. package/dist/index.d.ts +12 -0
  28. package/dist/index.js +6165 -0
  29. package/dist/interface.d.ts +15 -0
  30. package/package.json +44 -0
  31. package/src/api/modules/auth/index.ts +1 -0
  32. package/src/api/modules/auth/renzhengfuwu.ts +223 -0
  33. package/src/api/modules/auth/typings.d.ts +140 -0
  34. package/src/api/request.ts +4 -0
  35. package/src/components/VerifyInput/PubinfoVerifyInput.vue +91 -0
  36. package/src/components/VerifyInput/authService.ts +22 -0
  37. package/src/components/VerifyInput/captchaUtils.ts +15 -0
  38. package/src/components/VerifyPoints/PubinfoFixedPoint.vue +224 -0
  39. package/src/components/VerifyPoints/PubinfoPopPoint.vue +55 -0
  40. package/src/components/VerifyPoints/PubinfoTouchPoint.vue +73 -0
  41. package/src/components/VerifyPoints/common/checkEvent.ts +72 -0
  42. package/src/components/VerifyPoints/common/initFuns.ts +44 -0
  43. package/src/components/VerifyPoints/common/touchService.ts +53 -0
  44. package/src/components/VerifyPoints/common/variable.ts +76 -0
  45. package/src/components/VerifyPoints/pubinfoPopPoint.ts +34 -0
  46. package/src/components/VerifySlide/PubinfoFixedSlide.vue +285 -0
  47. package/src/components/VerifySlide/PubinfoPopSlide.vue +53 -0
  48. package/src/components/VerifySlide/PubinfoTouchSlide.vue +51 -0
  49. package/src/components/VerifySlide/common/init.ts +41 -0
  50. package/src/components/VerifySlide/common/mouse.ts +124 -0
  51. package/src/components/VerifySlide/common/touchService.ts +52 -0
  52. package/src/components/VerifySlide/common/variable.ts +90 -0
  53. package/src/components/VerifySlide/pubinfoPopSlide.ts +34 -0
  54. package/src/components/aes.ts +13 -0
  55. package/src/context.ts +4 -0
  56. package/src/images/click.png +0 -0
  57. package/src/index.ts +37 -0
  58. package/src/interface.ts +19 -0
@@ -0,0 +1,34 @@
1
+ import { createApp, h } from 'vue';
2
+
3
+ import PubinfoPopSlide from './PubinfoPopSlide.vue';
4
+
5
+ export function pubinfoPopSlide(): Promise<any> {
6
+ return new Promise((resolve) => {
7
+ const app = createApp({
8
+ render() {
9
+ return h(PubinfoPopSlide, {
10
+ open: true,
11
+ onCancel: () => {
12
+ close();
13
+ resolve(null);
14
+ },
15
+ onSuccess: (...arg) => {
16
+ resolve(...arg);
17
+ close();
18
+ },
19
+ });
20
+ },
21
+ });
22
+
23
+ const container = document.createElement('div');
24
+ document.body.appendChild(container);
25
+ app.mount(container);
26
+
27
+ function close() {
28
+ setTimeout(() => {
29
+ app.unmount();
30
+ document.body.removeChild(container);
31
+ }, 500);
32
+ }
33
+ });
34
+ }
@@ -0,0 +1,13 @@
1
+ import CryptoJS from 'crypto-js';
2
+
3
+ export function aesEncrypt(word: any, secretKey?: string) {
4
+ const key = CryptoJS.enc.Utf8.parse(secretKey as string);
5
+ const srcs = CryptoJS.enc.Utf8.parse(word);
6
+ const encrypted = CryptoJS.AES.encrypt(srcs, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
7
+ return encrypted.toString();
8
+ }
9
+ // export function aesDecrypt(word: any, secretKey?: string) {
10
+ // const key = CryptoJS.enc.Utf8.parse(secretKey);
11
+ // const decrypt = CryptoJS.AES.decrypt(word, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
12
+ // return CryptoJS.enc.Utf8.stringify(decrypt).toString();
13
+ // }
package/src/context.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { InternalContext } from './interface.ts';
2
+ import { createContext } from 'pubinfo';
3
+
4
+ export const ctx = createContext<InternalContext>('captcha');
Binary file
package/src/index.ts ADDED
@@ -0,0 +1,37 @@
1
+ import type { ModuleOptions } from 'pubinfo';
2
+
3
+ import type { CaptchaOptions } from './interface';
4
+
5
+ import { ctx } from './context';
6
+ import 'uno.css';
7
+
8
+ export function captcha(options: CaptchaOptions): ModuleOptions {
9
+ const { request } = options;
10
+ ctx.set({ request });
11
+
12
+ return {
13
+ name: 'pubinfo:captcha',
14
+ };
15
+ }
16
+
17
+ // 输入验证模式
18
+ export { default as PubinfoVerifyInput } from './components/VerifyInput/PubinfoVerifyInput.vue';
19
+
20
+ // 点文字组件三模式
21
+ // 页面组件-嵌入式
22
+ export { default as PubinfoFixedPoint } from './components/VerifyPoints/PubinfoFixedPoint.vue';
23
+ // 函数式插件
24
+ export { pubinfoPopPoint as captchaPopPoint } from './components/VerifyPoints/pubinfoPopPoint.ts';
25
+ // 页面组件-触发式
26
+ export { default as PubinfoTouchPoint } from './components/VerifyPoints/PubinfoTouchPoint.vue';
27
+
28
+ // 滑动组件三模式
29
+ // 页面组件-嵌入式
30
+ export { default as PubinfoFixedSlide } from './components/VerifySlide/PubinfoFixedSlide.vue';
31
+ // 函数式插件-弹出式
32
+ export { pubinfoPopSlide as captchaPopSlide } from './components/VerifySlide/pubinfoPopSlide.ts';
33
+ // 页面组件-触发式
34
+ export { default as PubinfoTouchSlide } from './components/VerifySlide/PubinfoTouchSlide.vue';
35
+
36
+ // 验证成功后数据类型导出
37
+ export type { CaptchaResult } from './interface';
@@ -0,0 +1,19 @@
1
+ import type { RequestInstance } from 'pubinfo';
2
+
3
+ export interface CaptchaOptions {
4
+ /**
5
+ * 接口请求实例
6
+ */
7
+ request: InternalContext['request']
8
+ }
9
+
10
+ export interface InternalContext {
11
+ request: RequestInstance
12
+ }
13
+
14
+ export { RequestInstance };
15
+
16
+ export interface CaptchaResult {
17
+ captchaVerification: string
18
+ captchaType: string
19
+ }