继续优化页面

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,45 +1,53 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<!-- 使用 CDN 加速的 CSS 文件,配置在 vue.config.js 下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style">
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet">
<% } %>
<title><%= htmlWebpackPlugin.options.title %></title>
<script>
var authConfig = {
roots: [
{
id: "0AEofxddwF4bAUk9PVA",
name: "TeamDrive",
pass: "",
},
{
id: "root",
name: "PriveDrive",
pass: "",
},
],
};
window.gds = JSON.parse(
JSON.stringify(authConfig.roots.map((it) => it.name))
);
window.current_drive_order = 0;
// window.MODEL = { q: "the" };
</script>
<!-- 使用 CDN 加速的 JS 文件,配置在 vue.config.js 下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
<script src="/app.js"></script>
</head>
<body>
</body>
</html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<!-- 使用 CDN 加速的 CSS 文件,配置在 vue.config.js 下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style">
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet">
<% } %>
<title><%= htmlWebpackPlugin.options.title %></title>
<script>
var authConfig = {
version: '1.1.0',
roots: [
{
id: "0AEofxddwF4bAUk9PVA",
name: "TeamDrive",
pass: "",
},
{
id: "root",
name: "PriveDrive",
pass: "",
},
],
};
var themeOptions = {
// en/zh-chs/zh-cht
languages: 'en'
}
window.gdconfig = JSON.parse(JSON.stringify({ version: authConfig.version, themeOptions: themeOptions }));
window.gds = JSON.parse(
JSON.stringify(authConfig.roots.map((it) => it.name))
);
window.current_drive_order = 0;
// window.MODEL = { q: "the" };
</script>
<!-- 使用 CDN 加速的 JS 文件,配置在 vue.config.js 下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
<script src="/app.js"></script>
</head>
<body>
</body>
</html>

View File

@ -25,7 +25,7 @@ Vue.prototype.$languages = Object.keys(messages).map(langlage => ({
}))
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,
messages
})

View File

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

View File

@ -1,12 +1,50 @@
// 由于懒加载页面太多的话会造成webpack热更新太慢所以开发环境不使用懒加载只有生产环境使用懒加载
const _import = require("@/libs/util.import." + process.env.NODE_ENV);
const frameIn = [
{ path: "/:id:(text)/:path", component: _import("page/GoText"), props: 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") },
{ path: "/:id::cmd?(/?/??.*/)", component: _import("page/GoList") },
const meta = {
keepAlive: true
}
const frameIn = [{
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">
<div class="container">
<bread-crumb ref="breadcrumb"></bread-crumb>
<!-- <keep-alive> -->
<keep-alive>
<router-view></router-view>
<!-- </keep-alive> -->
</keep-alive>
<Footer></Footer>
</div>
</section>

View File

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

View File

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

View File

@ -25,6 +25,11 @@
<svg class="iconfont" aria-hidden="true">
<use :xlink:href="getIcon(file.mimeType)" />
</svg>
<!-- <span class="icon">
<figure class="image is-24x24">
<img :src="file.thumbnailLink" />
</figure>
</span>-->
{{file.name}}
</td>
<td class="is-hidden-mobile is-hidden-touch">{{file.modifiedTime}}</td>
@ -84,7 +89,7 @@ export default {
Headmd: Markdown,
Readmemd: Markdown
},
data: function() {
data: function () {
return {
page: {
page_token: null,
@ -123,7 +128,7 @@ export default {
};
},
computed: {
columns() {
columns () {
return [
{ name: this.$t("list.title.file"), style: "" },
{
@ -138,22 +143,22 @@ export default {
},
{
name: this.$t("list.title.operation"),
style: "width:13%",
style: "width:13.5%",
class: "is-hidden-mobile is-hidden-touch"
}
];
}
},
mounted() {
mounted () {
this.render();
},
methods: {
cellClass(row) {
cellClass (row) {
if (row.columnIndex != 0) {
return "is-hidden-mobile is-hidden-touch has-text-drak";
}
},
render() {
render () {
let path = window.location.pathname;
this.loading = true;
var password = localStorage.getItem("password" + path);
@ -220,7 +225,7 @@ export default {
this.loading = false;
});
},
checkPassword(path) {
checkPassword (path) {
var pass = prompt(this.$t("list.auth"), "");
localStorage.setItem("password" + path, pass);
if (pass != null && pass != "") {
@ -229,12 +234,12 @@ export default {
history.go(-1);
}
},
copy(path) {
copy (path) {
let origin = window.location.origin;
path = origin + path;
clipboard.writeText(path);
},
go(file, target) {
go (file, target) {
let path = file.path;
if (path.match("/[0-9]+:search/")) {
this.goSearchResult(file, target);
@ -261,7 +266,7 @@ export default {
return;
}
},
goSearchResult(file, target) {
goSearchResult (file, target) {
this.loading = true;
let cur = window.current_drive_order;
axios
@ -286,19 +291,25 @@ export default {
console.log(e);
});
},
getIcon(type) {
getIcon (type) {
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;
$route (to, from) {
if (!to.path.indexOf(':search')) {
// 退page_token
if (to.path.length < from.path.length) {
this.page.page_token = null;
}
if (to.path.substr(-1) !== '/' && from.meta.view !== "list") {
return
}
}
if (to.path.substr(-1) === '/') {
this.render();
}
this.headmd = { display: false, file: {}, path: "" },
this.readmemd = { display: false, file: {}, path: "" }
this.render();
}
}
};

View File

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

View File

@ -15,32 +15,40 @@
<script>
import { get_file, decode64 } from "@utils/AcrouUtil";
export default {
data: function() {
data: function () {
return {
path: "",
content: ""
};
},
created() {
watch: {
$route (to, from) {
this.render();
}
},
created () {
this.render();
},
computed: {
url() {
return decode64(this.$route.params.path);
url () {
if (this.$route.params.path) {
return decode64(this.$route.params.path);
}
return ''
}
},
components: {
editor: require("@/components/ace-editor")
},
methods: {
render() {
render () {
let path = this.url;
this.content = this.$t("page.text.loading");
get_file({ path: path, file: {} }, data => {
this.content = data;
});
},
editorInit(editor) {
editorInit (editor) {
editor.setFontSize(18);
editor.session.setUseWrapMode(false);
require("brace/ext/language_tools"); //language extension prerequsite...

View File

@ -56,7 +56,7 @@
<script>
import { decode64 } from "@utils/AcrouUtil";
export default {
data: function() {
data: function () {
return {
apiurl: "",
videourl: "",
@ -95,21 +95,24 @@ export default {
};
},
methods: {
render() {
render () {
// 便
this.videourl = window.location.origin + this.url;
this.apiurl =
"https://api.jsonpop.cn/demo/blplyaer/?url=" + this.videourl;
}
},
created() {
created () {
this.render();
},
computed: {
url() {
return decode64(this.$route.params.path);
url () {
if (this.$route.params.path) {
return decode64(this.$route.params.path);
}
return ''
},
getThunder() {
getThunder () {
return Buffer.from("AA" + this.videourl + "ZZ").toString("base64");
}
}