123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- //
- // INSSettingBodyView.m
- // KulexiuForStudent
- //
- // Created by 王智 on 2023/9/11.
- //
- #import "INSSettingBodyView.h"
- #import "UIImageView+DisplayImage.h"
- @interface INSSettingBodyView ()
- @property (weak, nonatomic) IBOutlet UILabel *tenantGroupName;
- @property (weak, nonatomic) IBOutlet UILabel *userName;
- @property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
- @property (nonatomic, copy) SettingActionBlock callback;
- @property (nonatomic, strong) UIImage *preDisplayImage;
- @end
- @implementation INSSettingBodyView
- + (instancetype)shareInstance {
- INSSettingBodyView *view = [[[NSBundle mainBundle] loadNibNamed:@"INSSettingBodyView" owner:nil options:nil] firstObject];
- return view;
- }
- - (void)configUserWithUserInfo:(UserInfo *)info {
- if (![NSString isEmptyString:info.heardUrl]) {
- if (self.preDisplayImage == nil) {
- self.preDisplayImage = [UIImage imageNamed:CLIENT_USERDEFAULT_LOGO];
- }
- [self.uesrAvatar displayImageWithUrl:[NSURL URLWithString:[info.heardUrl getUrlEndcodeString]] placeholder:self.preDisplayImage defaultImage:[UIImage imageNamed:CLIENT_USERDEFAULT_LOGO] callback:^(UIImage * _Nonnull image) {
- self.preDisplayImage = image;
- }];
- }
- else {
- [self.uesrAvatar setImage:[UIImage imageNamed:CLIENT_USERDEFAULT_LOGO]];
- self.preDisplayImage = [UIImage imageNamed:CLIENT_USERDEFAULT_LOGO];
- }
- self.userName.text = [NSString returnNoNullStringWithString:info.username];
- self.phoneLabel.text = [NSString returnNoNullStringWithString:info.phone];
-
- if ([NSString isEmptyString:info.birthdate]) {
- self.birthdayLabel.text = @"未设置";
- }
- else {
- self.birthdayLabel.text = [[info.birthdate componentsSeparatedByString:@" "] firstObject];
- }
-
- NSString *userSex = @"";
- if (info.gender == 1) {
- userSex = @"男";
- }
- else {
- userSex = @"女";
- }
- self.userSex.text = userSex;
- NSString *subjectName = info.subjectName;
- if ([NSString isEmptyString:info.subjectName]) {
- subjectName = @"请选择乐器";
- }
- self.subjectLabel.text = subjectName;
- self.tenantGroupName.text = [NSString returnNoNullStringWithString:info.tenantGroupName];
- }
- - (void)refreshSubject:(NSString *)subjectName {
- if ([NSString isEmptyString:subjectName]) {
- subjectName = @"请选择乐器";
- }
- self.subjectLabel.text = subjectName;
- }
- - (void)settingCallback:(SettingActionBlock)callback {
- if (callback) {
- self.callback = callback;
- }
- }
- - (IBAction)tapAction:(UITapGestureRecognizer *)sender {
- NSInteger index = sender.view.tag;
- if (self.callback) {
- self.callback(index);
- }
- }
- - (CGFloat)getViewHeight {
-
- return 58 * 8 + 12 + 12 + 78;
- }
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect {
- // Drawing code
- }
- */
- @end
|