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

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

上级 b251d2eb
......@@ -80,6 +80,15 @@ export function createArticle(data) {
export function updateArticle(id, 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
......@@ -122,6 +131,12 @@ export function batchDeleteArticle(data) {
export function getImgTextList(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
......@@ -130,6 +145,15 @@ export function getImgTextList(params) {
export function updateImgText(id, 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
......@@ -144,7 +168,7 @@ export function publishImgText(id, data) {
* @param {string} project_id 项目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 @@
>
</template>
</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">
<h5>
{{ drawTitle }}
......@@ -64,7 +64,7 @@
>
</h5>
</template>
<drawer-form :options="drawFormOptions">
<drawer-form :options="drawFormOptions" @drawFormSubmit="HandleDrawFormSubmit" @drawFormClose="$refs.articleDrawer.closeDrawer()">
<template #form-item-review>
<el-form-item>
<el-button type="primary" @click="dialogVisible = true" size="small">审核</el-button>
......@@ -72,7 +72,7 @@
</template>
</drawer-form>
<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-drawer>
</div>
......@@ -80,7 +80,8 @@
<script>
import DrawerForm from '../components/DrawerForm.vue'
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 {
data() {
return {
......@@ -162,7 +163,7 @@ export default {
}
}
},
components: { TableList, DrawerForm },
components: { TableList, DrawerForm, AuditForm },
methods: {
// 审核状态
auditStatusText(value) {
......@@ -229,32 +230,55 @@ export default {
handleDetails(val) {
this.drawItem = val
this.drawFormOptions.type = 'details'
this.drawFormOptions.details = {
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.drawFormOptions.details = val
this.drawerVisible = true
},
handleReviewSubmit(val) {
console.log(val)
HandleDrawFormSubmit(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() {
// 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 @@
>
</template>
</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">
<h5>
{{ drawTitle }}
......@@ -51,7 +51,7 @@
>
</h5>
</template>
<drawer-form :options="drawFormOptions">
<drawer-form :options="drawFormOptions" @drawFormSubmit="HandleDrawFormSubmit" @drawFormClose="$refs.imgTextDrawer.closeDrawer()">
<template #form-item-review>
<el-form-item>
<el-button type="primary" @click="dialogVisible = true" size="small">审核</el-button>
......@@ -59,7 +59,7 @@
</template>
</drawer-form>
<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-drawer>
</div>
......@@ -67,7 +67,8 @@
<script>
import DrawerForm from '../components/DrawerForm.vue'
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 {
data() {
return {
......@@ -148,7 +149,7 @@ export default {
}
}
},
components: { TableList, DrawerForm },
components: { TableList, DrawerForm, AuditForm },
methods: {
// 审核状态
auditStatusText(value) {
......@@ -194,32 +195,55 @@ export default {
handleDetails(val) {
this.drawItem = val
this.drawFormOptions.type = 'details'
this.drawFormOptions.details = {
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.drawFormOptions.details = val
this.drawerVisible = true
},
handleReviewSubmit(val) {
console.log(val)
HandleDrawFormSubmit(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() {
// 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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论