Commit 1f52f729 authored by Xuguangxing's avatar Xuguangxing

Merge branch 'feat/group-buy' of git.quantgroup.cn:ui/group-buy-ui into feat/group-buy

parents b3fd7aab ea33a91a
...@@ -48,18 +48,17 @@ export default { ...@@ -48,18 +48,17 @@ export default {
const autoplay = isLoop ? { delay: 3000 } : false; const autoplay = isLoop ? { delay: 3000 } : false;
return { return {
timer: null, timer: null,
interTimer: null,
isLoop, isLoop,
isAddClass: false, isAddClass: false,
rightImgPath: '', rightImgPath: '',
leftImgPath: '', leftImgPath: '',
avatorItem: null,
defaultImg: 'https://himg.bdimg.com/sys/portraitn/item/19e96973556e646566696e6564d8bcc080', defaultImg: 'https://himg.bdimg.com/sys/portraitn/item/19e96973556e646566696e6564d8bcc080',
swiperOptions: { swiperOptions: {
loop: isLoop, loop: isLoop,
initialSlide: 0, initialSlide: 0,
slidesPerView: 9, slidesPerView: 9,
// spaceBetween: 4, // spaceBetween: 4,
// cssMode: true,
speed: 800, speed: 800,
centeredSlides: isLoop, centeredSlides: isLoop,
centeredSlidesBounds: true, centeredSlidesBounds: true,
...@@ -73,7 +72,6 @@ export default { ...@@ -73,7 +72,6 @@ export default {
const activeIndex = this.activeIndex; const activeIndex = this.activeIndex;
const slideLeft = this.slides.eq(activeIndex - 5); const slideLeft = this.slides.eq(activeIndex - 5);
const slideRight = this.slides.eq(activeIndex + 4); const slideRight = this.slides.eq(activeIndex + 4);
vm.avatorItem = vm.getAvatorItem(slideRight);
vm.leftImgPath = slideLeft.data('src'); vm.leftImgPath = slideLeft.data('src');
vm.rightImgPath = slideRight.data('src'); vm.rightImgPath = slideRight.data('src');
slideLeft.addClass('ani-opt'); slideLeft.addClass('ani-opt');
...@@ -81,7 +79,7 @@ export default { ...@@ -81,7 +79,7 @@ export default {
vm.isAddClass = true; vm.isAddClass = true;
clearTimeout(vm.timer); clearTimeout(vm.timer);
vm.timer = setTimeout(() => { vm.timer = setTimeout(() => {
vm.$store.dispatch('goods_avator_info', { ...vm.avatorItem, showInfo: true }); vm.oneTransLate(vm.getAvatorItem(slideRight));
clearTimeout(vm.timer); clearTimeout(vm.timer);
}, 1000); }, 1000);
}, },
...@@ -102,34 +100,43 @@ export default { ...@@ -102,34 +100,43 @@ export default {
} }
}, },
mounted() { mounted() {
if (!this.isLoop) { const avatorData = this.avatorData;
this.oneTransLate(); if (!this.isLoop && avatorData.length) {
this.startTimeoutAvatar(avatorData);
} }
}, },
beforeDestroy() { beforeDestroy() {
this.$store.dispatch('goods_avator_info', { showInfo: false }); this.$store.dispatch('goods_avator_info', { showInfo: false });
clearTimeout(this.timer); clearTimeout(this.timer);
clearInterval(this.interTimer);
}, },
methods: { methods: {
oneTransLate() { oneTransLate(avatorItem) {
const avatorData = this.avatorData; this.$store.dispatch('goods_avator_info', {
const imgItem = avatorData[avatorData.length - 1]; ...{ src: avatorItem.avatar, name: avatorItem.name },
const lastItem = { src: imgItem.avatar, name: imgItem.name, showInfo: true }; showInfo: true
this.$store.dispatch('goods_avator_info', lastItem); });
}, },
// setTranslate() {
// const slides = this.swiper.slides;
// for (let i = 0; i < slides.length; i++) {
// const slide = slides.eq(i);
// const progress = slides[i].progress;
// slide.css('transform', `scale(${1 - Math.abs(progress) / 17}`);
// }
// },
getAvatorItem(ele) { getAvatorItem(ele) {
return { return {
src: ele.data('src') || '', src: ele.data('src') || '',
name: ele.data('name') || '' name: ele.data('name') || ''
}; };
},
startTimeoutAvatar(avatorData) {
const avatorLength = avatorData.length - 1;
let count = avatorLength;
this.oneTransLate(avatorData[count]);
this.interTimer = setInterval(() => {
count--;
this.swiperOptions.on.slideChangeTransitionStart();
if (count < 0) count = avatorLength;
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.oneTransLate(avatorData[count]);
clearTimeout(this.timer);
}, 800);
}, 3000);
} }
} }
}; };
......
...@@ -227,7 +227,6 @@ export default { ...@@ -227,7 +227,6 @@ export default {
}); });
}, },
appShareEventChange() { appShareEventChange() {
alert(JSON.stringify(this.shareInfo.imgUrl));
const { title, desc, link, imgUrl, posterUrl } = this.shareInfo; const { title, desc, link, imgUrl, posterUrl } = this.shareInfo;
// 进行App分享 // 进行App分享
const data = { const data = {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<div v-if="isLoop" class="avator_right avator-swiper_item"> <div v-if="isLoop" class="avator_right avator-swiper_item">
<img :src="rightImgPath" /> <img :src="rightImgPath" />
</div> </div>
<span class="avator-swiper-bg" :style="{ backgroundColor: bgColor }">&nbsp;</span> <span class="avator-swiper-bg" :style="{ backgroundColor: bgColor }" />
</div> </div>
</template> </template>
<script> <script>
...@@ -48,18 +48,17 @@ export default { ...@@ -48,18 +48,17 @@ export default {
const autoplay = isLoop ? { delay: 1500, reverseDirection: true } : false; const autoplay = isLoop ? { delay: 1500, reverseDirection: true } : false;
return { return {
timer: null, timer: null,
interTimer: null,
isLoop, isLoop,
isAnimate: false, isAnimate: false,
leftImgPath: '', leftImgPath: '',
rightImgPath: '', rightImgPath: '',
avatorItem: null,
defaultImg: 'https://himg.bdimg.com/sys/portraitn/item/19e96973556e646566696e6564d8bcc080', defaultImg: 'https://himg.bdimg.com/sys/portraitn/item/19e96973556e646566696e6564d8bcc080',
swiperOptions: { swiperOptions: {
loop: isLoop, loop: isLoop,
loopAdditionalSlides: 2,
initialSlide: 0, initialSlide: 0,
slidesPerView: 7, slidesPerView: 7,
// spaceBetween: 8,
// cssMode: true,
speed: 600, speed: 600,
centeredSlides: isLoop, centeredSlides: isLoop,
centeredSlidesBounds: true, centeredSlidesBounds: true,
...@@ -73,7 +72,6 @@ export default { ...@@ -73,7 +72,6 @@ export default {
const activeIndex = this.activeIndex, const activeIndex = this.activeIndex,
slideLeft = this.slides.eq(activeIndex - 3), slideLeft = this.slides.eq(activeIndex - 3),
slideRight = this.slides.eq(activeIndex + 4); slideRight = this.slides.eq(activeIndex + 4);
vm.avatorItem = vm.getAvatorItem(slideLeft);
vm.isAnimate = true; vm.isAnimate = true;
vm.rightImgPath = slideRight.data('src'); vm.rightImgPath = slideRight.data('src');
vm.leftImgPath = slideLeft.data('src'); vm.leftImgPath = slideLeft.data('src');
...@@ -81,7 +79,7 @@ export default { ...@@ -81,7 +79,7 @@ export default {
slideRight.addClass('ani-opt'); slideRight.addClass('ani-opt');
clearTimeout(vm.timer); clearTimeout(vm.timer);
vm.timer = setTimeout(() => { vm.timer = setTimeout(() => {
vm.$emit('animation-event-end', vm.avatorItem); vm.oneTransLate(vm.getAvatorItem(slideLeft));
clearTimeout(vm.timer); clearTimeout(vm.timer);
}, 800); }, 800);
}, },
...@@ -102,23 +100,39 @@ export default { ...@@ -102,23 +100,39 @@ export default {
} }
}, },
mounted() { mounted() {
if (!this.isLoop) { const avatorData = this.avatorData;
this.oneTransLate(); if (!this.isLoop && avatorData.length) {
this.startTimeoutAvatar(avatorData);
} }
}, },
destroyed() { destroyed() {
clearTimeout(this.timer); clearTimeout(this.timer);
clearInterval(this.interTimer);
}, },
methods: { methods: {
oneTransLate() { oneTransLate(fristItem) {
const [fristItem] = this.avatorData;
this.$emit('animation-event-end', { src: fristItem.avatar, name: fristItem.name }); this.$emit('animation-event-end', { src: fristItem.avatar, name: fristItem.name });
}, },
getAvatorItem(ele) { getAvatorItem(ele) {
return { return {
src: ele.data('src'), avatar: ele.data('src'),
name: ele.data('name') name: ele.data('name')
}; };
},
startTimeoutAvatar(avatorData) {
const avatorLength = avatorData.length;
let count = 0;
this.oneTransLate(avatorData[count]);
this.interTimer = setInterval(() => {
count++;
this.swiperOptions.on.slideChangeTransitionStart();
if (count >= avatorLength) count = 0;
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.oneTransLate(avatorData[count]);
clearTimeout(this.timer);
}, 800);
}, 2000);
} }
} }
}; };
......
...@@ -312,13 +312,32 @@ async function getActivityList(urlQuery, next) { ...@@ -312,13 +312,32 @@ async function getActivityList(urlQuery, next) {
t = await computedTemplate(t); t = await computedTemplate(t);
t.groupBuyUserInfoList = (t.groupBuyUserInfoList || []).reverse(); t.groupBuyUserInfoList = (t.groupBuyUserInfoList || []).reverse();
// t.groupBuyUserInfoList = [ // t.groupBuyUserInfoList = [
// { avatar: 'https://avatar.q-gp.com/14612340001/ee8991d0-1d38-11ec-b6f6-bf45b18f0626' },
// { // {
// name: '皱眉',
// avatar: // avatar:
// 'https://thirdwx.qlogo.cn/mmopen/vi_32/LF7hK1yuMnxUAnx4YmjPyJCn0WqwVMplgTnDSBwwOib5uHP9fQazPf7xRXCUNEfI8sicf7boaCNoD2NUss2k7jFg/132' // 'https://img.lkbang.net/avator/0c8c1cfeb1cfdfffd77ac74af83377a17812a3585027-OKt5j9_fw658.jpeg'
// },
// {
// name: '空白人生',
// avatar:
// 'https://img.lkbang.net/avator/e684de0d4db0fcd3a04945ff7ed394abb678ce577dba5-VJbncW_fw658.jpeg'
// },
// {
// name: '逅黄昏',
// avatar:
// 'https://img.lkbang.net/avator/900b3be08740dbe4e38f7c3b7a73b613538a2f2edac3-yXzWfB_fw658.jpeg'
// },
// {
// name: '桑过后正年轻',
// avatar:
// 'https://img.lkbang.net/avator/7ca48321827385f386d0317a40d3f6201f442fddf99a-xXvv37_fw658.jpeg'
// },
// {
// name: '年少就是不服输',
// avatar:
// 'https://img.lkbang.net/avator/e33db7b617e42367d888e3821e1acd89b4b20319cb42-esiOS3_fw658.jpeg'
// } // }
// ]; // ];
// store.dispatch('save_openlink_host', t.openLink);
store.commit('CHANGE_TITLE', t.title || '活动页'); store.commit('CHANGE_TITLE', t.title || '活动页');
nextFns(vm => { nextFns(vm => {
// topicIndex = 0; // topicIndex = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment