// // SettingsAccountView.swift // punchnet // // Created by 安礼成 on 2026/1/16. // import SwiftUI struct SettingsAccountView: View { @State var state: SettingsState = SettingsState() var body: some View { ScrollView(.vertical, showsIndicators: false) { VStack(alignment: .leading) { Text("账户") AccountCreditView() AccountCreditView() TokenCreditView() AccountCreditView() TokenCreditView() Text("网络") HStack(alignment: .top) { Text("默认网络") VStack(alignment: .leading) { Menu { ForEach(state.networks, id: \.id) { network in Button(network.name) { self.state.selectedNetwork = network } } } label: { Text(state.selectedNetwork.name) .padding() .background(Color.gray.opacity(0.2)) .cornerRadius(5) } Button { } label: { Text("进入管理平台") } } Button { } label: { Text("详情") } } } } .padding() } } extension SettingsAccountView { // 基于账号密码的登陆 struct AccountCreditView: View { var body: some View { HStack { Image("logo") .resizable() .frame(width: 20, height: 20) Text("13012345678") Spacer() Button { } label: { Text("修改密码") } Button { } label: { Text("退出登陆") } } .frame(width: 400) } } // 基于Token的登陆 struct TokenCreditView: View { var body: some View { HStack { Image("logo") .resizable() .frame(width: 20, height: 20) Text("key_001") Spacer() Button { } label: { Text("退出登陆") } } .frame(width: 400) } } } #Preview { SettingsAccountView() }