85 lines
2.5 KiB
Objective-C
85 lines
2.5 KiB
Objective-C
//
|
|
// ZXYResultView.m
|
|
// SweetParty
|
|
//
|
|
// Created by MAC on 2024/5/6.
|
|
//
|
|
|
|
#import "ZXYResultView.h"
|
|
|
|
@interface ZXYResultView ()
|
|
|
|
@end
|
|
|
|
@implementation ZXYResultView
|
|
|
|
- (void)awakeFromNib {
|
|
[super awakeFromNib];
|
|
|
|
[self createUI];
|
|
}
|
|
|
|
- (void)createUI {
|
|
WEAK_SELF
|
|
[self.touchImgV dg_Tapped:^{
|
|
[weakSelf removeFromSuperview];
|
|
}];
|
|
}
|
|
|
|
- (IBAction)onConfirm:(id)sender {
|
|
[self removeFromSuperview];
|
|
}
|
|
|
|
- (void)onShowWith:(NSInteger)type model:(ZXYBoxModel *)model {
|
|
if (type == 1 || type == 3) {
|
|
self.mainHeightCon.constant = 361;
|
|
self.bgImgV.image = ImageNamed(@"zxy_result_fail");
|
|
self.giftBgView.hidden = self.confirmBtn.hidden = YES;
|
|
self.noWinLab.hidden = NO;
|
|
}else if (type == 2) {
|
|
self.mainHeightCon.constant = 473;
|
|
self.bgImgV.image = ImageNamed(@"zxy_result_success");
|
|
self.giftBgView.hidden = self.confirmBtn.hidden = NO;
|
|
self.noWinLab.hidden = YES;
|
|
}
|
|
|
|
if (model.win_type_info.count == 2) {
|
|
self.yueqi1CenterXCon.constant = -60;
|
|
self.yueqiImgV_2.hidden = self.yueqiLab_2.hidden = NO;
|
|
}else {
|
|
self.yueqi1CenterXCon.constant = 0;
|
|
self.yueqiImgV_2.hidden = self.yueqiLab_2.hidden = YES;
|
|
}
|
|
NSArray *yueqiImgVArr = @[_yueqiImgV_1, _yueqiImgV_2];
|
|
NSArray *yueqiLabArr = @[_yueqiLab_1, _yueqiLab_2];
|
|
for (NSInteger i = 0; i < model.win_type_info.count; i++) {
|
|
NSDictionary *dict = model.win_type_info[i];
|
|
UIImageView *imgV = yueqiImgVArr[i];
|
|
[imgV sd_setImageWithURL:[NSURL URLWithString:[dict safeStringForKey:@"base_image"]]];
|
|
|
|
UILabel *lab = yueqiLabArr[i];
|
|
lab.text = [dict safeStringForKey:@"type_name"];
|
|
}
|
|
|
|
if (model.win_gift_list.count == 2) {
|
|
self.gift1CenterXCon.constant = -60;
|
|
self.giftImgV_2.hidden = self.giftLab_2.hidden = NO;
|
|
}else {
|
|
self.gift1CenterXCon.constant = 0;
|
|
self.giftImgV_2.hidden = self.giftLab_2.hidden = YES;
|
|
}
|
|
NSArray *giftImgVArr = @[_giftImgV_1, _giftImgV_2];
|
|
NSArray *giftLabArr = @[_giftLab_1, _giftLab_2];
|
|
for (NSInteger i = 0; i < model.win_gift_list.count; i++) {
|
|
NSDictionary *dict = model.win_gift_list[i];
|
|
UIImageView *imgV = giftImgVArr[i];
|
|
[imgV sd_setImageWithURL:[NSURL URLWithString:[dict safeStringForKey:@"base_image"]]];
|
|
|
|
UILabel *lab = giftLabArr[i];
|
|
lab.text = [NSString stringWithFormat:@"%@(%@)*%@", dict[@"gift_name"], dict[@"gift_price"], dict[@"num"]];
|
|
}
|
|
|
|
}
|
|
|
|
@end
|