调整路由配置,优化页面

This commit is contained in:
Aicirou 2020-05-07 03:29:32 +08:00
parent 0513d69838
commit a9cae08aa2
16 changed files with 306 additions and 83 deletions

View File

@ -3,7 +3,7 @@ module.exports = [
{ name: 'vue-i18n', library: 'VueI18n', js: 'https://cdn.jsdelivr.net/npm/vue-i18n@8.17.3/dist/vue-i18n.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: 'vue-router', library: 'VueRouter', js: 'https://cdn.jsdelivr.net/npm/vue-router@3.1.6/dist/vue-router.min.js', css: '' },
{ name: 'axios', library: 'axios', js: 'https://cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.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: '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: 'js-cookie', library: 'Cookies', js: 'https://cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.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: 'brace', library: 'ace', js: 'https://cdn.jsdelivr.net/npm/brace@0.11.1/index.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/ext/language_tools', library: 'language_tools', js: ' https://cdn.jsdelivr.net/npm/brace@0.11.1/ext/language_tools.js', css: '' },

65
package-lock.json generated
View File

@ -2143,6 +2143,14 @@
"integrity": "sha1-3TeelPDbgxCwgpH51kwyCXZmF/0=", "integrity": "sha1-3TeelPDbgxCwgpH51kwyCXZmF/0=",
"dev": true "dev": true
}, },
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npm.taobao.org/async-validator/download/async-validator-1.8.5.tgz",
"integrity": "sha1-3D4I7B/Q3dtn5ghC8CwM0c7G1/A=",
"requires": {
"babel-runtime": "6.x"
}
},
"asynckit": { "asynckit": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "http://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz", "resolved": "http://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz",
@ -2224,6 +2232,11 @@
"resolve": "^1.12.0" "resolve": "^1.12.0"
} }
}, },
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "https://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha1-Iq69OzOQIyjlEyk6jkmSs4T58bY="
},
"babel-loader": { "babel-loader": {
"version": "8.1.0", "version": "8.1.0",
"resolved": "https://registry.npm.taobao.org/babel-loader/download/babel-loader-8.1.0.tgz?cache=0&sync_timestamp=1584717315701&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbabel-loader%2Fdownload%2Fbabel-loader-8.1.0.tgz", "resolved": "https://registry.npm.taobao.org/babel-loader/download/babel-loader-8.1.0.tgz?cache=0&sync_timestamp=1584717315701&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbabel-loader%2Fdownload%2Fbabel-loader-8.1.0.tgz",
@ -2278,6 +2291,27 @@
"object.assign": "^4.1.0" "object.assign": "^4.1.0"
} }
}, },
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
},
"dependencies": {
"core-js": {
"version": "2.6.11",
"resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.11.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-2.6.11.tgz",
"integrity": "sha1-OIMUafmSK97Y7iHJ3EaYXgOZMIw="
},
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.11.1.tgz?cache=0&sync_timestamp=1584052392667&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregenerator-runtime%2Fdownload%2Fregenerator-runtime-0.11.1.tgz",
"integrity": "sha1-vgWtf5v30i4Fb5cmzuUBf78Z4uk="
}
}
},
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.0.tgz", "resolved": "http://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.0.tgz",
@ -3918,8 +3952,7 @@
"deepmerge": { "deepmerge": {
"version": "1.5.2", "version": "1.5.2",
"resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-1.5.2.tgz", "resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-1.5.2.tgz",
"integrity": "sha1-EEmdhohEza1P7ghC34x/bwyVp1M=", "integrity": "sha1-EEmdhohEza1P7ghC34x/bwyVp1M="
"dev": true
}, },
"default-gateway": { "default-gateway": {
"version": "5.0.5", "version": "5.0.5",
@ -4371,6 +4404,19 @@
"integrity": "sha1-nQqS3v79p8wc+IlQWLiSeV3da0E=", "integrity": "sha1-nQqS3v79p8wc+IlQWLiSeV3da0E=",
"dev": true "dev": true
}, },
"element-ui": {
"version": "2.13.1",
"resolved": "https://registry.npm.taobao.org/element-ui/download/element-ui-2.13.1.tgz",
"integrity": "sha1-DLGkXPJ6phxgHe++GSdArFy533w=",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
"deepmerge": "^1.2.0",
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.0",
"throttle-debounce": "^1.0.1"
}
},
"elliptic": { "elliptic": {
"version": "6.5.2", "version": "6.5.2",
"resolved": "https://registry.npm.taobao.org/elliptic/download/elliptic-6.5.2.tgz", "resolved": "https://registry.npm.taobao.org/elliptic/download/elliptic-6.5.2.tgz",
@ -8214,6 +8260,11 @@
"integrity": "sha1-suHE3E98bVd0PfczpPWXjRhlBVk=", "integrity": "sha1-suHE3E98bVd0PfczpPWXjRhlBVk=",
"dev": true "dev": true
}, },
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz",
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
},
"npm-run-path": { "npm-run-path": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-run-path%2Fdownload%2Fnpm-run-path-2.0.2.tgz", "resolved": "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-run-path%2Fdownload%2Fnpm-run-path-2.0.2.tgz",
@ -10038,6 +10089,11 @@
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
"dev": true "dev": true
}, },
"resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npm.taobao.org/resize-observer-polyfill/download/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha1-DpAg3T0hAkRY1OvSfiPkAmmBBGQ="
},
"resolve": { "resolve": {
"version": "1.17.0", "version": "1.17.0",
"resolved": "https://registry.npm.taobao.org/resolve/download/resolve-1.17.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fresolve%2Fdownload%2Fresolve-1.17.0.tgz", "resolved": "https://registry.npm.taobao.org/resolve/download/resolve-1.17.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fresolve%2Fdownload%2Fresolve-1.17.0.tgz",
@ -11378,6 +11434,11 @@
"neo-async": "^2.6.0" "neo-async": "^2.6.0"
} }
}, },
"throttle-debounce": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/throttle-debounce/download/throttle-debounce-1.1.0.tgz",
"integrity": "sha1-UYU9o3vmihVctugns1FKPEIuic0="
},
"through": { "through": {
"version": "2.3.8", "version": "2.3.8",
"resolved": "http://registry.npm.taobao.org/through/download/through-2.3.8.tgz", "resolved": "http://registry.npm.taobao.org/through/download/through-2.3.8.tgz",

View File

@ -14,6 +14,8 @@
"bulma": "^0.8.2", "bulma": "^0.8.2",
"clipboard-polyfill": "^2.8.6", "clipboard-polyfill": "^2.8.6",
"core-js": "^3.6.4", "core-js": "^3.6.4",
"element-ui": "^2.13.1",
"js-base64": "^2.5.2",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"markdown-it": "^10.0.0", "markdown-it": "^10.0.0",
"node-sass": "^4.14.0", "node-sass": "^4.14.0",

View File

@ -0,0 +1,45 @@
<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,5 +1,9 @@
import Vue from 'vue' import Vue from 'vue'
import App from './App.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 axios from '@utils/axios' import axios from '@utils/axios'
import VueAxios from 'vue-axios' import VueAxios from 'vue-axios'
import router from './router' import router from './router'
@ -7,6 +11,7 @@ import i18n from './i18n'
import "@/assets/style/theme/register.scss" import "@/assets/style/theme/register.scss"
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(ElementUI)
Vue.use(VueAxios,axios) Vue.use(VueAxios,axios)
new Vue({ new Vue({

View File

@ -1,11 +1,12 @@
// 由于懒加载页面太多的话会造成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 frameIn = [
{ path: '/:id:(text/.*\\.)(html|php|css|go|java|py|js|json|txt|sh|md)', component: _import('page/GoText') }, { path: "/:id:(text)/:path", component: _import("page/GoText"), props: true },
{ path: '/:id:(video/.*\\.)(mp4|webm|mkv)', component: _import('page/GoVideo') }, { path: "/:id:(pdf)/:path", component: _import("page/GoPdf"), props: true },
{ path: '/:id:(image/.*\\.)(bmp|jpg|jpeg|png|gif)', component: _import('page/GoImg') }, { path: "/:id:(video)/:path", component: _import("page/GoVideo") },
{ path: '/:id::cmd?(/?/??.*/)', component: _import('page/GoList') }, { path: "/:id:(image)/:path", component: _import("page/GoImg") },
] { path: "/:id::cmd?(/?/??.*/)", component: _import("page/GoList") },
];
export default frameIn export default frameIn;

View File

@ -1,4 +1,5 @@
import axios from "@utils/axios"; import axios from "@utils/axios";
let Base64 = require("js-base64").Base64;
const exts = [ const exts = [
"html", "html",
@ -23,17 +24,44 @@ const exts = [
]; ];
export const checkoutPath = (path, file) => { export const checkoutPath = (path, file) => {
// 解决/css这种也会匹配的问题
// var ext = path.split(".").length > 1 ? path.split(".").pop() : "";
// if (exts.indexOf(`${ext}`) >= 0) {
// path += "?a=view";
// } else {
if (file.mimeType === "application/vnd.google-apps.folder") { if (file.mimeType === "application/vnd.google-apps.folder") {
if (path.substr(-1) !== "/") { if (path.substr(-1) !== "/") {
path += "/"; path += "/";
} }
} }
// } return path;
};
export const checkView = (path) => {
let name = path.split("/").pop();
let ext = name
.split(".")
.pop()
.toLowerCase();
let base64Path = Base64.encode(path);
if ("|html|php|css|go|java|js|json|txt|sh|md|".indexOf(`|${ext}|`) >= 0) {
path = path.replace(/\/(\d+:)\/.*/, (p1, p2) => {
return `/${p2}text/${base64Path}`;
});
}
if ("|pdf|".indexOf(`|${ext}|`) >= 0) {
path = path.replace(/\/(\d+:)\/.*/, (p1, p2) => {
return `/${p2}pdf/${base64Path}`;
});
}
if ("|mp4|webm|mkv|".indexOf(`|${ext}|`) >= 0) {
path = path.replace(/\/(\d+:)\/.*/, (p1, p2) => {
return `/${p2}video/${base64Path}`;
});
}
if ("|bmp|jpg|jpeg|png|gif|".indexOf(`|${ext}|`) >= 0) {
path = path.replace(/\/(\d+:)\/.*/, (p1, p2) => {
return `/${p2}image/${base64Path}`;
});
}
return path; return path;
}; };
@ -59,6 +87,14 @@ export const getURLParameters = (url) =>
//console.log(getQueryString("/Movies/xx.mp4?a=view&y=123", "y")); //console.log(getQueryString("/Movies/xx.mp4?a=view&y=123", "y"));
export const encode64 = (str) => {
return Base64.encode(str);
};
export const decode64 = (str) => {
return Base64.decode(str);
};
export function get_file(option, callback) { export function get_file(option, callback) {
var path = option.path; var path = option.path;
var modifiedTime = option.file.modifiedTime; var modifiedTime = option.file.modifiedTime;
@ -139,3 +175,52 @@ export function formatFileSize(bytes) {
} }
return bytes; return bytes;
} }
/**
* @param {Number String Date}
* @param {String} 'YYYY-MM-DD HH:mm:ss EEE' (Y)(M)(D)12小时(h)24小时(H)(m)(s)毫秒(S)(E)季度(q)
* @return {String}
* @example XDate.format(new Date(), "YYYY-MM-DD") ==> 2017-08-23
*/
export function formatDate(date, fmt) {
fmt = fmt || 'YYYY-MM-DD HH:mm:ss';
if (typeof date === 'string') {
// date = new Date(date.replace(/-/g, '/'))
date = new Date(date)
}
if (typeof date === 'number') {
date = new Date(date)
}
var o = {
'M+': date.getMonth() + 1,
'D+': date.getDate(),
'h+': date.getHours() % 12 === 0 ? 12 : date.getHours() % 12,
'H+': date.getHours(),
'm+': date.getMinutes(),
's+': date.getSeconds(),
'q+': Math.floor((date.getMonth() + 3) / 3),
'S': date.getMilliseconds()
}
var week = {
'0': '\u65e5',
'1': '\u4e00',
'2': '\u4e8c',
'3': '\u4e09',
'4': '\u56db',
'5': '\u4e94',
'6': '\u516d'
}
if (/(Y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
}
if (/(E+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? '\u661f\u671f' : '\u5468') : '') + week[date.getDay() + ''])
}
for (var k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
}
}
return fmt;
}

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

@ -2,7 +2,7 @@
<nav class="breadcrumb is-hidden-mobile is-hidden-touch" aria-label="breadcrumbs"> <nav class="breadcrumb is-hidden-mobile is-hidden-touch" aria-label="breadcrumbs">
<ul> <ul>
<li> <li>
<a v-show="navs && navs.length>0" @click="go(index)">{{$t('index')}}</a> <a v-show="navs && navs.length>0" @click="go('/'+index+':/')">{{$t('index')}}</a>
</li> </li>
<li <li
v-for="(item,index) in navs" v-for="(item,index) in navs"
@ -17,7 +17,9 @@
</template> </template>
<script> <script>
import { decode64 } from "@utils/AcrouUtil";
export default { export default {
props: ["name"],
data: function() { data: function() {
return { return {
navs: [], navs: [],
@ -28,9 +30,7 @@ export default {
this.render(); this.render();
}, },
watch: { watch: {
$route(to, from) { $route: "render"
this.render();
}
}, },
methods: { methods: {
go(path) { go(path) {
@ -39,8 +39,10 @@ export default {
}); });
}, },
render() { render() {
let path = window.location.pathname; this.index = this.$route.params.id;
this.index = path.match("/\\d+:/")[0] let path = this.$route.params.path
? decode64(this.$route.params.path)
: this.$route.path;
// //
if (path.match("/[0-9]+:search")) { if (path.match("/[0-9]+:search")) {
this.navs = []; this.navs = [];

View File

@ -7,7 +7,7 @@
<a <a
class="tag is-dark" class="tag is-dark"
href="https://github.com/Aicirou/goindex-theme-acrou" href="https://github.com/Aicirou/goindex-theme-acrou"
>goindex-template-acrou</a> >goindex-theme-acrou</a>
<span class="tag is-light"> <span class="tag is-light">
MIT &nbsp; MIT &nbsp;
<i class="fab fa-github"></i> <i class="fab fa-github"></i>

View File

@ -56,6 +56,9 @@
</div> --> </div> -->
<header-search /> <header-search />
<header-locales /> <header-locales />
<div class="navbar-item">
<header-color/>
</div>
<a <a
class="navbar-item" class="navbar-item"
target="_blank" target="_blank"
@ -74,10 +77,12 @@
<script> <script>
import headerSearch from '@/layout/header-aside/components/header-search' import headerSearch from '@/layout/header-aside/components/header-search'
import headerLocales from "@/layout/header-aside/components/header-locales"; import headerLocales from "@/layout/header-aside/components/header-locales";
import headerColor from '@/layout/header-aside/components/header-color'
export default { export default {
components: { components: {
headerSearch, headerSearch,
headerLocales headerLocales,
headerColor
}, },
created() { created() {
if (window.gds && window.gds.length > 0) { if (window.gds && window.gds.length > 0) {

View File

@ -13,6 +13,7 @@
</template> </template>
<script> <script>
import { decode64 } from "@utils/AcrouUtil";
export default { export default {
data: function() { data: function() {
return { return {
@ -20,17 +21,17 @@ export default {
display: false display: false
}; };
}, },
watch: { computed: {
$route(to, from) { url() {
this.render(); return decode64(this.$route.params.path);
} }
}, },
mounted() { created() {
this.render(); this.render();
}, },
methods: { methods: {
render() { render() {
let path = window.location.pathname; 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;

View File

@ -21,7 +21,7 @@
</thead> </thead>
<tbody> <tbody>
<tr v-for="(file,index) in files" v-bind:key="index"> <tr v-for="(file,index) in files" v-bind:key="index">
<td @click="go(file)"> <td @click="go(file, 'view')">
<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>
@ -34,7 +34,11 @@
v-if="file.mimeType!=='application/vnd.google-apps.folder'" v-if="file.mimeType!=='application/vnd.google-apps.folder'"
> >
<span class="icon" @click.stop="copy(file.path)"> <span class="icon" @click.stop="copy(file.path)">
<i class="fa fa-copy faa-shake animated-hover" :title="$t('list.opt.copy')" aria-hidden="true"></i> <i
class="fa fa-copy faa-shake animated-hover"
:title="$t('list.opt.copy')"
aria-hidden="true"
></i>
</span> </span>
<span class="icon" @click.stop="go(file,'_blank')"> <span class="icon" @click.stop="go(file,'_blank')">
<i <i
@ -65,7 +69,12 @@
</template> </template>
<script> <script>
import { utc2beijing, formatFileSize, checkoutPath } from "@utils/AcrouUtil"; import {
formatDate,
formatFileSize,
checkoutPath,
checkView
} from "@utils/AcrouUtil";
import axios from "@/utils/axios"; import axios from "@/utils/axios";
import Markdown from "../common/Markdown"; import Markdown from "../common/Markdown";
import * as clipboard from "clipboard-polyfill"; import * as clipboard from "clipboard-polyfill";
@ -83,7 +92,7 @@ export default {
}, },
files: [], files: [],
loading: true, loading: true,
copyTooltip: '', copyTooltip: "",
icon: { icon: {
"application/vnd.google-apps.folder": "icon-morenwenjianjia", "application/vnd.google-apps.folder": "icon-morenwenjianjia",
"video/mp4": "icon-mp", "video/mp4": "icon-mp",
@ -197,7 +206,7 @@ export default {
return { return {
path: p, path: p,
...item, ...item,
modifiedTime: utc2beijing(item.modifiedTime), modifiedTime: formatDate(item.modifiedTime),
size: formatFileSize(item.size) size: formatFileSize(item.size)
}; };
}); });
@ -222,7 +231,6 @@ export default {
}, },
copy(path) { copy(path) {
let origin = window.location.origin; let origin = window.location.origin;
path = path.replace("?a=view", "");
path = origin + path; path = origin + path;
clipboard.writeText(path); clipboard.writeText(path);
}, },
@ -233,25 +241,25 @@ export default {
return; return;
} }
if (target === "down") { if (target === "down") {
path = path.replace("?a=view", ""); location.href = path;
window.open(path); return;
}
if (target === "view") {
this.$router.push({
path: checkView(path)
});
return;
}
if (file.mimeType === "application/vnd.google-apps.folder") {
this.$router.push({
path: path
});
return; return;
} }
if (target === "_blank") { if (target === "_blank") {
window.open(path); window.open(path);
} else { return;
this.$router.push({
path: path
});
} }
/* else if (path.substr(-1) == "/" && path.indexOf("?a=view") > 0) {
this.$router.push({
path: path
});
} else {
location.href = path;
} */
}, },
goSearchResult(file, target) { goSearchResult(file, target) {
this.loading = true; this.loading = true;
@ -288,8 +296,10 @@ export default {
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) === '/') {
this.render(); this.render();
} }
} }
}
}; };
</script> </script>

View File

@ -1,22 +1,29 @@
<template> <template>
<object :data="url" type="application/pdf" name="test.pdf"> <div>
<object :data="url" type="application/pdf" name="file.pdf">
<embed :src="url" type="application/pdf" /> <embed :src="url" type="application/pdf" />
</object> </object>
</div>
</template> </template>
<script> <script>
import { decode64 } from "@utils/AcrouUtil";
export default { export default {
data: function() { data: function() {
return {}; return {};
}, },
mounted() {}, computed: {
watch: { url() {
$route: "render" return decode64(this.$route.params.path);
}
}, },
methods: { methods: {}
render() {
let path = window.location.pathname;
}
}
}; };
</script> </script>
<style scoped>
object{
width: 100%;
height: -webkit-fill-available;
}
</style>

View File

@ -13,7 +13,7 @@
</template> </template>
<script> <script>
import { get_file } from "@utils/AcrouUtil"; import { get_file, decode64 } from "@utils/AcrouUtil";
export default { export default {
data: function() { data: function() {
return { return {
@ -21,22 +21,22 @@ export default {
content: "" content: ""
}; };
}, },
watch: {
$route(to, from) {
this.render();
}
},
created() { created() {
this.render(); this.render();
}, },
computed: {
url() {
return decode64(this.$route.params.path);
}
},
components: { components: {
editor: require("@/components/ace-editor") editor: require("@/components/ace-editor")
}, },
methods: { methods: {
render() { render() {
let path = window.location.pathname; let path = this.url;
this.content = this.$t("page.text.loading"); this.content = this.$t("page.text.loading");
get_file({ path: path.replace("?a=view", "/"), file: {} }, data => { get_file({ path: path, file: {} }, data => {
this.content = data; this.content = data;
}); });
}, },

View File

@ -54,6 +54,7 @@
</template> </template>
<script> <script>
import { decode64 } from "@utils/AcrouUtil";
export default { export default {
data: function() { data: function() {
return { return {
@ -96,20 +97,18 @@ export default {
methods: { methods: {
render() { render() {
// 便 // 便
this.videourl = window.location.origin + window.location.pathname; this.videourl = window.location.origin + this.url;
this.apiurl = this.apiurl =
"https://api.jsonpop.cn/demo/blplyaer/?url=" + this.videourl; "https://api.jsonpop.cn/demo/blplyaer/?url=" + this.videourl;
} }
}, },
mounted() { created() {
this.render(); this.render();
}, },
watch: {
$route(to, from) {
this.render();
}
},
computed: { computed: {
url() {
return decode64(this.$route.params.path);
},
getThunder() { getThunder() {
return Buffer.from("AA" + this.videourl + "ZZ").toString("base64"); return Buffer.from("AA" + this.videourl + "ZZ").toString("base64");
} }