1、首页轮播图跳转
2、招租详情的轮播图的当前页数调整
This commit is contained in:
parent
0c34797e9a
commit
986eee5e7f
@ -4,26 +4,20 @@
|
|||||||
<!-- 顶部banner -->
|
<!-- 顶部banner -->
|
||||||
<view class="swiper-box">
|
<view class="swiper-box">
|
||||||
<view class="swiper_s">
|
<view class="swiper_s">
|
||||||
<swiper class="swiper_s" :circular="true" :autoplay="true" indicator-active-color="#0DAE11"
|
<swiper class="swiper_s" :circular="true" :autoplay="true" :indicator-dots="false" :current="currentImgIndex"
|
||||||
indicator-color="#ffffff" :indicator-dots="false" :current="currentImgIndex"
|
@change="swiperChange" :duration="2000" @animationfinish="animationfinish">
|
||||||
@animationfinish="swiperChange">
|
|
||||||
<!-- v-for="(item, index) in swiperList" :key="index" @click="openSwiper(item)"-->
|
<!-- v-for="(item, index) in swiperList" :key="index" @click="openSwiper(item)"-->
|
||||||
<swiper-item style="margin: 0 auto;">
|
<swiper-item style="margin: 0 auto;" v-for="(item,index) in imageList" :key="index">
|
||||||
<view style="position: relative;width: 100%;height: 100%;"
|
<view style="position: relative;width: 100%;height: 100%;"
|
||||||
v-for="(item,index) in detailRent.images" :key="index">
|
>
|
||||||
<image class="swiper-image" :src="item" mode="scaleToFill" />
|
<image class="swiper-image" :src="item" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
|
|
||||||
|
|
||||||
<!-- <swiper-item style="margin: 0 auto;">
|
|
||||||
<view style="position: relative;width: 100%;height: 100%">
|
|
||||||
<image class="swiper-image" src="/static/cart-empty.png" mode="scaleToFill" />
|
|
||||||
</view>
|
|
||||||
</swiper-item> -->
|
|
||||||
</swiper>
|
</swiper>
|
||||||
<view class="bannerNum">
|
<view class="bannerNum">
|
||||||
{{currentImgIndex}}/{{imagesNum}}
|
{{currentShowImgIndex}}/{{imagesNum}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -184,7 +178,8 @@
|
|||||||
const rentId = ref('');
|
const rentId = ref('');
|
||||||
const detailRent = ref('')
|
const detailRent = ref('')
|
||||||
const imagesNum = ref(0);
|
const imagesNum = ref(0);
|
||||||
const currentImgIndex = ref(1)
|
const currentImgIndex = ref(0)
|
||||||
|
const currentShowImgIndex = ref(1)
|
||||||
const showContacted = ref(false)
|
const showContacted = ref(false)
|
||||||
const showContactNo = ref(false)
|
const showContactNo = ref(false)
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
@ -200,7 +195,8 @@
|
|||||||
getDetail();
|
getDetail();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const imageList = ref([])
|
||||||
async function getDetail() {
|
async function getDetail() {
|
||||||
const res = await sheep.$api.rent.rentInfo(rentId.value)
|
const res = await sheep.$api.rent.rentInfo(rentId.value)
|
||||||
console.log('获取招租详情', res);
|
console.log('获取招租详情', res);
|
||||||
@ -208,9 +204,9 @@
|
|||||||
detailRent.value = res.data.detail
|
detailRent.value = res.data.detail
|
||||||
detailRent.value.release_time_text = detailRent.value.release_time_text.substring(0, 10);
|
detailRent.value.release_time_text = detailRent.value.release_time_text.substring(0, 10);
|
||||||
|
|
||||||
const imageList = res.data.detail.images
|
imageList.value = res.data.detail.images
|
||||||
console.log('imageList:', imageList.length);
|
console.log('imageList:', imageList.value);
|
||||||
imagesNum.value = imageList.length
|
imagesNum.value = imageList.value.length
|
||||||
console.log('imagesNum:', imagesNum.value);
|
console.log('imagesNum:', imagesNum.value);
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -219,6 +215,28 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function swiperChange(e) {
|
||||||
|
console.log('切换轮播图',e.detail.current);
|
||||||
|
if(e.detail.current<imagesNum.value) {
|
||||||
|
// if(e.detail.current == 0){
|
||||||
|
// currentImgIndex.value = imagesNum.value
|
||||||
|
// }else {
|
||||||
|
// currentImgIndex.value = e.detail.current;
|
||||||
|
// }
|
||||||
|
currentImgIndex.value = e.detail.current;
|
||||||
|
currentShowImgIndex.value = e.detail.current + 1;
|
||||||
|
}
|
||||||
|
// if(e.detail.source =='autoplay' || e.detail.source == 'touch' || e.detail.source === ''){
|
||||||
|
// currentImgIndex.value = e.detail.current + 1;
|
||||||
|
// }else {
|
||||||
|
// // currentImgIndex.value = e.detail.current + 1; // 无条件更新
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
function animationfinish(e) {
|
||||||
|
console.log('animationfinish',e);
|
||||||
|
};
|
||||||
|
|
||||||
//返回首页
|
//返回首页
|
||||||
function backHome() {
|
function backHome() {
|
||||||
|
@ -50,9 +50,9 @@
|
|||||||
<view class="swiper_s">
|
<view class="swiper_s">
|
||||||
<swiper class="swiper_s" :circular="true" :autoplay="true" indicator-active-color="#0DAE11"
|
<swiper class="swiper_s" :circular="true" :autoplay="true" indicator-active-color="#0DAE11"
|
||||||
indicator-color="#ffffff" :indicator-dots="false" :current="swiperCurrent"
|
indicator-color="#ffffff" :indicator-dots="false" :current="swiperCurrent"
|
||||||
@animationfinish="swiperChange" v-for="(item, index) in bannerList" :key="index">
|
@animationfinish="swiperChange">
|
||||||
<!-- v-for="(item, index) in swiperList" :key="index" @click="openSwiper(item)"-->
|
<!-- v-for="(item, index) in swiperList" :key="index" @click="openSwiper(item)"-->
|
||||||
<swiper-item style="margin: 0 auto;" >
|
<swiper-item style="margin: 0 auto;" v-for="(item, index) in bannerList" :key="index" @click="swiperJump(item)">
|
||||||
<view style="position: relative;width: 100%;height: 100%;">
|
<view style="position: relative;width: 100%;height: 100%;">
|
||||||
<!--<view class="fnon_tit"></view>
|
<!--<view class="fnon_tit"></view>
|
||||||
<view class="text">{{ item.title ? item.title : '' }}</view>
|
<view class="text">{{ item.title ? item.title : '' }}</view>
|
||||||
@ -298,6 +298,30 @@
|
|||||||
sheep.$router.go(decodeURIComponent(options.page));
|
sheep.$router.go(decodeURIComponent(options.page));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//轮播图跳转
|
||||||
|
function swiperJump(item) {
|
||||||
|
console.log('轮播图跳转事件:',item.url);
|
||||||
|
const tabBarPages = [
|
||||||
|
'/pages/index/index',
|
||||||
|
'/pages/index/fabu',
|
||||||
|
'/pages/index/user'
|
||||||
|
];
|
||||||
|
console.log('tabbarsList:',tabBarPages);
|
||||||
|
if(item.type == "in") {
|
||||||
|
console.log('跳进内页');
|
||||||
|
if(tabBarPages.includes(item.url)) {
|
||||||
|
console.log('导航页');
|
||||||
|
uni.switchTab({
|
||||||
|
url: item.url,
|
||||||
|
})
|
||||||
|
}else {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: item.url,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 下拉刷新
|
// 下拉刷新
|
||||||
onPullDownRefresh(() => {
|
onPullDownRefresh(() => {
|
||||||
@ -315,6 +339,7 @@
|
|||||||
console.log('banner',res);
|
console.log('banner',res);
|
||||||
if(res.code == 1) {
|
if(res.code == 1) {
|
||||||
bannerList.value = res.data.list
|
bannerList.value = res.data.list
|
||||||
|
console.log('bannerList',bannerList.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user