vodComment.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template name="vodComment">
  2. <view>
  3. <view class="banner">
  4. <dever-video
  5. :src="item.video"
  6. :pic="item.pic"
  7. :control="true"
  8. :index="0"
  9. :vid="item.id"
  10. :load.sync="load"
  11. :disabled="disabled"
  12. @play="play"
  13. ref="video"
  14. >
  15. </dever-video>
  16. </view>
  17. <block v-if="item.type == 2">
  18. <dever-comment ref="comment" :item="item" :type="`content/video_comment`" :type_id="item.id"></dever-comment>
  19. </block>
  20. <block v-if="item.type == 1">
  21. <dever-seat ref="seat" :item="item" :index="index" :type="`content/video_comment`" :type_id="item.id" @start="start" @stop="stop" @setDisabled="setDisabled"></dever-seat>
  22. </block>
  23. </view>
  24. </template>
  25. <script>
  26. import deverVideo from '@/lib/dever/components/video.nvue';
  27. import deverComment from "@/lib/dever/components/comment.vue";
  28. import deverSeat from '@/lib/dever/components/seat.vue';
  29. export default {
  30. name: "vodComment",
  31. props: {
  32. control : {
  33. type : Object,
  34. value : null
  35. },
  36. item : {
  37. type : Object,
  38. value : null
  39. },
  40. index : 0
  41. },
  42. data() {
  43. return {
  44. load : false,
  45. //默认不能播放
  46. disabled : true,
  47. }
  48. },
  49. mounted() {
  50. this.control[this.index] = this;
  51. },
  52. methods:{
  53. start : function() {
  54. this.$refs.video.start();
  55. },
  56. stop : function() {
  57. this.$refs.video.stop(true);
  58. },
  59. setDisabled : function(value) {
  60. this.disabled = value;
  61. },
  62. play : function(state, time) {
  63. if (this.item.type == 1) {
  64. var method = 'seat';
  65. } else {
  66. var method = 'comment';
  67. }
  68. if (state == 'start') {
  69. this.$refs[method].start();
  70. } else if (state == 'stop') {
  71. this.$refs[method].stop();
  72. } else if (state == 'time' && time) {
  73. this.$refs[method].time(time);
  74. }
  75. },
  76. },
  77. components:{
  78. deverVideo,deverComment,deverSeat
  79. }
  80. }
  81. </script>
  82. <style>
  83. .banner{
  84. position: relative;
  85. width: 750rpx;
  86. height: 422rpx;
  87. display: block;
  88. }
  89. </style>