发布管理

This commit is contained in:
Double-_-Z 2024-12-23 20:35:50 +08:00
parent d6b324049c
commit 36a465ac56
3 changed files with 320 additions and 15 deletions

View File

@ -0,0 +1,36 @@
import request from '/@/utils/request';
import { pixelUrlHost } from '/@/api/baseUrlHost';
/**
* request.post(xxx) post params data
* get请求时paramsdata
*
* api接口集合
* @method getReleaseList
*/
export function sharesApi() {
return {
getReleaseList: (params: object) => {
return request({
url: pixelUrlHost + '/paCreationRelease',
method: 'get',
params,
});
},
saveRelease: (data: object) => {
return request({
url: pixelUrlHost + '/paCreationRelease',
method: 'post',
data,
})
},
auditRelease: (params: object) => {
return request({
url: pixelUrlHost + '/paCreationRelease/reviewImages',
method: 'get',
params,
})
},
};
}

View File

@ -275,21 +275,21 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
}, },
}, },
// 发布管理 // 发布管理
// { {
// path: '/shares', path: '/shares',
// name: 'shares', name: 'shares',
// component: () => import('/@/views/service/shares/index.vue'), component: () => import('/@/views/service/shares/index.vue'),
// meta: { meta: {
// title: 'message.router.shares', title: 'message.router.shares',
// isLink: '', isLink: '',
// isHide: false, isHide: false,
// isKeepAlive: true, isKeepAlive: true,
// isAffix: false, isAffix: false,
// isIframe: false, isIframe: false,
// roles: ['admin'], roles: ['admin'],
// icon: 'ele-Upload', icon: 'ele-Upload',
// }, },
// }, },
/** /**
* end * end

View File

@ -0,0 +1,269 @@
<template>
<div class="system-dept-container layout-padding">
<el-card shadow="hover" class="layout-padding-auto">
<div class="system-dept-search mb15">
<!-- 发布者<el-input size="default" placeholder="请输入发布用户名称" v-model="state.tableData.param.userName"
class="ml10 mr10" style="max-width: 180px" clearable></el-input> -->
审核状态<el-select size="default" v-model="state.tableData.param.reviewStatus" placeholder="请选择审核状态"
clearable class="ml10 mr10" style="max-width: 180px">
<el-option v-for="(item,index) in statusList" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
<el-button @click="getTableData" size="default" type="primary" class="ml10">
<el-icon>
<ele-Search />
</el-icon>
查询
</el-button>
<el-button @click="reset" size="default" type="primary" class="ml10">
<el-icon>
<ele-RefreshRight />
</el-icon>
重置
</el-button>
</div>
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
<el-table-column align="center" type="index" label="序号" width="100"/>
<el-table-column align="center" prop="name" label="作品">
<template #default="scope">
<el-image :src="scope.row.path" lazy
preview-teleported="true" :preview-src-list="[scope.row.path]"/>
</template>
</el-table-column>
<!-- <el-table-column prop="phone" label="发布者" show-overflow-tooltip></el-table-column> -->
<!-- <el-table-column prop="type" label="类型" show-overflow-tooltip></el-table-column> -->
<el-table-column prop="reviewStatus" align="center" label="审核结果" show-overflow-tooltip>
<template #default="scope">
<el-tag v-if="scope.row.reviewStatus === 0">未发布</el-tag>
<el-tag v-else-if="scope.row.reviewStatus === 1" type="warning">审核中</el-tag>
<el-tag v-else-if="scope.row.reviewStatus === 2" type="success">通过</el-tag>
<el-tag v-else-if="scope.row.reviewStatus === 3" type="danger">未通过</el-tag>
</template>
</el-table-column>
<el-table-column prop="createtime" align="center" label="时间" :formatter="dateFormatter" show-overflow-tooltip></el-table-column>
<el-table-column label="操作" width="200" align="center">
<template #default="scope">
<!-- <el-button size="small" text type="primary" @click="toShowDetail(scope.row.id)">查看详情</el-button> -->
<el-button size="small" v-if="scope.row.reviewStatus === 0" text type="primary" @click="audit(scope.row)">审核</el-button>
<el-button size="small" v-else-if="scope.row.reviewStatus === 0" text type="primary" @click="toPublic(scope.row)">发布</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="onHandleSizeChange"
@current-change="onHandleCurrentChange"
class="mt15"
:pager-count="5"
:page-sizes="[10, 20, 30]"
v-model:current-page="state.tableData.param.current"
background
v-model:page-size="state.tableData.param.size"
layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total"
>
</el-pagination>
</el-card>
<MessageDialog ref="messageDialogRef" />
<!-- 回复弹窗 -->
<el-dialog style="height: 200px;" :title="state.auditDialog.title" v-model="state.auditDialog.show" width="400px">
<div class="dialog-content">
<el-form ref="replayFormRef" v-loading="state.auditDialog.loading" label-width="80px" :model="state.auditDialog.form">
<el-radio-group class="dialog-radio" v-model="state.auditDialog.form.status">
<el-radio :value="2">通过</el-radio>
<el-radio :value="3">不通过</el-radio>
</el-radio-group>
<div class="dialog-footer">
<el-button @click="state.auditDialog.show = false">取消</el-button>
<el-button type="primary" @click="commitAudit">确定</el-button>
</div>
</el-form>
</div>
</el-dialog>
</div>
</template>
<script setup lang="ts" name="shares">
import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
import { sharesApi } from '/@/api/service/shares';
import { ElMessage, ElMessageBox, TableColumnCtx } from 'element-plus';
//
const MessageDialog = defineAsyncComponent(() => import('/@/views/message/dialog.vue'));
const messageDialogRef = ref();
//
const state = reactive({
tableData: {
data: [],
total: 0,
loading: false,
param: {
current: 1,
size: 10,
reviewStatus: ''
},
},
auditDialog: {
loading: false,
form: {
id: '',
status: 2
},
show: false,
title: '作品审核',
message: '',
}
});
//
const statusList = ref([
{label: '未发布', value: 0},
{label: '审核中', value: 1},
{label: '通过', value: 2},
{label: '未通过', value: 3},
]);
// api
const shareApi = sharesApi();
//
const getTableData = async() => {
try {
state.tableData.loading = true;
let res = await shareApi.getReleaseList(state.tableData.param);
if(res?.success){
state.tableData.data = res.data.records;
state.tableData.total = res.data.total;
}else{
ElMessage.error('发布作品列表获取失败!');
}
} catch (error) {
} finally {
state.tableData.loading = false;
}
};
//
const reset = () =>{
state.tableData.param = {
current: 1,
size: 10,
reviewStatus: ''
}
getTableData();
}
//
const toShowDetail = (id: any) => {
messageDialogRef.value.openDialog(id);
}
const replayFormRef = ref();
//
const toPublic = (row: any) => {
ElMessageBox.confirm('确定要发布该作品吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async() => {
try {
state.tableData.loading = true;
let res = await shareApi.saveRelease({ creationId: row.creationId });
if(res?.success){
await getTableData();
ElMessage.success('发布成功!');
} else ElMessage.error('发布失败!');
} catch(e) {
ElMessage.error('处理失败!');
} finally {
state.tableData.loading = false;
}
})
}
//
const audit = (row: any) => {
state.auditDialog.form.id = row.id;
console.log(row.id);
state.auditDialog.form.status = 2;
state.auditDialog.show = true;
}
//
const commitAudit = async() => {
try {
state.auditDialog.loading = true;
let res = await shareApi.auditRelease(state.auditDialog.form);
if(res?.success){
ElMessage.success('审核成功!');
state.auditDialog.show = false;
getTableData();
}else{ElMessage.error('审核失败!');}
} catch (error) {
ElMessage.error('审核失败!');
}finally{
state.auditDialog.loading = false;
}
}
//
const dateFormatter = (row: any, column: TableColumnCtx<String>) => {
if(row.createtime === null) return '暂无';
let date = new Date(row.createtime);
return `${date.getFullYear()}-${date.getMonth()+1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
}
//
const onHandleSizeChange = (val: number) => {
state.tableData.param.size = val;
getTableData();
};
//
const onHandleCurrentChange = (val: number) => {
state.tableData.param.current = val;
getTableData();
};
onMounted(() => {
getTableData();
})
</script>
<style scoped lang="scss">
.system-dept-container {
:deep(.el-card__body) {
display: flex;
flex-direction: column;
flex: 1;
overflow: auto;
.el-table {
flex: 1;
}
}
}
.dialog-content{
padding: 0;
display: flex;
flex-direction: column;
}
.dialog-radio{
display: flex;
justify-content: center;
}
.dialog-footer{
margin-top: 20px;
display: flex;
justify-content: center;
}
::v-deep .el-image {
width: 250px; //
// height: 150px; //
object-fit: cover; //
// display: block;
}
</style>