vodComment.vue 1.9 KB

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