提交 71df6dae authored 作者: pengxiaohui's avatar pengxiaohui

文章图文创建更新审核接口

上级 b251d2eb
...@@ -80,6 +80,15 @@ export function createArticle(data) { ...@@ -80,6 +80,15 @@ export function createArticle(data) {
export function updateArticle(id, data) { export function updateArticle(id, data) {
return httpRequest.put(`/api/cms/admin/v1/article/${id}/update`, data) return httpRequest.put(`/api/cms/admin/v1/article/${id}/update`, data)
} }
/**
* 审核文章
* @param {string} id
* @param {number} data.audit_status 2通过 3驳回
* @param {string} data.audit_remarks 审核说明
*/
export function auditArticle(id, data) {
return httpRequest.post(`/api/cms/admin/v1/article/${id}/audit`, data)
}
/** /**
* 发布文章 * 发布文章
* @param {string} id * @param {string} id
...@@ -122,6 +131,12 @@ export function batchDeleteArticle(data) { ...@@ -122,6 +131,12 @@ export function batchDeleteArticle(data) {
export function getImgTextList(params) { export function getImgTextList(params) {
return httpRequest.get('/api/cms/admin/v1/img-texts', { params }) return httpRequest.get('/api/cms/admin/v1/img-texts', { params })
} }
/**
* 创建文章
*/
export function createImgText(data) {
return httpRequest.post('/api/cms/admin/v1/img-text/create', data)
}
/** /**
* 更新图文 * 更新图文
* @param {string} id * @param {string} id
...@@ -130,6 +145,15 @@ export function getImgTextList(params) { ...@@ -130,6 +145,15 @@ export function getImgTextList(params) {
export function updateImgText(id, data) { export function updateImgText(id, data) {
return httpRequest.put(`/api/cms/admin/v1/img-text/${id}/update`, data) return httpRequest.put(`/api/cms/admin/v1/img-text/${id}/update`, data)
} }
/**
* 审核图文
* @param {string} id
* @param {number} data.audit_status 2通过 3驳回
* @param {string} data.audit_remarks 审核说明
*/
export function auditImgText(id, data) {
return httpRequest.post(`/api/cms/admin/v1/img-text/${id}/audit`, data)
}
/** /**
* 发布图文 * 发布图文
* @param {string} id * @param {string} id
...@@ -144,7 +168,7 @@ export function publishImgText(id, data) { ...@@ -144,7 +168,7 @@ export function publishImgText(id, data) {
* @param {string} project_id 项目id * @param {string} project_id 项目id
*/ */
export function getProjectContentTypeList(type, id) { export function getProjectContentTypeList(type, id) {
return httpRequest.get(`/api/cms/admin/v1/type/${type}/project/${id}`) return httpRequest.get(`/api/cms/admin/v1/type/${type}/project`, { project_id: id })
} }
/** /**
* 置顶图文 * 置顶图文
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
> >
</template> </template>
</table-list> </table-list>
<el-drawer :visible.sync="drawerVisible" size="1100px" :destroy-on-close="true"> <el-drawer :visible.sync="drawerVisible" size="1100px" :destroy-on-close="true" ref="articleDrawer">
<template slot="title"> <template slot="title">
<h5> <h5>
{{ drawTitle }} {{ drawTitle }}
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
> >
</h5> </h5>
</template> </template>
<drawer-form :options="drawFormOptions"> <drawer-form :options="drawFormOptions" @drawFormSubmit="HandleDrawFormSubmit" @drawFormClose="$refs.articleDrawer.closeDrawer()">
<template #form-item-review> <template #form-item-review>
<el-form-item> <el-form-item>
<el-button type="primary" @click="dialogVisible = true" size="small">审核</el-button> <el-button type="primary" @click="dialogVisible = true" size="small">审核</el-button>
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
</template> </template>
</drawer-form> </drawer-form>
<el-dialog title="审核文章" :visible.sync="dialogVisible" width="460px" append-to-body :destroy-on-close="true"> <el-dialog title="审核文章" :visible.sync="dialogVisible" width="460px" append-to-body :destroy-on-close="true">
<review-form @dialogClose="dialogVisible = false" @reviewSubmit="handleReviewSubmit" /> <audit-form @dialogClose="dialogVisible = false" @auditSubmit="handleAuditSubmit" />
</el-dialog> </el-dialog>
</el-drawer> </el-drawer>
</div> </div>
...@@ -80,7 +80,8 @@ ...@@ -80,7 +80,8 @@
<script> <script>
import DrawerForm from '../components/DrawerForm.vue' import DrawerForm from '../components/DrawerForm.vue'
import TableList from '@/components/TableList' import TableList from '@/components/TableList'
import { getArticleList, publishArticle, topArticle, recommendArticle, batchDeleteArticle } from '@/api/contentManage' import AuditForm from '../components/AuditForm.vue'
import { getArticleList, createArticle, updateArticle, auditArticle, publishArticle, topArticle, recommendArticle, batchDeleteArticle } from '@/api/contentManage'
export default { export default {
data() { data() {
return { return {
...@@ -162,7 +163,7 @@ export default { ...@@ -162,7 +163,7 @@ export default {
} }
} }
}, },
components: { TableList, DrawerForm }, components: { TableList, DrawerForm, AuditForm },
methods: { methods: {
// 审核状态 // 审核状态
auditStatusText(value) { auditStatusText(value) {
...@@ -229,32 +230,55 @@ export default { ...@@ -229,32 +230,55 @@ export default {
handleDetails(val) { handleDetails(val) {
this.drawItem = val this.drawItem = val
this.drawFormOptions.type = 'details' this.drawFormOptions.type = 'details'
this.drawFormOptions.details = { this.drawFormOptions.details = val
project_id: '111',
type_id: '111',
title: '3232',
uri: 'https://www.baidu.com',
summary: '内容摘要',
remarks: '注意事项',
web_img_uri: 'https://zj-images.oss-cn-beijing.aliyuncs.com/00d78a3a999f4b10000f2cd422232221.JPG',
mobile_terminal_img_uri: 'https://zj-images.oss-cn-beijing.aliyuncs.com/00d78a3a999f4b10000f2cd422232221.JPG',
enclosure_uri: 'https://zj-images.oss-cn-beijing.aliyuncs.com/00d78a3a999f4b10000f2cd422232221.JPG',
video_uri: 'https://zj-images.oss-cn-beijing.aliyuncs.com/00d78a3a999f4b10000f2cd422232221.JPG',
start_time: '2021-01-01 08:33:22',
hasEndDate: 1,
end_time: '2021-01-05 08:33:22',
is_publish: 1,
is_top: 1,
weight: 10
}
this.drawerVisible = true this.drawerVisible = true
}, },
handleReviewSubmit(val) { HandleDrawFormSubmit(val) {
console.log(val) Object.keys(val).forEach(key => {
if (val[key] === '') delete val[key]
})
if (this.drawFormOptions.type === 'create') {
this.fetchCreateArticle(val)
} else {
this.fetchUpdateArticle(val)
}
},
handleAuditSubmit(val) {
auditArticle(this.drawItem.id, val).then(res => {
if (res.code === 0 && res.data && res.data.status) {
this.$message.success('审核文章成功')
this.$refs.tableList.refetch()
this.dialogVisible = false
} else {
this.$message.error(res.message || '审核文章失败')
}
})
}, },
handleTabClick() { handleTabClick() {
// true 强制刷新 // true 强制刷新
this.$refs.tableList.refetch(true) this.$refs.tableList.refetch(true)
},
fetchCreateArticle(val) {
createArticle(val).then(res => {
if (res.code === 0 && res.data && res.data.id) {
this.$message.success('新建文章成功')
this.$refs.tableList.refetch()
this.$refs.articleDrawer.closeDrawer()
} else {
this.$message.error(res.message || '新建广告失败')
}
})
},
fetchUpdateArticle(val) {
updateArticle(this.drawItem.id, val).then(res => {
if (res.code === 0 && res.data && res.data.status) {
this.$message.success('更改文章成功')
this.$refs.tableList.refetch()
this.$refs.articleDrawer.closeDrawer()
} else {
this.$message.error(res.message || '更改文章失败')
}
})
} }
} }
} }
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
> >
</template> </template>
</table-list> </table-list>
<el-drawer :visible.sync="drawerVisible" size="1100px" :destroy-on-close="true"> <el-drawer :visible.sync="drawerVisible" size="1100px" :destroy-on-close="true" ref="imgTextDrawer">
<template slot="title"> <template slot="title">
<h5> <h5>
{{ drawTitle }} {{ drawTitle }}
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
> >
</h5> </h5>
</template> </template>
<drawer-form :options="drawFormOptions"> <drawer-form :options="drawFormOptions" @drawFormSubmit="HandleDrawFormSubmit" @drawFormClose="$refs.imgTextDrawer.closeDrawer()">
<template #form-item-review> <template #form-item-review>
<el-form-item> <el-form-item>
<el-button type="primary" @click="dialogVisible = true" size="small">审核</el-button> <el-button type="primary" @click="dialogVisible = true" size="small">审核</el-button>
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
</template> </template>
</drawer-form> </drawer-form>
<el-dialog title="审核列表" :visible.sync="dialogVisible" width="460px" append-to-body :destroy-on-close="true"> <el-dialog title="审核列表" :visible.sync="dialogVisible" width="460px" append-to-body :destroy-on-close="true">
<review-form @dialogClose="dialogVisible = false" @reviewSubmit="handleReviewSubmit" /> <audit-form @dialogClose="dialogVisible = false" @auditSubmit="handleAuditSubmit" />
</el-dialog> </el-dialog>
</el-drawer> </el-drawer>
</div> </div>
...@@ -67,7 +67,8 @@ ...@@ -67,7 +67,8 @@
<script> <script>
import DrawerForm from '../components/DrawerForm.vue' import DrawerForm from '../components/DrawerForm.vue'
import TableList from '@/components/TableList' import TableList from '@/components/TableList'
import { getImgTextList, publishImgText, batchDeleteImgText } from '@/api/contentManage' import AuditForm from '../components/AuditForm.vue'
import { getImgTextList, createImgText, updateImgText, auditImgText, publishImgText, batchDeleteImgText } from '@/api/contentManage'
export default { export default {
data() { data() {
return { return {
...@@ -148,7 +149,7 @@ export default { ...@@ -148,7 +149,7 @@ export default {
} }
} }
}, },
components: { TableList, DrawerForm }, components: { TableList, DrawerForm, AuditForm },
methods: { methods: {
// 审核状态 // 审核状态
auditStatusText(value) { auditStatusText(value) {
...@@ -194,32 +195,55 @@ export default { ...@@ -194,32 +195,55 @@ export default {
handleDetails(val) { handleDetails(val) {
this.drawItem = val this.drawItem = val
this.drawFormOptions.type = 'details' this.drawFormOptions.type = 'details'
this.drawFormOptions.details = { this.drawFormOptions.details = val
project_id: '111',
type_id: '111',
title: '3232',
uri: 'https://www.baidu.com',
summary: '内容摘要',
remarks: '注意事项',
web_img_uri: 'https://zj-images.oss-cn-beijing.aliyuncs.com/00d78a3a999f4b10000f2cd422232221.JPG',
mobile_terminal_img_uri: 'https://zj-images.oss-cn-beijing.aliyuncs.com/00d78a3a999f4b10000f2cd422232221.JPG',
enclosure_uri: 'https://zj-images.oss-cn-beijing.aliyuncs.com/00d78a3a999f4b10000f2cd422232221.JPG',
video_uri: 'https://zj-images.oss-cn-beijing.aliyuncs.com/00d78a3a999f4b10000f2cd422232221.JPG',
start_time: '2021-01-01 08:33:22',
hasEndDate: 1,
end_time: '2021-01-05 08:33:22',
is_publish: 1,
is_top: 1,
weight: 10
}
this.drawerVisible = true this.drawerVisible = true
}, },
handleReviewSubmit(val) { HandleDrawFormSubmit(val) {
console.log(val) Object.keys(val).forEach(key => {
if (val[key] === '') delete val[key]
})
if (this.drawFormOptions.type === 'create') {
this.fetchCreateArticle(val)
} else {
this.fetchUpdateArticle(val)
}
},
handleAuditSubmit(val) {
auditImgText(this.drawItem.id, val).then(res => {
if (res.code === 0 && res.data && res.data.status) {
this.$message.success('审核图文成功')
this.$refs.tableList.refetch()
this.dialogVisible = false
} else {
this.$message.error(res.message || '审核图文失败')
}
})
}, },
handleTabClick() { handleTabClick() {
// true 强制刷新 // true 强制刷新
this.$refs.tableList.refetch(true) this.$refs.tableList.refetch(true)
},
fetchCreateArticle(val) {
createImgText(val).then(res => {
if (res.code === 0 && res.data && res.data.id) {
this.$message.success('新建图文成功')
this.$refs.tableList.refetch()
this.$refs.imgTextDrawer.closeDrawer()
} else {
this.$message.error(res.message || '新建图文失败')
}
})
},
fetchUpdateArticle(val) {
updateImgText(this.drawItem.id, val).then(res => {
if (res.code === 0 && res.data && res.data.status) {
this.$message.success('更改图文成功')
this.$refs.tableList.refetch()
this.$refs.imgTextDrawer.closeDrawer()
} else {
this.$message.error(res.message || '更改图文失败')
}
})
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论