72 lines
2.3 KiB
Swift
72 lines
2.3 KiB
Swift
//
|
|
// ScenicPromotionHeaderView.swift
|
|
// suixinkan
|
|
//
|
|
// Created by Codex on 2026/7/2.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
/// 宣传页顶部标题、说明文案和二维码入口。
|
|
struct ScenicPromotionHeaderView: View {
|
|
let board: ScenicPromotionBoard
|
|
let onQRCodeTap: () -> Void
|
|
let onQRCodeLongPress: () -> Void
|
|
|
|
var body: some View {
|
|
ZStack(alignment: .topTrailing) {
|
|
VStack(spacing: 7) {
|
|
Text("\(board.scenicName) · 排队导览")
|
|
.font(.system(size: 26, weight: .heavy))
|
|
.foregroundStyle(Color(hex: 0x0E3F91))
|
|
.multilineTextAlignment(.center)
|
|
.minimumScaleFactor(0.72)
|
|
.lineLimit(1)
|
|
.shadow(color: .white.opacity(0.55), radius: 0, x: 0, y: 2)
|
|
|
|
HStack(spacing: 12) {
|
|
Rectangle()
|
|
.fill(Color(hex: 0x2F80ED, alpha: 0.35))
|
|
.frame(width: 36, height: 1)
|
|
Text(board.subtitle)
|
|
.font(.system(size: 13, weight: .semibold))
|
|
.foregroundStyle(Color(hex: 0x1D5DA8))
|
|
Rectangle()
|
|
.fill(Color(hex: 0x2F80ED, alpha: 0.35))
|
|
.frame(width: 36, height: 1)
|
|
}
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
.padding(.top, 8)
|
|
.padding(.horizontal, 62)
|
|
|
|
Button(action: onQRCodeTap) {
|
|
ScenicPromotionQRCodeView()
|
|
.frame(width: 56, height: 56)
|
|
.padding(5)
|
|
.background(.white, in: RoundedRectangle(cornerRadius: 9))
|
|
.shadow(color: Color(hex: 0x0D47A1, alpha: 0.16), radius: 10, y: 4)
|
|
}
|
|
.buttonStyle(.plain)
|
|
.simultaneousGesture(
|
|
LongPressGesture(minimumDuration: 0.7)
|
|
.onEnded { _ in onQRCodeLongPress() }
|
|
)
|
|
.accessibilityLabel("二维码设置入口")
|
|
}
|
|
.frame(height: 96)
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
#Preview("顶部标题区") {
|
|
ScenicPromotionHeaderView(
|
|
board: ScenicPromotionPreviewSupport.sampleBoard,
|
|
onQRCodeTap: {},
|
|
onQRCodeLongPress: {}
|
|
)
|
|
.padding(.horizontal, 20)
|
|
.background(ScenicPromotionSkyBackground())
|
|
}
|
|
#endif
|