fhrons-mobile-next 2.0.0 → 2.0.2
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/.env.poc +8 -0
- package/assets/css/colors.js +6 -0
- package/assets/css/customVant.less +60 -0
- package/assets/css/extra.css +32 -0
- package/assets/css/global.css +1 -0
- package/assets/css/global.less +1637 -0
- package/assets/css/index.js +63 -0
- package/assets/css/static.less +607 -0
- package/assets/js/func.js +361 -0
- package/assets/js/globalData.js +18 -0
- package/assets/js/qywxapi.js +484 -0
- package/{packages → assets/js}/storage.js +1 -20
- package/assets/js/upload.js +269 -0
- package/assets/js/validate.js +48 -0
- package/assets/js/vant.js +39 -0
- package/assets/js/wxapi.js +297 -0
- package/assets/vantLang/index.js +172 -0
- package/assets/vantLang/lib/en-US.js +95 -0
- package/assets/vantLang/lib/es-ES.js +95 -0
- package/assets/vantLang/lib/pt-PT.js +96 -0
- package/assets/vantLang/lib/zh-CN.js +96 -0
- package/assets/vantLang/lib/zh-HK.js +96 -0
- package/assets/vantLang/locales/en_US.js +102 -0
- package/assets/vantLang/locales/es_ES.js +102 -0
- package/assets/vantLang/locales/index.js +12 -0
- package/assets/vantLang/locales/pt_PT.js +102 -0
- package/assets/vantLang/locales/zh_CN.js +102 -0
- package/assets/vantLang/locales/zh_T.js +102 -0
- package/babel.config.js +15 -0
- package/index.js +68 -33
- package/inject-env-plugin.js +29 -0
- package/package.json +46 -32
- package/packages/areaMobile/index.js +5 -0
- package/packages/areaMobile/index.vue +260 -0
- package/packages/autoGraph/VueEsign.vue +309 -0
- package/packages/autoGraph/index.js +5 -0
- package/packages/autoGraph/index.vue +472 -0
- package/packages/commonForm/CommonAsyncAreaPicker.vue +223 -0
- package/packages/commonForm/CommonDatePicker.vue +152 -0
- package/packages/commonForm/CommonForm.vue +786 -0
- package/packages/commonForm/CommonFullTimePicker.vue +137 -0
- package/packages/commonForm/CommonSinglePicker.vue +121 -0
- package/packages/commonForm/CommonYearMonthPicker.vue +127 -0
- package/packages/commonForm/index.js +33 -0
- package/packages/dialog/index.js +32 -0
- package/packages/dialog/index.vue +379 -0
- package/packages/index.js +7 -3
- package/packages/introduce/index.js +5 -0
- package/packages/introduce/index.vue +31 -0
- package/packages/loading/Loading.vue +70 -0
- package/packages/loading/index.js +43 -0
- package/packages/mindMap/index.js +5 -0
- package/packages/mindMap/index.vue +437 -0
- package/packages/pdfViewer/index.js +12 -0
- package/packages/pdfViewer/index.vue +131 -0
- package/packages/sharePanel/SheetPanel.vue +316 -0
- package/packages/sharePanel/index.js +5 -0
- package/packages/sharePanel/index.vue +476 -0
- package/packages/sharePanel/props.js +58 -0
- package/packages/sharePanel/utils/QyWxShareMixin.js +93 -0
- package/packages/sharePanel/utils/shareWay.js +81 -0
- package/packages/theme/index copy.js +89 -0
- package/packages/theme/index.js +38 -0
- package/packages/theme/theme.css +910 -0
- package/packages/theme/theme.less +26 -0
- package/packages/uploadFile/VanUploadFile.vue +80 -0
- package/packages/uploadFile/index.js +5 -0
- package/packages/uploadFile/index.vue +725 -0
- package/packages/uploadFile/vanUpload.js +5 -0
- package/packages/verify/Verify/VerifyPoints.vue +247 -0
- package/packages/verify/Verify/VerifySlide.vue +364 -0
- package/packages/verify/index.js +5 -0
- package/packages/verify/index.vue +416 -0
- package/packages/verify/utils/verify.js +53 -0
- package/packages/videoPage/index.js +5 -0
- package/packages/videoPage/index.vue +440 -0
- package/plugins/sensors/fhsensors.js +84 -0
- package/plugins/sensors/sensors.js +175 -0
- package/plugins/sensors/sensorsFun.js +1387 -0
- package/fhrons-mobile-next-2.0.0.tgz +0 -0
- package/packages/fhImage/index.js +0 -5
- package/packages/fhImage/index.vue +0 -57
- package/packages/fhPresetImage/index.js +0 -5
- package/packages/fhPresetImage/index.vue +0 -39
- package/packages/html2canvas/index.js +0 -29
- package/upload copy.js +0 -468
- package/utils/tools.js +0 -22
- /package/{dist → fhcommon/dist}/fhcommon.min.js +0 -0
- /package/{dist → fhcommon/dist}/fhcommon.min.js.LICENSE.txt +0 -0
- /package/{upload.js → fhcommon/upload.js} +0 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="verifyPoints" style="position: relative">
|
|
3
|
+
<div class="verify-img-out">
|
|
4
|
+
<div
|
|
5
|
+
class="verify-img-panel"
|
|
6
|
+
:style="{'width': setSize.imgWidth, 'height': setSize.imgHeight, 'background-size' : setSize.imgWidth + ' '+ setSize.imgHeight, 'margin-bottom': vSpace + 'px'}"
|
|
7
|
+
>
|
|
8
|
+
<img ref="canvas" :src="pointBackImgBase?('data:image/png;base64,'+pointBackImgBase):defaultImg" alt="" style="width:100%;height:100%;display:block" @click="bindingClick?canvasClick($event):undefined">
|
|
9
|
+
<div
|
|
10
|
+
v-for="(tempPoint, index) in tempPoints"
|
|
11
|
+
:key="index"
|
|
12
|
+
class="point-area"
|
|
13
|
+
:style="{
|
|
14
|
+
'background-color':'#1abd6c',
|
|
15
|
+
color:'#fff',
|
|
16
|
+
'z-index':9999,
|
|
17
|
+
width:'14px',
|
|
18
|
+
height:'14px',
|
|
19
|
+
'text-align':'center',
|
|
20
|
+
'line-height':'14px',
|
|
21
|
+
'border-radius': '50%',
|
|
22
|
+
position:'absolute',
|
|
23
|
+
top:parseInt(tempPoint.y-5) + 'px',
|
|
24
|
+
left:parseInt(tempPoint.x-5) + 'px'
|
|
25
|
+
}"
|
|
26
|
+
>
|
|
27
|
+
{{ index + 1 }}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<div class="verify-bar-area" :style="{'width': setSize.imgWidth, 'color': this.barAreaColor, }">
|
|
33
|
+
<span class="verify-msg">{{ text }}</span>
|
|
34
|
+
</div>
|
|
35
|
+
<div v-show="showRefresh" class="verify-refresh c-7f808a ta-c ft14" @click="refresh">{{$t('verify.verifypoints.llx1vr')}}<i class="iconfont icon-refresh icon-shuaxin ml6" />
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
<script type="text/babel">
|
|
40
|
+
import { resetSize,aesEncrypt } from '../utils/verify';
|
|
41
|
+
|
|
42
|
+
export default {
|
|
43
|
+
name: 'VerifyPoints',
|
|
44
|
+
props: {
|
|
45
|
+
// 弹出式pop,固定fixed
|
|
46
|
+
mode: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: 'fixed'
|
|
49
|
+
},
|
|
50
|
+
captchaType: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: ''
|
|
53
|
+
},
|
|
54
|
+
// 间隔
|
|
55
|
+
vSpace: {
|
|
56
|
+
type: Number,
|
|
57
|
+
default: 5
|
|
58
|
+
},
|
|
59
|
+
imgSize: {
|
|
60
|
+
type: Object,
|
|
61
|
+
default() {
|
|
62
|
+
return {
|
|
63
|
+
width: '310px',
|
|
64
|
+
height: '155px'
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
barSize: {
|
|
69
|
+
type: Object,
|
|
70
|
+
default() {
|
|
71
|
+
return {
|
|
72
|
+
width: '310px',
|
|
73
|
+
height: '40px'
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
defaultImg: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: ''
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
data() {
|
|
83
|
+
return {
|
|
84
|
+
secretKey: '', // 后端返回的ase加密秘钥
|
|
85
|
+
checkNum: 3, // 默认需要点击的字数
|
|
86
|
+
fontPos: [], // 选中的坐标信息
|
|
87
|
+
checkPosArr: [], // 用户点击的坐标
|
|
88
|
+
num: 1, // 点击的记数
|
|
89
|
+
pointBackImgBase: '', // 后端获取到的背景图片
|
|
90
|
+
poinTextList: [], // 后端返回的点击字体顺序
|
|
91
|
+
backToken: '', // 后端返回的token值
|
|
92
|
+
setSize: {
|
|
93
|
+
imgHeight: 0,
|
|
94
|
+
imgWidth: 0,
|
|
95
|
+
barHeight: 0,
|
|
96
|
+
barWidth: 0
|
|
97
|
+
},
|
|
98
|
+
tempPoints: [],
|
|
99
|
+
text: '',
|
|
100
|
+
barAreaColor: undefined,
|
|
101
|
+
barAreaBorderColor: undefined,
|
|
102
|
+
showRefresh: true,
|
|
103
|
+
bindingClick: true
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
computed: {
|
|
107
|
+
resetSize() {
|
|
108
|
+
return resetSize;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
watch: {
|
|
112
|
+
// type变化则全面刷新
|
|
113
|
+
type: {
|
|
114
|
+
immediate: true,
|
|
115
|
+
deep: true,
|
|
116
|
+
handler() {
|
|
117
|
+
this.initPointsData();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
mounted() {
|
|
122
|
+
// 禁止拖拽
|
|
123
|
+
this.$el.onselectstart = function() {
|
|
124
|
+
return false;
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
methods: {
|
|
128
|
+
initPointsData() {
|
|
129
|
+
// 加载页面
|
|
130
|
+
this.fontPos.splice(0, this.fontPos.length);
|
|
131
|
+
this.checkPosArr.splice(0, this.checkPosArr.length);
|
|
132
|
+
this.num = 1;
|
|
133
|
+
this.getPictrue();
|
|
134
|
+
this.$nextTick(() => {
|
|
135
|
+
this.setSize = this.resetSize(this); // 重新设置宽度高度
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
canvasClick(e) {
|
|
139
|
+
this.checkPosArr.push(this.getMousePos(this.$refs.canvas, e));
|
|
140
|
+
if (this.num === this.checkNum) {
|
|
141
|
+
this.num = this.createPoint(this.getMousePos(this.$refs.canvas, e));
|
|
142
|
+
// 按比例转换坐标值
|
|
143
|
+
this.checkPosArr = this.pointTransfrom(this.checkPosArr, this.setSize);
|
|
144
|
+
// 等创建坐标执行完
|
|
145
|
+
setTimeout(() => {
|
|
146
|
+
// 发送后端请求
|
|
147
|
+
const data = {
|
|
148
|
+
captchaType: this.captchaType,
|
|
149
|
+
'pointJson': this.secretKey ? aesEncrypt(JSON.stringify(this.checkPosArr), this.secretKey) : JSON.stringify(this.checkPosArr),
|
|
150
|
+
'token': this.backToken
|
|
151
|
+
};
|
|
152
|
+
axios.post(`/funapi/cbsmh/mhMessage/captcha/check`,data).then(res => {
|
|
153
|
+
if (res && res.repCode === '0000') {
|
|
154
|
+
this.barAreaColor = '#4cae4c';
|
|
155
|
+
this.barAreaBorderColor = '#5cb85c';
|
|
156
|
+
this.text = this.$t('verify.verifypoints.hv3ko8');
|
|
157
|
+
this.bindingClick = false;
|
|
158
|
+
if (this.mode === 'pop') {
|
|
159
|
+
const timer = setTimeout((timer) => {
|
|
160
|
+
this.$parent.clickShow = false;
|
|
161
|
+
this.refresh();
|
|
162
|
+
clearInterval(timer);
|
|
163
|
+
timer = null;
|
|
164
|
+
}, 1500);
|
|
165
|
+
}
|
|
166
|
+
var captchaVerification = this.secretKey ? aesEncrypt(this.backToken + '---' + JSON.stringify(this.checkPosArr), this.secretKey) : this.backToken + '---' + JSON.stringify(this.checkPosArr);
|
|
167
|
+
this.$emit('success', { captchaVerification });
|
|
168
|
+
} else {
|
|
169
|
+
this.endError(res)
|
|
170
|
+
}
|
|
171
|
+
}).catch(err=>{
|
|
172
|
+
this.endError(err)
|
|
173
|
+
});
|
|
174
|
+
}, 400);
|
|
175
|
+
}
|
|
176
|
+
if (this.num < this.checkNum) {
|
|
177
|
+
this.num = this.createPoint(this.getMousePos(this.$refs.canvas, e));
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
endError(res){
|
|
181
|
+
this.barAreaColor = '#d9534f';
|
|
182
|
+
this.barAreaBorderColor = '#d9534f';
|
|
183
|
+
this.text = res?.message||this.$t('verify.verifypoints.5c6mcj');
|
|
184
|
+
setTimeout(() => {
|
|
185
|
+
this.refresh();
|
|
186
|
+
}, 700);
|
|
187
|
+
},
|
|
188
|
+
// 获取坐标
|
|
189
|
+
getMousePos: function(obj, e) {
|
|
190
|
+
var x = e.offsetX;
|
|
191
|
+
var y = e.offsetY;
|
|
192
|
+
return { x, y };
|
|
193
|
+
},
|
|
194
|
+
// 创建坐标点
|
|
195
|
+
createPoint: function(pos) {
|
|
196
|
+
this.tempPoints.push(Object.assign({}, pos));
|
|
197
|
+
return ++this.num;
|
|
198
|
+
},
|
|
199
|
+
refresh: function() {
|
|
200
|
+
this.tempPoints.splice(0, this.tempPoints.length);
|
|
201
|
+
this.barAreaColor = '#000';
|
|
202
|
+
this.barAreaBorderColor = '#ddd';
|
|
203
|
+
this.bindingClick = true;
|
|
204
|
+
this.fontPos.splice(0, this.fontPos.length);
|
|
205
|
+
this.checkPosArr.splice(0, this.checkPosArr.length);
|
|
206
|
+
this.num = 1;
|
|
207
|
+
this.getPictrue();
|
|
208
|
+
this.text = '';
|
|
209
|
+
this.showRefresh = true;
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
// 请求背景图片和验证图片
|
|
213
|
+
getPictrue() {
|
|
214
|
+
const data = {
|
|
215
|
+
captchaType: this.captchaType,
|
|
216
|
+
clientUid: localStorage.getItem('point'),
|
|
217
|
+
ts: Date.now() // 现在的时间戳
|
|
218
|
+
};
|
|
219
|
+
axios.post(`/funapi/cbsmh/mhMessage/captcha/get`,data).then(res => {
|
|
220
|
+
if (res && res.repCode === '0000') {
|
|
221
|
+
this.pointBackImgBase = res.repData.originalImageBase64;
|
|
222
|
+
this.backToken = res.repData.token;
|
|
223
|
+
this.secretKey = res.repData.secretKey;
|
|
224
|
+
this.poinTextList = res.repData.wordList;
|
|
225
|
+
this.text =this.$t('verify.verifypoints.1g16ku')+this.poinTextList.join(',')+'】';
|
|
226
|
+
} else {
|
|
227
|
+
this.text = res.repMsg;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// 判断接口请求次数是否失效
|
|
231
|
+
if (res.repCode === '6201') {
|
|
232
|
+
this.pointBackImgBase = null;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
// 坐标转换函数
|
|
237
|
+
pointTransfrom(pointArr, imgSize) {
|
|
238
|
+
var newPointArr = pointArr.map(p => {
|
|
239
|
+
const x = Math.round(parseInt(this.imgSize.width) * p.x / parseInt(imgSize.imgWidth));
|
|
240
|
+
const y = Math.round(parseInt(this.imgSize.height) * p.y / parseInt(imgSize.imgHeight));
|
|
241
|
+
return { x, y };
|
|
242
|
+
});
|
|
243
|
+
return newPointArr;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
</script>
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="position: relative">
|
|
3
|
+
<div v-if="type === '2'" class="verify-img-out" :style="{height: (parseInt(setSize.imgHeight) + vSpace) + 'px'}">
|
|
4
|
+
<div class="verify-img-panel" :style="{ width: setSize.imgWidth, height: setSize.imgHeight }">
|
|
5
|
+
<img :src="backImgBase?('data:image/png;base64,'+backImgBase):defaultImg" alt="" style="width:100%;height:100%;display:block">
|
|
6
|
+
<transition name="tips">
|
|
7
|
+
<span v-if="tipWords" class="verify-tips" :class="passFlag ? 'suc-bg' : 'err-bg'">{{ tipWords }}</span>
|
|
8
|
+
</transition>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
<!-- 公共部分 -->
|
|
12
|
+
<div class="verify-bar-area" :style="{ width: setSize.imgWidth }">
|
|
13
|
+
<span class="verify-msg" v-text="text" />
|
|
14
|
+
<div class="verify-left-bar" :style="{width: (leftBarWidth!==undefined)?leftBarWidth: barSize.height, transaction: transitionWidth,'background-color':subColor}">
|
|
15
|
+
<span class="verify-msg" v-text="finishText" />
|
|
16
|
+
<div class="verify-move-block" :style="{ 'background-color': moveBlockBackgroundColor, left: moveBlockLeft, transition: transitionLeft, width: blockSize.width, height: blockSize.height }" @touchstart="start" @mousedown="start">
|
|
17
|
+
<i :class="['verify-icon iconfont', iconClass]" :style="{ color: iconColor }" />
|
|
18
|
+
<div v-if="type === '2'" class="verify-sub-block" :style="{'width':Math.floor(parseInt(setSize.imgWidth)*40/imgSize.width)+ 'px', 'height': setSize.imgHeight, 'top':'-' + (parseInt(setSize.imgHeight) + vSpace) + 'px', 'background-size': setSize.imgWidth + ' ' + setSize.imgHeight, }">
|
|
19
|
+
<img v-if="blockBackImgBase" :src="'data:image/png;base64,'+blockBackImgBase" alt="" style="width:100%;height:100%;display:block">
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div v-show="showRefresh" class="verify-refresh c-7f808a ta-c ft14" @click="refresh">{{ $t('signsale.productposter.42oq7s') }}<i class="iconfont icon-refresh icon-shuaxin ml6" />
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
<script type="text/babel">
|
|
29
|
+
import { resetSize, aesEncrypt } from "../utils/verify";
|
|
30
|
+
import { getStorage } from "../../../assets/js/storage";
|
|
31
|
+
export default {
|
|
32
|
+
name: "VerifySlide",
|
|
33
|
+
props: {
|
|
34
|
+
captchaType: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "",
|
|
37
|
+
},
|
|
38
|
+
type: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "1",
|
|
41
|
+
},
|
|
42
|
+
// 弹出式pop,固定fixed
|
|
43
|
+
mode: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "fixed",
|
|
46
|
+
},
|
|
47
|
+
vSpace: {
|
|
48
|
+
type: Number,
|
|
49
|
+
default: 5,
|
|
50
|
+
},
|
|
51
|
+
explain: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "",
|
|
54
|
+
},
|
|
55
|
+
imgSize: {
|
|
56
|
+
type: Object,
|
|
57
|
+
default() {
|
|
58
|
+
return {
|
|
59
|
+
width: "310px",
|
|
60
|
+
height: "155px",
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
blockSize: {
|
|
65
|
+
type: Object,
|
|
66
|
+
default() {
|
|
67
|
+
return {
|
|
68
|
+
width: "40px",
|
|
69
|
+
height: "25px",
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
barSize: {
|
|
74
|
+
type: Object,
|
|
75
|
+
default() {
|
|
76
|
+
return {
|
|
77
|
+
width: "310px",
|
|
78
|
+
height: "40px",
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
defaultImg: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: "",
|
|
85
|
+
},
|
|
86
|
+
showBox: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: false,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
data() {
|
|
92
|
+
return {
|
|
93
|
+
secretKey: "", // 后端返回的加密秘钥 字段
|
|
94
|
+
passFlag: "", // 是否通过的标识
|
|
95
|
+
backImgBase: "", // 验证码背景图片
|
|
96
|
+
blockBackImgBase: "", // 验证滑块的背景图片
|
|
97
|
+
backToken: "", // 后端返回的唯一token值
|
|
98
|
+
startMoveTime: "", // 移动开始的时间
|
|
99
|
+
endMovetime: "", // 移动结束的时间
|
|
100
|
+
tipsBackColor: "", // 提示词的背景颜色
|
|
101
|
+
tipWords: "",
|
|
102
|
+
text: "",
|
|
103
|
+
finishText: "",
|
|
104
|
+
setSize: {
|
|
105
|
+
imgHeight: 0,
|
|
106
|
+
imgWidth: 0,
|
|
107
|
+
barHeight: 0,
|
|
108
|
+
barWidth: 0,
|
|
109
|
+
},
|
|
110
|
+
top: 0,
|
|
111
|
+
left: 0,
|
|
112
|
+
moveBlockLeft: undefined,
|
|
113
|
+
leftBarWidth: undefined,
|
|
114
|
+
// 移动中样式
|
|
115
|
+
moveBlockBackgroundColor: getStorage({ name: "themeColor" }) || "#666",
|
|
116
|
+
leftBarBorderColor: "#ddd",
|
|
117
|
+
iconColor: undefined,
|
|
118
|
+
iconClass: "icon-right",
|
|
119
|
+
status: false, // 鼠标状态
|
|
120
|
+
isEnd: false, // 是够验证完成
|
|
121
|
+
showRefresh: true,
|
|
122
|
+
transitionLeft: "",
|
|
123
|
+
transitionWidth: "",
|
|
124
|
+
mainColor: getStorage({ name: 'themeColor' }) || '',
|
|
125
|
+
subColor: getStorage({ name: "themeColorObj" })?.subColor || "#888888",
|
|
126
|
+
timer: null
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
computed: {
|
|
130
|
+
barArea() {
|
|
131
|
+
return this.$el.querySelector(".verify-bar-area");
|
|
132
|
+
},
|
|
133
|
+
resetSize() {
|
|
134
|
+
return resetSize;
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
watch: {
|
|
138
|
+
// type变化则全面刷新
|
|
139
|
+
type: {
|
|
140
|
+
immediate: true,
|
|
141
|
+
deep: true,
|
|
142
|
+
handler() {
|
|
143
|
+
this.initSlideData();
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
showBox: {
|
|
147
|
+
immediate: true,
|
|
148
|
+
deep: true,
|
|
149
|
+
handler(val) {
|
|
150
|
+
if (this.subColor === "#888888") {
|
|
151
|
+
this.mainColor = getStorage({ name: "themeColor" }) || "#666";
|
|
152
|
+
this.subColor = getStorage({ name: "themeColorObj" })?.subColor || "#888888";
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
created() {},
|
|
158
|
+
mounted() {
|
|
159
|
+
// 禁止拖拽
|
|
160
|
+
this.$el.onselectstart = function () {
|
|
161
|
+
return false;
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
methods: {
|
|
165
|
+
initSlideData() {
|
|
166
|
+
this.text = this.explain;
|
|
167
|
+
this.getPictrue();
|
|
168
|
+
this.$nextTick(() => {
|
|
169
|
+
const setSize = this.resetSize(this); // 重新设置宽度高度
|
|
170
|
+
for (const key in setSize) {
|
|
171
|
+
this.$set(this.setSize, key, setSize[key]);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
var _this = this;
|
|
176
|
+
|
|
177
|
+
window.removeEventListener("touchmove", function (e) {
|
|
178
|
+
_this.move(e);
|
|
179
|
+
});
|
|
180
|
+
window.removeEventListener("mousemove", function (e) {
|
|
181
|
+
_this.move(e);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// 鼠标松开
|
|
185
|
+
window.removeEventListener("touchend", function () {
|
|
186
|
+
_this.end();
|
|
187
|
+
});
|
|
188
|
+
window.removeEventListener("mouseup", function () {
|
|
189
|
+
_this.end();
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
window.addEventListener("touchmove", function (e) {
|
|
193
|
+
_this.move(e);
|
|
194
|
+
});
|
|
195
|
+
window.addEventListener("mousemove", function (e) {
|
|
196
|
+
_this.move(e);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// 鼠标松开
|
|
200
|
+
window.addEventListener("touchend", function () {
|
|
201
|
+
_this.end();
|
|
202
|
+
});
|
|
203
|
+
window.addEventListener("mouseup", function () {
|
|
204
|
+
_this.end();
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
// 鼠标按下
|
|
209
|
+
start: function (e) {
|
|
210
|
+
e = e || window.event;
|
|
211
|
+
let x = 0;
|
|
212
|
+
if (!e.touches) {
|
|
213
|
+
// 兼容PC端
|
|
214
|
+
x = e.clientX;
|
|
215
|
+
} else {
|
|
216
|
+
// 兼容移动端
|
|
217
|
+
x = e.touches[0].pageX;
|
|
218
|
+
}
|
|
219
|
+
this.startLeft = Math.floor(x - this.barArea.getBoundingClientRect().left);
|
|
220
|
+
this.startMoveTime = +new Date(); // 开始滑动的时间
|
|
221
|
+
if (this.isEnd === false) {
|
|
222
|
+
this.text = "";
|
|
223
|
+
this.moveBlockBackgroundColor = this.mainColor;
|
|
224
|
+
this.leftBarBorderColor = this.mainColor;
|
|
225
|
+
this.iconColor = "#fff";
|
|
226
|
+
e.stopPropagation();
|
|
227
|
+
this.status = true;
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
// 鼠标移动
|
|
231
|
+
move: function (e) {
|
|
232
|
+
e = e || window.event;
|
|
233
|
+
if (this.status && this.isEnd === false) {
|
|
234
|
+
let x = 0;
|
|
235
|
+
if (!e.touches) {
|
|
236
|
+
// 兼容PC端
|
|
237
|
+
x = e.clientX;
|
|
238
|
+
} else {
|
|
239
|
+
// 兼容移动端
|
|
240
|
+
x = e.touches[0].pageX;
|
|
241
|
+
}
|
|
242
|
+
var bar_area_left = this.barArea.getBoundingClientRect().left;
|
|
243
|
+
var move_block_left = x - bar_area_left; // 小方块相对于父元素的left值
|
|
244
|
+
if (move_block_left >= this.barArea.offsetWidth - parseInt(this.blockSize.width) + this.startLeft) {
|
|
245
|
+
move_block_left = this.barArea.offsetWidth - parseInt(this.blockSize.width) + this.startLeft;
|
|
246
|
+
}
|
|
247
|
+
if (move_block_left <= this.startLeft) {
|
|
248
|
+
move_block_left = this.startLeft;
|
|
249
|
+
}
|
|
250
|
+
// 拖动后小方块的left值
|
|
251
|
+
this.moveBlockLeft = (move_block_left - this.startLeft) + 'px';
|
|
252
|
+
this.leftBarWidth = (move_block_left - this.startLeft) + 'px';
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
// 鼠标松开
|
|
257
|
+
end: function() {
|
|
258
|
+
this.endMovetime = +new Date();
|
|
259
|
+
var _this = this;
|
|
260
|
+
// 判断是否重合
|
|
261
|
+
if (this.status && this.isEnd === false) {
|
|
262
|
+
var moveLeftDistance = parseInt((this.moveBlockLeft || '').replace('px', ''));
|
|
263
|
+
moveLeftDistance = moveLeftDistance * 310 / parseInt(this.setSize.imgWidth);
|
|
264
|
+
const data = {
|
|
265
|
+
captchaType: this.captchaType,
|
|
266
|
+
'pointJson': this.secretKey ? aesEncrypt(JSON.stringify({ x: moveLeftDistance, y: 5.0 }), this.secretKey) : JSON.stringify({ x: moveLeftDistance, y: 5.0 }),
|
|
267
|
+
'token': this.backToken
|
|
268
|
+
};
|
|
269
|
+
axios.post(`/funapi/cbsmh/mhMessage/captcha/check`,data).then(res => {
|
|
270
|
+
if (res && res.repCode === '0000') {
|
|
271
|
+
this.moveBlockBackgroundColor = '#5cb85c';
|
|
272
|
+
this.leftBarBorderColor = '#5cb85c';
|
|
273
|
+
this.iconColor = '#fff';
|
|
274
|
+
this.iconClass = 'icon-zhengque';
|
|
275
|
+
this.isEnd = true;
|
|
276
|
+
if (this.mode === 'pop') {
|
|
277
|
+
const timer = setTimeout((timer) => {
|
|
278
|
+
this.$parent.clickShow = false;
|
|
279
|
+
this.refresh();
|
|
280
|
+
clearInterval(timer);
|
|
281
|
+
timer = null;
|
|
282
|
+
}, 1500);
|
|
283
|
+
}
|
|
284
|
+
this.passFlag = true;
|
|
285
|
+
this.tipWords = this.$t('verify.verifyslide.6dsw8j', [((this.endMovetime - this.startMoveTime) / 1000).toFixed(2)]);
|
|
286
|
+
var captchaVerification = this.secretKey ? aesEncrypt(this.backToken + '---' + JSON.stringify({ x: moveLeftDistance, y: 5.0 }), this.secretKey) : this.backToken + '---' + JSON.stringify({ x: moveLeftDistance, y: 5.0 });
|
|
287
|
+
this.timer = setTimeout(() => {
|
|
288
|
+
this.tipWords = '';
|
|
289
|
+
this.$emit('success', { captchaVerification });
|
|
290
|
+
this.$parent.closeBox();
|
|
291
|
+
clearInterval(this.timer);
|
|
292
|
+
this.timer = null;
|
|
293
|
+
}, 1000);
|
|
294
|
+
} else {
|
|
295
|
+
this.endError(res)
|
|
296
|
+
}
|
|
297
|
+
}).catch(err=>{
|
|
298
|
+
this.endError(err)
|
|
299
|
+
});
|
|
300
|
+
this.status = false;
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
endError(res){
|
|
304
|
+
this.moveBlockBackgroundColor = '#d9534f';
|
|
305
|
+
this.leftBarBorderColor = '#d9534f';
|
|
306
|
+
this.iconColor = '#fff';
|
|
307
|
+
this.iconClass = 'icon-guanbixian c-ffffff line-height32';
|
|
308
|
+
this.passFlag = false;
|
|
309
|
+
this.tipWords = res?.message||this.$t('verify.verifypoints.5c6mcj');
|
|
310
|
+
setTimeout(() => {
|
|
311
|
+
this.tipWords = '';
|
|
312
|
+
this.refresh();
|
|
313
|
+
}, 1000);
|
|
314
|
+
},
|
|
315
|
+
refresh: function () {
|
|
316
|
+
this.showRefresh = true;
|
|
317
|
+
this.finishText = "";
|
|
318
|
+
|
|
319
|
+
this.transitionLeft = "left .3s";
|
|
320
|
+
this.moveBlockLeft = 0;
|
|
321
|
+
|
|
322
|
+
this.leftBarWidth = undefined;
|
|
323
|
+
this.transitionWidth = "width .3s";
|
|
324
|
+
|
|
325
|
+
this.leftBarBorderColor = "#ddd";
|
|
326
|
+
this.moveBlockBackgroundColor = this.mainColor;
|
|
327
|
+
this.iconColor = "#000";
|
|
328
|
+
this.iconClass = "icon-right";
|
|
329
|
+
this.isEnd = false;
|
|
330
|
+
|
|
331
|
+
this.getPictrue();
|
|
332
|
+
setTimeout(() => {
|
|
333
|
+
this.transitionWidth = "";
|
|
334
|
+
this.transitionLeft = "";
|
|
335
|
+
this.text = this.explain;
|
|
336
|
+
}, 300);
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
// 请求背景图片和验证图片
|
|
340
|
+
getPictrue() {
|
|
341
|
+
const data = {
|
|
342
|
+
captchaType: this.captchaType,
|
|
343
|
+
clientUid: localStorage.getItem('slider'),
|
|
344
|
+
ts: Date.now() // 现在的时间戳
|
|
345
|
+
};
|
|
346
|
+
axios.post(`/funapi/cbsmh/mhMessage/captcha/get`,data).then(res => {
|
|
347
|
+
if (res && res.repCode === '0000') {
|
|
348
|
+
this.backImgBase = res.repData.originalImageBase64;
|
|
349
|
+
this.blockBackImgBase = res.repData.jigsawImageBase64;
|
|
350
|
+
this.backToken = res.repData.token;
|
|
351
|
+
this.secretKey = res.repData.secretKey;
|
|
352
|
+
} else {
|
|
353
|
+
this.tipWords = res ? res.repMsg : '';
|
|
354
|
+
}
|
|
355
|
+
// 判断接口请求次数是否失效
|
|
356
|
+
if (res && res.repCode === "6201") {
|
|
357
|
+
this.backImgBase = null;
|
|
358
|
+
this.blockBackImgBase = null;
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
};
|
|
364
|
+
</script>
|