RealtimeLog.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <el-container>
  3. <el-header height="220">
  4. <h3>实时日志</h3>
  5. </el-header>
  6. <el-main>
  7. </el-main>
  8. <!-- 修改视频可见范围对话框 -->
  9. <el-dialog
  10. append-to-body
  11. :visible.sync="showEditScopeDialog"
  12. width="30%"
  13. center
  14. >
  15. <el-card class="box-card">
  16. <div slot="header" class="clearfix">
  17. <span>修改视频可见范围</span>
  18. <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateScope">更新</el-button>
  19. </div>
  20. <div class="text item">
  21. <el-select v-model="form.scope" placeholder="选择可见范围">
  22. <el-option label="本人可见" value="1" />
  23. <el-option label="所有人可见" value="2" />
  24. <el-option label="VIP 可见" value="3" />
  25. </el-select>
  26. </div>
  27. </el-card>
  28. </el-dialog>
  29. <!-- 视频预览对话框 -->
  30. <el-dialog
  31. title="预览视频"
  32. append-to-body
  33. :visible.sync="showPreviewDialog"
  34. :before-close="handleDialogClose"
  35. width="70%"
  36. center
  37. >
  38. <template>
  39. <video-preview-player :video-prop.sync="videoProp" />
  40. </template>
  41. </el-dialog>
  42. </el-container>
  43. </template>
  44. <script>
  45. import VideoPreviewPlayer from 'components/VideoPreviewPlayer'
  46. import { updateVideoScope, videoInfo } from '@/api/vod'
  47. import { getVideoList } from '@/api/admin'
  48. export default {
  49. name: 'VideoPost',
  50. components: { VideoPreviewPlayer },
  51. data() {
  52. return {
  53. queryInfo: {
  54. scope: null,
  55. pn: 1
  56. },
  57. // 屏幕宽度, 为了控制分页条的大小
  58. screenWidth: document.body.clientWidth,
  59. currentPage: 1,
  60. pageSize: 10,
  61. totalSize: 0,
  62. dataList: [],
  63. nextId: 0,
  64. // **********************************************************************
  65. videoProp: null,
  66. showVideoResourceDialog: false,
  67. showEditScopeDialog: false,
  68. showPreviewDialog: false,
  69. form: {
  70. videoId: null,
  71. scope: 1
  72. },
  73. videoResources: [],
  74. publishVideoDiaglog: false
  75. }
  76. },
  77. created() {
  78. document.title = 'AdminVideoList'
  79. this.getData()
  80. },
  81. methods: {
  82. handleCurrentChange(pageNumber) {
  83. this.currentPage = pageNumber
  84. this.getData()
  85. // 回到顶部
  86. scrollTo(0, 0)
  87. },
  88. getData() {
  89. this.dataList = []
  90. getVideoList(0).then(resp => {
  91. if (resp.code === 0) {
  92. const respData = resp.data
  93. this.dataList = respData.list
  94. this.totalSize = respData.totalSize
  95. } else {
  96. this.$message.error(resp.msg)
  97. }
  98. })
  99. },
  100. onRefresh() {
  101. this.getData()
  102. },
  103. handleScope(index, row) {
  104. this.form.videoId = row.videoId
  105. this.form.scope = '' + row.scope
  106. this.showEditScopeDialog = true
  107. },
  108. handleDialogClose(done) {
  109. this.showPreviewDialog = false
  110. this.videoProp = {
  111. videoId: null,
  112. play: false
  113. }
  114. done()
  115. },
  116. handlePreview(index, row) {
  117. videoInfo(row.videoId).then(res => {
  118. if (res.code === 0) {
  119. this.showPreviewDialog = true
  120. this.videoProp = {
  121. videoId: res.data.videoId,
  122. play: true
  123. }
  124. }
  125. })
  126. },
  127. handleEdit(index, row) {
  128. const path = '/post/video/edit/' + row.videoId
  129. this.$router.push(path)
  130. },
  131. onUpdateScope() {
  132. this.showEditScopeDialog = false
  133. updateVideoScope(this.form).then(res => {
  134. if (res.code === 0) {
  135. this.$notify({
  136. title: '提示',
  137. message: '视频可见范围已更新',
  138. type: 'warning',
  139. duration: 3000
  140. })
  141. }
  142. }).catch(error => {
  143. this.$notify({
  144. title: '提示',
  145. message: error.message,
  146. type: 'warning',
  147. duration: 3000
  148. })
  149. })
  150. },
  151. onSelectChange() {
  152. this.$message.info(this.queryInfo)
  153. },
  154. handleClose() {
  155. }
  156. }
  157. }
  158. </script>
  159. <style>
  160. </style>