|
@@ -9,104 +9,62 @@ struct SettingPurchaseTopView: View {
|
|
|
var eventPublisher: ListEventPublisher
|
|
|
@Binding var vipType: PremiumPeriod
|
|
|
var body: some View {
|
|
|
- let contentW = 343*kDesignScale
|
|
|
- let contentH = 118*kDesignScale
|
|
|
- let vipType = PremiumPeriod.week
|
|
|
+ let topW = k_ScreenWidth-32
|
|
|
+ let topH = 134.0 //kGetScaleHeight(originalSize: CGSize(width: 343, height: 130), width: topW)
|
|
|
+ let updateText = vipType == .week ? "Upgrade Yearly Pro".localized : "Update to PRO".localized
|
|
|
ZStack {
|
|
|
- Color.clear
|
|
|
- Image(.settingVipBj).resizable()//.frame(width: contentW, height: contentH)
|
|
|
-
|
|
|
- if vipType == .none {
|
|
|
- HStack {
|
|
|
- Spacer().frame(width:20)
|
|
|
-
|
|
|
- VStack(alignment: .leading,spacing: 12) {
|
|
|
- customText(text: "\(kAppName) ",fontName: .KelsiFill,color:UIColor.white.color).frame(height: 50*kDesignScale)
|
|
|
- HStack {
|
|
|
- Text("Limited Time Discount".localized)
|
|
|
- .font(.font(size: 14))
|
|
|
- .frame(height: 14)
|
|
|
- .foregroundColor(UIColor.white.withAlphaComponent(0.6).color)
|
|
|
-
|
|
|
- Spacer()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Spacer()
|
|
|
-
|
|
|
- Text("Upgrade".localized)
|
|
|
+ Image(.settingVipBj).resizable().cornerRadius(16.0)
|
|
|
+ if vipType == .year {
|
|
|
+ VStack(alignment: .center) {
|
|
|
+ customGradientText(text: "\(kAppName) pro", font: .font(name: .PoppinsBoldItalic,size: 36))
|
|
|
+ Spacer().frame(height: 16)
|
|
|
+ Text("Due Date:".localized + " \(PurchaseManager.default.expiredDateString)")
|
|
|
+ .foregroundColor(.white.opacity(0.6))
|
|
|
.font(.font(size: 14,weight: .medium))
|
|
|
- .padding(EdgeInsets(top: 0, leading: 12, bottom: 0, trailing: 12))
|
|
|
- .frame(height: 26) // 设置高度
|
|
|
- .foregroundColor("#010101".uiColor.color)
|
|
|
- .background(UIColor.themeColor.color)
|
|
|
- .cornerRadius(13.0) // 圆角
|
|
|
-// .onTapGesture {
|
|
|
-// eventPublisher.enterPurchasePublisher.send(true)
|
|
|
-// }
|
|
|
-
|
|
|
- Spacer().frame(width: 15)
|
|
|
- }//.padding(.all,7)
|
|
|
- }else if vipType == .week {
|
|
|
- ZStack(){//}(alignment: .topTrailing) { // 对齐到右上角
|
|
|
+ .frame(height: 14)
|
|
|
+ }//.border(Color.blue, width: 1)
|
|
|
+ }else{
|
|
|
+ VStack(){
|
|
|
HStack {
|
|
|
- Spacer().frame(width:33)
|
|
|
-
|
|
|
- VStack(alignment: .leading,spacing: 19) {
|
|
|
- customGradientText(text: "Upgrade Yearly Pro".localized, font: .font(name: .PoppinsBlackItalic,size: 22)).frame(height: 26)
|
|
|
+ VStack(alignment: .leading,spacing: 8) {
|
|
|
+ customGradientText(text: updateText, font: .font(name: .PoppinsBoldItalic,size: 22),colors: [.white]).frame(height: 26)
|
|
|
HStack {
|
|
|
- Text("Due Date:".localized + " \(PurchaseManager.default.expiredDateString)")
|
|
|
- .foregroundColor(.white.opacity(0.6))
|
|
|
- .font(.font(size: 14,weight: .regular))
|
|
|
+ Text("Limited Time Discount".localized)
|
|
|
+ .font(.font(size: 14))
|
|
|
.frame(height: 14)
|
|
|
+ .foregroundColor(UIColor.white.withAlphaComponent(0.6).color)
|
|
|
Spacer()
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
Spacer()
|
|
|
+
|
|
|
+ Text("Save-Vip".localized + " 80%")
|
|
|
+ .foregroundColor(Color.white)
|
|
|
+ .font(.font(size: 12,weight: .semibold))
|
|
|
+ .frame(width: 82, height: 28, alignment: .center)
|
|
|
+ .foregroundColor("#010101".uiColor.color)
|
|
|
+ .background(Color.hex("#E83E3E"))
|
|
|
+ .cornerRadius(4.0)
|
|
|
+ .rotationEffect(.degrees(15)) // 向右旋转45度
|
|
|
}
|
|
|
- .border(Color.red, width: 1)
|
|
|
- //.padding(.all,20)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ Spacer().frame(width: 12)
|
|
|
|
|
|
- }
|
|
|
- }else if vipType == .year {
|
|
|
- VStack {
|
|
|
- Spacer().frame(height: 20)
|
|
|
- customGradientText(text: "\(kAppName) ",font: .font(name: .KelsiFill,size: 48)).frame(height: 50*kDesignScale)
|
|
|
- Spacer()
|
|
|
-
|
|
|
- Text("Due Date:".localized + " \(PurchaseManager.default.expiredDateString)")
|
|
|
- .foregroundColor(.white.opacity(0.6))
|
|
|
+ Text("Upgrade".localized)
|
|
|
.font(.font(size: 14,weight: .medium))
|
|
|
- .frame(height: 14)
|
|
|
+ .frame(width: topW-32, height: 38, alignment: .center)
|
|
|
+ .foregroundColor("#010101".uiColor.color)
|
|
|
+ .background(UIColor.themeColor.color)
|
|
|
+ .cornerRadius(8.0) // 圆角
|
|
|
+ .onTapGesture {
|
|
|
+ eventPublisher.enterPurchasePublisher.send(true)
|
|
|
+ }
|
|
|
|
|
|
- Spacer().frame(height: 22)
|
|
|
- }//.padding(.all,7)
|
|
|
+ }.padding(.all,16.0)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- ZStack(alignment: .topTrailing){
|
|
|
-
|
|
|
- Color.clear
|
|
|
- ZStack(alignment: .center){
|
|
|
- Image(.settingVipCornerMark)
|
|
|
- .resizable()
|
|
|
- .frame(width: 106, height: 103)
|
|
|
- Text("Save-Vip".localized + " 80%")
|
|
|
- .foregroundColor(Color.hex("#111111"))
|
|
|
- .font(.font(size: 12))
|
|
|
- .offset(x: 0, y: -22)
|
|
|
- .rotationEffect(.degrees(45)) // 向右旋转45度
|
|
|
- }
|
|
|
- //.offset(x: -3, y: -7)
|
|
|
- .border(Color.yellow, width: 1)
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }//.padding(.all,7)
|
|
|
- .border(Color.blue, width: 1)
|
|
|
+ }.frame(width: topW, height: topH)
|
|
|
}
|
|
|
|
|
|
// 定义一个返回 View 的方法
|
|
@@ -125,11 +83,11 @@ struct SettingPurchaseTopView: View {
|
|
|
// .minimumScaleFactor(0.5) // 最小缩放比例(0.5表示最小可缩放到初始大小的50%)
|
|
|
}
|
|
|
|
|
|
- func customGradientText(text:String,font:Font) -> some View {
|
|
|
+ func customGradientText(text:String,font:Font,colors:[Color] = [.hex("#FA794F"),.hex("#F8C32A"),.hex("#FEFBF4")]) -> some View {
|
|
|
return Text(text)
|
|
|
.font(font)
|
|
|
.gradientForeground(
|
|
|
- colors: [.hex("#FA794F"),.hex("#F8C32A"),.hex("#FEFBF4")],
|
|
|
+ colors: colors,
|
|
|
startPoint: UnitPoint.leading,
|
|
|
endPoint: UnitPoint.trailing
|
|
|
)
|