diff --git a/client/AssetAssistant/AssetAssistant.xcodeproj/project.pbxproj b/client/AssetAssistant/AssetAssistant.xcodeproj/project.pbxproj new file mode 100644 index 0000000..e23362a --- /dev/null +++ b/client/AssetAssistant/AssetAssistant.xcodeproj/project.pbxproj @@ -0,0 +1,356 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXFileReference section */ + 2BDE0AF52EC86E8F00C55B93 /* AssetAssistant.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AssetAssistant.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 2BDE0AF72EC86E8F00C55B93 /* AssetAssistant */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = AssetAssistant; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2BDE0AF22EC86E8F00C55B93 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2BDE0AEC2EC86E8E00C55B93 = { + isa = PBXGroup; + children = ( + 2BDE0AF72EC86E8F00C55B93 /* AssetAssistant */, + 2BDE0AF62EC86E8F00C55B93 /* Products */, + ); + sourceTree = ""; + }; + 2BDE0AF62EC86E8F00C55B93 /* Products */ = { + isa = PBXGroup; + children = ( + 2BDE0AF52EC86E8F00C55B93 /* AssetAssistant.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2BDE0AF42EC86E8F00C55B93 /* AssetAssistant */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2BDE0B002EC86E8F00C55B93 /* Build configuration list for PBXNativeTarget "AssetAssistant" */; + buildPhases = ( + 2BDE0AF12EC86E8F00C55B93 /* Sources */, + 2BDE0AF22EC86E8F00C55B93 /* Frameworks */, + 2BDE0AF32EC86E8F00C55B93 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 2BDE0AF72EC86E8F00C55B93 /* AssetAssistant */, + ); + name = AssetAssistant; + packageProductDependencies = ( + ); + productName = AssetAssistant; + productReference = 2BDE0AF52EC86E8F00C55B93 /* AssetAssistant.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2BDE0AED2EC86E8E00C55B93 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 2600; + LastUpgradeCheck = 2600; + TargetAttributes = { + 2BDE0AF42EC86E8F00C55B93 = { + CreatedOnToolsVersion = 26.0; + }; + }; + }; + buildConfigurationList = 2BDE0AF02EC86E8E00C55B93 /* Build configuration list for PBXProject "AssetAssistant" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 2BDE0AEC2EC86E8E00C55B93; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 2BDE0AF62EC86E8F00C55B93 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2BDE0AF42EC86E8F00C55B93 /* AssetAssistant */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2BDE0AF32EC86E8F00C55B93 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2BDE0AF12EC86E8F00C55B93 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 2BDE0AFE2EC86E8F00C55B93 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = U67YL4F3XK; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 2BDE0AFF2EC86E8F00C55B93 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = U67YL4F3XK; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SWIFT_COMPILATION_MODE = wholemodule; + }; + name = Release; + }; + 2BDE0B012EC86E8F00C55B93 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U67YL4F3XK; + ENABLE_APP_SANDBOX = YES; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + ENABLE_USER_SELECTED_FILES = readonly; + GENERATE_INFOPLIST_FILE = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 26.0; + LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 26.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.vipstation.AssetAssistant.AssetAssistant; + PRODUCT_NAME = "$(TARGET_NAME)"; + REGISTER_APP_GROUPS = YES; + SDKROOT = auto; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,7"; + XROS_DEPLOYMENT_TARGET = 26.0; + }; + name = Debug; + }; + 2BDE0B022EC86E8F00C55B93 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U67YL4F3XK; + ENABLE_APP_SANDBOX = YES; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + ENABLE_USER_SELECTED_FILES = readonly; + GENERATE_INFOPLIST_FILE = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; + "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; + "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 26.0; + LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 26.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.vipstation.AssetAssistant.AssetAssistant; + PRODUCT_NAME = "$(TARGET_NAME)"; + REGISTER_APP_GROUPS = YES; + SDKROOT = auto; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,7"; + XROS_DEPLOYMENT_TARGET = 26.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2BDE0AF02EC86E8E00C55B93 /* Build configuration list for PBXProject "AssetAssistant" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2BDE0AFE2EC86E8F00C55B93 /* Debug */, + 2BDE0AFF2EC86E8F00C55B93 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2BDE0B002EC86E8F00C55B93 /* Build configuration list for PBXNativeTarget "AssetAssistant" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2BDE0B012EC86E8F00C55B93 /* Debug */, + 2BDE0B022EC86E8F00C55B93 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2BDE0AED2EC86E8E00C55B93 /* Project object */; +} diff --git a/client/AssetAssistant/AssetAssistant.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/client/AssetAssistant/AssetAssistant.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/client/AssetAssistant/AssetAssistant.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/client/AssetAssistant/AssetAssistant/AssetAssistantApp.swift b/client/AssetAssistant/AssetAssistant/AssetAssistantApp.swift new file mode 100644 index 0000000..a41b057 --- /dev/null +++ b/client/AssetAssistant/AssetAssistant/AssetAssistantApp.swift @@ -0,0 +1,17 @@ +// +// AssetAssistantApp.swift +// AssetAssistant +// +// Created by vipg on 2025/11/15. +// + +import SwiftUI + +@main +struct AssetAssistantApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/client/AssetAssistant/AssetAssistant/Assets.xcassets/AccentColor.colorset/Contents.json b/client/AssetAssistant/AssetAssistant/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/client/AssetAssistant/AssetAssistant/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/client/AssetAssistant/AssetAssistant/Assets.xcassets/AppIcon.appiconset/Contents.json b/client/AssetAssistant/AssetAssistant/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..ffdfe15 --- /dev/null +++ b/client/AssetAssistant/AssetAssistant/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,85 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "tinted" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/client/AssetAssistant/AssetAssistant/Assets.xcassets/Contents.json b/client/AssetAssistant/AssetAssistant/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/client/AssetAssistant/AssetAssistant/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/client/AssetAssistant/AssetAssistant/LoginView.swift b/client/AssetAssistant/AssetAssistant/LoginView.swift new file mode 100644 index 0000000..3309da6 --- /dev/null +++ b/client/AssetAssistant/AssetAssistant/LoginView.swift @@ -0,0 +1,308 @@ +// +// FinanceLoginView.swift +// AssetAssistant +// +// Created by vipg on 2025/11/15. +// + +import SwiftUI + +struct FinanceLoginView: View { + // 状态管理 + @State private var username: String = "" + @State private var password: String = "" + @State private var isPasswordVisible: Bool = false + @State private var isLoggingIn: Bool = false + @State private var showError: Bool = false + @State private var errorMessage: String = "" + + // 环境变量 - 监听外观模式变化 + @Environment(\.colorScheme) var colorScheme + + // 计算属性 - 动态颜色 + private var primaryColor: Color { + colorScheme == .dark ? .blue : .blue + } + + private var secondaryColor: Color { + colorScheme == .dark ? .blue.opacity(0.8) : .blue.opacity(0.9) + } + + private var backgroundColor: Color { + colorScheme == .dark ? .black : .white + } + + private var cardColor: Color { + colorScheme == .dark ? Color(red: 0.1, green: 0.1, blue: 0.15) : Color(red: 0.98, green: 0.98, blue: 0.99) + } + + private var textColor: Color { + colorScheme == .dark ? .white : .black + } + + private var subTextColor: Color { + colorScheme == .dark ? .gray.opacity(0.8) : .gray.opacity(0.9) + } + + // 表单验证 + private var isFormValid: Bool { + return !username.isEmpty && password.count >= 6 + } + + // 登录操作 + private func handleLogin() { + guard isFormValid else { + errorMessage = "请输入有效的账号和密码(密码至少6位)" + showError = true + return + } + + isLoggingIn = true + + // 模拟网络请求 + DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { + isLoggingIn = false + + // 模拟登录结果 + if username.lowercased() == "finance" && password == "123456" { + // 登录成功,这里可以添加导航到主页的逻辑 + print("登录成功") + } else { + errorMessage = "账号或密码错误,请重试" + showError = true + } + } + } + + var body: some View { + ZStack { + // 背景渐变 + LinearGradient( + gradient: Gradient(colors: [ + backgroundColor, + colorScheme == .dark ? Color(red: 0.05, green: 0.05, blue: 0.1) : Color(red: 0.95, green: 0.95, blue: 0.97) + ]), + startPoint: .topLeading, + endPoint: .bottomTrailing + ) + .ignoresSafeArea() + + // 主内容 + VStack(spacing: 32) { + // 顶部Logo和标题 + VStack(spacing: 8) { + Image(systemName: "banknote.fill") + .font(.system(size: 56)) + .foregroundColor(primaryColor) + + Text("金融安全登录") + .font(.largeTitle) + .fontWeight(.bold) + .foregroundColor(textColor) + + Text("安全、便捷的金融服务入口") + .font(.subheadline) + .foregroundColor(subTextColor) + } + + Spacer() + + // 登录表单卡片 + VStack(spacing: 24) { + // 用户名输入框 + VStack(alignment: .leading, spacing: 8) { + Text("账号") + .font(.headline) + .foregroundColor(textColor) + + HStack { + Image(systemName: "person.fill") + .foregroundColor(subTextColor) + + TextField("请输入用户名或手机号", text: $username) + .font(.body) + .foregroundColor(textColor) + .autocapitalization(.none) + .autocorrectionDisabled() + } + .padding() + .background(cardColor) + .cornerRadius(12) + .overlay( + RoundedRectangle(cornerRadius: 12) + .stroke(username.isEmpty ? Color.clear : primaryColor.opacity(0.5), lineWidth: 1) + ) + } + + // 密码输入框 + VStack(alignment: .leading, spacing: 8) { + Text("密码") + .font(.headline) + .foregroundColor(textColor) + + HStack { + Image(systemName: "lock.fill") + .foregroundColor(subTextColor) + + if isPasswordVisible { + TextField("请输入密码", text: $password) + .font(.body) + .foregroundColor(textColor) + .autocapitalization(.none) + .autocorrectionDisabled() + } else { + SecureField("请输入密码", text: $password) + .font(.body) + .foregroundColor(textColor) + .autocapitalization(.none) + .autocorrectionDisabled() + } + + Button(action: { + isPasswordVisible.toggle() + }) { + Image(systemName: isPasswordVisible ? "eye.fill" : "eye.slash.fill") + .foregroundColor(subTextColor) + } + } + .padding() + .background(cardColor) + .cornerRadius(12) + .overlay( + RoundedRectangle(cornerRadius: 12) + .stroke(password.isEmpty ? Color.clear : primaryColor.opacity(0.5), lineWidth: 1) + ) + } + + // 忘记密码 + HStack { + Spacer() + + Button(action: { + // 忘记密码逻辑 + print("忘记密码") + }) { + Text("忘记密码?") + .font(.subheadline) + .foregroundColor(primaryColor) + .underline() + } + } + + // 登录按钮 + Button(action: handleLogin) { + HStack(spacing: 8) { + if isLoggingIn { + ProgressView() + .progressViewStyle(CircularProgressViewStyle(tint: .white)) + } + + Text("安全登录") + .font(.headline) + .fontWeight(.semibold) + } + .frame(maxWidth: .infinity) + .padding() + .background(isFormValid ? primaryColor : secondaryColor.opacity(0.5)) + .foregroundColor(.white) + .cornerRadius(12) + .shadow(color: primaryColor.opacity(0.3), radius: 8, x: 0, y: 4) + .opacity(isFormValid ? 1.0 : 0.8) + } + .disabled(!isFormValid || isLoggingIn) + .buttonStyle(ScaleButtonStyle()) + } + .padding(24) + .background(cardColor) + .cornerRadius(20) + .shadow(color: Color.black.opacity(0.05), radius: 10, x: 0, y: 8) + .padding(.horizontal, 20) + + Spacer() + + // 注册入口 + HStack(spacing: 4) { + Text("还没有账号?") + .font(.subheadline) + .foregroundColor(subTextColor) + + Button(action: { + // 注册逻辑 + print("前往注册") + }) { + Text("立即注册") + .font(.subheadline) + .fontWeight(.semibold) + .foregroundColor(primaryColor) + } + } + .padding(.bottom, 32) + + // 安全提示 + Text("登录即表示您同意我们的用户协议和隐私政策") + .font(.caption) + .foregroundColor(subTextColor) + .multilineTextAlignment(.center) + .padding(.bottom, 16) + } + + // 错误提示弹窗 + if showError { + VStack { + Spacer() + + HStack { + Image(systemName: "exclamationmark.triangle.fill") + .foregroundColor(.yellow) + + Text(errorMessage) + .font(.subheadline) + .foregroundColor(textColor) + } + .padding() + .background(cardColor) + .cornerRadius(12) + .shadow(radius: 10) + .padding(.horizontal, 32) + + Spacer() + .frame(height: 32) + } + .transition(.opacity.combined(with: .move(edge: .bottom))) + .onAppear { + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + withAnimation { + showError = false + } + } + } + } + } + .animation(.easeInOut, value: showError) + .animation(.easeInOut, value: isPasswordVisible) + .animation(.easeInOut, value: username) + .animation(.easeInOut, value: password) + } +} + +// 自定义按钮样式 - 点击缩放效果 +struct ScaleButtonStyle: ButtonStyle { + func makeBody(configuration: Configuration) -> some View { + configuration.label + .scaleEffect(configuration.isPressed ? 0.98 : 1.0) + .animation(.easeInOut(duration: 0.1), value: configuration.isPressed) + } +} + +// 预览 +struct FinanceLoginView_Previews: PreviewProvider { + static var previews: some View { + Group { + FinanceLoginView() + .preferredColorScheme(.light) + + FinanceLoginView() + .preferredColorScheme(.dark) + } + } +}