Commit ba700c42 authored by beisir's avatar beisir

feat:修改头像

parent 8493259e
<template> <template>
<div class="avator-swiper"> <div class="avator-swiper">
<div <div v-if="isLoop" ref="refLeft" :class="{ 'ani-left': isAddClass }" class="avator-swiper_left">
v-if="avatorData.length"
ref="refLeft"
:class="{ 'ani-left': isAddClass }"
class="avator-swiper_left"
>
<cr-image class="avator-swiper_small" :src="leftImgPath" /> <cr-image class="avator-swiper_small" :src="leftImgPath" />
</div> </div>
<swiper <swiper ref="mySwiper" :options="swiperOptions" class="avator-swiper_container">
ref="mySwiper"
:options="swiperOptions"
class="avator-swiper_container"
@set-translate="setTranslate"
>
<swiper-slide <swiper-slide
v-for="(item, index) in avatorData" v-for="(item, index) in avatorData"
:key="index" :key="index"
:data-src="item" :data-src="item"
:data-name="item" :data-name="item"
class="avator-swiper_item" class="avator-swiper_item"
@set-translate="setTranslate"
> >
<div class="avator-swiper_item"> <div class="avator-swiper_item">
<img :src="item | Img2Thumb" /> <img :src="item | Img2Thumb" />
...@@ -27,7 +18,7 @@ ...@@ -27,7 +18,7 @@
</swiper-slide> </swiper-slide>
</swiper> </swiper>
<div <div
v-if="avatorData.length" v-if="isLoop"
ref="refRight" ref="refRight"
:class="{ 'ani-right': isAddClass }" :class="{ 'ani-right': isAddClass }"
class="avator-swiper_right" class="avator-swiper_right"
...@@ -59,24 +50,23 @@ export default { ...@@ -59,24 +50,23 @@ export default {
}, },
data() { data() {
const vm = this; const vm = this;
const isLoop = vm.avatorData.length < 9 ? false : true;
const autoplay = isLoop ? { delay: 5000 } : false;
return { return {
isLoop,
isAddClass: false, isAddClass: false,
activeIndex: 0,
rightImgPath: '', rightImgPath: '',
leftImgPath: '', leftImgPath: '',
swiperOptions: { swiperOptions: {
loop: true, loop: isLoop,
initialSlide: 0, initialSlide: 0,
slidesPerView: 9, slidesPerView: 9,
spaceBetween: 4, spaceBetween: 4,
speed: 900, speed: 900,
centeredSlides: true, centeredSlides: isLoop,
watchSlidesProgress: true, watchSlidesProgress: false,
allowTouchMove: false, allowTouchMove: false,
autoplay: { autoplay,
delay: 5000
},
on: { on: {
transitionStart: function() { transitionStart: function() {
const activeIndex = this.activeIndex; const activeIndex = this.activeIndex;
......
...@@ -38,7 +38,8 @@ export default { ...@@ -38,7 +38,8 @@ export default {
}, },
data() { data() {
const vm = this; const vm = this;
const isLoop = vm.avatorData.length < 4 ? false : true; const isLoop = vm.avatorData.length < 7 ? false : true;
const autoplay = isLoop ? { delay: 5000, reverseDirection: true } : false;
return { return {
isLoop, isLoop,
isAnimate: false, isAnimate: false,
...@@ -46,25 +47,22 @@ export default { ...@@ -46,25 +47,22 @@ export default {
rightImgPath: '', rightImgPath: '',
avatorItem: null, avatorItem: null,
swiperOptions: { swiperOptions: {
loop: isLoop, loop: true,
initialSlide: 0, initialSlide: 0,
slidesPerView: 7, slidesPerView: 7,
spaceBetween: 4, spaceBetween: 4,
speed: 1700, speed: 1700,
centeredSlides: false, centeredSlides: true,
allowTouchMove: false, allowTouchMove: false,
autoplay: { autoplay,
delay: 5000,
reverseDirection: true
},
on: { on: {
slideChangeTransitionStart: function() { slideChangeTransitionStart: function() {
vm.$emit('animation-event-start'); vm.$emit('animation-event-start');
}, },
transitionStart: function() { transitionStart: function() {
const activeIndex = this.activeIndex, const activeIndex = this.activeIndex,
slideLeft = this.slides.eq(activeIndex), slideLeft = this.slides.eq(activeIndex - 3),
slideRight = this.slides.eq(activeIndex + 7); slideRight = this.slides.eq(activeIndex + 4);
vm.avatorItem = vm.getAvatorItem(slideLeft); vm.avatorItem = vm.getAvatorItem(slideLeft);
vm.isAnimate = true; vm.isAnimate = true;
vm.rightImgPath = slideRight.data('src'); vm.rightImgPath = slideRight.data('src');
...@@ -92,6 +90,12 @@ export default { ...@@ -92,6 +90,12 @@ export default {
return this.$refs.mySwiper.swiper; return this.$refs.mySwiper.swiper;
} }
}, },
mounted() {
if (!this.isLoop) {
const [fristItem] = this.avatorData;
this.$emit('animation-event-end', { src: fristItem.avatar, name: fristItem.name });
}
},
methods: { methods: {
getAvatorItem(ele) { getAvatorItem(ele) {
return { return {
......
...@@ -10,6 +10,7 @@ const state = { ...@@ -10,6 +10,7 @@ const state = {
isPrimordialBrowser: false, // 是否是原生浏览器 isPrimordialBrowser: false, // 是否是原生浏览器
isWeixinBrowser: false, // 是否是微信浏览器 isWeixinBrowser: false, // 是否是微信浏览器
showShare: false, // 是否打开底部分享showShare showShare: false, // 是否打开底部分享showShare
openLink: '', // 分享中专业链接
shareInfo: {}, // 分享信息 shareInfo: {}, // 分享信息
avatorInfo: {} // 详情页面头像滚动 avatorInfo: {} // 详情页面头像滚动
}; };
...@@ -42,6 +43,9 @@ const actions = { ...@@ -42,6 +43,9 @@ const actions = {
}, },
goods_avator_info({ commit }, info) { goods_avator_info({ commit }, info) {
commit(types.GOODS_AVATOR_INFO, info); commit(types.GOODS_AVATOR_INFO, info);
},
save_openlink_host({ commit }, host) {
commit(types.SAVE_LINK_HOST, host);
} }
}; };
...@@ -114,6 +118,9 @@ const mutations = { ...@@ -114,6 +118,9 @@ const mutations = {
}, },
[types.GOODS_AVATOR_INFO](state, info) { [types.GOODS_AVATOR_INFO](state, info) {
state.avatorInfo = info; state.avatorInfo = info;
},
[types.SAVE_LINK_HOST](state, host) {
state.openLink = host;
} }
}; };
......
...@@ -8,3 +8,4 @@ export const ADD_KEEP_ALIVE = 'ADD_KEEP_ALIVE'; ...@@ -8,3 +8,4 @@ export const ADD_KEEP_ALIVE = 'ADD_KEEP_ALIVE';
export const DEL_KEEP_ALIVE = 'DEL_KEEP_ALIVE'; export const DEL_KEEP_ALIVE = 'DEL_KEEP_ALIVE';
export const CLEAR_KEEP_ALIVE = 'CLEAR_KEEP_ALIVE'; export const CLEAR_KEEP_ALIVE = 'CLEAR_KEEP_ALIVE';
export const GOODS_AVATOR_INFO = 'GOODS_AVATOR_INFO'; export const GOODS_AVATOR_INFO = 'GOODS_AVATOR_INFO';
export const SAVE_LINK_HOST = 'SAVE_LINK_HOST';
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
background-image: linear-gradient(180deg, #ffd545 0%, #ffcc79 100%); background-image: linear-gradient(180deg, #ffd545 0%, #ffcc79 100%);
border-radius: 16px 0 0 16px; border-radius: 16px 0 0 16px;
padding: 6px 12px 6px 16px; padding: 6px 12px 6px 16px;
// padding: 12px 24px 12px 32px; // 线上使用背景遮罩层
} }
&-share { &-share {
display: flex; display: flex;
......
<template> <template>
<!-- 配置活动背景色 --> <!-- 配置活动背景色 -->
<div class="group" :style="{ backgroundColor: goodsTemp.bgcolor }"> <div class="group" :style="{ backgroundColor: goodsTemp.bgcolor }">
<div v-if="!isShowShare" class="group-puzzle" @click="goToMyorder">我的拼团</div> <!-- v-if="!isShowShare" -->
<div class="group-puzzle" @click="goToMyorder">我的拼团</div>
<!-- 配置头部动态信息 start --> <!-- 配置头部动态信息 start -->
<div class="group-top"> <div class="group-top">
<!-- 动态活动背景图 --> <!-- 动态活动背景图 -->
...@@ -312,12 +313,13 @@ async function getActivityList(urlQuery, next) { ...@@ -312,12 +313,13 @@ 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' }, // { avatar: 'https://avatar.q-gp.com/14612340001/ee8991d0-1d38-11ec-b6f6-bf45b18f0626' }
// { // // {
// avatar: // // avatar:
// 'https://thirdwx.qlogo.cn/mmopen/vi_32/LF7hK1yuMnxUAnx4YmjPyJCn0WqwVMplgTnDSBwwOib5uHP9fQazPf7xRXCUNEfI8sicf7boaCNoD2NUss2k7jFg/132' // // 'https://thirdwx.qlogo.cn/mmopen/vi_32/LF7hK1yuMnxUAnx4YmjPyJCn0WqwVMplgTnDSBwwOib5uHP9fQazPf7xRXCUNEfI8sicf7boaCNoD2NUss2k7jFg/132'
// } // // }
// ]; // ];
// 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