Browse Source

feat: support post custom template.

pull/59/head
ruibaby 5 years ago
parent
commit
bd682745bc
  1. 11
      src/api/theme.js
  2. 22
      src/views/post/components/PostSettingDrawer.vue
  3. 2
      src/views/sheet/components/SheetSettingDrawer.vue

11
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'
})
}

22
src/views/post/components/PostSettingDrawer.vue

@ -65,6 +65,19 @@
<a-radio :value="0"></a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="自定义模板:">
<a-select v-model="selectedPost.template">
<a-select-option
key=""
value=""
></a-select-option>
<a-select-option
v-for="tpl in customTpls"
:key="tpl"
:value="tpl"
>{{ tpl }}</a-select-option>
</a-select>
</a-form-item>
</a-form>
</div>
</div>
@ -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

2
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
})
},

Loading…
Cancel
Save