diff --git a/src/components/Article.vue b/src/components/Article.vue index fbd2528ce6159864c6d6c6ecd5b14d6f1de28546..e341dc634486195853b522f2a2feb35c164f4554 100644 --- a/src/components/Article.vue +++ b/src/components/Article.vue @@ -68,7 +68,7 @@ >
@@ -154,7 +154,7 @@ >
@@ -332,7 +332,7 @@ export default { weather_low: [], toTopIsShow: false, article_loc: 0, - challenge_loc: -1, + activeChallengeIndex: -1, topShow: false, userImg: '', username: '匿名', @@ -490,7 +490,7 @@ export default { }, li_errorClass: function () {}, clickChallengeEvent: function (item, index) { - this.challenge_loc = index + this.activeChallengeIndex = index if (item.isJumpPath) { this.$router .push({ diff --git a/src/style/special.css b/src/style/special.css new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/src/style/special.css @@ -0,0 +1 @@ + diff --git a/src/utils/aesEncode.js b/src/utils/aesEncode.js new file mode 100644 index 0000000000000000000000000000000000000000..d29c4917dc79addf14da1eeb72e0ad895c61a515 --- /dev/null +++ b/src/utils/aesEncode.js @@ -0,0 +1,31 @@ +import CryptoJS from 'crypto-js' + +export default { + // 随机生成指定数量的16进制key + generatekey (num) { + let library = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' + let key = '' + for (let i = 0; i < num; i++) { + let randomPoz = Math.floor(Math.random() * library.length) + key += library.substring(randomPoz, randomPoz + 1) + } + return key + }, + + // 加密 + encrypt (word, keyStr) { + // 判断是否存在ksy,不存在就用定义好的key + keyStr = keyStr || 'abcdsxyzhkj12345' + const key = CryptoJS.enc.Utf8.parse(keyStr) + const srcs = CryptoJS.enc.Utf8.parse(word) + const encrypted = CryptoJS.AES.encrypt(srcs, key, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7}) + return encrypted.toString() + }, + // 解密 + decrypt (word, keyStr) { + keyStr = keyStr || 'abcdsxyzhkj12345' + const key = CryptoJS.enc.Utf8.parse(keyStr) + const decrypt = CryptoJS.AES.decrypt(word, key, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7}) + return CryptoJS.enc.Utf8.stringify(decrypt).toString() + } +}