diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..8fe5889 Binary files /dev/null and b/.DS_Store differ diff --git a/jason.xcodeproj/project.pbxproj b/jason.xcodeproj/project.pbxproj index 58ebb5c..4776311 100644 --- a/jason.xcodeproj/project.pbxproj +++ b/jason.xcodeproj/project.pbxproj @@ -7,11 +7,18 @@ objects = { /* Begin PBXBuildFile section */ - 963267362B56C65600D7FAC9 /* TabbarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963267352B56C65600D7FAC9 /* TabbarView.swift */; }; 963267382B56C6EF00D7FAC9 /* UserView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963267372B56C6EF00D7FAC9 /* UserView.swift */; }; 9632673B2B56C77500D7FAC9 /* ExploreView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9632673A2B56C77500D7FAC9 /* ExploreView.swift */; }; 963267422B56CAD900D7FAC9 /* UserCardComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963267412B56CAD900D7FAC9 /* UserCardComponent.swift */; }; 963267472B56CEA100D7FAC9 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963267462B56CEA100D7FAC9 /* ViewController.swift */; }; + 9632674C2B5A095600D7FAC9 /* LaunchScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9632674B2B5A095600D7FAC9 /* LaunchScreen.swift */; }; + 9632674E2B5A0C4F00D7FAC9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9632674D2B5A0C4F00D7FAC9 /* LaunchScreen.storyboard */; }; + 963267502B5A1B3100D7FAC9 /* TabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9632674F2B5A1B3100D7FAC9 /* TabBar.swift */; }; + 963267522B5A1BCC00D7FAC9 /* TabBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963267512B5A1BCC00D7FAC9 /* TabBarView.swift */; }; + 963267552B5A25FE00D7FAC9 /* MallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963267542B5A25FE00D7FAC9 /* MallView.swift */; }; + 963267582B5A273B00D7FAC9 /* MessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963267572B5A273B00D7FAC9 /* MessageView.swift */; }; + 9632675B2B5A2FCC00D7FAC9 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9632675A2B5A2FCC00D7FAC9 /* LoginView.swift */; }; + 9632675E2B5A564100D7FAC9 /* RegisterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9632675D2B5A564100D7FAC9 /* RegisterView.swift */; }; 9634A8F32B569860007C90C0 /* MyApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9634A8F22B569860007C90C0 /* MyApp.swift */; }; 9634A8F52B569860007C90C0 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9634A8F42B569860007C90C0 /* HomeView.swift */; }; 9634A8F92B569862007C90C0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9634A8F82B569862007C90C0 /* Assets.xcassets */; }; @@ -19,6 +26,7 @@ 9634A9062B569862007C90C0 /* jasonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9634A9052B569862007C90C0 /* jasonTests.swift */; }; 9634A9102B569862007C90C0 /* jasonUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9634A90F2B569862007C90C0 /* jasonUITests.swift */; }; 9634A9122B569862007C90C0 /* jasonUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9634A9112B569862007C90C0 /* jasonUITestsLaunchTests.swift */; }; + 968A6F562B5E1DA1008609EE /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 968A6F552B5E1DA1008609EE /* SearchView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -40,11 +48,18 @@ /* Begin PBXFileReference section */ 963267342B56C56700D7FAC9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 963267352B56C65600D7FAC9 /* TabbarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabbarView.swift; sourceTree = ""; }; 963267372B56C6EF00D7FAC9 /* UserView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserView.swift; sourceTree = ""; }; 9632673A2B56C77500D7FAC9 /* ExploreView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExploreView.swift; sourceTree = ""; }; 963267412B56CAD900D7FAC9 /* UserCardComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserCardComponent.swift; sourceTree = ""; }; 963267462B56CEA100D7FAC9 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 9632674B2B5A095600D7FAC9 /* LaunchScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = LaunchScreen.swift; sourceTree = ""; usesTabs = 0; }; + 9632674D2B5A0C4F00D7FAC9 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; + 9632674F2B5A1B3100D7FAC9 /* TabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBar.swift; sourceTree = ""; }; + 963267512B5A1BCC00D7FAC9 /* TabBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarView.swift; sourceTree = ""; }; + 963267542B5A25FE00D7FAC9 /* MallView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MallView.swift; sourceTree = ""; }; + 963267572B5A273B00D7FAC9 /* MessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageView.swift; sourceTree = ""; }; + 9632675A2B5A2FCC00D7FAC9 /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = ""; }; + 9632675D2B5A564100D7FAC9 /* RegisterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterView.swift; sourceTree = ""; }; 9634A8EF2B569860007C90C0 /* jason.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = jason.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9634A8F22B569860007C90C0 /* MyApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyApp.swift; sourceTree = ""; }; 9634A8F42B569860007C90C0 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = ""; }; @@ -55,6 +70,7 @@ 9634A90B2B569862007C90C0 /* jasonUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = jasonUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 9634A90F2B569862007C90C0 /* jasonUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = jasonUITests.swift; sourceTree = ""; }; 9634A9112B569862007C90C0 /* jasonUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = jasonUITestsLaunchTests.swift; sourceTree = ""; }; + 968A6F552B5E1DA1008609EE /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -114,6 +130,40 @@ path = Components; sourceTree = ""; }; + 963267482B5A07DD00D7FAC9 /* Layouts */ = { + isa = PBXGroup; + children = ( + 9632674B2B5A095600D7FAC9 /* LaunchScreen.swift */, + 963267512B5A1BCC00D7FAC9 /* TabBarView.swift */, + ); + path = Layouts; + sourceTree = ""; + }; + 963267532B5A25D300D7FAC9 /* Mall */ = { + isa = PBXGroup; + children = ( + 963267542B5A25FE00D7FAC9 /* MallView.swift */, + ); + path = Mall; + sourceTree = ""; + }; + 963267562B5A272D00D7FAC9 /* Message */ = { + isa = PBXGroup; + children = ( + 963267572B5A273B00D7FAC9 /* MessageView.swift */, + ); + path = Message; + sourceTree = ""; + }; + 963267592B5A2FBE00D7FAC9 /* Auth */ = { + isa = PBXGroup; + children = ( + 9632675A2B5A2FCC00D7FAC9 /* LoginView.swift */, + 9632675D2B5A564100D7FAC9 /* RegisterView.swift */, + ); + path = Auth; + sourceTree = ""; + }; 9634A8E62B569860007C90C0 = { isa = PBXGroup; children = ( @@ -185,10 +235,15 @@ 9634A91F2B5698AB007C90C0 /* Views */ = { isa = PBXGroup; children = ( - 963267352B56C65600D7FAC9 /* TabbarView.swift */, + 968A6F532B5E1D91008609EE /* Search */, + 963267592B5A2FBE00D7FAC9 /* Auth */, + 963267562B5A272D00D7FAC9 /* Message */, + 963267532B5A25D300D7FAC9 /* Mall */, + 963267482B5A07DD00D7FAC9 /* Layouts */, 9632673E2B56C8BD00D7FAC9 /* Explore */, 9632673C2B56C88D00D7FAC9 /* Home */, 9632673D2B56C89900D7FAC9 /* User */, + 9632674D2B5A0C4F00D7FAC9 /* LaunchScreen.storyboard */, ); path = Views; sourceTree = ""; @@ -196,10 +251,19 @@ 9634A9202B5698B0007C90C0 /* Models */ = { isa = PBXGroup; children = ( + 9632674F2B5A1B3100D7FAC9 /* TabBar.swift */, ); path = Models; sourceTree = ""; }; + 968A6F532B5E1D91008609EE /* Search */ = { + isa = PBXGroup; + children = ( + 968A6F552B5E1DA1008609EE /* SearchView.swift */, + ); + path = Search; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -304,6 +368,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9632674E2B5A0C4F00D7FAC9 /* LaunchScreen.storyboard in Resources */, 9634A8FC2B569862007C90C0 /* Preview Assets.xcassets in Resources */, 9634A8F92B569862007C90C0 /* Assets.xcassets in Resources */, ); @@ -330,10 +395,17 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 963267362B56C65600D7FAC9 /* TabbarView.swift in Sources */, + 963267552B5A25FE00D7FAC9 /* MallView.swift in Sources */, + 9632674C2B5A095600D7FAC9 /* LaunchScreen.swift in Sources */, + 9632675E2B5A564100D7FAC9 /* RegisterView.swift in Sources */, + 963267522B5A1BCC00D7FAC9 /* TabBarView.swift in Sources */, 9634A8F52B569860007C90C0 /* HomeView.swift in Sources */, 9634A8F32B569860007C90C0 /* MyApp.swift in Sources */, + 963267502B5A1B3100D7FAC9 /* TabBar.swift in Sources */, + 9632675B2B5A2FCC00D7FAC9 /* LoginView.swift in Sources */, + 963267582B5A273B00D7FAC9 /* MessageView.swift in Sources */, 963267382B56C6EF00D7FAC9 /* UserView.swift in Sources */, + 968A6F562B5E1DA1008609EE /* SearchView.swift in Sources */, 963267422B56CAD900D7FAC9 /* UserCardComponent.swift in Sources */, 963267472B56CEA100D7FAC9 /* ViewController.swift in Sources */, 9632673B2B56C77500D7FAC9 /* ExploreView.swift in Sources */, @@ -504,8 +576,12 @@ ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = jason/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "小陈叔叔"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = ""; + INFOPLIST_KEY_UIStatusBarHidden = NO; + INFOPLIST_KEY_UIStatusBarStyle = UIStatusBarStyleDarkContent; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; IPHONEOS_DEPLOYMENT_TARGET = 15.0; @@ -538,8 +614,12 @@ ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = jason/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "小陈叔叔"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = ""; + INFOPLIST_KEY_UIStatusBarHidden = NO; + INFOPLIST_KEY_UIStatusBarStyle = UIStatusBarStyleDarkContent; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; IPHONEOS_DEPLOYMENT_TARGET = 15.0; diff --git a/jason.xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate b/jason.xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate index 8780d1a..ce8f329 100644 Binary files a/jason.xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate and b/jason.xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/jason/Assets.xcassets/Colors/TabBarColor.colorset/Contents.json b/jason/Assets.xcassets/Colors/TabBarColor.colorset/Contents.json new file mode 100644 index 0000000..9c0e331 --- /dev/null +++ b/jason/Assets.xcassets/Colors/TabBarColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0xFF", + "red" : "0xFF" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x00", + "red" : "0x00" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/jason/Assets.xcassets/Images/LaunchScreen.imageset/Contents.json b/jason/Assets.xcassets/Images/LaunchScreen.imageset/Contents.json new file mode 100644 index 0000000..6130e6a --- /dev/null +++ b/jason/Assets.xcassets/Images/LaunchScreen.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "sunset-675847_1920.jpg", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/jason/Assets.xcassets/Images/LaunchScreen.imageset/sunset-675847_1920.jpg b/jason/Assets.xcassets/Images/LaunchScreen.imageset/sunset-675847_1920.jpg new file mode 100644 index 0000000..e0a4f7e Binary files /dev/null and b/jason/Assets.xcassets/Images/LaunchScreen.imageset/sunset-675847_1920.jpg differ diff --git a/jason/Assets.xcassets/Images/logo.imageset/3.jpg b/jason/Assets.xcassets/Images/logo.imageset/3 1.jpg similarity index 100% rename from jason/Assets.xcassets/Images/logo.imageset/3.jpg rename to jason/Assets.xcassets/Images/logo.imageset/3 1.jpg diff --git a/jason/Assets.xcassets/Images/logo.imageset/3ac79f3df8dcd10010dddf20758b4710b9122f69.jpg b/jason/Assets.xcassets/Images/logo.imageset/3ac79f3df8dcd10010dddf20758b4710b9122f69.jpg new file mode 100644 index 0000000..ff6c748 Binary files /dev/null and b/jason/Assets.xcassets/Images/logo.imageset/3ac79f3df8dcd10010dddf20758b4710b9122f69.jpg differ diff --git a/jason/Assets.xcassets/Images/logo.imageset/Contents.json b/jason/Assets.xcassets/Images/logo.imageset/Contents.json index 0863889..c3138ad 100644 --- a/jason/Assets.xcassets/Images/logo.imageset/Contents.json +++ b/jason/Assets.xcassets/Images/logo.imageset/Contents.json @@ -1,11 +1,12 @@ { "images" : [ { + "filename" : "3 1.jpg", "idiom" : "universal", "scale" : "1x" }, { - "filename" : "3.jpg", + "filename" : "3ac79f3df8dcd10010dddf20758b4710b9122f69.jpg", "idiom" : "universal", "scale" : "2x" }, diff --git a/jason/Components/UserCardComponent.swift b/jason/Components/UserCardComponent.swift index 87691ba..8540f5e 100644 --- a/jason/Components/UserCardComponent.swift +++ b/jason/Components/UserCardComponent.swift @@ -8,6 +8,7 @@ import SwiftUI struct UserCardComponent: View { + var body: some View { VStack (alignment: .leading, spacing: 8, content: { Spacer() @@ -27,7 +28,8 @@ struct UserCardComponent: View { }) .padding(.all, 20) .frame(height: 300) - .background(.ultraThinMaterial) + .background(Image("Images/banner2").resizable().aspectRatio(contentMode: .fill)) +// .background(.ultraThinMaterial) .cornerRadius(10) .shadow(radius: 20) .padding(.horizontal, 10) diff --git a/jason/Models/TabBar.swift b/jason/Models/TabBar.swift new file mode 100644 index 0000000..4e529ba --- /dev/null +++ b/jason/Models/TabBar.swift @@ -0,0 +1,29 @@ +// +// TabBar.swift +// jason +// +// Created by Jason on 2024/1/19. +// + +import SwiftUI + +struct TabItem: Identifiable { + var id = UUID() + var icon: String + var text: String + var tab: Tab +} + +var tabItems = [ + TabItem(icon: "book", text: "图书馆", tab: .home), + TabItem(icon: "bag", text: "生活馆", tab: .explore), + TabItem(icon: "cart", text: "购物车", tab: .message), + TabItem(icon: "person", text: "个人中心", tab: .account) +] + +enum Tab: String { + case home + case explore + case message + case account +} diff --git a/jason/MyApp.swift b/jason/MyApp.swift index 50f98f0..4d985bc 100644 --- a/jason/MyApp.swift +++ b/jason/MyApp.swift @@ -6,13 +6,12 @@ // import SwiftUI -import SwiftData @main struct MyApp: App { var body: some Scene { WindowGroup { - TabbarView() + TabBarView() } } } diff --git a/jason/Views/Auth/LoginView.swift b/jason/Views/Auth/LoginView.swift new file mode 100644 index 0000000..3929e16 --- /dev/null +++ b/jason/Views/Auth/LoginView.swift @@ -0,0 +1,72 @@ +// +// LoginView.swift +// jason +// +// Created by Jason on 2024/1/19. +// + +import SwiftUI + +struct LoginView: View { + @AppStorage("authUsername") private var username: String = "" + @State private var password: String = "" + @State private var remember: Bool = false + @State private var toRegister: Bool = false + + + var body: some View { + ScrollView { + + NavigationLink(destination: RegisterView(), label: { + Text("去注册") + }) + + VStack(alignment: .leading ,spacing: 12) { +// Button(action: { +// dismiss() +// }, label: { +// Image(systemName: "chevron.backward") +// Text("返回") +// }) + + + TextField("请输入用户名",text: $username) + SecureField("请输入密码", text: $password) + Toggle(isOn: $remember) { + Text("记住用户") + } + + HStack { + + Button("注册") { + toRegister = true + } + .padding(.vertical, 12) + .padding(.horizontal, 32) + .foregroundColor(.white) + + .cornerRadius(6) + .fullScreenCover(isPresented: $toRegister, content: { + RegisterView() + }) + + Spacer() + + Button("登录") { + + } + .padding(.vertical, 12) + .padding(.horizontal, 32) + .foregroundColor(.white) + + .cornerRadius(6) + } + } + .padding(.horizontal, 12) + } + } +} + +#Preview { + LoginView() +} diff --git a/jason/Views/Auth/RegisterView.swift b/jason/Views/Auth/RegisterView.swift new file mode 100644 index 0000000..059d8d7 --- /dev/null +++ b/jason/Views/Auth/RegisterView.swift @@ -0,0 +1,70 @@ +// +// RegisterView.swift +// jason +// +// Created by Jason on 2024/1/19. +// + +import SwiftUI + +struct RegisterView: View { + @State private var username: String = "" + @State private var password: String = "" + @State private var showNext: Bool = false + + + var body: some View { + ScrollView { + VStack (alignment: .leading, spacing: 12) { +// Button(action: { +// dismiss() +// }, label: { +// Image(systemName: "chevron.backward") +// Text("返回") +// }) +// + TextField("请输入用户名",text: $username) + .padding(.all, 12) + .cornerRadius(6) + .border(Color.gray) + + SecureField("请输入密码", text: $password) + .padding(.all, 12) + .cornerRadius(6) + .border(Color.gray) + + HStack { + Button("注册") { + showNext = true + } + .padding(.vertical, 12) + .padding(.horizontal, 32) + .foregroundColor(.white) + + .cornerRadius(6) + .fullScreenCover(isPresented: $showNext, content: { + RegisterView() + }) + + Spacer() + + Button("登录") { + + } + .padding(.vertical, 12) + .padding(.horizontal, 32) + .foregroundColor(.white) + + .cornerRadius(6) + } + } + .padding(.all, 12) + .navigationTitle("注册") + .navigationBarTitleDisplayMode(.large) + } + } +} + +#Preview { + RegisterView() +} diff --git a/jason/Views/Home/HomeView.swift b/jason/Views/Home/HomeView.swift index 7e87e8c..23fb3af 100644 --- a/jason/Views/Home/HomeView.swift +++ b/jason/Views/Home/HomeView.swift @@ -10,10 +10,10 @@ import SwiftData struct HomeView: View { var body: some View { - ScrollView{ - VStack(alignment: .leading, content: { + ScrollView { + ZStack(alignment: .leading) { UserCardComponent() - }) + } } .background(Color.orange) } diff --git a/jason/Views/LaunchScreen.storyboard b/jason/Views/LaunchScreen.storyboard new file mode 100644 index 0000000..9ec4564 --- /dev/null +++ b/jason/Views/LaunchScreen.storyboard @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jason/Views/Layouts/LaunchScreen.swift b/jason/Views/Layouts/LaunchScreen.swift new file mode 100644 index 0000000..9efaf8e --- /dev/null +++ b/jason/Views/Layouts/LaunchScreen.swift @@ -0,0 +1,30 @@ +// +// LaunchScreen.swift +// jason +// +// Created by Jason on 2024/1/19. +// + +import SwiftUI + +struct LaunchScreen: View { + var body: some View { + + Spacer() + Text("Jason.App") + .font(.largeTitle) + .fontWeight(.bold) + .foregroundColor(Color.red) + .multilineTextAlignment(.center) + Spacer() + Text("Copyright By Jason 2023") + .font(.custom("", size: 10)) + .foregroundColor(Color.gray) + .multilineTextAlignment(.center) + + } +} + +#Preview { + LaunchScreen() +} diff --git a/jason/Views/Layouts/TabbarView.swift b/jason/Views/Layouts/TabbarView.swift new file mode 100644 index 0000000..ae17e9a --- /dev/null +++ b/jason/Views/Layouts/TabbarView.swift @@ -0,0 +1,65 @@ +// +// TabBarView.swift +// jason +// +// Created by Jason on 2024/1/19. +// + +import SwiftUI + +struct TabBarView: View { + @AppStorage("selectedTab") var selectedTab : Tab = .home + + var body: some View { + ZStack(alignment: .leading) { + Group { + switch selectedTab { + case .home: + HomeView() + case .explore: + MallView() + case .message: + MessageView() + case .account: + UserView() + } + } +// .offset(y: -44) +// .safeAreaInset(edge: .top) { +// Color.clear.frame(height: 32) +// } + + HStack { + ForEach(tabItems) { item in + Button(action: { + selectedTab = item.tab + }, label: { + VStack (spacing: 6) { + Image(systemName: item.icon).resizable().frame(width: 18, height: 18) + Text(item.text) + .font(.caption) + .fontWeight(.regular) + .multilineTextAlignment(.center) + .lineLimit(1) + } + .frame(maxWidth: .infinity) + }) + .foregroundColor(selectedTab == item.tab ? Color("MainText") : Color.secondary) + .shadow(color: (selectedTab == item.tab ? Color.orange: Color.blue), radius: 15) + } + } + .padding(.top, 12.0) + .padding(.bottom, 32) + .background(Color("TabBarColor")) + .frame(maxHeight: .infinity, alignment: .bottom) + .shadow(color: Color.gray.opacity(0.5), radius: 6, x: 0, y: 6) + .ignoresSafeArea() + } + .statusBarHidden(false) + } +} + +#Preview { + TabBarView() +} + diff --git a/jason/Views/Mall/MallView.swift b/jason/Views/Mall/MallView.swift new file mode 100644 index 0000000..4e19a0a --- /dev/null +++ b/jason/Views/Mall/MallView.swift @@ -0,0 +1,20 @@ +// +// MallView.swift +// jason +// +// Created by Jason on 2024/1/19. +// + +import SwiftUI + +struct MallView: View { + var body: some View { + ScrollView { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } + } +} + +#Preview { + MallView() +} diff --git a/jason/Views/Message/MessageView.swift b/jason/Views/Message/MessageView.swift new file mode 100644 index 0000000..97480e7 --- /dev/null +++ b/jason/Views/Message/MessageView.swift @@ -0,0 +1,25 @@ +// +// MessageView.swift +// jason +// +// Created by Jason on 2024/1/19. +// + +import SwiftUI + +struct MessageView: View { + var body: some View { + ScrollView { + + ForEach (0 ..< 55) { item in + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } + + } + + } +} + +#Preview { + MessageView() +} diff --git a/jason/Views/Search/SearchView.swift b/jason/Views/Search/SearchView.swift new file mode 100644 index 0000000..78f84c0 --- /dev/null +++ b/jason/Views/Search/SearchView.swift @@ -0,0 +1,18 @@ +// +// SearchView.swift +// jason +// +// Created by Jason on 2024/1/22. +// + +import SwiftUI + +struct SearchView: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +#Preview { + SearchView() +} diff --git a/jason/Views/TabbarView.swift b/jason/Views/TabbarView.swift deleted file mode 100644 index 06d5a35..0000000 --- a/jason/Views/TabbarView.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// TabbarView.swift -// jason -// -// Created by Jason on 2024/1/16. -// - -import SwiftUI - -struct TabbarView: View { - var body: some View { - TabView() { - HomeView() - .tabItem { - Image(systemName: "house") - Text("Home") - } - .tag(1) - ExploreView() - .tabItem { - Image(systemName: "magnifyingglass") - Text("Explore") - } - .tag(2) - UserView() - .tabItem { - Image(systemName: "person") - Text("User") - } - .tag(3) - } - .background(Color.white) - } -} - -#Preview { - TabbarView() -} diff --git a/jason/Views/User/UserView.swift b/jason/Views/User/UserView.swift index 8100efe..6983c9e 100644 --- a/jason/Views/User/UserView.swift +++ b/jason/Views/User/UserView.swift @@ -8,17 +8,86 @@ import SwiftUI struct UserView: View { + @State private var toLogin: Bool = false + var body: some View { - ScrollView { - VStack (alignment: .leading) { - UserCardComponent() - Text("item") + NavigationView { + ScrollView { + VStack (alignment: .leading, spacing: 12) { + Header + + ToVip + + + + // + // NavigationLink(destination: LoginView(), label: { + // Text("qu zhuce ") + // }) + // Button("登录"){ + // toLogin = true + // } + // .padding(.vertical, 12) + // .padding(.horizontal, 32) + // .foregroundColor(.white) + // .background(Color.blue) + // .cornerRadius(12) + // .fullScreenCover(isPresented: $toLogin, content: { + // LoginView() + // }) + } + } } - .background(Color.red) + } + + var Header : some View { + HStack { + Image("Images/logo") + .resizable() + .frame(width: 64, height: 64) + .cornerRadius(32) + .overlay( + RoundedRectangle(cornerRadius: 32, style: .continuous) + .stroke(Color.red, lineWidth: 2) + ) + + VStack (alignment: .leading, spacing: 12, content: { + Text("用户名称") + .font(.title2) + .fontWeight(.regular) + Text("我的用户简介,超出部分需要隐藏,隐藏需要自动设置,这个文字长度也要有约束") + .font(.caption) + .foregroundColor(Color.gray) + .lineLimit(1) + }) + + Image(systemName: "gearshape") + .foregroundColor(Color.gray) + } + .padding(.horizontal, 16) + } + + var ToVip: some View { + HStack(spacing: /*@START_MENU_TOKEN@*/nil/*@END_MENU_TOKEN@*/, content: { + Spacer() + Button("立即开通") { + + } + .foregroundColor(Color.red) + .font(.subheadline) + .padding(.vertical, 8) + .padding(.horizontal, 16) + .background(Color.gray) + .cornerRadius(32) + }) + .padding(16) + .frame(maxWidth: .infinity) + .frame( height: 64) + .background(Image("Images/banner3").resizable().cornerRadius(/*@START_MENU_TOKEN@*/12.0/*@END_MENU_TOKEN@*/)) + .padding(.horizontal, 16) } } - #Preview { UserView() }