마이페이지 추가
This commit is contained in:
@@ -7,9 +7,138 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
import Bootpay
|
||||
import BootpayUI
|
||||
import PopupView
|
||||
import RefreshableScrollView
|
||||
|
||||
struct MyPageView: View {
|
||||
|
||||
@StateObject var viewModel = MyPageViewModel()
|
||||
|
||||
@State private var payload = Payload()
|
||||
|
||||
var body: some View {
|
||||
Text("MyPage")
|
||||
BaseView(isLoading: $viewModel.isLoading) {
|
||||
if viewModel.isShowAuthView {
|
||||
BootpayUI(payload: payload, requestType: BootpayRequest.TYPE_AUTHENTICATION)
|
||||
.onConfirm {
|
||||
DEBUG_LOG("onConfirm: \($0)")
|
||||
return true
|
||||
}
|
||||
.onCancel {
|
||||
DEBUG_LOG("onCancel: \($0)")
|
||||
}
|
||||
.onError {
|
||||
DEBUG_LOG("onError: \($0)")
|
||||
viewModel.errorMessage = "본인인증 중 오류가 발생했습니다."
|
||||
viewModel.isShowPopup = true
|
||||
viewModel.isShowAuthView = false
|
||||
}
|
||||
.onDone {
|
||||
DEBUG_LOG("onDone: \($0)")
|
||||
viewModel.authVerify($0)
|
||||
}
|
||||
.onClose {
|
||||
DEBUG_LOG("onClose")
|
||||
viewModel.isShowAuthView = false
|
||||
}
|
||||
} else {
|
||||
GeometryReader { geo in
|
||||
VStack {
|
||||
HomeNavigationBar(title: "마이 페이지") {
|
||||
Image("ic_settings")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
.onTapGesture {
|
||||
AppState.shared.setAppStep(step: .settings)
|
||||
}
|
||||
}
|
||||
RefreshableScrollView(
|
||||
refreshing: $viewModel.isLoading,
|
||||
action: {
|
||||
viewModel.getMypage()
|
||||
}
|
||||
) {
|
||||
VStack(spacing: 0) {
|
||||
if let data = viewModel.myPageResponse {
|
||||
MyInfoCardView(data: data) {
|
||||
viewModel.getMypage()
|
||||
}
|
||||
.frame(width: screenSize().width - 26.7)
|
||||
.padding(.top, 13.3)
|
||||
|
||||
if UserDefaults.string(forKey: .role) == MemberRole.CREATOR.rawValue {
|
||||
Text("내 채널 보기")
|
||||
.frame(width: screenSize().width - 26.7, height: 46.7)
|
||||
.font(.custom(Font.bold.rawValue, size: 15.3))
|
||||
.foregroundColor(Color(hex: "eeeeee"))
|
||||
.background(Color(hex: "352953"))
|
||||
.cornerRadius(6.7)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 6.7)
|
||||
.stroke(Color(hex: "9970ff"), lineWidth: 1.3)
|
||||
)
|
||||
.padding(.top, 26.7)
|
||||
.onTapGesture {}
|
||||
}
|
||||
|
||||
CanCardView(data: data) {
|
||||
viewModel.getMypage()
|
||||
}
|
||||
.frame(width: screenSize().width - 26.7)
|
||||
.padding(.top, 26.7)
|
||||
|
||||
ReservationStatusView(data: data)
|
||||
.padding(.top, 33.3)
|
||||
|
||||
ServiceCenterButtonView()
|
||||
.padding(.top, 40)
|
||||
.padding(.bottom, data.isAuth ? 40 : 0)
|
||||
|
||||
if !data.isAuth {
|
||||
AuthButtonView()
|
||||
.padding(.vertical, 40)
|
||||
.onTapGesture {
|
||||
viewModel.isShowAuthView = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(width: geo.size.width, height: geo.size.height)
|
||||
}
|
||||
.onAppear {
|
||||
viewModel.getMypage()
|
||||
}
|
||||
}
|
||||
}
|
||||
.popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) {
|
||||
GeometryReader { geo in
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(viewModel.errorMessage)
|
||||
.padding(.vertical, 13.3)
|
||||
.frame(width: geo.size.width - 66.7, alignment: .center)
|
||||
.font(.custom(Font.medium.rawValue, size: 12))
|
||||
.background(Color(hex: "9970ff"))
|
||||
.foregroundColor(Color.white)
|
||||
.multilineTextAlignment(.center)
|
||||
.cornerRadius(20)
|
||||
.padding(.top, 66.7)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
payload.applicationId = BOOTPAY_APP_ID
|
||||
payload.price = 0
|
||||
payload.pg = "다날"
|
||||
payload.method = "본인인증"
|
||||
payload.orderName = "본인인증"
|
||||
payload.authenticationId = "\(UserDefaults.string(forKey: .nickname))__\(String(NSTimeIntervalSince1970))"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user