index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <div class="filter-container-lt">
  5. <el-form :inline="true" label-position="left" :model="listQuery">
  6. <el-form-item>
  7. <el-input clearable v-model="listQuery.sku" placeholder="搜索SKU"
  8. ></el-input>
  9. </el-form-item>
  10. <el-form-item>
  11. <el-input clearable v-model="listQuery.videoTitle" placeholder="视频标题"
  12. ></el-input>
  13. </el-form-item>
  14. <el-button type="primary" @click="handleFilter">搜索</el-button>
  15. </el-form>
  16. </div>
  17. <!-- <div class="filter-container-rt">
  18. <excel-import :upload-url="'/api/upload-excel'" :headers="{ token: 'your-token' }"
  19. :upload-data="{ type: 'import' }" @on-success="handleImportSuccess">
  20. <template slot="upload-text">
  21. 导入话题
  22. </template>
  23. </excel-import>
  24. </div> -->
  25. </div>
  26. <div class="table-container">
  27. <el-table style="width: 100%" v-loading="listLoading" :key="tableKey" :data="list" row-key="id" stripe border fit
  28. highlight-current-row>
  29. <el-table-column label="序号" type="index" width="60" align="center" />
  30. <el-table-column label="视频ID" min-width="100" align="center" prop="id" />
  31. <el-table-column label="视频标题" min-width="150" align="center" prop="videoTitle" />
  32. <el-table-column label="视频封面" min-width="130" align="center" prop="videoCoverImageUrl">
  33. <template slot-scope="scope">
  34. <div v-if="scope.row.videoCoverImageUrl" class="video" @click="handlePlay(scope.row)">
  35. <img :src="scope.row.videoCoverImageUrl" class="video-img" />
  36. <i class="el-icon-video-play" />
  37. </div>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="视频描述" min-width="150" align="center" prop="videoDesc">
  41. <template slot-scope="scope">
  42. <el-popover placement="top-start" width="200" trigger="hover" :content="scope.row.videoDesc">
  43. <span class="desc"
  44. slot="reference">{{ scope.row.videoDesc }}</span>
  45. </el-popover>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="SKU" min-width="100" align="center" prop="sku" />
  49. <el-table-column label="SKUID" min-width="100" align="center" prop="skuId" />
  50. <el-table-column label="审核状态" min-width="100" align="center" prop="reviewStatus">
  51. <template slot-scope="scope">
  52. <span class="status-tag" :class="{
  53. 'status-pending': scope.row.reviewStatus === 0,
  54. 'status-success': scope.row.reviewStatus === 1,
  55. 'status-error': scope.row.reviewStatus === 2
  56. }"></span>
  57. {{ getValueByKey(scope.row.reviewStatus, auditStatus) }}
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="审核时间" min-width="100" align="center" prop="reviewTime" />
  61. <el-table-column label="审核人" min-width="100" align="center" prop="reviewer" />
  62. <el-table-column label="发布状态" min-width="100" align="center" prop="publishStatus">
  63. <template slot-scope="scope">
  64. <span class="status-tag" :class="{
  65. 'status-pending': scope.row.publishStatus === 0,
  66. 'status-success': scope.row.publishStatus === 1,
  67. 'status-error': scope.row.publishStatus === 2
  68. }"></span>
  69. {{ getValueByKey(scope.row.publishStatus, auditStatus) }}
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="发布时间" min-width="100" align="center" prop="publishTime" />
  73. <el-table-column label="发布人" min-width="100" align="center" prop="publisher" />
  74. <el-table-column label="关联话题" min-width="100" align="center" prop="hotWords" />
  75. <el-table-column label="直播时间" min-width="100" align="center" prop="liveTime" />
  76. <!-- <el-table-column
  77. label="直播场次"
  78. min-width="100"
  79. align="center"
  80. prop="liveSession"
  81. /> -->
  82. <el-table-column label="直播中控" min-width="120" align="center" prop="liveController">
  83. </el-table-column>
  84. <el-table-column label="直播间号" min-width="100" align="center" prop="liveRoomId" />
  85. <el-table-column label="操作人" min-width="100" align="center" prop="creator" />
  86. <el-table-column label="创建时间" min-width="100" align="center" prop="createTime" />
  87. <el-table-column label="下载次数" min-width="100" align="center">
  88. <template slot-scope="scope">
  89. {{ scope.row.downloadCount ? scope.row.downloadCount : '-' }}
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="操作" align="center" min-width="160"
  93. v-bind="device !== 'mobile' ? { fixed: 'right' } : {}">
  94. <template slot-scope="scope">
  95. <el-tooltip class="item" effect="dark" content="下载" placement="top">
  96. <el-button type="primary" :loading="scope.row && scope.row.id
  97. ? downloadingRows[scope.row.id]
  98. : false
  99. " size="mini" icon="el-icon-download" circle @click="handleDownload(scope.row)" />
  100. </el-tooltip>
  101. <el-tooltip class="item" effect="dark" content="播放" placement="top">
  102. <el-button type="success" size="mini" icon="el-icon-caret-right" circle @click="handlePlay(scope.row)" />
  103. </el-tooltip>
  104. <el-tooltip
  105. class="more"
  106. effect="dark"
  107. content="删除"
  108. placement="top"
  109. >
  110. <el-button
  111. type="danger"
  112. size="mini"
  113. icon="el-icon-delete-solid"
  114. circle
  115. @click="handleDelete(scope.row)"
  116. />
  117. </el-tooltip>
  118. <el-tooltip class="more" style="margin: 10px 0 0 0;" effect="dark" content="更多操作" placement="top">
  119. <el-dropdown trigger="click" @command="command => handleAdvise(command, scope.row)">
  120. <el-button size="mini" type="info" icon="el-icon-more" circle title="更多操作" />
  121. <el-dropdown-menu class="dropdown-menu" slot="dropdown">
  122. <el-dropdown-item command="addAdvise">优化建议</el-dropdown-item>
  123. <el-dropdown-item command="editAdvise">查看建议</el-dropdown-item>
  124. </el-dropdown-menu>
  125. </el-dropdown>
  126. </el-tooltip>
  127. <!-- <el-tooltip class="more" effect="dark" content="更多操作" placement="top">
  128. <el-dropdown trigger="click" @command="command => handleMore(command, scope.row)">
  129. <el-button size="mini" type="primary" icon="el-icon-more" circle title="更多操作" />
  130. <el-dropdown-menu class="dropdown-menu" slot="dropdown">
  131. <el-dropdown-item command="changeTopic">修改话题</el-dropdown-item>
  132. <el-dropdown-item command="delete">删除</el-dropdown-item>
  133. </el-dropdown-menu>
  134. </el-dropdown>
  135. </el-tooltip> -->
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. </div>
  140. <!-- 分页 -->
  141. <swPage v-if="total > 0" key="2" :listQuery="listQuery" :total="total" pos="btmRight" @retPage="retPage" />
  142. <!-- 视频播放 -->
  143. <video-player ref="videoPlayer" :video-url="currentVideoUrl" :video-title="currentVideoTitle"
  144. @close="handlePlayerClose" />
  145. <!-- 修改话题-->
  146. <change-topic ref="changeTopicRef" :rows="currentVideo" @confirm="handleTopicChange" />
  147. <!-- 优化建议 -->
  148. <suggestion-table ref="suggestionTable" />
  149. <!-- 编辑优化建议 -->
  150. <edit-suggestion ref="editSuggestion" />
  151. </div>
  152. </template>
  153. <script>
  154. import waves from "@/directive/waves";
  155. import swPage from "@/views/common/swPage";
  156. import { auditStatus } from "@/constants/index";
  157. import { getValueByKey } from "@/utils/index";
  158. import ExcelImport from "@/components/ExcelImport";
  159. import changeTopic from "@/views/oral-video/component/changeTopic";
  160. import EditSuggestion from "@/components/Suggestion/editSuggestion";
  161. import SuggestionTable from "@/components/Suggestion/suggestionTable";
  162. import { fetchOralVideoList, deleteOralVideoList, addSuggestion } from "@/api/video";
  163. import downloadUtil from "@/utils/downloadUtil";
  164. import VideoPlayer from "@/components/VideoPlayer";
  165. import { mapGetters } from "vuex";
  166. export default {
  167. name: "oralVideoIndex",
  168. directives: {
  169. waves
  170. },
  171. components: {
  172. swPage,
  173. VideoPlayer,
  174. ExcelImport,
  175. changeTopic,
  176. EditSuggestion,
  177. SuggestionTable
  178. },
  179. computed: {
  180. ...mapGetters(["device"]) // 从 vuex 中获取设备类型
  181. },
  182. data() {
  183. return {
  184. auditStatus,
  185. tableKey: 0,
  186. list: [],
  187. total: 0,
  188. listLoading: false,
  189. downloadingRows: {},
  190. listQuery: {
  191. currentPage: 1,
  192. pageSize: 10,
  193. videoTitle: null,
  194. type: 1,
  195. sku:null
  196. },
  197. currentVideoUrl: null,
  198. currentVideoTitle: null,
  199. currentVideo:{},
  200. };
  201. },
  202. //页面创建的时候执行
  203. created() {
  204. this.getList();
  205. },
  206. methods: {
  207. getValueByKey,
  208. getList() {
  209. this.listLoading = true;
  210. const params = {}
  211. for (const key in this.listQuery) {
  212. const value = this.listQuery[key]
  213. if (value !== null && value !== '' && value !== undefined) {
  214. params[key] = value
  215. }
  216. }
  217. fetchOralVideoList(params).then(res => {
  218. if (200 == res.code) {
  219. this.total = res.data.total;
  220. this.list = res.data.rows;
  221. }
  222. this.listLoading = false;
  223. });
  224. },
  225. retPage() {
  226. //分页
  227. this.getList();
  228. },
  229. handleFilter() {
  230. this.listQuery.page = 1;
  231. this.getList();
  232. },
  233. // 视频下载
  234. async handleDownload(row) {
  235. const { videoUrl, videoTitle, id, sku } = row;
  236. this.$set(this.downloadingRows, id, true);
  237. try {
  238. const title = sku ? videoTitle + "_" + sku : videoTitle;
  239. const res = await downloadUtil.fileDownload(videoUrl, title);
  240. if (res) {
  241. const params = {
  242. "videoId": id,
  243. "operationType": 2
  244. }
  245. addSuggestion(params).then(res =>{
  246. if(res.code == 200){}
  247. })
  248. this.$message.success("下载成功");
  249. }
  250. } catch (error) {
  251. this.$message.error(error.message);
  252. } finally {
  253. this.$set(this.downloadingRows, id, false);
  254. }
  255. },
  256. // 视频播放
  257. handlePlay(row) {
  258. const { videoUrl, videoTitle } = row;
  259. ``;
  260. if (!videoUrl) {
  261. this.$message.error("视频地址不存在");
  262. return;
  263. }
  264. this.currentVideoUrl = videoUrl;
  265. this.currentVideoTitle = videoTitle;
  266. this.$refs.videoPlayer.show();
  267. },
  268. handlePlayerClose() {
  269. this.currentVideoUrl = "";
  270. this.currentVideoTitle = "";
  271. },
  272. handleDelete(row) {
  273. //删除
  274. this.$confirm("是否删除该视频?", "提示", {
  275. confirmButtonText: "确定",
  276. cancelButtonText: "取消",
  277. type: "warning"
  278. }).then(() => {
  279. const { id } = row;
  280. deleteOralVideoList([id]).then(() => {
  281. this.$notify({
  282. title: "成功",
  283. message: "删除成功",
  284. type: "success",
  285. duration: 3000
  286. });
  287. const index = this.list.indexOf(row);
  288. this.list.splice(index, 1);
  289. });
  290. });
  291. },
  292. // 导入话题回调
  293. handleImportSuccess({ data, header, file }) {
  294. console.log("导入的数据:", data);
  295. console.log("表头:", header);
  296. console.log("原始文件:", file);
  297. // 处理导入的数据
  298. },
  299. handleAdvise(command, row) {
  300. if (command == 'addAdvise') {
  301. this.handleEditSuggestions(row)
  302. }
  303. if (command == 'editAdvise') {
  304. this.handleViewSuggestions(row)
  305. }
  306. },
  307. handleViewSuggestions(row) {
  308. this.$refs.suggestionTable.show(row);
  309. },
  310. handleEditSuggestions(row) {
  311. this.$refs.editSuggestion.show(row);
  312. },
  313. //更多
  314. handleMore(command, row) {
  315. if (command === "delete") {
  316. this.handleDelete(row); // 删除
  317. } else if (command === "changeTopic") {
  318. this.changeTopic(row); // 修改话题
  319. }
  320. },
  321. // 修改话题
  322. changeTopic(row) {
  323. this.currentVideo = row;
  324. this.$refs.changeTopicRef.show();
  325. },
  326. handleTopicChange() {
  327. this.$refs.changeTopicRef.show();
  328. this.retPage()
  329. }
  330. }
  331. };
  332. </script>
  333. <style rel="stylesheet/scss" lang="scss" scoped>
  334. @import "@/styles/layout.scss";
  335. .button {
  336. .el-button {
  337. margin-bottom: 10px;
  338. &:last-child {
  339. margin-bottom: 0;
  340. }
  341. }
  342. }
  343. .video {
  344. position: relative;
  345. display: flex;
  346. align-content: center;
  347. justify-content: center;
  348. &:hover {
  349. i {
  350. opacity: 1;
  351. }
  352. .video-img {
  353. opacity: 0.6;
  354. }
  355. }
  356. &-img {
  357. width: 80px;
  358. height: 80px;
  359. border: 1px solid #eee;
  360. object-fit: cover;
  361. cursor: pointer;
  362. }
  363. i {
  364. width: 80px;
  365. height: 80px;
  366. position: absolute;
  367. top: 85%;
  368. left: 50%;
  369. transform: translate(-50%, -50%);
  370. font-size: 20px;
  371. font-weight: bold;
  372. color: #fff;
  373. opacity: 0;
  374. cursor: pointer;
  375. }
  376. }
  377. .status-tag {
  378. display: inline-block;
  379. width: 8px;
  380. height: 8px;
  381. border-radius: 50%;
  382. margin-right: 6px;
  383. }
  384. .status-pending {
  385. background-color: #e6a23c;
  386. }
  387. .status-success {
  388. background-color: #67c23a;
  389. }
  390. .status-error {
  391. background-color: #f56c6c;
  392. }
  393. .filter-btn {
  394. height: 40px;
  395. }
  396. .desc {
  397. overflow: hidden;
  398. text-overflow: ellipsis;
  399. display: -webkit-box;
  400. -webkit-line-clamp: 2;
  401. -webkit-box-orient: vertical;
  402. line-height: 1.5;
  403. max-height: 3em;
  404. }
  405. .more {
  406. margin-left: 10px;
  407. }
  408. </style>