|
@@ -30,7 +30,7 @@
|
|
|
<div class="content-scroll swiper">
|
|
|
<!-- 使用swiper -->
|
|
|
<div class="swiper-wrapper">
|
|
|
- <swiper :options="swiperoption" ref="mySwiper">
|
|
|
+ <swiper :options="swiperoption" ref="mySwiper" @slideChange="slideChanged">
|
|
|
<swiper-slide class="swiper-slide scroll-item list active" v-for="(item,index) in list" :key="item.id" :class="
|
|
|
current == index
|
|
|
? `active index${index} ${curIndex == index ? 'fang' : ''}`
|
|
@@ -73,8 +73,8 @@
|
|
|
</div>
|
|
|
<div class="tips">
|
|
|
请选择祈愿类型
|
|
|
- <div v-if="curIndex" class="downButtom flex justify-center">
|
|
|
- <div class="downButtomItem">返回我的祈愿</div>
|
|
|
+ <div v-if="mycurrentData.id != userInfo.id" class="downButtom flex justify-center">
|
|
|
+ <div class="downButtomItem" @click="swiper.slideTo(mycurrent, 100, true)">返回我的祈愿</div>
|
|
|
</div>
|
|
|
<div v-else class="downButtom flex justify-center">
|
|
|
<div class="downButtomItem" @click="$router.push('/map')">祈愿地图</div>
|
|
@@ -159,6 +159,10 @@ export default {
|
|
|
shareShow: false,
|
|
|
scrollLeft: 0, // 横向滚动条位置
|
|
|
current: 0,
|
|
|
+ mycurrent: 0,
|
|
|
+ mycurrentData: {
|
|
|
+
|
|
|
+ },
|
|
|
curIndex: null,
|
|
|
qrcode1: null,
|
|
|
qrcode2: null,
|
|
@@ -194,7 +198,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState('home', ['img']),
|
|
|
+ ...mapState('home', ['img', "userInfo"]),
|
|
|
swiper() {
|
|
|
return this.$refs.mySwiper.swiper
|
|
|
}
|
|
@@ -202,8 +206,11 @@ export default {
|
|
|
mounted() {
|
|
|
this.$store.commit('home/setImg', null)
|
|
|
this.getRequest('/api/show/pray/getList').then(res => {
|
|
|
- console.log(res, 'getList')
|
|
|
- this.list = res.data
|
|
|
+ this.list = res.data || []
|
|
|
+ this.mycurrent = res.data.findIndex(item => item.id == this.userInfo.id)
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.swiper.slideTo(this.mycurrent, 100, true)
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
@@ -260,6 +267,11 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ slideChanged() {
|
|
|
+ console.log('slideChanged', this.swiper)
|
|
|
+ let active = this.swiper.activeIndex
|
|
|
+ this.mycurrentData = this.list[active]
|
|
|
+ },
|
|
|
// 获取标题区域宽度,和每个子元素节点的宽度以及元素距离左边栏的距离
|
|
|
getScrollW() {
|
|
|
const query = uni.createSelectorQuery().in(this)
|