diff --git a/ProductApp/ProductApp.xcodeproj/project.pbxproj b/ProductApp/ProductApp.xcodeproj/project.pbxproj index 7b2b0a0..3f690f5 100644 --- a/ProductApp/ProductApp.xcodeproj/project.pbxproj +++ b/ProductApp/ProductApp.xcodeproj/project.pbxproj @@ -217,6 +217,11 @@ CA6B97302CBD11B1000213F3 /* AIChatFunctionCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = CA6B972F2CBD11B1000213F3 /* AIChatFunctionCollectionViewCell.m */; }; CA6B97342CBD1FA0000213F3 /* AIChaAnswerView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA6B97332CBD1FA0000213F3 /* AIChaAnswerView.m */; }; CA6B97372CBD2102000213F3 /* AIChaAnswerTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = CA6B97362CBD2102000213F3 /* AIChaAnswerTableViewCell.m */; }; + CA6D54742CCB3FC8001B530A /* CamreShiLiView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA6D54732CCB3FC8001B530A /* CamreShiLiView.m */; }; + CA6D54772CCB7C5D001B530A /* PicAiModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA6D54762CCB7C5D001B530A /* PicAiModel.m */; }; + CA6D547A2CCB9F00001B530A /* CorrectWriteCorrectModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA6D54792CCB9F00001B530A /* CorrectWriteCorrectModel.m */; }; + CA6D547D2CCB9FA8001B530A /* CorrectWriteErrorModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA6D547C2CCB9FA8001B530A /* CorrectWriteErrorModel.m */; }; + CA6D54802CCBA3C2001B530A /* WriteCorrectScoreModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA6D547F2CCBA3C2001B530A /* WriteCorrectScoreModel.m */; }; CA8181882C9E58B100EE7E6E /* StartKTXZWenZhangViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CA8181872C9E58B100EE7E6E /* StartKTXZWenZhangViewController.m */; }; CA81818B2C9E598300EE7E6E /* StartKTXZWenZhangView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA81818A2C9E598300EE7E6E /* StartKTXZWenZhangView.m */; }; CA81818E2C9E60B100EE7E6E /* ViewLable.m in Sources */ = {isa = PBXBuildFile; fileRef = CA81818D2C9E60B100EE7E6E /* ViewLable.m */; }; @@ -882,6 +887,16 @@ CA6B97332CBD1FA0000213F3 /* AIChaAnswerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AIChaAnswerView.m; sourceTree = ""; }; CA6B97352CBD2102000213F3 /* AIChaAnswerTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AIChaAnswerTableViewCell.h; sourceTree = ""; }; CA6B97362CBD2102000213F3 /* AIChaAnswerTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AIChaAnswerTableViewCell.m; sourceTree = ""; }; + CA6D54722CCB3FC8001B530A /* CamreShiLiView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CamreShiLiView.h; sourceTree = ""; }; + CA6D54732CCB3FC8001B530A /* CamreShiLiView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CamreShiLiView.m; sourceTree = ""; }; + CA6D54752CCB7C5D001B530A /* PicAiModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PicAiModel.h; sourceTree = ""; }; + CA6D54762CCB7C5D001B530A /* PicAiModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PicAiModel.m; sourceTree = ""; }; + CA6D54782CCB9F00001B530A /* CorrectWriteCorrectModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CorrectWriteCorrectModel.h; sourceTree = ""; }; + CA6D54792CCB9F00001B530A /* CorrectWriteCorrectModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CorrectWriteCorrectModel.m; sourceTree = ""; }; + CA6D547B2CCB9FA8001B530A /* CorrectWriteErrorModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CorrectWriteErrorModel.h; sourceTree = ""; }; + CA6D547C2CCB9FA8001B530A /* CorrectWriteErrorModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CorrectWriteErrorModel.m; sourceTree = ""; }; + CA6D547E2CCBA3C2001B530A /* WriteCorrectScoreModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WriteCorrectScoreModel.h; sourceTree = ""; }; + CA6D547F2CCBA3C2001B530A /* WriteCorrectScoreModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WriteCorrectScoreModel.m; sourceTree = ""; }; CA8181862C9E58B100EE7E6E /* StartKTXZWenZhangViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StartKTXZWenZhangViewController.h; sourceTree = ""; }; CA8181872C9E58B100EE7E6E /* StartKTXZWenZhangViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StartKTXZWenZhangViewController.m; sourceTree = ""; }; CA8181892C9E598300EE7E6E /* StartKTXZWenZhangView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StartKTXZWenZhangView.h; sourceTree = ""; }; @@ -1863,6 +1878,8 @@ CA11ED5C2CA653F600209DFC /* CamreImagesView.m */, CA11ED622CA6851200209DFC /* CamreTiShiAlterView.h */, CA11ED632CA6851200209DFC /* CamreTiShiAlterView.m */, + CA6D54722CCB3FC8001B530A /* CamreShiLiView.h */, + CA6D54732CCB3FC8001B530A /* CamreShiLiView.m */, ); path = view; sourceTree = ""; @@ -3053,6 +3070,14 @@ CA9CFF6D2CC9DFCC00C3E90E /* ExampleTextGreatModel.m */, CA9CFF6F2CC9E9E300C3E90E /* RoleInfoModel.h */, CA9CFF702CC9E9E300C3E90E /* RoleInfoModel.m */, + CA6D54752CCB7C5D001B530A /* PicAiModel.h */, + CA6D54762CCB7C5D001B530A /* PicAiModel.m */, + CA6D54782CCB9F00001B530A /* CorrectWriteCorrectModel.h */, + CA6D54792CCB9F00001B530A /* CorrectWriteCorrectModel.m */, + CA6D547B2CCB9FA8001B530A /* CorrectWriteErrorModel.h */, + CA6D547C2CCB9FA8001B530A /* CorrectWriteErrorModel.m */, + CA6D547E2CCBA3C2001B530A /* WriteCorrectScoreModel.h */, + CA6D547F2CCBA3C2001B530A /* WriteCorrectScoreModel.m */, ); path = models; sourceTree = ""; @@ -4530,6 +4555,7 @@ CA5D02E22CC0DD6B007B3BA5 /* ActivityListModel.m in Sources */, CAC8064A2CA119C500C21AA7 /* StartZWPIDetailViewController.m in Sources */, CA9CFF712CC9E9E300C3E90E /* RoleInfoModel.m in Sources */, + CA6D54772CCB7C5D001B530A /* PicAiModel.m in Sources */, CB489DCA27449D5C00DA044A /* AppDelegate.m in Sources */, CB489F8B2744A0BD00DA044A /* NSString+extend.m in Sources */, CA5D02E82CC0DD6B007B3BA5 /* UserLoginModel.m in Sources */, @@ -4543,6 +4569,7 @@ CB489F532744A0BD00DA044A /* RecordAudio.m in Sources */, CAC8063E2CA10B1600C21AA7 /* StartZWPIViewController.m in Sources */, CA11ED7D2CA6B0DE00209DFC /* XieZuoFenXiangAlterView.m in Sources */, + CA6D54802CCBA3C2001B530A /* WriteCorrectScoreModel.m in Sources */, CAC806732CA171ED00C21AA7 /* StartPZXZPageView.m in Sources */, CA5D02AB2CC0B2DE007B3BA5 /* SetTableViewCell.m in Sources */, CA6B971A2CBCBD56000213F3 /* FanWenDetailView.m in Sources */, @@ -4600,6 +4627,7 @@ CA8181992C9E77FB00EE7E6E /* DownJDLoadView.m in Sources */, CB489F6F2744A0BD00DA044A /* XLAlertView.m in Sources */, CA0D085A2CA543E40086855E /* ShouYeZCPPTTableViewCell.m in Sources */, + CA6D547A2CCB9F00001B530A /* CorrectWriteCorrectModel.m in Sources */, CA81819D2C9E9C6600EE7E6E /* StartKTXZPGDetailViewController.m in Sources */, CB489FA32744A0BD00DA044A /* ZJContentView.m in Sources */, CA5D02E62CC0DD6B007B3BA5 /* UserUploadModel.m in Sources */, @@ -4623,6 +4651,7 @@ CA0FD6A82CA900E2009A4417 /* FXTextView.m in Sources */, CA0D086D2CA548F70086855E /* ShouYeLiShiJiLuPPTTableViewController.m in Sources */, CA8EE5292CC905BD009D73E3 /* NomoAlterView.m in Sources */, + CA6D547D2CCB9FA8001B530A /* CorrectWriteErrorModel.m in Sources */, CA487D932CA4055B00AE773B /* StartPayGoodsCollectionViewCell.m in Sources */, CA4257B62CA2BBB000A36A10 /* StartPayView.m in Sources */, CB489DDB27449D5D00DA044A /* main.m in Sources */, @@ -4736,6 +4765,7 @@ CA5D03672CC0DE8D007B3BA5 /* YouHuiQuanDuiHuanSuccessView.m in Sources */, CABA14D92C9D5071002CB3B1 /* PageControlView.m in Sources */, CAF76E8E2CBE650600825E5E /* GongJuCreateTextInputView.m in Sources */, + CA6D54742CCB3FC8001B530A /* CamreShiLiView.m in Sources */, CAF76E772CBE513A00825E5E /* GongJuSearchViewController.m in Sources */, CA4257852CA24E1100A36A10 /* StartPZXZDetailViewController.m in Sources */, CB489FA52744A0BD00DA044A /* ZJSegmentStyle.m in Sources */, diff --git a/ProductApp/ProductApp.xcworkspace/xcuserdata/gongzuo.xcuserdatad/UserInterfaceState.xcuserstate b/ProductApp/ProductApp.xcworkspace/xcuserdata/gongzuo.xcuserdatad/UserInterfaceState.xcuserstate index 4e2286c..4de8b3a 100644 Binary files a/ProductApp/ProductApp.xcworkspace/xcuserdata/gongzuo.xcuserdatad/UserInterfaceState.xcuserstate and b/ProductApp/ProductApp.xcworkspace/xcuserdata/gongzuo.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ProductApp/ProductApp.xcworkspace/xcuserdata/gongzuo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/ProductApp/ProductApp.xcworkspace/xcuserdata/gongzuo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index ef7bee0..7ab36aa 100644 --- a/ProductApp/ProductApp.xcworkspace/xcuserdata/gongzuo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/ProductApp/ProductApp.xcworkspace/xcuserdata/gongzuo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -119,16 +119,16 @@ diff --git a/ProductApp/ProductApp/AppDelegate.m b/ProductApp/ProductApp/AppDelegate.m index e1117b2..accfb53 100644 --- a/ProductApp/ProductApp/AppDelegate.m +++ b/ProductApp/ProductApp/AppDelegate.m @@ -21,6 +21,7 @@ #import #import +#import "SSENetWorkManager.h" @interface AppDelegate () diff --git a/ProductApp/ProductApp/Assets.xcassets/首页/cam_shili_ok.imageset/Contents.json b/ProductApp/ProductApp/Assets.xcassets/首页/cam_shili_ok.imageset/Contents.json new file mode 100644 index 0000000..f1f4074 --- /dev/null +++ b/ProductApp/ProductApp/Assets.xcassets/首页/cam_shili_ok.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "组 42708@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "组 42708@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ProductApp/ProductApp/Assets.xcassets/首页/cam_shili_ok.imageset/组 42708@2x.png b/ProductApp/ProductApp/Assets.xcassets/首页/cam_shili_ok.imageset/组 42708@2x.png new file mode 100644 index 0000000..254d722 Binary files /dev/null and b/ProductApp/ProductApp/Assets.xcassets/首页/cam_shili_ok.imageset/组 42708@2x.png differ diff --git a/ProductApp/ProductApp/Assets.xcassets/首页/cam_shili_ok.imageset/组 42708@3x.png b/ProductApp/ProductApp/Assets.xcassets/首页/cam_shili_ok.imageset/组 42708@3x.png new file mode 100644 index 0000000..c3551b6 Binary files /dev/null and b/ProductApp/ProductApp/Assets.xcassets/首页/cam_shili_ok.imageset/组 42708@3x.png differ diff --git a/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.h b/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.h index f1e678b..9c4deb8 100644 --- a/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.h +++ b/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.h @@ -88,6 +88,9 @@ NS_ASSUME_NONNULL_BEGIN +(NSMutableArray *)getSyetemPay; ///根据身份获取字符串 +(NSString *)getidentityTypeString; +///获取role_id ++(NSString *)getRole_id; + @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.m b/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.m index a2cfdec..91a4d14 100644 --- a/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.m +++ b/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.m @@ -11,6 +11,7 @@ #import "NavgationController.h" #import "PublicNetWorkManager.h" +#import "RoleTreeModel.h" static UserInfoModel *userinfo; @implementation UserInfoModel @@ -257,4 +258,27 @@ static UserInfoModel *userinfo; return str; } + +///获取role_id ++(NSString *)getRole_id +{ + NSString *strback = @""; + if([UserInfoModel shareModel].identityType.intValue == 3) + { + if([UserInfoModel shareModel].isAllLevel.intValue == 1) + { + strback = [UserInfoModel shareModel].user_stage.pid; + } + else + { + strback = [UserInfoModel shareModel].user_stage.ID; + } + } + else + { + strback = [UserInfoModel shareModel].user_stage.ID; + } + return strback; +} + @end diff --git a/ProductApp/ProductApp/Configure/ConfigireSetting.h b/ProductApp/ProductApp/Configure/ConfigireSetting.h index 9b39263..b40d20f 100644 --- a/ProductApp/ProductApp/Configure/ConfigireSetting.h +++ b/ProductApp/ProductApp/Configure/ConfigireSetting.h @@ -138,6 +138,10 @@ alpha:alphaValue] ///首页工具刷新 #define HomeToosRef @"HomeToosRef" +///相机提示 拍照写作和作文批改 +#define CamreTiShiPaiZhao @"CamreTiShiPaiZhao" +#define CamreTiShiPiGai @"CamreTiShiPiGai" + @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/Other/ViewLable.m b/ProductApp/ProductApp/Other/ViewLable.m index 15cceb8..692c5b7 100644 --- a/ProductApp/ProductApp/Other/ViewLable.m +++ b/ProductApp/ProductApp/Other/ViewLable.m @@ -133,6 +133,7 @@ NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:self.fspeed>0?self.fspeed:0.02 target:self selector:@selector(textSpeedAppend) userInfo:nil repeats:YES]; _timer = timer; [[NSRunLoop mainRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes]; + [[NSRunLoop mainRunLoop] addTimer:self.timer forMode:NSDefaultRunLoopMode]; } } -(void)textSpeedAppend @@ -147,7 +148,11 @@ }); return; } - if(self.inow+1>self.strValue.length)return; + if(self.inow+1>self.strValue.length) + { + self.backHeight(-1,NO); + return; + } NSString *str = [self.strValue substringToIndex:self.inow]; ///行间距 NSMutableParagraphStyle *style = [NSMutableParagraphStyle new]; diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.h b/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.h index 858f7ba..ae94c9b 100644 --- a/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.h +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.h @@ -18,6 +18,11 @@ #import "ExamplePptDetailModel.h" #import "ExampleTextGreatModel.h" #import "RoleInfoModel.h" +#import "PicAiModel.h" +#import "CorrectWriteCorrectModel.h" +#import "CorrectWriteErrorModel.h" +#import "WriteCorrectScoreModel.h" + NS_ASSUME_NONNULL_BEGIN @@ -91,6 +96,27 @@ NS_ASSUME_NONNULL_BEGIN scene:(NSString *)scene Callback:(completeModeBlock)callback; +/* + case 0://改写作文 + origin = "photos_write"; + scene = "pic_rewrite"; + break; + case 1://拍题写作 + origin = "photos_title"; + scene = "pic_question"; + break; + case 2://拍照续写 + origin = "photos_continue"; + scene = "pic_with_front"; + break; + } + */ ++ (void)requestExamplePicData:(UIView *)view + role_id:(NSString *)role_id + scene:(NSString *)scene + origin:(NSString *)origin + Callback:(completeModeBlock)callback; + /* 引导页ppt /api/example/ppt @@ -213,6 +239,114 @@ NS_ASSUME_NONNULL_BEGIN info:(NSDictionary *)info Callback:(completeModeBlock)callback; +#pragma mark - 拍照写作 +/* + 1上传需识别的图片 + /api/file/ocr + */ + +/* + 2新建带图片记录 + /api/pic/ai + images + */ ++ (void)requestPicAiData:(UIView *)view + images:(NSArray *)images + Callback:(completeModeBlock)callback; + +/* + 3获取记录的所有图片结果(只调用,是后台需要使用的接口) + /api/pic/ai/result + id + */ ++ (void)requestPicAiResultData:(UIView *)view + ID:(NSString *)ID + Callback:(completeModeBlock)callback; + +/* + 3 sse接口 + /api/pic/completions + scene (Query) + id (Body) + */ + +/* + 添加拍图写作记录 + /api/pic/ai/save + id + result { scene content} + */ ++ (void)requestPicAiSaveData:(UIView *)view + ID:(NSString *)ID + scene:(NSString *)scene + content:(NSString *)content + Callback:(completeModeBlock)callback; + +#pragma mark - 作文批改 +/* + { + AiTypeWrite = 1 //智能写作 + AiTypeCorrect = 2 //批改 + AiTypeClassroom = 3 //课堂写作 + AiTypePic = 4 //图片写作 + AiTypeTool = 5 //工具 + AiTypeExample = 6 //范文 + } + */ +/* + 作文批改-创建记录并识别 + /api/correct/create + images [] + sse_type + */ ++ (void)requestCorrectCreateData:(UIView *)view + images:(NSArray *)images + sse_type:(NSString *)sse_type + Callback:(completeModeBlock)callback; + + +/* + 作文批改-反句子1 + /api/correct/write_correct + id + */ ++ (void)requestCorrectWrite_correctData:(UIView *)view + ID:(NSString *)ID + Callback:(completeModeBlock)callback; + +/* + 作文批改_错误寻找 + /api/correct/write_correct_error + id + */ ++ (void)requestCorrectWrite_correct_errorData:(UIView *)view + ID:(NSString *)ID + Callback:(completeModeBlock)callback; + +/* + 作文批改-评分2 + /api/correct/write_correct_score + id + */ ++ (void)requestCorrectWrite_correct_scoreData:(UIView *)view + ID:(NSString *)ID + Callback:(completeModeBlock)callback; + +/* + 作文批改-综合评价3 + /api/correct sse + */ + +/* + 作文批改-句子评价4 + /api/correct sse + */ + +/* + 作文批改-改写润色 + /api/correct sse + */ + /* 语言列表key分组 /api/translate/language/key diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.m b/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.m index af13a03..e4f8999 100644 --- a/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.m +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.m @@ -265,6 +265,56 @@ } }]; } + +/* + case 0://改写作文 + origin = "photos_write"; + scene = "pic_rewrite"; + break; + case 1://拍题写作 + origin = "photos_title"; + scene = "pic_question"; + break; + case 2://拍照续写 + origin = "photos_continue"; + scene = "pic_with_front"; + break; + } + */ ++ (void)requestExamplePicData:(UIView *)view + role_id:(NSString *)role_id + scene:(NSString *)scene + origin:(NSString *)origin + Callback:(completeModeBlock)callback +{ + NSMutableDictionary *dicQuery = [NSMutableDictionary new]; + [dicQuery setObject:[Tools isStringnil:role_id] forKey:@"role_id"]; + [dicQuery setObject:[Tools isStringnil:scene] forKey:@"scene"]; + [dicQuery setObject:[Tools isStringnil:origin] forKey:@"origin"]; + + NSMutableDictionary *dicHeader = [NSMutableDictionary new]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + + [YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:1 url:@"api/example/pic" paraments:dicpush Headers:dicHeader Query:dicQuery completeBlock:^(id _Nullable responseObject, NSError * _Nullable error) { + BOOL state = NO; + NSString *describle = @""; + if (responseObject==nil) { + describle = @"网络错误"; + BaseModel *model = [BaseModel new]; + model.message =describle; + callback(state,model,describle); + }else{ + NSDictionary *dicAll=responseObject; + describle = dicAll[@"message"]; + if ([[NSString stringWithFormat:@"%@",dicAll[@"code"]] intValue] == 0) { + state = YES; + } + callback(state,[ExamplePicModel yy_modelWithJSON:dicAll],describle); + } + }]; +} + /* 引导页ppt /api/example/ppt @@ -668,6 +718,305 @@ }]; } +#pragma mark - 拍照写作 +/* + 1上传需识别的图片 + /api/file/ocr + */ + +/* + 2新建带图片记录 + /api/pic/ai + images 图片ID + */ ++ (void)requestPicAiData:(UIView *)view + images:(NSArray *)images + Callback:(completeModeBlock)callback +{ + NSMutableDictionary *dicQuery = [NSMutableDictionary new]; + + NSMutableDictionary *dicHeader = [NSMutableDictionary new]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:images==nil?@[]:images forKey:@"images"]; + + [YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:2 url:@"api/pic/ai" paraments:dicpush Headers:dicHeader Query:dicQuery completeBlock:^(id _Nullable responseObject, NSError * _Nullable error) { + BOOL state = NO; + NSString *describle = @""; + if (responseObject==nil) { + describle = @"网络错误"; + BaseModel *model = [BaseModel new]; + model.message =describle; + callback(state,model,describle); + }else{ + NSDictionary *dicAll=responseObject; + describle = dicAll[@"message"]; + if ([[NSString stringWithFormat:@"%@",dicAll[@"code"]] intValue] == 0) { + state = YES; + } + callback(state,[PicAiModel yy_modelWithJSON:dicAll],describle); + } + }]; +} + +/* + 3获取记录的所有图片结果(只调用,是后台需要使用的接口) + /api/pic/ai/result + id + */ ++ (void)requestPicAiResultData:(UIView *)view + ID:(NSString *)ID + Callback:(completeModeBlock)callback +{ + NSMutableDictionary *dicQuery = [NSMutableDictionary new]; + [dicQuery setObject:[Tools isStringnil:ID] forKey:@"id"]; + + NSMutableDictionary *dicHeader = [NSMutableDictionary new]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + + [YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:1 url:@"api/pic/ai/result" paraments:dicpush Headers:dicHeader Query:dicQuery completeBlock:^(id _Nullable responseObject, NSError * _Nullable error) { + BOOL state = NO; + NSString *describle = @""; + if (responseObject==nil) { + describle = @"网络错误"; + BaseModel *model = [BaseModel new]; + model.message =describle; + callback(state,model,describle); + }else{ + NSDictionary *dicAll=responseObject; + describle = dicAll[@"message"]; + if ([[NSString stringWithFormat:@"%@",dicAll[@"code"]] intValue] == 0) { + state = YES; + } + callback(state,[PicAiModel yy_modelWithJSON:dicAll],describle); + } + }]; +} + +/* + 添加拍图写作记录 + /api/pic/ai/save + id + result { scene content} + */ ++ (void)requestPicAiSaveData:(UIView *)view + ID:(NSString *)ID + scene:(NSString *)scene + content:(NSString *)content + Callback:(completeModeBlock)callback +{ + NSMutableDictionary *dicQuery = [NSMutableDictionary new]; + + NSMutableDictionary *dicHeader = [NSMutableDictionary new]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:[Tools isStringnil:ID] forKey:@"id"]; + + NSMutableDictionary *dicresult = [NSMutableDictionary new]; + [dicresult setObject:[Tools isStringnil:scene] forKey:@"scene"]; + [dicresult setObject:[Tools isStringnil:content] forKey:@"content"]; + [dicpush setObject:dicresult forKey:@"result"]; + + [YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:2 url:@"api/pic/ai/save" paraments:dicpush Headers:dicHeader Query:dicQuery completeBlock:^(id _Nullable responseObject, NSError * _Nullable error) { + BOOL state = NO; + NSString *describle = @""; + if (responseObject==nil) { + describle = @"网络错误"; + BaseModel *model = [BaseModel new]; + model.message =describle; + callback(state,model,describle); + }else{ + NSDictionary *dicAll=responseObject; + describle = dicAll[@"message"]; + if ([[NSString stringWithFormat:@"%@",dicAll[@"code"]] intValue] == 0) { + state = YES; + } + callback(state,[BaseModel yy_modelWithJSON:dicAll],describle); + } + }]; +} + +/* + 3 sse接口 + /api/pic/completions + scene (Query) + id (Body) + */ + +#pragma mark - 作文批改 +/* + { + AiTypeWrite = 1 //智能写作 + AiTypeCorrect = 2 //批改 + AiTypeClassroom = 3 //课堂写作 + AiTypePic = 4 //图片写作 + AiTypeTool = 5 //工具 + AiTypeExample = 6 //范文 + } + */ +/* + 作文批改-创建记录并识别 + /api/correct/create + images [] + sse_type + */ ++ (void)requestCorrectCreateData:(UIView *)view + images:(NSArray *)images + sse_type:(NSString *)sse_type + Callback:(completeModeBlock)callback +{ + NSMutableDictionary *dicQuery = [NSMutableDictionary new]; + + NSMutableDictionary *dicHeader = [NSMutableDictionary new]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:images==nil?@[]:images forKey:@"images"]; + [dicpush setObject:[Tools isStringnil:sse_type] forKey:@"sse_type"]; + + [YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:2 url:@"api/correct/create" paraments:dicpush Headers:dicHeader Query:dicQuery completeBlock:^(id _Nullable responseObject, NSError * _Nullable error) { + BOOL state = NO; + NSString *describle = @""; + if (responseObject==nil) { + describle = @"网络错误"; + BaseModel *model = [BaseModel new]; + model.message =describle; + callback(state,model,describle); + }else{ + NSDictionary *dicAll=responseObject; + describle = dicAll[@"message"]; + if ([[NSString stringWithFormat:@"%@",dicAll[@"code"]] intValue] == 0) { + state = YES; + } + callback(state,[PicAiModel yy_modelWithJSON:dicAll],describle); + } + }]; +} + +/* + 作文批改-反句子1 + /api/correct/write_correct + id + */ ++ (void)requestCorrectWrite_correctData:(UIView *)view + ID:(NSString *)ID + Callback:(completeModeBlock)callback +{ + NSMutableDictionary *dicQuery = [NSMutableDictionary new]; + + NSMutableDictionary *dicHeader = [NSMutableDictionary new]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:[Tools isStringnil:ID] forKey:@"id"]; + + [YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:2 url:@"api/correct/write_correct" paraments:dicpush Headers:dicHeader Query:dicQuery completeBlock:^(id _Nullable responseObject, NSError * _Nullable error) { + BOOL state = NO; + NSString *describle = @""; + if (responseObject==nil) { + describle = @"网络错误"; + BaseModel *model = [BaseModel new]; + model.message =describle; + callback(state,model,describle); + }else{ + NSDictionary *dicAll=responseObject; + describle = dicAll[@"message"]; + if ([[NSString stringWithFormat:@"%@",dicAll[@"code"]] intValue] == 0) { + state = YES; + } + callback(state,[CorrectWriteCorrectModel yy_modelWithJSON:dicAll],describle); + } + }]; +} + +/* + 作文批改_错误寻找 + /api/correct/write_correct_error + id + */ ++ (void)requestCorrectWrite_correct_errorData:(UIView *)view + ID:(NSString *)ID + Callback:(completeModeBlock)callback +{ + NSMutableDictionary *dicQuery = [NSMutableDictionary new]; + + NSMutableDictionary *dicHeader = [NSMutableDictionary new]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:[Tools isStringnil:ID] forKey:@"id"]; + + [YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:2 url:@"api/correct/write_correct_error" paraments:dicpush Headers:dicHeader Query:dicQuery completeBlock:^(id _Nullable responseObject, NSError * _Nullable error) { + BOOL state = NO; + NSString *describle = @""; + if (responseObject==nil) { + describle = @"网络错误"; + BaseModel *model = [BaseModel new]; + model.message =describle; + callback(state,model,describle); + }else{ + NSDictionary *dicAll=responseObject; + describle = dicAll[@"message"]; + if ([[NSString stringWithFormat:@"%@",dicAll[@"code"]] intValue] == 0) { + state = YES; + } + callback(state,[CorrectWriteErrorModel yy_modelWithJSON:dicAll],describle); + } + }]; +} + +/* + 作文批改-评分2 + /api/correct/write_correct_score + id + */ ++ (void)requestCorrectWrite_correct_scoreData:(UIView *)view + ID:(NSString *)ID + Callback:(completeModeBlock)callback +{ + NSMutableDictionary *dicQuery = [NSMutableDictionary new]; + + NSMutableDictionary *dicHeader = [NSMutableDictionary new]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:[Tools isStringnil:ID] forKey:@"id"]; + + [YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:2 url:@"api/correct/write_correct_score" paraments:dicpush Headers:dicHeader Query:dicQuery completeBlock:^(id _Nullable responseObject, NSError * _Nullable error) { + BOOL state = NO; + NSString *describle = @""; + if (responseObject==nil) { + describle = @"网络错误"; + BaseModel *model = [BaseModel new]; + model.message =describle; + callback(state,model,describle); + }else{ + NSDictionary *dicAll=responseObject; + describle = dicAll[@"message"]; + if ([[NSString stringWithFormat:@"%@",dicAll[@"code"]] intValue] == 0) { + state = YES; + } + callback(state,[WriteCorrectScoreModel yy_modelWithJSON:dicAll],describle); + } + }]; +} + + + +/* + 作文批改-综合评价3 + /api/correct sse + */ + +/* + 作文批改-句子评价4 + /api/correct sse + */ + +/* + 作文批改-改写润色 + /api/correct sse + */ + + + /* 语言列表key分组 /api/translate/language/key diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/SSENetWorkManager.m b/ProductApp/ProductApp/ProductMain/NetWorkManager/SSENetWorkManager.m index 121e1e5..ab9c342 100644 --- a/ProductApp/ProductApp/ProductMain/NetWorkManager/SSENetWorkManager.m +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/SSENetWorkManager.m @@ -47,7 +47,8 @@ NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:host]]; - [request setValue:@"text/event-stream" forHTTPHeaderField:@"Content-Type"]; + [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; + [request setValue:@"text/event-stream" forHTTPHeaderField:@"Accept"]; [request setHTTPMethod:@"POST"]; NSMutableDictionary *dicheadertemp = [NSMutableDictionary new]; @@ -74,7 +75,6 @@ [request setHTTPBody:[bodyString dataUsingEncoding:NSUTF8StringEncoding]]; - NSURLSessionDataTask *task = [session dataTaskWithRequest:request]; // 启动任务 [task resume]; diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/models/CorrectWriteCorrectModel.h b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/CorrectWriteCorrectModel.h new file mode 100644 index 0000000..c757e31 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/CorrectWriteCorrectModel.h @@ -0,0 +1,27 @@ +// +// CorrectWriteCorrectModel.h +// ProductApp +// +// Created by 工作 on 2024/10/25. +// + +#import "BaseModel.h" + +NS_ASSUME_NONNULL_BEGIN +@class CorrectWriteCorrectModelData,CorrectWriteCorrectModelDataSplit; +@interface CorrectWriteCorrectModel : BaseModel +/// +@property (nonatomic , strong) CorrectWriteCorrectModelData *data; +@end +@interface CorrectWriteCorrectModelData : NSObject +/// +@property (nonatomic , strong) NSString *ID; +/// +@property (nonatomic , strong) NSArray *split_review; +@end +@interface CorrectWriteCorrectModelDataSplit : NSObject +/// +@property (nonatomic , strong) NSString *origin_content; +@end + +NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/models/CorrectWriteCorrectModel.m b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/CorrectWriteCorrectModel.m new file mode 100644 index 0000000..9c2cdcd --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/CorrectWriteCorrectModel.m @@ -0,0 +1,27 @@ +// +// CorrectWriteCorrectModel.m +// ProductApp +// +// Created by 工作 on 2024/10/25. +// + +#import "CorrectWriteCorrectModel.h" + +@implementation CorrectWriteCorrectModel ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"data" : [CorrectWriteCorrectModelData class]}; +} +@end +@implementation CorrectWriteCorrectModelData ++ (nullable NSDictionary *)modelCustomPropertyMapper +{ + return @{@"ID" : @"id"}; +} ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"split_review" : [CorrectWriteCorrectModelDataSplit class]}; +} +@end +@implementation CorrectWriteCorrectModelDataSplit + +@end + diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/models/CorrectWriteErrorModel.h b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/CorrectWriteErrorModel.h new file mode 100644 index 0000000..c76b64e --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/CorrectWriteErrorModel.h @@ -0,0 +1,41 @@ +// +// CorrectWriteErrorModel.h +// ProductApp +// +// Created by 工作 on 2024/10/25. +// + +#import "BaseModel.h" + +NS_ASSUME_NONNULL_BEGIN +@class CorrectWriteErrorModelData,CorrectWriteErrorModelDataPosition,CorrectWriteErrorModelDataPositionSize; +@interface CorrectWriteErrorModel : BaseModel +/// +@property (nonatomic , strong) NSArray *data; +@end +@interface CorrectWriteErrorModelData : NSObject +/// +@property (nonatomic , strong) NSString *page; +/// +@property (nonatomic , strong) NSString *type; +/// +@property (nonatomic , strong) CorrectWriteErrorModelDataPosition *position; +/// +@property (nonatomic , strong) NSString *before; +/// +@property (nonatomic , strong) NSString *after; +@end +@interface CorrectWriteErrorModelDataPosition : NSObject +/// +@property (nonatomic , strong) NSString *left_top; +/// +@property (nonatomic , strong) NSString *right_bottom; +@end +@interface CorrectWriteErrorModelDataPositionSize : NSObject +/// +@property (nonatomic , strong) NSString *x; +/// +@property (nonatomic , strong) NSString *y; +@end + +NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/models/CorrectWriteErrorModel.m b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/CorrectWriteErrorModel.m new file mode 100644 index 0000000..cf994a7 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/CorrectWriteErrorModel.m @@ -0,0 +1,29 @@ +// +// CorrectWriteErrorModel.m +// ProductApp +// +// Created by 工作 on 2024/10/25. +// + +#import "CorrectWriteErrorModel.h" + +@implementation CorrectWriteErrorModel ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"data" : [CorrectWriteErrorModelData class]}; +} +@end +@implementation CorrectWriteErrorModelData ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"position" : [CorrectWriteErrorModelDataPosition class]}; +} +@end +@implementation CorrectWriteErrorModelDataPosition ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"left_top" : [CorrectWriteErrorModelDataPositionSize class], + @"right_bottom" : [CorrectWriteErrorModelDataPositionSize class]}; +} +@end +@implementation CorrectWriteErrorModelDataPositionSize + +@end + diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/models/PicAiModel.h b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/PicAiModel.h new file mode 100644 index 0000000..8e1b151 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/PicAiModel.h @@ -0,0 +1,20 @@ +// +// PicAiModel.h +// ProductApp +// +// Created by 工作 on 2024/10/25. +// + +#import "BaseModel.h" + +NS_ASSUME_NONNULL_BEGIN +@class PicAiModelData; +@interface PicAiModel : BaseModel +/// +@property (nonatomic , strong) PicAiModelData *data; +@end +@interface PicAiModelData : NSObject +/// +@property (nonatomic , strong) NSString *ID; +@end +NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/models/PicAiModel.m b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/PicAiModel.m new file mode 100644 index 0000000..16170cd --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/PicAiModel.m @@ -0,0 +1,20 @@ +// +// PicAiModel.m +// ProductApp +// +// Created by 工作 on 2024/10/25. +// + +#import "PicAiModel.h" + +@implementation PicAiModel ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"data" : [PicAiModelData class]}; +} +@end +@implementation PicAiModelData ++ (nullable NSDictionary *)modelCustomPropertyMapper +{ + return @{@"ID" : @"id"}; +} +@end diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/models/WriteCorrectScoreModel.h b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/WriteCorrectScoreModel.h new file mode 100644 index 0000000..c3d8074 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/WriteCorrectScoreModel.h @@ -0,0 +1,29 @@ +// +// WriteCorrectScoreModel.h +// ProductApp +// +// Created by 工作 on 2024/10/25. +// + +#import "BaseModel.h" + +NS_ASSUME_NONNULL_BEGIN +@class WriteCorrectScoreModelData,WriteCorrectScoreModelDataComplex; +@interface WriteCorrectScoreModel : BaseModel +/// +@property (nonatomic , strong) WriteCorrectScoreModelData *data; +@end +@interface WriteCorrectScoreModelData : NSObject +/// +@property (nonatomic , strong) WriteCorrectScoreModelDataComplex *complex_review; +/// +@property (nonatomic , strong) NSString *total_score; +/// +@property (nonatomic , strong) NSString *total_words; +@end + +@interface WriteCorrectScoreModelDataComplex : NSObject +/// +@property (nonatomic , strong) NSArray *score; +@end +NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/models/WriteCorrectScoreModel.m b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/WriteCorrectScoreModel.m new file mode 100644 index 0000000..fa9b0a9 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/WriteCorrectScoreModel.m @@ -0,0 +1,26 @@ +// +// WriteCorrectScoreModel.m +// ProductApp +// +// Created by 工作 on 2024/10/25. +// + +#import "WriteCorrectScoreModel.h" +#import "TextbookInfoModel.h" + +@implementation WriteCorrectScoreModel ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"data" : [WriteCorrectScoreModelData class]}; +} +@end +@implementation WriteCorrectScoreModelData ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"complex_review" : [WriteCorrectScoreModelDataComplex class]}; +} +@end +@implementation WriteCorrectScoreModelDataComplex ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"score" : [TextbookInfoModelDataResultComplexScore class]}; +} +@end + diff --git a/ProductApp/ProductApp/ProductMain/alter/LoadAlterView.m b/ProductApp/ProductApp/ProductMain/alter/LoadAlterView.m index 76c1a52..44657dd 100644 --- a/ProductApp/ProductApp/ProductMain/alter/LoadAlterView.m +++ b/ProductApp/ProductApp/ProductMain/alter/LoadAlterView.m @@ -34,10 +34,10 @@ static LoadAlterView *viewshow; [viewback.layer setMasksToBounds:YES]; [viewback.layer setCornerRadius:15]; - NSString *strpath = [[NSBundle mainBundle] pathForResource:@"pag_loading" ofType:@"pag"]; PAGView *pagView = [[PAGView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; [viewback addSubview:pagView]; dispatch_async(dispatch_get_global_queue(0, 0), ^{ + NSString *strpath = [[NSBundle mainBundle] pathForResource:@"pag_loading" ofType:@"pag"]; PAGFile* pagFile = [PAGFile Load:strpath]; [pagView setComposition:pagFile]; [pagView setRepeatCount:0]; diff --git a/ProductApp/ProductApp/ProductMain/引导/作文批改/cell/StartZWPIViewCell.h b/ProductApp/ProductApp/ProductMain/引导/作文批改/cell/StartZWPIViewCell.h index 585d2db..e8c1a38 100644 --- a/ProductApp/ProductApp/ProductMain/引导/作文批改/cell/StartZWPIViewCell.h +++ b/ProductApp/ProductApp/ProductMain/引导/作文批改/cell/StartZWPIViewCell.h @@ -10,6 +10,12 @@ NS_ASSUME_NONNULL_BEGIN @interface StartZWPIViewCell : JhtBannerCardView + +/// +@property (nonatomic , strong) UILabel *lbname; +/// +@property (nonatomic , strong) UIImageView *imgvback; + /// @property (nonatomic , strong) ExampleCorrectListDataItems *model; @end diff --git a/ProductApp/ProductApp/ProductMain/引导/作文批改/cell/StartZWPIViewCell.m b/ProductApp/ProductApp/ProductMain/引导/作文批改/cell/StartZWPIViewCell.m index 2532554..c36e4f6 100644 --- a/ProductApp/ProductApp/ProductMain/引导/作文批改/cell/StartZWPIViewCell.m +++ b/ProductApp/ProductApp/ProductMain/引导/作文批改/cell/StartZWPIViewCell.m @@ -9,10 +9,7 @@ @interface StartZWPIViewCell () -/// -@property (nonatomic , strong) UILabel *lbname; -/// -@property (nonatomic , strong) UIImageView *imgvback; + @end @implementation StartZWPIViewCell @@ -22,7 +19,7 @@ if(self = [super initWithFrame:frame]) { UILabel *lbname = [[UILabel alloc] init]; - [lbname setText:@"《一路有你相伴》"]; + [lbname setText:@""]; [lbname setTextColor:RGBCOLOR(51, 51, 51)]; [lbname setTextAlignment:NSTextAlignmentCenter]; [lbname setFont:[UIFont boldSystemFontOfSize:20]]; @@ -35,7 +32,7 @@ _lbname = lbname; UIImageView *imgvback = [[UIImageView alloc] init]; - [imgvback setContentMode:UIViewContentModeScaleAspectFill]; + [imgvback setContentMode:UIViewContentModeRedraw]; [self addSubview:imgvback]; [imgvback mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self); diff --git a/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/StartZWPIDetailViewController.h b/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/StartZWPIDetailViewController.h index d0345ce..ffcd0f9 100644 --- a/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/StartZWPIDetailViewController.h +++ b/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/StartZWPIDetailViewController.h @@ -14,6 +14,12 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic , assign) BOOL isshiyong; ///引导页数据-作文批改 @property (nonatomic , strong) ExampleCorrectListDataItems *modelDetailZWPG; + +///批改的图片 +@property (nonatomic , strong) NSArray *arrXZImages; +/// +@property (nonatomic , strong) NSString *strID; + @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/StartZWPIDetailViewController.m b/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/StartZWPIDetailViewController.m index 9eeb430..8735495 100644 --- a/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/StartZWPIDetailViewController.m +++ b/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/StartZWPIDetailViewController.m @@ -7,7 +7,7 @@ #import "StartZWPIDetailViewController.h" #import "StartZWPIDetailView.h" - +#import "NetWorkManager.h" @interface StartZWPIDetailViewController () @@ -23,7 +23,15 @@ [self showNaviGationView:YES]; [self.navigationView setTitle:@"作文批改" titleColor:RGBCOLOR(60, 60, 60)]; [self.navigationView setBackgroundColor:[UIColor whiteColor]]; - [self.navigationView.backButton setHidden:YES]; + [self.navigationView.backButton setHidden:self.isshiyong]; + if(self.isshiyong==NO) + { + [self.navigationView setMuenImg:@"xz_fenxiang"]; + } +} +-(void)navMuenButtonAction +{///分享 + } - (void)viewDidLoad { [super viewDidLoad]; @@ -37,7 +45,60 @@ }]; view.isshiyong = self.isshiyong; view.modelDetailZWPG = self.modelDetailZWPG; + view.arrXZImages = self.arrXZImages; + view.strID = self.strID; + if(self.arrXZImages.count>0) + { + [LoadAlterView show]; + __block int loadcount = 0; + [NetWorkManager requestCorrectWrite_correct_scoreData:self.view ID:self.strID Callback:^(BOOL state, WriteCorrectScoreModel *responseObject, NSString * _Nullable describle) { + loadcount++; + if(state) + { + view.modelPF = responseObject.data; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + if(loadcount>=3) + { + [LoadAlterView dismiss]; + } + }]; + [NetWorkManager requestCorrectWrite_correct_errorData:self.view ID:self.strID Callback:^(BOOL state, CorrectWriteErrorModel *responseObject, NSString * _Nullable describle) { + loadcount++; + if(state) + { + view.arrErrorLocation = responseObject.data; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + if(loadcount>=3) + { + [LoadAlterView dismiss]; + } + }]; + [NetWorkManager requestCorrectWrite_correctData:self.view ID:self.strID Callback:^(BOOL state, CorrectWriteCorrectModel *responseObject, NSString * _Nullable describle) { + loadcount++; + if(state) + { + view.modelContentItems = responseObject.data; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + if(loadcount>=3) + { + [LoadAlterView dismiss]; + } + }]; + + } } diff --git a/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/view/StartZWPIDetailView.h b/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/view/StartZWPIDetailView.h index 9326bdf..36e70c0 100644 --- a/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/view/StartZWPIDetailView.h +++ b/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/view/StartZWPIDetailView.h @@ -7,6 +7,9 @@ #import #import "ExampleCorrectList.h" + +#import "WriteCorrectScoreModel.h" +#import "CorrectWriteCorrectModel.h" NS_ASSUME_NONNULL_BEGIN @interface StartZWPIDetailView : UIView @@ -14,6 +17,17 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic , assign) BOOL isshiyong; ///引导页数据-作文批改 @property (nonatomic , strong) ExampleCorrectListDataItems *modelDetailZWPG; + +///批改的图片 +@property (nonatomic , strong) NSArray *arrXZImages; +/// +@property (nonatomic , strong) NSString *strID; +///评分 +@property (nonatomic , strong) WriteCorrectScoreModelData *modelPF; +///错误位置信息 +@property (nonatomic , strong) NSArray *arrErrorLocation; +///句子数据 +@property (nonatomic , strong) CorrectWriteCorrectModelData *modelContentItems; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/view/StartZWPIDetailView.m b/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/view/StartZWPIDetailView.m index eeeb24a..1466264 100644 --- a/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/view/StartZWPIDetailView.m +++ b/ProductApp/ProductApp/ProductMain/引导/作文批改/批改信息/view/StartZWPIDetailView.m @@ -10,6 +10,8 @@ #import "StartKTXZPGDetailZHView.h" #import "StartKTXZPGDetailFJView.h" #import "StartPayViewController.h" +#import "DuanLuoXieZuoQWViewController.h" +#import "StartKTXZPGDetailXZView.h" @interface StartZWPIDetailView () /// @@ -24,6 +26,9 @@ @property (nonatomic , strong) StartKTXZPGDetailZHView *viewzh; /// @property (nonatomic , strong) StartKTXZPGDetailFJView *viewfj; +/// +@property (nonatomic , strong) StartKTXZPGDetailXZView *viewxz; + @end @@ -125,7 +130,6 @@ make.top.offset(30); make.height.offset(40); }]; - viewtop.arrTitle = @[@"综合评价",@"分句点评"]; [viewtop setBackSelect:^(NSInteger tag) { [self.scvbackinfo setContentOffset:CGPointMake(UISCREEN_WIDTH*tag, 0)]; [self showVC:tag]; @@ -136,7 +140,7 @@ [scvback setPagingEnabled:YES]; [scvback setShowsHorizontalScrollIndicator:NO]; [view addSubview:scvback]; - [scvback setContentSize:CGSizeMake(UISCREEN_WIDTH*3, 0)]; + [scvback setContentSize:CGSizeMake(UISCREEN_WIDTH*2, 0)]; [scvback setDelegate:self]; _scvbackinfo = scvback; @@ -174,8 +178,17 @@ } -(void)tiyanAction { - StartPayViewController *vc = [StartPayViewController new]; - [self.viewController.navigationController pushViewController:vc animated:YES]; + if(self.isshiyong) + {///支付 + StartPayViewController *vc = [StartPayViewController new]; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + else + {///写作文章 + DuanLuoXieZuoQWViewController *vc = [DuanLuoXieZuoQWViewController new]; +// vc.dicpush = + [self.viewController.navigationController pushViewController:vc animated:YES]; + } } -(void)showVC:(NSInteger)page { @@ -194,6 +207,21 @@ _viewfj = viewfj; } } + else if (page==2) + { + if(!self.viewxz) + { + StartKTXZPGDetailXZView *viewxz = [StartKTXZPGDetailXZView new]; + [self.scvbackinfo addSubview:viewxz]; + [viewxz mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.offset(UISCREEN_WIDTH*2); + make.top.offset(0); + make.width.height.equalTo(self.scvbackinfo); + }]; + viewxz.modelResult = self.modelDetailZWPG.result; + _viewxz = viewxz; + } + } } #pragma mark - UIScrollView - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView @@ -203,10 +231,25 @@ [self showVC:ipage]; } +-(void)setIsshiyong:(BOOL)isshiyong +{ + _isshiyong = isshiyong; + if(isshiyong) + { + [self.scvbackinfo setContentSize:CGSizeMake(UISCREEN_WIDTH*2, 0)]; + self.viewtop.arrTitle = @[@"综合评价",@"分句点评"]; + } + else + { + [self.scvbackinfo setContentSize:CGSizeMake(UISCREEN_WIDTH*3, 0)]; + self.viewtop.arrTitle = @[@"综合评价",@"分句点评",@"写作思路"]; + } +} + -(void)setModelDetailZWPG:(ExampleCorrectListDataItems *)modelDetailZWPG { _modelDetailZWPG = modelDetailZWPG; - + if(modelDetailZWPG==nil)return; if(self.modelDetailZWPG.output_image.count>0) { @@ -246,7 +289,49 @@ } self.viewzh.modelResult = modelDetailZWPG.result; +} +-(void)setArrXZImages:(NSArray *)arrXZImages +{ + _arrXZImages = arrXZImages; + if(arrXZImages.count>0) + { + UIView *viewlast = nil; + for(UIImage *image in self.arrXZImages) + { + UIImageView *imgvback = [[UIImageView alloc] init]; + [imgvback setContentMode:UIViewContentModeScaleAspectFit]; + [self.scvback addSubview:imgvback]; + [imgvback mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.offset(0); + make.width.offset(UISCREEN_WIDTH); + if(viewlast) + { + make.top.equalTo(viewlast.mas_bottom).offset(20); + } + else + { + make.top.offset(0); + } + make.height.offset(image.size.height*UISCREEN_WIDTH/image.size.width); + }]; + viewlast = imgvback; + } + [self.scvback mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(viewlast).offset(20); + }]; + } } +-(void)setStrID:(NSString *)strID +{ + _strID = strID; + self.viewzh.strID = strID; +} +-(void)setModelPF:(WriteCorrectScoreModelData *)modelPF +{ + _modelPF = modelPF; + + self.viewzh.modelPF = modelPF; +} @end diff --git a/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/StartKTXZPGViewController.h b/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/StartKTXZPGViewController.h index 4c4af5a..edfdba8 100644 --- a/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/StartKTXZPGViewController.h +++ b/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/StartKTXZPGViewController.h @@ -8,12 +8,15 @@ #import "BaseViewController.h" #import "TextbookInfoModel.h" #import "ExampleCorrectList.h" + +#import "ExamplePicModel.h" + NS_ASSUME_NONNULL_BEGIN @interface StartKTXZPGViewController : BaseViewController ///是否是引导页 @property (nonatomic , assign) BOOL isshiyong; -///0课堂写作 1作文批改 +///0课堂写作 1作文批改 10改写作文 11拍题成文 12 拍照续写 @property (nonatomic , assign) int type; ///引导页数据-课堂写作 @@ -21,6 +24,11 @@ NS_ASSUME_NONNULL_BEGIN ///引导页数据-作文批改 @property (nonatomic , strong) ExampleCorrectListDataItems *modelDetailZWPG; +///拍照写作示例 +@property (nonatomic , strong) ExamplePicModelDataItems *modelXZSL; +///写作的图片 +@property (nonatomic , strong) NSArray *arrXZImages; + @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/StartKTXZPGViewController.m b/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/StartKTXZPGViewController.m index c8438ce..626876a 100644 --- a/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/StartKTXZPGViewController.m +++ b/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/StartKTXZPGViewController.m @@ -34,6 +34,9 @@ view.type = self.type; view.modelDetailYDY = self.modelDetailYDY; view.modelDetailZWPG = self.modelDetailZWPG; + view.modelXZSL = self.modelXZSL; + view.arrXZImages = self.arrXZImages; + } diff --git a/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/view/StartKTXZPGView.h b/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/view/StartKTXZPGView.h index 130bdbe..6cab7c7 100644 --- a/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/view/StartKTXZPGView.h +++ b/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/view/StartKTXZPGView.h @@ -8,10 +8,13 @@ #import #import "TextbookInfoModel.h" #import "ExampleCorrectList.h" + +#import "ExamplePicModel.h" + NS_ASSUME_NONNULL_BEGIN @interface StartKTXZPGView : UIView -///0课堂写作 1作文批改 +///0课堂写作 1作文批改 10改写作文 11拍题成文 12 拍照续写 @property (nonatomic , assign) int type; ///是否是引导页 @property (nonatomic , assign) BOOL isshiyong; @@ -19,6 +22,14 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic , strong) TextbookInfoModelData *modelDetailYDY; ///引导页数据-作文批改 @property (nonatomic , strong) ExampleCorrectListDataItems *modelDetailZWPG; + + +///拍照写作示例 +@property (nonatomic , strong) ExamplePicModelDataItems *modelXZSL; +///写作的图片 +@property (nonatomic , strong) NSArray *arrXZImages; + + @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/view/StartKTXZPGView.m b/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/view/StartKTXZPGView.m index df6e89f..ff35025 100644 --- a/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/view/StartKTXZPGView.m +++ b/ProductApp/ProductApp/ProductMain/引导/扫描识别页面/view/StartKTXZPGView.m @@ -9,7 +9,9 @@ #import "DownJDLoadView.h" #import "StartKTXZPGDetailViewController.h" #import "StartZWPIDetailViewController.h" - +#import "StartPZXZDetailViewController.h" +#import "PublicUploadImageManager.h" +#import "NetWorkManager.h" @interface StartKTXZPGView () /// @@ -23,6 +25,15 @@ /// @property (nonatomic , strong) DownJDLoadView *viewjd; @property (nonatomic , strong) UILabel *lbstate; + + +@property (nonatomic , assign) int iputimagetag; +/// +@property (nonatomic , strong) NSMutableArray *arrImageIDs; + +/// +@property (nonatomic , strong) NSString *strID; + @end @implementation StartKTXZPGView @@ -138,21 +149,39 @@ ///模拟 float fvalue = (self.viewjd.fblv*100+0.2)/100; + + ///真实数据 + if(self.arrXZImages.count>0) + { + if(self.strID.length==0 && fvalue>=0.98) + { + fvalue = 0.98; + } + } + self.viewjd.fblv = fvalue; if(fvalue>0.3 && fvalue<0.8) { [self.lbstate setText:@"作文批改中..."]; + if(self.type>=10&&self.type<=12) + { + [self.lbstate setText:@"作文识别中..."]; + } } else if (fvalue>0.99 && fvalue<1) { [self.lbstate setText:@"作文批改完成"]; + if(self.type>=10&&self.type<=12) + { + [self.lbstate setText:@"图片识别完成"]; + } } else if(fvalue>=1) { [self.timer invalidate]; self.timer = nil; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self pushVC]; }); } @@ -173,8 +202,107 @@ [self.imgvvalue sd_setImageWithURL:[NSURL URLWithString:modelDetailZWPG.input_image.firstObject] placeholderImage:nil]; } } + +-(void)setModelXZSL:(ExamplePicModelDataItems *)modelXZSL +{ + _modelXZSL = modelXZSL; + if(modelXZSL.image.count>0) + { + [self.imgvvalue sd_setImageWithURL:[NSURL URLWithString:modelXZSL.image.firstObject] placeholderImage:nil]; + } +} +-(void)setArrXZImages:(NSArray *)arrXZImages +{ + _arrXZImages = arrXZImages; + self.iputimagetag = 0; + self.arrImageIDs = [NSMutableArray new]; + [self uploadImage]; +} +-(void)uploadImage +{ + self.imgvvalue.image = self.arrXZImages[self.iputimagetag]; + NSString *strurl = @""; + if(self.type==1) + { + strurl = @"api/correct/image"; + } + else if (self.type>=10&&self.type<=12) + { + strurl = @"api/file/ocr"; + } + [[PublicUploadImageManager shareManager] netWorkUrlUserPost:[NSString stringWithFormat:@"%@%@",BaseUrl,strurl] UploadImage:self.arrXZImages[self.iputimagetag] dicQuery:@{} Callback:^(BOOL state, NSDictionary *responseObject, NSString * _Nullable describle) { + if(state) + { + [self.arrImageIDs addObject:[Tools isStringnil:[responseObject objectForKey:@"id"]]]; + } + else + { + [HXHud showMessage:describle afterDelayType:1]; + } + self.iputimagetag++; + if(self.iputimagetag>=self.arrXZImages.count) + {/// + [self createJiLu]; + } + else + { + [self uploadImage]; + } + }]; +} +-(void)createJiLu +{ + if(self.type==1) + { + [NetWorkManager requestCorrectCreateData:self images:self.arrImageIDs sse_type:@"2" Callback:^(BOOL state, PicAiModel *responseObject, NSString * _Nullable describle) { + if(state) + { + self.strID = responseObject.data.ID; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + [self.viewController.navigationController popViewControllerAnimated:YES]; + } + }]; + } + else if (self.type>=10&&self.type<=12) + { + [NetWorkManager requestPicAiData:self images:self.arrImageIDs Callback:^(BOOL state, PicAiModel *responseObject, NSString * _Nullable describle) { + if(state) + { + [self getJiLu:responseObject.data.ID]; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + [self.viewController.navigationController popViewControllerAnimated:YES]; + } + }]; + } + + + + +} +-(void)getJiLu:(NSString *)ID +{ + [NetWorkManager requestPicAiResultData:self ID:ID Callback:^(BOOL state, BaseModel *responseObject, NSString * _Nullable describle) { + if(state) + { + self.strID = ID; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + [self.viewController.navigationController popViewControllerAnimated:YES]; + } + }]; +} + -(void)pushVC { + ///0课堂写作 1作文批改 10改写作文 11拍题成文 12 拍照续写 switch (self.type) { case 0: { @@ -189,6 +317,8 @@ StartZWPIDetailViewController *vc = [StartZWPIDetailViewController new]; vc.isshiyong = self.isshiyong; vc.modelDetailZWPG = self.modelDetailZWPG; + vc.strID = self.strID; + vc.arrXZImages = self.arrXZImages; [self.viewController.navigationController pushViewController:vc animated:YES]; } break; @@ -202,6 +332,17 @@ } break; + case 10: case 11: case 12: + { + StartPZXZDetailViewController *vc = [StartPZXZDetailViewController new]; + vc.isshiyong = self.isshiyong; + vc.modelYD = self.modelXZSL; + vc.type = self.type; + vc.strID = self.strID; + vc.arrXZImages = self.arrXZImages; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + break; default: break; } diff --git a/ProductApp/ProductApp/ProductMain/引导/拍照写作/view/StartPZXZPageView.h b/ProductApp/ProductApp/ProductMain/引导/拍照写作/view/StartPZXZPageView.h index c68c5b1..e449e1a 100644 --- a/ProductApp/ProductApp/ProductMain/引导/拍照写作/view/StartPZXZPageView.h +++ b/ProductApp/ProductApp/ProductMain/引导/拍照写作/view/StartPZXZPageView.h @@ -10,9 +10,15 @@ NS_ASSUME_NONNULL_BEGIN @interface StartPZXZPageView : UIView +///是否是引导页 +@property (nonatomic , assign) BOOL isshiyong; @property (nonatomic , assign) CGSize yidongsize; /// @property (nonatomic , strong) ExamplePicModelDataItems *model; + +///写作的图片 +@property (nonatomic , strong) NSArray *arrXZImages; + @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/拍照写作/view/StartPZXZPageView.m b/ProductApp/ProductApp/ProductMain/引导/拍照写作/view/StartPZXZPageView.m index b3ddd8a..fbe71e6 100644 --- a/ProductApp/ProductApp/ProductMain/引导/拍照写作/view/StartPZXZPageView.m +++ b/ProductApp/ProductApp/ProductMain/引导/拍照写作/view/StartPZXZPageView.m @@ -44,18 +44,104 @@ } return self; } +-(void)setIsshiyong:(BOOL)isshiyong +{ + if(isshiyong==NO) + { + [self.scvback setContentSize:CGSizeMake(0, 0)]; + } +} -(void)setModel:(ExamplePicModelDataItems *)model { _model = model; - if(model.image.count>0) + + if(self.isshiyong==NO) { - [self.imgvback sd_setImageWithURL:[NSURL URLWithString:model.image.firstObject] placeholderImage:nil]; + [self.imgvback removeFromSuperview]; + [self.scvback setUserInteractionEnabled:YES]; + [self.scvback setScrollEnabled:YES]; + UIView *viewlast = nil; + for(int i = 0 ; i < model.image.count;i++) + { + UIImageView *imgvback = [[UIImageView alloc] init]; + [self.scvback addSubview:imgvback]; + [imgvback mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.width.equalTo(self.scvback); + if(viewlast!=nil) + { + make.top.equalTo(viewlast.mas_bottom); + } + else + { + make.top.offset(0); + } + }]; + viewlast = imgvback; + + [imgvback sd_setImageWithURL:[NSURL URLWithString:model.image[i]] placeholderImage:nil completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { + if(image) + { + [imgvback mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.offset(UISCREEN_WIDTH*image.size.height/image.size.width); + }]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self.scvback setContentSize:CGSizeMake(0, imgvback.bottom)]; + }); + } + }]; + + } } else { - [self.imgvback setImage:[UIImage imageNamed:@"yd_nomoxiangji"]]; + if(model.image.count>0) + { + [self.imgvback sd_setImageWithURL:[NSURL URLWithString:model.image.firstObject] placeholderImage:nil]; + } + else + { + [self.imgvback setImage:[UIImage imageNamed:@"yd_nomoxiangji"]]; + } } } + +-(void)setArrXZImages:(NSArray *)arrXZImages +{ + _arrXZImages = arrXZImages; + + [self.imgvback removeFromSuperview]; + [self.scvback setUserInteractionEnabled:YES]; + [self.scvback setScrollEnabled:YES]; + UIView *viewlast = nil; + for(int i = 0 ; i < arrXZImages.count;i++) + { + UIImage *image = arrXZImages[i]; + UIImageView *imgvback = [[UIImageView alloc] init]; + [self.scvback addSubview:imgvback]; + [imgvback mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.width.equalTo(self.scvback); + if(viewlast!=nil) + { + make.top.equalTo(viewlast.mas_bottom); + } + else + { + make.top.offset(0); + } + }]; + imgvback.image = image; + viewlast = imgvback; + + [imgvback mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.offset(UISCREEN_WIDTH*image.size.height/image.size.width); + }]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self.scvback setContentSize:CGSizeMake(0, imgvback.bottom)]; + }); + + } +} + ///去小数点后1 x y -(void)setYidongsize:(CGSize)yidongsize { diff --git a/ProductApp/ProductApp/ProductMain/引导/拍照写作/view/StartPZXZView.m b/ProductApp/ProductApp/ProductMain/引导/拍照写作/view/StartPZXZView.m index ff6a894..98bd174 100644 --- a/ProductApp/ProductApp/ProductMain/引导/拍照写作/view/StartPZXZView.m +++ b/ProductApp/ProductApp/ProductMain/引导/拍照写作/view/StartPZXZView.m @@ -194,6 +194,7 @@ [self stopMotion]; /// StartPZXZDetailViewController *vc = [StartPZXZDetailViewController new]; + vc.isshiyong = YES; vc.modelYD = self.arrdataYD[self.btselect.tag]; [self.viewController.navigationController pushViewController:vc animated:YES]; } diff --git a/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/StartPZXZDetailViewController.h b/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/StartPZXZDetailViewController.h index 08bfa21..5875b10 100644 --- a/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/StartPZXZDetailViewController.h +++ b/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/StartPZXZDetailViewController.h @@ -10,8 +10,19 @@ NS_ASSUME_NONNULL_BEGIN @interface StartPZXZDetailViewController : BaseViewController +///是否是引导页 +@property (nonatomic , assign) BOOL isshiyong; /// @property (nonatomic , strong) ExamplePicModelDataItems *modelYD; +/// +@property (nonatomic , strong) NSString *value; +///10改写作文 11拍题成文 12 拍照续写 +@property (nonatomic , assign) int type; + +///写作的图片 +@property (nonatomic , strong) NSArray *arrXZImages; +/// +@property (nonatomic , strong) NSString *strID; @end diff --git a/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/StartPZXZDetailViewController.m b/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/StartPZXZDetailViewController.m index b766597..0550c9d 100644 --- a/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/StartPZXZDetailViewController.m +++ b/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/StartPZXZDetailViewController.m @@ -36,10 +36,29 @@ { [self.navigationView setTitle:@"拍照续写" titleColor:RGBCOLOR(60, 60, 60)]; } - + } + if(self.type==10) + { + [self.navigationView setTitle:@"拍照改写" titleColor:RGBCOLOR(60, 60, 60)]; + } + else if(self.type==11) + { + [self.navigationView setTitle:@"拍题写作" titleColor:RGBCOLOR(60, 60, 60)]; + } + else if(self.type==12) + { + [self.navigationView setTitle:@"拍照续写" titleColor:RGBCOLOR(60, 60, 60)]; } [self.navigationView setBackgroundColor:[UIColor whiteColor]]; - [self.navigationView.backButton setHidden:YES]; + [self.navigationView.backButton setHidden:self.isshiyong]; + if(self.isshiyong==NO) + { + [self.navigationView setMuenTitle:@"反馈" titleColor:RGBCOLOR(60, 60, 60)]; + } +} +-(void)navMuenButtonAction +{ + } - (void)viewDidLoad { [super viewDidLoad]; @@ -51,8 +70,13 @@ make.left.right.bottom.equalTo(self.view); make.top.offset(NavHeight); }]; + view.type = self.type; + view.isshiyong = self.isshiyong; view.modelYD = self.modelYD; + view.arrXZImages = self.arrXZImages; + view.strID = self.strID; + } @end diff --git a/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/view/StartPZXZDetailView.h b/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/view/StartPZXZDetailView.h index 9fe355e..fd6c659 100644 --- a/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/view/StartPZXZDetailView.h +++ b/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/view/StartPZXZDetailView.h @@ -10,8 +10,18 @@ NS_ASSUME_NONNULL_BEGIN @interface StartPZXZDetailView : UIView +///是否是引导页 +@property (nonatomic , assign) BOOL isshiyong; /// @property (nonatomic , strong) ExamplePicModelDataItems *modelYD; +///10改写作文 11拍题成文 12 拍照续写 +@property (nonatomic , assign) int type; + +///写作的图片 +@property (nonatomic , strong) NSArray *arrXZImages; +/// +@property (nonatomic , strong) NSString *strID; + @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/view/StartPZXZDetailView.m b/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/view/StartPZXZDetailView.m index b2b785e..4f8d2d1 100644 --- a/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/view/StartPZXZDetailView.m +++ b/ProductApp/ProductApp/ProductMain/引导/拍照写作/文章/view/StartPZXZDetailView.m @@ -10,6 +10,13 @@ #import "StartPZXZPageView.h" #import "StartPayViewController.h" +#import "XieZuoSaveAlterView.h" +#import "SSENetWorkManager.h" +#import "RoleTreeModel.h" +#import "SSEDrawListTextModel.h" + +#import "NetWorkManager.h" + @interface StartPZXZDetailView () /// @property (nonatomic , strong) CMMotionManager *motionManager; @@ -18,6 +25,8 @@ /// @property (nonatomic , strong) UIView *viewback; +@property (nonatomic , strong) UIView *viewbottom; + @property (nonatomic , assign) BOOL isdrawEnd; /// @@ -28,6 +37,26 @@ @property (nonatomic , strong) UILabel *lbname; @property (nonatomic , strong) ViewLable *lbwz; +@property (nonatomic , strong) UIButton *btpigai; + +/// +@property (nonatomic , strong) MASConstraint *scrollBottom; + +/// +@property (nonatomic , strong) NSMutableArray *arrLBWZ; +@property (nonatomic , strong) NSMutableArray *arrBTN; +/// +@property (nonatomic , strong) NSMutableArray *arrdata; +/// +@property (nonatomic , strong) SSEConfigModel *modelConfig; +@property (nonatomic , assign) BOOL isStartDrawText; + +@property (nonatomic , assign) NSInteger iDraw; +/// +@property (nonatomic , strong) UIView *viewDarwLast; + +/// +@property (nonatomic , strong) SSEDrawListTextModel *modelSelect; @end @@ -45,7 +74,7 @@ make.height.equalTo(self).offset(-200); }]; _viweBack = viweBack; - [self tuoluo]; + UIView *viewback = [[UIView alloc] initWithFrame:CGRectMake(0, UISCREEN_HEIGHT*0.2, UISCREEN_WIDTH, UISCREEN_HEIGHT*0.8-TabHeight-20-NavHeight)]; [viewback setBackgroundColor:[UIColor whiteColor]]; @@ -67,6 +96,7 @@ make.left.right.bottom.equalTo(self); make.height.offset(TabHeight+20); }]; + _viewbottom = viewbottom; [self drawBottomView:viewbottom]; } @@ -97,7 +127,57 @@ }]; [btpigai addTarget:self action:@selector(tiyanAction) forControlEvents:UIControlEventTouchUpInside]; [Tools changedView:btpigai colors:MainJBColors startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)]; + _btpigai = btpigai; } +-(void)drawBottomViewXZ:(UIView *)view +{ + for(UIView *viewson in view.subviews) + { + [viewson removeFromSuperview]; + } + UIView *viewline = [[UIView alloc] init]; + [viewline setBackgroundColor:RGBCOLOR(248, 248, 248)]; + [view addSubview:viewline]; + [viewline mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.equalTo(view); + make.height.offset(1); + }]; + + UIButton *btchange = [[UIButton alloc] init]; + [btchange setTitle:@"重写一篇" forState:UIControlStateNormal]; + [btchange setTitleColor:RGBCOLOR(61, 61, 61) forState:UIControlStateNormal]; + [btchange.titleLabel setFont:[UIFont boldSystemFontOfSize:18]]; + [btchange.layer setMasksToBounds:YES]; + [btchange.layer setCornerRadius:10]; + [btchange.layer setBorderWidth:1]; + [btchange.layer setBorderColor:RGBCOLOR(216, 216, 216).CGColor]; + [view addSubview:btchange]; + [btchange mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.offset(20); + make.top.offset(10); + make.height.offset(40); + make.width.offset((UISCREEN_WIDTH-52)/2.0); + }]; + [btchange setTag:0]; + [btchange addTarget:self action:@selector(bottomAction:) forControlEvents:UIControlEventTouchUpInside]; + + UIButton *btcreate = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, (UISCREEN_WIDTH-52)/2.0, 40)]; + [btcreate setTitle:@"保存记录" forState:UIControlStateNormal]; + [btcreate setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [btcreate.titleLabel setFont:[UIFont boldSystemFontOfSize:18]]; + [btcreate.layer setMasksToBounds:YES]; + [btcreate.layer setCornerRadius:10]; + [view addSubview:btcreate]; + [btcreate mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(btchange.mas_right).offset(12); + make.top.height.equalTo(btchange); + make.right.equalTo(view).offset(-30); + }]; + [btcreate setTag:1]; + [btcreate addTarget:self action:@selector(bottomAction:) forControlEvents:UIControlEventTouchUpInside]; + [Tools changedView:btcreate colors:MainJBColors startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)]; +} + -(void)drawInfoView:(UIView *)view { [view setBackgroundColor:[UIColor whiteColor]]; @@ -135,7 +215,7 @@ _scvback = scvback; UILabel *lbname = [[UILabel alloc] init]; - [lbname setText:@"假如我是一颗小星星"]; + [lbname setText:@""]; [lbname setTextColor:RGBCOLOR(51, 51, 51)]; [lbname setTextAlignment:NSTextAlignmentCenter]; [lbname setFont:[UIFont boldSystemFontOfSize:24]]; @@ -172,9 +252,117 @@ }]; _lbwz = lbwz; [scvback mas_makeConstraints:^(MASConstraintMaker *make) { - make.bottom.equalTo(lbwz).offset(20); + self.scrollBottom = make.bottom.equalTo(lbwz).offset(20); }]; } + +-(ViewLable *)drawItemLastView:(UIView *)view tag:(NSInteger)tag +{ + ViewLable *lbwz = [[ViewLable alloc] init]; + [self.scvback addSubview:lbwz]; + [lbwz mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.offset(20); + make.width.equalTo(self.scvback).offset(-40); + if(view) + { + make.top.equalTo(view.mas_bottom).offset(20); + } + else + { + make.top.offset(10); + } + }]; + lbwz.textColor = RGBCOLOR(61, 61, 61); + lbwz.textFont = [UIFont systemFontOfSize:16]; + if(self.scrollBottom) + { + [self.scrollBottom uninstall]; + } + [self.scvback mas_makeConstraints:^(MASConstraintMaker *make) { + self.scrollBottom = make.bottom.equalTo(lbwz.mas_bottom).offset(20); + }]; + [self.arrLBWZ addObject:lbwz]; + + UIButton *btcx = [[UIButton alloc] init]; + [btcx setTitle:@"重写" forState:UIControlStateNormal]; + [btcx setTitleColor:RGBCOLOR(108, 119, 246) forState:UIControlStateNormal]; + [btcx.titleLabel setFont:[UIFont systemFontOfSize:12]]; + [btcx setImage:[UIImage imageNamed:@"xz_chongxie"] forState:UIControlStateNormal]; + [self.scvback addSubview:btcx]; + [btcx mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.sizeOffset(CGSizeMake(54, 22)); + make.left.offset(20); + if(view) + { + make.top.equalTo(view.mas_bottom).offset(17); + } + else + { + make.top.offset(7); + } + }]; + [btcx setIconInLeft]; + [btcx setBackgroundColor:RGBCOLOR(226, 228, 253)]; + [btcx addTarget:self action:@selector(cxAction:) forControlEvents:UIControlEventTouchUpInside]; + [btcx setTag:tag]; + [btcx.layer setMasksToBounds:YES]; + [btcx.layer setCornerRadius:11]; + [self.arrBTN addObject:btcx]; + return lbwz; +} + + +-(void)setIsshiyong:(BOOL)isshiyong +{ + _isshiyong = isshiyong; + self.viweBack.isshiyong = self.isshiyong; + if(self.isshiyong) + { + [self tuoluo]; + } + else + { + [self.btpigai setTitle:@"复制全文" forState:UIControlStateNormal]; + } +} +-(void)setModelYD:(ExamplePicModelDataItems *)modelYD +{ + _modelYD = modelYD; + + self.viweBack.model = self.modelYD; + + if(modelYD) + { + NSString *strcontet = self.modelYD.result.content; + strcontet = [NSString stringWithFormat:@" %@",strcontet]; + strcontet = [strcontet stringByReplacingOccurrencesOfString:@"\n" withString:@"\n "]; + + self.lbwz.fspeed = 0.02; + self.lbwz.strValue = strcontet; + self.lbwz.isWriteEnd = YES; + } +} +-(void)setType:(int)type +{ + _type = type; + if(type>=10&&type<=12) + { + [self drawBottomViewXZ:self.viewbottom]; + } +} +-(void)setArrXZImages:(NSArray *)arrXZImages +{ + _arrXZImages = arrXZImages; + [self.lbwz setHidden:YES]; + self.viweBack.arrXZImages = self.arrXZImages; +} +-(void)setStrID:(NSString *)strID +{ + _strID = strID; + + [self getdata]; +} + - (void)panGestureAction:(UIPanGestureRecognizer *)pan { if(pan.state == UIGestureRecognizerStateChanged) @@ -196,6 +384,85 @@ [pan setTranslation:CGPointZero inView:self]; } } +-(void)cxAction:(UIButton *)sender +{ + if(self.isdrawEnd==NO) + { + [HXHud showMessage:@"请等待写作完成" afterDelayType:0]; + return; + } + self.isdrawEnd = NO; + SSEDrawListTextModel *model = self.arrdata[sender.tag]; + model.isaddEnd = NO; + self.modelSelect = model; + + [self getDuanLuo:model.value]; +} +-(void)bottomAction:(UIButton *)sender +{ + if(self.isdrawEnd==NO) + { + [HXHud showMessage:@"请等待写作完成" afterDelayType:0]; + return; + } + switch (sender.tag) { + case 0: + { + [self getdata]; + } + break; + case 1: + { + [LoadAlterView show]; + + NSString *strscene = @""; + ///10改写作文 11拍题成文 12 拍照续写 + if(self.type == 10) + { + strscene = @"pic_rewrite"; + } + else if(self.type == 11) + { + strscene = @"pic_question"; + } + else if(self.type == 12) + { + strscene = @"pic_with_front"; + } + + NSMutableArray *arrcontent = [NSMutableArray new]; + for(SSEDrawListTextModel *model in self.arrdata) + { + if(model.value.length>0) + { + [arrcontent addObject:model.value]; + } + } + + [NetWorkManager requestPicAiSaveData:self ID:self.strID scene:strscene content:[arrcontent componentsJoinedByString:@"\n"] Callback:^(BOOL state, BaseModel *responseObject, NSString * _Nullable describle) { + [LoadAlterView dismiss]; + if(state) + { + XieZuoSaveAlterView *view = [[XieZuoSaveAlterView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)]; + [self.viewController.view addSubview:view]; + [view setBackValue:^{ + UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; + pasteboard.string = [arrcontent componentsJoinedByString:@"\n"]; + [HXHud showMessage:@"复制成功" afterDelayType:0]; + }]; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; + } + break; + default: + break; + } +} +//// -(void)tiyanAction { if(self.isdrawEnd==NO) @@ -204,10 +471,17 @@ return; } [self stopMotion]; - - StartPayViewController *vc = [StartPayViewController new]; - [self.viewController.navigationController pushViewController:vc animated:YES]; - + if(self.isshiyong) + { + StartPayViewController *vc = [StartPayViewController new]; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + else + {///复制 + UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; + pasteboard.string = self.lbwz.strValue; + [HXHud showMessage:@"复制成功" afterDelayType:0]; + } } -(void)tuoluo { @@ -235,8 +509,11 @@ } -(void)stopMotion { - [self.motionManager stopAccelerometerUpdates]; - self.motionManager = nil; + if(self.motionManager) + { + [self.motionManager stopAccelerometerUpdates]; + self.motionManager = nil; + } } #pragma mark - UIScrollView - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView @@ -248,23 +525,221 @@ self.isDragging = NO; } --(void)setModelYD:(ExamplePicModelDataItems *)modelYD +-(void)nomoData { - _modelYD = modelYD; + for(UIView *view in self.arrLBWZ) + { + [view removeFromSuperview]; + } + for(UIButton *btin in self.arrBTN) + { + [btin removeFromSuperview]; + } + self.arrLBWZ = [NSMutableArray new]; + self.arrBTN = [NSMutableArray new]; + self.arrdata = [NSMutableArray new]; + for(int i = 0 ; i < 200;i++) + { + SSEDrawListTextModel *model = [SSEDrawListTextModel new]; + [self.arrdata addObject:model]; + } - self.viweBack.model = self.modelYD; + self.isStartDrawText = NO; + self.isdrawEnd = NO; + self.iDraw = 0; + self.viewDarwLast = nil; +} +///段落重写 rewrite {content,type} +-(void)getDuanLuo:(NSString *)content +{ + self.modelSelect.lbwz.isWriteEnd = NO; + [self.modelSelect.lbwz setBackHeight:^(float fheight, BOOL isend) { + + }]; + NSString *strscene = @""; + ///10改写作文 11拍题成文 12 拍照续写 + if(self.type == 10) + { + strscene = @"pic_rewrite"; + } + else if(self.type == 10) + { + strscene = @"pic_question"; + } + else if(self.type == 10) + { + strscene = @"pic_with_front"; + } - NSString *strcontet = self.modelYD.result.content; - strcontet = [NSString stringWithFormat:@" %@",strcontet]; - strcontet = [strcontet stringByReplacingOccurrencesOfString:@"\n" withString:@"\n "]; + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:[Tools isStringnil:strscene] forKey:@"type"]; + [dicpush setObject:[Tools isStringnil:content] forKey:@"content"]; - self.lbwz.fspeed = 0.02; - self.lbwz.strValue = strcontet; + [[SSENetWorkManager shareManager] requestTo:[NSString stringWithFormat:@"https://aiw.batiao8.com/api/chat?scene=rewrite"] dicpush:dicpush config:^(SSEConfigModel * _Nonnull config) { + } backValue:^(NSString * _Nonnull value, BOOL isfinish) { + NSLog(@"%@",value); + if(value.length>4) + { + self.modelSelect.value = value; + self.modelSelect.lbwz.strValue = [NSString stringWithFormat:@" %@",self.modelSelect.value]; + } + else + { + if(isfinish) + { + self.modelSelect.isaddEnd = YES; + self.isdrawEnd = YES; + self.modelSelect.lbwz.isWriteEnd = YES; + } + } + } error:^(NSString * _Nonnull errorString) { + [HXHud showMessage:errorString afterDelayType:0]; + } ID:^(NSString * _Nonnull value) { + + }]; +} + +///全文 +-(void)getdata +{ + [LoadAlterView show]; + [self nomoData]; + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:[NSString stringWithFormat:@"%@",self.strID] forKey:@"id"]; - self.lbwz.isWriteEnd = YES; + NSString *strscene = @""; + ///10改写作文 11拍题成文 12 拍照续写 + if(self.type == 10) + { + strscene = @"pic_rewrite"; + } + else if(self.type == 11) + { + strscene = @"pic_question"; + } + else if(self.type == 12) + { + strscene = @"pic_with_front"; + } + + [[SSENetWorkManager shareManager] requestTo:[NSString stringWithFormat:@"https://aiw.batiao8.com/api/pic/completions?scene=%@",strscene] dicpush:dicpush config:^(SSEConfigModel * _Nonnull config) { + [LoadAlterView dismiss]; + self.modelConfig = config; + } backValue:^(NSString * _Nonnull value, BOOL isfinish) { + if(value.length>10) + { + [self chuliShuJu:value isfinish:NO]; + } + else + { + if(isfinish) + { + [self chuliShuJu:value isfinish:YES]; + } + } + } error:^(NSString * _Nonnull errorString) { + [LoadAlterView dismiss]; + [HXHud showMessage:errorString afterDelayType:0]; + } ID:^(NSString * _Nonnull value) { + + }]; +} + +-(void)chuliShuJu:(NSString *)value isfinish:(BOOL)isfinish +{ + if(isfinish) + { + for(SSEDrawListTextModel *model in self.arrdata) + { + model.isaddEnd = YES; + } + } + else + { + NSString *strshow = [value stringByReplacingOccurrencesOfString:@"* " withString:@"|&&|"]; + strshow = [strshow stringByReplacingOccurrencesOfString:@"*" withString:@"|&&|"]; + NSArray *arrlist = [strshow componentsSeparatedByString:@"|&&|"]; + SSEDrawListTextModel *modellast; + for(int i = 0 ; i < arrlist.count;i++) + { + NSString *str = arrlist[i]; + if(str.length<2) + { + continue;; + } + if(modellast) + { + modellast.isaddEnd = YES; + } + SSEDrawListTextModel *model = self.arrdata[i]; + str = [str stringByReplacingOccurrencesOfString:@"\n" withString:@""]; + model.value = str; + modellast = model; + } + } + dispatch_async(dispatch_get_main_queue(), ^{ + if(self.isStartDrawText==NO) + { + self.isStartDrawText = YES; + [self drawTextInfo]; + } + }); +} +-(void)drawTextInfo +{ + if(self.iDraw>=self.arrdata.count) + { + self.isdrawEnd = YES; + return; + } + + SSEDrawListTextModel *model = self.arrdata[self.iDraw]; + if(model.value.length==0) + { + self.iDraw++; + [self drawTextInfo]; + return; + } + ViewLable *lbwz; + if(model.lbwz==nil) + { + lbwz = [self drawItemLastView:self.viewDarwLast tag:self.iDraw]; + if(self.modelConfig.time.intValue>0) + { + lbwz.fspeed = self.modelConfig.time.intValue/1000.0; + } + [lbwz setBackHeight:^(float fheight, BOOL isend) { + if(isend) + { + self.iDraw+=1; + } + if(fheight==-1||isend) + { + [self drawTextInfo]; + } + if(self.isDragging==NO) + { + if(self.scvback.contentSize.height-self.scvback.height>0) + { + [self.scvback setContentOffset:CGPointMake(0, self.scvback.contentSize.height-self.scvback.height) animated:NO]; + } + } + }]; + self.viewDarwLast = lbwz; + model.lbwz = lbwz; + } + else + { + lbwz = model.lbwz; + } + lbwz.isWriteEnd = model.isaddEnd; + + lbwz.strValue = [NSString stringWithFormat:@" %@",model.value]; } + + @end diff --git a/ProductApp/ProductApp/ProductMain/引导/课堂写作/批改信息/view/综合评价/StartKTXZPGDetailZHView.h b/ProductApp/ProductApp/ProductMain/引导/课堂写作/批改信息/view/综合评价/StartKTXZPGDetailZHView.h index 00557ce..0e75e00 100644 --- a/ProductApp/ProductApp/ProductMain/引导/课堂写作/批改信息/view/综合评价/StartKTXZPGDetailZHView.h +++ b/ProductApp/ProductApp/ProductMain/引导/课堂写作/批改信息/view/综合评价/StartKTXZPGDetailZHView.h @@ -7,6 +7,7 @@ #import #import "TextbookInfoModel.h" +#import "WriteCorrectScoreModel.h" NS_ASSUME_NONNULL_BEGIN @interface StartKTXZPGDetailZHView : UIView @@ -14,6 +15,10 @@ NS_ASSUME_NONNULL_BEGIN /// @property (nonatomic , strong) TextbookInfoModelDataResult *modelResult; +/// +@property (nonatomic , strong) NSString *strID; +///评分 +@property (nonatomic , strong) WriteCorrectScoreModelData *modelPF; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/课堂写作/批改信息/view/综合评价/StartKTXZPGDetailZHView.m b/ProductApp/ProductApp/ProductMain/引导/课堂写作/批改信息/view/综合评价/StartKTXZPGDetailZHView.m index 5203e0d..ef34647 100644 --- a/ProductApp/ProductApp/ProductMain/引导/课堂写作/批改信息/view/综合评价/StartKTXZPGDetailZHView.m +++ b/ProductApp/ProductApp/ProductMain/引导/课堂写作/批改信息/view/综合评价/StartKTXZPGDetailZHView.m @@ -6,7 +6,7 @@ // #import "StartKTXZPGDetailZHView.h" - +#import "RoleTreeModel.h" @interface StartKTXZPGDetailZHView () /// @@ -202,6 +202,10 @@ UILabel *lbbzName = [[UILabel alloc] init]; [lbbzName setText:[Tools isStringnilkong:self.modelResult.complex_review.full_review.style]]; + if(self.modelPF) + { + [lbbzName setText:[UserInfoModel shareModel].user_stage.parent_name]; + } [lbbzName setTextColor:RGBCOLOR(61, 61, 61)]; [lbbzName setTextAlignment:NSTextAlignmentLeft]; [lbbzName setFont:[UIFont systemFontOfSize:12]]; @@ -226,14 +230,28 @@ NSInteger iline = self.modelResult.complex_review.score.count/2.0; if(self.modelResult.complex_review.score.count%2!=0)iline+=1; - + if(self.modelPF) + { + iline = self.modelPF.complex_review.score.count/2.0; + if(self.modelPF.complex_review.score.count%2!=0)iline+=1; + } UIView *viewlast = nil; for(int i = 0; i < iline; i++) { for(int j = 0 ; j < 2; j++) { - if(i*2+j>=self.modelResult.complex_review.score.count)break; - TextbookInfoModelDataResultComplexScore *model = self.modelResult.complex_review.score[i*2+j]; + TextbookInfoModelDataResultComplexScore *model; + if(self.modelResult) + { + if(i*2+j>=self.modelResult.complex_review.score.count)break; + model = self.modelResult.complex_review.score[i*2+j]; + } + if(self.modelPF) + { + if(i*2+j>=self.modelPF.complex_review.score.count)break; + model = self.modelPF.complex_review.score[i*2+j]; + } + UILabel *lbname = [[UILabel alloc] init]; [lbname setText:[Tools isStringnilkong:model.name]]; [lbname setTextColor:RGBCOLOR(61, 61, 61)]; @@ -312,7 +330,13 @@ [self drawTopView:self.viewtop]; [self drawContentView:self.viewcontent]; } - +-(void)setModelPF:(WriteCorrectScoreModelData *)modelPF +{ + _modelPF = modelPF; + if(modelPF==nil)return; + [self drawTopView:self.viewtop]; +// [self drawContentView:self.viewcontent]; +} #pragma mark - UIScrollView - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView diff --git a/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeXieZuoTableViewCell.m b/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeXieZuoTableViewCell.m index f061cfb..71fa339 100644 --- a/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeXieZuoTableViewCell.m +++ b/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeXieZuoTableViewCell.m @@ -146,7 +146,9 @@ switch (sender.tag) { case 0: { - + CamreViewController *vc = [CamreViewController new]; + vc.type = 2; + [self.viewController.navigationController pushViewController:vc animated:YES]; } break; case 1: diff --git a/ProductApp/ProductApp/ProductMain/首页/智能写作/全文写作/写作详情/view/XieZuoXiangQingView.m b/ProductApp/ProductApp/ProductMain/首页/智能写作/全文写作/写作详情/view/XieZuoXiangQingView.m index eb5f2be..1bc0836 100644 --- a/ProductApp/ProductApp/ProductMain/首页/智能写作/全文写作/写作详情/view/XieZuoXiangQingView.m +++ b/ProductApp/ProductApp/ProductMain/首页/智能写作/全文写作/写作详情/view/XieZuoXiangQingView.m @@ -40,8 +40,6 @@ @property (nonatomic , strong) SSEConfigModel *modelConfig; @property (nonatomic , assign) BOOL isStartDrawText; /// -@property (nonatomic , strong) NSTimer *timerDraw; -/// @property (nonatomic , strong) MASConstraint *bottomScroll; @property (nonatomic , assign) NSInteger iDraw; /// @@ -243,9 +241,6 @@ SSEDrawListTextModel *model = self.arrdata[sender.tag]; model.isaddEnd = NO; self.modelSelect = model; -// model.value = @""; -// ViewLable *lbwz = model.lbwz; -// lbwz.strValue = @""; [self getDuanLuo:model.value]; @@ -439,6 +434,7 @@ } } } error:^(NSString * _Nonnull errorString) { + [LoadAlterView dismiss]; [HXHud showMessage:errorString afterDelayType:0]; } ID:^(NSString * _Nonnull value) { @@ -481,8 +477,6 @@ if(self.isStartDrawText==NO) { self.isStartDrawText = YES; - self.timerDraw = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(drawTextInfo) userInfo:nil repeats:YES]; - [[NSRunLoop mainRunLoop] addTimer:self.timerDraw forMode:NSRunLoopCommonModes]; [self drawTextInfo]; } }); @@ -491,8 +485,6 @@ { if(self.iDraw>=self.arrdata.count) { - [self.timerDraw invalidate]; - self.timerDraw = nil; self.isdrawEnd = YES; return; } @@ -517,6 +509,10 @@ { self.iDraw+=1; } + if(fheight==-1||isend) + { + [self drawTextInfo]; + } if(self.isDragging==NO) { if(self.scvback.contentSize.height-self.scvback.height>0) diff --git a/ProductApp/ProductApp/ProductMain/首页/智能写作/全文写作/创作思路/view/ChuangZuoSiLuView.m b/ProductApp/ProductApp/ProductMain/首页/智能写作/全文写作/创作思路/view/ChuangZuoSiLuView.m index ab43b85..5d29d93 100644 --- a/ProductApp/ProductApp/ProductMain/首页/智能写作/全文写作/创作思路/view/ChuangZuoSiLuView.m +++ b/ProductApp/ProductApp/ProductMain/首页/智能写作/全文写作/创作思路/view/ChuangZuoSiLuView.m @@ -31,8 +31,6 @@ typedef void(^ChuangZuoSiLuViewDraw)(void); /// @property (nonatomic , strong) SSEConfigModel *modelConfig; @property (nonatomic , assign) BOOL isStartDrawText; -/// -@property (nonatomic , strong) NSTimer *timerDraw; @end @@ -270,6 +268,7 @@ typedef void(^ChuangZuoSiLuViewDraw)(void); } } } error:^(NSString * _Nonnull errorString) { + [LoadAlterView dismiss]; [HXHud showMessage:errorString afterDelayType:0]; } ID:^(NSString * _Nonnull value) { @@ -352,8 +351,6 @@ typedef void(^ChuangZuoSiLuViewDraw)(void); if(self.isStartDrawText==NO) { self.isStartDrawText = YES; - self.timerDraw = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(drawTextInfo) userInfo:nil repeats:YES]; - [[NSRunLoop mainRunLoop] addTimer:self.timerDraw forMode:NSRunLoopCommonModes]; [self drawTextInfo]; } }); @@ -363,8 +360,6 @@ typedef void(^ChuangZuoSiLuViewDraw)(void); { if(self.iDraw>=self.arrDraw.count) { - [self.timerDraw invalidate]; - self.timerDraw = nil; self.isdrawEnd = YES; return; } @@ -398,6 +393,10 @@ typedef void(^ChuangZuoSiLuViewDraw)(void); self.iDraw+=1; } } + if(fheight==-1||isend) + { + [self drawTextInfo]; + } if(self.isDragging==NO) { if(self.scvback.contentSize.height-self.scvback.height>0) diff --git a/ProductApp/ProductApp/ProductMain/首页/智能写作/全文写作/换个思路/view/HuanGeSiLuView.m b/ProductApp/ProductApp/ProductMain/首页/智能写作/全文写作/换个思路/view/HuanGeSiLuView.m index 5141db1..e0dd2a7 100644 --- a/ProductApp/ProductApp/ProductMain/首页/智能写作/全文写作/换个思路/view/HuanGeSiLuView.m +++ b/ProductApp/ProductApp/ProductMain/首页/智能写作/全文写作/换个思路/view/HuanGeSiLuView.m @@ -297,6 +297,7 @@ } } } error:^(NSString * _Nonnull errorString) { + [LoadAlterView dismiss]; [HXHud showMessage:errorString afterDelayType:0]; } ID:^(NSString * _Nonnull value) { diff --git a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/view/DuanLuoXieZuoCellView.h b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/view/DuanLuoXieZuoCellView.h index 92ba248..369fdd4 100644 --- a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/view/DuanLuoXieZuoCellView.h +++ b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/view/DuanLuoXieZuoCellView.h @@ -8,7 +8,7 @@ #import NS_ASSUME_NONNULL_BEGIN -typedef void(^DuanLuoXieZuoCellViewBack)(BOOL isend); +typedef void(^DuanLuoXieZuoCellViewBack)(float height, BOOL isend); @interface DuanLuoXieZuoCellView : UIView /// @property (nonatomic , strong) NSString *strname; @@ -22,6 +22,9 @@ typedef void(^DuanLuoXieZuoCellViewBack)(BOOL isend); ///0 1 2 @property (nonatomic , strong) NSString *paragraph_type; +/// +@property (nonatomic , strong) NSDictionary *dicpush; + /// @property (nonatomic , strong) DuanLuoXieZuoCellViewBack backValue; diff --git a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/view/DuanLuoXieZuoCellView.m b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/view/DuanLuoXieZuoCellView.m index 1fb4934..97f155b 100644 --- a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/view/DuanLuoXieZuoCellView.m +++ b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/view/DuanLuoXieZuoCellView.m @@ -71,7 +71,7 @@ lbwz.textFont = [UIFont systemFontOfSize:14]; _lbwz = lbwz; [lbwz setBackHeight:^(float fheight, BOOL isend) { - self.backValue(isend); + self.backValue(fheight,isend); }]; UILabel *lbnumber = [[UILabel alloc] init]; @@ -130,6 +130,7 @@ } -(void)setIsWriteEnd:(BOOL)isWriteEnd { + _isWriteEnd = isWriteEnd; self.lbwz.isWriteEnd = isWriteEnd; } -(void)setFspeed:(float)fspeed @@ -158,9 +159,18 @@ -(void)nextAction { + if(self.isWriteEnd==NO) + { + [HXHud showMessage:@"请等待写作完成" afterDelayType:0]; + return; + } if(self.paragraph_type.intValue==0) {///开头段落续写 + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setDictionary:self.dicpush]; + [dicpush setObject:self.strvalue forKey:@"paragraph"]; DuanLuoXieZuoQWViewController *vc = [DuanLuoXieZuoQWViewController new]; + vc.dicpush = dicpush; [self.viewController.navigationController pushViewController:vc animated:YES]; } } diff --git a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/view/DuanLuoXieZuoView.m b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/view/DuanLuoXieZuoView.m index 36830bf..c9cd93f 100644 --- a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/view/DuanLuoXieZuoView.m +++ b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/view/DuanLuoXieZuoView.m @@ -23,10 +23,11 @@ /// @property (nonatomic , strong) NSMutableArray *arrdata; +/// +@property (nonatomic , strong) NSMutableArray *arrCreateData; + @property (nonatomic , assign) BOOL isStartDrawText; @property (nonatomic , assign) BOOL isdrawEnd; -/// -@property (nonatomic , strong) NSTimer *timerDraw; @property (nonatomic , assign) int iDraw; /// @@ -36,6 +37,10 @@ /// @property (nonatomic , strong) MASConstraint *scrollBottom; + +/// +@property (nonatomic , strong) NSDictionary *dicpush; + @end @implementation DuanLuoXieZuoView @@ -94,11 +99,6 @@ }]; viewitem.technique = self.technique; viewitem.paragraph_type = self.paragraph_type; -// viewitem.strname = @"结果一"; -// viewitem.strvalue = @"阳光透过茂密的树叶,洒在我的帐篷上。我睁开眼睛,闻到了清新的泥土味和远处溪水的声音。这是我第一次露营,心情无比激动。"; -// [viewitem setBackValue:^(BOOL isend) { -// -// }]; if(self.scrollBottom) { [self.scrollBottom uninstall]; @@ -120,12 +120,14 @@ } -(void)addValues { + self.arrCreateData = [NSMutableArray new]; for(int i = 0 ; i < 3; i++) { SSEDrawListTextModel *model = [SSEDrawListTextModel new]; - model.title = [NSString stringWithFormat:@"结果%@",[Tools convertNumberToUppercase:self.arrdata.count+1]]; - [self.arrdata addObject:model]; + model.title = [NSString stringWithFormat:@"结果%@",[Tools convertNumberToUppercase:self.arrCreateData.count + self.arrdata.count+1]]; + [self.arrCreateData addObject:model]; } + [self.arrdata addObjectsFromArray:self.arrCreateData]; } @@ -157,6 +159,7 @@ [dicpush setObject:[Tools isStringnil:self.require] forKey:@"require"]; [dicpush setObject:[NSNumber numberWithInt:self.paragraph_type.intValue] forKey:@"paragraph_type"]; [dicpush setObject:[Tools isStringnil:self.technique] forKey:@"technique"]; + self.dicpush = dicpush; [[SSENetWorkManager shareManager] requestTo:[NSString stringWithFormat:@"https://aiw.batiao8.com/api/chat?scene=%@",scenct] dicpush:dicpush config:^(SSEConfigModel * _Nonnull config) { [LoadAlterView dismiss]; @@ -174,6 +177,7 @@ } } } error:^(NSString * _Nonnull errorString) { + [LoadAlterView dismiss]; [HXHud showMessage:errorString afterDelayType:0]; } ID:^(NSString * _Nonnull value) { @@ -183,7 +187,7 @@ { if(isfinish) { - for(SSEDrawListTextModel *model in self.arrdata) + for(SSEDrawListTextModel *model in self.arrCreateData) { model.isaddEnd = YES; } @@ -209,7 +213,7 @@ { modellast.isaddEnd = YES; } - SSEDrawListTextModel *model = self.arrdata[i]; + SSEDrawListTextModel *model = self.arrCreateData[i]; str = [str stringByReplacingOccurrencesOfString:@"\n" withString:@""]; model.value = str; modellast = model; @@ -219,8 +223,6 @@ if(self.isStartDrawText==NO) { self.isStartDrawText = YES; - self.timerDraw = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(drawTextInfo) userInfo:nil repeats:YES]; - [[NSRunLoop mainRunLoop] addTimer:self.timerDraw forMode:NSRunLoopCommonModes]; [self drawTextInfo]; } }); @@ -230,8 +232,6 @@ { if(self.iDraw>=self.arrdata.count) { - [self.timerDraw invalidate]; - self.timerDraw = nil; self.isdrawEnd = YES; return; } @@ -251,11 +251,17 @@ { lbwz.fspeed = self.modelConfig.time.intValue/1000.0; } - [lbwz setBackValue:^(BOOL isend) { + lbwz.dicpush = self.dicpush; + lbwz.strname = model.title; + [lbwz setBackValue:^(float height, BOOL isend) { if(isend) { self.iDraw+=1; } + if(height==-1 || isend) + { + [self drawTextInfo]; + } if(self.isDragging==NO) { if(self.scvback.contentSize.height-self.scvback.height>0) @@ -272,10 +278,7 @@ lbwz = model.view; } lbwz.strvalue = model.value; - lbwz.strname = model.title; lbwz.isWriteEnd = model.isaddEnd; - -// NSLog(@"%@",model.value); } diff --git a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/DuanLuoXieZuoQWViewController.h b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/DuanLuoXieZuoQWViewController.h index 8bfdb7c..ca2bdea 100644 --- a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/DuanLuoXieZuoQWViewController.h +++ b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/DuanLuoXieZuoQWViewController.h @@ -10,7 +10,8 @@ NS_ASSUME_NONNULL_BEGIN @interface DuanLuoXieZuoQWViewController : BaseViewController - +/// +@property (nonatomic , strong) NSDictionary *dicpush; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/DuanLuoXieZuoQWViewController.m b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/DuanLuoXieZuoQWViewController.m index 01ac672..a3520b0 100644 --- a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/DuanLuoXieZuoQWViewController.m +++ b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/DuanLuoXieZuoQWViewController.m @@ -34,7 +34,7 @@ make.left.right.bottom.equalTo(self.view); make.top.offset(NavHeight); }]; - + view.dicpush = self.dicpush; } diff --git a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/view/DuanLuoXieZuoQWView.h b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/view/DuanLuoXieZuoQWView.h index 8a0b92f..2ee35f2 100644 --- a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/view/DuanLuoXieZuoQWView.h +++ b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/view/DuanLuoXieZuoQWView.h @@ -10,7 +10,8 @@ NS_ASSUME_NONNULL_BEGIN @interface DuanLuoXieZuoQWView : UIView - +/// +@property (nonatomic , strong) NSDictionary *dicpush; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/view/DuanLuoXieZuoQWView.m b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/view/DuanLuoXieZuoQWView.m index fa710c4..9a96d21 100644 --- a/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/view/DuanLuoXieZuoQWView.m +++ b/ProductApp/ProductApp/ProductMain/首页/智能写作/段落/续写润色/view/DuanLuoXieZuoQWView.m @@ -9,7 +9,16 @@ #import "ChongXieYiPianViewController.h" #import "FenXiangWenZhangAlterView.h" -@interface DuanLuoXieZuoQWView () + +#import "XieZuoSaveAlterView.h" +#import "SSENetWorkManager.h" +#import "RoleTreeModel.h" +#import "SSEDrawListTextModel.h" + +#import "NetWorkManager.h" + + +@interface DuanLuoXieZuoQWView () /// @property (nonatomic , strong) UIScrollView *scvback; /// @@ -17,12 +26,29 @@ /// @property (nonatomic , strong) UILabel *lbyaoqiu; + + +@property (nonatomic , assign) BOOL isDragging; /// -@property (nonatomic , strong) NSArray *arrdata; +@property (nonatomic , strong) NSMutableArray *arrLBWZ; +@property (nonatomic , strong) NSMutableArray *arrBTN; /// -@property (nonatomic , strong) NSMutableArray *arrItems; -@property (nonatomic , strong) NSMutableArray *arrBts; +@property (nonatomic , strong) NSMutableArray *arrdata; + @property (nonatomic , assign) BOOL isdrawEnd; + +/// +@property (nonatomic , strong) SSEConfigModel *modelConfig; +@property (nonatomic , assign) BOOL isStartDrawText; +/// +@property (nonatomic , strong) MASConstraint *bottomScroll; +@property (nonatomic , assign) NSInteger iDraw; +/// +@property (nonatomic , strong) UIView *viewDarwLast; + +/// +@property (nonatomic , strong) SSEDrawListTextModel *modelSelect; + @end @implementation DuanLuoXieZuoQWView @@ -32,6 +58,7 @@ if(self = [super initWithFrame:frame]) { UIScrollView *scvback = [[UIScrollView alloc] init]; + [scvback setDelegate:self]; [self addSubview:scvback]; [scvback mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.offset(0); @@ -68,7 +95,7 @@ _lbname = lbname; UILabel *lbyaoqiu = [[UILabel alloc] init]; - [lbyaoqiu setText:@"在柔和的阳光中,我怀抱着一颗跳动的心,翘首以盼着那即将到来的露营之旅。那是一个普通而又特别的日子,我的心中充满了对未知世界的好奇和期待。每当夜晚来临,我总会凝视着窗外繁星点点的夜空,梦想着有一天能够亲手点燃篝火,与好友们一起分享这片刻的温馨与快乐。"]; + [lbyaoqiu setText:@"-"]; [lbyaoqiu setTextColor:RGBCOLOR(109, 109, 109)]; [lbyaoqiu setTextAlignment:NSTextAlignmentLeft]; [lbyaoqiu setNumberOfLines:0]; @@ -80,67 +107,9 @@ }]; _lbyaoqiu = lbyaoqiu; - self.arrBts = [NSMutableArray new]; - self.arrItems = [NSMutableArray new]; - self.arrdata = @[@"",@"",@"",@""]; - [self drawItemLastView:lbyaoqiu tag:0 bottom:nil]; -} --(void)drawItemLastView:(UIView *)view tag:(int)tag bottom:(MASConstraint *)bottom -{ - ViewLable *lbwz = [[ViewLable alloc] init]; - [self.scvback addSubview:lbwz]; - [lbwz mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.offset(20); - make.width.equalTo(self.scvback).offset(-40); - make.top.equalTo(view.mas_bottom).offset(20); - }]; - lbwz.textColor = RGBCOLOR(61, 61, 61); - lbwz.textFont = [UIFont systemFontOfSize:16]; - lbwz.fspeed = 0.02; - lbwz.strValue = [NSString stringWithFormat:@" %@",@"你的作文非常出色,但是可以在语言表达上更加生动有趣,增加一些形象的比喻和细节描写,让读者更加深入地了解你的思考和感受。同时,可以适当增加一些个人的经历和感受,让作文更加具有个性化和独特性。"]; - lbwz.isWriteEnd = YES; - __strong ViewLable *lbwzSelf = lbwz; - __block MASConstraint *bottomScroll; - [lbwz setBackHeight:^(float fheight, BOOL isend) { - if(isend) - { - if(tag0) - { - [self.scvback setContentOffset:CGPointMake(0, self.scvback.contentSize.height-self.scvback.height)]; - } - }]; - [self.arrItems addObject:lbwz]; - if(bottom) - { - [bottom uninstall]; - } - [self.scvback mas_makeConstraints:^(MASConstraintMaker *make) { - bottomScroll = make.bottom.equalTo(lbwz.mas_bottom).offset(20); - }]; - UIButton *btcx = [[UIButton alloc] init]; - [btcx setImage:[UIImage imageNamed:@"znxz_chongxie"] forState:UIControlStateNormal]; - [self.scvback addSubview:btcx]; - [btcx mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.sizeOffset(CGSizeMake(24, 24)); - make.left.offset(23); - make.top.equalTo(view.mas_bottom).offset(17); - }]; - [btcx addTarget:self action:@selector(cxAction:) forControlEvents:UIControlEventTouchUpInside]; - [btcx setTag:tag]; - [self.arrBts addObject:btcx]; } - -(void)drawBottomView:(UIView *)view { UIView *viewline = [[UIView alloc] init]; @@ -170,7 +139,7 @@ [btchange addTarget:self action:@selector(bottomAction:) forControlEvents:UIControlEventTouchUpInside]; UIButton *btcreate = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, (UISCREEN_WIDTH-52)/2.0, 40)]; - [btcreate setTitle:@"保存分享" forState:UIControlStateNormal]; + [btcreate setTitle:@"保存记录" forState:UIControlStateNormal]; [btcreate setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [btcreate.titleLabel setFont:[UIFont boldSystemFontOfSize:18]]; [btcreate.layer setMasksToBounds:YES]; @@ -185,6 +154,58 @@ [btcreate addTarget:self action:@selector(bottomAction:) forControlEvents:UIControlEventTouchUpInside]; [Tools changedView:btcreate colors:MainJBColors startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)]; } +-(ViewLable *)drawItemLastView:(UIView *)view tag:(NSInteger)tag +{ + ViewLable *lbwz = [[ViewLable alloc] init]; + [self.scvback addSubview:lbwz]; + [lbwz mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.offset(20); + make.width.equalTo(self.scvback).offset(-40); + make.top.equalTo(view.mas_bottom).offset(20); + }]; + lbwz.textColor = RGBCOLOR(61, 61, 61); + lbwz.textFont = [UIFont systemFontOfSize:16]; + if(self.bottomScroll) + { + [self.bottomScroll uninstall]; + } + [self.scvback mas_makeConstraints:^(MASConstraintMaker *make) { + self.bottomScroll = make.bottom.equalTo(lbwz.mas_bottom).offset(20); + }]; + [self.arrLBWZ addObject:lbwz]; + + UIButton *btcx = [[UIButton alloc] init]; + [btcx setTitle:@"重写" forState:UIControlStateNormal]; + [btcx setTitleColor:RGBCOLOR(108, 119, 246) forState:UIControlStateNormal]; + [btcx.titleLabel setFont:[UIFont systemFontOfSize:12]]; + [btcx setImage:[UIImage imageNamed:@"xz_chongxie"] forState:UIControlStateNormal]; + [self.scvback addSubview:btcx]; + [btcx mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.sizeOffset(CGSizeMake(54, 22)); + make.left.offset(20); + make.top.equalTo(view.mas_bottom).offset(17); + }]; + [btcx setIconInLeft]; + [btcx setBackgroundColor:RGBCOLOR(226, 228, 253)]; + [btcx addTarget:self action:@selector(cxAction:) forControlEvents:UIControlEventTouchUpInside]; + [btcx setTag:tag]; + [btcx.layer setMasksToBounds:YES]; + [btcx.layer setCornerRadius:11]; + [self.arrBTN addObject:btcx]; + return lbwz; +} + + +-(void)setDicpush:(NSDictionary *)dicpush +{ + _dicpush = dicpush; + + self.lbname.text = [Tools isStringnilkong:[dicpush objectForKey:@"title"]]; + self.lbyaoqiu.text = [Tools isStringnilkong:[dicpush objectForKey:@"paragraph"]]; + + [self getdata]; +} + -(void)cxAction:(UIButton *)sender { if(self.isdrawEnd==NO) @@ -193,15 +214,11 @@ return; } self.isdrawEnd = NO; - ViewLable *lbwz = self.arrItems[sender.tag]; - lbwz.strValue = [NSString stringWithFormat:@" %@",@"2341234123你的作文非常出色,但是可以在语言表达上更加生动有趣,增加一些形象的比喻和细节描写,让读者更加深入地了解你的思考和感受。同时,可以适当增加一些个人的经历和感受,让作文更加具有个性化和独特性。"]; - lbwz.isWriteEnd = YES; - [lbwz setBackHeight:^(float fheight, BOOL isend) { - if(isend) - { - self.isdrawEnd = YES; - } - }]; + SSEDrawListTextModel *model = self.arrdata[sender.tag]; + model.isaddEnd = NO; + self.modelSelect = model; + + [self getDuanLuo:model.value]; } -(void)bottomAction:(UIButton *)sender { @@ -213,27 +230,45 @@ switch (sender.tag) { case 0: { - self.isdrawEnd = NO; - for(UIView *view in self.arrItems) - { - [view removeFromSuperview]; - } - for(UIButton *bt in self.arrBts) - { - [bt removeFromSuperview]; - } - [self.arrBts removeAllObjects]; - [self.arrItems removeAllObjects]; - [self drawItemLastView:self.lbyaoqiu tag:0 bottom:nil]; - + [self getdata]; } break; case 1: { - FenXiangWenZhangAlterView *view = [[FenXiangWenZhangAlterView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)]; - [self.viewController.view addSubview:view]; - [view setBackValue:^(NSInteger tag) { - + [LoadAlterView show]; + NSMutableDictionary *dicinfo = [NSMutableDictionary new]; + [dicinfo setObject:[Tools isStringnil:[self.dicpush objectForKey:@"title"]] forKey:@"title"]; + [dicinfo setObject:[Tools isStringnil:[self.dicpush objectForKey:@"stage"]] forKey:@"stage"]; + [dicinfo setObject:[Tools isStringnil:[self.dicpush objectForKey:@"paragraph"]] forKey:@"paragraph"]; + NSMutableArray *arrcontent = [NSMutableArray new]; + for(SSEDrawListTextModel *model in self.arrdata) + { + if(model.value.length>0) + { + [arrcontent addObject:model.value]; + } + } + [dicinfo setObject:[arrcontent componentsJoinedByString:@"\n"] forKey:@"content"]; + [dicinfo setObject:[NSString stringWithFormat:@"%d",rand()%6+95] forKey:@"score"]; + [dicinfo setObject:[Tools isStringnil:[self.dicpush objectForKey:@"paragraph"]] forKey:@"paragraph"]; + + + [NetWorkManager requestWriteSaveData:self title:[self.dicpush objectForKey:@"title"] scene:@"write_with_content" info:dicinfo Callback:^(BOOL state, BaseModel *responseObject, NSString * _Nullable describle) { + [LoadAlterView dismiss]; + if(state) + { + XieZuoSaveAlterView *view = [[XieZuoSaveAlterView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)]; + [self.viewController.view addSubview:view]; + [view setBackValue:^{ + UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; + pasteboard.string = [arrcontent componentsJoinedByString:@"\n"]; + [HXHud showMessage:@"复制成功" afterDelayType:0]; + }]; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } }]; } break; @@ -242,4 +277,195 @@ } } + +#pragma mark - UIScrollView +- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView +{ + self.isDragging = YES; +} +- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate +{ + self.isDragging = NO; +} +-(void)nomoData +{ + for(UIView *view in self.arrLBWZ) + { + [view removeFromSuperview]; + } + for(UIButton *btin in self.arrBTN) + { + [btin removeFromSuperview]; + } + self.arrLBWZ = [NSMutableArray new]; + self.arrBTN = [NSMutableArray new]; + self.arrdata = [NSMutableArray new]; + for(int i = 0 ; i < 200;i++) + { + SSEDrawListTextModel *model = [SSEDrawListTextModel new]; + [self.arrdata addObject:model]; + } + + self.isStartDrawText = NO; + self.isdrawEnd = NO; + self.iDraw = 0; + self.viewDarwLast = self.lbyaoqiu; +} +///段落重写 rewrite {content,type} +-(void)getDuanLuo:(NSString *)content +{ + self.modelSelect.lbwz.isWriteEnd = NO; + [self.modelSelect.lbwz setBackHeight:^(float fheight, BOOL isend) { + + }]; + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:[Tools isStringnil:[self.dicpush objectForKey:@"technique"]] forKey:@"type"]; + [dicpush setObject:[Tools isStringnil:content] forKey:@"content"]; + + [[SSENetWorkManager shareManager] requestTo:[NSString stringWithFormat:@"https://aiw.batiao8.com/api/chat?scene=rewrite"] dicpush:dicpush config:^(SSEConfigModel * _Nonnull config) { + } backValue:^(NSString * _Nonnull value, BOOL isfinish) { + NSLog(@"%@",value); + if(value.length>4) + { + self.modelSelect.value = value; + self.modelSelect.lbwz.strValue = [NSString stringWithFormat:@" %@",self.modelSelect.value]; + } + else + { + if(isfinish) + { + self.modelSelect.isaddEnd = YES; + self.isdrawEnd = YES; + self.modelSelect.lbwz.isWriteEnd = YES; + } + } + } error:^(NSString * _Nonnull errorString) { + [HXHud showMessage:errorString afterDelayType:0]; + } ID:^(NSString * _Nonnull value) { + + }]; +} + +///全文 +-(void)getdata +{ + [LoadAlterView show]; + [self nomoData]; + + [[SSENetWorkManager shareManager] requestTo:[NSString stringWithFormat:@"https://aiw.batiao8.com/api/chat?scene=%@",@"write_with_content"] dicpush:self.dicpush config:^(SSEConfigModel * _Nonnull config) { + [LoadAlterView dismiss]; + self.modelConfig = config; + } backValue:^(NSString * _Nonnull value, BOOL isfinish) { + if(value.length>10) + { + [self chuliShuJu:value isfinish:NO]; + } + else + { + if(isfinish) + { + [self chuliShuJu:value isfinish:YES]; + } + } + } error:^(NSString * _Nonnull errorString) { + [LoadAlterView dismiss]; + [HXHud showMessage:errorString afterDelayType:0]; + } ID:^(NSString * _Nonnull value) { + + }]; +} + +-(void)chuliShuJu:(NSString *)value isfinish:(BOOL)isfinish +{ + if(isfinish) + { + for(SSEDrawListTextModel *model in self.arrdata) + { + model.isaddEnd = YES; + } + } + else + { + NSString *strshow = [value stringByReplacingOccurrencesOfString:@"* " withString:@"|&&|"]; + strshow = [strshow stringByReplacingOccurrencesOfString:@"*" withString:@"|&&|"]; + NSArray *arrlist = [strshow componentsSeparatedByString:@"|&&|"]; + SSEDrawListTextModel *modellast; + for(int i = 0 ; i < arrlist.count;i++) + { + NSString *str = arrlist[i]; + if(str.length<2) + { + continue;; + } + if(modellast) + { + modellast.isaddEnd = YES; + } + SSEDrawListTextModel *model = self.arrdata[i]; + str = [str stringByReplacingOccurrencesOfString:@"\n" withString:@""]; + model.value = str; + modellast = model; + } + } + dispatch_async(dispatch_get_main_queue(), ^{ + if(self.isStartDrawText==NO) + { + self.isStartDrawText = YES; + [self drawTextInfo]; + } + }); +} +-(void)drawTextInfo +{ + if(self.iDraw>=self.arrdata.count) + { + self.isdrawEnd = YES; + return; + } + + SSEDrawListTextModel *model = self.arrdata[self.iDraw]; + if(model.value.length==0) + { + self.iDraw++; + [self drawTextInfo]; + return; + } + ViewLable *lbwz; + if(model.lbwz==nil) + { + lbwz = [self drawItemLastView:self.viewDarwLast tag:self.iDraw]; + if(self.modelConfig.time.intValue>0) + { + lbwz.fspeed = self.modelConfig.time.intValue/1000.0; + } + [lbwz setBackHeight:^(float fheight, BOOL isend) { + if(isend) + { + self.iDraw+=1; + } + if(fheight==-1||isend) + { + [self drawTextInfo]; + } + if(self.isDragging==NO) + { + if(self.scvback.contentSize.height-self.scvback.height>0) + { + [self.scvback setContentOffset:CGPointMake(0, self.scvback.contentSize.height-self.scvback.height) animated:NO]; + } + } + }]; + self.viewDarwLast = lbwz; + model.lbwz = lbwz; + } + else + { + lbwz = model.lbwz; + } + lbwz.isWriteEnd = model.isaddEnd; + + lbwz.strValue = [NSString stringWithFormat:@" %@",model.value]; + +} + @end diff --git a/ProductApp/ProductApp/ProductMain/首页/自定义相机/CamreViewController.m b/ProductApp/ProductApp/ProductMain/首页/自定义相机/CamreViewController.m index 99bb622..0b43efe 100644 --- a/ProductApp/ProductApp/ProductMain/首页/自定义相机/CamreViewController.m +++ b/ProductApp/ProductApp/ProductMain/首页/自定义相机/CamreViewController.m @@ -17,6 +17,9 @@ #import "StartKTXZPGViewController.h" +#import "CamreShiLiView.h" +#import "NetWorkManager.h" + @interface CamreViewController () // ------------- 设备配置等 ------------- //捕获设备,通常是前置摄像头,后置摄像头,麦克风(音频输入) @@ -32,6 +35,8 @@ // ------------- UI -------------- /// +@property (nonatomic , strong) CamreTypeView *viewtype; +/// @property (nonatomic , strong) UIButton *btok; @property (nonatomic , strong) UIButton *btnumber; /// @@ -74,8 +79,23 @@ [self drawUI]; + if(self.type==2) + { + if([[[NSUserDefaults standardUserDefaults] objectForKey:CamreTiShiPaiZhao] intValue] !=1) + { + [[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:CamreTiShiPaiZhao]; + [CamreTiShiAlterView show]; + } + } + if(self.type==1) + { + if([[[NSUserDefaults standardUserDefaults] objectForKey:CamreTiShiPiGai] intValue] !=1) + { + [[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:CamreTiShiPiGai]; + [CamreTiShiAlterView show]; + } + } - [CamreTiShiAlterView show]; } @@ -131,7 +151,8 @@ make.height.offset(30); }]; // - viewtype.arrItems = @[@"改写作文",@"拍题成文",@"拍照"]; + viewtype.arrItems = @[@"改写作文",@"拍题成文",@"拍照续写"]; + _viewtype = viewtype; if(self.type==1) { [viewtype setHidden:YES]; @@ -226,9 +247,55 @@ { [self.navigationController popViewControllerAnimated:YES]; } +#pragma mark - 示例 -(void)shiliAction { - + [LoadAlterView show]; + if(self.type==2) + { + NSString *strname = [self.viewtype getSelectName]; + NSString *strscene = @"pic_rewrite"; + if([strname isEqualToString:@"拍题成文"]) + { + strscene = @"pic_question"; + } + else if([strname isEqualToString:@"拍照续写"]) + { + strscene = @"pic_with_front"; + } + [NetWorkManager requestExamplePicData:self.view role_id:@"" scene:strscene Callback:^(BOOL state, ExamplePicModel *responseObject, NSString * _Nullable describle) { + [LoadAlterView dismiss]; + if(state) + { + CamreShiLiView *view = [[CamreShiLiView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)]; + view.strpzname = strname; + view.type = self.type; + view.arrdata = responseObject.data.items; + [self.view addSubview:view]; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; + } + else if (self.type==1) + {///作文批改 + [NetWorkManager requestExampleCorrectListData:self.view role_id:[UserInfoModel getRole_id] Callback:^(BOOL state, ExampleCorrectList *responseObject, NSString * _Nullable describle) { + [LoadAlterView dismiss]; + if(state) + { + CamreShiLiView *view = [[CamreShiLiView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)];; + view.type = self.type; + view.arrdata = responseObject.data.items; + [self.view addSubview:view]; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; + } } -(void)bottomAction:(UIButton *)sender @@ -247,10 +314,28 @@ break; case 1: {///确定 - StartKTXZPGViewController *vc = [StartKTXZPGViewController new]; - vc.type = self.type-1; - [self.navigationController pushViewController:vc animated:YES]; - + if(self.arrData.count==0) + { + [HXHud showMessage:@"请添加图片" afterDelayType:0]; + return; + } + ///1作文批改 2拍照写作 + if(self.type==1) + { + StartKTXZPGViewController *vc = [StartKTXZPGViewController new]; + vc.type = 1; + vc.arrXZImages = self.arrData; + [self.navigationController pushViewController:vc animated:YES]; + } + else if(self.type==2) + { + NSArray *arrtt = @[@"改写作文",@"拍题成文",@"拍照续写"]; + int temp = (int)[arrtt indexOfObject:[self.viewtype getSelectName]]; + StartKTXZPGViewController *vc = [StartKTXZPGViewController new]; + vc.type = temp+10; + vc.arrXZImages = self.arrData; + [self.navigationController pushViewController:vc animated:YES]; + } } break; case 2: diff --git a/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreShiLiView.h b/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreShiLiView.h new file mode 100644 index 0000000..5aabb3b --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreShiLiView.h @@ -0,0 +1,23 @@ +// +// CamreShiLiView.h +// ProductApp +// +// Created by 工作 on 2024/10/25. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CamreShiLiView : UIView +///1作文批改 2拍照写作 +@property (nonatomic , assign) int type; + +///拍照写作 类型 +@property (nonatomic , strong) NSString *strpzname; + +/// +@property (nonatomic , strong) NSArray *arrdata; +@end + +NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreShiLiView.m b/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreShiLiView.m new file mode 100644 index 0000000..d5ab61a --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreShiLiView.m @@ -0,0 +1,203 @@ +// +// CamreShiLiView.m +// ProductApp +// +// Created by 工作 on 2024/10/25. +// + +#import "CamreShiLiView.h" +#import "JhtBannerScrollView.h" +#import "StartZWPIViewCell.h" + +#import "ExampleCorrectList.h"///作文批改 +#import "ExamplePicModel.h" + +#import "StartKTXZPGViewController.h" + + +#define CamreShiLiViewCellHeight UISCREEN_HEIGHT-KMagrinTop-TabHeight-190 +@interface CamreShiLiView () +@property (nonatomic, strong) JhtBannerScrollView *bannerView; +/// +@property (nonatomic , strong) UILabel *lbname; + +@end + +@implementation CamreShiLiView + +-(id)initWithFrame:(CGRect)frame +{ + if(self = [super initWithFrame:frame]) + { + [self setBackgroundColor:[UIColor blackColor]]; + + UIView *viewinfo = [[UIView alloc] init]; + [viewinfo setBackgroundColor:RGBCOLOR(238, 238, 238)]; + [self addSubview:viewinfo]; + [viewinfo mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.top.width.equalTo(self); + make.bottom.equalTo(self).offset(-TabHeight-100); + }]; + [self drawInfoView:viewinfo]; + + + UILabel *lbname = [[UILabel alloc] init]; + [lbname setText:@"作业批改"]; + [lbname setTextColor:[UIColor whiteColor]]; + [lbname setTextAlignment:NSTextAlignmentLeft]; + [lbname setFont:[UIFont systemFontOfSize:14]]; + [self addSubview:lbname]; + [lbname mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(viewinfo.mas_bottom).offset(20); + make.centerX.equalTo(self); + }]; + _lbname = lbname; + + UIButton *btok = [[UIButton alloc] init]; + [btok setImage:[UIImage imageNamed:@"cam_shili_ok"] forState:UIControlStateNormal]; + [self addSubview:btok]; + [btok mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self); + make.top.equalTo(lbname.mas_bottom).offset(40); + make.width.height.offset(45); + }]; + [btok addTarget:self action:@selector(okAction) forControlEvents:UIControlEventTouchUpInside]; + + } + return self; +} + +-(void)drawInfoView:(UIView *)view +{ + UIButton *btback = [[UIButton alloc] init]; + [btback setImage:[UIImage imageNamed:@"cam_cancle"] forState:UIControlStateNormal]; + [view addSubview:btback]; + [btback mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.offset(KMagrinTop); + make.height.offset(50); + make.left.offset(10); + make.width.offset(50); + }]; + [btback addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside]; + + UILabel *lbtishi = [[UILabel alloc] init]; + [lbtishi setText:@"拍照清晰、作文完整、批改更准确哟"]; + [lbtishi setTextColor:[UIColor whiteColor]]; + [lbtishi setTextAlignment:NSTextAlignmentCenter]; + [lbtishi setFont:[UIFont systemFontOfSize:14]]; + [view addSubview:lbtishi]; + [lbtishi mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(view); + make.top.equalTo(btback.mas_bottom).offset(10); + }]; + + JhtBannerScrollView *bannerView = [[JhtBannerScrollView alloc] initWithFrame:CGRectMake(0, KMagrinTop+50, UISCREEN_WIDTH, CamreShiLiViewCellHeight)]; + bannerView.delegate = self; + bannerView.dataSource = self; + bannerView.minCoverViewAlpha = 0.0; + bannerView.leftRightMargin = UISCREEN_WIDTH*0.05; + bannerView.topBottomMargin = 20; + bannerView.orientation = BV_Orientation_Horizontal; + bannerView.isOpenAutoScroll = NO; + bannerView.isCarousel = NO; + [bannerView setBackgroundColor:[UIColor clearColor]]; + [view addSubview:bannerView]; + [bannerView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self); + make.top.offset(KMagrinTop+50); + make.height.offset(CamreShiLiViewCellHeight); + }]; + [bannerView setClipsToBounds:NO]; + _bannerView = bannerView; + +} +-(void)backAction +{ + [self removeFromSuperview]; +} +-(void)setStrpzname:(NSString *)strpzname +{ + _strpzname = strpzname; + self.lbname.text = strpzname; +} +-(void)setArrdata:(NSArray *)arrdata +{ + _arrdata = arrdata; + [self.bannerView reloadData]; +} + +-(void)okAction +{ + ///1作文批改 2拍照写作 + if(self.type==1) + { + StartKTXZPGViewController *vc = [StartKTXZPGViewController new]; + vc.type = 1; + vc.modelDetailZWPG = self.arrdata[self.bannerView.currentIndex]; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + else if (self.type==2) + { + NSArray *arrtt = @[@"改写作文",@"拍题成文",@"拍照续写"]; + int temp = (int)[arrtt indexOfObject:self.strpzname]; + StartKTXZPGViewController *vc = [StartKTXZPGViewController new]; + vc.type = temp+10; + vc.modelXZSL = self.arrdata[self.bannerView.currentIndex]; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } +} +#pragma mark - JhtBannerScrollViewDataSource +/** 显示cardView 个数 */ +- (NSInteger)numberOfCardViewInBannerView:(JhtBannerScrollView *)bannerView +{ + return self.arrdata.count; +} + +/** 单个cardView */ +- (UIView *)bannerView:(JhtBannerScrollView *)bannerView cardViewForBannerViewAtIndex:(NSInteger)index +{ + StartZWPIViewCell *cardView = (StartZWPIViewCell *)[bannerView dequeueReusableView]; + if (!cardView) { + cardView = [[StartZWPIViewCell alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH*0.8, CamreShiLiViewCellHeight)]; + cardView.tag = index; + } + if(self.type==1) + {///作文批改 + ExampleCorrectListDataItems *model = self.arrdata[index]; + if(model.input_image.count>0) + { + [cardView.imgvback sd_setImageWithURL:[NSURL URLWithString:model.input_image.firstObject] placeholderImage:nil]; + } + } + else + { + ExamplePicModelDataItems *model = self.arrdata[index]; + if(model.image.count>0) + { + [cardView.imgvback sd_setImageWithURL:[NSURL URLWithString:model.image.firstObject] placeholderImage:nil]; + } + } + + return cardView; +} + +/** 当前显示cardView Size */ +- (CGSize)sizeForCurrentCardViewInBannerView:(JhtBannerScrollView *)bannerView +{ + return CGSizeMake(UISCREEN_WIDTH*0.8, CamreShiLiViewCellHeight); +} + +/** 滚动到了某一个cardView */ +- (void)bannerView:(JhtBannerScrollView *)bannerView didScrollToCardViewWithIndex:(NSInteger)index +{ + +} + +/** 点击了第几个cardView + * index: 点击bannerCardView index + */ +- (void)bannerView:(JhtBannerScrollView *)bannerView didSelectCardView:(UIView *)cardView withCardViewIndex:(NSInteger)index +{ + +} +@end diff --git a/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreTypeView.h b/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreTypeView.h index 39c9cae..d1615a6 100644 --- a/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreTypeView.h +++ b/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreTypeView.h @@ -12,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN @interface CamreTypeView : UIView /// @property (nonatomic , strong) NSArray *arrItems; +-(NSString *)getSelectName; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreTypeView.m b/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreTypeView.m index a821a3f..f00adc7 100644 --- a/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreTypeView.m +++ b/ProductApp/ProductApp/ProductMain/首页/自定义相机/view/CamreTypeView.m @@ -126,5 +126,8 @@ } } } - +-(NSString *)getSelectName +{ + return self.arrItems[self.btselect.tag]; +} @end