@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,224 @@
1
+ <script lang="ts" setup>
2
+ import { useElementSize } from '@vueuse/core';
3
+ import { onMounted, ref } from 'vue';
4
+
5
+ import { canvasClick } from './common/checkEvent.ts';
6
+ import { init, refresh } from './common/initFuns.ts';
7
+ import { variable } from './common/variable.ts';
8
+
9
+ const emit = defineEmits(['success']);
10
+
11
+ const pointRef = ref();
12
+
13
+ const { width: pointWidth } = useElementSize(pointRef);
14
+
15
+ const VA = variable();
16
+ const canvas = ref(null);
17
+
18
+ onMounted(() => {
19
+ init(VA);
20
+ VA.setSize.value.imgHeight = `${pointWidth.value / 2}px`;
21
+ VA.realImgSize.value = {
22
+ width: pointWidth.value,
23
+ height: pointWidth.value / 2,
24
+ };
25
+ });
26
+
27
+ function successFun(params: any) {
28
+ emit('success', params);
29
+ }
30
+
31
+ // watch(
32
+ // () => isRefresh.value,
33
+ // (val) => {
34
+ // if (val) {
35
+ // refresh(VA);
36
+ // isRefresh.value = false;
37
+ // }
38
+ // },
39
+ // );
40
+
41
+ defineExpose({
42
+ refresh: () => {
43
+ refresh(VA);
44
+ },
45
+ });
46
+ </script>
47
+
48
+ <template>
49
+ <div ref="pointRef" style="position: relative" :style="{ width: VA.setSize.value.imgWidth }">
50
+ <div class="verify-img-out" :style="{ height: `${parseInt(VA.setSize.value.imgHeight) + 10}px` }">
51
+ <div
52
+ class="verify-img-panel" :style="{ width: VA.setSize.value.imgWidth,
53
+ height: VA.setSize.value.imgHeight,
54
+ }"
55
+ >
56
+ <div v-show="VA.showRefresh.value" class="verify-refresh" style="z-index:3" @click="refresh(VA)">
57
+ <RedoOutlined :style="{ fontSize: '20px', color: 'white', transform: 'rotate(-90deg)' }" />
58
+ </div>
59
+ <img
60
+ ref="canvas"
61
+ :src="`data:image/png;base64,${VA.pointBackImgBase.value}`"
62
+ alt="" style="width:100%;height:100%;display:block"
63
+ @click="VA.bindingClick.value ? canvasClick($event, canvas, VA, successFun) : undefined"
64
+ >
65
+
66
+ <div
67
+ v-for="(tempPoint, index) in VA.tempPoints" :key="index" class="point-area"
68
+ :style="{
69
+ 'background-color': '#1abd6c',
70
+ 'color': '#fff',
71
+ 'z-index': 2,
72
+ 'width': '20px',
73
+ 'height': '20px',
74
+ 'text-align': 'center',
75
+ 'line-height': '20px',
76
+ 'border-radius': '50%',
77
+ 'position': 'absolute',
78
+ 'top': `${tempPoint.y - 10}px`,
79
+ 'left': `${tempPoint.x - 10}px`,
80
+ }"
81
+ >
82
+ {{ index + 1 }}
83
+ </div>
84
+ </div>
85
+ </div>
86
+ <div
87
+ class="verify-bar-area"
88
+ :style="{ 'width': VA.setSize.value.imgWidth,
89
+ 'height': VA.setSize.value.barHeight,
90
+ 'color': VA.barTextColor.value,
91
+ 'background-color': VA.barBackgroundColor.value,
92
+ 'border-color': VA.barAreaBorderColor.value }"
93
+ >
94
+ <div>
95
+ <CheckOutlined v-if="VA.text.value === '验证成功'" :style="{ fontSize: '16px', color: VA.barTextColor.value, marginRight: '6px' }" />
96
+ <CloseOutlined v-if="VA.text.value === '验证失败'" :style="{ fontSize: '16px', color: VA.barTextColor.value, marginRight: '6px' }" />
97
+ <span class="verify-msg">{{ VA.text.value }}</span>
98
+ </div>
99
+ </div>
100
+ </div>
101
+ </template>
102
+
103
+ <style scoped>
104
+ .verify-tips {
105
+ position: absolute;
106
+ bottom:0;
107
+ left:0;
108
+ right:0;
109
+ z-index:7;
110
+ height: 30px;
111
+ line-height:30px;
112
+ color: #fff;
113
+ padding-left:8px;
114
+ opacity: 1;
115
+ }
116
+ .suc-bg {
117
+ background-color: rgba(92, 184, 92, 0.5);
118
+ filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#7f5CB85C, endcolorstr=#7f5CB85C);
119
+ }
120
+ .err-bg {
121
+ background-color: rgba(217, 83, 79, 0.5);
122
+ filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#7fD9534F, endcolorstr=#7fD9534F);
123
+ }
124
+
125
+ /* ---------------------------- */
126
+ /*点文字验证码*/
127
+ .verify-bar-area {
128
+ position: relative;
129
+ box-sizing: border-box;
130
+ border: 1px solid #e4e7eb;
131
+ background-color: #f7f9fa;
132
+ border-radius: 2px;
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: center;
136
+ }
137
+
138
+ .verify-bar-area .verify-move-block {
139
+ position: absolute;
140
+ top: 0px;
141
+ left: 0;
142
+ box-sizing: border-box;
143
+ cursor: pointer;
144
+ background-color: #fff;
145
+ border-radius: 2px;
146
+ box-shadow: 0 0 3px rgba(0,0,0,.3);
147
+ transition: background .2s linear;
148
+ display: flex;
149
+ align-items: center;
150
+ justify-content: center;
151
+ }
152
+
153
+ .verify-bar-area .verify-move-block:hover {
154
+ background-color: #1991fa;
155
+ }
156
+
157
+ .verify-bar-area .verify-move-block:hover .verify-icon {
158
+ color: #fff;
159
+ }
160
+
161
+ .verify-bar-area .verify-left-bar {
162
+ position: absolute;
163
+ top: -1px;
164
+ left: -1px;
165
+ box-sizing: border-box;
166
+ cursor: pointer;
167
+ background-color: #7bbaf1;
168
+ border: 1px solid #1991fa;
169
+ }
170
+
171
+ .verify-img-panel {
172
+ width: 100%;
173
+ position: relative;
174
+ box-sizing: border-box;
175
+ margin: 0;
176
+ border: 1px solid #ddd;
177
+ border-radius: 3px;
178
+ }
179
+
180
+ .verify-img-panel .verify-refresh {
181
+ position: absolute;
182
+ top: 0;
183
+ right: 0;
184
+ z-index: 2;
185
+ width: 30px;
186
+ height: 30px;
187
+ text-align: center;
188
+ cursor: pointer;
189
+ background-color: rgba(0,0,0,0.12);
190
+ line-height: 30px;
191
+ }
192
+
193
+ .verify-img-panel .icon-refresh {
194
+ font-size: 20px;
195
+ color: #fff;
196
+ }
197
+
198
+ .verify-bar-area .verify-move-block .verify-sub-block {
199
+ position: absolute;
200
+ z-index: 3;
201
+ text-align: center;
202
+ left:0px;
203
+ }
204
+
205
+ .verify-bar-area .verify-move-block .verify-icon {
206
+ font-size: 18px;
207
+ }
208
+
209
+ .verify-bar-area .verify-msg {
210
+ z-index: 3;
211
+ }
212
+
213
+ .pubinfo-m-normal .verify-img-out {
214
+ width: 100%;
215
+ position: absolute;
216
+ bottom: 20px;
217
+ opacity: 0;
218
+ transition: opacity 0.5s, bottom 0.5s;
219
+ }
220
+ .pubinfo-m-touch .verify-img-out {
221
+ bottom: 40px;
222
+ opacity: 1;
223
+ }
224
+ </style>
@@ -0,0 +1,55 @@
1
+ <script setup lang="ts">
2
+ import type { RESULT } from './common/checkEvent.ts';
3
+ import { useToggle } from '@vueuse/core';
4
+ import { ref, useAttrs } from 'vue';
5
+ import Fixed from './PubinfoFixedPoint.vue';
6
+
7
+ export interface PubinfoPopPointProps {
8
+ onSuccess?: (data: RESULT) => void
9
+ }
10
+
11
+ defineOptions({
12
+ name: 'PubinfoPopPoint',
13
+ });
14
+
15
+ const props = withDefaults(defineProps<PubinfoPopPointProps>(), {});
16
+
17
+ const attrs = useAttrs();
18
+
19
+ // 双向绑定
20
+ const open = defineModel<boolean>('open');
21
+
22
+ const setOpen = useToggle(open);
23
+
24
+ const showBox = ref<boolean>(false);
25
+
26
+ function onOpen() {
27
+ setOpen(true);
28
+ }
29
+
30
+ function onSuccess(data: RESULT) {
31
+ props.onSuccess?.(data);
32
+ }
33
+
34
+ defineExpose({
35
+ open: onOpen,
36
+ });
37
+ </script>
38
+
39
+ <template>
40
+ <div>
41
+ <a-modal
42
+ v-bind="attrs"
43
+ v-model:open="open"
44
+ title="请完成安全验证"
45
+ :width="370"
46
+ :z-index="1101"
47
+ :destroy-on-close="true"
48
+ :footer="false"
49
+ centered
50
+ :mask-closable="false"
51
+ >
52
+ <Fixed @success="onSuccess" />
53
+ </a-modal>
54
+ </div>
55
+ </template>
@@ -0,0 +1,73 @@
1
+ <script setup lang="ts">
2
+ import { onMounted, ref } from 'vue';
3
+ import ClickImage from '@/images/click.png';
4
+ import { useTouchService } from './common/touchService.ts';
5
+
6
+ import Fixed from './PubinfoFixedPoint.vue';
7
+
8
+ const emit = defineEmits(['success']);
9
+
10
+ const { onButtonAreaMouseLeave, onMouseEnter, onMouseLeave, handleSubmit, showButton, isSuccess, inArea } = useTouchService();
11
+
12
+ const pubinfoMMRef = ref<any>(null);
13
+
14
+ onMounted(() => {
15
+ showButton.value = true;
16
+ isSuccess.value = false;
17
+ inArea.value = false;
18
+ });
19
+
20
+ function onSubmit(data: any) {
21
+ handleSubmit(data, emit);
22
+ }
23
+
24
+ defineExpose({
25
+ refresh: () => {
26
+ showButton.value = true;
27
+ isSuccess.value = false;
28
+ inArea.value = false;
29
+ pubinfoMMRef.value.refresh();
30
+ },
31
+ });
32
+ </script>
33
+
34
+ <template>
35
+ <div relative h-40px class="w-100%">
36
+ <div absolute bottom-0 left-0 right-0 z-99999 class="pubinfo-m-normal" :class="{ 'pubinfo-m-touch': !showButton }" @mouseleave="onMouseLeave">
37
+ <div absolute bottom-0 w-full>
38
+ <Fixed ref="pubinfoMMRef" @success="onSubmit" />
39
+ </div>
40
+ </div>
41
+ <div class="button_touch" :class="{ 'pubinfo-m-success': isSuccess }" flex justify-center items-center @mouseenter="onMouseEnter" @mouseleave="onButtonAreaMouseLeave">
42
+ <CheckOutlined v-if="isSuccess" :style="{ fontSize: '16px', color: 'rgb(82, 204, 186)', marginRight: '6px' }" />
43
+ <img v-else :src="ClickImage" alt="" style="width:18px;height:18px;margin-right:8px">
44
+ <span>{{ isSuccess ? '验证成功' : '点此进行验证' }}</span>
45
+ </div>
46
+ </div>
47
+ </template>
48
+
49
+ <style scoped>
50
+ .button_touch {
51
+ width: 100%;
52
+ height: 40px;
53
+ border-radius: 2px;
54
+ background: linear-gradient(180deg, #fff 0, #ebedf0 87%);
55
+ border: 1px solid #e4e7eb;
56
+ cursor: pointer;
57
+ font-size: 14px;
58
+ color: #45494c;
59
+ }
60
+ .pubinfo-m-normal {
61
+ visibility: hidden;
62
+ transition: visibility 0.2s;
63
+ }
64
+ .pubinfo-m-touch{
65
+ visibility: visible;
66
+ }
67
+ .pubinfo-m-success{
68
+ color: rgb(82, 204, 186);
69
+ background: rgb(210, 244, 239);
70
+ border-color: rgb(82, 204, 186);
71
+ cursor: default;
72
+ }
73
+ </style>
@@ -0,0 +1,72 @@
1
+ import { postAuthCaptchaCheck } from '@/api/modules/auth/renzhengfuwu';
2
+ import { aesEncrypt } from '../../aes';
3
+ import { refresh } from './initFuns.ts';
4
+
5
+ export interface RESULT {
6
+ captchaVerification: string
7
+ captchaType: string
8
+ }
9
+
10
+ export function canvasClick(e: any, canvas: any, VA: any, callback: any) {
11
+ const pointObj = getMousePos(canvas, e);
12
+ VA.checkPosArr.push(pointObj);
13
+ VA.tempPoints.push(Object.assign({}, pointObj));
14
+ VA.num.value = VA.num.value + 1;
15
+ if (VA.num.value === VA.checkNum) {
16
+ VA.bindingClick.value = false;
17
+ // 按比例转换坐标值
18
+ const arr = pointTransfrom(VA.checkPosArr, VA.realImgSize.value);
19
+ VA.checkPosArr.length = 0;
20
+ VA.checkPosArr.push(...arr);
21
+ // 发送后端请求
22
+ const captchaVerification = VA.secretKey.value ? aesEncrypt(`${VA.backToken.value}---${JSON.stringify(VA.checkPosArr)}`, VA.secretKey.value) : `${VA.backToken.value}---${JSON.stringify(VA.checkPosArr)}`;
23
+ const data = {
24
+ captchaType: 'clickWord',
25
+ pointJson: VA.secretKey.value ? aesEncrypt(JSON.stringify(VA.checkPosArr), VA.secretKey.value) : JSON.stringify(VA.checkPosArr),
26
+ token: VA.backToken.value,
27
+ };
28
+ postAuthCaptchaCheck(data).then((res) => {
29
+ if (res.success) {
30
+ VA.barTextColor.value = '#52ccba';
31
+ VA.barAreaBorderColor.value = '#52ccba';
32
+ VA.barBackgroundColor.value = '#d2f4ef';
33
+ VA.showRefresh.value = false;
34
+ VA.text.value = '验证成功';
35
+ VA.bindingClick.value = false;
36
+ const params: RESULT = {
37
+ captchaVerification,
38
+ // token: secretKey.value ? aesEncrypt(backToken.value, secretKey.value) : aesEncrypt(backToken.value),
39
+ captchaType: 'clickWord',
40
+ };
41
+ setTimeout(() => {
42
+ // emit('success', params);
43
+ callback(params);
44
+ }, 100);
45
+ }
46
+ }).catch(() => {
47
+ VA.barTextColor.value = '#f57a7a';
48
+ VA.barAreaBorderColor.value = '#f57a7a';
49
+ VA.barBackgroundColor.value = '#fce1e1';
50
+ VA.text.value = '验证失败';
51
+ setTimeout(() => {
52
+ refresh(VA);
53
+ }, 200);
54
+ });
55
+ }
56
+ };
57
+ // 获取坐标
58
+ function getMousePos(obj: any, e: any) {
59
+ const x = e.offsetX;
60
+ const y = e.offsetY;
61
+ return { x, y };
62
+ };
63
+
64
+ // 坐标转换函数
65
+ function pointTransfrom(pointArr: any[], imgSize: any) {
66
+ const newPointArr = pointArr.map((p) => {
67
+ const x = Math.round(310 * p.x / Number.parseInt(imgSize.width));
68
+ const y = Math.round(155 * p.y / Number.parseInt(imgSize.height));
69
+ return { x, y };
70
+ });
71
+ return newPointArr;
72
+ };
@@ -0,0 +1,44 @@
1
+ import { postAuthCaptchaGet } from '@/api/modules/auth/renzhengfuwu';
2
+
3
+ export function init(VA: any) {
4
+ // 加载页面
5
+ VA.tempPoints.splice(0, VA.tempPoints.length);
6
+ VA.checkPosArr.splice(0, VA.checkPosArr.length);
7
+ VA.num.value = 0;
8
+ getPicture(VA);
9
+ };
10
+
11
+ export function refresh(VA: any) {
12
+ VA.tempPoints.splice(0, VA.tempPoints.length);
13
+ VA.barTextColor.value = 'rgba(0,0,0,0.88)';
14
+ VA.barBackgroundColor.value = '#f7f9fa';
15
+ VA.barAreaBorderColor.value = '#e4e7eb';
16
+ VA.bindingClick.value = true;
17
+ VA.checkPosArr.splice(0, VA.checkPosArr.length);
18
+ VA.num.value = 0;
19
+ getPicture(VA);
20
+ VA.text.value = '验证失败';
21
+ VA.showRefresh.value = true;
22
+ };
23
+
24
+ // 请求背景图片和验证图片
25
+ function getPicture(VA: any) {
26
+ const data = {
27
+ captchaType: 'clickWord',
28
+ size: '320*160',
29
+ };
30
+ postAuthCaptchaGet(data).then((res: any) => {
31
+ if (res.success) {
32
+ const captchaMessage = JSON.parse(res.data.plaintext);
33
+ // console.log('postAuthCaptchaGet---> ', res.data.key, captchaMessage);
34
+ VA.pointBackImgBase.value = captchaMessage.originalImageBase64;
35
+ VA.backToken.value = captchaMessage.token;
36
+ VA.secretKey.value = captchaMessage.secretKey;
37
+ VA.poinTextList.value = captchaMessage.wordList;
38
+ VA.text.value = `请依次点击【${VA.poinTextList.value.join(',')}】`;
39
+ }
40
+ else {
41
+ VA.text.value = res.repMsg;
42
+ }
43
+ });
44
+ }
@@ -0,0 +1,53 @@
1
+ import { ref } from 'vue';
2
+ // import { refreshFixedPoint } from './initFuns.ts';
3
+ // 定义提交处理函数的类型
4
+ export type EmitFunction = (event: 'success', data: any) => void;
5
+
6
+ export function useTouchService() {
7
+ const showButton = ref<boolean>(true);
8
+ const isSuccess = ref<boolean>(false);
9
+ const inArea = ref<boolean>(false);
10
+
11
+ function handleSubmit(data: any, emit: EmitFunction) {
12
+ showButton.value = true;
13
+ isSuccess.value = true;
14
+ emit('success', data);
15
+ }
16
+
17
+ function onMouseEnter() {
18
+ inArea.value = true;
19
+ setTimeout(() => {
20
+ if (!isSuccess.value && inArea.value) {
21
+ showButton.value = false;
22
+ }
23
+ }, 300);
24
+ }
25
+
26
+ function onMouseLeave() {
27
+ // 当已经校验成功时,不做任何操作(也看不到验证码图片)
28
+ if (!isSuccess.value) {
29
+ showButton.value = true;
30
+ }
31
+ }
32
+
33
+ function onButtonAreaMouseLeave() {
34
+ inArea.value = false;
35
+ }
36
+
37
+ return {
38
+ showButton,
39
+ isSuccess,
40
+ inArea,
41
+ handleSubmit,
42
+ onMouseEnter,
43
+ onMouseLeave,
44
+ onButtonAreaMouseLeave,
45
+ };
46
+ }
47
+
48
+ // export function refreshTouchPoint() {
49
+ // showButton.value = true;
50
+ // isSuccess.value = false;
51
+ // inArea.value = false;
52
+ // refreshFixedPoint();
53
+ // }
@@ -0,0 +1,76 @@
1
+ import { reactive, ref } from 'vue';
2
+
3
+ export function variable() {
4
+ // 后端返回的ase加密秘钥
5
+ const secretKey = ref('');
6
+ // 默认需要点击的字数
7
+ const checkNum = 3;
8
+ // 选中的坐标信息
9
+ // const fontPos = reactive<any[]>([]);
10
+ // 用户点击的坐标
11
+ const checkPosArr = reactive<any[]>([]);
12
+ // 点击的记数
13
+ const num = ref(0);
14
+ // 后端获取到的背景图片
15
+ const pointBackImgBase = ref('');
16
+ // 后端返回的点击字体顺序
17
+ const poinTextList = ref<any[]>([]);
18
+ // 后端返回的token值
19
+ const backToken = ref('');
20
+ // 图片与滑动区域的宽高
21
+ const setSize = ref({
22
+ imgHeight: '160px',
23
+ imgWidth: '100%',
24
+ barHeight: '40px',
25
+ });
26
+ const realImgSize = ref({
27
+ width: 0,
28
+ height: 0,
29
+ });
30
+ // 图片上显示的点击位置
31
+ const tempPoints = reactive<any[]>([]);
32
+ // 下方的文字显示
33
+ const text = ref('');
34
+ // 下方文字显示颜色
35
+ const barTextColor = ref('rgba(0,0,0,0.88)');
36
+ // 下方的背景色
37
+ const barBackgroundColor = ref('#f7f9fa');
38
+ // 下方的边框色
39
+ const barAreaBorderColor = ref('#e4e7eb');
40
+ // 是否展示刷新按钮
41
+ const showRefresh = ref(true);
42
+ // 是否绑定点击事件
43
+ const bindingClick = ref(true);
44
+
45
+ return {
46
+ secretKey,
47
+ // setSecretKey,
48
+ checkNum,
49
+ checkPosArr,
50
+ // setCheckPosArr,
51
+ num,
52
+ // setNum,
53
+ pointBackImgBase,
54
+ // setPointBackImgBase,
55
+ poinTextList,
56
+ // setPoinTextList,
57
+ backToken,
58
+ // setBackToken,
59
+ setSize,
60
+ realImgSize,
61
+ tempPoints,
62
+ // setTempPoints,
63
+ text,
64
+ // setText,
65
+ barTextColor,
66
+ // setBarTextColor,
67
+ barBackgroundColor,
68
+ // setBarBackgroundColor,
69
+ barAreaBorderColor,
70
+ // setBarAreaBorderColor,
71
+ showRefresh,
72
+ // setShowRefresh,
73
+ bindingClick,
74
+ // setBindingClick,
75
+ };
76
+ }
@@ -0,0 +1,34 @@
1
+ import { createApp, h } from 'vue';
2
+
3
+ import PubinfoPopPoint from './PubinfoPopPoint.vue';
4
+
5
+ export function pubinfoPopPoint(): Promise<any> {
6
+ return new Promise((resolve) => {
7
+ const app = createApp({
8
+ render() {
9
+ return h(PubinfoPopPoint, {
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
+ }