提交 d6433621 authored 作者: 王鹏飞's avatar 王鹏飞

更新内容管理列表

上级 e3376ebb
import httpRequest from '@/utils/axios' import httpRequest from '@/utils/axios'
/** /**
* 获取广告列表 * 获取广告列表
* @param {string} type_id 类型id
* @param {number} id_title id或标题
* @param {string} project_id 项目id
*/ */
export function getAdList(params) { export function getAdList(params) {
return httpRequest.get('/api/cms/admin/v1/advertisements', { params }) return httpRequest.get('/api/cms/admin/v1/advertisements', { params })
} }
/**
* 发布广告
* @param {string} id
* @param {number} data.is_publish 发布1 取消发布0
*/
export function publishAd(id, data) {
return httpRequest.post(`/api/cms/admin/v1/advertisement/${id}/publish`, data)
}
/** /**
* 获取文章列表 * 获取文章列表
...@@ -15,6 +26,14 @@ export function getAdList(params) { ...@@ -15,6 +26,14 @@ export function getAdList(params) {
export function getArticleList(params) { export function getArticleList(params) {
return httpRequest.get('/api/cms/admin/v1/articles', { params }) return httpRequest.get('/api/cms/admin/v1/articles', { params })
} }
/**
* 发布文章
* @param {string} id
* @param {number} data.is_publish 发布1 取消发布0
*/
export function publishArticle(id, data) {
return httpRequest.post(`/api/cms/admin/v1/article/${id}/publish`, data)
}
/** /**
* 获取图文列表 * 获取图文列表
...@@ -25,3 +44,11 @@ export function getArticleList(params) { ...@@ -25,3 +44,11 @@ export function getArticleList(params) {
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 })
} }
/**
* 发布图文
* @param {string} id
* @param {number} data.is_publish 发布1 取消发布0
*/
export function publishImgText(id, data) {
return httpRequest.post(`/api/cms/admin/v1/img-text/${id}/publish`, data)
}
...@@ -7,33 +7,53 @@ ...@@ -7,33 +7,53 @@
<el-tabs v-model="activeName" type="card" @tab-click="handleTabClick"> <el-tabs v-model="activeName" type="card" @tab-click="handleTabClick">
<el-tab-pane label="全部" name="0"></el-tab-pane> <el-tab-pane label="全部" name="0"></el-tab-pane>
<el-tab-pane label="待审核" name="1"></el-tab-pane> <el-tab-pane label="待审核" name="1"></el-tab-pane>
<el-tab-pane label="已驳回" name="2"></el-tab-pane> <el-tab-pane label="已驳回" name="3"></el-tab-pane>
<el-tab-pane label="已通过" name="3"></el-tab-pane> <el-tab-pane label="已通过" name="2"></el-tab-pane>
</el-tabs> </el-tabs>
<!-- 图片 --> <!-- 图片 -->
<template v-slot:image="scope"><img :src="scope.row.image_url" height="40" /></template> <template v-slot:image="{ row }">
<template v-slot:adId="scope"><span class="details-handle" @click="handleDetails(scope.row)">{{scope.row.ad_id}}</span></template> <img :src="row.web_img_uri || row.mobile_terminal_img_uri" height="40" />
</template>
<template v-slot:table-id="{ row }">
<span class="details-handle" @click="handleDetails(row)">{{ row.id }}</span>
</template>
<!-- 审核状态 --> <!-- 审核状态 -->
<template v-slot:review-status="{ row }"> <template v-slot:review-status="{ row }">
<el-switch v-model="row.review_status"></el-switch> {{ auditStatusText(row.audit_status) }}
</template> </template>
<!-- 发布状态 --> <!-- 发布状态 -->
<template v-slot:publish-status="{ row }"> <template v-slot:publish-status="{ row }">
<el-switch v-model="row.publish_status"></el-switch> <el-switch
:active-value="1"
:inactive-value="0"
v-model="row.is_publish"
@change="handlePublish(row)"
></el-switch>
</template> </template>
<!-- 置顶状态 --> <!-- 置顶状态 -->
<template v-slot:top-status="{ row }"> <template v-slot:top-status="{ row }">
<el-switch v-model="row.top_status"></el-switch> <el-switch :active-value="1" :inactive-value="0" v-model="row.is_top"></el-switch>
</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">
<template slot="title"> <template slot="title">
<h5> <h5>
{{drawTitle}} {{ drawTitle }}
<el-button v-if="drawFormOptions.type !== 'create'" type="primary" @click="drawFormOptions.type = 'edit'" size="mini" style="float:right;margin-right:30px;">编辑</el-button> <el-button
v-if="drawFormOptions.type !== 'create'"
type="primary"
@click="drawFormOptions.type = 'edit'"
size="mini"
style="float: right; margin-right: 30px"
>编辑</el-button
>
</h5> </h5>
</template> </template>
<drawer-form :options="drawFormOptions" @drawFormSubmit="HandleDrawFormSubmit" @drawFormClose="drawerVisible = false"> <drawer-form
:options="drawFormOptions"
@drawFormSubmit="HandleDrawFormSubmit"
@drawFormClose="drawerVisible = false"
>
<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>
...@@ -41,7 +61,7 @@ ...@@ -41,7 +61,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"/> <review-form @dialogClose="dialogVisible = false" @reviewSubmit="handleReviewSubmit" />
</el-dialog> </el-dialog>
</el-drawer> </el-drawer>
</div> </div>
...@@ -50,12 +70,12 @@ ...@@ -50,12 +70,12 @@
import TableList from '@/components/TableList' import TableList from '@/components/TableList'
import DrawerForm from '../components/DrawerForm.vue' import DrawerForm from '../components/DrawerForm.vue'
import ReviewForm from '../components/ReviewForm.vue' import ReviewForm from '../components/ReviewForm.vue'
import { getAdList } from '@/api/contentManage' import { getAdList, publishAd } from '@/api/contentManage'
export default { export default {
components: { TableList, DrawerForm, ReviewForm }, components: { TableList, DrawerForm, ReviewForm },
data() { data() {
return { return {
activeName: '0', activeName: '',
drawerVisible: false, drawerVisible: false,
projectList: [ projectList: [
{ project_id: '111', project_name: '官网' }, { project_id: '111', project_name: '官网' },
...@@ -109,44 +129,39 @@ export default { ...@@ -109,44 +129,39 @@ export default {
], ],
columns: [ columns: [
{ prop: 'image_url', label: '图片', slots: 'image' }, { prop: 'image_url', label: '图片', slots: 'image' },
{ prop: 'ad_id', label: '广告ID', slots: 'adId' }, { prop: 'id', label: '广告ID', slots: 'table-id' },
{ prop: 'title', label: '标题' }, { prop: 'title', label: '标题' },
{ prop: 'start_time', label: '开始时间' }, { prop: 'start_time', label: '开始时间' },
{ prop: 'end_time', label: '结束时间' }, { prop: 'end_time', label: '结束时间' },
{ prop: 'project_name', label: '项目' }, { prop: 'project.name', label: '项目' },
{ prop: 'type', label: '类型' }, { prop: 'type.name', label: '类型' },
{ prop: 'top', label: '权重' }, { prop: 'weight', label: '权重' },
{ prop: 'author', label: '创建人' }, { prop: 'sso_user.real_name', label: '创建人' },
{ prop: 'review_status', label: '审核状态', slots: 'review-status' }, { prop: 'audit_status', label: '审核状态', slots: 'review-status' },
{ prop: 'publish_status', label: '发布状态', slots: 'publish-status' }, { prop: 'is_publish', label: '发布状态', slots: 'publish-status' },
{ prop: 'top_status', label: '置顶状态/权重', slots: 'top-status' }, { prop: 'is_top', label: '置顶状态/权重', slots: 'top-status' },
{ prop: 'create_time', label: '创建时间' } { prop: 'created_at', label: '创建时间' }
],
data: [
{
image_url: 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png',
ad_id: '20210425001',
title: '专业化的紫荆',
start_time: '2020-01-23 14:23:34',
end_time: '2020-01-23 14:23:34',
project_name: 'sofia项目站',
type: 'banner广告',
top: '100',
author: '作者',
review_status: '1',
publish_status: '1',
top_status: '1',
create_time: '2020-01-23 14:23:34'
}
] ]
} }
} }
}, },
methods: { methods: {
// 审核状态
auditStatusText(value) {
const map = { 1: '待审核', 2: '已通过', 3: '已驳回' }
return map[value]
},
// 接口请求之前,参数处理
beforeRequest(params) { beforeRequest(params) {
params.status = this.activeName params.audit_status = this.activeName === '0' ? '' : this.activeName
return params return params
}, },
// 发布
handlePublish(row) {
publishAd(row.id, { is_publish: row.is_publish }).then(res => {
this.$message.success('更改状态成功')
})
},
handleCreate() { handleCreate() {
this.drawFormOptions.type = 'create' this.drawFormOptions.type = 'create'
this.drawerVisible = true this.drawerVisible = true
......
...@@ -11,26 +11,46 @@ ...@@ -11,26 +11,46 @@
<el-tab-pane label="已通过" name="3"></el-tab-pane> <el-tab-pane label="已通过" name="3"></el-tab-pane>
</el-tabs> </el-tabs>
<!-- 图片 --> <!-- 图片 -->
<template v-slot:image="scope"><img :src="scope.row.image_url" height="40" /></template> <template v-slot:image="{ row }">
<template v-slot:adId="scope"><span class="details-handle" @click="handleDetails(scope.row)">{{scope.row.ad_id}}</span></template> <img :src="row.web_img_uri || row.mobile_terminal_img_uri" height="40" />
</template>
<template v-slot:table-id="{ row }">
<span class="details-handle" @click="handleDetails(row)">{{ row.id }}</span>
</template>
<!-- 审核状态 --> <!-- 审核状态 -->
<template v-slot:review-status="{ row }"> <template v-slot:review-status="{ row }">
<el-switch v-model="row.review_status"></el-switch> {{ auditStatusText(row.audit_status) }}
</template> </template>
<!-- 发布状态 --> <!-- 发布状态 -->
<template v-slot:publish-status="{ row }"> <template v-slot:publish-status="{ row }">
<el-switch v-model="row.publish_status"></el-switch> <el-switch
:active-value="1"
:inactive-value="0"
v-model="row.is_publish"
@change="handlePublish(row)"
></el-switch>
</template> </template>
<!-- 置顶状态 --> <!-- 置顶状态 -->
<template v-slot:top-status="{ row }"> <template v-slot:top-status="{ row }">
<el-switch v-model="row.top_status"></el-switch> <el-switch :active-value="1" :inactive-value="0" v-model="row.is_top"></el-switch>
</template>
<!-- 推荐状态 -->
<template v-slot:recommend-status="{ row }">
<el-switch :active-value="1" :inactive-value="0" v-model="row.is_recommend"></el-switch>
</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">
<template slot="title"> <template slot="title">
<h5> <h5>
{{drawTitle}} {{ drawTitle }}
<el-button v-if="drawFormOptions.type !== 'create'" type="primary" @click="drawFormOptions.type = 'edit'" size="mini" style="float:right;margin-right:30px;">编辑</el-button> <el-button
v-if="drawFormOptions.type !== 'create'"
type="primary"
@click="drawFormOptions.type = 'edit'"
size="mini"
style="float: right; margin-right: 30px"
>编辑</el-button
>
</h5> </h5>
</template> </template>
<drawer-form :options="drawFormOptions"> <drawer-form :options="drawFormOptions">
...@@ -41,7 +61,7 @@ ...@@ -41,7 +61,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"/> <review-form @dialogClose="dialogVisible = false" @reviewSubmit="handleReviewSubmit" />
</el-dialog> </el-dialog>
</el-drawer> </el-drawer>
</div> </div>
...@@ -49,7 +69,7 @@ ...@@ -49,7 +69,7 @@
<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 } from '@/api/contentManage' import { getArticleList, publishArticle } from '@/api/contentManage'
export default { export default {
data() { data() {
return { return {
...@@ -106,45 +126,41 @@ export default { ...@@ -106,45 +126,41 @@ export default {
], ],
columns: [ columns: [
{ prop: 'image_url', label: '图片', slots: 'image' }, { prop: 'image_url', label: '图片', slots: 'image' },
{ prop: 'ad_id', label: '广告ID', slots: 'adId' }, { prop: 'id', label: '文章ID', slots: 'table-id' },
{ prop: 'title', label: '标题' }, { prop: 'title', label: '标题' },
{ prop: 'start_time', label: '开始时间' }, { prop: 'start_time', label: '开始时间' },
{ prop: 'end_time', label: '结束时间' }, { prop: 'end_time', label: '结束时间' },
{ prop: 'project_name', label: '项目' }, { prop: 'project.name', label: '项目' },
{ prop: 'type', label: '类型' }, { prop: 'type.name', label: '类型' },
{ prop: 'top', label: '权重' }, { prop: 'weight', label: '权重' },
{ prop: 'author', label: '创建人' }, { prop: 'sso_user.real_name', label: '创建人' },
{ prop: 'review_status', label: '审核状态', slots: 'review-status' }, { prop: 'audit_status', label: '审核状态', slots: 'review-status' },
{ prop: 'publish_status', label: '发布状态', slots: 'publish-status' }, { prop: 'is_show', label: '发布状态', slots: 'publish-status' },
{ prop: 'top_status', label: '置顶状态/权重', slots: 'top-status' }, { prop: 'is_top', label: '置顶状态/权重', slots: 'top-status' },
{ prop: 'create_time', label: '创建时间' } { prop: 'is_recommend', label: '推荐状态', slots: 'recommend-status' },
], { prop: 'created_at', label: '创建时间' }
data: [
{
image_url: 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png',
ad_id: '20210425001',
title: '专业化的紫荆',
start_time: '2020-01-23 14:23:34',
end_time: '2020-01-23 14:23:34',
project_name: 'sofia项目站',
type: 'banner广告',
top: '100',
author: '作者',
review_status: '1',
publish_status: '1',
top_status: '1',
create_time: '2020-01-23 14:23:34'
}
] ]
} }
} }
}, },
components: { TableList, DrawerForm }, components: { TableList, DrawerForm },
methods: { methods: {
// 审核状态
auditStatusText(value) {
const map = { 1: '待审核', 2: '已通过', 3: '已驳回' }
return map[value]
},
// 接口请求之前,参数处理
beforeRequest(params) { beforeRequest(params) {
params.status = this.activeName params.audit_status = this.activeName === '0' ? '' : this.activeName
return params return params
}, },
// 发布
handlePublish(row) {
publishArticle(row.id, { is_publish: row.is_publish }).then(res => {
this.$message.success('更改状态成功')
})
},
handleCreate() { handleCreate() {
this.drawFormOptions.type = 'create' this.drawFormOptions.type = 'create'
this.drawerVisible = true this.drawerVisible = true
......
...@@ -11,26 +11,42 @@ ...@@ -11,26 +11,42 @@
<el-tab-pane label="已通过" name="3"></el-tab-pane> <el-tab-pane label="已通过" name="3"></el-tab-pane>
</el-tabs> </el-tabs>
<!-- 图片 --> <!-- 图片 -->
<template v-slot:image="scope"><img :src="scope.row.image_url" height="40" /></template> <template v-slot:image="{ row }">
<template v-slot:adId="scope"><span class="details-handle" @click="handleDetails(scope.row)">{{scope.row.ad_id}}</span></template> <img :src="row.web_img_uri || row.mobile_terminal_img_uri" height="40" />
</template>
<template v-slot:table-id="{ row }">
<span class="details-handle" @click="handleDetails(row)">{{ row.id }}</span>
</template>
<!-- 审核状态 --> <!-- 审核状态 -->
<template v-slot:review-status="{ row }"> <template v-slot:review-status="{ row }">
<el-switch v-model="row.review_status"></el-switch> {{ auditStatusText(row.audit_status) }}
</template> </template>
<!-- 发布状态 --> <!-- 发布状态 -->
<template v-slot:publish-status="{ row }"> <template v-slot:publish-status="{ row }">
<el-switch v-model="row.publish_status"></el-switch> <el-switch
:active-value="1"
:inactive-value="0"
v-model="row.is_publish"
@change="handlePublish(row)"
></el-switch>
</template> </template>
<!-- 置顶状态 --> <!-- 置顶状态 -->
<template v-slot:top-status="{ row }"> <template v-slot:top-status="{ row }">
<el-switch v-model="row.top_status"></el-switch> <el-switch :active-value="1" :inactive-value="0" v-model="row.is_top"></el-switch>
</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">
<template slot="title"> <template slot="title">
<h5> <h5>
{{drawTitle}} {{ drawTitle }}
<el-button v-if="drawFormOptions.type !== 'create'" type="primary" @click="drawFormOptions.type = 'edit'" size="mini" style="float:right;margin-right:30px;">编辑</el-button> <el-button
v-if="drawFormOptions.type !== 'create'"
type="primary"
@click="drawFormOptions.type = 'edit'"
size="mini"
style="float: right; margin-right: 30px"
>编辑</el-button
>
</h5> </h5>
</template> </template>
<drawer-form :options="drawFormOptions"> <drawer-form :options="drawFormOptions">
...@@ -41,7 +57,7 @@ ...@@ -41,7 +57,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"/> <review-form @dialogClose="dialogVisible = false" @reviewSubmit="handleReviewSubmit" />
</el-dialog> </el-dialog>
</el-drawer> </el-drawer>
</div> </div>
...@@ -49,7 +65,7 @@ ...@@ -49,7 +65,7 @@
<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 } from '@/api/contentManage' import { getImgTextList, publishImgText } from '@/api/contentManage'
export default { export default {
data() { data() {
return { return {
...@@ -107,45 +123,40 @@ export default { ...@@ -107,45 +123,40 @@ export default {
], ],
columns: [ columns: [
{ prop: 'image_url', label: '图片', slots: 'image' }, { prop: 'image_url', label: '图片', slots: 'image' },
{ prop: 'ad_id', label: '广告ID', slots: 'adId' }, { prop: 'id', label: '广告ID', slots: 'table-id' },
{ prop: 'title', label: '标题' }, { prop: 'title', label: '标题' },
{ prop: 'start_time', label: '开始时间' }, { prop: 'start_time', label: '开始时间' },
{ prop: 'end_time', label: '结束时间' }, { prop: 'end_time', label: '结束时间' },
{ prop: 'project_name', label: '项目' }, { prop: 'project.name', label: '项目' },
{ prop: 'type', label: '类型' }, { prop: 'type.name', label: '类型' },
{ prop: 'top', label: '权重' }, { prop: 'weight', label: '权重' },
{ prop: 'author', label: '创建人' }, { prop: 'sso_user.real_name', label: '创建人' },
{ prop: 'review_status', label: '审核状态', slots: 'review-status' }, { prop: 'audit_status', label: '审核状态', slots: 'review-status' },
{ prop: 'publish_status', label: '发布状态', slots: 'publish-status' }, { prop: 'is_show', label: '发布状态', slots: 'publish-status' },
{ prop: 'top_status', label: '置顶状态/权重', slots: 'top-status' }, { prop: 'is_top', label: '置顶状态/权重', slots: 'top-status' },
{ prop: 'create_time', label: '创建时间' } { prop: 'created_at', label: '创建时间' }
],
data: [
{
image_url: 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png',
ad_id: '20210425001',
title: '专业化的紫荆',
start_time: '2020-01-23 14:23:34',
end_time: '2020-01-23 14:23:34',
project_name: 'sofia项目站',
type: 'banner广告',
top: '100',
author: '作者',
review_status: '1',
publish_status: '1',
top_status: '1',
create_time: '2020-01-23 14:23:34'
}
] ]
} }
} }
}, },
components: { TableList, DrawerForm }, components: { TableList, DrawerForm },
methods: { methods: {
// 审核状态
auditStatusText(value) {
const map = { 1: '待审核', 2: '已通过', 3: '已驳回' }
return map[value]
},
// 接口请求之前,参数处理
beforeRequest(params) { beforeRequest(params) {
params.status = this.activeName params.audit_status = this.activeName === '0' ? '' : this.activeName
return params return params
}, },
// 发布
handlePublish(row) {
publishImgText(row.id, { is_publish: row.is_publish }).then(res => {
this.$message.success('更改状态成功')
})
},
handleCreate() { handleCreate() {
this.drawFormOptions.type = 'create' this.drawFormOptions.type = 'create'
this.drawerVisible = true this.drawerVisible = true
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论