🎨Update icons

This commit is contained in:
Aicirou 2020-06-30 17:06:12 +08:00
parent dbab8e23e8
commit 6cc467699f
2 changed files with 54 additions and 53 deletions

View File

@ -9,7 +9,7 @@ module.exports = [
{ 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: 'lowdb', library: 'low', js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/low.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: 'lowdb/adapters/LocalStorage', library: 'LocalStorage', js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/LocalStorage.min.js', css: '' },
{ name: '', library: '', js: 'https://at.alicdn.com/t/font_1760192_axq33n6snd.js', css: '' }, { name: '', library: '', js: 'https://at.alicdn.com/t/font_1760192_8add3xcxs4u.js', 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@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' }, { name: '', library: '', js: '', css: 'https://cdn.jsdelivr.net/npm/font-awesome-animation@0.2.1/dist/font-awesome-animation.min.css' },
] ]

View File

@ -27,10 +27,7 @@
<div slot="no-more"></div> <div slot="no-more"></div>
<div slot="no-results"></div> <div slot="no-results"></div>
</infinite-loading> </infinite-loading>
<div <div v-show="files.length === 0" class="has-text-centered no-content"></div>
v-show="files.length === 0"
class="has-text-centered no-content"
></div>
</div> </div>
<div <div
class="is-divider" class="is-divider"
@ -38,10 +35,7 @@
$t('list.total') + ' ' + files.length + ' ' + $t('list.item') $t('list.total') + ' ' + files.length + ' ' + $t('list.item')
" "
></div> ></div>
<readmemd <readmemd :option="readmemd" v-if="renderReadMeMD && readmemd.display"></readmemd>
:option="readmemd"
v-if="renderReadMeMD && readmemd.display"
></readmemd>
<viewer <viewer
v-if="viewer && images && images.length > 0" v-if="viewer && images && images.length > 0"
@ -87,7 +81,7 @@ export default {
Readmemd: Markdown, Readmemd: Markdown,
InfiniteLoading, InfiniteLoading,
}, },
data: function() { data: function () {
return { return {
infiniteId: +new Date(), infiniteId: +new Date(),
loading: true, loading: true,
@ -98,27 +92,34 @@ export default {
files: [], files: [],
viewer: false, viewer: false,
icon: { icon: {
"application/vnd.google-apps.folder": "icon-morenwenjianjia", "application/vnd.google-apps.folder": "icon-folder",
"video/mp4": "icon-mp", "video/mp4": "icon-mp4",
"video/x-matroska": "icon-mkv", "video/x-matroska": "icon-mkv",
"video/x-msvideo": "icon-avi", "video/x-msvideo": "icon-avi",
"video/webm": "icon-webm", "video/webm": "icon-webm",
"video/x-flv": "icon-video",
"application/x-mpegURL": "icon-video",
"audio/mpegurl": "icon-video",
"text/plain": "icon-txt", "text/plain": "icon-txt",
"text/markdown": "icon-markdown", "text/markdown": "icon-markdown",
"text/x-ssa": "icon-ASS", "text/x-ssa": "icon-ass",
"text/html": "icon-html", "text/html": "icon-html",
"text/x-python-script": "icon-python", "text/x-python-script": "icon-python",
"text/x-java": "icon-java1", "text/x-java": "icon-java",
"text/x-sh": "icon-SH", "text/x-sh": "icon-sh",
"application/x-subrip": "icon-srt", "application/x-subrip": "icon-srt",
"application/zip": "icon-zip", "application/zip": "icon-zip",
"application/x-zip-compressed": "icon-zip", "application/x-zip-compressed": "icon-zip",
"application/rar": "icon-rar", "application/rar": "icon-rar",
"application/pdf": "icon-pdf", "application/pdf": "icon-pdf",
"application/json": "icon-JSON1", "application/json": "icon-json",
"application/x-yaml": "icon-YML", "application/x-yaml": "icon-yml",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
"icon-word", "icon-word",
"application/vnd.android.package-archive": "icon-app",
"application/x-msdownload": "icon-exe",
"application/x-apple-diskimage": "icon-dmg",
"application/vnd.google-apps.shortcut": "icon-link",
"image/bmp": "icon-img", "image/bmp": "icon-img",
"image/jpeg": "icon-img", "image/jpeg": "icon-img",
"image/png": "icon-img", "image/png": "icon-img",
@ -130,23 +131,23 @@ export default {
}, },
computed: { computed: {
...mapState("acrou/view", ["mode"]), ...mapState("acrou/view", ["mode"]),
images() { images () {
return this.files.filter( return this.files.filter(
(file) => file.mimeType.startsWith("image/") (file) => file.mimeType.startsWith("image/")
); );
}, },
renderHeadMD() { renderHeadMD () {
return window.themeOptions.render.head_md || false; return window.themeOptions.render.head_md || false;
}, },
renderReadMeMD() { renderReadMeMD () {
return window.themeOptions.render.readme_md || false; return window.themeOptions.render.readme_md || false;
}, },
}, },
created() { created () {
this.render(); this.render();
}, },
methods: { methods: {
infiniteHandler($state) { infiniteHandler ($state) {
// //
if (!this.page.page_token) { if (!this.page.page_token) {
return; return;
@ -154,7 +155,7 @@ export default {
this.page.page_index++; this.page.page_index++;
this.render($state); this.render($state);
}, },
render($state) { render ($state) {
this.headmd = { display: false, file: {}, path: "" }; this.headmd = { display: false, file: {}, path: "" };
this.readmemd = { display: false, file: {}, path: "" }; this.readmemd = { display: false, file: {}, path: "" };
var path = this.$route.path; var path = this.$route.path;
@ -202,32 +203,32 @@ export default {
console.log(e); console.log(e);
}); });
}, },
buildFiles(files) { buildFiles (files) {
var path = this.$route.path; var path = this.$route.path;
return !files return !files
? [] ? []
: files : files
.map((item) => { .map((item) => {
var p = path + checkoutPath(item.name, item); var p = path + checkoutPath(item.name, item);
let isFolder = let isFolder =
item.mimeType === "application/vnd.google-apps.folder"; item.mimeType === "application/vnd.google-apps.folder";
let size = isFolder ? "-" : formatFileSize(item.size); let size = isFolder ? "-" : formatFileSize(item.size);
return { return {
path: p, path: p,
...item, ...item,
modifiedTime: formatDate(item.modifiedTime), modifiedTime: formatDate(item.modifiedTime),
size: size, size: size,
isFolder: isFolder, isFolder: isFolder,
}; };
}) })
.sort((a, b) => { .sort((a, b) => {
if (a.isFolder && b.isFolder) { if (a.isFolder && b.isFolder) {
return 0; return 0;
} }
return a.isFolder ? -1 : 1; return a.isFolder ? -1 : 1;
}); });
}, },
checkPassword(path) { checkPassword (path) {
var pass = prompt(this.$t("list.auth"), ""); var pass = prompt(this.$t("list.auth"), "");
localStorage.setItem("password" + path, pass); localStorage.setItem("password" + path, pass);
if (pass != null && pass != "") { if (pass != null && pass != "") {
@ -236,7 +237,7 @@ export default {
this.$router.go(-1); this.$router.go(-1);
} }
}, },
copy(path) { copy (path) {
let origin = window.location.origin; let origin = window.location.origin;
path = origin + encodeURI(path); path = origin + encodeURI(path);
this.$copyText(path) this.$copyText(path)
@ -254,13 +255,13 @@ export default {
}); });
}); });
}, },
thum(url) { thum (url) {
return url ? `/${this.$route.params.id}:view?url=${url}` : ""; return url ? `/${this.$route.params.id}:view?url=${url}` : "";
}, },
inited(viewer) { inited (viewer) {
this.$viewer = viewer; this.$viewer = viewer;
}, },
action(file, target) { action (file, target) {
if (file.mimeType.startsWith("image/")) { if (file.mimeType.startsWith("image/")) {
this.viewer = true; this.viewer = true;
this.$nextTick(() => { this.$nextTick(() => {
@ -276,7 +277,7 @@ export default {
} }
this.target(file, target); this.target(file, target);
}, },
target(file, target) { target (file, target) {
let path = file.path; let path = file.path;
if (target === "_blank") { if (target === "_blank") {
window.open(path); window.open(path);
@ -303,7 +304,7 @@ export default {
return; return;
} }
}, },
renderMd(files, path) { renderMd (files, path) {
var cmd = this.$route.params.cmd; var cmd = this.$route.params.cmd;
if (cmd) { if (cmd) {
return; return;
@ -327,7 +328,7 @@ export default {
} }
}); });
}, },
goSearchResult(file, target) { goSearchResult (file, target) {
this.loading = true; this.loading = true;
let id = this.$route.params.id; let id = this.$route.params.id;
this.axios this.axios
@ -345,8 +346,8 @@ export default {
console.log(e); console.log(e);
}); });
}, },
getIcon(type) { getIcon (type) {
return "#" + (this.icon[type] ? this.icon[type] : "icon-weizhi"); return "#" + (this.icon[type] ? this.icon[type] : "icon-file");
}, },
}, },
}; };