Commit 99541d74 authored by 张毅辰's avatar 张毅辰

登录修改(验证码&加密)

parent df298467
......@@ -63,18 +63,20 @@ export function captchaImage() {
}
// 获取验证图片
export function reqGet(data) {
export function getBwCaptcha(params) {
const data = Qs.stringify(params)
return request({
url: '/captcha/get',
url: '/captcha/getBwCaptcha',
method: 'post',
data
})
}
// 滑动或者点选验证
export function reqCheck(data) {
export function checkBwCaptcha(params) {
const data = Qs.stringify(params)
return request({
url: '/captcha/check',
url: '/captcha/checkBwCaptcha',
method: 'post',
data
})
......
......@@ -18,7 +18,7 @@
<components
:is="componentType"
v-if="componentType"
:captcha-type="captchaType"
:captcha-type="componentType"
:type="verifyType"
ref="instance"
:figure="figure"
......
......@@ -78,7 +78,7 @@ import {
_code_color2
} from './../utils/util'
import { aesEncrypt } from './../utils/ase'
import { reqGet, reqCheck } from '@/api/login'
import { getBwCaptcha, checkBwCaptcha } from '@/api/login'
export default {
name: 'VerifyPoints',
......@@ -203,13 +203,14 @@ export default {
console.log('token', this.backToken)
console.log('大概是滑动数据(加密后 pointJson)', this.checkPosArr)
console.log('加密前JSON', JSON.stringify(this.checkPosArr))
reqCheck(data).then((res) => {
if (res.repCode == '0000') {
checkBwCaptcha(data).then((res) => {
const { data } = res
if (data.repCode === '0000') {
this.barAreaColor = '#4cae4c'
this.barAreaBorderColor = '#5cb85c'
this.text = '验证成功'
this.bindingClick = false
if (this.mode == 'pop') {
if (this.mode === 'pop') {
setTimeout(() => {
this.$parent.clickShow = false
this.refresh()
......@@ -264,21 +265,23 @@ export default {
clientUid: localStorage.getItem('point'),
ts: Date.now() // 现在的时间戳
}
reqGet(data).then((res) => {
if (res.repCode == '0000') {
this.pointBackImgBase = res.repData.originalImageBase64
this.backToken = res.repData.token
this.secretKey = res.repData.secretKey
this.poinTextList = res.repData.wordList
getBwCaptcha(data).then(res => {
const { data, code } = res
if (data.repCode === '0000') {
this.pointBackImgBase = data.repData.originalImageBase64
this.backToken = data.repData.token
this.secretKey = data.repData.secretKey
this.poinTextList = data.repData.wordList
this.text = '请依次点击【' + this.poinTextList.join(',') + '】'
} else {
this.text = res.repMsg
this.text = data.repMsg
}
if (code === 400) {
// 判断接口请求次数是否失效
if (res.repCode == '6201') {
if (data.repCode === '6201') {
this.pointBackImgBase = null
}
}
})
},
// 坐标转换函数
......
......@@ -93,7 +93,7 @@
* */
import { aesEncrypt } from './../utils/ase'
import { resetSize } from './../utils/util'
import { reqGet, reqCheck } from '@/api/login'
import { getBwCaptcha, checkBwCaptcha } from '@/api/login'
// "captchaType":"blockPuzzle",
export default {
......@@ -327,13 +327,9 @@ export default {
pointJson: this.secretKey ? aesEncrypt(JSON.stringify({ x: moveLeftDistance, y: 5.0 }), this.secretKey) : JSON.stringify({ x: moveLeftDistance, y: 5.0 }),
token: this.backToken
}
console.log('captchaType', this.captchaType)
console.log('secretKey', this.secretKey)
console.log('token', this.backToken)
console.log('坐标(滑动不存在Y)', moveLeftDistance)
console.log('加密前JSON', JSON.stringify({ x: moveLeftDistance, y: 5.0 }))
reqCheck(data).then((res) => {
if (res.repCode == '0000') {
checkBwCaptcha(data).then((res) => {
const { data } = res
if (data.repCode === '0000') {
this.moveBlockBackgroundColor = '#5cb85c'
this.leftBarBorderColor = '#5cb85c'
this.iconColor = '#fff'
......@@ -358,7 +354,6 @@ export default {
setTimeout(() => {
this.tipWords = ''
this.$parent.closeBox()
return
this.$parent.$emit('success', { captchaVerification })
}, 1000)
} else {
......@@ -412,24 +407,28 @@ export default {
clientUid: localStorage.getItem('slider'),
ts: Date.now() // 现在的时间戳
}
reqGet(data).then((res) => {
if (res.repCode == '0000') {
this.backImgBase = res.repData.originalImageBase64
this.blockBackImgBase = res.repData.jigsawImageBase64
this.backToken = res.repData.token
this.secretKey = res.repData.secretKey
getBwCaptcha(data).then((res) => {
const { data, code } = res
if (data.repCode === '0000') {
this.backImgBase = data.repData.originalImageBase64
this.blockBackImgBase = data.repData.jigsawImageBase64
this.backToken = data.repData.token
this.secretKey = data.repData.secretKey
} else {
this.tipWords = res.repMsg
this.tipWords = data.repMsg
}
if (code === 400) {
// 判断接口请求次数是否失效
if (res.repCode == '6201') {
if (res.repCode === '6201') {
this.backImgBase = null
this.blockBackImgBase = null
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
</style>
import request from '@/utils/request'
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment