add view
This commit is contained in:
parent
d91860af49
commit
6e054fc169
40
punchnet/Views/Settings/SettingsAboutView.swift
Normal file
40
punchnet/Views/Settings/SettingsAboutView.swift
Normal file
@ -0,0 +1,40 @@
|
||||
//
|
||||
// SettingsAboutView.swift
|
||||
// punchnet
|
||||
//
|
||||
// Created by 安礼成 on 2026/1/19.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsAboutView: View {
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
Text("关于PunchNet")
|
||||
|
||||
HStack {
|
||||
Text("当前版本")
|
||||
Text("v1.25(arm64)")
|
||||
|
||||
Text("检查更新")
|
||||
}
|
||||
|
||||
Button {
|
||||
|
||||
} label: {
|
||||
Text("用户反馈")
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("隐私政策")
|
||||
Text("服务条款")
|
||||
}
|
||||
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SettingsAboutView()
|
||||
}
|
||||
@ -40,6 +40,7 @@ struct SettingsAccountView: View {
|
||||
.background(Color.gray.opacity(0.2))
|
||||
.cornerRadius(5)
|
||||
}
|
||||
|
||||
Button {
|
||||
|
||||
} label: {
|
||||
|
||||
43
punchnet/Views/Settings/SettingsDeviceView.swift
Normal file
43
punchnet/Views/Settings/SettingsDeviceView.swift
Normal file
@ -0,0 +1,43 @@
|
||||
//
|
||||
// SettingsDeviceView.swift
|
||||
// punchnet
|
||||
//
|
||||
// Created by 安礼成 on 2026/1/19.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsDeviceView: View {
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Text("设备")
|
||||
|
||||
HStack {
|
||||
Text("设备名称")
|
||||
Text("史蒂夫的air")
|
||||
|
||||
Button {
|
||||
|
||||
} label: {
|
||||
Text("修改")
|
||||
}
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("虚拟IPv4")
|
||||
Text("192.168.1.1")
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("虚拟IPv6")
|
||||
Text("ab:ef:1")
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SettingsDeviceView()
|
||||
}
|
||||
83
punchnet/Views/Settings/SettingsNetworkView.swift
Normal file
83
punchnet/Views/Settings/SettingsNetworkView.swift
Normal file
@ -0,0 +1,83 @@
|
||||
//
|
||||
// SettingsNetworkView.swift
|
||||
// punchnet
|
||||
//
|
||||
// Created by 安礼成 on 2026/1/19.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsNetworkView: View {
|
||||
@State var state: SettingsState = SettingsState()
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
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("详情")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
HStack {
|
||||
Text("出口节点")
|
||||
|
||||
Menu {
|
||||
ForEach(state.exitNodes, id: \.id) { node in
|
||||
Button(node.name) {
|
||||
self.state.selectedExitNode = node
|
||||
}
|
||||
}
|
||||
|
||||
} label: {
|
||||
Text(state.selectedExitNode.name)
|
||||
}
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("授权状态")
|
||||
Text("有效")
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("授权有效期")
|
||||
Text("临时(至断开连接)")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SettingsNetworkView()
|
||||
}
|
||||
@ -15,10 +15,20 @@ class SettingsState {
|
||||
var name: String
|
||||
}
|
||||
|
||||
var networks: [Network]
|
||||
struct ExitNode {
|
||||
var id: Int
|
||||
var name: String
|
||||
}
|
||||
|
||||
|
||||
var networks: [Network]
|
||||
var selectedNetwork: Network
|
||||
|
||||
|
||||
var exitNodes: [ExitNode]
|
||||
var selectedExitNode: ExitNode
|
||||
|
||||
|
||||
init() {
|
||||
let networks: [Network] = [
|
||||
.init(id: 1, name: "测试网络12"),
|
||||
@ -30,6 +40,18 @@ class SettingsState {
|
||||
|
||||
self.selectedNetwork = networks[0]
|
||||
self.networks = networks
|
||||
|
||||
|
||||
let exitNodes: [ExitNode] = [
|
||||
.init(id: 1, name: "出口节点1"),
|
||||
.init(id: 2, name: "出口节点12"),
|
||||
.init(id: 3, name: "出口节点13"),
|
||||
.init(id: 4, name: "出口节点14"),
|
||||
.init(id: 5, name: "出口节点15"),
|
||||
]
|
||||
self.selectedExitNode = exitNodes[0]
|
||||
self.exitNodes = exitNodes
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
27
punchnet/Views/Settings/SettingsSystemView.swift
Normal file
27
punchnet/Views/Settings/SettingsSystemView.swift
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// SettingsSystemView.swift
|
||||
// punchnet
|
||||
//
|
||||
// Created by 安礼成 on 2026/1/19.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsSystemView: View {
|
||||
@State private var isOn: Bool = false
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Toggle("开机时启动", isOn: $isOn)
|
||||
Toggle("启动时候自动连接", isOn: $isOn)
|
||||
Toggle("启动时显示主界面", isOn: $isOn)
|
||||
Toggle("自动安装更新", isOn: $isOn)
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SettingsSystemView()
|
||||
}
|
||||
53
punchnet/Views/Settings/SettingsUserIssueView.swift
Normal file
53
punchnet/Views/Settings/SettingsUserIssueView.swift
Normal file
@ -0,0 +1,53 @@
|
||||
//
|
||||
// SettingsUserIssueView.swift
|
||||
// punchnet
|
||||
//
|
||||
// Created by 安礼成 on 2026/1/19.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsUserIssueView: View {
|
||||
@State private var account: String = ""
|
||||
@State private var text: String = ""
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Text("用户反馈")
|
||||
|
||||
TextField("", text: $account)
|
||||
.multilineTextAlignment(.leading)
|
||||
.textFieldStyle(PlainTextFieldStyle())
|
||||
.frame(width: 200, height: 25)
|
||||
.background(Color.clear)
|
||||
.foregroundColor(Color.black)
|
||||
.overlay(
|
||||
Rectangle()
|
||||
.frame(height: 1)
|
||||
.foregroundColor(.blue)
|
||||
.padding(.top, 25)
|
||||
, alignment: .topLeading)
|
||||
|
||||
TextEditor(text: $text)
|
||||
.padding(4)
|
||||
.overlay(alignment: .topLeading) {
|
||||
if text.isEmpty {
|
||||
Text("请输入内容")
|
||||
.foregroundColor(.gray)
|
||||
.padding(.leading, 8)
|
||||
}
|
||||
}
|
||||
.frame(minHeight: 120)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 6)
|
||||
.stroke(Color.gray.opacity(0.4))
|
||||
)
|
||||
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SettingsUserIssueView()
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user