vodComment.vue 1.7 KB

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