|
|
@@ -39,9 +39,9 @@
|
|
|
{{ getPlanStatusText(row.status) }}
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="failReason" label="原因" width="100" show-overflow-tooltip>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="广告类型" align="center" width="90">
|
|
|
<template #default="{ row }">
|
|
|
<el-tag :type="getAdTypeColor(row.adType)">
|
|
|
@@ -138,7 +138,7 @@
|
|
|
clearable
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
+
|
|
|
<el-form-item label="广告类型" prop="adType">
|
|
|
<el-radio-group v-model="formData.adType">
|
|
|
<el-radio label="企微" :value="1" />
|
|
|
@@ -346,7 +346,11 @@
|
|
|
|
|
|
<el-form-item label="创意图片/视频" prop="creativeFileArr">
|
|
|
<div class="flex flex-col gap-2">
|
|
|
- <el-button :disabled="valueDisabled" size="small" @click="openFileSelector('creative')" style="width: fit-content">选择文件</el-button>
|
|
|
+ <div class="flex flex-row gap-2">
|
|
|
+ <el-button :disabled="valueDisabled" size="small" @click="openFileSelector('creative')" style="width: fit-content">选择文件</el-button>
|
|
|
+ <el-button type="primary" :disabled="valueDisabled" size="small" @click="addOneCreativeImage" style="width: fit-content"><el-icon><Plus /></el-icon> 加个图片</el-button>
|
|
|
+ <el-button type="primary" :disabled="valueDisabled" size="small" @click="addOneCreativeVideo" style="width: fit-content"><el-icon><Plus /></el-icon> 加个视频</el-button>
|
|
|
+ </div>
|
|
|
<div v-if="formData.creativeFileArr" class="flex flex-wrap gap-2">
|
|
|
<div
|
|
|
v-for="(cf, index) in formData.creativeFileArr"
|
|
|
@@ -367,6 +371,7 @@
|
|
|
style="width: 80px; height: 80px; display: block"
|
|
|
class="cursor-pointer rounded border"></video>
|
|
|
<button
|
|
|
+ type="button"
|
|
|
:disabled="valueDisabled"
|
|
|
@click="removeFile('creative', index)"
|
|
|
class="absolute -top-1 -right-1 cursor-pointer bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center hover:bg-red-600 transition-colors"
|
|
|
@@ -383,7 +388,10 @@
|
|
|
|
|
|
<el-form-item label="品牌形象图片" prop="brandImageUrl">
|
|
|
<div class="flex flex-col gap-2">
|
|
|
- <el-button :disabled="valueDisabled" size="small" @click="openFileSelector('brand')" style="width: fit-content">选择图片</el-button>
|
|
|
+ <div class="flex flex-row gap-2">
|
|
|
+ <el-button :disabled="valueDisabled" size="small" @click="openFileSelector('brand')" style="width: fit-content">选择图片</el-button>
|
|
|
+ <el-button type="primary" :disabled="valueDisabled" size="small" @click="randomOneBrandImage" style="width: fit-content"><el-icon><Refresh /></el-icon> 随机图片</el-button>
|
|
|
+ </div>
|
|
|
<div v-if="formData.brandImageUrl">
|
|
|
<div class="relative inline-block">
|
|
|
<el-image
|
|
|
@@ -394,6 +402,7 @@
|
|
|
class="cursor-pointer rounded border"
|
|
|
/>
|
|
|
<button
|
|
|
+ type="button"
|
|
|
:disabled="valueDisabled"
|
|
|
@click="removeFile('brand', 0)"
|
|
|
class="absolute -top-1 -right-1 cursor-pointer bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center hover:bg-red-600 transition-colors"
|
|
|
@@ -439,7 +448,7 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<el-button type="primary" @click="handleReCreate">预览</el-button>
|
|
|
- <el-table :data="plans"
|
|
|
+ <el-table :data="plans"
|
|
|
:preserve-expanded-content="true"
|
|
|
row-key="adgroupName"
|
|
|
:expand-row-keys="expandedRows"
|
|
|
@@ -511,7 +520,7 @@
|
|
|
<template #default="{ row }">
|
|
|
{{ row.assetType === 1 ? row.dramaId : row.fictionId }}
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="dramaName" label="资产名称" width="120" show-overflow-tooltip >
|
|
|
<template #default="{ row }">
|
|
|
{{ row.assetType === 1 ? row.dramaName : row.fictionName }}
|
|
|
@@ -588,7 +597,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="fileType" label="类型" width="100" />
|
|
|
-
|
|
|
+
|
|
|
<el-table-column label="业务分类" width="120">
|
|
|
<template #default="{ row }">
|
|
|
<el-tag v-if="row.businessType === 1" type="success">创意</el-tag>
|
|
|
@@ -647,7 +656,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, computed, onMounted, watch } from 'vue'
|
|
|
+import { ref, computed, onMounted, watch, toRaw } from 'vue'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
import {
|
|
|
getAdPlanConfList,
|
|
|
@@ -655,7 +664,10 @@ import {
|
|
|
updateAdPlanConf,
|
|
|
deleteAdPlanConf,
|
|
|
reCreateAdPlanConf,
|
|
|
- generatePlan
|
|
|
+ generatePlan,
|
|
|
+ getOneCreativeImage,
|
|
|
+ getOneCreativeVideo,
|
|
|
+ getOneBrandImage
|
|
|
} from '@/api/adPlanConf'
|
|
|
import { myDramaAssetList } from '@/api/drama'
|
|
|
import { getConversions } from '@/api/conversion'
|
|
|
@@ -670,6 +682,9 @@ import {
|
|
|
Close
|
|
|
} from '@element-plus/icons-vue'
|
|
|
import router from '@/router'
|
|
|
+import dayjs from 'dayjs'
|
|
|
+import { de } from 'element-plus/es/locales.mjs'
|
|
|
+
|
|
|
|
|
|
// 数据
|
|
|
const loading = ref(false)
|
|
|
@@ -813,6 +828,16 @@ const formRules = {
|
|
|
],
|
|
|
}
|
|
|
|
|
|
+const userInfo = ref(null)
|
|
|
+
|
|
|
+// 加载用户信息
|
|
|
+const loadUserInfo = () => {
|
|
|
+ const storedUserInfo = localStorage.getItem('userInfo')
|
|
|
+ if (storedUserInfo) {
|
|
|
+ userInfo.value = JSON.parse(storedUserInfo)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 方法
|
|
|
const loadConfList = async () => {
|
|
|
loading.value = true
|
|
|
@@ -871,7 +896,7 @@ const getPlanStatusText = (status) => {
|
|
|
2: '执行中',
|
|
|
3: '失败',
|
|
|
4: '已结束',
|
|
|
- 5: '部分失败'
|
|
|
+ 5: '部分失败'
|
|
|
}
|
|
|
return statusMap[status] || '未知'
|
|
|
}
|
|
|
@@ -901,15 +926,81 @@ const handleAdTypeChange = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const handleCreate = () => {
|
|
|
+const addOneCreativeImage = async () => {
|
|
|
+ const oldIds = formData.value.creativeFileArr.map(file => file.id)
|
|
|
+ const creativeImage = await getOneCreativeImage(oldIds)
|
|
|
+ if (creativeImage.success) {
|
|
|
+ formData.value.creativeFileArr.push(creativeImage.data)
|
|
|
+ const urls = formData.value.creativeFileArr.map(file => file.fileUrl).join(',')
|
|
|
+ // 去除文件后缀
|
|
|
+ const fileNames = formData.value.creativeFileArr.map(file => file.originalFileName.split('.').slice(0, -1).join('.')).join(',')
|
|
|
+ formData.value.creativeFileUrls = urls
|
|
|
+ formData.value.creativeFileNames = fileNames
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const addOneCreativeVideo = async () => {
|
|
|
+ const oldIds = formData.value.creativeFileArr.map(file => file.id)
|
|
|
+ const creativeVideo = await getOneCreativeVideo(oldIds)
|
|
|
+ if (creativeVideo.success) {
|
|
|
+ formData.value.creativeFileArr.push(creativeVideo.data)
|
|
|
+ const urls = formData.value.creativeFileArr.map(file => file.fileUrl).join(',')
|
|
|
+ // 去除文件后缀
|
|
|
+ const fileNames = formData.value.creativeFileArr.map(file => file.originalFileName.split('.').slice(0, -1).join('.')).join(',')
|
|
|
+ formData.value.creativeFileUrls = urls
|
|
|
+ formData.value.creativeFileNames = fileNames
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const randomOneBrandImage = async () => {
|
|
|
+ const brandImage = await getOneBrandImage()
|
|
|
+ if (brandImage.success) {
|
|
|
+ formData.value.brandImageFile = brandImage.data
|
|
|
+ formData.value.brandImageUrl = brandImage.data.fileUrl
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const handleCreate = async () => {
|
|
|
//1,2,3,4,5,6,7,8,9,10,11
|
|
|
//随机一个1-11
|
|
|
+ const name = userInfo.value.name + dayjs().format('MMDDHH')
|
|
|
+ const createImage = await getOneCreativeImage([])
|
|
|
+ console.log(createImage)
|
|
|
+ let creativeFileArr = []
|
|
|
+ let creativeFileUrls = ''
|
|
|
+ let creativeFileNames = ''
|
|
|
+ if (createImage.success) {
|
|
|
+ creativeFileArr = [createImage.data]
|
|
|
+ creativeFileUrls = createImage.data.fileUrl
|
|
|
+ creativeFileNames = createImage.data.originalFileName
|
|
|
+ }
|
|
|
+
|
|
|
+ const brandImage = await getOneBrandImage()
|
|
|
+ let brandImageFile = null
|
|
|
+ let brandImageUrl = ''
|
|
|
+ if (brandImage.success) {
|
|
|
+ brandImageFile = brandImage.data
|
|
|
+ brandImageUrl = brandImage.data.fileUrl
|
|
|
+ }
|
|
|
+
|
|
|
+ let myLoadPageList = toRaw(loadPageList.value).filter(page => page.createUserId === userInfo.value.id)
|
|
|
+ console.log(myLoadPageList)
|
|
|
+ let pageIdArr = []
|
|
|
+ let pageIds = ''
|
|
|
+ if (myLoadPageList.length > 0) {
|
|
|
+ pageIdArr = [myLoadPageList[0].pageId]
|
|
|
+ pageIds = myLoadPageList[0].pageId + ''
|
|
|
+ }
|
|
|
+
|
|
|
+ let accountGroupId = toRaw(accountGroupList.value)[0].id
|
|
|
+
|
|
|
+
|
|
|
const site = Math.floor(Math.random() * 11) + 1
|
|
|
dialogTitle.value = '创建配置'
|
|
|
editingId.value = null
|
|
|
formData.value = {
|
|
|
- name: '',
|
|
|
- accountGroupId: null,
|
|
|
+ name: name,
|
|
|
+ accountGroupId: accountGroupId,
|
|
|
adType: 2,
|
|
|
bidAmount: 150,
|
|
|
deepConversionWorthRate: 50.00,
|
|
|
@@ -923,13 +1014,13 @@ const handleCreate = () => {
|
|
|
assetModel: 1,
|
|
|
fictionAmount: 0,
|
|
|
imageIds: '',
|
|
|
- pageIds: '',
|
|
|
- pageIdArr: [],
|
|
|
- creativeFileArr: [],
|
|
|
- creativeFileUrls: '',
|
|
|
- creativeFileNames: '',
|
|
|
- brandImageFile: null,
|
|
|
- brandImageUrl: '',
|
|
|
+ pageIds: pageIds,
|
|
|
+ pageIdArr: pageIdArr,
|
|
|
+ creativeFileArr: creativeFileArr,
|
|
|
+ creativeFileUrls: creativeFileUrls,
|
|
|
+ creativeFileNames: creativeFileNames,
|
|
|
+ brandImageFile: brandImageFile,
|
|
|
+ brandImageUrl: brandImageUrl,
|
|
|
creativeText: '情感美文点点看',
|
|
|
brandName: '情感美文',
|
|
|
buttonText: '查看详情',
|
|
|
@@ -1151,16 +1242,16 @@ const confirmFileSelection = () => {
|
|
|
ElMessage.warning('请至少选择一个文件')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (currentFileType.value === 'brand' && selectedFiles.value.length > 1) {
|
|
|
ElMessage.warning('品牌形象图片只能选择1张')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
const urls = selectedFiles.value.map(file => file.fileUrl).join(',')
|
|
|
// 去除文件后缀
|
|
|
const fileNames = selectedFiles.value.map(file => file.originalFileName.split('.').slice(0, -1).join('.')).join(',')
|
|
|
-
|
|
|
+
|
|
|
if (currentFileType.value === 'creative') {
|
|
|
formData.value.creativeFileUrls = urls
|
|
|
formData.value.creativeFileNames = fileNames
|
|
|
@@ -1169,7 +1260,7 @@ const confirmFileSelection = () => {
|
|
|
formData.value.brandImageUrl = selectedFiles.value[0].fileUrl
|
|
|
formData.value.brandImageFile = selectedFiles.value[0]
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
fileSelectorVisible.value = false
|
|
|
selectedFiles.value = []
|
|
|
}
|
|
|
@@ -1177,13 +1268,15 @@ const confirmFileSelection = () => {
|
|
|
// 移除文件
|
|
|
const removeFile = (type, index) => {
|
|
|
if (type === 'creative') {
|
|
|
- const urls = formData.value.creativeFileUrls.split(',')
|
|
|
- urls.splice(index, 1)
|
|
|
- formData.value.creativeFileUrls = urls.filter(url => url).join(',')
|
|
|
- // 同步更新 creativeFileArr
|
|
|
- if (formData.value.creativeFileArr && formData.value.creativeFileArr.length > index) {
|
|
|
- formData.value.creativeFileArr.splice(index, 1)
|
|
|
- }
|
|
|
+ const arr = toRaw(formData.value.creativeFileArr)
|
|
|
+ arr.splice(index, 1)
|
|
|
+ debugger
|
|
|
+ formData.value.creativeFileArr = [...arr]
|
|
|
+ debugger
|
|
|
+ formData.value.creativeFileUrls = arr.map(file => file.fileUrl).join(',')
|
|
|
+ debugger
|
|
|
+ formData.value.creativeFileNames = arr.map(file => file.originalFileName).join(',')
|
|
|
+ debugger
|
|
|
} else if (type === 'brand') {
|
|
|
formData.value.brandImageUrl = ''
|
|
|
formData.value.brandImageFile = null
|
|
|
@@ -1248,6 +1341,7 @@ onMounted(() => {
|
|
|
loadAccountGroupList()
|
|
|
loadDramaList()
|
|
|
loadLoadPageList()
|
|
|
+ loadUserInfo()
|
|
|
})
|
|
|
</script>
|
|
|
|