dever 5 年之前
父节点
当前提交
920ba54e6e
共有 4 个文件被更改,包括 59 次插入267 次删除
  1. 25 4
      pages/dream/view/audioComment.vue
  2. 0 256
      pages/dream/view/comment.vue
  3. 9 3
      pages/dream/view/liveComment.vue
  4. 25 4
      pages/dream/view/vodComment.vue

+ 25 - 4
pages/dream/view/audioComment.vue

@@ -6,18 +6,25 @@
 			:pic="item.pic" 
 			:control="true"
 			:loop="true"
-			:load.sync="load"
+			:load.sync="load"
+			@play="play"
 			ref="audio"
 			>
 			</dever-audio>
 		</view>
-		<comment :item="item" :type="`content/audio_comment`" :type_id="item.id"></comment>
+		<block v-if="item.type == 2">
+			<comment ref="comment" :item="item" :type="`content/video_comment`" :type_id="item.id"></comment>
+		</block>
+		<block v-if="item.type == 1">
+			<seat ref="seat" :item="item" :type="`content/video_comment`" :type_id="item.id" @start="start" @stop="stop"></seat>
+		</block>
 	</view>
 </template>
 
 <script>
 import deverAudio from '@/lib/dever/components/audio.nvue';
-import comment from "@/pages/dream/view/comment.vue";
+import comment from "@/lib/dever/components/comment.vue";
+import seat from '@/lib/dever/components/seat.vue';
 export default {
 	name: "audioComment",
 	props: {
@@ -46,9 +53,23 @@ export default {
 		stop : function() {
 			this.$refs.audio.stop();
 		},
+		play : function(state, time) {
+			if (this.item.type == 1) {
+				var method = 'seat';
+			} else {
+				var method = 'comment';
+			}
+			if (state == 'start') {
+				this.$refs[method].start();
+			} else if (state == 'stop') {
+				this.$refs[method].stop();
+			} else if (state == 'time' && time) {
+				this.$refs[method].time(time);
+			}
+		},
 	},
 	components:{
-		deverAudio,comment
+		deverAudio,comment,seat
 	}
 }
 </script>

+ 0 - 256
pages/dream/view/comment.vue

@@ -1,256 +0,0 @@
-<template name="comment">
-	<view>
-		<view class="msgs-tabs">
-		  <view class="tit">{{item.name}}</view>
-		  <view class="num" style="display: none;">全部({{fetch.total}})</view>
-		</view>
-		<view class="living grace-body">
-			<view class="rich-wrapper">
-				<dever-content :item="item.content_array" :pics="item.content_pic"></dever-content>
-			</view>
-			<view class="message" @touchstart="stop">
-				<y-Barrage ref="barrage" @end="reload" :minTime="minTime" :maxTime="maxTime"></y-Barrage>
-			</view>
-		</view>
-		<y-Fab :bottom="20" :right="140" @click="showModal" bgColor="#0fa5e5" text="发布"></y-Fab>
-		<view v-if="show">
-			<publish :title="title" :is_upload="false" @hideModal="hideModal" @getRefresh="getRefresh" :type="type" :type_id="type_id" :api="api"></publish>
-		</view>
-	</view>
-</template>
-
-<script>
-import publish from '@/lib/dever/components/publish.vue';
-import deverContent from '@/lib/dever/components/content.vue';
-export default {
-	name: "comment",
-	props: {
-		type : {
-			type : String,
-			value : null
-		},
-		type_id : {
-			type : String,
-			value : null
-		},
-		item : {
-			type    : Object,
-			value	: null
-		},
-		index : 0
-	},
-	data() {
-		return {
-			api : 'app/community/?l=api.addComment',
-			title : '发表新评论',
-			minTime : 5,
-			maxTime : 10,
-			show : false,
-			fetch : {
-				info : [],
-			},
-			page : 1,
-			load : true,
-			info : [],
-			seconds : 0,
-		}
-	},
-	mounted() {
-		this.page = 1;
-		this.getData();
-	},
-	methods:{
-		getData : function() {
-			var self = this;
-			if (!self.load) {
-				self.$refs.barrage.start(self.info);
-				return;
-			}
-			this.Dever.get(this, 'app/community/?l=api.comment', {code:this.Dever.config.code,noloading:1,page:this.page,type:this.type,type_id:this.type_id,noconcat:1}, function(t) {
-				if (t && t.info && t.info.length > 0) {
-					self.info = self.info.concat(t.info);
-					if (self.page == 1) {
-						self.$refs.barrage.start(t.info);
-					} else {
-						for (var i in t.info) {
-							self.$refs.barrage.add(t.info[i]);
-						}
-					}
-					self.page++;
-				} else {
-					self.load = false;
-					self.reload();
-				}
-			}, function(e) {
-				self.load = false;
-				self.reload();
-			});
-		},
-		reload : function() {
-			this.getData();
-		},
-		stop : function() {
-			//this.$refs.barrage.stop();
-		},
-		showModal : function() {
-			this.show = true;
-		},
-		hideModal : function() {
-			this.show = false;
-		},
-		getRefresh : function(cate_id, type, type_id, content) {
-			var item = {};
-			item.content = content;
-			this.info.push(item);
-			this.$refs.barrage.add(item);
-			this.hideModal();
-		}
-	},
-	components:{
-		publish,deverContent
-	}
-}
-</script>
-
-<style>
-.rich-wrapper .p{
-  padding: 0;
-}
-.rich-wrapper image{
-  width: 100% !important;
-}
-.rich-wrapper .wxParse-p{
-  font-size: 30rpx;
-}
-.msgs-tabs{
-  line-height: 88rpx;
-  display: flex;
-  height: 88rpx;
-  justify-content: space-between;
-  box-sizing: border-box;
-  padding: 0 30rpx;
-  border-bottom: 1rpx solid #ccc;
-}
-.msgs-tabs .tit{
-  font-size: 30rpx;
-  color: #000;
-  display: flex;
-  align-items: center;
-  overflow: hidden;
-}
-.msgs-tabs .tit:before{
-  content: '';
-  display: inline-block;
-  width: 6rpx;
-  height: 30rpx;
-  margin-right: 10rpx;
-  background-color: #000;
-}
-.msgs-tabs .num{
-  font-size: 22rpx;
-  color: #999;
-  overflow: hidden;
-}
-
-.living{
-  margin-bottom:50rpx;
-}
-.living-tabs{
-  display: flex;
-  justify-content: center;
-  margin-bottom: 36rpx;
-}
-.living-tabs>view{
-  font-size: 30rpx;
-  line-height: 52rpx;
-  margin: 0 26rpx;
-}
-.living-tabs>view.cur{
-  border-bottom: 6rpx solid #000;
-}
-.living .message{
-  height:320rpx;
-  padding:15rpx 0 110rpx;
-  border-bottom: solid 2rpx #f0f0f0;
-}
-.living .message .item{
-  padding:20rpx 35rpx 0;
-  display: flex;
-}
-.living .message .user{
-  float:left;
-}
-.living .message .user image{
-  display: block;
-  width:51rpx;
-  height:51rpx;
-  border-radius: 50%;
-}
-.living .message .info{
-  position: relative;
-  margin-left:70rpx;
-  overflow: visible;
-}
-.living .message .username{
-  font-size: 28rpx;
-  margin-bottom: 13rpx;
-}
-.living .message .txt{
-  position: relative;
-  float:left;
-  background: #eeeeee;
-  max-width:400rpx;
-  border-radius: 15rpx;
-  padding: 9rpx 18rpx;
-  font-size: 26rpx;
-  line-height: 1.8;
-  color: #666666;
-  overflow: visible;
-}
-.living .message .txt:before{
-  display: block;
-  position: absolute;
-  top:0;
-  left:-14rpx;
-  width:0;
-  height:0;
-  border: solid 14rpx transparent;
-  border-top: solid 12rpx #eee;
-  content:'';
-}
-.living{
-  margin-bottom: 0;
-}
-.living .message{
-  padding:0;
-  border-bottom: 0;
-}
-.living .message{
-  position: absolute;
-  bottom: 120rpx;
-  top: 544rpx;
-  left: 0;
-  width: 100%;
-  height: auto;
-}
-.mask .layer{
-  padding:40rpx 30rpx;
-}
-.mask textarea{
-  margin-bottom: 25rpx;
-  box-sizing: border-box;
-  padding:10rpx;
-  border:solid 2rpx #999999;
-  border-radius: 10rpx;
-  width:500rpx;
-  font-size: 24rpx;
-}
-.mask .button{
-  width:300rpx;
-}
-.share{
-  position: fixed;
-  bottom:20rpx;
-  left:225rpx;
-}
-</style>

+ 9 - 3
pages/dream/view/liveComment.vue

@@ -12,13 +12,19 @@
 			>
 			</dever-video>
 		</view>
-		<comment :item="item" :type="`content/live_comment`" :type_id="item.id"></comment>
+		<block v-if="item.type == 2">
+			<comment ref="comment" :item="item" :type="`content/video_comment`" :type_id="item.id"></comment>
+		</block>
+		<block v-if="item.type == 1">
+			<seat ref="seat" :item="item" :type="`content/video_comment`" :type_id="item.id" @start="start" @stop="stop"></seat>
+		</block>
 	</view>
 </template>
 
 <script>
 import deverVideo from '@/lib/dever/components/video.nvue';
-import comment from "@/pages/dream/view/comment.vue";
+import comment from "@/lib/dever/components/comment.vue";
+import seat from '@/lib/dever/components/seat.vue';
 export default {
 	name: "liveComment",
 	props: {
@@ -49,7 +55,7 @@ export default {
 		},
 	},
 	components:{
-		deverVideo,comment
+		deverVideo,comment,seat
 	}
 }
 </script>

+ 25 - 4
pages/dream/view/vodComment.vue

@@ -7,18 +7,25 @@
 			:control="true"
 			:index="0" 
 			:vid="item.id" 
-			:load.sync="load"
+			:load.sync="load"
+			@play="play"
 			ref="video"
 			>
 			</dever-video>
 		</view>
-		<comment :item="item" :type="`content/video_comment`" :type_id="item.id"></comment>
+		<block v-if="item.type == 2">
+			<comment ref="comment" :item="item" :type="`content/video_comment`" :type_id="item.id"></comment>
+		</block>
+		<block v-if="item.type == 1">
+			<seat ref="seat" :item="item" :type="`content/video_comment`" :type_id="item.id" @start="start" @stop="stop"></seat>
+		</block>
 	</view>
 </template>
 
 <script>
 import deverVideo from '@/lib/dever/components/video.nvue';
-import comment from "@/pages/dream/view/comment.vue";
+import comment from "@/lib/dever/components/comment.vue";
+import seat from '@/lib/dever/components/seat.vue';
 export default {
 	name: "vodComment",
 	props: {
@@ -47,9 +54,23 @@ export default {
 		stop : function() {
 			this.$refs.video.stop(true);
 		},
+		play : function(state, time) {
+			if (this.item.type == 1) {
+				var method = 'seat';
+			} else {
+				var method = 'comment';
+			}
+			if (state == 'start') {
+				this.$refs[method].start();
+			} else if (state == 'stop') {
+				this.$refs[method].stop();
+			} else if (state == 'time' && time) {
+				this.$refs[method].time(time);
+			}
+		},
 	},
 	components:{
-		deverVideo,comment
+		deverVideo,comment,seat
 	}
 }
 </script>