|
@@ -8,7 +8,6 @@
|
|
>批量删除</a-button
|
|
>批量删除</a-button
|
|
>
|
|
>
|
|
</a-popconfirm>
|
|
</a-popconfirm>
|
|
-
|
|
|
|
<a-table
|
|
<a-table
|
|
bordered
|
|
bordered
|
|
:data-source="list"
|
|
:data-source="list"
|
|
@@ -22,8 +21,31 @@
|
|
onChange: onSelectChange,
|
|
onChange: onSelectChange,
|
|
}"
|
|
}"
|
|
>
|
|
>
|
|
|
|
+ <template #video_name="{ record }">
|
|
|
|
+ <div class="table-view-box">
|
|
|
|
+ <div class="video-view">
|
|
|
|
+ <i class="iconfont icon-ziyuan"></i>
|
|
|
|
+ </div>
|
|
|
|
+ <span>{{ record.name }}</span>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ <template #image_name="{ record }">
|
|
|
|
+ <div class="table-view-box">
|
|
|
|
+ <div class="image-view"></div>
|
|
|
|
+ <span>{{ record.name }}</span>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ <template #video_type="{ record }">
|
|
|
|
+ <span v-show="record.video_type === 'S'">竖版视频</span>
|
|
|
|
+ <span v-show="record.video_type === 'H'">横版视频</span>
|
|
|
|
+ </template>
|
|
|
|
+ <template #image_type="{ record }">
|
|
|
|
+ <span v-show="record.image_type === 'S'">竖版大图</span>
|
|
|
|
+ <span v-show="record.image_type === 'H'">横版大图</span>
|
|
|
|
+ <span v-show="record.image_type === 'X'">小图</span>
|
|
|
|
+ </template>
|
|
<template #operation="{ record }">
|
|
<template #operation="{ record }">
|
|
- <a>推送</a>
|
|
|
|
|
|
+ <a @click="onOpenPush(record)">推送</a>
|
|
<a-popconfirm @confirm="onDelete(record)">
|
|
<a-popconfirm @confirm="onDelete(record)">
|
|
<template #title>
|
|
<template #title>
|
|
<p>确认删除该素材吗</p>
|
|
<p>确认删除该素材吗</p>
|
|
@@ -32,6 +54,25 @@
|
|
</a-popconfirm>
|
|
</a-popconfirm>
|
|
</template>
|
|
</template>
|
|
</a-table>
|
|
</a-table>
|
|
|
|
+ <a-modal
|
|
|
|
+ v-model:visible="pushVisible"
|
|
|
|
+ :title="type === 'video' ? '推送视频' : '推送图片'"
|
|
|
|
+ @ok="onConfirmPush"
|
|
|
|
+ width="40%"
|
|
|
|
+ >
|
|
|
|
+ <span>选择广告主:</span>
|
|
|
|
+ <a-cascader
|
|
|
|
+ style="width: 360px"
|
|
|
|
+ v-model:value="advertiser"
|
|
|
|
+ :options="adList"
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ :field-names="{
|
|
|
|
+ label: 'advertiser_name',
|
|
|
|
+ value: 'advertiser_id',
|
|
|
|
+ children: 'advertises',
|
|
|
|
+ }"
|
|
|
|
+ />
|
|
|
|
+ </a-modal>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -50,7 +91,14 @@ import {
|
|
TableColumnOfImage,
|
|
TableColumnOfImage,
|
|
} from "../../_pageOptions/table_material";
|
|
} from "../../_pageOptions/table_material";
|
|
//getPromotionList
|
|
//getPromotionList
|
|
-import { getVideoList, getImageList, deleteVideo, deleteImage } from "@/api";
|
|
|
|
|
|
+import {
|
|
|
|
+ getVideoList,
|
|
|
|
+ getImageList,
|
|
|
|
+ deleteVideo,
|
|
|
|
+ deleteImage,
|
|
|
|
+ getAdvertiser,
|
|
|
|
+ pushMaterial,
|
|
|
|
+} from "@/api";
|
|
import { message } from "ant-design-vue";
|
|
import { message } from "ant-design-vue";
|
|
const CommonTable = defineComponent({
|
|
const CommonTable = defineComponent({
|
|
components: {},
|
|
components: {},
|
|
@@ -62,14 +110,15 @@ const CommonTable = defineComponent({
|
|
loading: false,
|
|
loading: false,
|
|
list: ref<any[]>([]),
|
|
list: ref<any[]>([]),
|
|
columns: ref<any[]>([]),
|
|
columns: ref<any[]>([]),
|
|
|
|
+ adList: ref<any[]>([]),
|
|
selectedRowKeys: ref<any[]>([]),
|
|
selectedRowKeys: ref<any[]>([]),
|
|
|
|
+ pushVisible: false,
|
|
|
|
+ currentId: 0, // 当前操作的素材id
|
|
|
|
+ advertiser: ref<string[]>([]), // 选择的广告主
|
|
});
|
|
});
|
|
- // watchEffect(() => {
|
|
|
|
- // console.log("测试变化监听", props.searchForm);
|
|
|
|
- // });
|
|
|
|
const getList = async (page?: any) => {
|
|
const getList = async (page?: any) => {
|
|
state.loading = true;
|
|
state.loading = true;
|
|
- return message.success("请求接口");
|
|
|
|
|
|
+ // return message.success("请求接口");
|
|
let api = state.type === "video" ? getVideoList : getImageList;
|
|
let api = state.type === "video" ? getVideoList : getImageList;
|
|
let { data } = await api({
|
|
let { data } = await api({
|
|
page: page ? page.current : 1,
|
|
page: page ? page.current : 1,
|
|
@@ -97,20 +146,21 @@ const CommonTable = defineComponent({
|
|
this.type = this.$props.materialType;
|
|
this.type = this.$props.materialType;
|
|
if (this.type === "video") this.columns = TableColumnOfVideo;
|
|
if (this.type === "video") this.columns = TableColumnOfVideo;
|
|
if (this.type === "picture") this.columns = TableColumnOfImage;
|
|
if (this.type === "picture") this.columns = TableColumnOfImage;
|
|
|
|
+ this.getAdList();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- // 获取推广链接数据
|
|
|
|
- // async getList(page?: any) {
|
|
|
|
- // this.loading = true;
|
|
|
|
- // let api = this.type === "video" ? getVideoList : getImageList;
|
|
|
|
- // let { data } = await api({
|
|
|
|
- // page: page ? page.current : 1,
|
|
|
|
- // ...this.$props.searchForm,
|
|
|
|
- // });
|
|
|
|
- // this.loading = false;
|
|
|
|
- // this.list = data.list;
|
|
|
|
- // console.log("返回的数据", data);
|
|
|
|
- // },
|
|
|
|
|
|
+ // 获取广告主列表
|
|
|
|
+ async getAdList() {
|
|
|
|
+ let { data } = await getAdvertiser();
|
|
|
|
+ console.log("AD", data);
|
|
|
|
+ this.adList = data;
|
|
|
|
+ if (this.adList.length === 0) return;
|
|
|
|
+ this.adList.forEach((item) => {
|
|
|
|
+ item.advertiser_id = item.account_id;
|
|
|
|
+ item.advertiser_name = item.account_name;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
async onDelete(val?: any) {
|
|
async onDelete(val?: any) {
|
|
let arr = [];
|
|
let arr = [];
|
|
if (val.id) {
|
|
if (val.id) {
|
|
@@ -133,6 +183,27 @@ const CommonTable = defineComponent({
|
|
this.getList({ current: 1 });
|
|
this.getList({ current: 1 });
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ // 点击推送
|
|
|
|
+ onOpenPush(item: any) {
|
|
|
|
+ this.currentId = item.id;
|
|
|
|
+ this.advertiser = [];
|
|
|
|
+ this.pushVisible = true;
|
|
|
|
+ },
|
|
|
|
+ // 确定推送
|
|
|
|
+ async onConfirmPush() {
|
|
|
|
+ console.log("IDS", this.currentId, this.advertiser);
|
|
|
|
+ try {
|
|
|
|
+ await pushMaterial({
|
|
|
|
+ material_id: this.currentId,
|
|
|
|
+ advertiser_id: this.advertiser[0],
|
|
|
|
+ });
|
|
|
|
+ this.pushVisible = false;
|
|
|
|
+ message.success("推送成功");
|
|
|
|
+ } catch (err) {
|
|
|
|
+ message.error("推送失败");
|
|
|
|
+ console.log(err);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
@@ -143,5 +214,31 @@ export default CommonTable;
|
|
.common-table {
|
|
.common-table {
|
|
background: white;
|
|
background: white;
|
|
padding: 10px;
|
|
padding: 10px;
|
|
|
|
+ .table-view-box {
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ .video-view {
|
|
|
|
+ width: 80px;
|
|
|
|
+ height: 60px;
|
|
|
|
+ border: 1px solid gray;
|
|
|
|
+ margin-right: 4px;
|
|
|
|
+ position: relative;
|
|
|
|
+ .icon-ziyuan {
|
|
|
|
+ position: absolute;
|
|
|
|
+ top: 18px;
|
|
|
|
+ left: 32px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .image-view {
|
|
|
|
+ width: 60px;
|
|
|
|
+ height: 60px;
|
|
|
|
+ border: 1px solid gray;
|
|
|
|
+ margin-right: 4px;
|
|
|
|
+ }
|
|
|
|
+ &:hover span {
|
|
|
|
+ color: rgb(0, 140, 255);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|