This commit is contained in:
2024-01-25 17:50:40 +08:00
parent 2d7d3dc836
commit 6f7f8deda1
19 changed files with 530 additions and 201 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -38,6 +38,11 @@
968A6FB42B610C67008609EE /* KillCountDown.swift in Sources */ = {isa = PBXBuildFile; fileRef = 968A6FB32B610C67008609EE /* KillCountDown.swift */; };
968A6FB62B6113BE008609EE /* UserAccountCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 968A6FB52B6113BE008609EE /* UserAccountCard.swift */; };
968A6FB82B6113FF008609EE /* UserAccountCardModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 968A6FB72B6113FF008609EE /* UserAccountCardModel.swift */; };
96E93E972B621CF6004AB649 /* UserInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E93E962B621CF6004AB649 /* UserInfoView.swift */; };
96E93E9B2B622931004AB649 /* UserAvatarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E93E9A2B622931004AB649 /* UserAvatarView.swift */; };
96E93E9D2B622D00004AB649 /* NavigationPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E93E9C2B622D00004AB649 /* NavigationPageView.swift */; };
96E93E9F2B62305F004AB649 /* UserNicknameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E93E9E2B62305F004AB649 /* UserNicknameView.swift */; };
96E93EA12B623D4E004AB649 /* MessageDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E93EA02B623D4E004AB649 /* MessageDetailView.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -73,6 +78,11 @@
968A6FB32B610C67008609EE /* KillCountDown.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KillCountDown.swift; sourceTree = "<group>"; };
968A6FB52B6113BE008609EE /* UserAccountCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserAccountCard.swift; sourceTree = "<group>"; };
968A6FB72B6113FF008609EE /* UserAccountCardModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserAccountCardModel.swift; sourceTree = "<group>"; };
96E93E962B621CF6004AB649 /* UserInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfoView.swift; sourceTree = "<group>"; };
96E93E9A2B622931004AB649 /* UserAvatarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserAvatarView.swift; sourceTree = "<group>"; };
96E93E9C2B622D00004AB649 /* NavigationPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationPageView.swift; sourceTree = "<group>"; };
96E93E9E2B62305F004AB649 /* UserNicknameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserNicknameView.swift; sourceTree = "<group>"; };
96E93EA02B623D4E004AB649 /* MessageDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageDetailView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -106,9 +116,9 @@
isa = PBXGroup;
children = (
968A6F762B5F4E0D008609EE /* Components */,
968A6F752B5F4DFD008609EE /* Views */,
968A6F742B5F4DF9008609EE /* Models */,
968A6F732B5F4DF3008609EE /* Controllers */,
968A6F742B5F4DF9008609EE /* Models */,
968A6F752B5F4DFD008609EE /* Views */,
968A6F632B5F4C99008609EE /* demoApp.swift */,
968A6F692B5F4C9B008609EE /* Assets.xcassets */,
968A6F6B2B5F4C9B008609EE /* Preview Content */,
@@ -169,6 +179,7 @@
isa = PBXGroup;
children = (
968A6F782B5F4E28008609EE /* TabBarView.swift */,
96E93E9C2B622D00004AB649 /* NavigationPageView.swift */,
);
path = Layouts;
sourceTree = "<group>";
@@ -200,6 +211,7 @@
isa = PBXGroup;
children = (
968A6F842B5F4EB2008609EE /* MessageView.swift */,
96E93EA02B623D4E004AB649 /* MessageDetailView.swift */,
);
path = Message;
sourceTree = "<group>";
@@ -207,8 +219,9 @@
968A6F862B5F4EB6008609EE /* User */ = {
isa = PBXGroup;
children = (
968A6F902B5F6810008609EE /* Account */,
968A6F872B5F4EC4008609EE /* UserView.swift */,
96E93E952B621CD9004AB649 /* Info */,
968A6F902B5F6810008609EE /* Account */,
968A6F8F2B5F67FE008609EE /* Order */,
);
path = User;
@@ -244,6 +257,16 @@
path = Auth;
sourceTree = "<group>";
};
96E93E952B621CD9004AB649 /* Info */ = {
isa = PBXGroup;
children = (
96E93E962B621CF6004AB649 /* UserInfoView.swift */,
96E93E9A2B622931004AB649 /* UserAvatarView.swift */,
96E93E9E2B62305F004AB649 /* UserNicknameView.swift */,
);
path = Info;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -320,25 +343,30 @@
968A6FB22B5FC3A2008609EE /* ShowMore.swift in Sources */,
968A6F822B5F4EA1008609EE /* MallView.swift in Sources */,
968A6F972B5F683E008609EE /* CouponView.swift in Sources */,
96E93E9B2B622931004AB649 /* UserAvatarView.swift in Sources */,
968A6F7C2B5F4E63008609EE /* TabBar.swift in Sources */,
968A6F8A2B5F6421008609EE /* GoodsDetailView.swift in Sources */,
968A6F922B5F681C008609EE /* AccountView.swift in Sources */,
96E93E972B621CF6004AB649 /* UserInfoView.swift in Sources */,
968A6FAE2B5FA329008609EE /* CamelPrice.swift in Sources */,
968A6FAC2B5F6B1C008609EE /* GoodsCommentsView.swift in Sources */,
968A6FA42B5F68B8008609EE /* LicenceView.swift in Sources */,
968A6FB02B5FBB86008609EE /* GoodsCard.swift in Sources */,
96E93EA12B623D4E004AB649 /* MessageDetailView.swift in Sources */,
968A6F9B2B5F686D008609EE /* NoticeListView.swift in Sources */,
968A6F992B5F6860008609EE /* NoticeView.swift in Sources */,
968A6F8E2B5F67F8008609EE /* OrderDetailView.swift in Sources */,
968A6F7F2B5F4E91008609EE /* HomeView.swift in Sources */,
968A6FA22B5F68AA008609EE /* ForgotView.swift in Sources */,
968A6F792B5F4E28008609EE /* TabBarView.swift in Sources */,
96E93E9F2B62305F004AB649 /* UserNicknameView.swift in Sources */,
968A6FA82B5F6AF3008609EE /* CartView.swift in Sources */,
968A6FAA2B5F6B07008609EE /* CategoryView.swift in Sources */,
968A6FB82B6113FF008609EE /* UserAccountCardModel.swift in Sources */,
968A6F642B5F4C99008609EE /* demoApp.swift in Sources */,
968A6FB62B6113BE008609EE /* UserAccountCard.swift in Sources */,
968A6F952B5F6836008609EE /* BalanceView.swift in Sources */,
96E93E9D2B622D00004AB649 /* NavigationPageView.swift in Sources */,
968A6FB42B610C67008609EE /* KillCountDown.swift in Sources */,
968A6F882B5F4EC4008609EE /* UserView.swift in Sources */,
968A6F9E2B5F688A008609EE /* LoginView.swift in Sources */,
@@ -483,6 +511,8 @@
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard;
INFOPLIST_KEY_UIRequiresFullScreen = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
@@ -493,9 +523,13 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = tech.uzchain.demo;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
@@ -514,6 +548,8 @@
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard;
INFOPLIST_KEY_UIRequiresFullScreen = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
@@ -524,9 +560,13 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = tech.uzchain.demo;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
};

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "24DFC6EB-7C02-45A3-A4C6-DB7A684613BB"
type = "1"
version = "2.0">
</Bucket>

