Commit efbed357 authored by zhengke's avatar zhengke

修改视屏

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