Support select theme on theme edit page.

pull/40/head
ruibaby 2019-09-11 20:49:52 +08:00
parent c96d962c75
commit d96a7f6a73
4 changed files with 51 additions and 28 deletions

View File

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

View File

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

View File

@ -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('保存成功!')
})
}

View File

@ -313,12 +313,12 @@ export default {
// photoList: [], //
// previewVisible: false,
showMoreOptions: false,
previewPhoto: {
//
name: '',
description: '',
url: ''
},
// previewPhoto: {
// //
// name: '',
// description: '',
// url: ''
// },
title: '发表',
listLoading: false,
visible: false,