东西湖大屏
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.9 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="video-box">
  3. <video v-if="srcList[0].endsWith('.mp4')" width="100%" height="100%" controls loop autoplay muted :poster="poster">
  4. <source :src="srcList[0]" type="video/mp4">
  5. </video>
  6. <el-carousel v-if="!srcList[0].endsWith('.mp4')" interval="6000">
  7. <el-carousel-item v-for="src in srcList" :key="src">
  8. <img width="100%" height="100%" :src="src">
  9. </el-carousel-item>
  10. </el-carousel>
  11. </div>
  12. </template>
  13. <script>
  14. import { FetchShowFileList } from '@/api/library'
  15. export default {
  16. name: 'Video',
  17. components: {
  18. },
  19. data() {
  20. return {
  21. poster: 'https://qiniu.aiyxlib.com/1658104787005.jpg',
  22. srcList: ['']
  23. }
  24. },
  25. created() {
  26. this.getShowFile()
  27. },
  28. mounted() {
  29. },
  30. methods: {
  31. getShowFile() {
  32. const params = {
  33. libcode: '1201'
  34. }
  35. // this.src = 'D://uploadFile/9f904de6-0f5e-498e-8e5d-b7e14ea15496.mp4'.replace('D://', 'http://127.0.0.1:8888/')
  36. FetchShowFileList(params).then(res => {
  37. if (res.errCode === 0) {
  38. // this.src = res.data[0].filePath.replace('D://', 'http://172.16.0.23:8888/')
  39. this.srcList = res.data.map(x => x.filePath.replace('D://', 'http://172.16.0.23:8888/'))
  40. // this.srcList = res.data.map(x => x.filePath.replace('D://uploadFile', 'http://localhost:8080/static/'))
  41. // console.log(22222, this.srcList)
  42. // this.src = 'D://uploadFile/11503339-b829-4357-8379-d2b49106431f.mp4'.replace('D://', 'http://127.0.0.1:8888/')
  43. // this.src = 'http://127.0.0.1:8888/uploadFile/9f904de6-0f5e-498e-8e5d-b7e14ea15496.mp4'
  44. } else {
  45. this.$message.error('接口错误')
  46. }
  47. })
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss">
  53. @import "~@/assets/styles/index.scss";
  54. .el-carousel__container {
  55. position: relative;
  56. height: 100%;
  57. }
  58. .el-carousel.el-carousel--horizontal {
  59. height: 100%;
  60. }
  61. </style>