优化广告位、广告模块

This commit is contained in:
zjl 2024-08-30 15:25:52 +08:00
parent 24634fe5f3
commit da777e082f
4 changed files with 46 additions and 11 deletions

View File

@ -1,21 +1,23 @@
import { h } from 'vue'; import { h } from 'vue';
import { ElAvatar } from 'element-plus'; import { ElAvatar, ElTag } from 'element-plus';
export const columns = [ export const columns = [
{ {
type: 'selection', type: 'selection',
}, },
{ {
label: 'ID', label: 'ID',
prop: 'id' prop: 'id',
width: 100,
}, },
{ {
label: '广告标题', label: '广告标题',
prop: 'title', prop: 'title',
width: 250,
render(record) { render(record) {
return h('a', { return h('a', {
href: 'http://www.baidu.com', href: record.row.url,
target:"_blank" target:"_blank"
},record.row.title); }, record.row.title);
}, },
}, },
{ {
@ -23,7 +25,7 @@ export const columns = [
prop: 'cover', prop: 'cover',
render(record) { render(record) {
return h(ElAvatar, { return h(ElAvatar, {
size: 48, size: 35,
src: record.row.cover, src: record.row.cover,
shape: 'square', shape: 'square',
fit: 'fill', fit: 'fill',
@ -56,9 +58,39 @@ export const columns = [
label: '广告状态', label: '广告状态',
prop: 'status', prop: 'status',
render(record) { render(record) {
return h('span', record.row.status === 1 ? '在用' : '停用') return h(
ElTag,
{
type: record.row.status ==1 ? 'success' : 'danger',
},
{
default: () => (record.row.status ==1 ? '正常' : '停用'),
},
);
}, },
}, },
{
label: '广告尺寸',
prop: 'size',
render(record) {
return record.row.width + 'x' + record.row.height;
},
},
{
label: '投放时间',
prop: 'time',
render(record) {
return record.row.start_time + 'x' + record.row.end_time;
},
},
{
label: '点击量',
prop: 'click',
},
{
label: '排序',
prop: 'sort',
},
{ {
label: '创建人', label: '创建人',
prop: 'createUser', prop: 'createUser',
@ -66,5 +98,6 @@ export const columns = [
{ {
label: '创建时间', label: '创建时间',
prop: 'createTime', prop: 'createTime',
width: 180,
}, },
]; ];

View File

@ -22,7 +22,7 @@
<PlusOutlined /> <PlusOutlined />
</el-icon> </el-icon>
</template> </template>
添加广告 添加
</el-button> </el-button>
<el-button type="danger" @click="handleDelete()" :disabled="!selectionData.length" v-perm="['sys:ad:batchDelete']"> <el-button type="danger" @click="handleDelete()" :disabled="!selectionData.length" v-perm="['sys:ad:batchDelete']">
<template #icon> <template #icon>
@ -69,7 +69,7 @@ const selectionData = ref([])
adSortId:'' adSortId:''
}); });
const actionColumn = reactive({ const actionColumn = reactive({
width: 250, width: 200,
label: '操作', label: '操作',
prop: 'action', prop: 'action',
fixed: 'right', fixed: 'right',

View File

@ -7,7 +7,8 @@ export const columns = [
}, },
{ {
label: 'ID', label: 'ID',
prop: 'id' prop: 'id',
width: 100,
}, },
{ {
label: '广告位名称', label: '广告位名称',
@ -49,5 +50,6 @@ export const columns = [
{ {
label: '创建时间', label: '创建时间',
prop: 'createTime', prop: 'createTime',
width: 180,
}, },
]; ];

View File

@ -19,7 +19,7 @@
<PlusOutlined /> <PlusOutlined />
</el-icon> </el-icon>
</template> </template>
添加广告位 添加
</el-button> </el-button>
<el-button type="danger" @click="handleDelete()" :disabled="!selectionData.length" v-perm="['sys:adSort:batchDelete']"> <el-button type="danger" @click="handleDelete()" :disabled="!selectionData.length" v-perm="['sys:adSort:batchDelete']">
<template #icon> <template #icon>
@ -66,7 +66,7 @@ const selectionData = ref([])
type:'' type:''
}); });
const actionColumn = reactive({ const actionColumn = reactive({
width: 250, width: 200,
label: '操作', label: '操作',
prop: 'action', prop: 'action',
fixed: 'right', fixed: 'right',