AdminVideoList.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <el-container>
  3. <el-header height="220">
  4. <el-row style="margin-top: 10px">
  5. <el-select
  6. v-model="queryInfo.scope"
  7. clearable
  8. placeholder="查询条件"
  9. style="margin-left: 5px"
  10. @change="onSelectChange"
  11. />
  12. <el-button type="plain" icon="el-icon-refresh" style="margin-left: 5px" @click="onRefresh">刷新</el-button>
  13. </el-row>
  14. </el-header>
  15. <el-main>
  16. <el-table
  17. :data="dataList"
  18. border
  19. height="480"
  20. style="width: 100%"
  21. >
  22. <el-table-column
  23. fixed="left"
  24. label="No"
  25. type="index"
  26. />
  27. <el-table-column
  28. prop="pubDate"
  29. label="发布时间"
  30. width="150"
  31. />
  32. <el-table-column
  33. prop="coverUrl"
  34. label="封面"
  35. width="90"
  36. >
  37. <template slot-scope="scope">
  38. <el-image :src="scope.row.coverUrl" min-width="30" height="20" />
  39. </template>
  40. </el-table-column>
  41. <el-table-column
  42. prop="videoId"
  43. label="视频 ID"
  44. width="120"
  45. >
  46. <template slot-scope="scope">
  47. <router-link target="_blank" :to="`/vod/video/${scope.row.videoId}`">
  48. <span>{{ scope.row.videoId }}</span>
  49. </router-link>
  50. </template>
  51. </el-table-column>
  52. <el-table-column
  53. prop="title"
  54. label="标题"
  55. :show-overflow-tooltip="true"
  56. >
  57. <template slot-scope="scope">
  58. <el-tooltip
  59. v-if="scope.row.title"
  60. :content="scope.row.title"
  61. raw-content
  62. placement="top-start"
  63. >
  64. <span v-if="scope.row.title.length <= 15">
  65. {{ scope.row.title }}
  66. </span>
  67. <span v-else>
  68. {{ scope.row.title.substr(0, 15) + "..." }}
  69. </span>
  70. </el-tooltip>
  71. </template>
  72. </el-table-column>
  73. <el-table-column
  74. prop="description"
  75. label="描述"
  76. :show-overflow-tooltip="true"
  77. >
  78. <template slot-scope="scope">
  79. <el-tooltip
  80. v-if="scope.row.description"
  81. :content="scope.row.description"
  82. raw-content
  83. placement="top-start"
  84. >
  85. <span v-if="scope.row.description && scope.row.description.length <= 15">
  86. {{ scope.row.description }}
  87. </span>
  88. <span v-if="scope.row.description && scope.row.description.length > 15">
  89. {{ scope.row.description.substr(0, 15) + "..." }}
  90. </span>
  91. </el-tooltip>
  92. <span v-else-if="scope.row.description === null">-</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column
  96. prop="duration"
  97. label="时长"
  98. />
  99. <el-table-column
  100. prop="horizontal"
  101. label="方向"
  102. >
  103. <template slot-scope="scope">
  104. <el-tag v-if="scope.row.horizontal" :type="'warning'" disable-transitions>
  105. <span icon="el-icon-monitor">横屏</span>
  106. </el-tag>
  107. <el-tag v-else :type="'success'" disable-transitions>
  108. <span icon="el-icon-mobile-phone">竖屏</span>
  109. </el-tag>
  110. </template>
  111. </el-table-column>
  112. <el-table-column
  113. prop="scope"
  114. label="可见范围"
  115. width="120"
  116. >
  117. <template slot-scope="scope">
  118. <el-tag v-if="scope.row.scope === 1" :type="'warning'" disable-transitions>
  119. 本人可见
  120. </el-tag>
  121. <el-tag v-if="scope.row.scope === 2" :type="'success'" disable-transitions>
  122. 所有人可见
  123. </el-tag>
  124. <el-tag v-if="scope.row.scope === 3" :type="'danger'" disable-transitions>
  125. VIP 可见
  126. </el-tag>
  127. </template>
  128. </el-table-column>
  129. <el-table-column
  130. prop="scope"
  131. label="审核状态"
  132. width="120"
  133. >
  134. <template slot-scope="scope">
  135. <el-tag v-if="scope.row.status === 1" :type="'warning'" disable-transitions>
  136. 审核中
  137. </el-tag>
  138. <el-tag v-else-if="scope.row.status === 2" :type="'success'" disable-transitions>
  139. 审核通过
  140. </el-tag>
  141. <el-tag v-else-if="scope.row.status === 3" :type="'danger'" disable-transitions>
  142. 审核未通过
  143. </el-tag>
  144. <el-tag v-else-if="scope.row.status === 4" :type="'danger'" disable-transitions>
  145. 下架
  146. </el-tag>
  147. <el-tag v-else :type="'danger'" disable-transitions>
  148. 状态值: {{ scope.row.status }}
  149. </el-tag>
  150. </template>
  151. </el-table-column>
  152. <el-table-column
  153. prop="videoId"
  154. label="创作者"
  155. width="120"
  156. >
  157. <template slot-scope="scope">
  158. <router-link target="_blank" :to="`/vod/video/${scope.row.videoId}`">
  159. <span>{{ scope.row.videoId }}</span>
  160. </router-link>
  161. </template>
  162. </el-table-column>
  163. <el-table-column
  164. fixed="right"
  165. label="操作"
  166. width="280"
  167. >
  168. <template slot-scope="scope">
  169. <el-button
  170. size="mini"
  171. @click="handlePreview(scope.$index, scope.row)"
  172. >预览</el-button>
  173. <el-button
  174. size="mini"
  175. @click="handleEdit(scope.$index, scope.row)"
  176. >编辑</el-button>
  177. </template>
  178. </el-table-column>
  179. </el-table>
  180. <el-pagination
  181. background
  182. :small="screenWidth <= 768"
  183. layout="prev, pager, next"
  184. :page-size="pageSize"
  185. :current-page="currentPage"
  186. :total="totalSize"
  187. @current-change="handleCurrentChange"
  188. @prev-click="handleCurrentChange"
  189. @next-click="handleCurrentChange"
  190. />
  191. </el-main>
  192. <!-- 修改视频可见范围对话框 -->
  193. <el-dialog
  194. append-to-body
  195. :visible.sync="showEditScopeDialog"
  196. width="30%"
  197. center
  198. >
  199. <el-card class="box-card">
  200. <div slot="header" class="clearfix">
  201. <span>修改视频可见范围</span>
  202. <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateScope">更新</el-button>
  203. </div>
  204. <div class="text item">
  205. <el-select v-model="form.scope" placeholder="选择可见范围">
  206. <el-option label="本人可见" value="1" />
  207. <el-option label="所有人可见" value="2" />
  208. <el-option label="VIP 可见" value="3" />
  209. </el-select>
  210. </div>
  211. </el-card>
  212. </el-dialog>
  213. <!-- 视频预览对话框 -->
  214. <el-dialog
  215. title="预览视频"
  216. append-to-body
  217. :visible.sync="showPreviewDialog"
  218. :before-close="handleDialogClose"
  219. width="70%"
  220. center
  221. >
  222. <template>
  223. <video-preview-player :video-prop.sync="videoProp" />
  224. </template>
  225. </el-dialog>
  226. </el-container>
  227. </template>
  228. <script>
  229. import VideoPreviewPlayer from 'components/VideoPreviewPlayer'
  230. import { updateVideoScope, videoInfo } from '@/api/video'
  231. import { getVideoList } from '@/api/admin'
  232. export default {
  233. name: 'VideoPost',
  234. components: { VideoPreviewPlayer },
  235. data() {
  236. return {
  237. queryInfo: {
  238. scope: null,
  239. pn: 1
  240. },
  241. // 屏幕宽度, 为了控制分页条的大小
  242. screenWidth: document.body.clientWidth,
  243. currentPage: 1,
  244. pageSize: 12,
  245. totalSize: 0,
  246. dataList: [],
  247. nextId: 0,
  248. // **********************************************************************
  249. videoProp: null,
  250. showVideoResourceDialog: false,
  251. showEditScopeDialog: false,
  252. showPreviewDialog: false,
  253. form: {
  254. videoId: null,
  255. scope: 1
  256. },
  257. videoResources: [],
  258. publishVideoDiaglog: false
  259. }
  260. },
  261. created() {
  262. document.title = 'AdminVideoList'
  263. this.getData()
  264. },
  265. methods: {
  266. handleCurrentChange(pageNumber) {
  267. this.currentPage = pageNumber
  268. this.getData()
  269. // 回到顶部
  270. scrollTo(0, 0)
  271. },
  272. getData() {
  273. this.dataList = []
  274. getVideoList(0).then(resp => {
  275. if (resp.code === 0) {
  276. const respData = resp.data
  277. this.dataList = respData.list
  278. this.totalSize = respData.totalSize
  279. } else {
  280. this.$message.error(resp.msg)
  281. }
  282. })
  283. },
  284. onRefresh() {
  285. this.getData()
  286. },
  287. handleScope(index, row) {
  288. this.form.videoId = row.videoId
  289. this.form.scope = '' + row.scope
  290. this.showEditScopeDialog = true
  291. },
  292. handleDialogClose(done) {
  293. this.showPreviewDialog = false
  294. this.videoProp = {
  295. videoId: null,
  296. play: false
  297. }
  298. done()
  299. },
  300. handlePreview(index, row) {
  301. videoInfo(row.videoId).then(res => {
  302. if (res.code === 0) {
  303. this.showPreviewDialog = true
  304. this.videoProp = {
  305. videoId: res.data.videoId,
  306. play: true
  307. }
  308. }
  309. })
  310. },
  311. handleEdit(index, row) {
  312. const path = '/post/video/edit/' + row.videoId
  313. this.$router.push(path)
  314. },
  315. onUpdateScope() {
  316. this.showEditScopeDialog = false
  317. updateVideoScope(this.form).then(res => {
  318. if (res.code === 0) {
  319. this.$notify({
  320. title: '提示',
  321. message: '视频可见范围已更新',
  322. type: 'warning',
  323. duration: 3000
  324. })
  325. }
  326. }).catch(error => {
  327. this.$notify({
  328. title: '提示',
  329. message: error.message,
  330. type: 'warning',
  331. duration: 3000
  332. })
  333. })
  334. },
  335. onSelectChange() {
  336. this.$message.info(this.queryInfo)
  337. },
  338. handleClose() {
  339. }
  340. }
  341. }
  342. </script>
  343. <style>
  344. </style>