买家端新增视频播放功能

master
Yer 2023-07-20 16:50:43 +08:00
parent 6a653198c3
commit 9fce33ca18
5 changed files with 75 additions and 16 deletions

View File

@ -10,6 +10,7 @@
"dependencies": {
"@amap/amap-jsapi-loader": "0.0.7",
"axios": "^0.19.2",
"dplayer": "^1.27.1",
"js-cookie": "^2.2.1",
"less": "^2.7.0",
"less-loader": "^5.0.0",

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z" fill="none" stroke="#333" stroke-width="4" stroke-linejoin="round"/><path d="M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z" fill="none" stroke="#333" stroke-width="4" stroke-linejoin="round"/></svg>

After

Width:  |  Height:  |  Size: 468 B

View File

@ -4,22 +4,15 @@
<!-- 详情左侧展示数据图片收藏举报 -->
<div class="item-detail-left">
<!-- 大图放大镜 -->
<!-- <div id="dplayer"></div> -->
<div class="item-detail-big-img">
<pic-zoom :url="imgList[imgIndex].url" :scale="2"></pic-zoom>
</div>
<div
v-if="skuDetail.goodsType !== 'VIRTUAL_GOODS'"
style="margin-top:10px;rgb(153, 149, 149);"
>
实物商品
</div>
<div
v-else-if="skuDetail.goodsType == 'VIRTUAL_GOODS'"
style="margin-top:10px;rgb(153, 149, 149);"
>
虚拟商品
<pic-zoom :url="imgList[imgIndex].url" :scale="2"></pic-zoom>
</div>
<!-- <div id="dplayer"></div> -->
<div class="item-detail-img-row">
<div
class="item-detail-img-small"
@mouseover="imgIndex = index"
@ -44,6 +37,18 @@
<div class="item-detail-title">
<p>
{{ skuDetail.goodsName }}
<Tag
v-if="skuDetail.goodsType !== 'VIRTUAL_GOODS'"
style="margin-top:10px;rgb(153, 149, 149);"
>
实物商品
</Tag>
<Tag
v-else-if="skuDetail.goodsType == 'VIRTUAL_GOODS'"
style="margin-top:10px;rgb(153, 149, 149);"
>
虚拟商品
</Tag>
</p>
</div>
<div class="sell-point">
@ -272,7 +277,8 @@
class="add-buy-car"
v-if="$route.query.way !== 'POINT' && skuDetail.authFlag === 'PASS'"
>
<Button
<Button
type="error"
v-if="skuDetail.goodsType !== 'VIRTUAL_GOODS'"
:loading="loading"
@ -287,9 +293,15 @@
@click="buyNow"
>立即购买</Button
>
<Tooltip content="观看视频">
<img class="view-video" @click="showGoodsVideo = true" :src="require('@/assets/iconfont/play.svg')" alt="">
</Tooltip>
</div>
</div>
</div>
<Modal title="浏览视频" v-model="showGoodsVideo">
<div id="dplayer"></div>
</Modal>
</div>
</div>
</template>
@ -297,6 +309,7 @@
<script>
import Promotion from "./Promotion.vue";
import PicZoom from "vue-piczoom"; //
import DPlayer from "dplayer";
import {
collectGoods,
isCollection,
@ -304,6 +317,7 @@ import {
cancelCollect,
} from "@/api/member.js";
import { addCartGoods } from "@/api/cart.js";
export default {
name: "ShowGoods",
props: {
@ -321,14 +335,22 @@ export default {
if (this.wholesaleList && this.wholesaleList.length > 0) {
this.count = this.wholesaleList[0].num;
}
this.swiperGoodsImg();
},
deep: true,
immediate: true,
},
showGoodsVideo(val){
if(val){
this.initVideo();
}
}
},
data() {
return {
showGoodsVideo:false,
goodsVideo:"",
wholesaleList: [],
count: 1, //
imgIndex: 0, //
@ -368,6 +390,24 @@ export default {
},
},
methods: {
// video
initVideo(){
if(!this.goodsVideo ){
setTimeout(()=>{
this.goodsVideo = new DPlayer({
container: document.getElementById('dplayer'),
video: {
url:this.skuDetail.goodsVideo,
},
});
},100)
}
},
changeCount(val) {
if (this.wholesaleList && this.wholesaleList.length > 0) {
if (this.count <= this.wholesaleList[0].num) {
@ -544,6 +584,7 @@ export default {
this.imgList = e.specImage;
}
});
},
},
mounted() {
@ -599,6 +640,7 @@ export default {
.item-detail-left {
width: 350px;
margin-right: 30px;
}
@ -607,8 +649,14 @@ export default {
height: 350px;
box-shadow: 0px 0px 8px $border_color;
cursor: pointer;
}
}
#dplayer{
width: 100%;
height: 100%;
}
.item-detail-big-img img {
width: 100%;
}
@ -842,11 +890,14 @@ export default {
.add-buy-car-box {
width: 100%;
margin-top: 15px;
border-top: 1px dotted $border_color;
}
.add-buy-car {
display: flex;
align-items: center;
margin-top: 15px;
> * {
margin: 0 4px;
@ -869,5 +920,8 @@ export default {
color: red;
margin-bottom: 5px;
}
.view-video{
cursor: pointer;
}
/******************商品图片及购买详情结束******************/
</style>

View File

@ -153,7 +153,9 @@
</div>
</div>
</template>
<div @click="moreOptions" v-if="tagsContent.length>4" class="more-options">{{showTagCount===5?'':''}}<Icon :type="showTagCount===5?'ios-arrow-down':'ios-arrow-up'" /></div>
<div @click="moreOptions" v-if="tagsContent.length>4" class="more-options">
{{showTagCount===5?'更多筛选项':'收起筛选项'}}
</div>
</div>
</div>
</template>

View File

@ -178,6 +178,7 @@ export default {
//
handleSearch(key) {
this.params.keyword = key;
this.$route.query.keyword = key
this.params.pageNumber = 0;
this.getGoodsList();
},