|
|
@ -96,7 +96,7 @@ |
|
|
|
ADD_DETAIL, |
|
|
|
UPDATE_DETAIL, |
|
|
|
QUERY_DETAIL |
|
|
|
} from '@/api/contentDetail'; |
|
|
|
} from '@/api/contentIntro'; |
|
|
|
import Alert from "@/utils/alert"; |
|
|
|
|
|
|
|
export default { |
|
|
@ -134,7 +134,7 @@ |
|
|
|
{ type: 'string', required: true, message: '请输入标题', trigger: 'blur' } |
|
|
|
], |
|
|
|
showPage: [ |
|
|
|
{ type: 'array', required: true, message: '请选择页面显示位置', trigger: 'change' } |
|
|
|
{ type: 'array', required: true, message: '请选择页面显示位置', trigger: 'blur' } |
|
|
|
], |
|
|
|
content: [ |
|
|
|
{ type: 'string', required: true, message: '请输入正文' } |
|
|
@ -146,8 +146,14 @@ |
|
|
|
mounted() { |
|
|
|
if(this.currList && this.currList && !this.showAdd){ |
|
|
|
const { showPage } = this.currList |
|
|
|
console.log('showPage: ', showPage, showPage.slice(0, 2)); |
|
|
|
this.getDetail() |
|
|
|
this.formLabelAlign = this.currList |
|
|
|
for(let key in this.currList){ |
|
|
|
if(key !== 'showPage'){ |
|
|
|
this.formLabelAlign[key] = this.currList[key] |
|
|
|
} |
|
|
|
} |
|
|
|
console.log('this.formLabelAlign: ', this.formLabelAlign); |
|
|
|
this.formLabelAlign.showPage.splice(0, 1, showPage.slice(0, 2)) |
|
|
|
this.formLabelAlign.showPage.splice(1, 1, showPage) |
|
|
|
}else{ |
|
|
@ -209,8 +215,7 @@ |
|
|
|
this.$refs.ruleForm.validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
if(this.showAdd){ |
|
|
|
console.log('formName: ', formName); |
|
|
|
// this.addCarousel(formName) |
|
|
|
this.addCarousel(formName) |
|
|
|
}else{ |
|
|
|
this.updateCarousel(formName) |
|
|
|
} |
|
|
@ -225,11 +230,10 @@ |
|
|
|
* 添加详情 |
|
|
|
*/ |
|
|
|
async addCarousel(formName){ |
|
|
|
const { showPage, content } = formName; |
|
|
|
const params = { |
|
|
|
showPage: showPage[1], |
|
|
|
content |
|
|
|
}; |
|
|
|
console.log('formName: ', formName); |
|
|
|
const { showPage } = formName; |
|
|
|
const params = formName; |
|
|
|
params.showPage = showPage[1], |
|
|
|
await ADD_DETAIL(params).then((res) => { |
|
|
|
if(res.code === 200){ |
|
|
|
Alert.success('添加成功'); |
|
|
@ -265,11 +269,9 @@ |
|
|
|
*/ |
|
|
|
async getDetail(){ |
|
|
|
try { |
|
|
|
const { detailId, showPage } = this.currList |
|
|
|
const { introId, showPage } = this.currList |
|
|
|
const params = { |
|
|
|
detailId, |
|
|
|
pageNum: 1, |
|
|
|
pageSize: 10, |
|
|
|
introId, |
|
|
|
showPage |
|
|
|
}; |
|
|
|
await QUERY_DETAIL(params).then(res => { |
|
|
|