View File

@@ -13,6 +13,9 @@ struct GoodsCard: View {
}
var body: some View {
NavigationLink {
GoodsDetailView()
} label: {
VStack {
Image("Images/LaunchScreen")
.resizable()
@@ -22,6 +25,7 @@ struct GoodsCard: View {
Text("苏东坡专辑,谁谁会注解的内容哦")
.font(.subheadline)
.lineLimit(1)
.foregroundColor(Color.black)
HStack(alignment: .bottom) {
CamelPrice(amount: 125.9229, size: 16)
Spacer()
@@ -37,3 +41,4 @@ struct GoodsCard: View {
.cornerRadius(8)
}
}
}

View File

@@ -10,13 +10,19 @@ import SwiftUI
struct UserAccountCard: View {
var model: UserAccountCardModel
var body: some View {
VStack {
HStack {
VStack(alignment: .leading, spacing: 12) {
HStack(spacing: 4) {
Image(systemName: model.icon)
.resizable()
.frame(width: 15, height: 15)
.foregroundColor(Color.black)
Text(model.title)
.font(.system(size: 16))
.foregroundColor(Color.black)
}
Text(model.info)
.font(.caption)
.font(.system(size: 12))
.foregroundColor(Color.gray)
}
.padding(12)
.background(Color.white)

View File

@@ -11,29 +11,66 @@ struct HomeView: View {
@State private var selectedTab = 0
var body: some View {
ScrollView {
ScrollView(.vertical, showsIndicators: false) {
VStack(spacing: 12) {
// Search
// Banner
// Navigation
Search
Banner
Navigation
TodayKill
// Living
// Bestselling
// PartyReading
// NewBooks
// Categories
Living
Bestselling
PartyReading
NewBooks
Categories
Spacer()
}
}
.frame(maxWidth: .infinity)
.padding(.horizontal, 12)
.padding(.bottom, 48)
.background(Color.gray.opacity(0.2))
}
var Search: some View {
HStack(alignment: .center, spacing: 16) {
HStack {
Image(systemName: "magnifyingglass")
.resizable()
.frame(width: 18, height: 18)
.foregroundColor(Color.gray)
Text("搜索书籍")
.foregroundColor(Color.gray)
.font(.system(size: 16))
Spacer()
}
.frame(maxWidth: /*@START_MENU_TOKEN@*/ .infinity/*@END_MENU_TOKEN@*/)
.padding(12)
.background(Color.white)
.cornerRadius(32)
Image(systemName: "bell")
.resizable()
.frame(width: 24, height: 24)
.overlay(alignment: .topTrailing) {
Circle()
.fill(Color.red.opacity(0.8))
.frame(width: 20, height: 20)
.overlay {
Text("20")
.foregroundColor(Color.white)
.font(.system(size: 12))
}
.offset(x: 8, y: -10)
}
Spacer()
}
}
let columns = [GridItem(.flexible()), GridItem(.flexible())]
var Categories: some View {
VStack {
ScrollView(.horizontal) {
ScrollView(.horizontal, showsIndicators: false) {
HStack {
Text("推荐")
Text("竞品书单")
@@ -55,6 +92,27 @@ struct HomeView: View {
}
}
var Banner: some View {
TabView {
ForEach(1 ..< 4) { index in
GeometryReader { proxy in
let minX = proxy.frame(in: .global).minX
Image("Images/banner" + String(index))
.resizable()
.aspectRatio(contentMode: .fill)
.cornerRadius(12)
.rotation3DEffect(
.degrees(minX / -10),
axis: (x: 0.0, y: 1, z: 0.0)
)
}
}
}
.tabViewStyle(.page(indexDisplayMode: .always))
.frame(height: 220)
.cornerRadius(12)
}
var NewBooks: some View {
VStack(alignment: .leading) {
HStack {
@@ -178,6 +236,7 @@ struct HomeView: View {
HStack {
Text("今日秒杀")
.foregroundColor(Color.white)
.font(.system(size: 16))
KillCountDown()
}
.padding(8)
@@ -197,7 +256,7 @@ struct HomeView: View {
.cornerRadius(8)
VStack {
Text("石床垫:阿特伍德黑暗就故事(有的人说啥就是啥呢有的人说啥就是啥呢有的人说啥就是啥呢)")
.font(.title2)
.font(.system(size: 20))
.multilineTextAlignment(/*@START_MENU_TOKEN@*/ .leading/*@END_MENU_TOKEN@*/)
.lineLimit(/*@START_MENU_TOKEN@*/2/*@END_MENU_TOKEN@*/)
.foregroundColor(Color.white)
@@ -208,6 +267,7 @@ struct HomeView: View {
.background(Color.white)
HStack {
Text("抢购")
.font(.system(size: 14))
Image(systemName: "chevron.forward")
}
.foregroundColor(Color.white)
@@ -257,63 +317,13 @@ struct HomeView: View {
.cornerRadius(64)
Text("图书")
.font(.system(size: 14))
}
}
}
}
}
var Banner: some View {
HStack {
Image("Images/banner1")
.resizable(resizingMode: .stretch)
.aspectRatio(contentMode: .fit)
Image("Images/banner2")
.resizable(resizingMode: .stretch)
.aspectRatio(contentMode: .fit)
Image("Images/banner3")
.resizable(resizingMode: .stretch)
.aspectRatio(contentMode: .fit)
#Preview {
HomeView()
}
.frame(maxWidth: /*@START_MENU_TOKEN@*/ .infinity/*@END_MENU_TOKEN@*/)
}
var Search: some View {
HStack(alignment: .center, spacing: 16) {
HStack {
Image(systemName: "magnifyingglass")
.resizable()
.frame(width: 18, height: 18)
.foregroundColor(Color.gray)
Text("搜索书籍")
.foregroundColor(Color.gray)
Spacer()
}
.frame(maxWidth: /*@START_MENU_TOKEN@*/ .infinity/*@END_MENU_TOKEN@*/)
.padding(12)
.background(Color.white)
.cornerRadius(32)
Image(systemName: "bell")
.resizable()
.frame(width: 24, height: 24)
.overlay(alignment: .topTrailing) {
Circle()
.fill(Color.red)
.frame(width: 20, height: 20)
.offset(x: 4, y: -8)
}
.overlay(alignment: .topTrailing) {
Text("20")
.foregroundColor(Color.white)
.font(.system(size: 12))
.offset(x: 2, y: -5)
}
Spacer()
}
}
}
//
// #Preview {
// HomeView()
// }

View File

@@ -0,0 +1,34 @@
//
// NavigationPageView.swift
// demo
//
// Created by Jason on 2024/1/25.
//
import SwiftUI
struct NavigationPageView: View {
@Environment(\.dismiss) private var dismiss
var title: String = ""
var content: any View
var body: some View {
ScrollView {
AnyView(content)
}
.navigationBarTitleDisplayMode(.inline)
.navigationTitle(title)
.navigationBarBackButtonHidden(true)
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
Button {
dismiss()
} label: {
HStack {
Image(systemName: "chevron.backward")
}
}
}
}
}
}

View File

@@ -11,6 +11,7 @@ struct TabBarView: View {
@AppStorage("selectedTab") var selectedTab: Tab = .home
var body: some View {
NavigationView {
ZStack(alignment: .leading) {
Group {
switch selectedTab {
@@ -57,6 +58,8 @@ struct TabBarView: View {
}
.statusBarHidden(false)
}
.navigationViewStyle(.columns)
}
}
#Preview {

View File

@@ -9,7 +9,11 @@ import SwiftUI
struct GoodsDetailView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
NavigationPageView(title: "商品详情", content: content)
}
var content: some View {
Image("Images/banner1")
}
}

View File

@@ -0,0 +1,22 @@
//
// MessageDetailView.swift
// demo
//
// Created by Jason on 2024/1/25.
//
import SwiftUI
struct MessageDetailView: View {
var body: some View {
NavigationPageView(title: "消息详情", content: content)
}
var content: some View {
Text("asdf")
}
}
#Preview {
MessageDetailView()
}

View File

@@ -9,7 +9,17 @@ import SwiftUI
struct MessageView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
NavigationPageView(title: "资讯列表", content: content)
}
var content: some View {
VStack {
NavigationLink {
MessageDetailView()
} label: {
Text("xiaoxo")
}
}
}
}

View File

@@ -9,7 +9,7 @@ import SwiftUI
struct AccountView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
NavigationPageView(title: "我的积分", content: Text("Account View"))
}
}

View File

@@ -0,0 +1,54 @@
//
// UserAvatarView.swift
// demo
//
// Created by Jason on 2024/1/25.
//
import SwiftUI
struct UserAvatarView: View {
@Environment(\.dismiss) private var dismiss
@State private var showSheet = false
var body: some View {
VStack {
Image("Images/banner1")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.width)
}
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
Button {
dismiss()
} label: {
Image(systemName: "chevron.backward")
}
}
ToolbarItem(placement: .navigationBarTrailing) {
Button {
showSheet = true
} label: {
Image(systemName: "ellipsis")
}
.actionSheet(isPresented: $showSheet, content: {
ActionSheet(title: Text("更换头像"), message: nil, buttons: [
.default(Text("从相册选择"), action: {}),
.default(Text("拍一张"), action: {}),
.cancel(Text("取消"))
])
})
}
}
.navigationBarBackButtonHidden(true)
.navigationBarTitleDisplayMode(.inline)
.navigationTitle("头像")
}
}
#Preview {
UserAvatarView()
}

View File

@@ -0,0 +1,24 @@
//
// UserInfoView.swift
// demo
//
// Created by Jason on 2024/1/25.
//
import SwiftUI
struct UserInfoView: View {
var body: some View {
NavigationPageView(title: "用户设置", content: VStack {
NavigationLink {
UserNicknameView()
} label: {
Text("用户昵称")
}
})
}
}
#Preview {
UserInfoView()
}

View File

@@ -0,0 +1,18 @@
//
// UserNicknameView.swift
// demo
//
// Created by Jason on 2024/1/25.
//
import SwiftUI
struct UserNicknameView: View {
var body: some View {
NavigationPageView(title: "用户昵称", content: Text("nickname"))
}
}
#Preview {
UserNicknameView()
}

View File

@@ -9,7 +9,11 @@ import SwiftUI
struct OrdersView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
NavigationPageView(title: "全部订单", content: content)
}
var content: some View {
Text("q全部订单, World!")
}
}

View File

@@ -9,27 +9,29 @@ import SwiftUI
struct UserView: View {
@State private var showDetail = false
@State private var showUserInfo = false
var body: some View {
ScrollView {
ScrollView(.vertical, showsIndicators: false) {
VStack(spacing: 0) {
Header
ToVip
VStack(spacing: 16) {
InfoList
Notice
OrderShow
Coupons
tj
Recommend
}
.padding(16)
.background(Color.gray.opacity(0.2))
.cornerRadius(12)
}
.padding(.bottom, 48)
.animation(.spring, value: showDetail)
}
var Header: some View {
HStack {
NavigationLink {
UserAvatarView()
} label: {
Image("Images/logo")
.resizable()
.frame(width: 64, height: 64)
@@ -38,6 +40,7 @@ struct UserView: View {
RoundedRectangle(cornerRadius: 32, style: .continuous)
.stroke(Color.red, lineWidth: 2)
)
}
VStack(alignment: .leading, spacing: 12, content: {
Text("用户名称")
@@ -48,15 +51,18 @@ struct UserView: View {
.foregroundColor(Color.gray)
.lineLimit(1)
})
NavigationLink {
UserInfoView()
} label: {
Image(systemName: "gearshape")
.foregroundColor(Color.gray)
}
}
.padding(.horizontal, 24)
}
var ToVip: some View {
HStack(spacing: /*@START_MENU_TOKEN@*/nil/*@END_MENU_TOKEN@*/, content: {
HStack(alignment: .top, spacing: /*@START_MENU_TOKEN@*/nil/*@END_MENU_TOKEN@*/, content: {
Text("VIP de yixie 简介部分")
Button(action: {
self.showDetail.toggle()
@@ -72,111 +78,194 @@ struct UserView: View {
.background(Color.gray)
.cornerRadius(32)
})
.padding(16)
.padding(.bottom, 64)
.frame(maxWidth: .infinity)
.frame(height: showDetail ? 100 : 200)
.animation(.default, value: showDetail)
.background(
Image("Images/banner3").resizable(resizingMode: .tile)
// .overlay(
// UnevenRoundedRectangle(cornerRadii: RectangleCornerRadii(topLeading: 12, topTrailing: 12))
// )
.padding(12)
.padding(.top, 12)
.frame(height: showDetail ? 64 : 150, alignment: .topLeading)
.background(Color.red.opacity(0.3))
.clipShape(
RoundedRectangle(cornerRadius: 12)
.offset(y: 12)
)
.cornerRadius(12)
.padding(.horizontal, 16)
.padding(.horizontal, 12)
}
var InfoList: some View {
ScrollView(.horizontal) {
HStack(spacing: 16) {
ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { _ in
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 12) {
ForEach(0 ..< 8) { _ in
NavigationLink {
AccountView()
} label: {
UserAccountCard(model: UserAccountCardModel(title: "我的积分", icon: "star", info: "共30001分"))
}
}
}
}
.padding(12)
.background(Color.gray.opacity(0.2))
}
var Notice: some View {
HStack {
HStack(spacing: 4) {
Text("资讯")
.padding(4)
.background(Color.red)
.foregroundColor(Color.white)
.font(.system(size: 16))
NavigationLink {
MessageDetailView()
} label: {
Text("平台与2024年1余额开始更新敬请期待@@@")
.foregroundColor(Color.gray)
.frame(maxWidth: .infinity)
.multilineTextAlignment(/*@START_MENU_TOKEN@*/ .leading/*@END_MENU_TOKEN@*/)
.font(.system(size: 14))
.lineLimit(1)
}
NavigationLink {
MessageView()
} label: {
HStack(spacing: 2, content: {
Text("更多")
.font(.system(size: 14))
.foregroundColor(Color.secondary)
Image(systemName: "chevron.forward.2")
.resizable()
.frame(width: 10, height: 10)
.foregroundColor(Color.secondary)
})
}
}
.frame(maxWidth: .infinity)
.padding(8)
.background(Color.white)
.cornerRadius(8)
.padding(.horizontal, 12)
.padding(.bottom, 12)
.background(Color.gray.opacity(0.2))
}
var OrderShow: some View {
VStack(spacing: 16) {
VStack(spacing: 0) {
HStack {
Text("订单中心")
.font(.system(size: 16))
Spacer()
NavigationLink {
OrdersView()
} label: {
ShowMore()
}
.padding(8)
HStack {
}
.padding(.horizontal, 12)
Spacer(minLength: 22)
HStack(alignment: .center) {
Spacer()
ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { _ in
NavigationLink {
OrdersView()
} label: {
VStack {
Image(systemName: "wallet.pass")
.resizable()
.frame(width: 24, height: 24)
.foregroundColor(Color.gray)
.overlay(alignment: .topTrailing) {
Circle()
.fill(Color.red.opacity(0.9))
.frame(width: 20, height: 20)
.overlay {
Text("5")
.foregroundColor(Color.white)
.font(.system(size: 12))
}
.offset(x: 12, y: -10)
}
Text("待付款")
.font(.system(size: 12))
.foregroundColor(Color.gray)
}
}
Spacer()
}
}
}
.padding(.vertical, 12)
.background(Color.white)
.cornerRadius(6)
.padding(.horizontal, 12)
.padding(.bottom, 12)
.background(Color.gray.opacity(0.2))
}
var Coupons: some View {
VStack(spacing: 16) {
VStack(spacing: 0) {
HStack {
Spacer()
ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { _ in
VStack {
Image(systemName: "wallet.pass")
Text("优惠券")
.resizable()
.frame(width: 24, height: 24)
.foregroundColor(Color.gray)
.overlay(alignment: .topTrailing) {
Circle()
.fill(Color.red.opacity(0.9))
.frame(width: 20, height: 20)
.overlay {
Text("5")
.foregroundColor(Color.white)
.font(.system(size: 12))
}
.offset(x: 12, y: -10)
}
Text("待付款")
.font(.system(size: 12))
.foregroundColor(Color.gray)
}
Spacer()
}
}
}
.padding(12)
.padding(.top, 22)
.padding(.bottom, 12)
.background(Color.white)
.cornerRadius(6)
.padding(.horizontal, 12)
.padding(.bottom, 12)
.background(Color.gray.opacity(0.2))
}
let columns = [GridItem(.flexible()), GridItem(.flexible())]
let columns = [GridItem(.flexible(), spacing: 12), GridItem(.flexible(), spacing: 12)]
var tj: some View {
LazyVGrid(columns: columns, alignment: .center) {
var Recommend: some View {
LazyVGrid(columns: columns, alignment: .center, spacing: 12, pinnedViews: .sectionHeaders) {
Section {
ForEach(0 ..< 20, id: \.self) { _ in
GoodsCard()
}
}
header: {
HStack {
Rectangle()
.fill(LinearGradient(colors: [Color.gray.opacity(0), Color.gray.opacity(0.8)], startPoint: .leading, endPoint: UnitPoint.trailing))
.frame(width: 48, height: 4.0)
Text("推荐广场")
.font(.system(size: 16))
Rectangle()
.fill(LinearGradient(colors: [Color.gray.opacity(0.8), Color.gray.opacity(0)], startPoint: .leading, endPoint: UnitPoint.trailing))
.frame(width: 48, height: 4.0)
}
}
}
.padding(.horizontal, 12)
.padding(.bottom, 12)
.background(Color.gray.opacity(0.2))
}
}
//
// #Preview {
// UserView()
// }
#Preview {
UserView()
}

View File

@@ -5,8 +5,8 @@
// Created by Jason on 2024/1/23.
//
import SwiftUI
import SwiftData
import SwiftUI
@main
struct demoApp: App {