Feat:接口对接
This commit is contained in:
@@ -1,31 +1,26 @@
|
||||
<template>
|
||||
<view class="pkg-product-list">
|
||||
<view class="search-box flex jc-between ai-center">
|
||||
<input type="text" v-model="keyword" placeholder="搜索商品" placeholder-style="color:#949494" @confirm="search">
|
||||
<image class="icon" :src="webUrl+'/20220903142935869059.png'" mode="scaleToFill" @click="search"></image>
|
||||
</view>
|
||||
<view class="first-half">
|
||||
<view class="search-box flex jc-between ai-center">
|
||||
<input type="text" v-model="keyword" placeholder="搜索商品" placeholder-style="color:#949494" @confirm="search">
|
||||
<image class="icon" :src="webUrl+'/20220903142935869059.png'" mode="scaleToFill" @click="search"></image>
|
||||
</view>
|
||||
|
||||
<swiper class="swiper-box" indicator-dots indicator-color="rgba(255,255,255,.3)" indicator-active-color="#fff"
|
||||
autoplay circular v-if="bannerList.length>0">
|
||||
<swiper-item v-for="(item,index) in bannerList" :key="index">
|
||||
<image :src="item.pic" mode="scaleToFill" @click="$global.commonJump(item.uniappUrl)"/>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<swiper class="swiper-box" indicator-dots indicator-color="rgba(255,255,255,.3)" indicator-active-color="#fff"
|
||||
autoplay circular v-if="bannerList.length>0">
|
||||
<swiper-item v-for="(item,index) in bannerList" :key="index">
|
||||
<image :src="item.pic" mode="scaleToFill" @click="$global.commonJump(item.uniappUrl)"/>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
<swiper class="swiper-box" indicator-dots indicator-color="rgba(255,255,255,.3)" indicator-active-color="#fff"
|
||||
autoplay circular v-else>
|
||||
<swiper-item>
|
||||
<view class="swiper-item uni-bg-blue">暂无内容</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
<view class="tab-box flex jc-center ai-center" v-show="tabIndex===0">
|
||||
<image class="active" src="/static/images/v6/btn_active_left.png" @click="changeTab(0)"/>
|
||||
<image class="inactive" src="/static/images/v6/btn_right.png" @click="changeTab(1)"/>
|
||||
</view>
|
||||
<view class="tab-box flex jc-center ai-center" v-show="tabIndex===1">
|
||||
<image class="inactive" src="/static/images/v6/btn_left.png" @click="changeTab(0)"/>
|
||||
<image class="active" src="/static/images/v6/btn_active_right.png" @click="changeTab(1)"/>
|
||||
<view class="tab-box flex jc-center ai-center" v-show="tabIndex===0">
|
||||
<image class="active" src="/static/images/v6/btn_active_left.png" @click="changeTab(0)"/>
|
||||
<image class="inactive" src="/static/images/v6/btn_right.png" @click="changeTab(1)"/>
|
||||
</view>
|
||||
<view class="tab-box flex jc-center ai-center" v-show="tabIndex===1">
|
||||
<image class="inactive" src="/static/images/v6/btn_left.png" @click="changeTab(0)"/>
|
||||
<image class="active" src="/static/images/v6/btn_active_right.png" @click="changeTab(1)"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="body-box">
|
||||
@@ -40,7 +35,8 @@
|
||||
<scroll-view class="list flex flex-wrap" :style="{'height':listHeight}" :enable-flex="true"
|
||||
:scroll-anchoring="true"
|
||||
:scroll-y="true"
|
||||
:scroll-with-animation="true" :enable-back-to-top="true" @scrolltolower="onLower" v-if="dataList.length>0">
|
||||
:scroll-with-animation="true" :enable-back-to-top="true" @scrolltolower="onLower"
|
||||
v-if="dataList.length>0">
|
||||
<view v-for="(item, index) in dataList" :key="index">
|
||||
<view class="item item-store" @click="goStore(item.id)" v-if="tabIndex===0">
|
||||
<image class="cover" :src="item.cover" mode="scaleToFill"/>
|
||||
@@ -59,8 +55,11 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<image class="img-nodata" :src="webUrl+'/20230912145123537792.png'" mode="scaleToFill" v-else-if="tabIndex===0"/>
|
||||
<image class="img-nodata" :src="webUrl+'/20230912145113749133.png'" mode="scaleToFill" v-else/>
|
||||
<view class="tc" v-else>
|
||||
<image class="img-nodata" :src="webUrl+'/20230912145123537792.png'" mode="scaleToFill"
|
||||
v-if="tabIndex===0"/>
|
||||
<image class="img-nodata" :src="webUrl+'/20230912145113749133.png'" mode="scaleToFill" v-else/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -92,7 +91,9 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
wellnessFood().then(({data}) => this.bannerList = data.banner);
|
||||
wellnessFood().then(({data}) => {
|
||||
this.bannerList = data.banner
|
||||
});
|
||||
fetchCity(4).then(({data}) => {
|
||||
this.asideList = data.group;
|
||||
this.search();
|
||||
@@ -128,7 +129,7 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
handleData(data){
|
||||
handleData(data) {
|
||||
let that = this;
|
||||
if (this.page === 1) {
|
||||
this.dataList = [];
|
||||
@@ -138,7 +139,6 @@ export default {
|
||||
success: function (res) {
|
||||
let len = that.dataList.length;
|
||||
let {windowHeight} = res;
|
||||
console.log("test data",windowHeight)
|
||||
that.listHeight = "auto";
|
||||
if (windowHeight > 600 && len > 4) {
|
||||
that.listHeight = "100%";
|
||||
@@ -179,8 +179,22 @@ export default {
|
||||
padding-top: 16rpx;
|
||||
background: #fff;
|
||||
|
||||
.first-half {
|
||||
height: 612rpx;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.swiper-box {
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.tab-box {
|
||||
margin: 0 32rpx;
|
||||
padding-bottom: 32rpx;
|
||||
|
||||
.active {
|
||||
width: 342rpx;
|
||||
@@ -195,14 +209,10 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
.swiper-box {
|
||||
margin: 20rpx auto 30rpx;
|
||||
}
|
||||
|
||||
.body-box {
|
||||
position: fixed;
|
||||
top: 610rpx;
|
||||
height: calc(100vh - 610rpx);
|
||||
position: relative;
|
||||
height: calc(100vh - 612rpx);
|
||||
z-index: 10;
|
||||
|
||||
.store {
|
||||
image {
|
||||
@@ -218,14 +228,15 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
.img-nodata{
|
||||
position: relative;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%,-50%);
|
||||
.article-box {
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.img-nodata {
|
||||
width: 360rpx;
|
||||
height: 360rpx;
|
||||
vertical-align: middle;
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user