diff --git a/package-lock.json b/package-lock.json index 4a03607..3f682ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3361,6 +3361,15 @@ } } }, + "crc-32": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz", + "integrity": "sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA==", + "requires": { + "exit-on-epipe": "~1.0.1", + "printj": "~1.1.0" + } + }, "create-ecdh": { "version": "4.0.3", "resolved": "https://registry.npm.taobao.org/create-ecdh/download/create-ecdh-4.0.3.tgz", @@ -4354,6 +4363,11 @@ "strip-eof": "^1.0.0" } }, + "exit-on-epipe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz", + "integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw==" + }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npm.taobao.org/expand-brackets/download/expand-brackets-2.1.4.tgz", @@ -6945,6 +6959,11 @@ "object-visit": "^1.0.0" } }, + "material-design-icons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/material-design-icons/-/material-design-icons-3.0.1.tgz", + "integrity": "sha1-mnHEh0chjrylHlGmbaaCA4zct78=" + }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npm.taobao.org/md5.js/download/md5.js-1.3.5.tgz", @@ -8803,6 +8822,11 @@ "utila": "~0.4" } }, + "printj": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz", + "integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==" + }, "private": { "version": "0.1.8", "resolved": "https://registry.npm.taobao.org/private/download/private-0.1.8.tgz", @@ -9435,6 +9459,11 @@ "inherits": "^2.0.1" } }, + "roboto-fontface": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/roboto-fontface/-/roboto-fontface-0.6.1.tgz", + "integrity": "sha1-vVarPtTkovKaG9IPv1+S6eTPNUA=" + }, "run-queue": { "version": "1.0.3", "resolved": "https://registry.npm.taobao.org/run-queue/download/run-queue-1.0.3.tgz", @@ -11186,6 +11215,11 @@ } } }, + "vue-material": { + "version": "1.0.0-beta-11", + "resolved": "https://registry.npmjs.org/vue-material/-/vue-material-1.0.0-beta-11.tgz", + "integrity": "sha512-1+dIVkQafMIA/zNONb7OwGaTjAxaWk/JhUA2/FInQvbArxf1ToKB+yIdeSfzopQ1KICnBTAmk9E0Vdr5p4MWNA==" + }, "vue-router": { "version": "3.1.5", "resolved": "https://registry.npm.taobao.org/vue-router/download/vue-router-3.1.5.tgz", diff --git a/package.json b/package.json index 3a1126b..1214ef6 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,15 @@ }, "dependencies": { "core-js": "^3.6.4", + "crc-32": "^1.2.0", + "material-design-icons": "^3.0.1", "register-service-worker": "^1.6.2", + "roboto-fontface": "^0.6.0", "vue": "^2.6.11", + "vue-clipboard2": "^0.3.1", "vue-material": "^1.0.0-beta-11", "vue-router": "^3.1.5", - "vuex": "^3.1.2", - "roboto-fontface": "^0.6.0", - "material-design-icons": "^3.0.1" + "vuex": "^3.1.2" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.2.0", diff --git a/src/main.js b/src/main.js index a2926d5..d1fa2fc 100644 --- a/src/main.js +++ b/src/main.js @@ -21,6 +21,10 @@ function setHtmlFontSize() { } setHtmlFontSize(); +// 剪切板 +import VueClipboard from "vue-clipboard2"; +Vue.use(VueClipboard); + Vue.config.productionTip = false new Vue({ diff --git a/src/router/index.js b/src/router/index.js index 46c745e..7d35183 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,11 +1,6 @@ import Vue from 'vue' import VueRouter from 'vue-router' -const linkActiveClass = 'my-link-active-class' - -// // pass custom class to Vue Material -// Vue.material.router.linkActiveClass = linkActiveClass - Vue.use(VueRouter) const routes = [ @@ -44,12 +39,17 @@ const routes = [ name: 'Settings', component: () => import(/* webpackChunkName: "settings" */ '../views/Settings/Settings.vue') }, + { + path: '/unlock', + name: 'Unlock', + component: () => import(/* webpackChunkName: "unlock" */ '../views/Unlock/Unlock.vue') + }, ] const router = new VueRouter({ mode: 'history', base: process.env.BASE_URL, - routes + routes, }) export default router diff --git a/src/store/index.js b/src/store/index.js index 332b916..be7015f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -4,12 +4,50 @@ import Vuex from 'vuex' Vue.use(Vuex) export default new Vuex.Store({ - state: { - }, - mutations: { - }, - actions: { - }, - modules: { - } + state: { + // 用户信息 + user_info: '', + // aes化的密码信息 + row_data: '', + // aes化的用户主密码 + row_pwd: '', + }, + mutations: { + // 设置用户信息 + SET_USERINFO(state, user_info) { + state.user_info = user_info; + }, + // 设置aes化的密码信息 + SET_ROWDATA(state, row_data) { + state.row_data = row_data; + }, + // 设置aes化的用户主密码 + SET_ROWPWD(state, row_pwd) { + state.row_pwd = row_pwd; + }, + }, + actions: { + // 设置用户信息 + setUserInfo({ + commit + }, arg) { + commit('SET_USERINFO', arg[0]); + localStorage.setItem("storeState", JSON.stringify(arg[1].$store.state)); + }, + // 设置aes化的密码信息 + setRowData({ + commit + }, arg) { + commit('SET_ROWDATA', arg[0]); + localStorage.setItem("storeState", JSON.stringify(arg[1].$store.state)); + }, + // 设置aes化的用户主密码 + setRowPwd({ + commit + }, arg) { + commit('SET_ROWPWD', arg[0]); + localStorage.setItem("storeState", JSON.stringify(arg[1].$store.state)); + }, + }, + modules: {} }) diff --git a/src/style/font.scss b/src/style/font.scss index abaeb56..f3e9a3c 100644 --- a/src/style/font.scss +++ b/src/style/font.scss @@ -4,7 +4,7 @@ font-style: normal; font-weight: 400; font-display: swap; - src: local('Roboto'), local('Roboto-Regular'), url(/assets/KFOmCnqEu92Fr1Mu72xKOzY.woff2) format('woff2'); + src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu72xKOzY.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* cyrillic */ @@ -13,7 +13,7 @@ font-style: normal; font-weight: 400; font-display: swap; - src: local('Roboto'), local('Roboto-Regular'), url(/assets/KFOmCnqEu92Fr1Mu5mxKOzY.woff2) format('woff2'); + src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu5mxKOzY.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* greek-ext */ @@ -22,7 +22,7 @@ font-style: normal; font-weight: 400; font-display: swap; - src: local('Roboto'), local('Roboto-Regular'), url(/assets/KFOmCnqEu92Fr1Mu7mxKOzY.woff2) format('woff2'); + src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu7mxKOzY.woff2) format('woff2'); unicode-range: U+1F00-1FFF; } /* greek */ @@ -31,7 +31,7 @@ font-style: normal; font-weight: 400; font-display: swap; - src: local('Roboto'), local('Roboto-Regular'), url(/assets/KFOmCnqEu92Fr1Mu4WxKOzY.woff2) format('woff2'); + src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu4WxKOzY.woff2) format('woff2'); unicode-range: U+0370-03FF; } /* vietnamese */ @@ -40,7 +40,7 @@ font-style: normal; font-weight: 400; font-display: swap; - src: local('Roboto'), local('Roboto-Regular'), url(/assets/KFOmCnqEu92Fr1Mu7WxKOzY.woff2) format('woff2'); + src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu7WxKOzY.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB; } /* latin-ext */ @@ -49,7 +49,7 @@ font-style: normal; font-weight: 400; font-display: swap; - src: local('Roboto'), local('Roboto-Regular'), url(/assets/KFOmCnqEu92Fr1Mu7GxKOzY.woff2) format('woff2'); + src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu7GxKOzY.woff2) format('woff2'); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @@ -58,10 +58,9 @@ font-style: normal; font-weight: 400; font-display: swap; - src: local('Roboto'), local('Roboto-Regular'), url(/assets/KFOmCnqEu92Fr1Mu4mxK.woff2) format('woff2'); + src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu4mxK.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } - // @font-face { // font-family: 'Material Icons'; // font-style: normal; diff --git a/src/utils/aes.js b/src/utils/aes.js new file mode 100644 index 0000000..03e766e --- /dev/null +++ b/src/utils/aes.js @@ -0,0 +1,48 @@ +import CryptoJS from 'crypto-js' +import CRC32 from 'crc-32' + +// aes加密 +export function encrypt(code, json_row) { + // 循环冗余校验 + let aesKey = CRC32.str(code) + // 取八位 + aesKey = aesKey.toString().slice(0,8) + // 字符串化 + let json_str = JSON.stringify(json_row) + // 加密 + return CryptoJS.AES.encrypt(json_str, CryptoJS.enc.Utf8.parse(aesKey), { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.Pkcs7 + }).toString(); +} + +// aes解密 +export function decrypt(code, encrypt_str) { + // 循环冗余校验 + let aesKey = CRC32.str(code) + // 取八位 + aesKey = aesKey.toString().slice(0,8) + // 解密 + return CryptoJS.AES.decrypt(encrypt_str, CryptoJS.enc.Utf8.parse(aesKey), { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.Pkcs7 + }).toString(CryptoJS.enc.Utf8); +} + +// aes加密用户密码 +export function encryptMainCode(code) { + let default_key = 'e08b44a351a3' + return CryptoJS.AES.encrypt(code, CryptoJS.enc.Utf8.parse(default_key), { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.Pkcs7 + }).toString(); +} + +// aes解密用户密码 +export function decryptMainCode(row_code) { + let default_key = 'e08b44a351a3' + return CryptoJS.AES.decrypt(row_code, CryptoJS.enc.Utf8.parse(default_key), { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.Pkcs7 + }).toString(CryptoJS.enc.Utf8); +} \ No newline at end of file diff --git a/src/views/Account/Account.vue b/src/views/Account/Account.vue index e69de29..660278f 100644 --- a/src/views/Account/Account.vue +++ b/src/views/Account/Account.vue @@ -0,0 +1,188 @@ + + + + + \ No newline at end of file diff --git a/src/views/Home/Home.vue b/src/views/Home/Home.vue index 660278f..1c8e614 100644 --- a/src/views/Home/Home.vue +++ b/src/views/Home/Home.vue @@ -1,188 +1,291 @@ \ No newline at end of file + diff --git a/src/views/Settings/Settings.vue b/src/views/Settings/Settings.vue index e69de29..660278f 100644 --- a/src/views/Settings/Settings.vue +++ b/src/views/Settings/Settings.vue @@ -0,0 +1,188 @@ + + + + + \ No newline at end of file diff --git a/src/views/Unlock/Unlock.vue b/src/views/Unlock/Unlock.vue new file mode 100644 index 0000000..660278f --- /dev/null +++ b/src/views/Unlock/Unlock.vue @@ -0,0 +1,188 @@ + + + + + \ No newline at end of file diff --git a/src/views/test.js b/src/views/test.js new file mode 100644 index 0000000..552488f --- /dev/null +++ b/src/views/test.js @@ -0,0 +1,41 @@ +this.show_list = [ + { + open_count: 1, + title: 'QQ', + user_name: '1144131090', + password: 'test', + node: '测试用' + }, + { + open_count: 2, + title: '微信', + user_name: '15143211127', + password: 'test', + node: '测试用' + }, + { + open_count: 3, + title: 'WIFI', + user_name: 'admin', + password: 'test', + node: '测试用' + }, + { + open_count: 4, + title: 'WeGame', + user_name: '1144131090', + password: 'test', + node: '测试用' + } + ]; + test() { + // + // let main_code = '10aeff' + // let data_aes = encrypt(main_code, this.show_list); + // if(!this.row_data) this.setRowData([data_aes, this]) + // let main_code_aes = encryptMainCode(main_code) + // if(!this.row_pwd) this.setRowPwd([main_code_aes, this]) + // let main_code_decrpt = decryptMainCode(main_code_aes) + // let data_decrpt = decrypt(main_code_decrpt, data_aes) + // console.log(data_aes, main_code_aes, main_code_decrpt,data_decrpt) + }, \ No newline at end of file