Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
0e8b5314
Commit
0e8b5314
authored
Mar 16, 2020
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
点赞功能
parent
04ff84cd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
25 deletions
+126
-25
src/components/livedModel/livedControls.vue
+126
-25
No files found.
src/components/livedModel/livedControls.vue
View file @
0e8b5314
...
...
@@ -7,18 +7,21 @@
<!-- 底部控制层 -->
<div
class=
"control flex"
>
<div
class=
"goodsImg"
>
<img
src=
"../../../static/images/lived/goodsImg.png"
alt=
""
>
<img
src=
"../../../static/images/lived/goodsImg.png"
alt
/
>
<p
class=
"goodsNum"
>
99
</p>
</div>
<div
class=
"iptCopy"
>
跟主播说点什么...
</div>
<div
class=
"iptCopy"
>
跟主播说点什么...
</div>
<div
class=
"shareIcon"
>
<van-icon
name=
"share"
/>
</div>
<div
class=
"heardIcon"
>
<van-icon
name=
"like"
class=
"like"
/>
<p
class=
"heardNum"
>
99.9w
</p>
<div
class=
"heardIcon"
@
click=
"addLike(1)"
>
<van-icon
name=
"like"
class=
"like"
/>
<p
class=
"heardNum"
>
{{
likeNumCopy
}}
</p>
<div
class=
"box"
>
<div
class=
"img"
v-for=
"(item,index) in imgList"
:key=
"index"
>
<img
:src=
"item.img"
alt
/>
</div>
</div>
</div>
</div>
</div>
...
...
@@ -30,38 +33,87 @@ import livedIsMsg from "@/components/livedModel/livedIsMsg";
export
default
{
name
:
""
,
data
()
{
return
{}
return
{
likeNum
:
9997
,
//点赞数
imgList
:
[],
iconList
:
[
"https://img3.imgtn.bdimg.com/it/u=3743111107,1940472030&fm=11&gp=0.jpg"
,
"https://img0.imgtn.bdimg.com/it/u=216605226,3652567530&fm=11&gp=0.jpg"
,
"https://img3.imgtn.bdimg.com/it/u=3743111107,1940472030&fm=11&gp=0.jpg"
,
"https://img2.imgtn.bdimg.com/it/u=1354268575,1268995723&fm=26&gp=0.jpg"
],
num
:
0
};
},
components
:
{
livedAnnouncement
,
livedIsMsg
},
computed
:
{},
computed
:
{
likeNumCopy
()
{
return
this
.
watchMan
(
this
.
likeNum
);
}
},
created
()
{},
mounted
()
{},
methods
:
{}
}
mounted
()
{
setInterval
(()
=>
{
this
.
getAdd
();
},
5000
);
},
methods
:
{
// 数量大于1w
watchMan
(
val
)
{
return
val
-
0
>
10000
?
Math
.
floor
(
val
/
10000
*
100
)
/
100
+
"w"
:
val
;
},
// 点赞
addLike
(
val
)
{
if
(
val
==
1
)
{
this
.
likeNum
++
;
}
setTimeout
(()
=>
{
this
.
num
++
;
if
(
this
.
num
>=
4
)
{
this
.
num
=
0
;
}
this
.
imgList
.
push
({
img
:
this
.
iconList
[
this
.
num
]
});
},
300
);
},
// 接口获取触发点赞
getAdd
()
{
if
(
this
.
imgList
.
length
>
20
)
{
this
.
imgList
=
[];
}
for
(
let
i
=
0
;
i
<
this
.
iconList
.
length
;
i
++
)
{
setTimeout
(()
=>
{
this
.
addLike
(
2
);
},
200
*
i
);
}
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.flex
{
.flex
{
display
:
flex
;
}
.livedControls
{
.livedControls
{
position
:
absolute
;
bottom
:
10px
;
left
:
0
;
width
:
100vw
;
.control{
.control
{
height
:
40px
;
align-items
:
center
;
justify-content
:
space-around
;
padding
:
0
12px
;
.goodsImg{
.goodsImg
{
width
:
30px
;
height
:
30px
;
position
:
relative
;
img{
img
{
width
:
30px
;
height
:
30px
;
position
:
absolute
;
...
...
@@ -69,17 +121,17 @@ export default {
left
:
0
;
z-index
:
-1
;
}
.goodsNum
{
.goodsNum
{
color
:
#fff
;
font-size
:
14px
;
text-align
:
center
;
margin-top
:
10px
;
}
}
.iptCopy
{
.iptCopy
{
margin
:
0
10px
;
width
:
50vw
;
background
:
rgba
(
#000
,
0.4
);
background
:
rgba
(
#000
,
0.4
);
color
:
#999
;
font-size
:
16px
;
height
:
38px
;
...
...
@@ -87,27 +139,76 @@ export default {
line-height
:
38px
;
text-indent
:
1em
;
}
.shareIcon
,
.heardIcon
{
.shareIcon
,
.heardIcon
{
color
:
#fff
;
font-size
:
30px
;
position
:
relative
;
width
:
50px
;
height
:
30px
;
}
.heardIcon
{
.like{
.heardIcon
{
.like
{
position
:
absolute
;
top
:
0
;
left
:
20%
;
}
.heardNum
{
.heardNum
{
text-align
:
center
;
transform
:
translateY
(
-5px
);
background
:
rgba
(
#
E60012
,
0.5
);
background
:
rgba
(
#
e60012
,
0.5
);
border-radius
:
4px
;
padding
:
1px
2px
;
font-size
:
12px
;
}
.box
{
width
:
100px
;
height
:
260px
;
position
:
absolute
;
overflow
:
hidden
;
bottom
:
0
;
right
:
-30px
;
.img
{
position
:
absolute
;
bottom
:
0
;
left
:
50%
;
margin-left
:
-20px
;
width
:
40px
;
height
:
40px
;
animation
:
moveImg
1.5s
linear
0.1s
;
opacity
:
0
;
border-radius
:
50%
;
overflow
:
hidden
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
img
{
width
:
40px
;
height
:
40px
;
}
}
@keyframes
moveImg
{
0
%
{
opacity
:
1
;
}
20
%
{
transform
:
translateY
(
-40px
)
translateX
(
-5px
)
scale
(
1
);
}
40
%
{
transform
:
translateY
(
-80px
)
translateX
(
0
)
scale
(
1
);
}
60
%
{
transform
:
translateY
(
-120px
)
translateX
(
0
)
scale
(
1
);
}
80
%
{
transform
:
translateY
(
-160px
)
translateX
(
5px
)
scale
(
1
);
}
100
%
{
opacity
:
0
;
transform
:
translateY
(
-200px
)
translateX
(
0
)
scale
(
1
);
}
}
}
}
}
}
...
...
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