继续优化页面

This commit is contained in:
qxz 2020-05-07 14:54:04 +08:00
parent a9cae08aa2
commit f83cfaba0d
11 changed files with 163 additions and 89 deletions

View File

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
@ -13,6 +14,7 @@
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
<script> <script>
var authConfig = { var authConfig = {
version: '1.1.0',
roots: [ roots: [
{ {
id: "0AEofxddwF4bAUk9PVA", id: "0AEofxddwF4bAUk9PVA",
@ -26,6 +28,11 @@
}, },
], ],
}; };
var themeOptions = {
// en/zh-chs/zh-cht
languages: 'en'
}
window.gdconfig = JSON.parse(JSON.stringify({ version: authConfig.version, themeOptions: themeOptions }));
window.gds = JSON.parse( window.gds = JSON.parse(
JSON.stringify(authConfig.roots.map((it) => it.name)) JSON.stringify(authConfig.roots.map((it) => it.name))
); );
@ -42,4 +49,5 @@
<body> <body>
</body> </body>
</html> </html>

View File

@ -25,7 +25,7 @@ Vue.prototype.$languages = Object.keys(messages).map(langlage => ({
})) }))
export default new VueI18n({ export default new VueI18n({
locale: util.cookies.get('lang') || process.env.VUE_APP_I18N_LOCALE, locale: util.cookies.get('lang') || window.gdconfig.themeOptions.languages || process.env.VUE_APP_I18N_LOCALE,
fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE, fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE,
messages messages
}) })

View File

@ -30,7 +30,7 @@ const router = new VueRouter({
*/ */
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
console.log("before:"); console.log("before:");
console.log(to); console.log(to,from);
next(); next();
}); });

View File

@ -1,12 +1,50 @@
// 由于懒加载页面太多的话会造成webpack热更新太慢所以开发环境不使用懒加载只有生产环境使用懒加载 // 由于懒加载页面太多的话会造成webpack热更新太慢所以开发环境不使用懒加载只有生产环境使用懒加载
const _import = require("@/libs/util.import." + process.env.NODE_ENV); const _import = require("@/libs/util.import." + process.env.NODE_ENV);
const frameIn = [ const meta = {
{ path: "/:id:(text)/:path", component: _import("page/GoText"), props: true }, keepAlive: true
{ path: "/:id:(pdf)/:path", component: _import("page/GoPdf"), props: true }, }
{ path: "/:id:(video)/:path", component: _import("page/GoVideo") },
{ path: "/:id:(image)/:path", component: _import("page/GoImg") }, const frameIn = [{
{ path: "/:id::cmd?(/?/??.*/)", component: _import("page/GoList") }, path: "/:id:(text)/:path",
component: _import("page/GoText"),
meta: {
...meta,
view: 'text'
}
},
{
path: "/:id:(pdf)/:path",
component: _import("page/GoPdf"),
meta: {
...meta,
view: 'pdf'
}
},
{
path: "/:id:(video)/:path",
component: _import("page/GoVideo"),
meta: {
...meta,
view: 'video'
}
},
{
path: "/:id:(image)/:path",
component: _import("page/GoImg"),
meta: {
...meta,
view: 'image'
}
},
{
path: "/:id::cmd?(/?/??.*)",
component: _import("page/GoList"),
meta: {
...meta,
view: 'list'
}
},
]; ];
export default frameIn; export default frameIn;

View File

@ -4,9 +4,9 @@
<section class="section"> <section class="section">
<div class="container"> <div class="container">
<bread-crumb ref="breadcrumb"></bread-crumb> <bread-crumb ref="breadcrumb"></bread-crumb>
<!-- <keep-alive> --> <keep-alive>
<router-view></router-view> <router-view></router-view>
<!-- </keep-alive> --> </keep-alive>
<Footer></Footer> <Footer></Footer>
</div> </div>
</section> </section>

View File

@ -38,7 +38,7 @@
<div class="navbar-end"> <div class="navbar-end">
<!-- is-hidden-desktop --> <!-- is-hidden-desktop -->
<!-- <div class="navbar-item"> <div class="navbar-item">
<div class="field is-grouped"> <div class="field is-grouped">
<p class="control has-icons-left" style="width:100%;"> <p class="control has-icons-left" style="width:100%;">
<input <input
@ -53,8 +53,8 @@
</span> </span>
</p> </p>
</div> </div>
</div> --> </div>
<header-search /> <!-- <header-search /> -->
<header-locales /> <header-locales />
<div class="navbar-item"> <div class="navbar-item">
<header-color/> <header-color/>

View File

@ -23,8 +23,11 @@ export default {
}, },
computed: { computed: {
url() { url() {
if (this.$route.params.path) {
return decode64(this.$route.params.path); return decode64(this.$route.params.path);
} }
return ''
}
}, },
created() { created() {
this.render(); this.render();
@ -33,7 +36,7 @@ export default {
render() { render() {
let path = this.url; let path = this.url;
// 便 // 便
path = process.env.NODE_ENV === "development" ? "/api" + path : ""; // path = process.env.NODE_ENV === "development" ? "/api" + path : "";
this.imgurl = path; this.imgurl = path;
}, },
loading(event) { loading(event) {

View File

@ -25,6 +25,11 @@
<svg class="iconfont" aria-hidden="true"> <svg class="iconfont" aria-hidden="true">
<use :xlink:href="getIcon(file.mimeType)" /> <use :xlink:href="getIcon(file.mimeType)" />
</svg> </svg>
<!-- <span class="icon">
<figure class="image is-24x24">
<img :src="file.thumbnailLink" />
</figure>
</span>-->
{{file.name}} {{file.name}}
</td> </td>
<td class="is-hidden-mobile is-hidden-touch">{{file.modifiedTime}}</td> <td class="is-hidden-mobile is-hidden-touch">{{file.modifiedTime}}</td>
@ -138,7 +143,7 @@ export default {
}, },
{ {
name: this.$t("list.title.operation"), name: this.$t("list.title.operation"),
style: "width:13%", style: "width:13.5%",
class: "is-hidden-mobile is-hidden-touch" class: "is-hidden-mobile is-hidden-touch"
} }
]; ];
@ -292,14 +297,20 @@ export default {
}, },
watch: { watch: {
$route (to, from) { $route (to, from) {
if (!to.path.indexOf(':search')) {
// 退page_token // 退page_token
if (to.path.length < from.path.length) { if (to.path.length < from.path.length) {
this.page.page_token = null; this.page.page_token = null;
} }
if (to.path.substr(-1) === '/') { if (to.path.substr(-1) !== '/' && from.meta.view !== "list") {
this.render(); return
} }
} }
this.headmd = { display: false, file: {}, path: "" },
this.readmemd = { display: false, file: {}, path: "" }
this.render();
}
} }
}; };
</script> </script>

View File

@ -14,8 +14,11 @@ export default {
}, },
computed: { computed: {
url() { url() {
if (this.$route.params.path) {
return decode64(this.$route.params.path); return decode64(this.$route.params.path);
} }
return ''
}
}, },
methods: {} methods: {}
}; };

View File

@ -21,13 +21,21 @@ export default {
content: "" content: ""
}; };
}, },
watch: {
$route (to, from) {
this.render();
}
},
created () { created () {
this.render(); this.render();
}, },
computed: { computed: {
url () { url () {
if (this.$route.params.path) {
return decode64(this.$route.params.path); return decode64(this.$route.params.path);
} }
return ''
}
}, },
components: { components: {
editor: require("@/components/ace-editor") editor: require("@/components/ace-editor")

View File

@ -107,7 +107,10 @@ export default {
}, },
computed: { computed: {
url () { url () {
if (this.$route.params.path) {
return decode64(this.$route.params.path); return decode64(this.$route.params.path);
}
return ''
}, },
getThunder () { getThunder () {
return Buffer.from("AA" + this.videourl + "ZZ").toString("base64"); return Buffer.from("AA" + this.videourl + "ZZ").toString("base64");