Skip to content

Commit d76ea52

Browse files
committed
增加车票背景
1 parent 3a9f5d9 commit d76ea52

File tree

2 files changed

+37
-14
lines changed

2 files changed

+37
-14
lines changed
64.6 KB
Loading

package/website/src/components/TrainTicket.vue

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
>
1515
<div
1616
class="ticket relative text-[32px] text-gray-800 w-full h-full rounded-[14px] shadow-[0_6px_24px_rgba(0,0,0,.12),0_2px_6px_rgba(0,0,0,.08)] border border-[#b8cfe0] overflow-hidden p-[5px_65px_0_50px]"
17-
role="img"
17+
role="img"
1818
aria-label="火车票">
1919

2020
<!-- 顶部:票号/检票口 -->
@@ -24,33 +24,48 @@
2424
</div>
2525

2626
<div class="bgmain">
27+
<div
28+
class="absolute inset-0 z-[-2] opacity-5 bg-bottom bg-no-repeat bg-contain"
29+
:style="{ backgroundImage: 'url(/CRH-Dr3OhT7q.jpg)' }"
30+
></div>
2731
<div class="h-[250px]">
2832
<!-- 主信息:出发站 / 车次 / 到达站 -->
29-
<div class="main grid grid-cols-[1fr_auto_1fr] gap-[10px] px-[0px_40px_0_20px]">
30-
<div class="station from items-center">
31-
<div class="flex items-end flex-grow-0">
33+
<div class="main grid grid-cols-[1fr_auto_1fr] gap-[10px] px-[0px_40px_0_20px] items-center">
34+
<div class="station flex flex-col from items-center">
35+
<div class="flex items-center flex-grow-0">
3236
<div
3337
class="name text-[45px] tracking-[0.5px] max-w-[240px]"
3438
:class="{'two-char': fromStation.length === 2}"
3539
>
3640
{{ fromStation }}
3741
</div>
38-
<div class="big-fix px-[4px] py-[0px] text-[40px] self-start">站</div>
42+
<div class="big-fix px-[4px] py-[0px] text-[35px]">站</div>
3943
</div>
40-
<div class="pinyin ml-[10px] text-[24px] text-[#3a5874]">{{ fromPinyin }}</div>
44+
<div class="pinyin ml-[10px] text-[24px]">{{ fromPinyin }}</div>
4145
</div>
42-
<div class="train-code text-center text-[50px] pb-0 flex items-center justify-center">{{ trainCode }}</div>
43-
<div class="station to items-center">
44-
<div class="flex items-end flex-grow-0">
46+
<!-- 中间列:车次 + 箭头 -->
47+
<div class="train-center flex flex-col items-center justify-center">
48+
<div class="train-code text-center text-[50px] leading-none pb-1">
49+
{{ trainCode }}
50+
</div>
51+
<!-- 箭头 -->
52+
<!-- CSS 箭头 -->
53+
<div class="arrow mt-[6px] relative h-3 w-full">
54+
<div class="line h-[4px] bg-gray-600 w-full"></div>
55+
<div class="arrow-head absolute right-0 top-[-7px] h-4 w-4 border-t-[4px] border-gray-600 rotate-45"></div>
56+
</div>
57+
</div>
58+
<div class="station to flex flex-col items-center">
59+
<div class="flex items-center flex-grow-0">
4560
<div
4661
class="name text-[45px] tracking-[0.5px] max-w-[240px]"
4762
:class="{'two-char': toStation.length === 2}"
4863
>
4964
{{ toStation }}
5065
</div>
51-
<div class="big-fix px-[4px] py-[0px] text-[40px] self-start">站</div>
66+
<div class="big-fix px-[4px] py-[0px] text-[35px]">站</div>
5267
</div>
53-
<div class="pinyin ml-[10px] text-[24px] text-[#3a5874]">{{ toPinyin }}</div>
68+
<div class="pinyin ml-[10px] text-[24px]">{{ toPinyin }}</div>
5469
</div>
5570
</div>
5671

@@ -208,22 +223,30 @@ defineExpose({ wrapper, exporting }) // ✅ 暴露内部DOM给父组件访问
208223
}
209224
210225
/* 背景图 */
211-
.bgmain::before {
226+
/* .bgmain::before {
212227
content: "";
213228
position: absolute;
214229
inset: 0;
215230
z-index: -2;
216231
opacity: 0.05;
217-
background-image: url('./CRH-Dr3OhT7q.jpg');
232+
background-image: url('/CRH-Dr3OhT7q.jpg');
218233
background-size: contain;
219234
background-repeat: no-repeat;
220235
background-position: bottom;
221-
}
236+
} */
222237
223238
/* 两字站名样式 */
224239
.two-char {
225240
min-width: 145px;
226241
text-align: justify;
227242
text-align-last: justify;
228243
}
244+
.train-arrow {
245+
width: 100%; /* 与“G2025”文字宽度完全一致 */
246+
height: 0;
247+
border-left: 8px solid transparent; /* 左透明边框(数值越小箭头越细) */
248+
border-right: 8px solid transparent; /* 右透明边框(与左边数值一致) */
249+
border-top: 8px solid #3a5874; /* 箭头颜色(与拼音同色) */
250+
margin-top: 6px; /* 箭头与文字的间距(可按需调整) */
251+
}
229252
</style>

0 commit comments

Comments
 (0)