diff --git a/src/locales/en.json b/src/locales/en.json
index d610770..10d20b9 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -54,6 +54,7 @@
"tips": "New version detected, Go to GitHub"
},
"error": {
- "shortcut_not_down": "Shortcut can't open/download"
+ "shortcut_not_down": "Shortcut can't open/download",
+ "401": "Unauthorized, please login"
}
}
\ No newline at end of file
diff --git a/src/locales/zh-chs.json b/src/locales/zh-chs.json
index 241acb5..ed3659b 100644
--- a/src/locales/zh-chs.json
+++ b/src/locales/zh-chs.json
@@ -54,6 +54,7 @@
"tips": "检测到有新版本,前往GitHub"
},
"error": {
- "shortcut_not_down": "快捷方式无法打开/下载"
+ "shortcut_not_down": "快捷方式无法打开/下载",
+ "401": "未授权,请登录"
}
}
diff --git a/src/locales/zh-cht.json b/src/locales/zh-cht.json
index a95a35a..40e0ca5 100644
--- a/src/locales/zh-cht.json
+++ b/src/locales/zh-cht.json
@@ -54,6 +54,7 @@
"tips": "檢測到有新版本,前往GitHub"
},
"error": {
- "shortcut_not_down": "快捷方式無法打開/下載"
+ "shortcut_not_down": "快捷方式無法打開/下載",
+ "401": "未授權,請登錄"
}
}
diff --git a/src/plugin/axios/index.js b/src/plugin/axios/index.js
index 657e0a6..c3d60d8 100644
--- a/src/plugin/axios/index.js
+++ b/src/plugin/axios/index.js
@@ -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);
}
);
diff --git a/src/views/page/GoList.vue b/src/views/page/GoList.vue
index 493cf3a..e22dc93 100644
--- a/src/views/page/GoList.vue
+++ b/src/views/page/GoList.vue
@@ -1,6 +1,10 @@
-
+
file.mimeType.startsWith("image/")
- );
+ images() {
+ return this.files.filter((file) => file.mimeType.startsWith("image/"));
},
- renderHeadMD () {
+ renderHeadMD() {
return window.themeOptions.render.head_md || false;
},
- renderReadMeMD () {
+ renderReadMeMD() {
return window.themeOptions.render.readme_md || false;
},
},
- created () {
+ created() {
this.render();
},
methods: {
- infiniteHandler ($state) {
+ infiniteHandler($state) {
// 首次进入页面不执行滚动事件
if (!this.page.page_token) {
return;
@@ -155,7 +163,7 @@ export default {
this.page.page_index++;
this.render($state);
},
- render ($state) {
+ render($state) {
this.headmd = { display: false, file: {}, path: "" };
this.readmemd = { display: false, file: {}, path: "" };
var path = this.$route.path;
@@ -198,37 +206,36 @@ export default {
}
this.loading = false;
})
- .catch((e) => {
+ .catch(() => {
this.loading = false;
- console.log(e);
});
},
- buildFiles (files) {
+ buildFiles(files) {
var path = this.$route.path;
return !files
? []
: files
- .map((item) => {
- var p = path + checkoutPath(item.name, item);
- let isFolder =
- item.mimeType === "application/vnd.google-apps.folder";
- let size = isFolder ? "-" : formatFileSize(item.size);
- return {
- path: p,
- ...item,
- modifiedTime: formatDate(item.modifiedTime),
- size: size,
- isFolder: isFolder,
- };
- })
- .sort((a, b) => {
- if (a.isFolder && b.isFolder) {
- return 0;
- }
- return a.isFolder ? -1 : 1;
- });
+ .map((item) => {
+ var p = path + checkoutPath(item.name, item);
+ let isFolder =
+ item.mimeType === "application/vnd.google-apps.folder";
+ let size = isFolder ? "-" : formatFileSize(item.size);
+ return {
+ path: p,
+ ...item,
+ modifiedTime: formatDate(item.modifiedTime),
+ size: size,
+ isFolder: isFolder,
+ };
+ })
+ .sort((a, b) => {
+ if (a.isFolder && b.isFolder) {
+ return 0;
+ }
+ return a.isFolder ? -1 : 1;
+ });
},
- checkPassword (path) {
+ checkPassword(path) {
var pass = prompt(this.$t("list.auth"), "");
localStorage.setItem("password" + path, pass);
if (pass != null && pass != "") {
@@ -237,36 +244,37 @@ export default {
this.$router.go(-1);
}
},
- copy (path) {
+ copy(path) {
let origin = window.location.origin;
path = origin + encodeURI(path);
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"
});
});
},
- thum (url) {
+ thum(url) {
return url ? `/${this.$route.params.id}:view?url=${url}` : "";
},
- inited (viewer) {
+ inited(viewer) {
this.$viewer = viewer;
},
- action (file, target) {
+ action(file, target) {
// 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;
@@ -286,7 +294,7 @@ export default {
}
this.target(file, target);
},
- target (file, target) {
+ target(file, target) {
let path = file.path;
if (target === "_blank") {
window.open(path);
@@ -313,7 +321,7 @@ export default {
return;
}
},
- renderMd (files, path) {
+ renderMd(files, path) {
var cmd = this.$route.params.cmd;
if (cmd) {
return;
@@ -337,7 +345,7 @@ export default {
}
});
},
- goSearchResult (file, target) {
+ goSearchResult(file, target) {
this.loading = true;
let id = this.$route.params.id;
this.axios
@@ -355,7 +363,7 @@ export default {
console.log(e);
});
},
- getIcon (type) {
+ getIcon(type) {
return "#" + (this.icon[type] ? this.icon[type] : "icon-file");
},
},