From 05bf9d6aaaec69e97818e9959128fbd05f0c9d24 Mon Sep 17 00:00:00 2001 From: Aicirou <2643053021@qq.com> Date: Thu, 14 May 2020 03:24:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=A1=B5=E9=9D=A2=E7=BA=A7?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=97=AE=E9=A2=98=EF=BC=8C=E7=BB=A7=E7=BB=AD?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dependencies-cdn.js | 5 + package-lock.json | 288 +++++++++++++++++- package.json | 11 +- src/App.vue | 43 +-- src/assets/style/theme/acrou/index.scss | 3 + src/assets/style/theme/register.scss | 1 + .../components/header-color/index.vue | 45 --- .../components/header-search/index.vue | 15 - .../components/header-setting/index.vue | 32 ++ src/libs/util.cookies.js | 6 +- src/libs/util.db.js | 106 +++++++ src/libs/util.js | 6 +- src/locales/en.json | 8 +- src/locales/zh-chs.json | 82 ++--- src/locales/zh-cht.json | 82 ++--- src/main.js | 7 +- src/router/index.js | 15 +- src/router/routes.js | 3 +- src/store/index.js | 12 + src/store/modules/acrou/index.js | 16 + src/store/modules/acrou/modules/db.js | 157 ++++++++++ src/utils/AcrouUtil.js | 44 ++- src/views/Layout.vue | 22 +- src/views/common/Navbar.vue | 11 +- src/views/page/GoList.vue | 16 +- src/views/page/GoVideo.vue | 4 +- vue.config.js | 26 +- 27 files changed, 816 insertions(+), 250 deletions(-) delete mode 100644 src/layout/header-aside/components/header-color/index.vue delete mode 100644 src/layout/header-aside/components/header-search/index.vue create mode 100644 src/layout/header-aside/components/header-setting/index.vue create mode 100644 src/libs/util.db.js create mode 100644 src/store/index.js create mode 100644 src/store/modules/acrou/index.js create mode 100644 src/store/modules/acrou/modules/db.js diff --git a/dependencies-cdn.js b/dependencies-cdn.js index 5e4b59d..0837267 100644 --- a/dependencies-cdn.js +++ b/dependencies-cdn.js @@ -2,9 +2,13 @@ module.exports = [ { name: 'vue', library: 'Vue', js: 'https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js', css: '' }, { name: 'vue-i18n', library: 'VueI18n', js: 'https://cdn.jsdelivr.net/npm/vue-i18n@8.17.3/dist/vue-i18n.min.js', css: '' }, { name: 'vue-router', library: 'VueRouter', js: 'https://cdn.jsdelivr.net/npm/vue-router@3.1.6/dist/vue-router.min.js', css: '' }, + { name: 'vuex', library: 'Vuex', js: 'https://cdn.jsdelivr.net/npm/vuex@3.4.0/dist/vuex.js', css: '' }, { name: 'axios', library: 'axios', js: 'https://cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js', css: '' }, { name: 'element-ui', library: 'ELEMENT', js: 'https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/index.js', css: 'https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/theme-chalk/index.css' }, + { name: 'lodash', library: '_', js: 'https://cdn.jsdelivr.net/npm/lodash@4.17.15/lodash.min.js', css: '' }, { name: 'js-cookie', library: 'Cookies', js: 'https://cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.min.js', css: '' }, + { name: 'lowdb', library: 'low', js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/low.min.js', css: '' }, + { name: 'lowdb/adapters/LocalStorage', library: 'LocalStorage', js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/LocalStorage.min.js', css: '' }, // { name: 'brace', library: 'ace', js: 'https://cdn.jsdelivr.net/npm/brace@0.11.1/index.min.js', css: '' }, // { name: 'brace/ext/language_tools', library: 'language_tools', js: ' https://cdn.jsdelivr.net/npm/brace@0.11.1/ext/language_tools.js', css: '' }, // { name: 'brace/mode/html', library: 'html', js: ' https://cdn.jsdelivr.net/npm/brace@0.11.1/mode/html.js', css: '' }, @@ -14,6 +18,7 @@ module.exports = [ // { name: 'brace/snippets/javascript', library: 'javascript', js: ' https://cdn.jsdelivr.net/npm/brace@0.11.1/snippets/javascript.js', css: '' }, // { name: 'vue2-ace-editor', library: 'Vue2ACEEditor', js: 'https://cdn.jsdelivr.net/npm/vue2-ace-editor@0.0.15/index.min.js', css: '' }, { name: 'markdown-it', library: 'markdownit', js: 'https://cdn.jsdelivr.net/npm/markdown-it@10.0.0/dist/markdown-it.min.js', css: '' }, + { name: '', library: '', js: 'https://at.alicdn.com/t/font_1760192_zf96psu0uo.js', css: '' }, { name: '', library: '', js: '', css: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css' }, { name: '', library: '', js: '', css: 'https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css' }, { name: '', library: '', js: '', css: 'https://cdn.jsdelivr.net/npm/font-awesome-animation@0.2.1/dist/font-awesome-animation.min.css' }, diff --git a/package-lock.json b/package-lock.json index 4b7bc3d..de74c76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "go2index-theme-acrou", - "version": "0.1.0", + "version": "1.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -934,6 +934,22 @@ "regenerator-runtime": "^0.13.4" } }, + "@babel/runtime-corejs2": { + "version": "7.9.6", + "resolved": "https://registry.npm.taobao.org/@babel/runtime-corejs2/download/@babel/runtime-corejs2-7.9.6.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fruntime-corejs2%2Fdownload%2F%40babel%2Fruntime-corejs2-7.9.6.tgz", + "integrity": "sha1-rNXWNROEzCgo3CEapUJqkEdr9Kg=", + "requires": { + "core-js": "^2.6.5", + "regenerator-runtime": "^0.13.4" + }, + "dependencies": { + "core-js": { + "version": "2.6.11", + "resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.11.tgz?cache=0&sync_timestamp=1586450269267&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-2.6.11.tgz", + "integrity": "sha1-OIMUafmSK97Y7iHJ3EaYXgOZMIw=" + } + } + }, "@babel/template": { "version": "7.8.6", "resolved": "https://registry.npm.taobao.org/@babel/template/download/@babel/template-7.8.6.tgz", @@ -3382,6 +3398,195 @@ } } }, + "compression-webpack-plugin": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/compression-webpack-plugin/download/compression-webpack-plugin-4.0.0.tgz?cache=0&sync_timestamp=1589291140068&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcompression-webpack-plugin%2Fdownload%2Fcompression-webpack-plugin-4.0.0.tgz", + "integrity": "sha1-dZn1kgUAAqSc060+4YrnNx4ma8o=", + "dev": true, + "requires": { + "cacache": "^15.0.3", + "find-cache-dir": "^3.3.1", + "schema-utils": "^2.6.6", + "serialize-javascript": "^3.0.0", + "webpack-sources": "^1.4.3" + }, + "dependencies": { + "cacache": { + "version": "15.0.3", + "resolved": "https://registry.npm.taobao.org/cacache/download/cacache-15.0.3.tgz", + "integrity": "sha1-IiXC0d2OhyM5lQ1qOcBR4OkzQ5I=", + "dev": true, + "requires": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "glob": "^7.1.4", + "infer-owner": "^1.0.4", + "lru-cache": "^5.1.1", + "minipass": "^3.1.1", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.2", + "mkdirp": "^1.0.3", + "move-file": "^2.0.0", + "p-map": "^4.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^3.0.2", + "ssri": "^8.0.0", + "tar": "^6.0.2", + "unique-filename": "^1.1.1" + } + }, + "chownr": { + "version": "2.0.0", + "resolved": "https://registry.npm.taobao.org/chownr/download/chownr-2.0.0.tgz", + "integrity": "sha1-Fb++U9LqtM9w8YqM1o6+Wzyx3s4=", + "dev": true + }, + "find-cache-dir": { + "version": "3.3.1", + "resolved": "https://registry.npm.taobao.org/find-cache-dir/download/find-cache-dir-3.3.1.tgz", + "integrity": "sha1-ibM/rUpGcNqpT4Vff74x1thP6IA=", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npm.taobao.org/find-up/download/find-up-4.1.0.tgz", + "integrity": "sha1-l6/n1s3AvFkoWEt8jXsW6KmqXRk=", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npm.taobao.org/locate-path/download/locate-path-5.0.0.tgz", + "integrity": "sha1-Gvujlq/WdqbUJQTQpno6frn2KqA=", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npm.taobao.org/make-dir/download/make-dir-3.1.0.tgz?cache=0&sync_timestamp=1587567576732&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmake-dir%2Fdownload%2Fmake-dir-3.1.0.tgz", + "integrity": "sha1-QV6WcEazp/HRhSd9hKpYIDcmoT8=", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npm.taobao.org/mkdirp/download/mkdirp-1.0.4.tgz", + "integrity": "sha1-PrXtYmInVteaXw4qIh3+utdcL34=", + "dev": true + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npm.taobao.org/p-limit/download/p-limit-2.3.0.tgz", + "integrity": "sha1-PdM8ZHohT9//2DWTPrCG2g3CHbE=", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npm.taobao.org/p-locate/download/p-locate-4.1.0.tgz", + "integrity": "sha1-o0KLtwiLOmApL2aRkni3wpetTwc=", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-map": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/p-map/download/p-map-4.0.0.tgz", + "integrity": "sha1-uy+Vpe2i7BaOySdOBqdHw+KQTSs=", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npm.taobao.org/p-try/download/p-try-2.2.0.tgz", + "integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY=", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/path-exists/download/path-exists-4.0.0.tgz", + "integrity": "sha1-UTvb4tO5XXdi6METfvoZXGxhtbM=", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npm.taobao.org/pkg-dir/download/pkg-dir-4.2.0.tgz", + "integrity": "sha1-8JkTPfft5CLoHR2ESCcO6z5CYfM=", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npm.taobao.org/rimraf/download/rimraf-3.0.2.tgz?cache=0&sync_timestamp=1581257110269&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Frimraf%2Fdownload%2Frimraf-3.0.2.tgz", + "integrity": "sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho=", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1586886267748&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz", + "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=", + "dev": true + }, + "serialize-javascript": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/serialize-javascript/download/serialize-javascript-3.0.0.tgz?cache=0&sync_timestamp=1581887711256&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fserialize-javascript%2Fdownload%2Fserialize-javascript-3.0.0.tgz", + "integrity": "sha1-SS5Imi13t7gErTkaX12XhwlSVI4=", + "dev": true + }, + "ssri": { + "version": "8.0.0", + "resolved": "https://registry.npm.taobao.org/ssri/download/ssri-8.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fssri%2Fdownload%2Fssri-8.0.0.tgz", + "integrity": "sha1-ecp04h+M6u3fy0uQFDxFi42YiAg=", + "dev": true, + "requires": { + "minipass": "^3.1.1" + } + }, + "tar": { + "version": "6.0.2", + "resolved": "https://registry.npm.taobao.org/tar/download/tar-6.0.2.tgz?cache=0&sync_timestamp=1588021389848&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftar%2Fdownload%2Ftar-6.0.2.tgz", + "integrity": "sha1-XfF4E0aKYmT/FPdmiGxiK4SuLzk=", + "dev": true, + "requires": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^3.0.0", + "minizlib": "^2.1.0", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/yallist/download/yallist-4.0.0.tgz", + "integrity": "sha1-m7knkNnA7/7GO+c1GeEaNQGaOnI=", + "dev": true + } + } + }, "concat-map": { "version": "0.0.1", "resolved": "http://registry.npm.taobao.org/concat-map/download/concat-map-0.0.1.tgz", @@ -5113,6 +5318,14 @@ "websocket-driver": ">=0.5.1" } }, + "feb-alive": { + "version": "1.0.9", + "resolved": "https://registry.npm.taobao.org/feb-alive/download/feb-alive-1.0.9.tgz", + "integrity": "sha1-MhgTZxhevs/uSuCg6ekkf9CEYS8=", + "requires": { + "@babel/runtime-corejs2": "^7.4.3" + } + }, "figgy-pudding": { "version": "3.5.2", "resolved": "https://registry.npm.taobao.org/figgy-pudding/download/figgy-pudding-3.5.2.tgz", @@ -7072,8 +7285,7 @@ "is-promise": { "version": "2.1.0", "resolved": "http://registry.npm.taobao.org/is-promise/download/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=" }, "is-regex": { "version": "1.0.5", @@ -7575,6 +7787,25 @@ "signal-exit": "^3.0.0" } }, + "lowdb": { + "version": "1.0.0", + "resolved": "https://registry.npm.taobao.org/lowdb/download/lowdb-1.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flowdb%2Fdownload%2Flowdb-1.0.0.tgz", + "integrity": "sha1-UkO+ayJ4bMzjDlDJoz6sNrIMgGQ=", + "requires": { + "graceful-fs": "^4.1.3", + "is-promise": "^2.1.0", + "lodash": "4", + "pify": "^3.0.0", + "steno": "^0.4.1" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npm.taobao.org/pify/download/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + } + } + }, "lower-case": { "version": "1.1.4", "resolved": "https://registry.npm.taobao.org/lower-case/download/lower-case-1.1.4.tgz", @@ -7918,6 +8149,24 @@ "minipass": "^3.0.0" } }, + "minizlib": { + "version": "2.1.0", + "resolved": "https://registry.npm.taobao.org/minizlib/download/minizlib-2.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fminizlib%2Fdownload%2Fminizlib-2.1.0.tgz", + "integrity": "sha1-/VLGRTAe8JpjosIJaXwpTGzgLPM=", + "dev": true, + "requires": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "dependencies": { + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/yallist/download/yallist-4.0.0.tgz", + "integrity": "sha1-m7knkNnA7/7GO+c1GeEaNQGaOnI=", + "dev": true + } + } + }, "mississippi": { "version": "3.0.0", "resolved": "https://registry.npm.taobao.org/mississippi/download/mississippi-3.0.0.tgz", @@ -7979,6 +8228,23 @@ "run-queue": "^1.0.3" } }, + "move-file": { + "version": "2.0.0", + "resolved": "https://registry.npm.taobao.org/move-file/download/move-file-2.0.0.tgz", + "integrity": "sha1-g/+jCbXX9p1RiyjhMz4v+t8zHj4=", + "dev": true, + "requires": { + "path-exists": "^4.0.0" + }, + "dependencies": { + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/path-exists/download/path-exists-4.0.0.tgz", + "integrity": "sha1-UTvb4tO5XXdi6METfvoZXGxhtbM=", + "dev": true + } + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.1.2.tgz", @@ -9882,8 +10148,7 @@ "regenerator-runtime": { "version": "0.13.5", "resolved": "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.13.5.tgz?cache=0&sync_timestamp=1584052392667&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregenerator-runtime%2Fdownload%2Fregenerator-runtime-0.13.5.tgz", - "integrity": "sha1-2Hih0JS0MG0QuQlkhLM+vVXiZpc=", - "dev": true + "integrity": "sha1-2Hih0JS0MG0QuQlkhLM+vVXiZpc=" }, "regenerator-transform": { "version": "0.14.4", @@ -11095,6 +11360,14 @@ "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", "dev": true }, + "steno": { + "version": "0.4.4", + "resolved": "https://registry.npm.taobao.org/steno/download/steno-0.4.4.tgz", + "integrity": "sha1-BxEFvfwobmYVwEA8J+nXtdy4Vcs=", + "requires": { + "graceful-fs": "^4.1.3" + } + }, "stream-browserify": { "version": "2.0.2", "resolved": "https://registry.npm.taobao.org/stream-browserify/download/stream-browserify-2.0.2.tgz?cache=0&sync_timestamp=1587041545531&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstream-browserify%2Fdownload%2Fstream-browserify-2.0.2.tgz", @@ -12293,6 +12566,11 @@ "brace": "^0.11.0" } }, + "vuex": { + "version": "3.4.0", + "resolved": "https://registry.npm.taobao.org/vuex/download/vuex-3.4.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvuex%2Fdownload%2Fvuex-3.4.0.tgz", + "integrity": "sha1-IMwIYGLXUHafzh/rs05/zurr3kU=" + }, "watchpack": { "version": "1.6.1", "resolved": "https://registry.npm.taobao.org/watchpack/download/watchpack-1.6.1.tgz", diff --git a/package.json b/package.json index 1c4dfb6..30dbc4d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { "name": "go2index-theme-acrou", - "version": "0.1.0", - "private": true, + "version": "1.1.0", "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", @@ -15,8 +14,11 @@ "bulma-pageloader": "^0.3.0", "core-js": "^3.6.4", "element-ui": "^2.13.1", + "feb-alive": "^1.0.9", "js-base64": "^2.5.2", "js-cookie": "^2.2.1", + "lodash": "^4.17.15", + "lowdb": "^1.0.0", "markdown-it": "^10.0.0", "node-sass": "^4.14.0", "sass-loader": "^8.0.2", @@ -25,15 +27,18 @@ "vue-clipboard2": "^0.3.1", "vue-i18n": "^8.17.3", "vue-router": "^3.1.6", - "vue2-ace-editor": "0.0.15" + "vue2-ace-editor": "0.0.15", + "vuex": "^3.4.0" }, "devDependencies": { "@intlify/vue-i18n-loader": "^1.0.0", "@vue/cli-plugin-babel": "~4.3.0", "@vue/cli-plugin-eslint": "~4.3.0", + "@vue/cli-plugin-vuex": "^4.3.1", "@vue/cli-service": "~4.3.0", "babel-eslint": "^10.1.0", "babel-plugin-component": "^1.1.1", + "compression-webpack-plugin": "^4.0.0", "eslint": "^6.7.2", "eslint-plugin-vue": "^6.2.2", "fs": "0.0.1-security", diff --git a/src/App.vue b/src/App.vue index bf47820..4519ebb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,49 +5,28 @@ \ No newline at end of file + diff --git a/src/assets/style/theme/acrou/index.scss b/src/assets/style/theme/acrou/index.scss index 64a538f..7b7b620 100644 --- a/src/assets/style/theme/acrou/index.scss +++ b/src/assets/style/theme/acrou/index.scss @@ -91,6 +91,9 @@ body { min-height: 240px; position: relative; + .el-loading-mask { + z-index: initial; + } .pageloader:not(.is-bottom-to-top) { -webkit-transform: initial; transform: initial; diff --git a/src/assets/style/theme/register.scss b/src/assets/style/theme/register.scss index 81ba836..fd46e40 100644 --- a/src/assets/style/theme/register.scss +++ b/src/assets/style/theme/register.scss @@ -1,3 +1,4 @@ +@charset "utf-8"; @import 'bulma'; // @import 'bulma-pageloader'; @import '~@/assets/style/theme/acrou/index.scss'; \ No newline at end of file diff --git a/src/layout/header-aside/components/header-color/index.vue b/src/layout/header-aside/components/header-color/index.vue deleted file mode 100644 index ff28b47..0000000 --- a/src/layout/header-aside/components/header-color/index.vue +++ /dev/null @@ -1,45 +0,0 @@ - - - diff --git a/src/layout/header-aside/components/header-search/index.vue b/src/layout/header-aside/components/header-search/index.vue deleted file mode 100644 index cd63ac1..0000000 --- a/src/layout/header-aside/components/header-search/index.vue +++ /dev/null @@ -1,15 +0,0 @@ - - - diff --git a/src/layout/header-aside/components/header-setting/index.vue b/src/layout/header-aside/components/header-setting/index.vue new file mode 100644 index 0000000..be6b737 --- /dev/null +++ b/src/layout/header-aside/components/header-setting/index.vue @@ -0,0 +1,32 @@ + + + diff --git a/src/libs/util.cookies.js b/src/libs/util.cookies.js index 22a30a3..bb66f6d 100644 --- a/src/libs/util.cookies.js +++ b/src/libs/util.cookies.js @@ -13,7 +13,7 @@ cookies.set = function (name = 'default', value = '', cookieSetting = {}) { expires: 1 } Object.assign(currentCookieSetting, cookieSetting) - Cookies.set(`d2admin-${process.env.VUE_APP_VERSION}-${name}`, value, currentCookieSetting) + Cookies.set(`go2index-${process.env.APP_VERSION}-${name}`, value, currentCookieSetting) } /** @@ -21,7 +21,7 @@ cookies.set = function (name = 'default', value = '', cookieSetting = {}) { * @param {String} name cookie name */ cookies.get = function (name = 'default') { - return Cookies.get(`d2admin-${process.env.VUE_APP_VERSION}-${name}`) + return Cookies.get(`go2index-${process.env.APP_VERSION}-${name}`) } /** @@ -36,7 +36,7 @@ cookies.getAll = function () { * @param {String} name cookie name */ cookies.remove = function (name = 'default') { - return Cookies.remove(`d2admin-${process.env.VUE_APP_VERSION}-${name}`) + return Cookies.remove(`go2index-${process.env.APP_VERSION}-${name}`) } export default cookies diff --git a/src/libs/util.db.js b/src/libs/util.db.js new file mode 100644 index 0000000..74b649e --- /dev/null +++ b/src/libs/util.db.js @@ -0,0 +1,106 @@ +import low from 'lowdb' +import LocalStorage from 'lowdb/adapters/LocalStorage' +import util from '@/libs/util' +import { cloneDeep } from 'lodash' + +const adapter = new LocalStorage(`go2index-${process.env.APP_VERSION}`) +const db = low(adapter) + +db + .defaults({ + sys: {}, + database: {} + }) + .write() + +export default db + +/** + * @description 检查路径是否存在 不存在的话初始化 + * @param {Object} payload dbName {String} 数据库名称 + * @param {Object} payload path {String} 路径 + * @param {Object} payload user {Boolean} 区分用户 + * @param {Object} payload validator {Function} 数据校验钩子 返回 true 表示验证通过 + * @param {Object} payload defaultValue {*} 初始化默认值 + * @returns {String} 可以直接使用的路径 + */ +export function pathInit ({ + dbName = 'database', + path = '', + user = true, + validator = () => true, + defaultValue = '' +}) { + const uuid = util.cookies.get('uuid') || 'ghost-uuid' + const currentPath = `${dbName}.${user ? `user.${uuid}` : 'public'}${path ? `.${path}` : ''}` + const value = db.get(currentPath).value() + if (!(value !== undefined && validator(value))) { + db + .set(currentPath, defaultValue) + .write() + } + return currentPath +} + +/** + * @description 将数据存储到指定位置 | 路径不存在会自动初始化 + * @description 效果类似于取值 dbName.path = value + * @param {Object} payload dbName {String} 数据库名称 + * @param {Object} payload path {String} 存储路径 + * @param {Object} payload value {*} 需要存储的值 + * @param {Object} payload user {Boolean} 是否区分用户 + */ +export function dbSet ({ + dbName = 'database', + path = '', + value = '', + user = false +}) { + db.set(pathInit({ + dbName, + path, + user + }), value).write() +} + +/** + * @description 获取数据 + * @description 效果类似于取值 dbName.path || defaultValue + * @param {Object} payload dbName {String} 数据库名称 + * @param {Object} payload path {String} 存储路径 + * @param {Object} payload defaultValue {*} 取值失败的默认值 + * @param {Object} payload user {Boolean} 是否区分用户 + */ +export function dbGet ({ + dbName = 'database', + path = '', + defaultValue = '', + user = false +}) { + return new Promise(resolve => { + resolve(cloneDeep(db.get(pathInit({ + dbName, + path, + user, + defaultValue + })).value())) + }) +} + +/** + * @description 获取存储数据库对象 + * @param {Object} payload user {Boolean} 是否区分用户 + */ +export function database ({ + dbName = 'database', + path = '', + user = false, + validator = () => true, + defaultValue = '' +} = {}) { + return new Promise(resolve => { + resolve(db.get(pathInit({ + dbName, path, user, validator, defaultValue + }))) + }) +} diff --git a/src/libs/util.js b/src/libs/util.js index 114843b..7b4b740 100644 --- a/src/libs/util.js +++ b/src/libs/util.js @@ -1,10 +1,10 @@ import cookies from './util.cookies' -// import db from './util.db' +import db from './util.db' // import log from './util.log' const util = { cookies, - // db, + db, // log } @@ -13,7 +13,7 @@ const util = { * @param {String} title 标题 */ util.title = function (titleText) { - const processTitle = process.env.VUE_APP_TITLE || 'D2Admin' + const processTitle = process.env.VUE_APP_TITLE || 'GoIndex' window.document.title = `${processTitle}${titleText ? ` | ${titleText}` : ''}` } diff --git a/src/locales/en.json b/src/locales/en.json index dd23c14..85d924f 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1,5 +1,5 @@ { - "_name": "English", + "_name": "🇬🇧English", "languages": "Languages", "index": "Index", "folder": "Folder", @@ -37,5 +37,11 @@ "text": { "loading": "Loading..." } + }, + "setting": { + "clear": { + "text": "Clean cache", + "success": "Cache cleanup successful" + } } } diff --git a/src/locales/zh-chs.json b/src/locales/zh-chs.json index e8750ff..f2db110 100644 --- a/src/locales/zh-chs.json +++ b/src/locales/zh-chs.json @@ -1,41 +1,47 @@ { - "_name": "简体中文", - "languages": "选择语言", - "index": "首页", - "folder": "文件夹", - "notify": { - "title": "提示" + "_name": "🇨🇳简体中文", + "languages": "选择语言", + "index": "首页", + "folder": "文件夹", + "notify": { + "title": "提示" + }, + "copy": { + "success": "复制成功", + "error": "复制失败" + }, + "list": { + "auth": "目录加密,请输入密码", + "title": { + "file": "文件", + "moditime": "修改时间", + "size": "大小", + "operation": "操作" }, - "copy": { - "success": "复制成功", - "error": "复制失败" - }, - "list": { - "auth": "目录加密,请输入密码", - "title": { - "file": "文件", - "moditime": "修改时间", - "size": "大小", - "operation": "操作" - }, - "loading": "加载中...", - "opt": { - "copy": "复制链接", - "newTab": "打开新的标签页", - "download": "下载" - } - }, - "search": { - "placeholder": "搜索..." - }, - "page": { - "video": { - "play": "播放", - "download": "下载", - "link": "下载地址" - }, - "text": { - "loading": "加载中..." - } + "loading": "加载中...", + "opt": { + "copy": "复制链接", + "newTab": "打开新的标签页", + "download": "下载" } -} \ No newline at end of file + }, + "search": { + "placeholder": "搜索..." + }, + "page": { + "video": { + "play": "播放", + "download": "下载", + "link": "下载地址" + }, + "text": { + "loading": "加载中..." + } + }, + "setting": { + "clear": { + "text": "清理缓存", + "success": "缓存清理成功" + } + } +} diff --git a/src/locales/zh-cht.json b/src/locales/zh-cht.json index 86babd0..282827d 100644 --- a/src/locales/zh-cht.json +++ b/src/locales/zh-cht.json @@ -1,41 +1,47 @@ { - "_name": "繁体中文", - "languages": "選擇語言", - "index": "首頁", - "folder": "文件夾", - "notify": { - "title": "提示" + "_name": "🇨🇳繁体中文", + "languages": "選擇語言", + "index": "首頁", + "folder": "文件夾", + "notify": { + "title": "提示" + }, + "copy": { + "success": "復制成功", + "error": "復制失敗" + }, + "list": { + "auth": "目錄加密,請輸入密碼", + "title": { + "file": "文件", + "moditime": "修改時間", + "size": "大小", + "operation": "操作" }, - "copy": { - "success": "復制成功", - "error": "復制失敗" - }, - "list": { - "auth": "目錄加密,請輸入密碼", - "title": { - "file": "文件", - "moditime": "修改時間", - "size": "大小", - "operation": "操作" - }, - "loading": "加載中...", - "opt": { - "copy": "復制鏈接", - "newTab": "打開新的標簽頁", - "download": "下載" - } - }, - "search": { - "placeholder": "搜索..." - }, - "page": { - "video": { - "play": "播放", - "download": "下載", - "link": "下載地址" - }, - "text": { - "loading": "加載中..." - } + "loading": "加載中...", + "opt": { + "copy": "復制鏈接", + "newTab": "打開新的標簽頁", + "download": "下載" } -} \ No newline at end of file + }, + "search": { + "placeholder": "搜索..." + }, + "page": { + "video": { + "play": "播放", + "download": "下載", + "link": "下載地址" + }, + "text": { + "loading": "加載中..." + } + }, + "setting": { + "clear": { + "text": "清理緩存", + "success": "緩存清理成功" + } + } +} diff --git a/src/main.js b/src/main.js index a68f2bd..7cb8518 100644 --- a/src/main.js +++ b/src/main.js @@ -1,15 +1,15 @@ import Vue from 'vue' import App from './App.vue' import ElementUI from 'element-ui' -import 'element-ui/lib/theme-chalk/color-picker.css' -import 'element-ui/lib/theme-chalk/base.css' -import 'element-ui/lib/theme-chalk/button.css' +import 'element-ui/lib/theme-chalk/icon.css' import 'element-ui/lib/theme-chalk/notification.css' import 'element-ui/lib/theme-chalk/loading.css' import axios from '@utils/axios' import VueAxios from 'vue-axios' import router from './router' import i18n from './i18n' +// store +import store from '@/store/index' import VueClipboard from 'vue-clipboard2' import "@/assets/style/theme/register.scss" @@ -20,6 +20,7 @@ Vue.use(VueClipboard) new Vue({ router, + store, i18n, render: h => h(App) }).$mount('#app') diff --git a/src/router/index.js b/src/router/index.js index c04f4d9..e0dc5ff 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,8 +1,12 @@ import Vue from "vue"; +import febAlive from "feb-alive"; import VueRouter from "vue-router"; // 路由数据 import routes from "./routes"; +// 在router实例化之前重写history +febAlive.resetHistory(); + // fix vue-router NavigationDuplicated const VueRouterPush = VueRouter.prototype.push; VueRouter.prototype.push = function push(location) { @@ -19,11 +23,20 @@ Vue.use(VueRouter); const router = new VueRouter({ mode: "history", scrollBehavior(to, from, savePosition) { - return { x: 0, y: 0 }; + if (savePosition) { + return savePosition; + } else { + return { + x: 0, + y: 0, + }; + } }, routes, }); +Vue.use(febAlive, { router }); + /** * 路由拦截 * 权限验证 diff --git a/src/router/routes.js b/src/router/routes.js index d900a64..e3d3889 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -2,7 +2,8 @@ const _import = require("@/libs/util.import." + process.env.NODE_ENV); const meta = { - keepAlive: true + // keepAlive: true + disableCache: false } const frameIn = [{ diff --git a/src/store/index.js b/src/store/index.js new file mode 100644 index 0000000..63fabbc --- /dev/null +++ b/src/store/index.js @@ -0,0 +1,12 @@ +import Vue from 'vue' +import Vuex from 'vuex' + +import acrou from './modules/acrou' + +Vue.use(Vuex) + +export default new Vuex.Store({ + modules: { + acrou + } +}) diff --git a/src/store/modules/acrou/index.js b/src/store/modules/acrou/index.js new file mode 100644 index 0000000..6f1a7ce --- /dev/null +++ b/src/store/modules/acrou/index.js @@ -0,0 +1,16 @@ +/** + * The file enables `@/store/index.js` to import all vuex modules + * in a one-shot manner. There should not be any reason to edit this file. + */ + +const files = require.context('./modules', false, /\.js$/) +const modules = {} + +files.keys().forEach(key => { + modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default +}) + +export default { + namespaced: true, + modules +} diff --git a/src/store/modules/acrou/modules/db.js b/src/store/modules/acrou/modules/db.js new file mode 100644 index 0000000..7232f5e --- /dev/null +++ b/src/store/modules/acrou/modules/db.js @@ -0,0 +1,157 @@ +import router from '@/router' +import { cloneDeep } from 'lodash' +import { database as getDatabase, dbGet, dbSet } from '@/libs/util.db' + +export default { + namespaced: true, + actions: { + /** + * @description 将数据存储到指定位置 | 路径不存在会自动初始化 + * @description 效果类似于取值 dbName.path = value + * @param {Object} context + * @param {Object} payload dbName {String} 数据库名称 + * @param {Object} payload path {String} 存储路径 + * @param {Object} payload value {*} 需要存储的值 + * @param {Object} payload user {Boolean} 是否区分用户 + */ + set (context, { + dbName = 'database', + path = '', + value = '', + user = false + }) { + dbSet({ dbName, path, value, user }) + }, + /** + * @description 获取数据 + * @description 效果类似于取值 dbName.path || defaultValue + * @param {Object} context + * @param {Object} payload dbName {String} 数据库名称 + * @param {Object} payload path {String} 存储路径 + * @param {Object} payload defaultValue {*} 取值失败的默认值 + * @param {Object} payload user {Boolean} 是否区分用户 + */ + get (context, { + dbName = 'database', + path = '', + defaultValue = '', + user = false + }) { + return dbGet({ dbName, path, defaultValue, user }) + }, + /** + * @description 获取存储数据库对象 + * @param {Object} context + * @param {Object} payload user {Boolean} 是否区分用户 + */ + database (context, { + user = false + } = {}) { + return getDatabase({ + user, + defaultValue: {} + }) + }, + /** + * @description 清空存储数据库对象 + * @param {Object} context + * @param {Object} payload user {Boolean} 是否区分用户 + */ + databaseClear (context, { + user = false + } = {}) { + return getDatabase({ + user, + validator: () => false, + defaultValue: {} + }) + }, + /** + * @description 获取存储数据库对象 [ 区分页面 ] + * @param {Object} context + * @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ] + * @param {Object} payload user {Boolean} 是否区分用户 + */ + databasePage (context, { + basis = 'fullPath', + user = false + } = {}) { + return getDatabase({ + path: `$page.${router.app.$route[basis]}`, + user, + defaultValue: {} + }) + }, + /** + * @description 清空存储数据库对象 [ 区分页面 ] + * @param {Object} context + * @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ] + * @param {Object} payload user {Boolean} 是否区分用户 + */ + databasePageClear (context, { + basis = 'fullPath', + user = false + } = {}) { + return getDatabase({ + path: `$page.${router.app.$route[basis]}`, + user, + validator: () => false, + defaultValue: {} + }) + }, + /** + * @description 快速将页面当前的数据 ( $data ) 持久化 + * @param {Object} context + * @param {Object} payload instance {Object} vue 实例 + * @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ] + * @param {Object} payload user {Boolean} 是否区分用户 + */ + pageSet (context, { + instance, + basis = 'fullPath', + user = false + }) { + return getDatabase({ + path: `$page.${router.app.$route[basis]}.$data`, + user, + validator: () => false, + defaultValue: cloneDeep(instance.$data) + }) + }, + /** + * @description 快速获取页面快速持久化的数据 + * @param {Object} context + * @param {Object} payload instance {Object} vue 实例 + * @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ] + * @param {Object} payload user {Boolean} 是否区分用户 + */ + pageGet (context, { + instance, + basis = 'fullPath', + user = false + }) { + return dbGet({ + path: `$page.${router.app.$route[basis]}.$data`, + user, + defaultValue: cloneDeep(instance.$data) + }) + }, + /** + * @description 清空页面快照 + * @param {Object} context + * @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ] + * @param {Object} payload user {Boolean} 是否区分用户 + */ + pageClear (context, { + basis = 'fullPath', + user = false + }) { + return getDatabase({ + path: `$page.${router.app.$route[basis]}.$data`, + user, + validator: () => false, + defaultValue: {} + }) + } + } +} diff --git a/src/utils/AcrouUtil.js b/src/utils/AcrouUtil.js index 45088ae..0c1accb 100644 --- a/src/utils/AcrouUtil.js +++ b/src/utils/AcrouUtil.js @@ -1,27 +1,27 @@ import axios from "@utils/axios"; let Base64 = require("js-base64").Base64; -const exts = [ - "html", - "php", - "css", - "go", - "java", - "js", - "json", - "py", - "txt", - "sh", - "md", - "mp4", - "webm", - "mkv", - "bmp", - "jpg", - "jpeg", - "png", - "gif", -]; +// const exts = [ +// "html", +// "php", +// "css", +// "go", +// "java", +// "js", +// "json", +// "py", +// "txt", +// "sh", +// "md", +// "mp4", +// "webm", +// "mkv", +// "bmp", +// "jpg", +// "jpeg", +// "png", +// "gif", +// ]; export const checkoutPath = (path, file) => { if (file.mimeType === "application/vnd.google-apps.folder") { @@ -38,7 +38,6 @@ export const checkView = (path) => { .split(".") .pop() .toLowerCase(); - console.log(path) let base64Path = encode64(path); if ("|html|php|css|go|java|js|json|txt|sh|md|".indexOf(`|${ext}|`) >= 0) { path = path.replace(/\/(\d+:)\/.*/, (p1, p2) => { @@ -101,7 +100,6 @@ export function get_file(option, callback) { var modifiedTime = option.file.modifiedTime; var key = "file_path_" + path + modifiedTime; var data = localStorage.getItem(key); - data = ""; if (data) { return callback(data); } else { diff --git a/src/views/Layout.vue b/src/views/Layout.vue index 3a36d0e..fd5ac95 100644 --- a/src/views/Layout.vue +++ b/src/views/Layout.vue @@ -4,9 +4,11 @@
- + + - + +
@@ -14,11 +16,11 @@ diff --git a/src/views/common/Navbar.vue b/src/views/common/Navbar.vue index 1443b6c..8f59e76 100644 --- a/src/views/common/Navbar.vue +++ b/src/views/common/Navbar.vue @@ -58,11 +58,7 @@

- - + @@ -79,14 +76,12 @@ diff --git a/src/views/page/GoVideo.vue b/src/views/page/GoVideo.vue index e5c0f37..4ec9451 100644 --- a/src/views/page/GoVideo.vue +++ b/src/views/page/GoVideo.vue @@ -32,7 +32,7 @@
- +
@@ -97,7 +97,7 @@ export default { methods: { render () { // 便于开发环境调试 - this.videourl = window.location.origin + this.url; + this.videourl = window.location.origin + encodeURI(this.url); this.apiurl = "https://api.jsonpop.cn/demo/blplyaer/?url=" + this.videourl; } diff --git a/vue.config.js b/vue.config.js index 45f9fed..260e900 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,11 +1,15 @@ const path = require("path"); const cdnDependencies = require("./dependencies-cdn"); const BuildAppJSPlugin = require("./buildAppJSPlugin"); +const CompressionWebpackPlugin = require('compression-webpack-plugin') function resolve(dir) { return path.join(__dirname, dir); } +// 增加环境变量 +process.env.APP_VERSION = require('./package.json').version + // 基础路径 注意发布之前要先修改这里 let publicPath = process.env.VUE_APP_PUBLIC_PATH || "/"; @@ -25,11 +29,21 @@ module.exports = { lintOnSave: true, configureWebpack: (config) => { - const configNew = {}; - if (process.env.NODE_ENV === "production") { - configNew.externals = externals; + const configNew = {} + if (process.env.NODE_ENV === 'production') { + configNew.externals = externals + configNew.plugins = [ + // gzip + new CompressionWebpackPlugin({ + filename: '[path].gz[query]', + test: new RegExp('\\.(' + ['js', 'css'].join('|') + ')$'), + threshold: 10240, + minRatio: 0.8, + deleteOriginalAssets: false + }) + ] } - return configNew; + return configNew }, chainWebpack: (config) => { @@ -42,12 +56,16 @@ module.exports = { args[0].cdn = cdn; } else { args[0].cdn = { + js: cdnDependencies.filter((e) => e.name === "").map((e) => e.js), css: cdnDependencies.filter((e) => e.name === "").map((e) => e.css), }; } args[0].inject = false return args; }); + // 解决 cli3 热更新失效 https://github.com/vuejs/vue-cli/issues/1559 + config.resolve + .symlinks(true) config.resolve.alias .set("@", resolve("src")) .set("@assets", resolve("src/assets"))