diff --git a/.DS_Store b/.DS_Store index 517346e..867634a 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/demo.xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate b/demo.xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate index 01597d7..29e73ed 100644 Binary files a/demo.xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate and b/demo.xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/demo/Components/GoodsCard.swift b/demo/Components/GoodsCard.swift index bf00dea..529d7e2 100644 --- a/demo/Components/GoodsCard.swift +++ b/demo/Components/GoodsCard.swift @@ -8,13 +8,14 @@ import SwiftUI struct GoodsCard: View { + var title: String func getHeight() -> CGFloat { (UIScreen.main.bounds.width - 24 - 12) / 2 * 1.2 } var body: some View { NavigationLink { - GoodsDetailView() + GoodsDetailView(title: title) } label: { VStack { Image("Images/LaunchScreen") diff --git a/demo/Views/Home/HomeView.swift b/demo/Views/Home/HomeView.swift index 3f63a3b..c483503 100644 --- a/demo/Views/Home/HomeView.swift +++ b/demo/Views/Home/HomeView.swift @@ -84,7 +84,7 @@ struct HomeView: View { LazyVGrid(columns: columns, alignment: .center) { ForEach(0 ..< 20, id: \.self) { _ in - GoodsCard() + GoodsCard(title: "首页进入的商品标题,如果长了,会不会自动隐藏的问题,这里需要测试") } } } diff --git a/demo/Views/Mall/GoodsDetailView.swift b/demo/Views/Mall/GoodsDetailView.swift index 13099ab..b418186 100644 --- a/demo/Views/Mall/GoodsDetailView.swift +++ b/demo/Views/Mall/GoodsDetailView.swift @@ -8,15 +8,107 @@ import SwiftUI struct GoodsDetailView: View { - var body: some View { - NavigationPageView(title: "商品详情", content: content) - } + @Environment(\.dismiss) private var dismiss + var title: String - var content: some View { - Image("Images/banner1") + var body: some View { + ZStack { + ScrollView { + VStack { + ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { _ in + Image("Images/banner1") + .resizable() + .scaledToFit() + } + + HStack { + Text(title) + CamelPrice(amount: 32.112) + } + VStack { + Text("商品详情部分") + } + } + } + + .padding(.bottom, 100) + .ignoresSafeArea(.all) + + HStack { + Image(systemName: "chevron.backward") + Spacer() + Image(systemName: "ellipsis") + } + .padding(12.0) + .background(LinearGradient(colors: [Color.white, Color.white.opacity(0)], startPoint: .top, endPoint: .bottom)) + .frame(maxHeight: .infinity, alignment: .top) + + HStack(spacing: 0) { + HStack(spacing: 8) { + Image(systemName: "house") + .resizable() + .foregroundColor(Color.gray) + .frame(width: 20, height: 18) + Image(systemName: "person.fill.questionmark") + .resizable() + .foregroundColor(Color.gray) + .frame(width: 20, height: 18) + Image(systemName: "star") + .resizable() + .foregroundColor(Color.gray) + .frame(width: 20, height: 18) + Image(systemName: "cart") + .resizable() + .foregroundColor(Color.gray) + .frame(width: 20, height: 18) + } + Spacer() + HStack(spacing: 12) { + Button {} label: { + Text("加入购物车") + .font(.system(size: 15)) + .foregroundColor(Color.white) + } + Rectangle() + .fill(Color.white) + .frame(width: 1, height: 14) + Button {} label: { + Text("立即购买") + .font(.system(size: 15)) + .foregroundColor(Color.white) + } + } + .padding(.vertical, 12) + .padding(.horizontal, 24) + .background(LinearGradient(colors: [Color.orange, Color.red], startPoint: .leading, endPoint: .trailing)) + .clipShape( + RoundedRectangle(cornerRadius: 24) + ) + } + .padding(12.0) + .frame(maxWidth: /*@START_MENU_TOKEN@*/ .infinity/*@END_MENU_TOKEN@*/) + .background(Color("TabBarColor")) + .frame(maxHeight: .infinity, alignment: .bottom) + } + + .background(Color.gray.opacity(0.2)) +// .navigationBarTitleDisplayMode(.inline) +// .navigationTitle(title) +// .navigationBarBackButtonHidden(true) +// .toolbar { +// ToolbarItem(placement: .navigationBarLeading) { +// Button { +// dismiss() +// } label: { +// HStack { +// Image(systemName: "chevron.backward") +// } +// } +// } +// } } } #Preview { - GoodsDetailView() + GoodsDetailView(title: "Test") } diff --git a/demo/Views/User/UserView.swift b/demo/Views/User/UserView.swift index 1930b65..bba0616 100644 --- a/demo/Views/User/UserView.swift +++ b/demo/Views/User/UserView.swift @@ -272,7 +272,7 @@ struct UserView: View { LazyVGrid(columns: columns, alignment: .center, spacing: 12, pinnedViews: .sectionHeaders) { Section { ForEach(0 ..< 20, id: \.self) { _ in - GoodsCard() + GoodsCard(title: "我是商品标题") } } header: {