替换var 为const/let

删除未使用import
替换 == 为 ===
This commit is contained in:
xingyu4j
2022-11-08 13:31:08 +08:00
parent c9e11e7636
commit 011dc23699
66 changed files with 305 additions and 319 deletions

File diff suppressed because one or more lines are too long

View File

@@ -58,7 +58,7 @@
* VerifyPoints
* @description 点选
* */
import { resetSize, _code_chars, _code_color1, _code_color2 } from './../utils/util'
import { resetSize } from './../utils/util'
import { aesEncrypt } from '@/utils/ase'
import { reqGet, reqCheck } from './../api/index'
@@ -167,7 +167,7 @@ export default {
setTimeout(() => {
// var flag = this.comparePos(this.fontPos, this.checkPosArr);
// 发送后端请求
var captchaVerification = this.secretKey ? aesEncrypt(this.backToken + '---' + JSON.stringify(this.checkPosArr), this.secretKey) : this.backToken + '---' + JSON.stringify(this.checkPosArr)
const captchaVerification = this.secretKey ? aesEncrypt(this.backToken + '---' + JSON.stringify(this.checkPosArr), this.secretKey) : this.backToken + '---' + JSON.stringify(this.checkPosArr)
const data = {
captchaType: this.captchaType,
'pointJson': this.secretKey ? aesEncrypt(JSON.stringify(this.checkPosArr), this.secretKey) : JSON.stringify(this.checkPosArr),
@@ -205,8 +205,8 @@ export default {
// 获取坐标
getMousePos: function(obj, e) {
var x = e.offsetX
var y = e.offsetY
const x = e.offsetX
const y = e.offsetY
return { x, y }
},
// 创建坐标点
@@ -253,7 +253,7 @@ export default {
},
// 坐标转换函数
pointTransfrom(pointArr, imgSize) {
var newPointArr = pointArr.map(p => {
const newPointArr = pointArr.map(p => {
const x = Math.round(310 * p.x / parseInt(imgSize.imgWidth))
const y = Math.round(155 * p.y / parseInt(imgSize.imgHeight))
return { x, y }

View File

@@ -193,7 +193,7 @@ export default {
this.$parent.$emit('ready', this)
})
var _this = this
const _this = this
window.removeEventListener('touchmove', function(e) {
_this.move(e)
@@ -228,11 +228,12 @@ export default {
// 鼠标按下
start: function(e) {
let x
e = e || window.event
if (!e.touches) { // 兼容PC端
var x = e.clientX
x = e.clientX
} else { // 兼容移动端
var x = e.touches[0].pageX
x = e.touches[0].pageX
}
this.startLeft = Math.floor(x - this.barArea.getBoundingClientRect().left)
this.startMoveTime = +new Date() // 开始滑动的时间
@@ -247,15 +248,16 @@ export default {
},
// 鼠标移动
move: function(e) {
let x
e = e || window.event
if (this.status && this.isEnd === false) {
if (!e.touches) { // 兼容PC端
var x = e.clientX
x = e.clientX
} else { // 兼容移动端
var x = e.touches[0].pageX
x = e.touches[0].pageX
}
var bar_area_left = this.barArea.getBoundingClientRect().left
var move_block_left = x - bar_area_left // 小方块相对于父元素的left值
const bar_area_left = this.barArea.getBoundingClientRect().left
let move_block_left = x - bar_area_left // 小方块相对于父元素的left值
if (move_block_left >= this.barArea.offsetWidth - parseInt(parseInt(this.blockSize.width) / 2) - 2) {
move_block_left = this.barArea.offsetWidth - parseInt(parseInt(this.blockSize.width) / 2) - 2
}
@@ -271,10 +273,10 @@ export default {
// 鼠标松开
end: function() {
this.endMovetime = +new Date()
var _this = this
const _this = this
// 判断是否重合
if (this.status && this.isEnd === false) {
var moveLeftDistance = parseInt((this.moveBlockLeft || '').replace('px', ''))
const moveLeftDistance = parseInt((this.moveBlockLeft || '').replace('px', ''))
moveLeftDistance = moveLeftDistance * 310 / parseInt(this.setSize.imgWidth)
const data = {
captchaType: this.captchaType,
@@ -297,7 +299,10 @@ export default {
}
this.passFlag = true
this.tipWords = `${((this.endMovetime - this.startMoveTime) / 1000).toFixed(2)}s验证成功`
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 })
const captchaVerification = this.secretKey ? aesEncrypt(this.backToken + '---' + JSON.stringify({
x: moveLeftDistance,
y: 5.0
}), this.secretKey) : this.backToken + '---' + JSON.stringify({ x: moveLeftDistance, y: 5.0 })
setTimeout(() => {
this.tipWords = ''
this.$parent.closeBox()

View File

@@ -21,8 +21,7 @@ service.interceptors.request.use(
// response interceptor
service.interceptors.response.use(
response => {
const res = response.data
return res
return response.data
},
error => {
}