From bd682745bc7c9dca9c13ea5b3db5ec9ce5b0a5a2 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Fri, 20 Dec 2019 16:47:21 +0800 Subject: [PATCH] feat: support post custom template. --- src/api/theme.js | 11 ++++++++-- .../post/components/PostSettingDrawer.vue | 22 ++++++++++++++++++- .../sheet/components/SheetSettingDrawer.vue | 2 +- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/api/theme.js b/src/api/theme.js index 2863546b..899d74d7 100644 --- a/src/api/theme.js +++ b/src/api/theme.js @@ -25,9 +25,16 @@ themeApi.listFiles = themeId => { }) } -themeApi.customTpls = () => { +themeApi.customSheetTpls = () => { return service({ - url: `${baseUrl}/files/custom`, + url: `${baseUrl}/activation/template/custom/sheet`, + method: 'get' + }) +} + +themeApi.customPostTpls = () => { + return service({ + url: `${baseUrl}/activation/template/custom/post`, method: 'get' }) } diff --git a/src/views/post/components/PostSettingDrawer.vue b/src/views/post/components/PostSettingDrawer.vue index 79d8012b..020141ef 100644 --- a/src/views/post/components/PostSettingDrawer.vue +++ b/src/views/post/components/PostSettingDrawer.vue @@ -65,6 +65,19 @@ + + + + {{ tpl }} + + @@ -258,7 +271,8 @@ export default { selectedTagIds: this.tagIds, selectedCategoryIds: this.categoryIds, categories: [], - categoryToCreate: {} + categoryToCreate: {}, + customTpls: [] } }, props: { @@ -331,6 +345,7 @@ export default { this.loadSkeleton() this.loadCategories() this.loadPresetMetasField() + this.loadCustomTpls() } } }, @@ -376,6 +391,11 @@ export default { }) } }, + loadCustomTpls() { + themeApi.customPostTpls().then(response => { + this.customTpls = response.data.data + }) + }, handleSelectPostThumb(data) { this.selectedPost.thumbnail = encodeURI(data.path) this.thumbDrawerVisible = false diff --git a/src/views/sheet/components/SheetSettingDrawer.vue b/src/views/sheet/components/SheetSettingDrawer.vue index 733b8387..bf0cda08 100644 --- a/src/views/sheet/components/SheetSettingDrawer.vue +++ b/src/views/sheet/components/SheetSettingDrawer.vue @@ -237,7 +237,7 @@ export default { } }, loadCustomTpls() { - themeApi.customTpls().then(response => { + themeApi.customSheetTpls().then(response => { this.customTpls = response.data.data }) },