vodComment.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. if (this.item.type == 2) {
  53. this.disabled = false;
  54. } else {
  55. this.disabled = true;
  56. }
  57. },
  58. methods:{
  59. start : function() {
  60. this.$refs.video.start();
  61. },
  62. stop : function() {
  63. this.$refs.video.stop(true);
  64. },
  65. setDisabled : function(value) {
  66. this.disabled = value;
  67. },
  68. play : function(state, time) {
  69. if (this.item.type == 1) {
  70. var method = 'seat';
  71. } else {
  72. var method = 'comment';
  73. }
  74. if (state == 'start') {
  75. this.$refs[method].start();
  76. } else if (state == 'stop') {
  77. this.$refs[method].stop();
  78. } else if (state == 'time' && time) {
  79. this.$refs[method].time(time);
  80. }
  81. },
  82. },
  83. components:{
  84. deverVideo,deverComment,deverSeat
  85. }
  86. }
  87. </script>
  88. <style>
  89. .banner{
  90. position: relative;
  91. width: 750rpx;
  92. height: 422rpx;
  93. display: block;
  94. }
  95. </style>