Commit e6d6c59b authored by lijin's avatar lijin

modified

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