From 8acbb1b57b594c69c3c5020af56cd10ac5982360 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Thu, 4 Apr 2019 16:45:43 +0800 Subject: [PATCH] ui build --- src/api/theme.js | 7 + src/components/setting/SettingDrawer.vue | 14 +- src/views/page/PageEdit.vue | 162 +++++++++++++++++++- src/views/post/PostEdit.vue | 181 +++++++++++++++++++---- yarn.lock | 17 +++ 5 files changed, 335 insertions(+), 46 deletions(-) diff --git a/src/api/theme.js b/src/api/theme.js index 6a28884d..7581fdae 100644 --- a/src/api/theme.js +++ b/src/api/theme.js @@ -11,4 +11,11 @@ themeApi.listFiles = () => { }) } +themeApi.customTpls = () => { + return service({ + url: `${baseUrl}/files/custom`, + method: 'get' + }) +} + export default themeApi diff --git a/src/components/setting/SettingDrawer.vue b/src/components/setting/SettingDrawer.vue index 338b249e..7a5cbe79 100644 --- a/src/components/setting/SettingDrawer.vue +++ b/src/components/setting/SettingDrawer.vue @@ -3,12 +3,13 @@
@@ -147,13 +148,6 @@
-
- - - - - -
@@ -289,10 +283,6 @@ export default { font-size: 14px; } } - .iconClose { - font-size: 24px; - cursor: pointer; - } } .setting-drawer-index-handle { diff --git a/src/views/page/PageEdit.vue b/src/views/page/PageEdit.vue index 7b0d387b..3b030086 100644 --- a/src/views/page/PageEdit.vue +++ b/src/views/page/PageEdit.vue @@ -1,10 +1,166 @@ +import { mavonEditor } from 'mavon-editor' +import { mixin, mixinDevice } from '@/utils/mixin.js' +import 'mavon-editor/dist/css/index.css' +import tagApi from '@/api/theme' +export default { + name: 'Editor', + components: { + mavonEditor + }, + mixins: [mixin, mixinDevice], + data() { + return { + wrapperCol: { + xl: { span: 24 }, + sm: { span: 24 }, + xs: { span: 24 } + }, + value: 'Hello World', + visible: false, + drawerWidth: '460', + postUrl: 'hello-world', + customTpls: [] + } + }, + mounted() { + if (this.isMobile()) { + this.drawerWidth = '100%' + } else { + this.drawerWidth = '460' + } + }, + created() { + this.loadCustomTpls() + }, + methods: { + loadCustomTpls() { + tagApi.customTpls().then(response => { + this.customTpls = response.data.data + }) + }, + showDrawer() { + this.visible = true + }, + onClose() { + this.visible = false + } + } +} + diff --git a/src/views/post/PostEdit.vue b/src/views/post/PostEdit.vue index 7ab9ef45..d601249f 100644 --- a/src/views/post/PostEdit.vue +++ b/src/views/post/PostEdit.vue @@ -1,7 +1,7 @@