diff --git a/redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate b/redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate index 952ee243565c2061a31af841c4bae8fd7657fbdc..7b72fd8c00d28da1c2a5098098f53b77f3935dbd 100644 Binary files a/redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate and b/redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/redstar/Classes/Module/Announce/AnnounceDetail/View/AnnounceDetailHeadView.m b/redstar/Classes/Module/Announce/AnnounceDetail/View/AnnounceDetailHeadView.m index cd8a445eca45e99d2ead7828beaedb04e0aa42af..1382deb0740c66e258a7c1d65082623613074726 100644 --- a/redstar/Classes/Module/Announce/AnnounceDetail/View/AnnounceDetailHeadView.m +++ b/redstar/Classes/Module/Announce/AnnounceDetail/View/AnnounceDetailHeadView.m @@ -43,6 +43,8 @@ - (void)setAnnoDetail:(AnnounceDetailModel *)annoDetail { _annoDetail = annoDetail; + + self.titleLabel.text = [NSString stringWithFormat:@"%@", _annoDetail.title]; self.nameLabel.text = [NSString stringWithFormat:@"%@", _annoDetail.lastModify_operName]; self.timeLabel.text = [NSString stringWithFormat:@"%@", _annoDetail.lastModify_time]; diff --git a/redstar/Classes/Module/Announce/AnnounceDetail/ViewController/AnnoDetailViewController.m b/redstar/Classes/Module/Announce/AnnounceDetail/ViewController/AnnoDetailViewController.m index d292df3e0dbe09d432dd727f29a7f1dba921b6d0..95493ae6335737af1d2abb70c24bce886ebe14ed 100644 --- a/redstar/Classes/Module/Announce/AnnounceDetail/ViewController/AnnoDetailViewController.m +++ b/redstar/Classes/Module/Announce/AnnounceDetail/ViewController/AnnoDetailViewController.m @@ -115,7 +115,11 @@ cell = [[AnnoContentTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kAnnounceContentCell]; } cell.titleLabel.text = @"内容"; - cell.contentLabel.text = [NSString stringWithFormat:@"%@",_annoDetail.content]; + + NSString *str = [NSString stringWithFormat:@"<style> html{ font-size: 15px; color: #444444 } </style>%@", _annoDetail.content]; + NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[str dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil]; + cell.contentLabel.attributedText = attrStr; + cell.backgroundColor = kAnnounceHeaderColor; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; diff --git a/redstar/Classes/Module/Announce/AnnounceList/Cell/AnnoTableViewCell.m b/redstar/Classes/Module/Announce/AnnounceList/Cell/AnnoTableViewCell.m index 247d2f5dbf9d8fe028e9af4f78024e461260729e..05316a6a7e14b060d74337f4ac42dfc70d1c226e 100644 --- a/redstar/Classes/Module/Announce/AnnounceList/Cell/AnnoTableViewCell.m +++ b/redstar/Classes/Module/Announce/AnnounceList/Cell/AnnoTableViewCell.m @@ -13,7 +13,14 @@ - (void)setAnnounce:(AnnounceModel *)announce { _announce = announce; - self.titleLabel.text = [NSString stringWithFormat:@"%@", announce.content]; + + + NSString *str = [NSString stringWithFormat:@"<style> html{ font-size: 15px; color: #444444 } </style>%@", announce.content]; + NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[str dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil]; + self.titleLabel.attributedText = attrStr; + + + //self.titleLabel.text = [NSString stringWithFormat:@"%@", announce.content]; self.peopleLabel.text = [NSString stringWithFormat:@"å‘布人:%@ å‘布日期:%@", announce.lastModify_operName ,announce.lastModify_time]; if ([self.currentState isEqualToString:@"false"]) { diff --git a/redstar/Classes/Module/Announce/AnnounceList/ViewController/AnnounceViewController.m b/redstar/Classes/Module/Announce/AnnounceList/ViewController/AnnounceViewController.m index cfd712f92fc03a93d7297a84f1c9e5d16fba0120..b9f0bc144b10c55d0839d6c16d60e6d104f000b5 100644 --- a/redstar/Classes/Module/Announce/AnnounceList/ViewController/AnnounceViewController.m +++ b/redstar/Classes/Module/Announce/AnnounceList/ViewController/AnnounceViewController.m @@ -43,7 +43,7 @@ self.allAnnoArray = [NSMutableArray array]; self.isRead = NO; - self.stateStr = @"0"; + self.stateStr = @"false"; [self setNav]; @@ -70,7 +70,7 @@ int page_number = 0; int page_size = 10; NSString *url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size]; - //NSString *url = [NSString stringWithFormat:@"%@%@%@?page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid, page_number, page_size]; + // NSString *url = [NSString stringWithFormat:@"%@%@%@?page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid, page_number, page_size]; NSLog(@"urlll = %@", url); HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url]; @@ -123,15 +123,16 @@ - (void)segmentChangedValue:(UISegmentedControl *)sender { + NSString *url; NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"]; int page_number = 0; int page_size = 10; if (sender.selectedSegmentIndex == 0) { - self.stateStr = @"0"; + self.stateStr = @"false"; url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size]; } else if (sender.selectedSegmentIndex == 1) { - self.stateStr = @"1"; + self.stateStr = @"true"; url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size]; } else { self.stateStr = @""; diff --git a/redstar/Classes/Module/Function/Question/AddQuestion/ViewController/AddQuestionViewController.m b/redstar/Classes/Module/Function/Question/AddQuestion/ViewController/AddQuestionViewController.m index 5463aab1701ae7c26f742965ed0eac8cd680c8de..613797ecc609d1ed45755dfb898ff66ade076f47 100644 --- a/redstar/Classes/Module/Function/Question/AddQuestion/ViewController/AddQuestionViewController.m +++ b/redstar/Classes/Module/Function/Question/AddQuestion/ViewController/AddQuestionViewController.m @@ -469,8 +469,8 @@ NSLog(@"imageName = %@", imageName); NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName]; UIImage *image = [UIImage imageWithContentsOfFile:fullPath]; - NSLog(@"image = %@fullPath = %@", image, fullPath); - [cell.photoButton1 setImage:image forState:UIControlStateNormal]; + UIImage *image00 = [self cutImage:image]; + [cell.photoButton1 setImage:image00 forState:UIControlStateNormal]; cell.photoButton2.tag = 2201; [cell.photoButton2 addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside]; @@ -498,18 +498,17 @@ cell = [[InpectPictureCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier]; } NSString *imageName0 = _imageNameArray[(indexPath.row - 3) * 2]; - NSLog(@"imageName = %@", imageName0); NSString *fullPath0 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName0]; UIImage *image0 = [UIImage imageWithContentsOfFile:fullPath0]; - NSLog(@"image = %@fullPath = %@", image0, fullPath0); - [cell.photoButton1 setImage:image0 forState:UIControlStateNormal]; + UIImage *image00 = [self cutImage:image0]; + [cell.photoButton1 setImage:image00 forState:UIControlStateNormal]; NSString *imageName1 = _imageNameArray[(indexPath.row - 3) * 2 + 1]; NSLog(@"imageName = %@", imageName1); NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1]; UIImage *image1 = [UIImage imageWithContentsOfFile:fullPath1]; - NSLog(@"image = %@fullPath = %@", image1, fullPath1); - [cell.photoButton2 setImage:image1 forState:UIControlStateNormal]; + UIImage *image11 = [self cutImage:image1]; + [cell.photoButton2 setImage:image11 forState:UIControlStateNormal]; return cell; } @@ -517,6 +516,29 @@ } +//è£å‰ªå›¾ç‰‡ +- (UIImage *)cutImage:(UIImage*)image +{ + //压缩图片 + CGSize newSize; + CGImageRef imageRef = nil; + + if ((image.size.width / image.size.height) < (((kScreenWidth - 20 * 3) / 2) / 90)) { + newSize.width = image.size.width; + newSize.height = image.size.width * 90 / ((kScreenWidth - 20 * 3) / 2); + + imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height)); + + } else { + newSize.height = image.size.height; + newSize.width = image.size.height * ((kScreenWidth - 20 * 3) / 2) / 90; + + imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height)); + + } + + return [UIImage imageWithCGImage:imageRef]; +} - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { diff --git a/redstar/Classes/Module/Function/Question/QuestionDetail/Cell/QuestionDetailCell.m b/redstar/Classes/Module/Function/Question/QuestionDetail/Cell/QuestionDetailCell.m index e4f1887de524fdca3d55906e49316d5000e0c3ab..b938325c082dc1a4e3b4c4375dd20a84da6ec9b7 100644 --- a/redstar/Classes/Module/Function/Question/QuestionDetail/Cell/QuestionDetailCell.m +++ b/redstar/Classes/Module/Function/Question/QuestionDetail/Cell/QuestionDetailCell.m @@ -38,6 +38,7 @@ [questionNameAttr addAttributes:@{NSForegroundColorAttributeName:kdetailCellTitleColor,NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} range:NSMakeRange(5,questionNameText.length - 5)]; [self.questionName setAttributedText:questionNameAttr]; + NSLog(@"questionDetail.state = %@",questionDetail.state); // çŠ¶æ€ if ([questionDetail.state isEqualToString:@"resolved"]) { NSString *stateText = [NSString stringWithFormat:@"状æ€ï¼šå·²è§£å†³"]; diff --git a/redstar/Classes/Module/Function/Question/QuestionList/ViewController/QuestionViewController.m b/redstar/Classes/Module/Function/Question/QuestionList/ViewController/QuestionViewController.m index d9c0a6f6da4c66489a4c4745c49472073f2c4539..2d8a66d4557abc82a00bab3a4d40badee62fe4e5 100644 --- a/redstar/Classes/Module/Function/Question/QuestionList/ViewController/QuestionViewController.m +++ b/redstar/Classes/Module/Function/Question/QuestionList/ViewController/QuestionViewController.m @@ -70,7 +70,7 @@ [self setupNav]; - [self requestQuestionList]; + // [self requestQuestionList]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(requestQuestionList) @@ -91,6 +91,8 @@ [self.menuView.taxiButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside]; [self.menuView.screenButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside]; self.tabBarController.tabBar.hidden = YES; + + [self requestQuestionList]; } diff --git a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectDetail/ViewController/InspectNotUploadViewController.m b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectDetail/ViewController/InspectNotUploadViewController.m index b08691995eed8ee4c4d8083757abc498a96bac1d..0f2d8b0312d49274d2d72bfe6125c9a7924fa104 100644 --- a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectDetail/ViewController/InspectNotUploadViewController.m +++ b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectDetail/ViewController/InspectNotUploadViewController.m @@ -181,8 +181,10 @@ NSLog(@"imageName = %@", imageName); NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName]; UIImage *image = [UIImage imageWithContentsOfFile:fullPath]; + UIImage *image00 = [self cutImage:image]; + NSLog(@"image = %@fullPath = %@", image, fullPath); - [cell.photoButton1 setImage:image forState:UIControlStateNormal]; + [cell.photoButton1 setImage:image00 forState:UIControlStateNormal]; cell.photoButton2.tag = 2201; [cell.photoButton2 addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside]; @@ -210,22 +212,107 @@ cell = [[InpectPictureCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier]; } NSString *imageName0 = _imageNameArray[(indexPath.row - 1) * 2]; - NSLog(@"imageName = %@", imageName0); NSString *fullPath0 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName0]; UIImage *image0 = [UIImage imageWithContentsOfFile:fullPath0]; - NSLog(@"image = %@fullPath = %@", image0, fullPath0); - [cell.photoButton1 setImage:image0 forState:UIControlStateNormal]; + UIImage *image00 = [self cutImage:image0]; + + // UIImage *image00 = [self getSubImage:image0 mCGRect:CGRectMake(0, 0, (kScreenWidth - 20 * 3) / 2, 90) centerBool:YES]; + [cell.photoButton1 setImage:image00 forState:UIControlStateNormal]; NSString *imageName1 = _imageNameArray[(indexPath.row - 1) * 2 + 1]; - NSLog(@"imageName = %@", imageName1); NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1]; UIImage *image1 = [UIImage imageWithContentsOfFile:fullPath1]; - NSLog(@"image = %@fullPath = %@", image1, fullPath1); - [cell.photoButton2 setImage:image1 forState:UIControlStateNormal]; + UIImage *image11 = [self cutImage:image1]; + // UIImage *image11 = [self getSubImage:image1 mCGRect:CGRectMake(0, 0, (kScreenWidth - 20 * 3) / 2, 90) centerBool:YES]; + + [cell.photoButton2 setImage:image11 forState:UIControlStateNormal]; return cell; } } +//è£å‰ªå›¾ç‰‡ +- (UIImage *)cutImage:(UIImage*)image +{ + //压缩图片 + CGSize newSize; + CGImageRef imageRef = nil; + + if ((image.size.width / image.size.height) < (((kScreenWidth - 20 * 3) / 2) / 90)) { + newSize.width = image.size.width; + newSize.height = image.size.width * 90 / ((kScreenWidth - 20 * 3) / 2); + + imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height)); + + } else { + newSize.height = image.size.height; + newSize.width = image.size.height * ((kScreenWidth - 20 * 3) / 2) / 90; + + imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height)); + + } + + return [UIImage imageWithCGImage:imageRef]; +} + +- (UIImage*)getSubImage:(UIImage *)image mCGRect:(CGRect)mCGRect centerBool:(BOOL)centerBool +{ + + /*如若centerBool为Yes则是由ä¸å¿ƒç‚¹å–mCGRect范围的图片*/ + + + float imgwidth = image.size.width; + float imgheight = image.size.height; + float viewwidth = mCGRect.size.width; + float viewheight = mCGRect.size.height; + CGRect rect; + if(centerBool) + rect = CGRectMake((imgwidth-viewwidth)/2, (imgheight-viewheight)/2, viewwidth, viewheight); + else{ + if (viewheight < viewwidth) { + if (imgwidth <= imgheight) { + rect = CGRectMake(0, 0, imgwidth, imgwidth*viewheight/viewwidth); + }else { + float width = viewwidth*imgheight/viewheight; + float x = (imgwidth - width)/2 ; + if (x > 0) { + rect = CGRectMake(x, 0, width, imgheight); + }else { + rect = CGRectMake(0, 0, imgwidth, imgwidth*viewheight/viewwidth); + } + } + }else { + if (imgwidth <= imgheight) { + float height = viewheight*imgwidth/viewwidth; + if (height < imgheight) { + rect = CGRectMake(0, 0, imgwidth, height); + }else { + rect = CGRectMake(0, 0, viewwidth*imgheight/viewheight, imgheight); + } + }else { + float width = viewwidth*imgheight/viewheight; + if (width < imgwidth) { + float x = (imgwidth - width)/2 ; + rect = CGRectMake(x, 0, width, imgheight); + }else { + rect = CGRectMake(0, 0, imgwidth, imgheight); + } + } + } + } + + CGImageRef subImageRef = CGImageCreateWithImageInRect(image.CGImage, rect); + CGRect smallBounds = CGRectMake(0, 0, CGImageGetWidth(subImageRef), CGImageGetHeight(subImageRef)); + + UIGraphicsBeginImageContext(smallBounds.size); + CGContextRef context = UIGraphicsGetCurrentContext(); + CGContextDrawImage(context, smallBounds, subImageRef); + UIImage* smallImage = [UIImage imageWithCGImage:subImageRef]; + UIGraphicsEndImageContext(); + + return smallImage; +} + + // section高度 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section diff --git a/redstar/Classes/Module/Login/ViewController/LoginViewController.m b/redstar/Classes/Module/Login/ViewController/LoginViewController.m index cc532b3c7fb69f11173259816aca8d35d8b05712..4845a2dfd217d93b146565f07427d77524b7d6f3 100644 --- a/redstar/Classes/Module/Login/ViewController/LoginViewController.m +++ b/redstar/Classes/Module/Login/ViewController/LoginViewController.m @@ -50,7 +50,6 @@ self.loginView.usernameTextFiled.delegate = self; self.loginView.passwordTextFiled.delegate = self; // åˆå§‹åŒ–数组 - self.allUserDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"thoradmin", @"admin", nil]; [self requestLogin]; }