feat: support post custom template.

pull/59/head
ruibaby 2019-12-20 16:47:21 +08:00
parent 0e208e9888
commit bd682745bc
3 changed files with 31 additions and 4 deletions

View File

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

View File

@ -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

View File

@ -237,7 +237,7 @@ export default {
}
},
loadCustomTpls() {
themeApi.customTpls().then(response => {
themeApi.customSheetTpls().then(response => {
this.customTpls = response.data.data
})
},