From 2f0d487dc4c10a1283693359b29962fab1fcaa0f Mon Sep 17 00:00:00 2001 From: jinyaqiu Date: Thu, 28 Aug 2025 18:23:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=BE=E7=BD=AE=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wake/Assets/Svg/Box.svg | 5 + wake/Assets/Svg/Memory.svg | 5 + wake/Assets/Svg/Pioneer.svg | 14 ++ wake/Assets/Svg/Set.svg | 4 + wake/Assets/Svg/Upload.svg | 10 ++ wake/ContentView.swift | 23 +-- wake/Typography.swift | 2 + wake/View/Components/UserProfileModal.swift | 180 +++++++++++++------- wake/View/Owner/SettingsView.swift | 2 +- wake/WakeApp.swift | 6 +- 10 files changed, 172 insertions(+), 79 deletions(-) create mode 100644 wake/Assets/Svg/Box.svg create mode 100644 wake/Assets/Svg/Memory.svg create mode 100644 wake/Assets/Svg/Pioneer.svg create mode 100644 wake/Assets/Svg/Set.svg create mode 100644 wake/Assets/Svg/Upload.svg diff --git a/wake/Assets/Svg/Box.svg b/wake/Assets/Svg/Box.svg new file mode 100644 index 0000000..96b0be1 --- /dev/null +++ b/wake/Assets/Svg/Box.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/wake/Assets/Svg/Memory.svg b/wake/Assets/Svg/Memory.svg new file mode 100644 index 0000000..82264f9 --- /dev/null +++ b/wake/Assets/Svg/Memory.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/wake/Assets/Svg/Pioneer.svg b/wake/Assets/Svg/Pioneer.svg new file mode 100644 index 0000000..adfded9 --- /dev/null +++ b/wake/Assets/Svg/Pioneer.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/wake/Assets/Svg/Set.svg b/wake/Assets/Svg/Set.svg new file mode 100644 index 0000000..f60210e --- /dev/null +++ b/wake/Assets/Svg/Set.svg @@ -0,0 +1,4 @@ + + + + diff --git a/wake/Assets/Svg/Upload.svg b/wake/Assets/Svg/Upload.svg new file mode 100644 index 0000000..ad296f7 --- /dev/null +++ b/wake/Assets/Svg/Upload.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/wake/ContentView.swift b/wake/ContentView.swift index e66f3e6..3ff2cc5 100644 --- a/wake/ContentView.swift +++ b/wake/ContentView.swift @@ -169,7 +169,8 @@ struct ContentView: View { LoginView() } } - .padding(.horizontal) + .padding() + .padding(.top, 20) // 标题 VStack(alignment: .leading, spacing: 4) { Text("Hi! Click And") @@ -194,19 +195,11 @@ struct ContentView: View { // 2. Lottie动画层 if showLottieAnimation { - LottieView(name: "loading", loopMode: .loop) - .frame(width: 200, height: 200) - .position(x: UIScreen.main.bounds.width / 2, - y: UIScreen.main.bounds.height * 0.325) - .onAppear { - // 5秒后隐藏Lottie动画并显示视频 - DispatchQueue.main.asyncAfter(deadline: .now() + 5) { - withAnimation { - showLottieAnimation = false - showVideoPlayer = true - } - } - } + GIFView(name: "Blind") { + // 点击事件处理 + Router.shared.navigate(to: .blindBox(mediaType: .video)) + } + .frame(width: 300, height: 300) } // 3. 视频播放器 @@ -288,7 +281,7 @@ struct ContentView: View { for (index, item) in login.enumerated() { print("记录 \(index + 1): 邮箱=\(item.email), 姓名=\(item.name)") } -// showModal.toggle() + showModal.toggle() } } diff --git a/wake/Typography.swift b/wake/Typography.swift index 90a1036..c9cab9e 100644 --- a/wake/Typography.swift +++ b/wake/Typography.swift @@ -28,6 +28,7 @@ enum TypographyStyle { case headline // 大标题 case title // 标题 case title2 // 标题 + case title3 // 标题 case body // 正文 case subtitle // 副标题 case caption // 说明文字 @@ -54,6 +55,7 @@ struct Typography { .largeTitle: TypographyConfig(size: 32, weight: .heavy, textStyle: .largeTitle), .smallLargeTitle: TypographyConfig(size: 30, weight: .heavy, textStyle: .largeTitle), .headline: TypographyConfig(size: 24, weight: .bold, textStyle: .headline), + .title3: TypographyConfig(size: 22, weight: .semibold, textStyle: .title2), .title: TypographyConfig(size: 20, weight: .semibold, textStyle: .title2), .title2: TypographyConfig(size: 18, weight: .bold, textStyle: .title2), .body: TypographyConfig(size: 16, weight: .regular, textStyle: .body), diff --git a/wake/View/Components/UserProfileModal.swift b/wake/View/Components/UserProfileModal.swift index d9f4fc5..d9970cb 100644 --- a/wake/View/Components/UserProfileModal.swift +++ b/wake/View/Components/UserProfileModal.swift @@ -11,59 +11,92 @@ struct UserProfileModal: View { .frame(height: UIApplication.shared.windows.first?.safeAreaInsets.top ?? 0) // 用户信息区域 HStack(alignment: .center, spacing: 16) { - // 头像 Image(systemName: "person.circle.fill") .resizable() .aspectRatio(contentMode: .fill) .frame(width: 60, height: 60) .foregroundColor(.blue) .clipShape(Circle()) - - // 姓名和ID - VStack(alignment: .leading, spacing: 4) { - Text("用户名") - .font(.headline) - .foregroundColor(.primary) - - Text("ID: 12345678") - .font(.subheadline) - .foregroundColor(.secondary) + + VStack(alignment: .leading, spacing: 10) { + Text("Name") + .font(Typography.font(for: .body)) + .fontWeight(.bold) + .foregroundColor(.themeTextMessageMain) + HStack(spacing: 4) { + Text("ID: 12345678") + .font(.system(size: 14)) + .foregroundColor(.themeTextMessageMain) + + Button(action: { + UIPasteboard.general.string = "12345678" + }) { + Image(systemName: "doc.on.doc") + .font(.system(size: 12)) + .foregroundColor(.themeTextMessageMain) + } + } } - + Spacer() } - .padding(.horizontal, 16) - .padding(.top, 16) - - VStack(alignment: .leading, spacing: 8) { - Text("会员等级") - .font(.headline) - .foregroundColor(.primary) - Text("会员时间") - .font(.subheadline) - .foregroundColor(.secondary) - Text("会员中心") - .font(.subheadline) - .foregroundColor(.secondary) + .frame(maxWidth: .infinity) + .padding() + .background( + RoundedRectangle(cornerRadius: 16) + .fill(Color.white) + .shadow(color: .black.opacity(0.1), radius: 4, x: 0, y: 2) + ) + .padding(.horizontal) + + ZStack(alignment: .center) { + // SVG背景 - 确保铺满整个区域 + SVGImage(svgName: "Pioneer") + .frame(maxWidth: .infinity, maxHeight: .infinity) + .scaledToFill() + + // 内容区域 + VStack(alignment: .leading, spacing: 6) { + Text("Pioneer") + .font(Typography.font(for: .title3)) + .fontWeight(.bold) + .foregroundColor(.themeTextMessageMain) + .padding(.top, 6) + + Text("Expires on :") + .font(.system(size: 12)) + .foregroundColor(.themeTextMessageMain) + .padding(.top, 2) + + Text("March 15, 2025") + .font(.system(size: 12)) + .fontWeight(.bold) + .foregroundColor(.themeTextMessageMain) + } + .frame(maxWidth: .infinity, alignment: .leading) + .padding(.leading, 32) + // 可以添加内边距使内容不紧贴边缘 + .padding(.vertical, 12) } - .frame(maxWidth: .infinity, alignment: .leading) - .padding(16) - .background(Color.clear) - .padding(.horizontal, 16) + .frame(height: 112) + .frame(maxWidth: .infinity) + .clipped() // 确保内容不会超出边界 + VStack(spacing: 12) { - // memories + // upload Button(action: { - print("memories") + Router.shared.navigate(to: .mediaUpload) }) { HStack(spacing: 16) { - Image(systemName: "crown.fill") + SVGImage(svgName: "Upload") .foregroundColor(.orange) - .frame(width: 24, height: 24) + .frame(width: 20, height: 20) - Text("My Memories") - .font(.headline) - .foregroundColor(.primary) + Text("Upload Resources") + .font(Typography.font(for: .body)) + .fontWeight(.bold) + .foregroundColor(.themeTextMessageMain) Spacer() } @@ -73,17 +106,41 @@ struct UserProfileModal: View { } .buttonStyle(PlainButtonStyle()) // 移除按钮默认样式 - // Box + // memories Button(action: { - print("Box") + Router.shared.navigate(to: .mediaUpload) }) { HStack(spacing: 16) { - Image(systemName: "clock.fill") - .foregroundColor(.blue) - .frame(width: 24, height: 24) - Text("My Bind Box") - .font(.headline) - .foregroundColor(.primary) + SVGImage(svgName: "Memory") + .foregroundColor(.orange) + .frame(width: 20, height: 20) + + Text("My Memories") + .font(Typography.font(for: .body)) + .fontWeight(.bold) + .foregroundColor(.themeTextMessageMain) + + Spacer() + } + .padding() + .cornerRadius(10) + .contentShape(Rectangle()) // 使整个区域可点击 + } + .buttonStyle(PlainButtonStyle()) // 移除按钮默认样式 + + // Box + Button(action: { + Router.shared.navigate(to: .mediaUpload) + }) { + HStack(spacing: 16) { + SVGImage(svgName: "Box") + .foregroundColor(.orange) + .frame(width: 20, height: 20) + + Text("My Blind Box") + .font(Typography.font(for: .body)) + .fontWeight(.bold) + .foregroundColor(.themeTextMessageMain) Spacer() } @@ -95,36 +152,41 @@ struct UserProfileModal: View { // setting Button(action: { - withAnimation(.spring(response: 0.5, dampingFraction: 0.8)) { + withAnimation(.spring(response: 0.5, dampingFraction: 0.8)) { showSettings = true } }) { HStack(spacing: 16) { - Image(systemName: "person.circle.fill") - .foregroundColor(.purple) - .frame(width: 24, height: 24) + SVGImage(svgName: "Set") + .foregroundColor(.orange) + .frame(width: 20, height: 20) + Text("Setting") - .font(.headline) - .foregroundColor(.primary) + .font(Typography.font(for: .body)) + .fontWeight(.bold) + .foregroundColor(.themeTextMessageMain) + Spacer() - Image(systemName: "chevron.right") - .foregroundColor(.gray) } .padding() - .background(Color.clear) - .overlay( - RoundedRectangle(cornerRadius: 10) - .stroke(Color.gray.opacity(0.2), lineWidth: 1) - ) + .cornerRadius(10) .contentShape(Rectangle()) // 使整个区域可点击 } .buttonStyle(PlainButtonStyle()) // 移除按钮默认样式 + } - .padding(.horizontal, 16) + .frame(maxWidth: .infinity) + .padding() + .background( + RoundedRectangle(cornerRadius: 16) + .fill(Color.white) + .shadow(color: .black.opacity(0.1), radius: 4, x: 0, y: 2) + ) + .padding(.horizontal) Spacer() } .frame(width: UIScreen.main.bounds.width * 0.8) - .background(Color(red: 0.87, green: 0.87, blue: 0.87)) + .background(Color.themeTextWhiteSecondary) .cornerRadius(20, corners: [.topRight, .bottomRight]) .edgesIgnoringSafeArea(.all) } diff --git a/wake/View/Owner/SettingsView.swift b/wake/View/Owner/SettingsView.swift index d2abf64..aaedfbb 100644 --- a/wake/View/Owner/SettingsView.swift +++ b/wake/View/Owner/SettingsView.swift @@ -70,7 +70,7 @@ struct SettingsView: View { .background(Color(.systemGroupedBackground)) } .frame(maxWidth: .infinity, maxHeight: .infinity) - .background(Color(.systemGroupedBackground)) + .background(Color.themeTextWhiteSecondary) // 设置水平尺寸类别为常规宽度(regular),用于支持分屏和不同设备尺寸的布局 .environment(\.horizontalSizeClass, .regular) } diff --git a/wake/WakeApp.swift b/wake/WakeApp.swift index 05f67a8..5f77c43 100644 --- a/wake/WakeApp.swift +++ b/wake/WakeApp.swift @@ -48,13 +48,11 @@ struct WakeApp: App { // 已登录:显示userInfo页面 // ContentView() // .environmentObject(authState) - MediaUploadView() + ContentView() .environmentObject(authState) } else { // 未登录:显示登录界面 - // LoginView() - // .environmentObject(authState) - UserInfo() + LoginView() .environmentObject(authState) } }