Log sheet control.

pull/9/head
ruibaby 2019-05-17 09:44:17 +08:00
parent 93919c4e9e
commit 9f35152162
4 changed files with 32 additions and 10 deletions

View File

@ -65,6 +65,18 @@ logApi.logType = {
PROFILE_UPDATED: {
value: 45,
text: '资料修改'
},
SHEET_PUBLISHED: {
value: 50,
text: '页面发布'
},
SHEET_EDITED: {
value: 50,
text: '页面修改'
},
SHEET_DELETED: {
value: 50,
text: '页面删除'
}
}

View File

@ -82,4 +82,4 @@ postApi.postStatus = {
text: '回收站'
}
}
export default postApi
export default postApi

View File

@ -18,19 +18,25 @@ sheetApi.get = sheetId => {
})
}
sheetApi.create = sheetToCreate => {
sheetApi.create = (sheetToCreate, autoSave) => {
return service({
url: baseUrl,
method: 'post',
data: sheetToCreate
data: sheetToCreate,
params: {
autoSave: autoSave
}
})
}
sheetApi.update = (sheetId, sheetToUpdate) => {
sheetApi.update = (sheetId, sheetToUpdate, autoSave) => {
return service({
url: `${baseUrl}/${sheetId}`,
method: 'put',
data: sheetToUpdate
data: sheetToUpdate,
params: {
autoSave: autoSave
}
})
}

View File

@ -216,16 +216,16 @@ export default {
handlerRemoveThumb() {
this.sheetToStage.thumbnail = null
},
createOrUpdateSheet(createSuccess, updateSuccess) {
createOrUpdateSheet(createSuccess, updateSuccess, autoSave) {
if (this.sheetToStage.id) {
sheetApi.update(this.sheetToStage.id, this.sheetToStage).then(response => {
sheetApi.update(this.sheetToStage.id, this.sheetToStage, autoSave).then(response => {
this.$log.debug('Updated sheet', response.data.data)
if (updateSuccess) {
updateSuccess()
}
})
} else {
sheetApi.create(this.sheetToStage).then(response => {
sheetApi.create(this.sheetToStage, autoSave).then(response => {
this.$log.debug('Created sheet', response.data.data)
if (createSuccess) {
createSuccess()
@ -235,11 +235,15 @@ export default {
}
},
saveSheet() {
this.createOrUpdateSheet(() => this.$message.success('页面创建成功'), () => this.$message.success('页面更新成功'))
this.createOrUpdateSheet(
() => this.$message.success('页面创建成功'),
() => this.$message.success('页面更新成功'),
false
)
},
autoSaveSheet() {
if (this.sheetToStage.title != null && this.sheetToStage.originalContent != null) {
this.createOrUpdateSheet()
this.createOrUpdateSheet(null, null, true)
}
},
handleSelectSheetThumb(data) {