解决页面级缓存问题,继续优化性能

This commit is contained in:
Aicirou 2020-05-14 03:24:35 +08:00
parent 84690b2e6e
commit 05bf9d6aaa
27 changed files with 816 additions and 250 deletions

View File

@ -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' },

288
package-lock.json generated
View File

@ -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",

View File

@ -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",

View File

@ -5,49 +5,28 @@
</template>
<script>
import util from '@/libs/util'
import util from "@/libs/util";
import Layout from "./views/Layout";
export default {
name: "App",
components: {
Layout
Layout,
},
data: function() {
return {
config: {
siteName: "",
title: "",
path: ""
}
};
return {};
},
watch: {
'$i18n.locale': 'i18nHandle'
"$i18n.locale": "i18nHandle",
},
created() {
this.i18nHandle(this.$i18n.locale)
this.i18nHandle(this.$i18n.locale);
},
methods: {
i18nHandle (val, oldVal) {
util.cookies.set('lang', val)
document.querySelector('html').setAttribute('lang', val)
}
i18nHandle(val) {
util.cookies.set("lang", val);
document.querySelector("html").setAttribute("lang", val);
},
},
mounted() {
let scripts = ["https://at.alicdn.com/t/font_1760192_zf96psu0uo.js"];
scripts.map(item => {
let script = document.createElement("script");
script.type = "text/javascript";
script.src = item;
document.getElementsByTagName("head")[0].appendChild(script);
});
let path = window.location.pathname;
this.config.path = path;
this.config.siteName = document.getElementsByTagName("title")[0].innerText;
this.config.title = this.siteName + "-" + decodeURI(path);
// this.$refs.layout.render(this.config);
}
};
</script>

View File

@ -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;

View File

@ -1,3 +1,4 @@
@charset "utf-8";
@import 'bulma';
// @import 'bulma-pageloader';
@import '~@/assets/style/theme/acrou/index.scss';

View File

@ -1,45 +0,0 @@
<template>
<el-color-picker
class="btn-text can-hover"
value="#363636"
:predefine="predefine"
size="mini"
/>
</template>
<script>
// import { mapState, mapActions } from 'vuex'
export default {
name: 'd2-header-color',
data () {
return {
predefine: [
'#ff4500',
'#ff8c00',
'#ffd700',
'#90ee90',
'#00ced1',
'#1e90ff',
'#c71585',
'#363636'
]
}
},
// computed: {
// ...mapState('d2admin/color', [
// 'value'
// ])
// },
watch: {
value (value) {
this.set(value)
}
},
// methods: {
// ...mapActions('d2admin/color', [
// 'set'
// ])
// }
}
</script>

View File

@ -1,15 +0,0 @@
<template>
<a class="navbar-item" @click="handleClick">
<i class="fa fa-search"></i>
</a>
</template>
<script>
export default {
methods: {
handleClick () {
this.$emit('click')
}
}
}
</script>

View File

@ -0,0 +1,32 @@
<template>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link is-arrowless" title="Setting">
<i class="fa fa-cog" aria-hidden="true"></i>
</a>
<div class="navbar-dropdown is-left">
<a class="navbar-item" @click="cleanCache">
<span class="icon">
<i class="fa fa-trash" aria-hidden="true"></i>
</span>
{{ $t("setting.clear.text") }}
</a>
</div>
</div>
</template>
<script>
export default {
data() {
return {};
},
methods: {
cleanCache() {
this.$notify({
title: this.$t("notify.title"),
message: this.$t("setting.clear.success"),
type: "success",
});
},
},
};
</script>

View File

@ -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

106
src/libs/util.db.js Normal file
View File

@ -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
})))
})
}

View File

@ -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}` : ''}`
}

View File

@ -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"
}
}
}

View File

@ -1,5 +1,5 @@
{
"_name": "简体中文",
"_name": "🇨🇳简体中文",
"languages": "选择语言",
"index": "首页",
"folder": "文件夹",
@ -37,5 +37,11 @@
"text": {
"loading": "加载中..."
}
},
"setting": {
"clear": {
"text": "清理缓存",
"success": "缓存清理成功"
}
}
}

View File

@ -1,5 +1,5 @@
{
"_name": "繁体中文",
"_name": "🇨🇳繁体中文",
"languages": "選擇語言",
"index": "首頁",
"folder": "文件夾",
@ -37,5 +37,11 @@
"text": {
"loading": "加載中..."
}
},
"setting": {
"clear": {
"text": "清理緩存",
"success": "緩存清理成功"
}
}
}

View File

@ -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')

View File

@ -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 });
/**
* 路由拦截
* 权限验证

View File

@ -2,7 +2,8 @@
const _import = require("@/libs/util.import." + process.env.NODE_ENV);
const meta = {
keepAlive: true
// keepAlive: true
disableCache: false
}
const frameIn = [{

12
src/store/index.js Normal file
View File

@ -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
}
})

View File

@ -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
}

View File

@ -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: {}
})
}
}
}

View File

@ -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 {

View File

@ -4,9 +4,11 @@
<section class="section">
<div class="container">
<bread-crumb ref="breadcrumb"></bread-crumb>
<keep-alive>
<!-- <keep-alive> -->
<feb-alive>
<router-view></router-view>
</keep-alive>
</feb-alive>
<!-- </keep-alive> -->
<Footer></Footer>
</div>
</section>
@ -14,9 +16,9 @@
</template>
<script>
import Head from "./common/Head"
import Head from "./common/Head";
import BreadCrumb from "./common/BreadCrumb";
import Footer from "./common/Footer"
import Footer from "./common/Footer";
export default {
data: function() {
return {
@ -38,7 +40,7 @@ export default {
},
setReadmemd(val) {
this.readmemd = val;
}
}
}
},
},
};
</script>

View File

@ -58,11 +58,7 @@
</p>
</div>
</div>
<!-- <header-search /> -->
<header-locales />
<div class="navbar-item">
<header-color />
</div>
<a
class="navbar-item"
target="_blank"
@ -72,6 +68,7 @@
>
<i class="fab fa-github"></i>
</a>
<header-setting />
</div>
</div>
</div>
@ -79,14 +76,12 @@
</template>
<script>
import headerSearch from "@/layout/header-aside/components/header-search";
import headerLocales from "@/layout/header-aside/components/header-locales";
import headerColor from "@/layout/header-aside/components/header-color";
import headerSetting from "@/layout/header-aside/components/header-setting";
export default {
components: {
headerSearch,
headerLocales,
headerColor,
headerSetting,
},
created() {
this.siteName = document.getElementsByTagName("title")[0].innerText;

View File

@ -236,7 +236,7 @@ export default {
},
copy(path) {
let origin = window.location.origin;
path = origin + path;
path = origin + encodeURI(path);
this.$copyText(path)
.then(() => {
this.$notify({
@ -333,19 +333,5 @@ export default {
return "#" + (this.icon[type] ? this.icon[type] : "icon-weizhi");
},
},
watch: {
$route(to, from) {
// 退page_token
if (to.path.length < from.path.length) {
this.page.page_token = null;
}
if (
to.path.indexOf(":search") > 0 ||
(to.path.substr(-1) === "/" && from.meta.view === "list")
) {
this.render();
}
},
},
};
</script>

View File

@ -32,7 +32,7 @@
<div class="field">
<label class="label">{{$t('page.video.link')}}</label>
<div class="control">
<input class="input" type="text" :value="decodeURIComponent(videourl)" />
<input class="input" type="text" :value="videourl" />
</div>
</div>
<div class="columns is-mobile is-multiline has-text-centered">
@ -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;
}

View File

@ -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"))