Commit e6d6c59b authored by lijin's avatar lijin

modified

parent b90fa713
......@@ -59,7 +59,7 @@
{{ getTemplateName(scope.row.campaignTemplateId) }}
</template>
</el-table-column>
<el-table-column prop="startTime" label="开始时间" width="180">
<template slot-scope="scope">
{{ scope.row.startTime ? moment(scope.row.startTime).format('YYYY-MM-DD HH:mm:ss') : '' }}
......@@ -77,7 +77,7 @@
</el-table-column>
<el-table-column prop="status" label="状态" sortables>
<template slot-scope="scope">
<el-tag
<el-tag
:type="getStatusType(scope.row.status)"
:class="{'clickable-tag': scope.row.status === 4}"
@click="scope.row.status === 4 && showErrorMessage(scope.row)">
......@@ -156,7 +156,13 @@
:visible.sync="detailVisible"
width="80%"
>
<el-table :data="currentTaskDetail" border>
<div class="header-actions">
<el-button type="primary" @click="showAddDialog">创建任务</el-button>
<div class="header-right">
<el-button icon="el-icon-refresh" @click="refreshDetail" :loading="detailLoading">刷新</el-button>
</div>
</div>
<el-table :data="currentTaskDetail" border :loading="detailLoading">
<el-table-column prop="id" label="ID" width="80"></el-table-column>
<el-table-column prop="advertiserId" label="广告账户ID" align="center" sortable></el-table-column>
<el-table-column prop="campaignId" label="广告计划ID" align="center" sortable></el-table-column>
......@@ -165,19 +171,19 @@
<template slot-scope="scope">
<div class="table-countries-container">
<template v-if="scope.row.countries && scope.row.countries.length > 0">
<el-tag
v-for="(country, index) in typeof scope.row.countries === 'string' ?
JSON.parse(scope.row.countries) : scope.row.countries"
<el-tag
v-for="(country, index) in typeof scope.row.countries === 'string' ?
JSON.parse(scope.row.countries) : scope.row.countries"
:key="country.code"
v-if="index < 5"
size="mini"
size="mini"
class="country-tag"
type="primary"
effect="light">
{{ country.code }}
</el-tag>
<span v-if="(typeof scope.row.countries === 'string' ?
JSON.parse(scope.row.countries) : scope.row.countries).length > 5"
<span v-if="(typeof scope.row.countries === 'string' ?
JSON.parse(scope.row.countries) : scope.row.countries).length > 5"
class="more-countries">...</span>
</template>
<span v-else class="no-countries-text">无国家信息</span>
......@@ -201,7 +207,7 @@
</el-table-column>
<el-table-column prop="status" label="状态" sortables>
<template slot-scope="scope">
<el-tag
<el-tag
:type="getStatusType(scope.row.status)"
:class="{'clickable-tag': scope.row.status === 4}"
@click="scope.row.status === 4 && showErrorMessage(scope.row)">
......@@ -212,11 +218,11 @@
<!-- 新增操作列 -->
<el-table-column label="操作" width="120" align="center">
<template slot-scope="scope">
<el-button
type="primary"
size="mini"
<el-button
type="primary"
size="mini"
icon="el-icon-data-analysis"
v-if="scope.row.adInfo"
v-if="scope.row.adInfo"
@click="showAdInfo(scope.row)">
广告信息
</el-button>
......@@ -224,7 +230,7 @@
</el-table-column>
</el-table>
</el-dialog>
<!-- 广告信息抽屉 -->
<el-drawer
title="广告信息"
......@@ -239,8 +245,8 @@
<div class="countries-section">
<template v-if="currentAdInfo.countries && currentAdInfo.countries.length > 0">
<div v-for="(country, index) in currentAdInfo.countries.slice(0, 10)" :key="country.code" class="country-item">
<el-tag
size="small"
<el-tag
size="small"
class="country-tag"
type="primary"
effect="light">
......@@ -252,7 +258,7 @@
</template>
<span v-else class="no-countries">无国家信息</span>
</div>
<!-- 标题部分 -->
<div class="section-title">标题</div>
<div class="headlines-section">
......@@ -281,10 +287,10 @@
<div class="section-title">视频</div>
<div class="videos-section">
<div v-for="(video, index) in currentAdInfo.videoInfos" :key="'video-'+index" class="video-item">
<video
:src="video.url"
class="video-thumbnail"
preload="metadata"
<video
:src="video.url"
class="video-thumbnail"
preload="metadata"
@click="playVideo(video.url)">
</video>
<div class="video-name">{{video.name}}</div>
......@@ -318,7 +324,7 @@
<el-button type="primary" @click="errorMessageVisible = false">关闭</el-button>
</span>
</el-dialog>
</div>
</template>
......@@ -373,7 +379,9 @@ export default {
videoPlayVisible: false,
currentVideoUrl: '',
errorMessageVisible: false,
currentErrorMsg: ''
currentErrorMsg: '',
currentTaskId: null,
detailLoading: false,
}
},
created() {
......@@ -498,7 +506,8 @@ export default {
this.detailVisible = true;
this.detailLoading = true;
this.currentTaskDetail = null;
this.currentTaskId = row.id;
getCampaignTaskDetails({taskId: row.id}).then(response => {
if (response.status === 200) {
this.currentTaskDetail = response.result.data;
......@@ -513,6 +522,22 @@ export default {
});
},
refreshDetail() {
this.detailLoading = true;
getCampaignTaskDetails({taskId: this.currentTaskId}).then(response => {
if (response.status === 200) {
this.currentTaskDetail = response.result.data;
} else {
this.$message.error(response.msg || '获取任务详情失败');
}
}).catch(error => {
console.error('获取任务详情失败:', error);
this.$message.error('获取任务详情失败: ' + error.message);
}).finally(() => {
this.detailLoading = false;
});
},
async handleStart(row) {
try {
const response = await axios.post(process.env.PUTIN_API + `/campaign-tasks/start?campaignTaskId=${row.id}`)
......@@ -562,7 +587,7 @@ export default {
showErrorReason() {
this.errorReasonVisible = true;
},
formatJson(jsonString) {
try {
// 如果是字符串,则解析为JSON对象
......@@ -579,13 +604,13 @@ export default {
try {
// 如果adInfo是字符串,则解析为JSON对象
this.currentAdInfo = typeof row.adInfo === 'string' ? JSON.parse(row.adInfo) : row.adInfo;
// 确保countries字段可用
if (row.countries) {
this.currentAdInfo.countries = typeof row.countries === 'string' ?
this.currentAdInfo.countries = typeof row.countries === 'string' ?
JSON.parse(row.countries) : row.countries;
}
this.drawerVisible = true;
} catch (error) {
console.error('解析广告信息失败:', error);
......@@ -595,12 +620,12 @@ export default {
this.$message.info('没有广告信息');
}
},
previewImage(url) {
this.previewImageUrl = url;
this.previewVisible = true;
},
playVideo(url) {
this.currentVideoUrl = url;
this.videoPlayVisible = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment