init
This commit is contained in:
18
demo/Views/Auth/ForgotView.swift
Normal file
18
demo/Views/Auth/ForgotView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// ForgotView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ForgotView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ForgotView()
|
||||
}
|
||||
18
demo/Views/Auth/LicenceView.swift
Normal file
18
demo/Views/Auth/LicenceView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Licence.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct LicenceView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
LicenceView()
|
||||
}
|
||||
18
demo/Views/Auth/LoginView.swift
Normal file
18
demo/Views/Auth/LoginView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// LoginView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct LoginView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
LoginView()
|
||||
}
|
||||
18
demo/Views/Auth/RegisterView.swift
Normal file
18
demo/Views/Auth/RegisterView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Register.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RegisterView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
RegisterView()
|
||||
}
|
||||
293
demo/Views/Home/HomeView.swift
Normal file
293
demo/Views/Home/HomeView.swift
Normal file
@@ -0,0 +1,293 @@
|
||||
//
|
||||
// HomeView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct HomeView: View {
|
||||
@State private var selectedTab = 0
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(spacing: 12) {
|
||||
// Search
|
||||
// Banner
|
||||
// Navigation
|
||||
// TodayKill
|
||||
// Living
|
||||
// Bestselling
|
||||
PartyReading
|
||||
// NewBooks
|
||||
// Categories
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.horizontal, 12)
|
||||
.background(Color.gray.opacity(0.2))
|
||||
}
|
||||
|
||||
let columns = [GridItem(.flexible()), GridItem(.flexible())]
|
||||
|
||||
var Categories: some View {
|
||||
VStack {
|
||||
ScrollView(.horizontal) {
|
||||
HStack {
|
||||
Text("推荐")
|
||||
Text("竞品书单")
|
||||
Text("少儿")
|
||||
Text("武侠")
|
||||
Text("文创")
|
||||
Text("历史")
|
||||
Text("专辑")
|
||||
Text("世纪难题")
|
||||
Text("个性推荐")
|
||||
}
|
||||
}
|
||||
|
||||
LazyVGrid(columns: columns, alignment: .center) {
|
||||
ForEach(0 ..< 20, id: \.self) { _ in
|
||||
GoodsCard()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var NewBooks: some View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text("新书上架")
|
||||
Spacer()
|
||||
|
||||
Image(systemName: "chevron.forward")
|
||||
}
|
||||
|
||||
HStack(alignment: .top) {
|
||||
ForEach(0 ..< 4) { _ in
|
||||
VStack {
|
||||
Image("Images/LaunchScreen")
|
||||
.resizable()
|
||||
.frame(maxHeight: 120)
|
||||
.cornerRadius(4)
|
||||
Text("唐伯虎的故事,成就的是谁")
|
||||
.lineLimit(1)
|
||||
}
|
||||
.frame(maxWidth: 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(12)
|
||||
.background(Color.white)
|
||||
.cornerRadius(12)
|
||||
}
|
||||
|
||||
var PartyReading: some View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text("党政读物预订专区")
|
||||
.font(.title3)
|
||||
.foregroundColor(Color.white)
|
||||
Spacer()
|
||||
ShowMore(title: "全部")
|
||||
}
|
||||
Text("阅读这10本书,让你深度学习党政相关知识,思想提升")
|
||||
.foregroundColor(Color.red)
|
||||
Text("治国必先治党,治党才能国强,进入新时代,以习近平通知为核心的党中央以前所未有的勇气和定理推进全面从严治党,")
|
||||
.font(.caption)
|
||||
.foregroundColor(Color.gray)
|
||||
.lineLimit(2)
|
||||
ScrollView(.horizontal) {
|
||||
HStack(alignment: .top) {
|
||||
ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { _ in
|
||||
VStack {
|
||||
Image("Images/LaunchScreen")
|
||||
.resizable()
|
||||
.frame(maxWidth: 120, maxHeight: 150)
|
||||
.cornerRadius(4)
|
||||
Text("唐伯虎的故事,成就的是谁")
|
||||
.lineLimit(1)
|
||||
}
|
||||
.frame(maxWidth: 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(12)
|
||||
.background(LinearGradient(colors: [Color.red, Color.white], startPoint: UnitPoint.top, endPoint: UnitPoint.bottom))
|
||||
.cornerRadius(12)
|
||||
}
|
||||
|
||||
var Bestselling: some View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text("畅销图书")
|
||||
Spacer()
|
||||
Text("全部")
|
||||
Image(systemName: "chevron.forward")
|
||||
}
|
||||
ScrollView(.horizontal) {
|
||||
HStack(alignment: .top) {
|
||||
ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { _ in
|
||||
VStack {
|
||||
Image("Images/LaunchScreen")
|
||||
.resizable()
|
||||
.frame(maxWidth: 120, maxHeight: 150)
|
||||
.cornerRadius(4)
|
||||
Text("唐伯虎的故事,成就的是谁")
|
||||
.lineLimit(1)
|
||||
HStack {
|
||||
Image(systemName: "eye")
|
||||
Text("299万")
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(12)
|
||||
.background(Color.white)
|
||||
.cornerRadius(12)
|
||||
}
|
||||
|
||||
var Living: some View {
|
||||
HStack {
|
||||
ForEach(0 ..< 3) { _ in
|
||||
VStack {
|
||||
HStack {
|
||||
Text("正在直播")
|
||||
Image(systemName: "livephoto")
|
||||
}
|
||||
Image("Images/LaunchScreen")
|
||||
.resizable(resizingMode: /*@START_MENU_TOKEN@*/ .stretch/*@END_MENU_TOKEN@*/)
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(maxWidth: 120)
|
||||
.cornerRadius(12)
|
||||
}
|
||||
.background(Color.pink.opacity(0.5))
|
||||
.cornerRadius(12)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var TodayKill: some View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text("今日秒杀")
|
||||
Text("00:00:00")
|
||||
}
|
||||
HStack {
|
||||
Image("Images/LaunchScreen")
|
||||
.resizable(resizingMode: /*@START_MENU_TOKEN@*/ .stretch/*@END_MENU_TOKEN@*/)
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(maxWidth: 120)
|
||||
VStack {
|
||||
Text("石床垫:阿特伍德黑暗就故事(有的人说啥就是啥呢有的人说啥就是啥呢有的人说啥就是啥呢)")
|
||||
.multilineTextAlignment(/*@START_MENU_TOKEN@*/ .leading/*@END_MENU_TOKEN@*/)
|
||||
.lineLimit(/*@START_MENU_TOKEN@*/2/*@END_MENU_TOKEN@*/)
|
||||
.foregroundColor(Color.white)
|
||||
Text("¥19.99")
|
||||
.foregroundColor(Color.red)
|
||||
.padding(12)
|
||||
.cornerRadius(12)
|
||||
.background(Color.white)
|
||||
HStack {
|
||||
Text("抢购")
|
||||
Image(systemName: "chevron.forward")
|
||||
}
|
||||
.foregroundColor(Color.white)
|
||||
}
|
||||
}
|
||||
HStack {
|
||||
ForEach(0 ..< 5) { _ in
|
||||
VStack {
|
||||
Image("Images/LaunchScreen")
|
||||
.resizable(resizingMode: /*@START_MENU_TOKEN@*/ .stretch/*@END_MENU_TOKEN@*/)
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(maxWidth: 120)
|
||||
Text("是石床垫:阿特伍德黑暗就故事")
|
||||
.lineLimit(1)
|
||||
Text("¥19.99")
|
||||
.foregroundColor(Color.red)
|
||||
}
|
||||
.frame(maxWidth: 110)
|
||||
.background(Color.white)
|
||||
}
|
||||
}
|
||||
.padding(12)
|
||||
.background(Color.white.opacity(0.3))
|
||||
}
|
||||
.frame(maxWidth: /*@START_MENU_TOKEN@*/ .infinity/*@END_MENU_TOKEN@*/)
|
||||
.background(Color.pink)
|
||||
.cornerRadius(12)
|
||||
}
|
||||
|
||||
var Navigation: some View {
|
||||
HStack(spacing: 32) {
|
||||
ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { _ in
|
||||
VStack {
|
||||
Image("Images/logo")
|
||||
.resizable(resizingMode: /*@START_MENU_TOKEN@*/ .stretch/*@END_MENU_TOKEN@*/)
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.background(Color.white)
|
||||
.cornerRadius(64)
|
||||
|
||||
Text("图书")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var Banner: some View {
|
||||
HStack {
|
||||
Image("Images/banner1")
|
||||
.resizable(resizingMode: .stretch)
|
||||
.aspectRatio(contentMode: .fit)
|
||||
Image("Images/banner2")
|
||||
.resizable(resizingMode: .stretch)
|
||||
.aspectRatio(contentMode: .fit)
|
||||
Image("Images/banner3")
|
||||
.resizable(resizingMode: .stretch)
|
||||
.aspectRatio(contentMode: .fit)
|
||||
}
|
||||
|
||||
.frame(maxWidth: /*@START_MENU_TOKEN@*/ .infinity/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
|
||||
var Search: some View {
|
||||
HStack(alignment: .center, spacing: 16) {
|
||||
HStack {
|
||||
Image(systemName: "magnifyingglass")
|
||||
.resizable()
|
||||
.frame(width: 18, height: 18)
|
||||
.foregroundColor(Color.gray)
|
||||
Text("搜索书籍")
|
||||
.foregroundColor(Color.gray)
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: /*@START_MENU_TOKEN@*/ .infinity/*@END_MENU_TOKEN@*/)
|
||||
.padding(12)
|
||||
.background(Color.white)
|
||||
.cornerRadius(32)
|
||||
ZStack {
|
||||
Image(systemName: "bell").resizable().frame(width: 24, height: 24)
|
||||
Text("9")
|
||||
.font(.system(size: 12))
|
||||
.padding(4)
|
||||
.frame(minWidth: 24)
|
||||
.background(Color.red)
|
||||
.foregroundColor(Color.white)
|
||||
.cornerRadius(99)
|
||||
.offset(x: 10, y: -10)
|
||||
}
|
||||
.padding(.trailing, 12)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// #Preview {
|
||||
// HomeView()
|
||||
// }
|
||||
18
demo/Views/Home/NoticeListView.swift
Normal file
18
demo/Views/Home/NoticeListView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// NoticeListView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct NoticeListView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NoticeListView()
|
||||
}
|
||||
18
demo/Views/Home/NoticeView.swift
Normal file
18
demo/Views/Home/NoticeView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// NoticeView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct NoticeView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NoticeView()
|
||||
}
|
||||
18
demo/Views/Home/SearchView.swift
Normal file
18
demo/Views/Home/SearchView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// SearchView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SearchView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SearchView()
|
||||
}
|
||||
64
demo/Views/Layouts/TabBarView.swift
Normal file
64
demo/Views/Layouts/TabBarView.swift
Normal file
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// 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: -64)
|
||||
// .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()
|
||||
}
|
||||
18
demo/Views/Mall/CartView.swift
Normal file
18
demo/Views/Mall/CartView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// CartView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CartView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
CartView()
|
||||
}
|
||||
18
demo/Views/Mall/CategoryView.swift
Normal file
18
demo/Views/Mall/CategoryView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// CategoryView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CategoryView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
CategoryView()
|
||||
}
|
||||
18
demo/Views/Mall/GoodsCommentsView.swift
Normal file
18
demo/Views/Mall/GoodsCommentsView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// GoodsCommentsView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct GoodsCommentsView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
GoodsCommentsView()
|
||||
}
|
||||
18
demo/Views/Mall/GoodsDetailView.swift
Normal file
18
demo/Views/Mall/GoodsDetailView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// GoodsDetail.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct GoodsDetailView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
GoodsDetailView()
|
||||
}
|
||||
18
demo/Views/Mall/MallView.swift
Normal file
18
demo/Views/Mall/MallView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// MallView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct MallView: View {
|
||||
var body: some View {
|
||||
Text("Mall Page")
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
MallView()
|
||||
}
|
||||
18
demo/Views/Message/MessageView.swift
Normal file
18
demo/Views/Message/MessageView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// MessageView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct MessageView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
MessageView()
|
||||
}
|
||||
18
demo/Views/User/Account/AccountView.swift
Normal file
18
demo/Views/User/Account/AccountView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// AccountView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct AccountView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
AccountView()
|
||||
}
|
||||
18
demo/Views/User/Account/BalanceView.swift
Normal file
18
demo/Views/User/Account/BalanceView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// BalanceView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct BalanceView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
BalanceView()
|
||||
}
|
||||
18
demo/Views/User/Account/CouponView.swift
Normal file
18
demo/Views/User/Account/CouponView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// CouponView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CouponView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
CouponView()
|
||||
}
|
||||
18
demo/Views/User/Order/OrderDetailView.swift
Normal file
18
demo/Views/User/Order/OrderDetailView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// OrderDetailView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct OrderDetailView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
OrderDetailView()
|
||||
}
|
||||
18
demo/Views/User/Order/OrdersView.swift
Normal file
18
demo/Views/User/Order/OrdersView.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// OrdersView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct OrdersView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
OrdersView()
|
||||
}
|
||||
183
demo/Views/User/UserView.swift
Normal file
183
demo/Views/User/UserView.swift
Normal file
@@ -0,0 +1,183 @@
|
||||
//
|
||||
// UserView.swift
|
||||
// demo
|
||||
//
|
||||
// Created by Jason on 2024/1/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct UserView: View {
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
Header
|
||||
ToVip
|
||||
|
||||
VStack(spacing: 16) {
|
||||
InfoList
|
||||
Notice
|
||||
OrderShow
|
||||
Coupons
|
||||
tj
|
||||
}
|
||||
.padding(16)
|
||||
.background(LinearGradient(colors: [Color.orange, Color.gray], startPoint: .top, endPoint: UnitPoint(x: 0, y: 0.5)))
|
||||
.cornerRadius(12)
|
||||
.offset(y: -76)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
.padding(.bottom, 64)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(
|
||||
Image("Images/banner3").resizable(resizingMode: .tile)
|
||||
// .overlay(
|
||||
// UnevenRoundedRectangle(cornerRadii: RectangleCornerRadii(topLeading: 12, topTrailing: 12))
|
||||
// )
|
||||
)
|
||||
.cornerRadius(12)
|
||||
.padding(.horizontal, 16)
|
||||
}
|
||||
|
||||
var InfoList: some View {
|
||||
ScrollView(.horizontal) {
|
||||
HStack(spacing: 16) {
|
||||
ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { _ in
|
||||
VStack {
|
||||
HStack {
|
||||
Image(systemName: "star")
|
||||
Text("我的积分")
|
||||
}
|
||||
Text("共8888分")
|
||||
.font(.caption)
|
||||
}
|
||||
.padding(12)
|
||||
.background(Color.white)
|
||||
.cornerRadius(8)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var Notice: some View {
|
||||
HStack {
|
||||
Text("资讯")
|
||||
.padding(4)
|
||||
.background(Color.red)
|
||||
.foregroundColor(Color.white)
|
||||
Text("平台与2024年1余额开始更新,敬请期待@@@")
|
||||
.foregroundColor(Color.gray)
|
||||
.frame(maxWidth: .infinity)
|
||||
.multilineTextAlignment(/*@START_MENU_TOKEN@*/ .leading/*@END_MENU_TOKEN@*/)
|
||||
.lineLimit(1)
|
||||
Text("更多")
|
||||
.foregroundColor(Color.secondary)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(8)
|
||||
.background(Color.white)
|
||||
.cornerRadius(8)
|
||||
}
|
||||
|
||||
var OrderShow: some View {
|
||||
VStack(spacing: 16) {
|
||||
HStack {
|
||||
Text("订单中心")
|
||||
Spacer()
|
||||
ShowMore()
|
||||
}
|
||||
.padding(8)
|
||||
HStack {
|
||||
Spacer()
|
||||
ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { _ in
|
||||
VStack {
|
||||
Image(systemName: "wallet.pass")
|
||||
Text("待付款")
|
||||
.font(.system(size: 12))
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
.background(Color.white)
|
||||
.cornerRadius(6)
|
||||
}
|
||||
|
||||
var Coupons: some View {
|
||||
VStack(spacing: 16) {
|
||||
HStack {
|
||||
Spacer()
|
||||
ForEach(/*@START_MENU_TOKEN@*/0 ..< 5/*@END_MENU_TOKEN@*/) { _ in
|
||||
VStack {
|
||||
Image(systemName: "wallet.pass")
|
||||
Text("优惠券")
|
||||
.font(.system(size: 12))
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(12)
|
||||
.background(Color.white)
|
||||
.cornerRadius(6)
|
||||
}
|
||||
|
||||
let columns = [GridItem(.flexible()), GridItem(.flexible())]
|
||||
|
||||
var tj: some View {
|
||||
LazyVGrid(columns: columns, alignment: .center) {
|
||||
Section {
|
||||
ForEach(0 ..< 20, id: \.self) { _ in
|
||||
GoodsCard()
|
||||
}
|
||||
}
|
||||
header: {
|
||||
Text("推荐广场")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// #Preview {
|
||||
// UserView()
|
||||
// }
|
||||
Reference in New Issue
Block a user