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

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

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