mirror of https://github.com/halo-dev/halo-admin
Support select theme on theme edit page.
parent
c96d962c75
commit
d96a7f6a73
|
@ -133,6 +133,16 @@ themeApi.getContent = path => {
|
|||
})
|
||||
}
|
||||
|
||||
themeApi.getContent = (themeId, path) => {
|
||||
return service({
|
||||
url: `${baseUrl}/${themeId}/files/content`,
|
||||
params: {
|
||||
path: path
|
||||
},
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
themeApi.saveContent = (path, content) => {
|
||||
return service({
|
||||
url: `${baseUrl}/files/content`,
|
||||
|
@ -144,6 +154,17 @@ themeApi.saveContent = (path, content) => {
|
|||
})
|
||||
}
|
||||
|
||||
themeApi.saveContent = (themeId, path, content) => {
|
||||
return service({
|
||||
url: `${baseUrl}/${themeId}/files/content`,
|
||||
data: {
|
||||
path: path,
|
||||
content: content
|
||||
},
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
themeApi.reload = () => {
|
||||
return service({
|
||||
url: `${baseUrl}/reload`,
|
||||
|
@ -161,4 +182,4 @@ themeApi.exists = template => {
|
|||
})
|
||||
}
|
||||
|
||||
export default themeApi
|
||||
export default themeApi
|
|
@ -373,7 +373,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
photoList: [],
|
||||
showMoreOptions: false,
|
||||
// showMoreOptions: false,
|
||||
startVal: 0,
|
||||
logType: logApi.logType,
|
||||
activityLoading: true,
|
||||
|
@ -450,18 +450,18 @@ export default {
|
|||
next()
|
||||
},
|
||||
methods: {
|
||||
handlerPhotoUploadSuccess(response, file) {
|
||||
var callData = response.data.data
|
||||
var photo = {
|
||||
name: callData.name,
|
||||
url: callData.path,
|
||||
thumbnail: callData.thumbPath,
|
||||
suffix: callData.suffix,
|
||||
width: callData.width,
|
||||
height: callData.height
|
||||
}
|
||||
this.journalPhotos.push(photo)
|
||||
},
|
||||
// handlerPhotoUploadSuccess(response, file) {
|
||||
// var callData = response.data.data
|
||||
// var photo = {
|
||||
// name: callData.name,
|
||||
// url: callData.path,
|
||||
// thumbnail: callData.thumbPath,
|
||||
// suffix: callData.suffix,
|
||||
// width: callData.width,
|
||||
// height: callData.height
|
||||
// }
|
||||
// this.journalPhotos.push(photo)
|
||||
// },
|
||||
listLatestPosts() {
|
||||
postApi.listLatest(5).then(response => {
|
||||
this.postData = response.data.data
|
||||
|
@ -498,13 +498,13 @@ export default {
|
|||
this.$message.success('发表成功!')
|
||||
this.journal = {}
|
||||
// this.photoList = []
|
||||
this.showMoreOptions = false
|
||||
// this.showMoreOptions = false
|
||||
})
|
||||
},
|
||||
handleUploadPhotoWallClick() {
|
||||
// 是否显示上传照片墙组件
|
||||
this.showMoreOptions = !this.showMoreOptions
|
||||
},
|
||||
// handleUploadPhotoWallClick() {
|
||||
// // 是否显示上传照片墙组件
|
||||
// this.showMoreOptions = !this.showMoreOptions
|
||||
// },
|
||||
handleShowLogDrawer() {
|
||||
this.logDrawerVisible = true
|
||||
this.loadLogs()
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
</a-select>
|
||||
</template>
|
||||
<theme-file
|
||||
v-if="files"
|
||||
:files="files"
|
||||
@listenToSelect="handleSelectFile"
|
||||
/>
|
||||
|
@ -83,7 +84,7 @@ export default {
|
|||
lineNumbers: true,
|
||||
line: true
|
||||
},
|
||||
files: [],
|
||||
files: null,
|
||||
file: {},
|
||||
content: '',
|
||||
themes: [],
|
||||
|
@ -112,6 +113,7 @@ export default {
|
|||
})
|
||||
},
|
||||
onSelectTheme(themeId) {
|
||||
this.files = null
|
||||
themeApi.listFiles(themeId).then(response => {
|
||||
this.files = response.data.data
|
||||
})
|
||||
|
@ -141,14 +143,14 @@ export default {
|
|||
}
|
||||
})
|
||||
}
|
||||
themeApi.getContent(file.path).then(response => {
|
||||
themeApi.getContent(this.selectedTheme.id,file.path).then(response => {
|
||||
this.content = response.data.data
|
||||
this.file = file
|
||||
this.buttonDisabled = false
|
||||
})
|
||||
},
|
||||
handlerSaveContent() {
|
||||
themeApi.saveContent(this.file.path, this.content).then(response => {
|
||||
themeApi.saveContent(this.selectedTheme.id,this.file.path, this.content).then(response => {
|
||||
this.$message.success('保存成功!')
|
||||
})
|
||||
}
|
||||
|
|
|
@ -313,12 +313,12 @@ export default {
|
|||
// photoList: [], // 编辑图片时回显所需对象
|
||||
// previewVisible: false,
|
||||
showMoreOptions: false,
|
||||
previewPhoto: {
|
||||
// 图片预览信息临时对象
|
||||
name: '',
|
||||
description: '',
|
||||
url: ''
|
||||
},
|
||||
// previewPhoto: {
|
||||
// // 图片预览信息临时对象
|
||||
// name: '',
|
||||
// description: '',
|
||||
// url: ''
|
||||
// },
|
||||
title: '发表',
|
||||
listLoading: false,
|
||||
visible: false,
|
||||
|
|
Loading…
Reference in New Issue