|
@@ -20,16 +20,30 @@
|
|
|
<el-card class="my-fill mt8" shadow="never">
|
|
|
<el-table v-loading="state.loading" :data="state.listData" row-key="id" height="'100%'"
|
|
|
style="width: 100%; height: 100%">
|
|
|
- <el-table-column prop="name" label="活动名称" min-width="120" show-overflow-tooltip />
|
|
|
- <el-table-column prop="imgUrl" label="活动图片" width="180" show-overflow-tooltip />
|
|
|
- <el-table-column prop="status" label="状态" width="180" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="name" label="活动名称" min-width="180" show-overflow-tooltip />
|
|
|
+ <el-table-column label="活动图片" min-width="180" show-overflow-tooltip >
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-image style="width: 150px; height: 100px" :src="row.imgUrl" ></el-image>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="status" label="状态" width="180" show-overflow-tooltip >
|
|
|
+ <template #default="{ row }">
|
|
|
+ <span v-if="row.status==0">待上架</span>
|
|
|
+ <span v-if="row.status == 1">上架</span>
|
|
|
+ <span v-if="row.status == 2">下架</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="rank" label="排序" width="120" show-overflow-tooltip />
|
|
|
- <el-table-column label="操作" width="140" header-align="center" align="center" fixed="right">
|
|
|
+ <el-table-column label="操作" width="180" header-align="center" align="center" fixed="right">
|
|
|
<template #default="{ row }">
|
|
|
- <el-button v-auth="'api:admin:banner:update'" icon="ele-EditPen" size="small" text type="primary"
|
|
|
+ <el-button v-if="row.status == 0 || row.status == 2" v-auth="'api:admin:banner:update'" icon="ele-EditPen" size="small" text type="primary"
|
|
|
@click="onEdit(row)">编辑</el-button>
|
|
|
- <el-button v-auth="'api:admin:banner:soft-delete'" icon="ele-Delete" size="small" text type="danger"
|
|
|
- @click="onDelete(row)">删除</el-button>
|
|
|
+ <el-button v-if="row.status == 0 || row.status == 2" v-auth="'api:admin:banner:soft-delete'" icon="ele-Delete" size="small" text type="danger"
|
|
|
+ @click="onDelete(row)">删除</el-button>
|
|
|
+ <el-button v-if="row.status==0 || row.status==2" v-auth="'api:admin:banner:update-status'" size="small" text type="primary"
|
|
|
+ @click="onLine(row)">上架</el-button>
|
|
|
+ <el-button v-if="row.status == 1" v-auth="'api:admin:banner:update-status'" size="small" text type="primary"
|
|
|
+ @click="offLine(row)">下架</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -54,7 +68,6 @@ import { auth } from '/@/utils/authFunction'
|
|
|
|
|
|
// 引入组件
|
|
|
const bannerForm = defineAsyncComponent(() => import('./components/banner-form.vue'))
|
|
|
-const MyDropdownMore = defineAsyncComponent(() => import('/@/components/my-dropdown-more/index.vue'))
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as any
|
|
|
|
|
@@ -103,20 +116,43 @@ const onAdd = () => {
|
|
|
bannerFormRef.value.open()
|
|
|
}
|
|
|
|
|
|
-const onEdit = (row: bannerGetPageOutput) => {
|
|
|
+const onEdit = (row: BannerListOutput) => {
|
|
|
state.bannerFormTitle = '编辑轮播图'
|
|
|
bannerFormRef.value.open(row)
|
|
|
}
|
|
|
+// 删除
|
|
|
+const onDelete = (row: BannerListOutput) => {
|
|
|
|
|
|
-const onDelete = (row: bannerGetPageOutput) => {
|
|
|
proxy.$modal
|
|
|
- .confirmDelete(`确定要删除【${row.title}】?`)
|
|
|
+ .confirmDelete(`确定要删除【${row.name}】?`)
|
|
|
.then(async () => {
|
|
|
await new BannerApi().softDelete({ id: row.id }, { loading: true, showSuccessMessage: true })
|
|
|
onQuery()
|
|
|
})
|
|
|
.catch(() => { })
|
|
|
}
|
|
|
+// 上架
|
|
|
+const onLine = (row: BannerListOutput) => {
|
|
|
+
|
|
|
+ proxy.$modal
|
|
|
+ .confirmDelete(`确定要上架【${row.name}】?`)
|
|
|
+ .then(async () => {
|
|
|
+ await new BannerApi().updateStatus({ id: row.id,status:1 }, { loading: true, showSuccessMessage: true })
|
|
|
+ onQuery()
|
|
|
+ })
|
|
|
+ .catch(() => { })
|
|
|
+}
|
|
|
+//下架
|
|
|
+const offLine = (row: BannerListOutput) => {
|
|
|
+
|
|
|
+ proxy.$modal
|
|
|
+ .confirmDelete(`确定要删除【${row.name}】?`)
|
|
|
+ .then(async () => {
|
|
|
+ await new BannerApi().updateStatus({ id: row.id, status: 2 }, { loading: true, showSuccessMessage: true })
|
|
|
+ onQuery()
|
|
|
+ })
|
|
|
+ .catch(() => { })
|
|
|
+}
|
|
|
|
|
|
const onSizeChange = (val: number) => {
|
|
|
state.pageInput.pageSize = val
|