index.vue 12 KB

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