Commit efbed357 authored by zhengke's avatar zhengke

修改视屏

parent 5e14a695
......@@ -145,10 +145,10 @@
<swiper-item>
<view class="uni_vdplayer">
<video :id="'myVideo' + index" :ref="'myVideo' + index" class="player-video" :loop="true" :show-progress="true"
:controls="false" :show-center-play-btn="false" :src="item.video_url" :autoplay="index==videoIndex" />
:controls="false" :show-center-play-btn="false" :src="item.video_url" :autoplay="index==videoIndex" :objectFit="getVideoHeight(item.VideoType)" />
</view>
<!-- 中间播放按钮 -->
<view class="vd-cover flexbox" @click="handleClicked(index)" >
<view class="vd-cover flexbox" @click="handleClicked(index)">
<image v-if="!isPlay" style="width:74px;height:74px;" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/v_pause.png"></image>
</view>
</swiper-item>
......@@ -197,12 +197,9 @@
return {
vlist: [],
videoIndex: 0,
swiperHeight: 0,
swiperHeight: 0,//高度
GoodsId: 0, //商品id
nav: 0,
changeIndex: 0,
goodObj: {}, //商品对象
msg: {
pageIndex: 1,
......@@ -213,19 +210,15 @@
OrderBy: 0,
IsVideo: 1
},
hkindex: 0,
isShowInfo: true, //显示商品弹窗
comGoodImg: '', //商品缩小图
comGoodTitle: '', //商品名称
comGoodPrice: '', //商品价格
showSku: false,
showSku: false,//是否显示商品SKU
sku: {},
showAuth: false,
u: {},
isPlay: true, //当前视频是否播放中
videoContextList: []
}
},
......@@ -238,13 +231,29 @@
this.getList();
},
onLoad(option) {
console.log(option, 'optionsss');
this.GoodsId = option.GoodsId;
this.sysheight = uni.getSystemInfoSync().windowHeight;
this.swiperHeight = `${this.sysheight}px`
this.swiperHeight = `${this.sysheight}px`;
this.videoIndex=0; //默认加载第一条
this.vlist = [];
wx.showShareMenu({
withShareTicket: true,
menus: ["shareAppMessage", "shareTimeline"],
});
},
methods: {
//获取商品视频
getVideoHeight(type)
{
//视频填充方式(0默认,1-填充)
if(type==0){
return 'contain'
}else{
return 'fill'
}
},
//返回上一页
redirectPrev() {
uni.navigateBack({
......@@ -254,18 +263,17 @@
// 滑动切换
handleSlider(e) {
let curIndex = e.detail.current
if(curIndex>0){
this.videoContextList[curIndex-1].pause()
if (curIndex > 0) {
this.videoContextList[curIndex - 1].pause()
}
if(curIndex<this.vlist.length-1){
this.videoContextList[curIndex+1].pause()
if (curIndex < this.vlist.length - 1) {
this.videoContextList[curIndex + 1].pause()
}
this.videoContextList[curIndex].play()
this.videoContextList[curIndex].seek(0)
this.isPlay=true
this.isPlay = true
this.videoIndex = curIndex;
console.log(this.vlist,'this.vlist');
this.comGoodImg = this.vlist[curIndex].picUrl;
this.comGoodTitle = this.vlist[curIndex].name;
this.comGoodPrice = this.vlist[curIndex].price;
......@@ -315,7 +323,8 @@
name: this.goodObj.name,
picUrl: this.goodObj.cover_pic,
price: this.goodObj.price,
video_url: this.goodObj.video_url
video_url: this.goodObj.video_url,
VideoType: this.goodObj.video_type
}
this.vlist.push(obj);
this.comGoodImg = this.goodObj.cover_pic;
......@@ -347,7 +356,8 @@
name: data[0].name,
picUrl: data[0].cover_pic,
price: this.goodObj.price,
video_url: data[0].video_url
video_url: data[0].video_url,
VideoType:data[0].video_type
}
this.vlist.push(obj);
this.videoContextList = []
......@@ -368,7 +378,7 @@
//加入购物车或购买
getBuy() {
this.u = uni.getStorageSync('mall_UserInfo');
console.log(this.u, 'uuu');
console.log(this.u,'uuuu');
if (!this.u) {
this.u = {
nickName: '未登录',
......@@ -394,14 +404,38 @@
imageUrl: this.comGoodImg
};
},
onShareTimeline() {
setTimeout(() => {
this.getReceive();
}, 2500);
let uid = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserId
: 0;
if(uid==0){
uid = uni.getStorageSync("pid")?uni.getStorageSync("pid").pid:0
}
let SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").SmallShopId
: 0;
if(SmallShopId == 0){//如果微店id为0 去找所属微店id
SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserSmallShopId
: 0;
}
return {
title: this.comGoodTitle,
query: "GoodsId=" + this.GoodsId + "&user_id=" + uid+ "&SmallShopId=" + SmallShopId,
imageUrl: this.comGoodImg,
};
},
//点击商品
getShowInfo() {
this.isShowInfo = !this.isShowInfo;
}
},
mounted() {
},
mounted() {},
created() {
this.nav = uni.getMenuButtonBoundingClientRect().top;
},
......
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