index.vue 11 KB

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