From 952587cd2c16c3fcd2c1f199b5c3ab5f633c801d Mon Sep 17 00:00:00 2001 From: simple321vip Date: Tue, 19 Apr 2022 00:51:31 +0800 Subject: [PATCH] =?UTF-8?q?=E3=83=96=E3=83=AD=E3=82=B0=E7=B7=A8=E9=9B=86?= =?UTF-8?q?=E7=94=BB=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/blog.ts | 21 +++++- src/components/common/Tab.vue | 89 +++++++++++++++++++++++++ src/entity/index.ts | 15 +++++ src/main.ts | 26 ++++++-- src/router/index.ts | 4 ++ src/view/blog/createBlog.vue | 120 ++++++++++++++++++++++++++++++++++ src/view/blog/index.vue | 21 +++--- 7 files changed, 279 insertions(+), 17 deletions(-) create mode 100644 src/components/common/Tab.vue create mode 100644 src/entity/index.ts create mode 100644 src/view/blog/createBlog.vue diff --git a/src/api/blog.ts b/src/api/blog.ts index a404d13..107beac 100644 --- a/src/api/blog.ts +++ b/src/api/blog.ts @@ -18,4 +18,23 @@ const get_blog = (params: any) => { }) } -export { get_blogs, get_blog } \ No newline at end of file +const get_user_blogs = (params: Object) => { + return request({ + url: '/blog', + method: 'get', + params: params, + paramsSerializer: (params) => { + return Qs.stringify(params, { arrayFormat: 'repeat' }) + }, + }) +} + +const update_blog_type = (params: Object) => { + return request({ + url: '/blog/update_blog_type', + method: 'post', + data: params + }) +} + +export { get_blogs, get_blog, get_user_blogs, update_blog_type } \ No newline at end of file diff --git a/src/components/common/Tab.vue b/src/components/common/Tab.vue new file mode 100644 index 0000000..4c699eb --- /dev/null +++ b/src/components/common/Tab.vue @@ -0,0 +1,89 @@ + + + + + \ No newline at end of file diff --git a/src/entity/index.ts b/src/entity/index.ts new file mode 100644 index 0000000..f42e7d4 --- /dev/null +++ b/src/entity/index.ts @@ -0,0 +1,15 @@ +type Blog = { + blog_id: string, + blog_type_id: string, + blog_type_name: string, + blog_title: string, + blog_prex: string +} + +type BlogType = { + blog_type_id: string, + blog_type_name: string, + blog_list: Blog[] +} + +export { Blog, BlogType } diff --git a/src/main.ts b/src/main.ts index 3de3999..30cbd98 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,14 +19,26 @@ import { getToken } from './utils/auth' const whiteList = ['/', '/blog'] let url = window.location.href console.log(url) -if (url != 'http://localhost:3000/' && url.search("blog=") != -1) { - let blog = { - blog_id: url.split("=")[1] +if (url != 'http://localhost:3000/') { + // if(url.search("blog=") != -1) { + // let blog = { + // blog_id: url.split("=")[1] + // } + // router.push({ + // path: '/feedback', + // query: blog + // }) + // } + if (url.search("edit_blog=") != -1) { + let blog = { + blog_id: url.split("=")[1] + } + router.push({ + path: '/BlogEditer', + query: blog + }) } - router.push({ - path: '/feedback', - query: blog - }) + } router.beforeEach((to, from, next) => { console.log(from.path, to.path) diff --git a/src/router/index.ts b/src/router/index.ts index cd165d4..f0199bb 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -74,6 +74,10 @@ const routes: Array = [ path: "/feedback", component: () => import('../view/blog/mdview.vue') }, + { + path: "/BlogEditer", + component: () => import('../view/blog/createBlog.vue') + }, { path: "/login", component: () => import('../components/login/login.vue') diff --git a/src/view/blog/createBlog.vue b/src/view/blog/createBlog.vue new file mode 100644 index 0000000..e774053 --- /dev/null +++ b/src/view/blog/createBlog.vue @@ -0,0 +1,120 @@ + + + + + + \ No newline at end of file diff --git a/src/view/blog/index.vue b/src/view/blog/index.vue index 9692dc2..413157a 100644 --- a/src/view/blog/index.vue +++ b/src/view/blog/index.vue @@ -1,7 +1,11 @@