This commit is contained in:
ouyangxiu
2025-06-18 20:08:06 +07:00
parent dceacbc3b1
commit 93a924ca33
4 changed files with 45 additions and 476 deletions
-264
View File
@@ -1,264 +0,0 @@
<template>
<div class="pf-warpper avlist">
<el-row class="table-form">
<el-form :inline="true" :model="searchData.param" class="form-inline" size="mini">
<el-form-item>
<el-select placeholder="请选择Ai类型" clearable v-model="searchData.atType" @clear="onClear('subType')">
<el-option :key="item.value" :label="item.label" :value="item.value" v-for="item in AtTypeList" />
</el-select>
</el-form-item>
<el-form-item>
<el-select placeholder="请选择Ai内容类型" clearable v-model="searchData.contentType" @clear="onClear('subType')">
<el-option :key="item.value" :label="item.label" :value="item.value" v-for="item in AiContentTypeList" />
</el-select>
</el-form-item>
<el-form-item>
<el-select placeholder="请选择激活状态" clearable v-model="searchData.enable" @clear="onClear('enable')">
<el-option :key="item.value" :label="item.label" :value="item.value" v-for="item in AiEnableList" />
</el-select>
</el-form-item>
<el-form-item>
<el-select placeholder="请选择排序状态" clearable v-model="searchData.sort" @clear="onClear('sort')">
<el-option key="0" :label="'最新'" :value="0" />
<el-option key="1" :label="'最热'" :value="1" />
</el-select>
</el-form-item>
<el-form-item>
<el-input clearable placeholder="请输入视频媒资库taskID" v-model.number="searchData.taskID" @clear="onClear('taskID')" />
</el-form-item>
<el-form-item>
<el-input clearable placeholder="请输入模版标题" v-model.number="searchData.title" @clear="onClear('title')" />
</el-form-item>
<el-form-item>
<el-button @click="onSearch" icon="el-icon-search" plain type="primary">搜索</el-button>
<el-button @click="add" icon="el-icon-circle-plus-outline" plain type="success">新增</el-button>
</el-form-item>
</el-form>
</el-row>
<el-row>
<el-col>
<el-table :data="resData" element-loading-text="拼命加载中" border height="750" highlight-current-row style="width: 100%" v-loading="loading">
<el-table-column align="center" label="类型">
<template slot-scope="scope">{{ scope.row.atType | changeAtType }}</template>
</el-table-column>
<el-table-column align="center" label="AI内容类型">
<template slot-scope="scope">{{ scope.row.contentType | changeAiContentType }}</template>
</el-table-column>
<el-table-column align="center" label="售卖次数(虚拟)">
<template slot-scope="scope">{{ scope.row.fakeSells }}</template>
</el-table-column>
<el-table-column align="center" label="售卖次数(真)">
<template slot-scope="scope">{{ scope.row.sells }}</template>
</el-table-column>
<el-table-column align="center" label="价格">
<template slot-scope="scope">{{ scope.row.price / 100 }}</template>
</el-table-column>
<el-table-column align="center" label="排序">
<template slot-scope="scope">{{ scope.row.rank }}</template>
</el-table-column>
<el-table-column align="center" label="是否激活">
<template slot-scope="scope">
<el-button :type="scope.row.enable ? 'success' : 'error'" plain size="mini">{{ scope.row.enable ? '开启' : '关闭' }}</el-button>
</template>
</el-table-column>
<el-table-column align="center" label="视频媒资库taskID(视频才会存在)">
<template slot-scope="scope">{{ scope.row.taskID }}</template>
</el-table-column>
<el-table-column align="center" label="模版标题">
<template slot-scope="scope">{{ scope.row.title }}</template>
</el-table-column>
<el-table-column align="center" width="100" label="模版图片">
<template slot-scope="scope">
<ShowImg style="width: 70px; height: 70px; margin: 0 auto" :urls="scope.row.picture"></ShowImg>
</template>
</el-table-column>
<el-table-column align="center" width="100" label="视频封面">
<template slot-scope="scope">
<ShowImg style="width: 70px; height: 70px; margin: 0 auto" :urls="scope.row.videoCover"> </ShowImg>
</template>
</el-table-column>
<el-table-column align="center" label="影片时长">
<template slot-scope="scope">{{ scope.row.playTime | secondToHouseMinuteSecond }}</template>
</el-table-column>
<el-table-column align="center" label="视频">
<template slot-scope="scope">
<i v-if="scope.row.videoUrl" class="el-icon-video-play views" title="点击预览" @click="checkMedia(scope.row.videoUrl, scope.row)"></i>
<div v-else>暂无</div>
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" width="180">
<template slot-scope="scope">{{ scope.row.createdAt | BeiJingTime }} </template>
</el-table-column>
<el-table-column align="center" label="更新时间" width="180">
<template slot-scope="scope">{{ scope.row.updatedAt | BeiJingTime }} </template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="200">
<template slot-scope="scope">
<el-button @click="handleEdit(scope.$index, scope.row)" size="mini" type="primary">编辑</el-button>
<el-button @click="handleDelete(scope.$index, scope.row)" size="mini" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<div class="table-pagination">
<el-pagination
:current-page="searchData.pageNum"
:page-size="searchData.pageSize"
:page-sizes="[10, 20, 30, 50, 100]"
:total="total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
layout="total, sizes, prev, pager, next, jumper"/>
</div>
<!-- 新增及编辑 -->
<Edit :data="editData" v-if="editVisible" @close="closeEdit" :categoryIdList="categoryIdList" />
<ShowVideo ref="showvideo"></ShowVideo>
</div>
</template>
<script>
// 引入模块
import Edit from './components/AddOrEdit'
import ShowImg from '@/components/ShowImg/index.vue'
import { aitemplateSearch, aitemplateDel } from '@/api/aiManagement/aiTemplate'
import ShowVideo from '@/components/ShowVideo/index.vue'
import { AtTypeList, AiContentTypeList, AiEnableList } from '@/filters/aiManagement/aiTemplate'
import { aitemplateCategoryList } from '@/api/aiManagement/aiOrder'
export default {
name: 'AiTemplate',
components: {
ShowImg,
Edit,
ShowVideo
},
data() {
return {
// 请求列表参数
searchData: {
atType: undefined,
contentType: undefined, // 搜索结束时间
enable: undefined, // 搜索开始时间
sort: undefined, // 发布者ID
taskID: undefined,
title: undefined,
pageNum: 1,
pageSize: 10
},
resData: [], // el-table表格数据
total: 0, // 数据总条数
loading: true, // 列表加载状态
AtTypeList: AtTypeList(),
AiContentTypeList: AiContentTypeList(),
AiEnableList: AiEnableList(),
editVisible: false,
categoryIdList: []
}
},
mounted() {
this.getGameInfo()
this.getCategoryId()
},
methods: {
getCategoryId() {
aitemplateCategoryList({
pageNum: 1,
pageSize: 1000
}).then(res => {
if (res.code === 200) {
this.categoryIdList = res.data.list
} else {
this.categoryIdList = []
this.$message.error('请求列表失败!')
}
})
},
// TODO:请求应用列表数据
getGameInfo() {
aitemplateSearch(this.searchData).then(res => {
if (res.code === 200) {
this.resData = res.data.list
this.total = res.data.total
} else {
this.resData = []
this.total = 0
this.$message.error('请求列表失败!')
}
this.loading = false
})
},
// TODO:删除应用列表数据
handleDelete(index, row) {
this.$confirm('确定删除?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
aitemplateDel({ id: row.id }).then(res => {
if (res.code === 200) {
this.getGameInfo()
this.$message.success('成功删除!')
} else {
this.$message.error('操作失败')
}
})
})
},
onSearch() {
this.searchData.pageNum = 1
this.searchData.pageSize = 10
this.getGameInfo()
},
// 切换每页数据量
handleSizeChange(val) {
this.searchData.pageSize = val
this.getGameInfo()
},
// 切换页数
handleCurrentChange(val) {
this.searchData.pageNum = val
this.getGameInfo()
},
// 新增按钮
add() {
this.editVisible = true
this.editData = {
title: '新增'
}
},
// 编辑按钮
handleEdit(index, row) {
this.editVisible = true
this.editData = {
title: '编辑',
data: row
}
},
// 关闭编辑弹窗
closeEdit() {
this.editData = {
title: '新增',
data: {}
}
this.editVisible = false
this.getGameInfo()
},
// 清空某一项筛选列表
onClear(key) {
this.searchData[key] = undefined
this.getGameInfo()
},
// 视频查看
checkMedia(url, data) {
this.$refs.showvideo.open(url, data, data.id)
}
}
}
</script>