From b62e2ee2e487664c53c6af6504913ea7b2926e29 Mon Sep 17 00:00:00 2001
From: wangsongsole
Date: Fri, 30 Jun 2023 11:44:58 +0800
Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20style:=20=E7=BA=A2=E5=8C=85?=
=?UTF-8?q?=E6=A8=A1=E6=9D=BF=E9=87=91=E9=A2=9D=E5=8A=A8=E6=80=81=E8=AE=A1?=
=?UTF-8?q?=E7=AE=97=E5=A4=A7=E5=B0=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/redPackets/index.less | 11 ++++++--
src/components/redPackets/mobileComponent.jsx | 28 +++++++++++++++++--
2 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/src/components/redPackets/index.less b/src/components/redPackets/index.less
index 064302a2..dc95f0c9 100644
--- a/src/components/redPackets/index.less
+++ b/src/components/redPackets/index.less
@@ -88,15 +88,20 @@
.money {
font-weight: bold;
color: #FE0F0B;
- font-size: 30px;
- top: 31%;
+ font-size: 40px;
+ top: 29.5%;
position: absolute;
width: 100%;
- text-align: center;
+ height: 42px;
+ display: flex;
+ align-items: flex-end;
+ justify-content: center;
}
.tag {
font-size: 16px;
+ display: inline-block;
+ margin-bottom: 4px;
}
.available_time {
diff --git a/src/components/redPackets/mobileComponent.jsx b/src/components/redPackets/mobileComponent.jsx
index d0bff497..54077206 100644
--- a/src/components/redPackets/mobileComponent.jsx
+++ b/src/components/redPackets/mobileComponent.jsx
@@ -9,6 +9,28 @@ export default ({ data }) => {
setNewWeek(sortWeeks(data.receive_rule.week))
}, [data.receive_rule.week, data.receive_irregular])
+ /* 动态font */
+ function fonts() {
+ const { cash_amount_type, min_denomination, max_denomination } = data
+ const defaultCss = { b: "20px", a: "40px" }
+ if (cash_amount_type === "2") {
+ const count =
+ String(parseFloat(min_denomination)).length +
+ String(parseFloat(max_denomination)).length +
+ 1
+ if (count > 6) {
+ return {
+ a: 32 - (count - 6) * 1.1 + "px",
+ b: 20 - (count - 6) + "px"
+ }
+ } else {
+ return defaultCss
+ }
+ } else {
+ return defaultCss
+ }
+ }
+
function createElement() {
if (data.receive_type === 1) {
return (
@@ -76,8 +98,10 @@ export default ({ data }) => {
{data.effect_date[1] || "2023-12-30 23:59:59"}
-
- ¥
+
+
+ ¥
+
{data.cash_amount_type === "1"
? parseFloat(data.denomination || 0.01)
: `${parseFloat(data.min_denomination || 0.01)}~${parseFloat(