dever 5 years ago
parent
commit
71fc6f5dae

+ 1 - 4
App.vue

@@ -26,10 +26,7 @@ export default {
 @import './lib/graceUI/graceWeex.css';
 /* #endif */
 @import './lib/dever/dever.css';
-page{background-color: #ECEEF7;}
-.grace-icons {
-	font-family: graceIconfont; 
-}
+page{background-color: #ECEEF7;}
 .grace-body {
 	width:100%;
 }

+ 2 - 2
lib/community/y-Barrage/y-Barrage.vue

@@ -88,9 +88,9 @@
 						clearInterval(cycle);
 						setTimeout(() => {
 							this.$emit("end", {});
-						}, time * 100)
+						}, time * 500)
 					}
-				}, 1000)
+				}, 500)
 			},
 			stop() {
 				//cycle && (clearInterval(cycle));

+ 3 - 1
pages/dream/view.vue

@@ -140,7 +140,9 @@ export default{
 		initDrawer : function() {
 			var i = '';
 			for (i in this.drawer.item) {
-				this.drawer.item[i].button.key = i;
+				this.drawer.item[i].button.key = i;
+				this.drawer.item[i].param.type = 3;
+				this.drawer.item[i].param.type_id = this.content_id;
 				this.drawer.button.push(this.drawer.item[i].button);
 			}
 		},

+ 1 - 1
pages/dream/view/audioComment.vue

@@ -11,7 +11,7 @@
 			>
 			</dever-audio>
 		</view>
-		<comment :name="item.name" :type="`content/audio_comment`" :type_id="item.id"></comment>
+		<comment :item="item" :type="`content/audio_comment`" :type_id="item.id"></comment>
 	</view>
 </template>
 

+ 65 - 150
pages/dream/view/comment.vue

@@ -1,26 +1,27 @@
 <template name="comment">
 	<view>
 		<view class="msgs-tabs">
-		  <view class="tit">{{name}}</view>
-		  <view class="num">全部评论(100)</view>
+		  <view class="tit">{{item.name}}</view>
+		  <view class="num" style="display: none;">全部({{fetch.total}})</view>
 		</view>
-		<view class="living">
+		<view class="living grace-body">
 			<view class="rich-wrapper">
-				<rich-text :nodes="content"></rich-text>
+				<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 class="send clearfix">
-				<input type="text" bindinput="comment" value="" />
-				<view class="button primary" bindtap="pushComment">发布</view>
 			</view>
+		</view>
+		<y-Fab :bottom="20" :right="140" @click="showModal" bgColor="#0fa5e5" text="发布"></y-Fab>
+		<view v-if="show">
+			<communityPush :title="title" :is_upload="false" @hideModal="hideModal" @getRefresh="getRefresh" :type="type" :type_id="type_id" :api="api"></communityPush>
 		</view>
 	</view>
 </template>
 
-<script>
+<script>
+import communityPush from "@/pages/dream/view/communityPush";
+import deverContent from '@/lib/dever/components/content.vue';
 export default {
 	name: "comment",
 	props: {
@@ -32,44 +33,56 @@ export default {
 			type : String,
 			value : null
 		},
-		name : {
-			type    : String,
+		item : {
+			type    : Object,
 			value	: null
-		},
-		content : {
-			type    : String,
-			value	: null
 		},
 	},
 	data() {
 		return {
+			api : 'app/community/?l=api.addComment',
+			title : '发表新评论',
 			minTime : 5,
-			maxTime : 10,
-			comments: [
-				{
-					id : 1,
-					avatar : 'https://pic.rmb.bdstatic.com/b9279adf974b78d27201a0b34970c2a9.jpeg',
-					username : 'rabin',
-					content : 'dfdfdfdf',
-				},
-				{
-					id : 2,
-					avatar : 'https://pic.rmb.bdstatic.com/b9279adf974b78d27201a0b34970c2a9.jpeg',
-					username : 'test',
-					content : '哈哈哈哈或',
-				}
-			],
-			loading: false
+			maxTime : 10,
+			show : false,
+			fetch : {
+				info : [],
+			},
+			page : 1,
+			load : true,
+			info : [],
+			seconds : 0,
 		}
 	},
-	mounted() {
+	mounted() {
+		this.page = 1;
 		this.getData();
 	},
 	methods:{
 		getData : function() {
 			var self = this;
-			this.Dever.get(this, 'app/community/?l=api.comment', {id:this.id,noloading:1}, function(t) {
-				self.$refs.barrage.start(t.info);
+			if (!self.load) {
+				self.$refs.barrage.start(self.info);
+				return;
+			}
+			this.Dever.get(this, 'app/community/?l=api.comment', {id:this.id,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() {
@@ -77,8 +90,24 @@ export default {
 		},
 		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:{
+		communityPush,deverContent
+	}
 }
 </script>
 
@@ -138,30 +167,6 @@ export default {
 .living-tabs>view.cur{
   border-bottom: 6rpx solid #000;
 }
-.living .send{
-  border-bottom: solid 2rpx #f0f0f0;
-  padding:0 30rpx 40rpx;
-}
-.living .send input{
-  float:left;
-  box-sizing: border-box;
-  width:540rpx;
-  height:60rpx;
-  border:solid 2rpx #999999;
-  border-radius: 10rpx;
-  padding:0 10rpx;
-  line-height: 60rpx;
-  font-size: 30rpx;
-}
-.living .send .button{
-  float:right;
-  box-sizing: border-box;
-  padding:0;
-  width:130rpx;
-  min-width: 0;
-  height:60rpx;
-  line-height: 60rpx;
-}
 .living .message{
   height:320rpx;
   padding:15rpx 0 110rpx;
@@ -227,54 +232,6 @@ export default {
   width: 100%;
   height: auto;
 }
-
-.console{
-  position: fixed;
-  bottom:0;
-  left:0;
-  width:750rpx;
-  height:98rpx;
-  padding-top:20rpx;
-  z-index: 5;
-}
-.console .comment{
-  position: absolute;
-  top:10rpx;
-  left:85rpx;
-  background:url(http://www.huoxingkandiqiu.com/files/img/ico-comment.png) no-repeat;
-  background-size: 98rpx 98rpx;
-  width:98rpx;
-  height:98rpx;
-}
-.console .thumbup{
-  position: absolute;
-  top:10rpx;
-  right:85rpx;
-}
-.console .num{
-  background: #fff;
-  position: absolute;
-  top:40rpx;
-  right:0;
-  width:100rpx;
-  height: 40rpx;
-  line-height: 40rpx;
-  color: #000;
-  font-size: 24rpx;
-  text-align: center;
-}
-.console .unlike{
-  background:url(http://www.huoxingkandiqiu.com/files/img/ico-unlike.png) no-repeat;
-  background-size: 98rpx 98rpx;
-  width:98rpx;
-  height:98rpx;
-}
-.console .like{
-  background:url(http://www.huoxingkandiqiu.com/files/img/ico-like.png) no-repeat;
-  background-size: 98rpx 98rpx;
-  width:98rpx;
-  height:98rpx;
-}
 .mask .layer{
   padding:40rpx 30rpx;
 }
@@ -295,46 +252,4 @@ export default {
   bottom:20rpx;
   left:225rpx;
 }
-
-.console .edit{
-  background:url(http://www.huoxingkandiqiu.com/files/img/edit.png) no-repeat;
-  background-size: 80rpx 80rpx;
-  width:80rpx;
-  height:80rpx;
-  position: absolute;
-  left: 135rpx;
-  bottom: 30rpx;
-}
-.console .edit.left30{
-  left: 30rpx;
-}
-.button {
-  height: 80rpx;
-  border: 1rpx solid #cc1619;
-  color: #cc1619;
-  font-size: 30rpx;
-  min-width: 300rpx;
-  border-radius: 40rpx;
-  text-align: center;
-  line-height: 80rpx;
-  display: block;
-  position: relative;
-}
-.button>button{
-  position: absolute;
-  width: 100%;
-  height: 100%;
-  left: 0;
-  top: 0;
-  opacity: 0;
-}
-
-.button.big {
-  width: 420rpx;
-}
-
-.button.primary {
-  background-color: #000;
-  color: #fff;
-}
 </style>

+ 1 - 1
pages/dream/view/community.vue

@@ -71,7 +71,7 @@ export default {
 		this.getData();
 	},
 	methods:{
-		getRefresh : function(cate_id, type, type_id) {
+		getRefresh : function(cate_id, type, type_id, content) {
 			this.getInfo(cate_id, 1);
 		},
 		getData : function() {

+ 15 - 6
pages/dream/view/communityPush.vue

@@ -53,6 +53,11 @@
 			to_uid : 0,
 			index : 0,
 			is_upload : true,
+			seconds : 0,
+			api : {
+				type : String,
+				default : 'app/community/?l=api.add'
+			},
 		},
 		data() {
 			return {
@@ -77,14 +82,18 @@
 				if (this.pic.length > 0) {
 					data.pic = this.pic.join(',');
 				}
-				
-				data.cate_id = this.cate_id;
+				if (this.cate_id) {
+					data.cate_id = this.cate_id;
+				}
+				if (this.seconds) {
+					data.seconds = this.seconds;
+				}
 				data.type = this.type;
 				data.type_id = this.type_id;
 				data.to_id = this.to_id;
 				data.to_uid = this.to_uid;
-				this.Dever.post('app/community/?l=api.add', data, function(t) {
-					self.getRefresh();
+				this.Dever.post(this.api, data, function(t) {
+					self.getRefresh(data.content);
 				});
 			},
 			// 选择图片
@@ -104,8 +113,8 @@
 				this.$emit('hideModal');
 			},
 			
-			getRefresh : function() {
-				this.$emit('getRefresh', this.cate_id, this.type, this.type_id);
+			getRefresh : function(content) {
+				this.$emit('getRefresh', this.cate_id, this.type, this.type_id, content);
 			}
 		}
 	}

+ 1 - 1
pages/dream/view/liveComment.vue

@@ -12,7 +12,7 @@
 			>
 			</dever-video>
 		</view>
-		<comment :name="item.name" :type="`content/live_comment`" :type_id="item.id"></comment>
+		<comment :item="item" :type="`content/live_comment`" :type_id="item.id"></comment>
 	</view>
 </template>
 

+ 2 - 1
pages/dream/view/product.vue

@@ -89,7 +89,8 @@
 					</view>
 				</form>
 			</graceBottomDialog>
-			<y-Fab :bottom="20" :right="140" v-if="!attrIsShow" @click="buyNow" bgColor="#e55d52" text="买"></y-Fab>
+			<y-Fab :bottom="20" :right="140" v-if="!attrIsShow" @click="buyNow" bgColor="#e55d52" text="购买"></y-Fab>
+			<y-Fab :bottom="20" :right="240" v-if="!attrIsShow" @click="buyNow" bgColor="#e55d52" text="评价"></y-Fab>
 		</view>
 		<!-- 底部 -->
 		

+ 1 - 1
pages/dream/view/vodComment.vue

@@ -12,7 +12,7 @@
 			>
 			</dever-video>
 		</view>
-		<comment :name="item.name" :type="`content/video_comment`" :type_id="item.id"></comment>
+		<comment :item="item" :type="`content/video_comment`" :type_id="item.id"></comment>
 	</view>
 </template>