From d07abaa7b5b30f9f3ff816a2fe9c16d2f4c46ed8 Mon Sep 17 00:00:00 2001 From: simple321vip Date: Mon, 6 Feb 2023 08:47:28 +0800 Subject: [PATCH] =?UTF-8?q?onenote=20=E5=BC=8F=E6=A0=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mock/onenote.ts | 79 +++++-- src/api/onenote.ts | 53 ++++- src/view/onenote/NavTab.vue | 58 ----- src/view/onenote/PageTab.vue | 101 --------- src/view/onenote/SectionTab.vue | 90 -------- src/view/onenote/index.vue | 363 +++++++++++++++++++++----------- 6 files changed, 349 insertions(+), 395 deletions(-) delete mode 100644 src/view/onenote/NavTab.vue delete mode 100644 src/view/onenote/PageTab.vue delete mode 100644 src/view/onenote/SectionTab.vue diff --git a/mock/onenote.ts b/mock/onenote.ts index 9b0bbf6..f9db3b2 100644 --- a/mock/onenote.ts +++ b/mock/onenote.ts @@ -2,27 +2,74 @@ import { MockMethod } from 'vite-plugin-mock' export default [ { - url: '/onenote/api/v1/one_note', + url: '/onenote/api/v1/category', method: 'get', response: () => { return [ { - section_id: 'x111', - section_name: 'A', - page_list: [ - { - page_id: 'y111', - section_id: 'x111', - page_name: 'B', - }, - { - page_id: 'y222', - section_id: 'x111', - page_name: 'C', - }, - ] - } + category_id: '4444', + category_color: ' #B0E0E6', + category_icon: 'Document', + category_theme: 'WIKI' + }, + { + category_id: '4444', + category_color: ' #B0E0E6', + category_icon: 'Collection', + category_theme: 'Collection' + }, + { + category_id: '4444', + category_color: ' #B0E0E6', + category_icon: 'Files', + category_theme: 'Files' + }, + { + category_id: '4444', + category_color: ' #B0E0E6', + category_icon: 'Phone', + category_theme: 'Phone' + }, ] } + }, + { + url: '/onenote/api/v1/4444/items/', + method: 'get', + response: () => { + return [ + { + item_id: '00001', + item_name: '中国联通', + item_value: '13332247026' + }, + { + item_id: '00002', + item_name: '中国联通副号', + item_value: '13333333333' + }, + ] + } + }, + { + url: '/onenote/api/v1/category', + method: 'put', + response: () => { + return {} + } + }, + { + url: '/onenote/api/v1/item', + method: 'put', + response: () => { + return {} + } + }, + { + url: '/onenote/api/v1/item', + method: 'delete', + response: () => { + return {} + } } ] as MockMethod[] \ No newline at end of file diff --git a/src/api/onenote.ts b/src/api/onenote.ts index 298437b..bc7decf 100644 --- a/src/api/onenote.ts +++ b/src/api/onenote.ts @@ -1,10 +1,49 @@ import { service } from '../utils/request' -const get_notes = (params: Object) => { +const get_categorys = () => { return service({ - url: '/onenote/api/v1/one_note', + url: '/onenote/api/v1/category', method: 'GET', - params: params + }) +} + +const get_items = (category_id: string) => { + return service({ + url: '/onenote/api/v1/' + category_id + '/items/', + method: 'GET', + }) +} + + +const put_category = (data: Object) => { + return service({ + url: '/onenote/api/v1/category', + method: 'PUT', + data: data + }) +} + +const put_item = (data: Object) => { + return service({ + url: '/onenote/api/v1/item', + method: 'PUT', + data: data + }) +} + +const post_item = (data: Object) => { + return service({ + url: '/onenote/api/v1/item', + method: 'post', + data: data + }) +} + +const delete_item = (data: Object) => { + return service({ + url: '/onenote/api/v1/item', + method: 'delete', + data: data }) } @@ -24,12 +63,6 @@ const update_section = (params: Object) => { }) } -const insert_section = () => { - return service({ - url: '/onenote/api/v1/one_note/insert_section', - method: 'PUT' - }) -} const insert_page = (params: Object) => { return service({ @@ -39,4 +72,4 @@ const insert_page = (params: Object) => { }) } -export { get_notes, update_page, update_section, insert_section, insert_page } +export { get_categorys, get_items, update_page, update_section, put_category, put_item, post_item, delete_item, insert_page } diff --git a/src/view/onenote/NavTab.vue b/src/view/onenote/NavTab.vue deleted file mode 100644 index dee4d53..0000000 --- a/src/view/onenote/NavTab.vue +++ /dev/null @@ -1,58 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/view/onenote/PageTab.vue b/src/view/onenote/PageTab.vue deleted file mode 100644 index 41d3c8e..0000000 --- a/src/view/onenote/PageTab.vue +++ /dev/null @@ -1,101 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/view/onenote/SectionTab.vue b/src/view/onenote/SectionTab.vue deleted file mode 100644 index fbcec2a..0000000 --- a/src/view/onenote/SectionTab.vue +++ /dev/null @@ -1,90 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/view/onenote/index.vue b/src/view/onenote/index.vue index e66602e..1f80b5c 100644 --- a/src/view/onenote/index.vue +++ b/src/view/onenote/index.vue @@ -1,153 +1,276 @@