|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
<view class="container" :style="'height: '+windowHeight+'px;'">
|
|
|
<jhlive
|
|
|
+ v-if="videoType == 1"
|
|
|
ref="jhlive" class="jhlive"
|
|
|
:sdkAppID="sdkAppID" :secretKey="secretKey" :userId="userId" :roomId="roomId"
|
|
|
:isAuthor="isAuthor" :linkMic="linkMic"
|
|
@@ -9,6 +10,20 @@
|
|
|
:btns="btns" @onBtnClick="onBtnClick"
|
|
|
:showIm="true" :imStatus="imStatus" :imMsgs="imMsgs" @onImSend="onImSend"
|
|
|
@onRemoteUser="num=$event.length" />
|
|
|
+ <video v-if="videoType == 2" id="myVideo" class="jhlive" :src="videoUrl" @error="videoErrorCallback" controls>
|
|
|
+ <cover-view class="popup-open" @click="$refs.popup.open()">
|
|
|
+ <!-- #ifdef APP-PLUS -->
|
|
|
+ <text class="nvue-iconfont iconzhibo-shangpin" :style="{fontFamily:'nvueIconfont'}"></text>
|
|
|
+ <!-- #endif -->
|
|
|
+ <!-- #ifdef MP-WEIXIN -->
|
|
|
+ <text class="iconfont iconzhibo-shangpin"></text>
|
|
|
+ <!-- #endif -->
|
|
|
+ </cover-view>
|
|
|
+ </video>
|
|
|
+ <view v-if="(videoType == 1) && (num<=0)" class="tips-box" :style="'top: '+windowHeight/3+'px;'">
|
|
|
+ <text class="tips-box-text">提示</text>
|
|
|
+ <text class="tips-box-text" style="margin-top: 10px;">讲解员未进入</text>
|
|
|
+ </view>
|
|
|
<uni-popup ref="popup" animation type="bottom">
|
|
|
<view class="popup-box">
|
|
|
<view class="popup-close">
|
|
@@ -45,7 +60,7 @@
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
- <u-modal v-if="num<=0" :value="true" content="讲解员未进入" :show-confirm-button="false" :async-close="true"></u-modal>
|
|
|
+ <!-- <u-modal v-if="(videoType == 1) && (num<=0)" :value="true" content="讲解员未进入" :show-confirm-button="false" :async-close="true"></u-modal> -->
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -83,6 +98,8 @@
|
|
|
isLiveFav: false,
|
|
|
imStatus: '',
|
|
|
imMsgs: [],
|
|
|
+ videoType: null,
|
|
|
+ videoId: '',
|
|
|
num: 0, // 开麦人数
|
|
|
// #ifdef MP-WEIXIN
|
|
|
showFav: true, // 是否展示收藏,app中不展示,小程序中 展示
|
|
@@ -93,16 +110,29 @@
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
- this.roomId = options.roomId;
|
|
|
- this.liveId = options.liveId;
|
|
|
- this.videoUrl = uni.getStorageSync("videoUrl").replace("http://", "https://");
|
|
|
- this.userData = uni.getStorageSync("userData");
|
|
|
- this.userId = this.userData.userId;
|
|
|
- this.userName = this.userData.userName;
|
|
|
+ this.videoType = options.videoType
|
|
|
+ if (this.videoType == 1) {
|
|
|
+ this.roomId = options.roomId;
|
|
|
+ this.liveId = options.liveId;
|
|
|
+ this.userData = uni.getStorageSync("userData");
|
|
|
+ this.userId = this.userData.userId;
|
|
|
+ this.userName = this.userData.userName;
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: '产品讲解'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.videoType = options.videoType
|
|
|
+ this.videoId = options.videoId
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: '正在播放短视频'
|
|
|
+ })
|
|
|
+ this.videoUrl = uni.getStorageSync("videoUrl").replace("http://","https://")
|
|
|
+ }
|
|
|
let info = uni.getSystemInfoSync();
|
|
|
this.windowWidth = info.windowWidth;
|
|
|
this.windowHeight = info.windowHeight;
|
|
|
console.log('宽高',this.windowWidth,this.windowHeight)
|
|
|
+
|
|
|
},
|
|
|
onReady() {
|
|
|
// this.isAuthor = false;
|
|
@@ -126,32 +156,45 @@
|
|
|
},
|
|
|
// #endif
|
|
|
onUnload() {
|
|
|
- this.exitRoom();
|
|
|
+ if (this.videoType == 1) {
|
|
|
+ this.exitRoom();
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
init() {
|
|
|
- NET.request(API.getLiveGoodsDetail + this.liveId, {}, 'GET').then(res => {
|
|
|
- this.goodsList = res.data
|
|
|
- }).catch(res => {
|
|
|
- uni.showToast({
|
|
|
- title: '获取商品列表失败',
|
|
|
- type: 'warning',
|
|
|
+ if (this.videoType == 1) {
|
|
|
+ NET.request(API.getLiveGoodsDetail + this.liveId, {}, 'GET').then(res => {
|
|
|
+ this.goodsList = res.data
|
|
|
+ }).catch(res => {
|
|
|
+ uni.showToast({
|
|
|
+ title: '获取商品列表失败',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
-
|
|
|
- this.avatar = uni.getStorageSync("liveImgUrl");
|
|
|
- this.title = uni.getStorageSync("liveName");
|
|
|
- this.$nextTick(() => this.enterRoom());
|
|
|
- // 查询是否关注
|
|
|
- NET.request(API.isSubscribed + this.liveId, {}, 'GET').then(res => {
|
|
|
- if(res.data==false){
|
|
|
- this.isLiveFav=false
|
|
|
- }else{
|
|
|
- this.isLiveFav=true
|
|
|
- }
|
|
|
- }).catch(res => {
|
|
|
- console.log(res)
|
|
|
- })
|
|
|
+
|
|
|
+ this.avatar = uni.getStorageSync("liveImgUrl");
|
|
|
+ this.title = uni.getStorageSync("liveName");
|
|
|
+ this.$nextTick(() => this.enterRoom());
|
|
|
+ // 查询是否关注
|
|
|
+ NET.request(API.isSubscribed + this.liveId, {}, 'GET').then(res => {
|
|
|
+ if(res.data==false){
|
|
|
+ this.isLiveFav=false
|
|
|
+ }else{
|
|
|
+ this.isLiveFav=true
|
|
|
+ }
|
|
|
+ }).catch(res => {
|
|
|
+ console.log(res)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ NET.request(API.getShortGoodsDetail + this.videoId, {}, 'GET').then(res => {
|
|
|
+ this.goodsList = res.data
|
|
|
+ }).catch(res => {
|
|
|
+ uni.showToast({
|
|
|
+ title: '获取商品列表失败',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
enterRoom() {
|
|
|
this.jhim = Jhim.getInstance(this.userId, this.sdkAppID, this.secretKey);
|
|
@@ -223,6 +266,10 @@
|
|
|
uni.navigateTo({
|
|
|
url: '/pagesGood/goodDetails?goodId=' + item.productId
|
|
|
});
|
|
|
+ },
|
|
|
+ // 短视频报错
|
|
|
+ videoErrorCallback(e) {
|
|
|
+ console.log('短视频报错:' + e)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -301,7 +348,7 @@
|
|
|
|
|
|
.goods-row {
|
|
|
width: 700rpx;
|
|
|
- height: 104px;
|
|
|
+ height: 114px;
|
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
|
flex-wrap: nowrap;
|
|
@@ -316,8 +363,8 @@
|
|
|
}
|
|
|
|
|
|
.goods-img {
|
|
|
- width: 104px;
|
|
|
- height: 104px;
|
|
|
+ width: 114px;
|
|
|
+ height: 114px;
|
|
|
object-fit: cover;
|
|
|
}
|
|
|
|
|
@@ -394,4 +441,17 @@
|
|
|
color: #999999;
|
|
|
text-align: center;
|
|
|
}
|
|
|
+ .tips-box {
|
|
|
+ padding: 10px;
|
|
|
+ width: 400rpx;
|
|
|
+ border-radius: 6px;
|
|
|
+ position: absolute;
|
|
|
+ left: 175rpx;
|
|
|
+ background-color: #ffffff;
|
|
|
+ }
|
|
|
+ .tips-box-text {
|
|
|
+ text-align: center;
|
|
|
+ color: #808080;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
</style>
|