From 6f35b90c88a37c54b461e359b141e38065237acc Mon Sep 17 00:00:00 2001 From: Aicirou <2643053021@qq.com> Date: Sat, 30 May 2020 19:28:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2md=E6=B8=B2=E6=9F=93=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E4=BC=98=E5=8C=96=E7=95=8C=E9=9D=A2=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 52 +++----- package.json | 2 +- public/images/baidu-pan-logo.png | Bin 0 -> 6447 bytes src/api/components.markdown.js | 8 ++ src/components/index.js | 3 + src/components/markdown/index.vue | 146 +++++++++++++++++++++ src/components/markdown/plugin/baidupan.js | 38 ++++++ src/main.js | 2 + src/views/Layout.vue | 3 - src/views/common/Markdown.vue | 6 +- src/views/page/GoList.vue | 7 +- vue.config.js | 1 + yarn.lock | 20 ++- 13 files changed, 237 insertions(+), 51 deletions(-) create mode 100644 public/images/baidu-pan-logo.png create mode 100644 src/api/components.markdown.js create mode 100644 src/components/index.js create mode 100644 src/components/markdown/index.vue create mode 100644 src/components/markdown/plugin/baidupan.js diff --git a/package-lock.json b/package-lock.json index 796a2db..1944e86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2016,6 +2016,7 @@ "version": "1.0.10", "resolved": "http://registry.npm.taobao.org/argparse/download/argparse-1.0.10.tgz", "integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=", + "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -3129,6 +3130,12 @@ "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=", "dev": true }, + "highlight.js": { + "version": "9.18.1", + "resolved": "https://registry.npm.taobao.org/highlight.js/download/highlight.js-9.18.1.tgz", + "integrity": "sha1-7SGqAB/mJSuxCj121HVzxlOf4Tw=", + "dev": true + }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.1.0.tgz", @@ -4709,7 +4716,8 @@ "entities": { "version": "2.0.0", "resolved": "https://registry.npm.taobao.org/entities/download/entities-2.0.0.tgz", - "integrity": "sha1-aNYITKsbB5dnVA2A5Wo5tCPkq/Q=" + "integrity": "sha1-aNYITKsbB5dnVA2A5Wo5tCPkq/Q=", + "dev": true }, "errno": { "version": "0.1.7", @@ -6519,12 +6527,6 @@ "integrity": "sha1-TAb8y0YC/iYCs8k9+C1+fb8aio4=", "dev": true }, - "highlight.js": { - "version": "9.18.1", - "resolved": "https://registry.npm.taobao.org/highlight.js/download/highlight.js-9.18.1.tgz", - "integrity": "sha1-7SGqAB/mJSuxCj121HVzxlOf4Tw=", - "dev": true - }, "hmac-drbg": { "version": "1.0.1", "resolved": "http://registry.npm.taobao.org/hmac-drbg/download/hmac-drbg-1.0.1.tgz", @@ -7596,14 +7598,6 @@ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", "dev": true }, - "linkify-it": { - "version": "2.2.0", - "resolved": "https://registry.npm.taobao.org/linkify-it/download/linkify-it-2.2.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flinkify-it%2Fdownload%2Flinkify-it-2.2.0.tgz", - "integrity": "sha1-47VGl+eL+RXHCjis14/QngBYsc8=", - "requires": { - "uc.micro": "^1.0.1" - } - }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npm.taobao.org/load-json-file/download/load-json-file-1.1.0.tgz", @@ -7865,17 +7859,10 @@ "object-visit": "^1.0.0" } }, - "markdown-it": { - "version": "10.0.0", - "resolved": "https://registry.npm.taobao.org/markdown-it/download/markdown-it-10.0.0.tgz", - "integrity": "sha1-q/xk8UGxci1mNAIETkOSfx9QqNw=", - "requires": { - "argparse": "^1.0.7", - "entities": "~2.0.0", - "linkify-it": "^2.0.0", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - } + "marked": { + "version": "1.1.0", + "resolved": "https://registry.npm.taobao.org/marked/download/marked-1.1.0.tgz", + "integrity": "sha1-YlBK1NEVUMlCk1zMXjnWTlpMTlA=" }, "md5.js": { "version": "1.3.5", @@ -7894,11 +7881,6 @@ "integrity": "sha1-aZs8OKxvHXKAkaZGULZdOIUC/Vs=", "dev": true }, - "mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npm.taobao.org/mdurl/download/mdurl-1.0.1.tgz", - "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=" - }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npm.taobao.org/media-typer/download/media-typer-0.3.0.tgz", @@ -11285,7 +11267,8 @@ "sprintf-js": { "version": "1.0.3", "resolved": "http://registry.npm.taobao.org/sprintf-js/download/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true }, "sshpk": { "version": "1.16.1", @@ -11952,11 +11935,6 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, - "uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npm.taobao.org/uc.micro/download/uc.micro-1.0.6.tgz", - "integrity": "sha1-nEEagCpAmpH8bPdAgbq6NLJEmaw=" - }, "uglify-js": { "version": "3.4.10", "resolved": "https://registry.npm.taobao.org/uglify-js/download/uglify-js-3.4.10.tgz", diff --git a/package.json b/package.json index ce1f94b..2446ed4 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "js-cookie": "^2.2.1", "lodash": "^4.17.15", "lowdb": "^1.0.0", - "markdown-it": "^10.0.0", + "marked": "^1.1.0", "node-sass": "^4.14.0", "sass-loader": "^8.0.2", "v-viewer": "^1.5.1", diff --git a/public/images/baidu-pan-logo.png b/public/images/baidu-pan-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..b51334a47b2db721ff8c88d109dcb50f198df1a5 GIT binary patch literal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;IeV)JpQsRV)qkP_p$?!qp4j=J*LgB#*p_hRBtsiu8CLD{p za7zeVs3=omGcM3$@CnP_h(G-4(2Vq!O$qn2&zpgN7wozO{t3E`_RsSZw6FjG002ov JPDHLkV1ntZO1l66 literal 0 HcmV?d00001 diff --git a/src/api/components.markdown.js b/src/api/components.markdown.js new file mode 100644 index 0000000..9198977 --- /dev/null +++ b/src/api/components.markdown.js @@ -0,0 +1,8 @@ +import request from '@/plugin/axios' + +export function ComponentsMarkdownBase (url) { + return request({ + url, + method: 'get' + }) +} diff --git a/src/components/index.js b/src/components/index.js new file mode 100644 index 0000000..1487e15 --- /dev/null +++ b/src/components/index.js @@ -0,0 +1,3 @@ +import Vue from 'vue' + +Vue.component('markdown', () => import('./markdown')) diff --git a/src/components/markdown/index.vue b/src/components/markdown/index.vue new file mode 100644 index 0000000..48d815e --- /dev/null +++ b/src/components/markdown/index.vue @@ -0,0 +1,146 @@ + + + + + diff --git a/src/components/markdown/plugin/baidupan.js b/src/components/markdown/plugin/baidupan.js new file mode 100644 index 0000000..a352844 --- /dev/null +++ b/src/components/markdown/plugin/baidupan.js @@ -0,0 +1,38 @@ + +import cdnpath from "@/libs/util.cdn"; + +export default (quote) => { + const _quote = quote.replace(/<[^<>]+>/g, '').trim() + const bdPanUrl = /^https:\/\/pan\.baidu\.com\/s\/[a-z0-9]+$/i + const bdPanUrlPwd = /^链接: https:\/\/pan\.baidu\.com\/s\/[a-z0-9]+ 密码: [a-z0-9]{4}$/i + if (bdPanUrl.test(_quote)) { + return `` + } else if (bdPanUrlPwd.test(_quote)) { + const url = _quote.match(/https:\/\/pan\.baidu\.com\/s\/[a-z0-9]+/i) + const pwd = _quote.match(/[a-z0-9]{4}$/i) + return `
+
+ +
+ +
+
${url[0]}
+
+
+
+ 密码 + ${pwd[0]} +
+
+
` + } else { + return false + } +} diff --git a/src/main.js b/src/main.js index 2889b62..b36347a 100644 --- a/src/main.js +++ b/src/main.js @@ -14,6 +14,8 @@ import VueClipboard from "vue-clipboard2"; import VueLazyload from "vue-lazyload"; import Viewer from "v-viewer"; import cdnpath from "./libs/util.cdn"; +// 组件 +import '@/components' import "viewerjs/dist/viewer.css"; import "@/assets/style/theme/register.scss"; diff --git a/src/views/Layout.vue b/src/views/Layout.vue index 5246740..d87ff40 100644 --- a/src/views/Layout.vue +++ b/src/views/Layout.vue @@ -3,7 +3,6 @@
- @@ -17,7 +16,6 @@