商家首页 #47

Merged
theluyuan merged 1 commits from xbx into master 2020-07-06 01:11:18 +00:00
5 changed files with 111 additions and 5 deletions

View File

@ -114,6 +114,11 @@ export default {
id: id, id: id,
page:page page:page
}); });
},
getStoreImgVideoList({id}){
return vm.$u.post('Store/getStoreImgVideoList', {
id: id
});
} }
} }
} }

View File

@ -0,0 +1,26 @@
<template>
<view class="imageTop">
<image :src="url"></image>
</view>
</template>
<style lang="scss" scoped>
.imageTop{
width: 100%;
height: 500rpx;
margin-bottom: 20rpx;
>image{
width: 100%;
height: 100%;
}
}
</style>
<script>
export default {
name:"imageTop",
data(){
return {
}
},
props:['url']
}
</script>

View File

@ -0,0 +1,28 @@
<template>
<view class="listItem">
<video v-if="type == '2'" :src="url" :show-fullscreen-btn="true"></video>
<image v-else :src="url"></image>
</view>
</template>
<style lang="scss" scoped>
.listItem{
width: 365rpx;
height: 500rpx;
margin-bottom: 20rpx;
>image,video{
width: 100%;
height: 100%;
}
}
</style>
<script>
export default {
name:"listItem",
data(){
return {
}
},
props:['url','type']
}
</script>

View File

@ -0,0 +1,26 @@
<template>
<view class="videoTop">
<video :src="url" :show-fullscreen-btn="true"></video>
</view>
</template>
<style lang="scss" scoped>
.videoTop{
width: 100%;
height: 284rpx;
margin-bottom: 20rpx;
>video{
width: 100%;
height: 100%;
}
}
</style>
<script>
export default {
name:"videoTop",
data(){
return {
}
},
props:['url']
}
</script>

View File

@ -38,7 +38,14 @@
</view> </view>
<view class="main"> <view class="main">
<view class="classify" v-if="cur==0"> <view class="classify" v-if="cur==0">
111 <view v-for="item in indextop" :key="item.id">
<videoTop :url="item.url" v-if="item.type == 2"></videoTop>
<imageTop v-else :url="item.url"></imageTop>
</view>
<view style="display: flex;flex-wrap: wrap;">
<listitem :style="{'margin-left': index%2 == 1 ? '20rpx':'0'}" v-for="(item,index) in indexlist" :key="item.id" :type="item.type" :url="item.url"></listitem>
</view>
</view> </view>
<!-- 商品筛选排序未完成 --> <!-- 商品筛选排序未完成 -->
<view class="item" v-if="cur==1"> <view class="item" v-if="cur==1">
@ -67,16 +74,25 @@
</template> </template>
<script> <script>
import item from "@/components/shop/list/item" import item from "@/components/shop/list/item"
import videoTop from "../components/merchant/video-top"
import imageTop from "../components/merchant/image-top"
import listitem from "../components/merchant/list-item"
export default { export default {
data() { data() {
return { return {
show: false, show: false,
cur: 0, cur: 0,
list:[] list:[],
indexlist:[],
indextop:[]
} }
}, },
components:{ components:{
item item,
videoTop,
imageTop,
listitem
}, },
methods: { methods: {
toDetailsPage() { toDetailsPage() {
@ -87,9 +103,14 @@ export default {
}, },
onLoad(){ onLoad(){
this.$u.api.getStoreGoodsList({id:1}).then((res)=>{ this.$u.api.getStoreGoodsList({id:1}).then((res)=>{
console.log(res.data) // console.log(res.data)
this.list= res.data.list this.list= res.data.list
}) })
this.$u.api.getStoreImgVideoList({id:1}).then((res)=>{
console.log(res.data)
this.indextop = [res.data[0],res.data[1]]
this.indexlist = res.data.slice(2,)
})
} }
}; };
</script> </script>
@ -155,7 +176,7 @@ export default {
background-color: #ffffff; background-color: #ffffff;
width: 100%; width: 100%;
margin-bottom: 20rpx; margin-bottom: 20rpx;
height: 140rpx; // height: 140rpx;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 20rpx 30rpx; padding: 20rpx 30rpx;