Commit 310d5a9a by 李嘉林

点赞

parent 594b40f9
......@@ -37,4 +37,8 @@ export default {
addGuestbook(options) {
return requestPOST(`${process.env.OLSHOP_URL}/liveBroadcastInfo/addGuestbook`, options);
},
// 直播间点赞接口
addLiveLikeByUser(options) {
return requestPOST(`${process.env.OLSHOP_URL}liveBroadcastInfo/addLiveLikeByUser`, options);
},
};
\ No newline at end of file
......@@ -63,13 +63,13 @@ import livedExplainingCommodities from "@/components/livedModel/livedExplainingC
import livedGoodsDia from "@/components/livedModel/livedGoodsDia";
import live from "@/api/live";
export default {
props: ["info","entryNoticeText","updateVal","guestBookList"],
props: ["info","entryNoticeText","updateVal","guestBookList","likeInfo"],
name: "",
data() {
return {
liveId: 0,
imgList: [],
watchNum:0,
likeNum:0,
iconList: [
"//img3.imgtn.bdimg.com/it/u=3743111107,1940472030&fm=11&gp=0.jpg",
"//img0.imgtn.bdimg.com/it/u=216605226,3652567530&fm=11&gp=0.jpg",
......@@ -81,7 +81,7 @@ export default {
showDia: false, //显示商品列表弹窗
isSend: false, //显示评论输入框
sendVal: "", //输入内容
getFocus: false //获取焦点
getFocus: false, //获取焦点
};
},
components: {
......@@ -92,12 +92,16 @@ export default {
},
computed: {
likeNumCopy() {
return this.watchMan(this.watchNum);
return this.watchMan(this.likeNum);
},
},
watch:{
updateVal(newVal,oldVal){
this.watchNum=this.info.watchNum;
console.log(this.likeInfo,'-----------101')
if(this.likeNum<this.likeInfo.likeNum){
this.getAdd();
}
this.likeNum=this.likeInfo.likeNum;
if(this.entryNoticeText){
this.userComing=true;
setTimeout(() => {
......@@ -126,7 +130,12 @@ export default {
return;
}
if (val == 1) {
this.watchNum++;
this.likeNum++;
let query={
liveBroadcastId:(this.liveId),
clickNum:1,
};
live.addLiveLikeByUser(query).then(res=>{});
}
setTimeout(() => {
this.num++;
......@@ -207,7 +216,7 @@ export default {
setTimeout(() => {
this.isSend = false;
this.sendVal = "";
}, 220);
}, 500);
},
// 点击发送留言
toSend() {
......
......@@ -23,7 +23,7 @@
<!-- <p class="del">
<span></span>
<span>{{999}}</span>
</p> -->
</p>-->
</div>
<div class="icon" @click="isLogin(item)">
<van-icon name="shopping-cart" />
......@@ -32,7 +32,7 @@
</div>
</div>
</div>
<div style="text-align:center;font-size:16px;padding-top:10px;" v-else>暂无商品</div>
<div style="text-align:center;font-size:16px;padding-top:10px;" v-else>暂无商品</div>
</van-popup>
<!-- 选择规格弹层 -->
<livedSelectionSpe
......@@ -57,7 +57,7 @@ import live from "@/api/live";
export default {
props: {
showDia: Boolean,
info: Object,
info: Object
},
name: "",
data() {
......@@ -76,10 +76,10 @@ export default {
onLoad(options) {
let params = JSON.parse(options.params);
this.liveId = params.liveId;
this.goodsList=this.info.goodsRespDTOs;
this.goodsList = this.info.goodsRespDTOs;
this.goodsList.forEach((item, index) => {
item.goodsPrice=Number(item.goodsPrice);
if(item.goodsImageUrl){
item.goodsPrice = Number(item.goodsPrice);
if (item.goodsImageUrl) {
item.goodsImageUrl = DFSImg(item.goodsImageUrl);
}
});
......@@ -116,6 +116,26 @@ export default {
});
},
showSpeDia(val) {
if (val.multiSpecificationFlag != 1) {
// 不是多规格直接加入购物车
live
.addCart([{ productGoodsId: val.productGoodsId, qty: 1}])
.then(res => {
if (res.data.code == 200) {
wx.showToast({
title: "加入成功",
icon: "success"
});
this.showSize = false;
} else {
wx.showToast({
title: res.data.msg,
icon: "none"
});
}
});
return;
}
let productId = val.productId;
this.itemGoods.productId = productId;
wx.showLoading({
......@@ -148,11 +168,11 @@ export default {
);
}
this.showSpe = true;
}else{
} else {
wx.showToast({
title: res.data.msg,
icon: 'none',
})
icon: "none"
});
}
});
},
......
......@@ -168,6 +168,7 @@ export default {
onLoad(options) {
let params = JSON.parse(options.params);
this.liveId=params.liveId;
this.product_goods_info.goodsImgUrl=this.goodsImg;
this.init();
},
mounted() {},
......@@ -249,9 +250,9 @@ export default {
this.getProductInfos[i].specifications
] = this.getProductInfos[i]; //修改数据结构格式,改成键值对的方式,以方便和选中之后的值进行匹配
}
let defaultnoSellOut=this.getProductInfos.filter((item,index)=>{return !((item.oversoldFlag==0&&item.saleQty-0<=0)||item.saleStatus=='0')});
// let defaultnoSellOut=this.getProductInfos.filter((item,index)=>{return !((item.oversoldFlag==0&&item.saleQty-0<=0)||item.saleStatus=='0')});
// 默认选中一个只有一个未售罄的规格
this.defaultSelection(defaultnoSellOut[0].twoSpecifications,this.goodsGuiges);
// this.defaultSelection(defaultnoSellOut[0].twoSpecifications,this.goodsGuiges);
if (this.goodsGuiges.length == 1) {
this.goodsGuiges[0].specificationValue.forEach((item, index) => {
for (var i in this.shopItemInfo) {
......
......@@ -36,18 +36,18 @@
:entryNoticeText="entryNoticeText"
:guestBookList="guestBookList"
:updateVal="updateVal"
:likeInfo="likeInfo"
@toSendMsg="toSendMsg"
></livedControls>
</div>
<!-- 直播 -->
<live-player
v-if="liveNoticeInfo.liveBroadcastState==1"
v-if="liveNoticeInfo.liveBroadcastState==1&&liveNoticeInfo.boStreamRTMP"
class="livePlayer"
:src="liveNoticeInfo.boStreamM3U8"
:src="liveNoticeInfo.boStreamRTMP"
mode="RTC"
autoplay
bindstatechange="statechange"
binderror="error"
@error="error"
/>
</div>
</template>
......@@ -146,12 +146,6 @@ export default {
}
});
},
statechange(res) {
console.log(res, "-------19");
},
error(err) {
console.log(err, "----22");
},
back() {
wx.navigateBack({
delta: 1
......@@ -205,6 +199,7 @@ export default {
}
}
this.guestBookList=resData.guestBookList;//评论列表
this.likeInfo=resData.likeInfo;
} else if (
this.liveNoticeInfo.liveBroadcastState == 1 &&
resData.liveState == "END_LIVE"
......@@ -237,6 +232,9 @@ export default {
});
}
});
},
error(res){
console.log(res,'------------------237')
}
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment