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 0000000..b51334a Binary files /dev/null and b/public/images/baidu-pan-logo.png differ 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 `
+ +
+ +
+
${_quote}
+
+
` + } 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 @@