diff --git a/mall4uni/App.vue b/mall4uni/App.vue index 4682dd0..8b5d6db 100644 --- a/mall4uni/App.vue +++ b/mall4uni/App.vue @@ -8,22 +8,22 @@ onShow: function() { // 判断浏览器环境 var ua = navigator.userAgent.toLowerCase(); - if (ua.search(/MicroMessenger/i) > -1 && !uni.getStorageSync('appType')) { - // 微信环境 - uni.setStorageSync('appType', 2) - http.mpAuthLogin() - } - const state = util.getUrlKey('state') - const code = util.getUrlKey('code') - if ((state == 'needCode' || state == 'unNeedCode') && code) { - let path = window.location.href - if (path.indexOf('code=') > 0 && path.indexOf('&state=unNeedCode') > -1) { - http.mpLogin(null, code) - path = path.substring(0, path.indexOf('code=') - 1) - history.replaceState({}, '', path) - } + // if (ua.search(/MicroMessenger/i) > -1 && !uni.getStorageSync('appType')) { + // // 微信环境 + // uni.setStorageSync('appType', 2) + // http.mpAuthLogin() + // } + // const state = util.getUrlKey('state') + // const code = util.getUrlKey('code') + // if ((state == 'needCode' || state == 'unNeedCode') && code) { + // let path = window.location.href + // if (path.indexOf('code=') > 0 && path.indexOf('&state=unNeedCode') > -1) { + // http.mpLogin(null, code) + // path = path.substring(0, path.indexOf('code=') - 1) + // history.replaceState({}, '', path) + // } http.getCartCount() - } + // } }, globalData: { // 定义全局请求队列 diff --git a/mall4uni/package.json b/mall4uni/package.json index 31ef0a9..01384b0 100644 --- a/mall4uni/package.json +++ b/mall4uni/package.json @@ -14,7 +14,10 @@ "author": "", "license": "ISC", "devDependencies": { - "uni-read-pages": "^1.0.5", - "query-string": "^6.13.1" + "query-string": "^6.13.1", + "uni-read-pages": "^1.0.5" + }, + "dependencies": { + "crypto-js": "^4.1.1" } } diff --git a/mall4uni/pages/accountLogin/accountLogin.vue b/mall4uni/pages/accountLogin/accountLogin.vue index 7f01525..06b807b 100644 --- a/mall4uni/pages/accountLogin/accountLogin.vue +++ b/mall4uni/pages/accountLogin/accountLogin.vue @@ -33,6 +33,7 @@ + diff --git a/mall4v/src/components/verifition/Verify/VerifyPoints.vue b/mall4v/src/components/verifition/Verify/VerifyPoints.vue new file mode 100644 index 0000000..71cecd3 --- /dev/null +++ b/mall4v/src/components/verifition/Verify/VerifyPoints.vue @@ -0,0 +1,268 @@ + + + + + + + + + + + {{ index + 1 }} + + + + + + {{ text }} + + + + diff --git a/mall4v/src/components/verifition/Verify/VerifySlide.vue b/mall4v/src/components/verifition/Verify/VerifySlide.vue new file mode 100644 index 0000000..535e5fa --- /dev/null +++ b/mall4v/src/components/verifition/Verify/VerifySlide.vue @@ -0,0 +1,378 @@ + + + + + + + + + {{ tipWords }} + + + + + + + + + + + + + + + + + + + + diff --git a/mall4v/src/components/verifition/api/index.js b/mall4v/src/components/verifition/api/index.js new file mode 100644 index 0000000..f4b7fb1 --- /dev/null +++ b/mall4v/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/mall4v/src/components/verifition/utils/ase.js b/mall4v/src/components/verifition/utils/ase.js new file mode 100644 index 0000000..71f07e0 --- /dev/null +++ b/mall4v/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/mall4v/src/components/verifition/utils/util.js b/mall4v/src/components/verifition/utils/util.js new file mode 100644 index 0000000..8f26e73 --- /dev/null +++ b/mall4v/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/mall4v/src/utils/crypto.js b/mall4v/src/utils/crypto.js new file mode 100644 index 0000000..51c0647 --- /dev/null +++ b/mall4v/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/mall4v/src/utils/index.js b/mall4v/src/utils/index.js index c5df254..1637e2c 100644 --- a/mall4v/src/utils/index.js +++ b/mall4v/src/utils/index.js @@ -20,7 +20,7 @@ export function isAuth (key) { if (authorities.length) { for (const i in authorities) { const element = authorities[i] - if (element.authority === key) { + if (element === key) { return true } } diff --git a/mall4v/src/views/common/login.vue b/mall4v/src/views/common/login.vue index 013f649..79e0cd0 100644 --- a/mall4v/src/views/common/login.vue +++ b/mall4v/src/views/common/login.vue @@ -22,7 +22,7 @@ type="password" placeholder="密码"> - + Copyright © 2019 广州市蓝海创新科技有限公司 +