initial import from openclaw workspace
This commit is contained in:
commit
27d0d57b56
59 files changed
+2666
No files matched your search
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import SwiftUI
|
||||
import Shared
|
||||
|
||||
struct DetailView: View {
|
||||
let product: Product
|
||||
let favoriteStore: FavoriteStore
|
||||
let cartStore: CartStore
|
||||
let onChanged: () -> Void
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
Text(product.title)
|
||||
.font(.title2)
|
||||
|
||||
Text("价格:¥\(String(format: "%.2f", product.price))")
|
||||
.font(.headline)
|
||||
|
||||
Text(product.description_)
|
||||
.foregroundStyle(.secondary)
|
||||
|
||||
HStack(spacing: 10) {
|
||||
Button("加入购物车") {
|
||||
cartStore.add(product: product)
|
||||
onChanged()
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
|
||||
Button(favoriteStore.isFavorite(productId: product.id) ? "取消收藏" : "收藏") {
|
||||
favoriteStore.toggle(productId: product.id)
|
||||
onChanged()
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding()
|
||||
.navigationTitle("商品详情")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
<dict>
|
||||
<key>UIApplicationSupportsMultipleScenes</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>UILaunchScreen</key>
|
||||
<dict/>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,2 @@
|
||||
// Kept for Xcode project file compatibility after removing template view-model bindings.
|
||||
// Mini Shopping iOS UI currently uses direct Shared business classes.
|
||||
@@ -0,0 +1,71 @@
|
||||
import SwiftUI
|
||||
import Shared
|
||||
|
||||
struct ListView: View {
|
||||
@State private var query: String = ""
|
||||
@State private var tick: Int = 0
|
||||
|
||||
private let repository = FakeProductRepository()
|
||||
private let favoriteStore = FavoriteStore()
|
||||
private let cartStore = CartStore()
|
||||
|
||||
private var products: [Product] {
|
||||
let all = repository.getProducts()
|
||||
guard !query.isEmpty else { return all }
|
||||
return all.filter {
|
||||
$0.title.localizedCaseInsensitiveContains(query) ||
|
||||
$0.description_.localizedCaseInsensitiveContains(query)
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
VStack(spacing: 12) {
|
||||
TextField("搜索课程", text: $query)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
.padding(.horizontal)
|
||||
|
||||
List(products, id: \.id) { product in
|
||||
NavigationLink {
|
||||
DetailView(
|
||||
product: product,
|
||||
favoriteStore: favoriteStore,
|
||||
cartStore: cartStore,
|
||||
onChanged: { tick += 1 }
|
||||
)
|
||||
} label: {
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
HStack {
|
||||
Text(product.title)
|
||||
.font(.headline)
|
||||
Spacer()
|
||||
Text("¥\(String(format: "%.2f", product.price))")
|
||||
.font(.subheadline)
|
||||
}
|
||||
|
||||
Text(product.description_)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
|
||||
HStack(spacing: 8) {
|
||||
Button(favoriteStore.isFavorite(productId: product.id) ? "已收藏" : "收藏") {
|
||||
favoriteStore.toggle(productId: product.id)
|
||||
tick += 1
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
|
||||
let q = cartStore.state().quantityOf(productId: product.id)
|
||||
if q > 0 {
|
||||
Text("已加购 x\(q)")
|
||||
.font(.caption)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 4)
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("Mini Shopping")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"sourceLanguage" : "en",
|
||||
"strings" : {
|
||||
"NoDataAvailable" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "No data available"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"version" : "1.0"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct iOSApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ListView()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user