From 18b9635815624508a557740ca241460346fd4a76 Mon Sep 17 00:00:00 2001 From: terwer Date: Mon, 10 Oct 2022 10:02:10 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:#1=20=E5=88=97=E8=A1=A8=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/default/Header.vue | 5 +++-- components/default/HeaderTime.vue | 3 +++ components/default/HomePostList.vue | 30 ++++++++++++++--------------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/components/default/Header.vue b/components/default/Header.vue index 3429964..9924cf2 100644 --- a/components/default/Header.vue +++ b/components/default/Header.vue @@ -1,5 +1,7 @@ diff --git a/components/default/HeaderTime.vue b/components/default/HeaderTime.vue index 05c2144..8083bab 100644 --- a/components/default/HeaderTime.vue +++ b/components/default/HeaderTime.vue @@ -63,6 +63,9 @@ export default { \ No newline at end of file diff --git a/components/default/HomePostList.vue b/components/default/HomePostList.vue index 8a16aed..ff17278 100644 --- a/components/default/HomePostList.vue +++ b/components/default/HomePostList.vue @@ -88,61 +88,61 @@ export default { \ No newline at end of file From 551c5cfa0e8dc7d38c305cf18a0c8a7ffffc7e49 Mon Sep 17 00:00:00 2001 From: terwer Date: Mon, 10 Oct 2022 11:47:11 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat:#1=20=E6=96=87=E7=AB=A0=E8=AF=A6?= =?UTF-8?q?=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/post.vue | 23 -------- pages/post/[postid].vue | 95 ++++++++++++++++++++++++++++++++++ server/api/endpoint/getPost.ts | 8 ++- yarn.lock | 9 +--- 4 files changed, 103 insertions(+), 32 deletions(-) delete mode 100644 pages/post.vue create mode 100644 pages/post/[postid].vue diff --git a/pages/post.vue b/pages/post.vue deleted file mode 100644 index 5466e48..0000000 --- a/pages/post.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/pages/post/[postid].vue b/pages/post/[postid].vue new file mode 100644 index 0000000..1ba3f2d --- /dev/null +++ b/pages/post/[postid].vue @@ -0,0 +1,95 @@ + + + + + + + \ No newline at end of file diff --git a/server/api/endpoint/getPost.ts b/server/api/endpoint/getPost.ts index 2c73040..18a6ca7 100644 --- a/server/api/endpoint/getPost.ts +++ b/server/api/endpoint/getPost.ts @@ -3,12 +3,16 @@ import {API} from "~/lib/api"; export default defineEventHandler(async (event) => { const query = useQuery(event) + if (query.t instanceof Array) { throw new Error("参数类型错误") } - const type = query.t || API_TYPE_CONSTANTS.API_TYPE_WORDPRESS - const postid = "1" + + if (query.postid instanceof Array) { + throw new Error("参数类型错误") + } + const postid = query.postid || "1" const env = useRuntimeConfig() console.log('Runtime env:', env) diff --git a/yarn.lock b/yarn.lock index d3a002c..c866e7d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1071,11 +1071,6 @@ resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.4.4.tgz#0b024fc8ca91bb4b6035abaf53c5aecc17119b3b" integrity sha512-Ku31WzpOV/8cruFaXaEZKF81WkNnvCSlBY4eOGtz5WMSdJvX1v1WWlSMGZeqUwPtQ27ZZz7B62erEMq8JDjcXw== -"@vue/devtools-api@^6.4.4": - version "6.4.4" - resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.4.4.tgz#0b024fc8ca91bb4b6035abaf53c5aecc17119b3b" - integrity sha512-Ku31WzpOV/8cruFaXaEZKF81WkNnvCSlBY4eOGtz5WMSdJvX1v1WWlSMGZeqUwPtQ27ZZz7B62erEMq8JDjcXw== - "@vue/reactivity-transform@3.2.40": version "3.2.40" resolved "https://registry.yarnpkg.com/@vue/reactivity-transform/-/reactivity-transform-3.2.40.tgz#dc24b9074b26f0d9dd2034c6349f5bb2a51c86ac" @@ -3591,9 +3586,9 @@ pify@^2.3.0: resolved "https://registry.npmmirror.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== -pinia@>=2.0.23, pinia@^2.0.22: +pinia@>=2.0.23, pinia@^2.0.23: version "2.0.23" - resolved "https://registry.yarnpkg.com/pinia/-/pinia-2.0.23.tgz#570f5f82160b656b412602789683faa95502d227" + resolved "https://registry.npmmirror.com/pinia/-/pinia-2.0.23.tgz#570f5f82160b656b412602789683faa95502d227" integrity sha512-N15hFf4o5STrxpNrib1IEb1GOArvPYf1zPvQVRGOO1G1d74Ak0J0lVyalX/SmrzdT4Q0nlEFjbURsmBmIGUR5Q== dependencies: "@vue/devtools-api" "^6.4.4" From 2651b7d34bd9ef8c52396b7b25f401abba427911 Mon Sep 17 00:00:00 2001 From: terwer Date: Mon, 10 Oct 2022 12:36:39 +0800 Subject: [PATCH 3/5] =?UTF-8?q?feat:#1=20=E6=94=AF=E6=8C=81Markdown?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/scss/index.dark.scss | 16 ++++++++++++++++ assets/scss/index.scss | 28 ++++++++++++++++++++++++++++ lib/markdownUtil.ts | 2 +- pages/post/[postid].vue | 23 ++++++++++++++++++++--- 4 files changed, 65 insertions(+), 4 deletions(-) diff --git a/assets/scss/index.dark.scss b/assets/scss/index.dark.scss index 626fa74..72fed23 100644 --- a/assets/scss/index.dark.scss +++ b/assets/scss/index.dark.scss @@ -2,4 +2,20 @@ html.dark body{ /* 自定义深色背景颜色 */ --custom-app-color:#ffffff; --custom-app-bg-color: #000000; +} + +/* dark table */ +html.dark .post-detail-content-box table { + color: #ffffff; + border-color: #ccc; +} + +html.dark .post-detail-content-box table th { + border-color: #ccc; + background-color: #161616; +} + +html.dark .post-detail-content-box table td { + border-color: #ccc; + background-color: #161616; } \ No newline at end of file diff --git a/assets/scss/index.scss b/assets/scss/index.scss index 9d55425..0e33bf6 100644 --- a/assets/scss/index.scss +++ b/assets/scss/index.scss @@ -76,4 +76,32 @@ https://github.com/nuxt/framework/issues/3141#issuecomment-1212899838 .el-menu-item > div { margin-left: -20px !important; +} + + +/* table */ +.post-detail-content-box table { + font-family: verdana, arial, sans-serif; + font-size: 14px; + color: #333333; + border-width: 1px; + border-color: #666666; + border-collapse: collapse; + margin-top: 10px; +} + +.post-detail-content-box table th { + border-width: 1px; + padding: 8px; + border-style: solid; + border-color: #666666; + background-color: #dedede; +} + +.post-detail-content-box table td { + border-width: 1px; + padding: 8px; + border-style: solid; + border-color: #666666; + background-color: #ffffff; } \ No newline at end of file diff --git a/lib/markdownUtil.ts b/lib/markdownUtil.ts index 544fb28..6a0cae4 100644 --- a/lib/markdownUtil.ts +++ b/lib/markdownUtil.ts @@ -1,6 +1,6 @@ import Showdown from "showdown" -const converter = new Showdown.Converter() +const converter = new Showdown.Converter({tables: true}); /** * 渲染Markdown diff --git a/pages/post/[postid].vue b/pages/post/[postid].vue index 1ba3f2d..e844586 100644 --- a/pages/post/[postid].vue +++ b/pages/post/[postid].vue @@ -1,5 +1,5 @@