Steven 3 місяців тому
батько
коміт
6f48bd3c69

+ 1 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/NotiferMessage/Model/NotiferMessageModel.h

@@ -27,6 +27,7 @@
 @property (nonatomic, assign) double readStatus;
 @property (nonatomic, strong) NSString *status;
 @property (nonatomic, strong) NSString *subType;
+@property (nonatomic, strong) NSString *img;
 
 + (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
 - (instancetype)initWithDictionary:(NSDictionary *)dict;

+ 8 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/NotiferMessage/Model/NotiferMessageModel.m

@@ -24,6 +24,8 @@ NSString *const kNotiferMessageModelGroup = @"group";
 NSString *const kNotiferMessageModelReadStatus = @"readStatus";
 NSString *const kNotiferMessageModelStatus = @"status";
 NSString *const kNotiferMessageModelSubType = @"subType";
+NSString *const kNotiferMessageModelImg = @"img";
+
 
 @interface NotiferMessageModel ()
 
@@ -49,6 +51,7 @@ NSString *const kNotiferMessageModelSubType = @"subType";
 @synthesize readStatus = _readStatus;
 @synthesize status = _status;
 @synthesize subType = _subType;
+@synthesize img = _img;
 
 + (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
 {
@@ -78,6 +81,7 @@ NSString *const kNotiferMessageModelSubType = @"subType";
             self.readStatus = [[self objectOrNilForKey:kNotiferMessageModelReadStatus fromDictionary:dict] doubleValue];
             self.status = [self objectOrNilForKey:kNotiferMessageModelStatus fromDictionary:dict];
         self.subType = [self objectOrNilForKey:kNotiferMessageModelSubType fromDictionary:dict];
+        self.img = [self objectOrNilForKey:kNotiferMessageModelImg fromDictionary:dict];
     }
     
     return self;
@@ -103,6 +107,7 @@ NSString *const kNotiferMessageModelSubType = @"subType";
     [mutableDict setValue:[NSNumber numberWithDouble:self.readStatus] forKey:kNotiferMessageModelReadStatus];
     [mutableDict setValue:self.status forKey:kNotiferMessageModelStatus];
     [mutableDict setValue:self.subType forKey:kNotiferMessageModelSubType];
+    [mutableDict setValue:self.img forKey:kNotiferMessageModelImg];
 
     return [NSDictionary dictionaryWithDictionary:mutableDict];
 }
@@ -146,6 +151,7 @@ NSString *const kNotiferMessageModelSubType = @"subType";
     self.readStatus = [aDecoder decodeDoubleForKey:kNotiferMessageModelReadStatus];
     self.status = [aDecoder decodeObjectForKey:kNotiferMessageModelStatus];
     self.subType = [aDecoder decodeObjectForKey:kNotiferMessageModelSubType];
+    self.img = [aDecoder decodeObjectForKey:kNotiferMessageModelImg];
     return self;
 }
 
@@ -168,6 +174,7 @@ NSString *const kNotiferMessageModelSubType = @"subType";
     [aCoder encodeDouble:_readStatus forKey:kNotiferMessageModelReadStatus];
     [aCoder encodeObject:_status forKey:kNotiferMessageModelStatus];
     [aCoder encodeObject:_subType forKey:kNotiferMessageModelSubType];
+    [aCoder encodeObject:_img forKey:kNotiferMessageModelImg];
 }
 
 - (id)copyWithZone:(NSZone *)zone
@@ -192,6 +199,7 @@ NSString *const kNotiferMessageModelSubType = @"subType";
         copy.readStatus = self.readStatus;
         copy.status = [self.status copyWithZone:zone];
         copy.subType = [self.subType copyWithZone:zone];
+        copy.img = [self.img copyWithZone:zone];
     }
     
     return copy;

+ 10 - 4
KulexiuForTeacher/KulexiuForTeacher/Module/Home/NotiferMessage/View/NotiferMessageCell.m

@@ -50,12 +50,18 @@
     
     NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:messgage attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x7a7a7a)}];
     self.descMessageLabel.attributedText = attrStr;
-    NSString *imgName = [self getTypeImageWithSubType:model.subType];
-    if (![NSString isEmptyString:imgName]) {
-        [self.messageTypeView setImage:[UIImage imageNamed:imgName]];
+    
+    if (![NSString isEmptyString:model.img]) {
+        [self.messageTypeView sd_setImageWithURL:[NSURL URLWithString:[model.img getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"notifer_unknow"]];
     }
     else {
-        [self.messageTypeView setImage:[UIImage imageNamed:@"notifer_unknow"]];
+        NSString *imgName = [self getTypeImageWithSubType:model.subType];
+        if (![NSString isEmptyString:imgName]) {
+            [self.messageTypeView setImage:[UIImage imageNamed:imgName]];
+        }
+        else {
+            [self.messageTypeView setImage:[UIImage imageNamed:@"notifer_unknow"]];
+        }
     }
 }