From 6fd1c6d909e6c30970dab5e02faad61d29ad2445 Mon Sep 17 00:00:00 2001
From: Aicirou <2643053021@qq.com>
Date: Sun, 17 May 2020 01:57:33 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=B7=B2=E7=9F=A5=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 3 +-
public/index.html | 2 +-
src/App.vue | 20 +++-
src/libs/util.cookies.js | 6 +-
src/libs/util.db.js | 2 +-
src/locales/en.json | 3 +
src/locales/zh-chs.json | 3 +
src/locales/zh-cht.json | 3 +
src/plugin/checkVersion.js | 16 ++++
src/router/routes.js | 12 +--
src/views/page/GoList.vue | 113 ++++-------------------
src/views/page/components/grid/index.vue | 44 +++++++--
src/views/page/components/list/index.vue | 112 ++++++++++++++++++++++
vue.config.js | 3 +-
14 files changed, 226 insertions(+), 116 deletions(-)
create mode 100644 src/plugin/checkVersion.js
create mode 100644 src/views/page/components/list/index.vue
diff --git a/package.json b/package.json
index 4d2d208..33dc46a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,7 @@
{
"name": "go2index-theme-acrou",
- "version": "1.1.0",
+ "version": "2.0.0",
+ "g2index": "1.0.0",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
diff --git a/public/index.html b/public/index.html
index 1b2ccea..9612800 100644
--- a/public/index.html
+++ b/public/index.html
@@ -14,7 +14,7 @@
<%= htmlWebpackPlugin.options.title %>
diff --git a/src/libs/util.cookies.js b/src/libs/util.cookies.js
index bb66f6d..bc14873 100644
--- a/src/libs/util.cookies.js
+++ b/src/libs/util.cookies.js
@@ -13,7 +13,7 @@ cookies.set = function (name = 'default', value = '', cookieSetting = {}) {
expires: 1
}
Object.assign(currentCookieSetting, cookieSetting)
- Cookies.set(`go2index-${process.env.APP_VERSION}-${name}`, value, currentCookieSetting)
+ Cookies.set(`go2index-${process.env.VUE_APP_VERSION}-${name}`, value, currentCookieSetting)
}
/**
@@ -21,7 +21,7 @@ cookies.set = function (name = 'default', value = '', cookieSetting = {}) {
* @param {String} name cookie name
*/
cookies.get = function (name = 'default') {
- return Cookies.get(`go2index-${process.env.APP_VERSION}-${name}`)
+ return Cookies.get(`go2index-${process.env.VUE_APP_VERSION}-${name}`)
}
/**
@@ -36,7 +36,7 @@ cookies.getAll = function () {
* @param {String} name cookie name
*/
cookies.remove = function (name = 'default') {
- return Cookies.remove(`go2index-${process.env.APP_VERSION}-${name}`)
+ return Cookies.remove(`go2index-${process.env.VUE_APP_VERSION}-${name}`)
}
export default cookies
diff --git a/src/libs/util.db.js b/src/libs/util.db.js
index 74b649e..955babb 100644
--- a/src/libs/util.db.js
+++ b/src/libs/util.db.js
@@ -3,7 +3,7 @@ import LocalStorage from 'lowdb/adapters/LocalStorage'
import util from '@/libs/util'
import { cloneDeep } from 'lodash'
-const adapter = new LocalStorage(`go2index-${process.env.APP_VERSION}`)
+const adapter = new LocalStorage(`go2index-${process.env.VUE_APP_VERSION}`)
const db = low(adapter)
db
diff --git a/src/locales/en.json b/src/locales/en.json
index 00afa6a..4d5f483 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -49,5 +49,8 @@
"text": "Clean cache",
"success": "Cache cleanup successful"
}
+ },
+ "checkVersion": {
+ "tips": "New version detected, Go to GitHub"
}
}
diff --git a/src/locales/zh-chs.json b/src/locales/zh-chs.json
index 215ddf3..ae374aa 100644
--- a/src/locales/zh-chs.json
+++ b/src/locales/zh-chs.json
@@ -49,5 +49,8 @@
"text": "清理缓存",
"success": "缓存清理成功"
}
+ },
+ "checkVersion": {
+ "tips": "检测到有新版本,前往GitHub"
}
}
diff --git a/src/locales/zh-cht.json b/src/locales/zh-cht.json
index a26e035..e892f2d 100644
--- a/src/locales/zh-cht.json
+++ b/src/locales/zh-cht.json
@@ -49,5 +49,8 @@
"text": "清理緩存",
"success": "緩存清理成功"
}
+ },
+ "checkVersion": {
+ "tips": "檢測到有新版本,前往GitHub"
}
}
diff --git a/src/plugin/checkVersion.js b/src/plugin/checkVersion.js
new file mode 100644
index 0000000..09fc030
--- /dev/null
+++ b/src/plugin/checkVersion.js
@@ -0,0 +1,16 @@
+import { Notification } from 'element-ui';
+
+export default function check() {
+ let g2index_verison = window.gdconfig.g2index_verison;
+ if (!g2index_verison || process.env.G2INDEX_VERSION !== g2index_verison) {
+ Notification.success({
+ title: "通知",
+ dangerouslyUseHTMLString: true,
+ message: `
+ 检测到有新版本,前往GitHub
+ New version detected, Go to GitHub
+ `,
+ duration: 0
+ });
+ }
+}
diff --git a/src/router/routes.js b/src/router/routes.js
index e3d3889..a63c290 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -7,7 +7,7 @@ const meta = {
}
const frameIn = [{
- path: "/:id::cmd(text)/:path",
+ path: "/:id(\\d)::cmd(text)/:path",
component: _import("page/GoText"),
meta: {
...meta,
@@ -15,7 +15,7 @@ const frameIn = [{
}
},
{
- path: "/:id::cmd(pdf)/:path",
+ path: "/:id(\\d)::cmd(pdf)/:path",
component: _import("page/GoPdf"),
meta: {
...meta,
@@ -23,7 +23,7 @@ const frameIn = [{
}
},
{
- path: "/:id::cmd(video)/:path",
+ path: "/:id(\\d)::cmd(video)/:path",
component: _import("page/GoVideo"),
meta: {
...meta,
@@ -31,7 +31,7 @@ const frameIn = [{
}
},
{
- path: "/:id::cmd(image)/:path",
+ path: "/:id(\\d)::cmd(image)/:path",
component: _import("page/GoImg"),
meta: {
...meta,
@@ -39,7 +39,7 @@ const frameIn = [{
}
},
{
- path: "/:id::cmd(search)(/?q=)*",
+ path: "/:id(\\d)::cmd(search)(/?q=)*",
component: _import("page/GoList"),
meta: {
...meta,
@@ -47,7 +47,7 @@ const frameIn = [{
}
},
{
- path: "/:id:/:path*",
+ path: "/:id(\\d):/:path*",
component: _import("page/GoList"),
meta: {
...meta,
diff --git a/src/views/page/GoList.vue b/src/views/page/GoList.vue
index 68e8bac..2f77b37 100644
--- a/src/views/page/GoList.vue
+++ b/src/views/page/GoList.vue
@@ -8,77 +8,13 @@
infinite-scroll-disabled="busy"
infinite-scroll-distance="10"
>
-
-
-
-
- {{ column.name }}
-
-
-
-
- |
-
-
-
-
-
-
- {{ file.name }}
- {{
- file.description
- }}
- |
-
- {{ file.modifiedTime }}
- |
- {{ file.size }} |
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
+
{
+ this.$viewer.show();
+ });
return;
}
let path = file.path;
@@ -342,7 +262,8 @@ export default {
return;
}
if (target === "down") {
- location.href = path;
+ let temp_path = this.$route.params.path ? this.$route.params.path : "";
+ location.href = `/${this.$route.params.id}:down/${temp_path}/${file.name}`;
return;
}
if (target === "view") {
diff --git a/src/views/page/components/grid/index.vue b/src/views/page/components/grid/index.vue
index 43483c6..904e0f8 100644
--- a/src/views/page/components/grid/index.vue
+++ b/src/views/page/components/grid/index.vue
@@ -27,16 +27,23 @@
@click="go(file, 'view')"
>