瀏覽代碼

feature: jhlive

able99 4 年之前
父節點
當前提交
0f6796c9e0
共有 3 個文件被更改,包括 50 次插入63 次删除
  1. 40 7
      jhlive/jhlive.nvue
  2. 0 52
      jhlive/live-app.vue
  3. 10 4
      pagesGood/liveDetail.nvue

+ 40 - 7
jhlive/jhlive.nvue

@@ -24,27 +24,27 @@
 			</view>
 		</view>
 
-		<!-- <view class="bottom-right-box">
+		<view class="bottom-right-box">
 		  <view class="bottom-right-box-btn" @click="btnLike">
 			<text class="bottom-right-box-btn-text">点赞</text>
 		  </view>
 		</view> -->
 		<!-- 留言 -->
-	    <!-- <view class="jhim-message-box">
-	      <view class="jhim-message" v-for="(item, index) in msgs.slice(0,5)" :key="index">
+	    <view class="jhim-message-box">
+	      <view class="jhim-message" v-for="(item, index) in imMsgs.slice(0,5)" :key="index">
 	        <image class="jhim-message-avatar" :src="item.avatar" />
 	        <text class="jhim-message-text" >{{item.name}}:{{item.text}}</text>
 	      </view>
 	    </view>
-	    <view v-if="ready" class="jhim-input-box">
+	    <view v-if="!imStatus" class="jhim-input-box">
 	      <input 
 	        class="jhim-input"
 	        placeholder="说点什么..." 
 	        placeholder-style="color:#fff" 
-	        v-model="input"
-	        confirm-type="send" @confirm="btnImSend" />
+	        v-model="imInput"
+	        confirm-type="send" @confirm="$emit('onImSend', imInput)" />
 	    </view>
-	    <view v-else class="jhim-logining"><text class="jhim-logining-text">登录中...</text></view> -->
+	    <view v-else class="jhim-logining"><text class="jhim-logining-text">{{imStatus}}</text></view>
 	</view>
 </template>
 
@@ -93,6 +93,18 @@
 				default: false,
 				type: Array
 			}, // 按钮数组
+			imMsgs:{
+				default: [],
+				type: Array
+			},
+			imInput:{
+				default: '',
+				type: String
+			},
+			imStatus:{
+				default: '',
+				type: Boolean
+			}
 		},
 		onLoad() {
 			this.init();
@@ -304,4 +316,25 @@
 	.bottom-right-box-btn-text {
 		color: white;
 	}
+	
+	.jhim-message-box {
+	  background-color:rgba(0, 0, 0, 0.4);
+	  border-radius: 1000px;
+	  padding: 5;
+	}
+	.jhim-message {
+	  display: flex;
+	  flex-direction: row;
+	  align-items: center;
+	  margin-bottom: 5px;
+	}
+	.jhim-message-avatar {
+	  width: 28rpx;
+	  height: 28rpx;
+	  margin-left: 5px;
+	}
+	.jhim-message-text {
+	  color: #fff;
+	  font-size: 24rpx;
+	}
 </style>

+ 0 - 52
jhlive/live-app.vue

@@ -1,52 +0,0 @@
-<template>
-	<JhliveApp 
-    class="container"
-    ref="jhliveApp"
-    :sdkAppID="sdkAppID"
-    :userSig="userSig"
-    :userid="userid" 
-    :roomid="roomid" 
-    :isAuthor="isAuthor"
-    :linkMic="linkMic" />
-</template>
-
-<script>
-
-export default {
-	data() {
-		return {
-			
-		};
-	},
-	props: {
-		props: {
-      sdkAppID: Number,
-      userSig: String,
-      userid: String,
-      roomid: String, 
-      isAuthor: Boolean,
-      linkMic: Boolean
-    },
-	},
-	mounted: function() {
-
-	},
-	destroyed: function() {
-		
-	},
-	methods: {
-		enterRoom: function() {
-			this.$refs.jhliveApp.enterRoom();
-		},
-		exitRoom: function() {
-			this.$refs.jhliveApp.exitRoom();
-		}
-	}
-};
-</script>
-
-<style scoped>
-.container {
-  flex: 1;
-}
-</style>

+ 10 - 4
pagesGood/liveDetail.nvue

@@ -1,9 +1,11 @@
 <template>
 	<view class="container" :style="'height: '+windowHeight+'px;'">
-		<jhlive ref="jhlive" class="jhlive" :sdkAppID="sdkAppID" :secretKey="secretKey" :userId="userId" :roomId="roomId"
-		 :isAuthor="isAuthor" :linkMic="linkMic" :avatar="avatar" :subtitle="num" :likes="likes" :title="name" />
-		<jhimlive ref="jhimlive" class="jhimlive" :sdkAppID="sdkAppID" :secretKey="secretKey" :userId="userId" :roomId="roomId"
-		 :isAuthor="isAuthor" :avatar="avatar" :name="name" @onMemberCount="num=$event" />
+		<jhlive 
+			ref="jhlive" class="jhlive" 
+			:sdkAppID="sdkAppID" :secretKey="secretKey" :userId="userId" :roomId="roomId"
+		    :isAuthor="isAuthor" :linkMic="linkMic" 
+			:avatar="avatar" :subtitle="num" :title="name" 
+			:imMsgs="imMsgs" @onImSend="onImSend" />
 		<view class="popup-open" @click="openPop()">
 			<!-- #ifdef APP-PLUS -->
 			<text class="nvue-iconfont iconzhibo-shangpin" :style="{fontFamily:'nvueIconfont'}">&#xe63f;</text>
@@ -158,6 +160,10 @@
 				uni.navigateTo({
 					url: '/pagesGood/goodDetails?goodId=' + item.productId
 				});
+			},
+			onImSend(text) {
+				debugger
+				this.imMsgs.push({name: 'xxx', text})
 			}
 		},
 	}