viewVideo.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div id="viewVideo">
  3. <detail-frame :title="mainTitle" returns="/trainVidoe/index">
  4. <el-col :span="24" class="top">
  5. <span>课程权属:{{ videoInfo.teacher || '中心提供' }}</span>
  6. <span>所讲课程:{{ videoInfo.subname }}</span>
  7. <el-link :underline="false" @click="toDownload">点击下载</el-link>
  8. </el-col>
  9. <el-col :span="24" class="info">
  10. <video :src="videoInfo.url" controls="controls">
  11. 您的浏览器不支持 video 标签。
  12. </video>
  13. </el-col>
  14. <el-col :span="24" class="foot" style="display:none">
  15. <el-input v-model="evaluate" type="textarea" maxlength="300" show-word-limit :autosize="{ minRows: 4, maxRows: 5 }" placeholder="请输入评价"></el-input>
  16. <el-button type="primary" size="mini" @click="onSubmit">提交评价</el-button>
  17. </el-col>
  18. </detail-frame>
  19. </div>
  20. </template>
  21. <script>
  22. import detailFrame from '@frame/layout/admin/detail-frame';
  23. import { mapState, createNamespacedHelpers } from 'vuex';
  24. const { mapActions: trainvideo } = createNamespacedHelpers('trainvideo');
  25. export default {
  26. name: 'viewVideo',
  27. props: {},
  28. components: { detailFrame },
  29. data: function() {
  30. return {
  31. videoInfo: {},
  32. evaluate: '',
  33. };
  34. },
  35. created() {},
  36. methods: {
  37. ...trainvideo(['fetch', 'create', 'update']),
  38. async search() {
  39. let res = await this.fetch(this.id);
  40. if (this.$checkRes(res)) {
  41. this.$set(this, `videoInfo`, res.data);
  42. }
  43. },
  44. toDownload() {
  45. let duplicate = _.cloneDeep(this.videoInfo);
  46. const { url } = duplicate;
  47. if (url) window.open(url);
  48. },
  49. // 提交评价
  50. onSubmit() {
  51. console.log(this.evaluate);
  52. },
  53. },
  54. computed: {
  55. ...mapState(['user']),
  56. id() {
  57. return this.$route.query.id;
  58. },
  59. isNew() {
  60. return this.$route.query.id ? false : true;
  61. },
  62. mainTitle() {
  63. let meta = this.$route.meta;
  64. let main = meta.title || '';
  65. let sub = meta.sub || '';
  66. return `${main}${sub}`;
  67. },
  68. keyWord() {
  69. let meta = this.$route.meta;
  70. let main = meta.title || '';
  71. return main;
  72. },
  73. },
  74. watch: {
  75. isNew: {
  76. immediate: true,
  77. handler(val) {
  78. if (val) this.loading = false;
  79. else this.search();
  80. },
  81. },
  82. },
  83. };
  84. </script>
  85. <style lang="less" scoped>
  86. .top {
  87. height: 50px;
  88. text-align: center;
  89. line-height: 50px;
  90. span {
  91. display: inline-block;
  92. margin: 0 10px;
  93. font-size: 30px;
  94. -webkit-text-stroke: 1px #76bdfe;
  95. font-family: cursive;
  96. }
  97. }
  98. .info {
  99. text-align: center;
  100. margin: 15px 0;
  101. video {
  102. width: 50%;
  103. }
  104. }
  105. .foot {
  106. padding: 0 20%;
  107. text-align: center;
  108. .el-button {
  109. margin: 15px 0;
  110. }
  111. }
  112. </style>