Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
group-buy-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
group-buy-ui
Commits
57a031df
Commit
57a031df
authored
Sep 13, 2021
by
beisir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:百人团0元购列表页面 轮播头像效果
parent
0e18d1bf
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
189 additions
and
32 deletions
+189
-32
groupBuy.js
src/api/groupBuy.js
+5
-0
groupSwiper.vue
src/components/groupSwiper.vue
+144
-0
groupBuy.js
src/router/groupBuy.js
+0
-2
index.less
src/views/goodsList/index.less
+2
-16
index.vue
src/views/goodsList/index.vue
+38
-14
No files found.
src/api/groupBuy.js
View file @
57a031df
...
@@ -22,5 +22,10 @@ export default {
...
@@ -22,5 +22,10 @@ export default {
return
http
.
get
(
`http://yapi.quantgroups.com/mock/479/goods/group-list`
,
data
,
{
return
http
.
get
(
`http://yapi.quantgroups.com/mock/479/goods/group-list`
,
data
,
{
hideLoading
:
true
hideLoading
:
true
});
});
},
getGroupAvator
(
data
)
{
return
http
.
get
(
`http://yapi.quantgroups.com/mock/479/goods/getAvator`
,
data
,
{
hideLoading
:
true
});
}
}
};
};
src/components/groupSwiper.vue
0 → 100644
View file @
57a031df
<
template
>
<div
class=
"avator-swiper"
@
click=
"onSlidePrevChange"
>
<swiper
ref=
"mySwiper"
:options=
"swiperOptions"
class=
"avator-swiper_container"
>
<!-- @slide-change="slideChange"
@set-translate="setTranslate" -->
<swiper-slide
v-for=
"(item, index) in avatorData"
:key=
"index"
class=
"avator-swiper_item"
>
<div
class=
"avator-swiper_item"
>
<img
:src=
"item"
/>
</div>
</swiper-slide>
</swiper>
<div
class=
"avator-swiper_right"
>
<cr-image
class=
"avator-swiper_item"
:src=
"leftImgPath"
/>
</div>
</div>
</
template
>
<
script
>
import
{
swiper
,
swiperSlide
}
from
'
vue-awesome-swiper
'
;
import
'
swiper/dist/css/swiper.css
'
;
export
default
{
name
:
'
AvatorSwiper
'
,
components
:
{
swiper
,
swiperSlide
},
props
:
{
avatorData
:
{
type
:
Array
,
default
()
{
return
[];
}
}
},
data
()
{
const
vm
=
this
;
return
{
activeIndex
:
0
,
leftImgPath
:
''
,
rightImgPath
:
''
,
swiperOptions
:
{
loop
:
true
,
initialSlide
:
0
,
slidesPerView
:
7
,
spaceBetween
:
4
,
speed
:
1100
,
centeredSlides
:
true
,
watchSlidesProgress
:
true
,
allowTouchMove
:
false
,
autoplay
:
false
,
// autoplay: {
// delay: 900,
// stopOnLastSlide: false,
// disableOnInteraction: false
// }
on
:
{
init
:
function
()
{
let
slideLeft
=
this
.
slides
.
eq
(
this
.
activeIndex
-
3
);
slideLeft
.
addClass
(
'
ani-left
'
);
},
transitionStart
:
function
()
{
let
slideLeft
=
this
.
slides
.
eq
(
this
.
activeIndex
-
3
);
let
slideRight
=
this
.
slides
.
eq
(
this
.
activeIndex
+
4
);
slideLeft
.
addClass
(
'
ani-left
'
);
slideRight
.
addClass
(
'
ani-right
'
);
vm
.
leftImgPath
=
slideRight
.
find
(
'
img
'
).
attr
(
'
src
'
);
},
transitionEnd
:
function
()
{
for
(
let
i
=
0
;
i
<
this
.
slides
.
length
;
i
++
)
{
let
slide
=
this
.
slides
.
eq
(
i
);
slide
.
removeClass
(
'
ani-left
'
);
slide
.
removeClass
(
'
ani-right
'
);
}
}
}
}
};
},
computed
:
{
swiper
()
{
return
this
.
$refs
.
mySwiper
.
swiper
;
}
},
watch
:
{
avatorData
()
{
this
.
onSlidePrevChange
();
}
},
methods
:
{
onSlidePrevChange
()
{
this
.
swiper
.
slidePrev
();
}
}
};
</
script
>
<
style
lang=
"less"
>
@keyframes leftToRight {
from {
transform: scale(0.3, 0.3);
opacity: 0;
}
to {
transform: scale(1, 1);
opacity: 1;
}
}
.ani-left {
transform-origin: right;
animation: leftToRight 0.7s linear;
}
@keyframes scaleTo {
to {
opacity: 1;
}
}
.ani-right {
opacity: 0;
// animation: scaleTo 3s ease-out;
}
.avator-swiper {
width: 100%;
margin: 0 auto !important;
position: relative;
&_right {
height: 25px;
width: 25px;
position: absolute;
right: 3px;
top: 2px;
}
&_item {
transition: transform 0.2s linear;
height: 32px;
padding-top: 2px;
img {
height: 25px;
width: 25px;
border-radius: 50%;
}
&.active {
transform: scale(1.2);
}
}
}
</
style
>
src/router/groupBuy.js
View file @
57a031df
...
@@ -39,7 +39,6 @@ module.exports = [
...
@@ -39,7 +39,6 @@ module.exports = [
{
{
path
:
'
/payFail
'
,
path
:
'
/payFail
'
,
name
:
'
payFail
'
,
name
:
'
payFail
'
,
alias
:
[
'
/payFail
'
],
meta
:
{
meta
:
{
title
:
'
支付失败
'
title
:
'
支付失败
'
},
},
...
@@ -48,7 +47,6 @@ module.exports = [
...
@@ -48,7 +47,6 @@ module.exports = [
{
{
path
:
'
/paySuccess
'
,
path
:
'
/paySuccess
'
,
name
:
'
paySuccess
'
,
name
:
'
paySuccess
'
,
alias
:
[
'
/paySuccess
'
],
meta
:
{
meta
:
{
title
:
'
支付成功
'
,
title
:
'
支付成功
'
,
success
:
true
success
:
true
...
...
src/views/goodsList/index.less
View file @
57a031df
.group {
.group {
font-size: @font-size-14;
font-size: @font-size-14;
&-banner {
&-top {
position: relative;
height: 380px;
height: 380px;
.banner-image {
position: absolute;
left: 0;
top: 0;
}
.banner-mark {
width: 40%;
height: 30px;
line-height: 30px;
border-radius: 15px;
color: #fff;
}
}
}
&-bottom {
&-bottom {
...
@@ -54,8 +41,6 @@
...
@@ -54,8 +41,6 @@
padding-right: 8px;
padding-right: 8px;
}
}
.group-portrait {
.group-portrait {
&-head {
&-head {
display: flex;
display: flex;
...
@@ -79,6 +64,7 @@
...
@@ -79,6 +64,7 @@
flex: 1;
flex: 1;
display: flex;
display: flex;
justify-content: space-around;
justify-content: space-around;
overflow: hidden;
}
}
&-image {
&-image {
height: 23px;
height: 23px;
...
...
src/views/goodsList/index.vue
View file @
57a031df
<
template
>
<
template
>
<div
class=
"group"
:style=
"
{ backgroundColor: gpBackColor }">
<div
class=
"group"
:style=
"
{ backgroundColor: gpBackColor }">
<!-- 配置头部动态信息 start -->
<!-- 配置头部动态信息 start -->
<div
class=
"group-
banner
"
>
<div
class=
"group-
top
"
>
<!-- 动态活动背景图 -->
<!-- 动态活动背景图 -->
<cr-image
width=
"100%"
height=
"100%"
class=
"banner-image"
:src=
"gpImagePath"
/>
<cr-image
width=
"100%"
height=
"100%"
class=
"group-top-image"
:src=
"gpImagePath"
/>
<!-- 顶部mark框 -->
<div
class=
"banner-mark"
>
135****8888刚刚获得华为P40
</div>
<!-- 头像列表 -->
<div
class=
"banner-portrait"
/>
<!-- 中间提示 文字 -->
<div
class=
"banner-prompt"
>
已有40万+人拿到商品
</div>
</div>
</div>
<!-- 配置头部动态信息 end -->
<!-- 配置头部动态信息 end -->
...
@@ -22,7 +14,10 @@
...
@@ -22,7 +14,10 @@
<div
class=
"group-portrait-swipe"
@
click=
"switchAnimation"
>
<div
class=
"group-portrait-swipe"
@
click=
"switchAnimation"
>
<swipeCustomerInfo
v-model=
"showSwipe"
/>
<swipeCustomerInfo
v-model=
"showSwipe"
/>
</div>
</div>
<ul
class=
"group-portrait-ul"
:class=
"animate"
>
<div
class=
"group-portrait-ul"
>
<groupSwiper
v-if=
"avatorData.length"
:avator-data=
"avatorData"
/>
</div>
<!--
<ul
class=
"group-portrait-ul"
:class=
"animate"
>
<li
<li
v-for=
"(imgItem, imgIndex) in gpImagePathArray"
v-for=
"(imgItem, imgIndex) in gpImagePathArray"
:key=
"imgIndex"
:key=
"imgIndex"
...
@@ -30,7 +25,7 @@
...
@@ -30,7 +25,7 @@
>
>
<cr-image
:src=
"imgItem"
/>
<cr-image
:src=
"imgItem"
/>
</li>
</li>
</ul>
</ul>
-->
</div>
</div>
<div
class=
"group-portrait-num"
@
click=
"showSwipe = !showSwipe"
>
已有 1230人 参与拼单
</div>
<div
class=
"group-portrait-num"
@
click=
"showSwipe = !showSwipe"
>
已有 1230人 参与拼单
</div>
</div>
</div>
...
@@ -61,15 +56,18 @@ import countDown from '@/components/countDown';
...
@@ -61,15 +56,18 @@ import countDown from '@/components/countDown';
import
swipeCustomerInfo
from
'
@/components/swipeCustomerInfo
'
;
import
swipeCustomerInfo
from
'
@/components/swipeCustomerInfo
'
;
import
gpImagePath
from
'
@/assets/images/groupBuy/bg-top.png
'
;
import
gpImagePath
from
'
@/assets/images/groupBuy/bg-top.png
'
;
import
goodsCard
from
'
./components/goodsCard
'
;
import
goodsCard
from
'
./components/goodsCard
'
;
import
groupSwiper
from
'
@/components/groupSwiper
'
;
export
default
{
export
default
{
// beforeRouteEnter(to, from, next) {
// beforeRouteEnter(to, from, next) {
// next(vm => {});
// next(vm => {});
// },
// },
// eslint-disable-next-line vue/name-property-casing
// eslint-disable-next-line vue/name-property-casing
name
:
'
groupBuyList
'
,
name
:
'
groupBuyList
'
,
components
:
{
countDown
,
swipeCustomerInfo
,
goodsCard
},
components
:
{
countDown
,
swipeCustomerInfo
,
goodsCard
,
groupSwiper
},
data
()
{
data
()
{
return
{
return
{
avatorData
:
[],
animate
:
{
animate
:
{
animateAuto
:
false
,
animateAuto
:
false
,
transition
:
true
,
transition
:
true
,
...
@@ -78,7 +76,7 @@ export default {
...
@@ -78,7 +76,7 @@ export default {
animation
:
false
animation
:
false
},
},
showSwipe
:
tru
e
,
showSwipe
:
fals
e
,
gpImagePath
,
gpImagePath
,
gpBackColor
:
'
#FA494E
'
,
gpBackColor
:
'
#FA494E
'
,
gpImagePathArray
:
[
gpImagePathArray
:
[
...
@@ -101,8 +99,34 @@ export default {
...
@@ -101,8 +99,34 @@ export default {
created
()
{},
created
()
{},
mounted
()
{
mounted
()
{
// todo 曝光埋点
// todo 曝光埋点
this
.
$nextTick
(()
=>
{
// this.avatorTimeSyncChange();
this
.
getAvatorList
();
});
},
},
methods
:
{
methods
:
{
avatorTimeSyncChange
()
{
setInterval
(()
=>
{
this
.
showSwipe
=
false
;
this
.
getAvatorList
();
// clearTimeout(timer);
},
3000
);
},
showSwipeSync
(
avatorData
)
{
let
timer
=
setTimeout
(()
=>
{
this
.
avatorData
=
avatorData
;
this
.
showSwipe
=
true
;
clearTimeout
(
timer
);
},
1000
);
},
async
getAvatorList
()
{
try
{
const
[
data
]
=
await
groupBuyApi
.
getGroupAvator
();
this
.
showSwipeSync
(
data
);
}
catch
(
err
)
{
console
.
log
(
err
);
}
},
switchAnimation
()
{
switchAnimation
()
{
this
.
animate
.
animateAuto
=
!
this
.
animate
.
animateAuto
;
this
.
animate
.
animateAuto
=
!
this
.
animate
.
animateAuto
;
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment