Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
groupPurchase-miniapp
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭佳妮(贵阳日报)
groupPurchase-miniapp
Commits
63fe770c
Commit
63fe770c
authored
Aug 06, 2024
by
石建新(贵阳日报)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
评分组件
parent
6f21af0b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
2 deletions
+79
-2
Rating.vue
src/Components/Rating/Rating.vue
+74
-0
shop.vue
src/pages/shop/shop.vue
+5
-2
No files found.
src/Components/Rating/Rating.vue
0 → 100644
View file @
63fe770c
<
template
>
<div
class=
"rating"
>
<div
v-for=
"index in maxStars"
:key=
"index"
class=
"star"
:style=
"
{ fontSize: fontSize }">
<div
class=
"filled"
:style=
"
{
width: getStarWidth(index) + '%',
color: color,
}"
>
★
</div>
★
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
'Rating'
,
props
:
{
score
:
{
type
:
Number
,
required
:
true
,
},
maxStars
:
{
type
:
Number
,
default
:
5
,
},
color
:
{
type
:
String
,
default
:
'#D44118'
,
},
fontSize
:
{
type
:
String
,
default
:
'30rpx'
,
},
},
methods
:
{
getStarWidth
(
index
)
{
const
fullStars
=
Math
.
floor
(
this
.
score
);
const
fraction
=
this
.
score
-
fullStars
;
if
(
index
<=
fullStars
)
{
return
100
;
}
else
if
(
index
===
fullStars
+
1
)
{
return
fraction
*
100
;
}
else
{
return
0
;
}
},
},
};
</
script
>
<
style
scoped
>
.rating
{
display
:
flex
;
}
.star
{
position
:
relative
;
font-size
:
22
rpx
;
color
:
#d3d3d3
;
}
.filled
{
position
:
absolute
;
top
:
0
;
left
:
0
;
height
:
100%
;
overflow
:
hidden
;
}
</
style
>
src/pages/shop/shop.vue
View file @
63fe770c
...
@@ -45,14 +45,15 @@
...
@@ -45,14 +45,15 @@
<text
class=
"tj"
>
推荐
</text>
<text
class=
"tj"
>
推荐
</text>
</view>
</view>
<view
class=
"score-icon"
>
<view
class=
"score-icon"
>
<wd-rate
<
!--
<
wd-rate
color=
"#fff"
color=
"#fff"
readonly
readonly
v-model=
"shopInfo.grade"
v-model=
"shopInfo.grade"
size=
"22rpx"
size=
"22rpx"
space=
"8rpx"
space=
"8rpx"
:active-color=
"['#FA5151']"
:active-color=
"['#FA5151']"
/>
/>
-->
<myRate
:score=
"grade"
/>
</view>
</view>
</view>
</view>
<view
class=
"shop-business-hours"
>
<view
class=
"shop-business-hours"
>
...
@@ -313,7 +314,9 @@ import {
...
@@ -313,7 +314,9 @@ import {
addImgUrlPrefix
,
addImgUrlPrefix
,
navigationSelect
,
navigationSelect
,
}
from
'@/utils/common'
;
}
from
'@/utils/common'
;
import
myRate
from
'@/Components/Rating/Rating.vue'
;
const
imgUrl
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
;
const
imgUrl
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
;
const
grade
=
ref
(
1.8
);
const
current
=
ref
(
0
);
const
current
=
ref
(
0
);
const
old
=
reactive
({
scrollTop
:
0
});
const
old
=
reactive
({
scrollTop
:
0
});
const
activeId
=
ref
(
1
);
const
activeId
=
ref
(
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