diff --git a/package.json b/package.json index bf551b8..dfada6c 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "@smallwei/avue": "2.0.2", "axios": "0.18.1", "core-js": "3.6.5", + "crypto-js": "^4.1.1", "element-ui": "2.15.7", "lodash": "4.17.5", "svg-sprite-loader": "3.7.3", diff --git a/src/assets/img/default-verify-error.jpg b/src/assets/img/default-verify-error.jpg new file mode 100644 index 0000000..aa0237b Binary files /dev/null and b/src/assets/img/default-verify-error.jpg differ diff --git a/src/components/verifition/Verify.vue b/src/components/verifition/Verify.vue new file mode 100644 index 0000000..62b4c43 --- /dev/null +++ b/src/components/verifition/Verify.vue @@ -0,0 +1,491 @@ + + + diff --git a/src/components/verifition/Verify/VerifyPoints.vue b/src/components/verifition/Verify/VerifyPoints.vue new file mode 100644 index 0000000..71cecd3 --- /dev/null +++ b/src/components/verifition/Verify/VerifyPoints.vue @@ -0,0 +1,268 @@ + + diff --git a/src/components/verifition/Verify/VerifySlide.vue b/src/components/verifition/Verify/VerifySlide.vue new file mode 100644 index 0000000..535e5fa --- /dev/null +++ b/src/components/verifition/Verify/VerifySlide.vue @@ -0,0 +1,378 @@ + + + diff --git a/src/components/verifition/api/index.js b/src/components/verifition/api/index.js new file mode 100644 index 0000000..f4b7fb1 --- /dev/null +++ b/src/components/verifition/api/index.js @@ -0,0 +1,24 @@ +/** + * 此处可直接引用自己项目封装好的 axios 配合后端联调 + */ + +import httpRequest from '@/utils/httpRequest' + +// 获取验证图片 以及token +export function reqGet (data) { + return httpRequest({ + url: httpRequest.adornUrl('/captcha/get'), + method: 'post', + data + }) +} + +// 滑动或者点选验证 +export function reqCheck (data) { + return httpRequest({ + url: httpRequest.adornUrl('/captcha/check'), + method: 'post', + data + }) +} + diff --git a/src/components/verifition/utils/ase.js b/src/components/verifition/utils/ase.js new file mode 100644 index 0000000..71f07e0 --- /dev/null +++ b/src/components/verifition/utils/ase.js @@ -0,0 +1,11 @@ +import CryptoJS from 'crypto-js' +/** + * @word 要加密的内容 + * @keyWord String 服务器随机返回的关键字 + * */ +export function aesEncrypt(word, keyWord = 'XwKsGlMcdPMEhR1B') { + var key = CryptoJS.enc.Utf8.parse(keyWord) + var srcs = CryptoJS.enc.Utf8.parse(word) + var encrypted = CryptoJS.AES.encrypt(srcs, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }) + return encrypted.toString() +} diff --git a/src/components/verifition/utils/util.js b/src/components/verifition/utils/util.js new file mode 100644 index 0000000..8f26e73 --- /dev/null +++ b/src/components/verifition/utils/util.js @@ -0,0 +1,36 @@ +export function resetSize(vm) { + var img_width, img_height, bar_width, bar_height // 图片的宽度、高度,移动条的宽度、高度 + + var parentWidth = vm.$el.parentNode.offsetWidth || window.offsetWidth + var parentHeight = vm.$el.parentNode.offsetHeight || window.offsetHeight + + if (vm.imgSize.width.indexOf('%') != -1) { + img_width = parseInt(this.imgSize.width) / 100 * parentWidth + 'px' + } else { + img_width = this.imgSize.width + } + + if (vm.imgSize.height.indexOf('%') != -1) { + img_height = parseInt(this.imgSize.height) / 100 * parentHeight + 'px' + } else { + img_height = this.imgSize.height + } + + if (vm.barSize.width.indexOf('%') != -1) { + bar_width = parseInt(this.barSize.width) / 100 * parentWidth + 'px' + } else { + bar_width = this.barSize.width + } + + if (vm.barSize.height.indexOf('%') != -1) { + bar_height = parseInt(this.barSize.height) / 100 * parentHeight + 'px' + } else { + bar_height = this.barSize.height + } + + return { imgWidth: img_width, imgHeight: img_height, barWidth: bar_width, barHeight: bar_height } +} + +export const _code_chars = [1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] +export const _code_color1 = ['#fffff0', '#f0ffff', '#f0fff0', '#fff0f0'] +export const _code_color2 = ['#FF0033', '#006699', '#993366', '#FF9900', '#66CC66', '#FF33CC'] diff --git a/src/utils/crypto.js b/src/utils/crypto.js new file mode 100644 index 0000000..51e1ce8 --- /dev/null +++ b/src/utils/crypto.js @@ -0,0 +1,11 @@ +import CryptoJS from 'crypto-js' +// 加密 +const keyStr = '-mall4j-password' // 解密用的key +export function encrypt (word) { + const time = Date.now() + + const key = CryptoJS.enc.Utf8.parse(keyStr) + const srcs = CryptoJS.enc.Utf8.parse(time + word) // 加密方式: 时间戳 + 密文 + const encrypted = CryptoJS.AES.encrypt(srcs, key, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7}) + return encrypted.toString() +} diff --git a/src/views/common/login.vue b/src/views/common/login.vue index 013f649..79e0cd0 100644 --- a/src/views/common/login.vue +++ b/src/views/common/login.vue @@ -22,7 +22,7 @@ type="password" placeholder="密码"> - +
Copyright © 2019 广州市蓝海创新科技有限公司
+