转移页面

This commit is contained in:
qiuxingzhou 2020-04-24 19:43:00 +08:00
parent 446cc7c92b
commit 6d08cee899
21 changed files with 1940 additions and 272 deletions

2
.env.development Normal file
View File

@ -0,0 +1,2 @@
# 开发环境
VUE_APP_API=/api

1072
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -8,8 +8,15 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.19.2",
"bulma": "^0.8.2",
"core-js": "^3.6.4",
"vue": "^2.6.11"
"markdown-it": "^10.0.0",
"node-sass": "^4.14.0",
"sass-loader": "^8.0.2",
"vue": "^2.6.11",
"vue-axios": "^2.1.5",
"vue2-ace-editor": "0.0.15"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.3.0",

View File

@ -1,17 +1,33 @@
<!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">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</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">
<title><%= htmlWebpackPlugin.options.title %></title>
<script>
var authConfig = {
roots: [
{
id: "team",
name: "TeamDrive",
pass: "",
},
{
id: "root",
name: "PriveDrive",
pass: "",
}
],
};
window.gds = JSON.parse(JSON.stringify(authConfig.roots.map(it => it.name)));
</script>
</head>
<body>
<div id="app"></div>
</body>
</html>

View File

@ -1,28 +1,50 @@
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<Layout ref="layout" />
</div>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
import Layout from './view/Layout'
export default {
name: 'App',
components: {
HelloWorld
Layout
},
data: function () {
return {
config: {
siteName: "",
title: "",
path: "",
}
}
},
mounted () {
let favicon = document.createElement("link");
favicon.rel = "icon";
favicon.href =
"https://cdn.jsdelivr.net/gh/Aicirou/goindex-theme-acrou/favicon.ico";
document.getElementsByTagName("head")[0].appendChild(favicon);
let scripts = [
"https://at.alicdn.com/t/font_1760192_ud2z97y6kba.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>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
</script>

View File

@ -0,0 +1,62 @@
@import "~/node_modules/bulma"
// .icon {
// width: 2em;
// height: 2em;
// vertical-align: -0.5em;
// fill: currentColor;
// overflow: hidden;
// }
// th,td {
// border: 0 !important;
// }
// .breadcrumb:not(:last-child) {
// margin: 0.5rem 0;
// padding: 0 0.75em;
// }
// .breadcrumb ul {
// flex-wrap: inherit;
// }
// .breadcrumb li:not(:first-child):not(:last-child) {
// margin: 0 5px;
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
// }
// body {
// overflow: hidden;
// }
// .section {
// padding: 0.5rem 0.5rem 1.5rem 0.5rem;
// }
// .container {
// max-width: 980px !important;
// }
// .table {
// width: 100%;
// table-layout: fixed;
// }
// .table td {
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
// }
// .no-content {
// background: url(https://s1.hdslb.com/bfs/static/jinkela/search/asserts/no-data.png) no-repeat 50% 50%;
// height: 240px;
// line-height: 240px;
// text-align: center;
// margin-top: 20px;
// }
$widescreen-enabled: false

View File

@ -1,58 +0,0 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@ -1,7 +1,51 @@
import Vue from 'vue'
import App from './App.vue'
import axios from '@utils/axios'
import VueAxios from 'vue-axios'
// import bulma from 'bulma'
var styles = [
// 'https://cdn.jsdelivr.net/npm/bulma@0.8.1/css/bulma.min.css',
// 'https://cdn.jsdelivr.net/npm/bulma-tooltip@3.0.2/dist/css/bulma-tooltip.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css',
]
styles.forEach(item=>{
document.write(`<link rel="stylesheet" href="${item}">`);
})
// document.write(
// `<style>.icon{width:2em;height:2em;vertical-align:-0.5em;fill:currentColor;overflow:hidden;}th,td{border:0 !important;}.breadcrumb:not(:last-child){margin:0.5rem 0;padding:0 0.75em;}.breadcrumb ul{flex-wrap:inherit;}.breadcrumb li:not(:first-child):not(:last-child){margin:0 5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
// body {
// overflow: hidden;
// }
// .section {
// padding: 0.5rem 0.5rem 1.5rem 0.5rem;
// }
// .container {
// max-width: 980px !important;
// }
// .table{
// width:100%;
// table-layout: fixed;
// }
// .table td{
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
// }
// .no-content {
// background: url(https://s1.hdslb.com/bfs/static/jinkela/search/asserts/no-data.png) no-repeat 50% 50%;
// height: 240px;
// line-height: 240px;
// text-align: center;
// margin-top: 20px;
// }
// </style>`
// );
Vue.config.productionTip = false
// Vue.use(bulma)
Vue.use(VueAxios,axios)
new Vue({
render: h => h(App),

104
src/utils/AcrouUtil.js Normal file
View File

@ -0,0 +1,104 @@
import axios from "@utils/axios";
export const getQueryString = (path, param) => {
if (!path) {
return "";
}
var args = getURLParameters(path);
return args[param] ? args[param] : "";
};
export const getURLParameters = (url) =>
url
.match(/([^?=&]+)(=([^&]*))/g)
.reduce(
(a, v) => (
(a[v.slice(0, v.indexOf("="))] = v.slice(v.indexOf("=") + 1)), a
),
{}
);
// console.log(getURLParameters("/Movies/xx.mp4?a=view&y=123"));
//console.log(getQueryString("/Movies/xx.mp4?a=view&y=123", "y"));
export function get_file(option, callback) {
var path = option.path;
var modifiedTime = option.file.modifiedTime;
var key = "file_path_" + path + modifiedTime;
var data = localStorage.getItem(key);
data = "";
if (data) {
return callback(data);
} else {
axios.get(path).then((res) => {
var data = res.data;
localStorage.setItem(key, data);
callback(data);
});
}
}
export function get_filex(path, callback) {
axios.get(path).then((res) => {
var data = res.data;
callback(data);
});
}
//时间转换
export function utc2beijing(utc_datetime) {
// 转为正常的时间格式 年-月-日 时:分:秒
var T_pos = utc_datetime.indexOf("T");
var Z_pos = utc_datetime.indexOf("Z");
var year_month_day = utc_datetime.substr(0, T_pos);
var hour_minute_second = utc_datetime.substr(T_pos + 1, Z_pos - T_pos - 1);
var new_datetime = year_month_day + " " + hour_minute_second; // 2017-03-31 08:02:06
// 处理成为时间戳
var timestamp = new Date(Date.parse(new_datetime));
timestamp = timestamp.getTime();
timestamp = timestamp / 1000;
// 增加8个小时北京时间比utc时间多八个时区
var unixtimestamp = timestamp + 8 * 60 * 60;
// 时间戳转为时间
var unixtimestamp = new Date(unixtimestamp * 1000);
var year = 1900 + unixtimestamp.getYear();
var month = "0" + (unixtimestamp.getMonth() + 1);
var date = "0" + unixtimestamp.getDate();
var hour = "0" + unixtimestamp.getHours();
var minute = "0" + unixtimestamp.getMinutes();
var second = "0" + unixtimestamp.getSeconds();
return (
year +
"-" +
month.substring(month.length - 2, month.length) +
"-" +
date.substring(date.length - 2, date.length) +
" " +
hour.substring(hour.length - 2, hour.length) +
":" +
minute.substring(minute.length - 2, minute.length) +
":" +
second.substring(second.length - 2, second.length)
);
}
export function formatFileSize(bytes) {
if (bytes >= 1000000000) {
bytes = (bytes / 1000000000).toFixed(2) + " GB";
} else if (bytes >= 1000000) {
bytes = (bytes / 1000000).toFixed(2) + " MB";
} else if (bytes >= 1000) {
bytes = (bytes / 1000).toFixed(2) + " KB";
} else if (bytes > 1) {
bytes = bytes + " bytes";
} else if (bytes == 1) {
bytes = bytes + " byte";
} else {
bytes = "";
}
return bytes;
}

9
src/utils/axios.js Normal file
View File

@ -0,0 +1,9 @@
import axios from "axios";
// 创建一个 axios 实例
const service = axios.create({
baseURL: process.env.VUE_APP_API ? process.env.VUE_APP_API : "",
// timeout: 30000,
});
export default service;

98
src/view/Layout.vue Normal file
View File

@ -0,0 +1,98 @@
<template>
<div>
<Navbar ref="navbar"></Navbar>
<section class="section">
<div class="container">
<go-headmd :option="headmd" v-show="headmd.display"></go-headmd>
<bread-crumb ref="breadcrumb"></bread-crumb>
<go-list
ref="list"
v-on:headmd="setHeadmd"
v-on:readmemd="setReadmemd"
v-show="show=='list'"
></go-list>
<hr />
<go-readmemd :option="readmemd" v-show="readmemd.display"></go-readmemd>
<go-video ref="govideo" v-show="show=='video'"></go-video>
<go-text :option="text" v-show="show=='text'"></go-text>
<go-img ref="goimg" v-show="show=='img'"></go-img>
<Footer></Footer>
</div>
</section>
</div>
</template>
<script>
import Navbar from "./common/Navbar"
import BreadCrumb from "./common/BreadCrumb"
import GoVideo from "./page/GoVideo"
import Markdown from "./common/Markdown"
import GoList from "./page/GoList"
import GoText from "./page/GoText"
import GoImg from "./page/GoImg"
import Footer from "./common/Footer"
import { getQueryString } from "@utils/AcrouUtil"
export default {
data: function () {
return {
path: "",
show: "list",
text: { file: {}, path: "" },
headmd: { display: false, file: {}, path: "" },
readmemd: { display: false, file: {}, path: "" },
};
},
components: {
Navbar: Navbar,
BreadCrumb: BreadCrumb,
GoHeadmd: Markdown,
GoReadmemd: Markdown,
GoList: GoList,
GoVideo: GoVideo,
GoText: GoText,
GoImg: GoImg,
Footer: Footer,
},
methods: {
render (config) {
let path = config.path;
this.$refs.navbar.siteName = config.siteName;
this.$refs.breadcrumb.render(path);
var param = window.location.search;
var reg = /\/\d+:$/g;
if (path.match(reg) || param.indexOf("?a=view") < 0) {
this.show = "list";
this.$refs.list.render(path, getQueryString(param, "q"));
} else {
var name = path.split("/").pop();
var ext = name.split(".").pop().toLowerCase();
if (
"|html|php|css|go|java|js|json|txt|sh|md|".indexOf(`|${ext}|`) >= 0
) {
this.show = "text";
this.text = {
path: path,
file: {},
};
}
if ("|mp4|webm|mkv|".indexOf(`|${ext}|`) >= 0) {
this.show = "video";
this.$refs.govideo.render(path);
}
if ("|bmp|jpg|jpeg|png|gif|".indexOf(`|${ext}|`) >= 0) {
this.show = "img";
this.$refs.goimg.render(path);
}
}
},
setHeadmd (val) {
this.headmd = val;
},
setReadmemd (val) {
this.readmemd = val;
}
}
}
</script>

View File

@ -0,0 +1,49 @@
<template>
<nav class="breadcrumb is-hidden-mobile is-hidden-touch" aria-label="breadcrumbs">
<ul>
<li v-show="navs.length>0">
<a href="/">首页</a>
</li>
<li
v-for="(item,index) in navs"
:class="(index+1)==navs.length?'is-active':''"
v-bind:key="index"
>
<a v-if="(index+1)==navs.length" aria-current="page" href="#">{{item.title}}</a>
<a v-else :href="item.path">{{item.title}}</a>
</li>
</ul>
</nav>
</template>
<script>
export default {
data: function () {
return {
navs: [],
};
},
methods: {
render (path) {
var arr = path.trim("/").split("/");
var p = "/";
if (arr.length > 0) {
var navs = [];
for (var i in arr) {
var n = arr[i];
if (n == "") {
continue;
}
n = decodeURI(n);
p += n + "/";
navs.push({
path: p,
title: n,
});
}
this.navs = navs;
}
},
}
}
</script>

View File

@ -0,0 +1,38 @@
<template>
<div class="content has-text-centered is-fixed-bottom">
<div class="columns is-mobile is-centered">
<div class="field is-grouped is-grouped-multiline">
<div class="control">
<div class="tags has-addons">
<a
class="tag is-dark"
href="https://github.com/Aicirou/goindex-theme-acrou"
>goindex-template-acrou</a>
<span class="tag is-light">
MIT &nbsp;
<i class="fab fa-github"></i>
</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
},
watch: {
},
data: function () {
return {
content: "",
};
},
components: {
},
methods: {
}
}
</script>

0
src/view/common/Head.vue Normal file
View File

View File

@ -0,0 +1,40 @@
<template>
<div class="content" v-html="content"></div>
</template>
<script>
import { get_file } from "@utils/AcrouUtil"
import MarkdownIt from 'markdown-it'
export default {
props: {
option: {},
},
watch: {
option (val) {
this.render()
},
},
data: function () {
return {
content: `
<center>
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr-only">Loading...</span>
</center>
`,
};
},
components: {},
methods: {
render () {
const md = new MarkdownIt()
// if (window.md == undefined) {
// window.md = window.markdownit();
// }
get_file(this.option, (data) => {
this.content = md.render(data);
});
},
}
}
</script>

112
src/view/common/Navbar.vue Normal file
View File

@ -0,0 +1,112 @@
<template>
<nav class="navbar is-dark" role="navigation" aria-label="main navigation">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item" href="/">
<h3 class="title is-3 has-text-white">{{siteName}}</h3>
</a>
<a
role="button"
:class="'navbar-burger burger '+(isActive?'is-active':'')"
aria-label="menu"
aria-expanded="false"
data-target="navbarBasicExample"
@click="burgerClick"
>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbarBasicExample" :class="'navbar-menu '+(isActive?'is-active':'')">
<div class="navbar-start">
<div
class="navbar-item has-dropdown is-hoverable"
v-if="gds.length>0 && getCurrGD.length>0"
>
<a class="navbar-link">{{this.currgd.name}}</a>
<div class="navbar-dropdown is-boxed">
<a
class="navbar-item"
@click="changeItem(item)"
v-for="(item,index) in getCurrGD"
v-bind:key="index"
>{{item.name}}</a>
</div>
</div>
</div>
<div class="navbar-end">
<div class="navbar-item">
<div class="field is-grouped">
<p class="control has-icons-left" style="width:100%;">
<input
class="input is-rounded has-text-grey"
@keyup.enter="query"
v-model="param"
type="search"
placeholder="Search or jump to…"
/>
<span class="icon is-small is-left">
<i class="fas fa-search"></i>
</span>
</p>
</div>
</div>
<a
class="navbar-item"
target="_blank"
rel="noopener"
title="Download on GitHub"
href="https://github.com/Aicirou/goindex-theme-acrou"
>
<i class="fab fa-github"></i>
</a>
</div>
</div>
</div>
</nav>
</template>
<script>
export default {
created () {
if (window.gds && window.gds.length > 0) {
this.gds = window.gds.map((item, index) => {
return {
name: item,
id: ":" + index + "/",
};
});
this.currgd = this.gds[0];
}
},
data: function () {
return {
siteName: "",
param: "",
currgd: {},
gds: [],
isActive: false
};
},
methods: {
changeItem (item) {
this.currgd = item;
},
query () {
if (this.param) {
location.href = "/?q=" + this.param;
}
},
burgerClick () {
this.isActive = !this.isActive
}
},
computed: {
getCurrGD () {
return this.gds.filter((item) => item.name !== this.currgd.name);
},
}
}
</script>

22
src/view/page/GoImg.vue Normal file
View File

@ -0,0 +1,22 @@
<template>
<div class="content">
<figure class="image">
<img :src="imgurl" />
</figure>
</div>
</template>
<script>
export default {
data: function () {
return {
imgurl: "",
};
},
methods: {
render (path) {
this.imgurl = path;
},
}
}
</script>

213
src/view/page/GoList.vue Normal file
View File

@ -0,0 +1,213 @@
<template>
<div>
<progress
v-if="loading"
class="progress is-small is-primary"
style="height: .25rem;"
max="100"
>15%</progress>
<table class="table is-hoverable">
<thead>
<tr>
<th
v-for="(column,index) in columns"
v-bind:key="index"
:class="column.class"
:style="column.style"
>{{column.name}}</th>
</tr>
</thead>
<tbody>
<tr v-for="(file,index) in files" v-bind:key="index">
<td @click="go(file.path)">
<svg class="icon" aria-hidden="true">
<use :xlink:href="getIcon(file.mimeType)" />
</svg>
{{file.name}}
</td>
<td class="is-hidden-mobile is-hidden-touch">{{file.modifiedTime}}</td>
<td class="is-hidden-mobile is-hidden-touch">{{file.size}}</td>
<td
class="is-hidden-mobile is-hidden-touch"
v-if="file.mimeType!=='application/vnd.google-apps.folder'"
>
<span class="icon">
<i class="fa fa-download" @click="go(file.path,'down')"></i>
</span>
</td>
</tr>
</tbody>
</table>
<div v-show="files.length==0" class="has-text-centered no-content"></div>
<nav class="pagination is-centered is-small" role="navigation" aria-label="pagination">
<a class="pagination-previous">Previous</a>
<a class="pagination-next">Next page</a>
<ul class="pagination-list">
<li>
<a class="pagination-link" aria-label="Goto page 1">1</a>
</li>
<li>
<span class="pagination-ellipsis">&hellip;</span>
</li>
<li>
<a class="pagination-link" aria-label="Goto page 45">45</a>
</li>
<li>
<a class="pagination-link is-current" aria-label="Page 46" aria-current="page">46</a>
</li>
<li>
<a class="pagination-link" aria-label="Goto page 47">47</a>
</li>
<li>
<span class="pagination-ellipsis">&hellip;</span>
</li>
<li>
<a class="pagination-link" aria-label="Goto page 86">86</a>
</li>
</ul>
</nav>
</div>
</template>
<script>
import { utc2beijing, formatFileSize } from "@utils/AcrouUtil";
export default {
data: function () {
return {
page: {},
files: [],
loading: false,
columns: [
{ name: "文件", style: "" },
{
name: "修改时间",
style: "width:20%",
class: "is-hidden-mobile is-hidden-touch",
},
{
name: "大小",
style: "width:10%",
class: "is-hidden-mobile is-hidden-touch",
},
{
name: "下载",
style: "width:6%",
class: "is-hidden-mobile is-hidden-touch",
},
],
icon: {
"application/vnd.google-apps.folder": "icon-morenwenjianjia",
"video/mp4": "icon-mp",
"video/x-matroska": "icon-mkv",
"video/x-msvideo": "icon-avi",
"video/webm": "icon-webm",
"text/plain": "icon-txt",
"text/markdown": "icon-markdown",
"text/x-ssa": "icon-ASS",
"application/x-subrip": "icon-srt",
},
};
},
methods: {
render (path, param) {
this.loading = true;
var password = localStorage.getItem("password" + path);
var p = {
password: password || null,
page_token: null,
page_index: 0
};
this.axios
.post(path, p)
.then((res) => {
var data = res.data.data;
if (
typeof data != "null" &&
data.hasOwnProperty("error") &&
data.error.code == "401"
) {
var pass = prompt("目录加密,请输入密码", "");
localStorage.setItem("password" + path, pass);
if (pass != null && pass != "") {
this.render(path);
} else {
history.go(-1);
}
} else if (typeof data != "null") {
var exts = [
"html",
"php",
"css",
"go",
"java",
"js",
"json",
"txt",
"sh",
"md",
"mp4",
"webm",
"mkv",
"bmp",
"jpg",
"jpeg",
"png",
"gif",
];
try {
this.files = data.files.map((item) => {
var p = path + item.name;
// HEAD.md
if (item.name === "HEAD.md") {
this.$emit("headmd", {
display: true,
file: item,
path: p,
});
}
// REDEME.md
if (item.name === "README.md") {
this.$emit("readmemd", {
display: true,
file: item,
path: p,
});
}
var ext = p.split(".").pop();
if (exts.indexOf(`${ext}`) >= 0) {
p += "?a=view";
} else {
if (item.mimeType === "application/vnd.google-apps.folder") {
p += "/";
}
}
return {
path: p,
...item,
modifiedTime: utc2beijing(item.modifiedTime),
size: formatFileSize(item.size),
};
});
} catch (e) {
console.log(e);
}
}
this.loading = false;
})
.catch((ex) => {
this.loading = false;
});
},
go (path, type = "view") {
if (type === "down") {
path = path.replace("?a=view", "");
}
location.href = path;
},
getIcon (type) {
return "#" + (this.icon[type] ? this.icon[type] : "icon-weizhi");
},
}
}
</script>

54
src/view/page/GoText.vue Normal file
View File

@ -0,0 +1,54 @@
<template>
<div class="content">
<editor
ref="myEditor"
v-model="content"
@init="editorInit"
lang="html"
theme="chrome"
width="100%"
height="600"
></editor>
</div>
</template>
<script>
import { get_file } from "@utils/AcrouUtil"
export default {
props: {
option: {
path: "",
file: {},
},
},
watch: {
option (val) {
this.content = "加载中...";
get_file(this.option, (data) => {
this.content = data;
});
},
},
data: function () {
return {
content: "",
};
},
components: {
editor: require("vue2-ace-editor"),
},
methods: {
render (path) { },
editorInit (editor) {
editor.setFontSize(18)
editor.session.setUseWrapMode(false);
require("brace/ext/language_tools"); //language extension prerequsite...
require("brace/mode/html");
require("brace/mode/javascript"); //language
require("brace/mode/less");
require("brace/theme/chrome");
require("brace/snippets/javascript"); //snippet
},
}
}
</script>

91
src/view/page/GoVideo.vue Normal file
View File

@ -0,0 +1,91 @@
<template>
<div class="content">
<iframe
width="100%"
height="600px;"
:src="apiurl"
frameborder="0"
border="0"
marginwidth="0"
marginheight="0"
scrolling="no"
allowtransparency="true"
allowfullscreen="true"
></iframe>
<div class="card">
<header class="card-header">
<p class="card-header-title">
<span class="icon">
<i class="fa fa-play-circle" aria-hidden="true"></i>
</span>
播放 /
<span class="icon">
<i class="fa fa-download" aria-hidden="true"></i>
</span>
下载
</p>
</header>
<div class="card-content">
<div class="content">
<div class="columns is-mobile is-multiline has-text-centered">
<div class="column" v-for="(item,index) in players" v-bind:key="index">
<p class="heading">
<a :href="item.scheme+(item.name==='Thunder'?getThunder:videourl)">
<figure class="image is-48x48" style="margin: 0 auto;">
<img class="icon" :src="item.icon" />
</figure>
</a>
</p>
<p class>{{item.name}}</p>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data: function () {
return {
apiurl: "",
videourl: "",
players: [
{
name: 'IINA',
icon: 'https://www.iina.io/images/iina-icon-60.png',
scheme: 'iina://weblink?url='
},
{
name: 'PotPlayer',
icon: 'https://cloud.jsonpop.cn/go2index/player/potplayer.png',
scheme: 'potplayer://'
},
{
name: 'VLC',
icon: 'https://cloud.jsonpop.cn/go2index/player/vlc.png',
scheme: 'vlc://'
},
{
name: 'Thunder',
icon: 'https://cloud.jsonpop.cn/go2index/player/thunder.png',
scheme: 'thunder://'
}
]
};
},
methods: {
render (path) {
this.videourl = window.location.origin + path;
this.apiurl =
"https://api.jsonpop.cn/demo/blplyaer/?url=" + this.videourl;
},
},
computed: {
getThunder () {
return Buffer.from("AA" + this.videourl + "ZZ").toString("base64")
}
}
}
</script>

35
vue.config.js Normal file
View File

@ -0,0 +1,35 @@
const path = require('path');
function resolve (dir) {
return path.join(__dirname, dir);
}
module.exports = {
lintOnSave: true,
css: {
loaderOptions: {
// 设置 scss 公用变量文件
sass: {
prependData: `@import '~@/assets/style/public.scss';`
}
}
},
devServer: {
proxy: {
"/api": {
target: "https://ossdev.achirou.workers.dev/",
ws: true,
changeOrigin: true,
pathRewrite: {
"^/api": "",
},
},
}
},
chainWebpack: (config) => {
config.resolve.alias
.set('@', resolve('src'))
.set('@assets', resolve('src/assets'))
.set('@utils', resolve('src/utils'))
.set('@node_modules', resolve('node_modules'))
}
};