🎨Optimize tips

This commit is contained in:
Aicirou 2020-07-04 23:29:55 +08:00
parent 1bdbf46020
commit adedafde03
5 changed files with 75 additions and 59 deletions

View File

@ -54,6 +54,7 @@
"tips": "New version detected, <a href='${url}'>Go to GitHub</a>"
},
"error": {
"shortcut_not_down": "Shortcut can't open/download"
"shortcut_not_down": "Shortcut can't open/download",
"401": "Unauthorized, please login"
}
}

View File

@ -54,6 +54,7 @@
"tips": "检测到有新版本,<a href='${url}'>前往GitHub</a>"
},
"error": {
"shortcut_not_down": "快捷方式无法打开/下载"
"shortcut_not_down": "快捷方式无法打开/下载",
"401": "未授权,请登录"
}
}

View File

@ -54,6 +54,7 @@
"tips": "檢測到有新版本,<a href='${url}'>前往GitHub</a>"
},
"error": {
"shortcut_not_down": "快捷方式無法打開/下載"
"shortcut_not_down": "快捷方式無法打開/下載",
"401": "未授權,請登錄"
}
}

View File

@ -1,6 +1,6 @@
import axios from "axios";
import store from "@/store";
import router from "@/router";
import notify from "@/components/notification";
// 创建一个 axios 实例
const service = axios.create({
@ -33,14 +33,19 @@ service.interceptors.response.use(
if (error && error.response) {
switch (error.response.status) {
case 401:
error.message = "未授权,请登录";
error.message = "error.401";
notify({
title: "notify.title",
message: error.message,
type: "error",
duration: 5 * 1000,
});
break;
default:
console.log(error);
break;
}
}
console.log(error);
router.app.$router.go(-1);
return Promise.reject(error);
}
);

View File

@ -1,6 +1,10 @@
<template>
<div>
<headmd :option="headmd" v-if="renderHeadMD && headmd.display" style="margin:1rem 0;"></headmd>
<headmd
:option="headmd"
v-if="renderHeadMD && headmd.display"
style="margin:1rem 0;"
></headmd>
<bread-crumb ref="breadcrumb"></bread-crumb>
<div class="golist" v-loading="loading">
<list-view
@ -27,7 +31,10 @@
<div slot="no-more"></div>
<div slot="no-results"></div>
</infinite-loading>
<div v-show="files.length === 0" class="has-text-centered no-content"></div>
<div
v-show="files.length === 0"
class="has-text-centered no-content"
></div>
</div>
<div
class="is-divider"
@ -35,7 +42,10 @@
$t('list.total') + ' ' + files.length + ' ' + $t('list.item')
"
></div>
<readmemd :option="readmemd" v-if="renderReadMeMD && readmemd.display"></readmemd>
<readmemd
:option="readmemd"
v-if="renderReadMeMD && readmemd.display"
></readmemd>
<viewer
v-if="viewer && images && images.length > 0"
@ -123,7 +133,7 @@ export default {
"image/bmp": "icon-img",
"image/jpeg": "icon-img",
"image/png": "icon-img",
"image/gif": "icon-img"
"image/gif": "icon-img",
},
headmd: { display: false, file: {}, path: "" },
readmemd: { display: false, file: {}, path: "" },
@ -132,9 +142,7 @@ export default {
computed: {
...mapState("acrou/view", ["mode"]),
images() {
return this.files.filter(
(file) => file.mimeType.startsWith("image/")
);
return this.files.filter((file) => file.mimeType.startsWith("image/"));
},
renderHeadMD() {
return window.themeOptions.render.head_md || false;
@ -198,9 +206,8 @@ export default {
}
this.loading = false;
})
.catch((e) => {
.catch(() => {
this.loading = false;
console.log(e);
});
},
buildFiles(files) {
@ -243,15 +250,16 @@ export default {
this.$copyText(path)
.then(() => {
this.$notify({
title: this.$t("notify.title"),
message: this.$t("copy.success"),
title: "notify.title",
message: "copy.success",
type: "success",
});
})
.catch(() => {
this.$notify.error({
title: this.$t("notify.title"),
message: this.$t("copy.error"),
this.$notify({
title: "notify.title",
message: "copy.error",
type: "error"
});
});
},
@ -265,8 +273,8 @@ export default {
// If it is a shortcut, the prompt cannot be downloaded
if (file.mimeType === "application/vnd.google-apps.shortcut") {
this.$notify({
title: this.$t("notify.title"),
message: this.$t("error.shortcut_not_down"),
title: "notify.title",
message: "error.shortcut_not_down",
type: "warning",
});
return;