引导页-课堂写作

引导页-作文批改
引导页-智能写作
引导页-拍照写作
This commit is contained in:
pengguangjian 2024-10-22 18:30:16 +08:00
parent 62a2a61d4d
commit ca25e9deec
37 changed files with 791 additions and 254 deletions

View File

@ -64,6 +64,9 @@
CA0FD6A42CA8FF5C009A4417 /* FXWDPFView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0FD6A32CA8FF5C009A4417 /* FXWDPFView.m */; };
CA0FD6A82CA900E2009A4417 /* FXTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0FD6A72CA900E2009A4417 /* FXTextView.m */; };
CA0FD6AC2CA924A1009A4417 /* FXXieZuoJianYiView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0FD6AB2CA924A1009A4417 /* FXXieZuoJianYiView.m */; };
CA10DF982CC74FC70094FEEE /* SSEConfigModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA10DF972CC74FC70094FEEE /* SSEConfigModel.m */; };
CA10DF9B2CC77D0F0094FEEE /* SSEDrawModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA10DF9A2CC77D0F0094FEEE /* SSEDrawModel.m */; };
CA10DF9E2CC7AC040094FEEE /* ExamplePicModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA10DF9D2CC7AC040094FEEE /* ExamplePicModel.m */; };
CA11ED5A2CA648AB00209DFC /* CamreTypeView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA11ED592CA648AB00209DFC /* CamreTypeView.m */; };
CA11ED5D2CA653F600209DFC /* CamreImagesView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA11ED5C2CA653F600209DFC /* CamreImagesView.m */; };
CA11ED612CA6556900209DFC /* CamreImagesCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = CA11ED602CA6556900209DFC /* CamreImagesCollectionViewCell.m */; };
@ -600,6 +603,12 @@
CA0FD6A72CA900E2009A4417 /* FXTextView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FXTextView.m; sourceTree = "<group>"; };
CA0FD6AA2CA924A1009A4417 /* FXXieZuoJianYiView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FXXieZuoJianYiView.h; sourceTree = "<group>"; };
CA0FD6AB2CA924A1009A4417 /* FXXieZuoJianYiView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FXXieZuoJianYiView.m; sourceTree = "<group>"; };
CA10DF962CC74FC70094FEEE /* SSEConfigModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SSEConfigModel.h; sourceTree = "<group>"; };
CA10DF972CC74FC70094FEEE /* SSEConfigModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SSEConfigModel.m; sourceTree = "<group>"; };
CA10DF992CC77D0F0094FEEE /* SSEDrawModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SSEDrawModel.h; sourceTree = "<group>"; };
CA10DF9A2CC77D0F0094FEEE /* SSEDrawModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SSEDrawModel.m; sourceTree = "<group>"; };
CA10DF9C2CC7AC040094FEEE /* ExamplePicModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExamplePicModel.h; sourceTree = "<group>"; };
CA10DF9D2CC7AC040094FEEE /* ExamplePicModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExamplePicModel.m; sourceTree = "<group>"; };
CA11ED582CA648AB00209DFC /* CamreTypeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CamreTypeView.h; sourceTree = "<group>"; };
CA11ED592CA648AB00209DFC /* CamreTypeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CamreTypeView.m; sourceTree = "<group>"; };
CA11ED5B2CA653F600209DFC /* CamreImagesView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CamreImagesView.h; sourceTree = "<group>"; };
@ -2987,6 +2996,10 @@
CA07CD192CC6335400AF41ED /* ExampleCorrectList.m */,
CA07CD1B2CC646AA00AF41ED /* ExampleWriteList.h */,
CA07CD1C2CC646AA00AF41ED /* ExampleWriteList.m */,
CA10DF962CC74FC70094FEEE /* SSEConfigModel.h */,
CA10DF972CC74FC70094FEEE /* SSEConfigModel.m */,
CA10DF9C2CC7AC040094FEEE /* ExamplePicModel.h */,
CA10DF9D2CC7AC040094FEEE /* ExamplePicModel.m */,
);
path = models;
sourceTree = "<group>";
@ -3442,6 +3455,8 @@
CB489E0B2744A0BC00DA044A /* YQLocationTransform.m */,
CA81818C2C9E60B100EE7E6E /* ViewLable.h */,
CA81818D2C9E60B100EE7E6E /* ViewLable.m */,
CA10DF992CC77D0F0094FEEE /* SSEDrawModel.h */,
CA10DF9A2CC77D0F0094FEEE /* SSEDrawModel.m */,
CA8181A52C9EAB8700EE7E6E /* PGJUILabel.h */,
CA8181A62C9EAB8700EE7E6E /* PGJUILabel.m */,
CA0D087D2CA55E5C0086855E /* JJGradientLabel.h */,
@ -4419,11 +4434,13 @@
CA5D035E2CC0DE8D007B3BA5 /* YaoQingAlterView.m in Sources */,
CA4257AA2CA2A30C00A36A10 /* StartZNPPTYuLanViewController.m in Sources */,
CB489F9D2744A0BD00DA044A /* AssistiveView.m in Sources */,
CA10DF9B2CC77D0F0094FEEE /* SSEDrawModel.m in Sources */,
CABA14CB2C9D4395002CB3B1 /* GTMBases64.m in Sources */,
CB489FA02744A0BD00DA044A /* UIView+ZJFrame.m in Sources */,
CABA148D2C9D4312002CB3B1 /* PublicNetWorkManager.m in Sources */,
CA11ED742CA69AC600209DFC /* GaiXieRunSeViewController.m in Sources */,
CAB0F3602CAA84B3003B0C39 /* XieZuoXiangQingViewController.m in Sources */,
CA10DF9E2CC7AC040094FEEE /* ExamplePicModel.m in Sources */,
CA4257A02CA299F900A36A10 /* StartZNPPTDaGangView.m in Sources */,
CA5D02A32CC0B2DE007B3BA5 /* PeiZhiShowViewController.m in Sources */,
CA5D02AC2CC0B2DE007B3BA5 /* SetViewController.m in Sources */,
@ -4691,6 +4708,7 @@
CABD8C752CBF61BB009A5E5E /* GongJuCreateSuperView.m in Sources */,
CA0FD69D2CA8F907009A4417 /* FenXiangHaiBaoInfoSuperView.m in Sources */,
CB489F782744A0BD00DA044A /* NSBundle+DAUtils.m in Sources */,
CA10DF982CC74FC70094FEEE /* SSEConfigModel.m in Sources */,
CB489F4C2744A0BD00DA044A /* AddressListUrlAlterView.m in Sources */,
CABA14DD2C9D6E40002CB3B1 /* NetWorkManager.m in Sources */,
CA5D02772CC09DA4007B3BA5 /* MyViewTableViewCell.m in Sources */,

View File

@ -78,8 +78,8 @@
filePath = "ProductApp/ProductMain/NetWorkManager/NetWorkManager.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "269"
endingLineNumber = "269"
startingLineNumber = "307"
endingLineNumber = "307"
landmarkName = "+requestToolsListData:page:type_id:tool_name:is_recommend:Callback:"
landmarkType = "7">
</BreakpointContent>
@ -132,51 +132,5 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "D4B77918-AD0D-4325-923A-A6D2D5DBFE85"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ProductApp/ProductMain/NetWorkManager/SSENetWorkManager.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "26"
endingLineNumber = "26"
landmarkName = "-requestTo:stage:title:require:title_id:"
landmarkType = "7">
<Locations>
<Location
uuid = "D4B77918-AD0D-4325-923A-A6D2D5DBFE85 - 5a44dda45c228076"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "+[SSENetWorkManager requestTo:stage:title:require:title_id:]"
moduleName = "ProductApp"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/gongzuo/Desktop/%E5%85%AC%E5%8F%B8GIT/%E6%9E%81%E5%85%89%E5%86%99%E4%BD%9C/ProductApp/ProductApp/ProductMain/NetWorkManager/SSENetWorkManager.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "26"
endingLineNumber = "26">
</Location>
<Location
uuid = "D4B77918-AD0D-4325-923A-A6D2D5DBFE85 - dca731babbc01e48"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[SSENetWorkManager requestTo:stage:title:require:title_id:]"
moduleName = "ProductApp"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/gongzuo/Desktop/%E5%85%AC%E5%8F%B8GIT/%E6%9E%81%E5%85%89%E5%86%99%E4%BD%9C/ProductApp/ProductApp/ProductMain/NetWorkManager/SSENetWorkManager.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "26"
endingLineNumber = "26">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -0,0 +1,28 @@
//
// SSEDrawModel.h
// ProductApp
//
// Created by 工作 on 2024/10/22.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SSEDrawModel : NSObject
///
@property (nonatomic , strong) NSString *title;
///是否绘制了titile
@property (nonatomic , assign) BOOL isDrawTitle;
///子类文本数据
@property (nonatomic , strong) NSArray *arrSon;
///当前绘制的子类tag
@property (nonatomic , assign) NSInteger idrawtag;
///绘制的ViewLable
@property (nonatomic , strong) NSMutableArray *arrViewLable;
///是否获取数据完成
@property (nonatomic , assign) BOOL isaddEnd;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,12 @@
//
// SSEDrawModel.m
// ProductApp
//
// Created by on 2024/10/22.
//
#import "SSEDrawModel.h"
@implementation SSEDrawModel
@end

View File

@ -6,7 +6,7 @@
//
#import <UIKit/UIKit.h>
#import "SSEDrawModel.h"
NS_ASSUME_NONNULL_BEGIN
typedef void(^ViewLableBackHeight)(float fheight,BOOL isend);
@interface ViewLable : UIView
@ -20,6 +20,11 @@ typedef void(^ViewLableBackHeight)(float fheight,BOOL isend);
@property (nonatomic , assign) float fspeed;
///是否关闭动画写入
@property (nonatomic , assign) BOOL isCloseAnimation;
///是否写入完成
@property (nonatomic , assign) BOOL isWriteEnd;
///在尾部添加数据
@property (nonatomic , strong) NSString *appendString;
///
@property (nonatomic , strong) ViewLableBackHeight backHeight;

View File

@ -50,8 +50,12 @@
make.left.right.top.equalTo(self);
}];
_lbname = lbname;
// [self mas_makeConstraints:^(MASConstraintMaker *make) {
// make.height.offset(18);
// }];
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.offset(18);
make.bottom.equalTo(lbname);
}];
UIImageView *imgvb = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 18, 18)];
@ -106,26 +110,44 @@
[self showText];
}
}
-(void)setAppendString:(NSString *)appendString
{
NSString *strtemp =@"";
if(self.strValue==nil)
{
strtemp = [[NSString alloc] initWithString:appendString];
}
else
{
strtemp = [NSString stringWithFormat:@"%@%@",self.strValue,appendString];
}
[self setStrValue:strtemp];
}
-(void)showText
{
if(self.timer==nil)
{
[self endAction];
[self.imgvb setHidden:NO];
self.inow = 0;
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];
}
}
-(void)textSpeedAppend
{
if(self.inow+1>self.strValue.length)
if(self.inow+1>self.strValue.length && self.isWriteEnd==YES)
{
[self.timer invalidate];
self.timer = nil;
[self.imgvb setHidden:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
self.backHeight(self.height,YES);
});
return;
}
if(self.inow+1>self.strValue.length)return;
NSString *str = [self.strValue substringToIndex:self.inow];
///
NSMutableParagraphStyle *style = [NSMutableParagraphStyle new];
@ -141,9 +163,9 @@
self.inow++;
float fheight = [Tools getLabelHeightWithText:self.lbname.text width:self.width font:self.lbname.font.pointSize linHeight:5]+1;
[self mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.offset(fheight);
}];
// [self mas_updateConstraints:^(MASConstraintMaker *make) {
// make.height.offset(fheight);
// }];
self.backHeight(fheight,NO);
CGPoint point = [self boundingRectForLastCharacterInLabel:self.lbname];
@ -153,34 +175,9 @@
}
// NSLog(@"%@",NSStringFromCGPoint(point));
}
- (CGPoint)boundingRectForLastCharacterInLabel:(UILabel *)label {
NSString *text = label.text;
//
// NSMutableParagraphStyle *style = [NSMutableParagraphStyle new];
// style.lineSpacing = 5;
// style.lineBreakMode = NSLineBreakByWordWrapping;
// style.alignment = NSTextAlignmentLeft;
//
// NSDictionary *attributes = @{NSFontAttributeName: label.font,NSParagraphStyleAttributeName:style}; //
//
// CGRect sz = [text boundingRectWithSize:CGSizeMake(MAXFLOAT, 20) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil];
//
// CGRect linesSz = [text boundingRectWithSize:CGSizeMake(label.frame.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil];
//
// [text sizeWithFont:label.font constrainedToSize:CGSizeMake(MAXFLOAT, 20) lineBreakMode:NSLineBreakByWordWrapping];
//
// CGPoint lastPoint;
// if(sz.size.height>=linesSz.size.height)
// {
// lastPoint = CGPointMake(label.frame.origin.x+sz.size.width, label.frame.origin.y+9);
// }
// else
// {
// lastPoint = CGPointMake(label.frame.origin.x+(int)sz.size.width%(int)linesSz.size.width, linesSz.size.height-sz.size.height+9);
// }
[self configWithLabel:label];
CGRect rect = [self characterRectAtIndex:text.length-1];

View File

@ -189,7 +189,7 @@
self.lbvalueright.isCloseAnimation = !model.isAnimation;
self.lbvalueright.strValue = strtext;
self.lbvalueright.isWriteEnd = YES;
}
else
{
@ -242,6 +242,7 @@
self.lbvalueLeft.isCloseAnimation = !model.isAnimation;
self.lbvalueLeft.strValue = model.text;
self.lbvalueLeft.isWriteEnd = YES;
}
}

View File

@ -14,6 +14,8 @@
#import "TextbookDetailModel.h"
#import "ExampleCorrectList.h"
#import "ExampleWriteList.h"
#import "ExamplePicModel.h"
NS_ASSUME_NONNULL_BEGIN
@ -67,6 +69,17 @@ NS_ASSUME_NONNULL_BEGIN
role_id:(NSString *)role_id
Callback:(completeModeBlock)callback;
/*
/api/example/pic
scene
role_id
*/
+ (void)requestExamplePicData:(UIView *)view
role_id:(NSString *)role_id
scene:(NSString *)scene
Callback:(completeModeBlock)callback;
/*
/api/tools/type

View File

@ -193,6 +193,44 @@
}];
}
/*
/api/example/pic
scene
role_id
*/
+ (void)requestExamplePicData:(UIView *)view
role_id:(NSString *)role_id
scene:(NSString *)scene
Callback:(completeModeBlock)callback
{
NSMutableDictionary *dicQuery = [NSMutableDictionary new];
[dicQuery setObject:[Tools isStringnil:role_id] forKey:@"role_id"];
[dicQuery setObject:[Tools isStringnil:scene] forKey:@"scene"];
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);
}
}];
}
/*

View File

@ -7,11 +7,19 @@
#import <Foundation/Foundation.h>
#import "YSAPIClient.h"
#import "SSEConfigModel.h"
NS_ASSUME_NONNULL_BEGIN
typedef void(^SSENetWorkManagerBackStringValue)(NSString *value,BOOL isfinish);
typedef void(^SSENetWorkManagerBackConfigValue)(SSEConfigModel *config);
typedef void(^SSENetWorkManagerBackErrorValue)(NSString *errorString);
typedef void(^SSENetWorkManagerBackIDValue)(NSString *value);
@interface SSENetWorkManager : NSObject
+ (instancetype)shareManager;
- (void)requestTo:(NSString*)host stage:(NSString *)stage title:(NSString *)title require:(NSString *)require title_id:(NSString *)title_id;
- (void)requestTo:(NSString*)host stage:(NSString *)stage title:(NSString *)title require:(NSString *)require title_id:(NSString *)title_id config:(SSENetWorkManagerBackConfigValue)config backValue:(SSENetWorkManagerBackStringValue)backValue error:(SSENetWorkManagerBackErrorValue)error ID:(SSENetWorkManagerBackIDValue)ID;
@end
NS_ASSUME_NONNULL_END

View File

@ -8,7 +8,20 @@
#import "SSENetWorkManager.h"
@interface SSENetWorkManager ()<NSURLSessionDelegate>
@interface SSENetWorkManager ()<NSURLSessionDataDelegate>
///
@property (nonatomic , strong) NSMutableString *strAll;
@property (nonatomic , strong) NSMutableString *strAllValue;
///
@property (nonatomic , strong) SSEConfigModel *modelConfig;
///
@property (nonatomic , strong) SSENetWorkManagerBackConfigValue backConfig;
@property (nonatomic , strong) SSENetWorkManagerBackStringValue backValue;
@property (nonatomic , strong) SSENetWorkManagerBackErrorValue backError;
@property (nonatomic , strong) SSENetWorkManagerBackIDValue backID;
@end
@implementation SSENetWorkManager
@ -21,15 +34,26 @@
});
return _instance;
}
- (void)requestTo:(NSString*)host stage:(NSString *)stage title:(NSString *)title require:(NSString *)require title_id:(NSString *)title_id
- (void)requestTo:(NSString*)host stage:(NSString *)stage title:(NSString *)title require:(NSString *)require title_id:(NSString *)title_id config:(SSENetWorkManagerBackConfigValue)config backValue:(SSENetWorkManagerBackStringValue)backValue error:(SSENetWorkManagerBackErrorValue)error ID:(SSENetWorkManagerBackIDValue)ID;
{
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] delegate:self delegateQueue:nil];
self.backConfig = config;
self.backValue = backValue;
self.backError = error;
self.backID = ID;
self.modelConfig = nil;
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] delegate:self delegateQueue:[NSOperationQueue mainQueue]];
NSMutableDictionary *dicpush = [NSMutableDictionary new];
[dicpush setObject:[Tools isStringnil:stage] forKey:@"stage"];
[dicpush setObject:[Tools isStringnil:title] forKey:@"title"];
[dicpush setObject:[Tools isStringnil:require] forKey:@"require"];
if(title_id.length>0)
{
[dicpush setObject:[Tools isStringnil:title_id] forKey:@"title_id"];
}
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:host]];
@ -45,7 +69,6 @@
[request setValue:[Tools isStringnil:[dicheadertemp objectForKey:key]] forHTTPHeaderField:key];
}
NSString *strtoken = [UserInfoModel shareModel].token;
if([Tools isStringnil:strtoken].length==0)
{
@ -63,42 +86,131 @@
NSURLSessionDataTask *task = [session dataTaskWithRequest:request];
// NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
// if(error)
// {
// return;
// }
//
// NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
// if(httpResponse.statusCode != 200)return;
//
// if([httpResponse.MIMEType isEqualToString:@"text/event-stream"])
// {
// NSString *strtemp = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
// NSLog(@"%@",strtemp);
// }
// }];
//
[task resume];
}
#pragma mark - NSURLSessionDelegate
- (void)URLSession:(NSURLSession *)session didBecomeInvalidWithError:(nullable NSError *)error
{
//
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler {
/*
使 completionHandler
NSURLSessionResponseCancel = 0,
NSURLSessionResponseAllow = 1,
NSURLSessionResponseBecomeDownload = 2,
NSURLSessionResponseBecomeStream
*/
// NSLog(@"");
self.strAll = [NSMutableString new];
self.strAllValue = [NSMutableString new];
//
completionHandler(NSURLSessionResponseAllow);
}
- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (NS_SWIFT_SENDABLE ^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler
{
//
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data {
NSString *strtemp = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@",strtemp);
[self.strAll appendString:strtemp];
NSString *stralltemp = self.strAll;
///
NSRange rangeStop = [stralltemp rangeOfString:@"event:stop"];
if(rangeStop.length != 0)
{///
rangeStop = [stralltemp rangeOfString:@"data:"];
if(rangeStop.length!=0)
{
NSString *strvalue = [stralltemp substringFromIndex:rangeStop.location+rangeStop.length];
self.backError(strvalue);
[dataTask cancel];
return;
}
}
///
NSRange range = [stralltemp rangeOfString:@"event:config"];
if(range.length != 0)
{/// {"model":"qwen-plus","time":"20"}
range = [stralltemp rangeOfString:@"data:"];
NSRange rangeEnd = [stralltemp rangeOfString:@"}"];
if(range.length!=0)
{
NSString *strValue = [stralltemp substringWithRange:NSMakeRange(range.location+range.length, rangeEnd.location+1-range.location-range.length)];
stralltemp = [stralltemp substringFromIndex:rangeEnd.location+1];
if(!self.modelConfig)
{
self.modelConfig = [SSEConfigModel yy_modelWithJSON:strValue];
self.backConfig(self.modelConfig);
}
}
}
NSMutableString *strAllTemp = [NSMutableString new];
///ID
NSArray *arrMessage = [stralltemp componentsSeparatedByString:@"event:message"];
for(NSString *str in arrMessage)
{
if(str.length==0)continue;
NSArray *arrtemp = [str componentsSeparatedByString:@"event:"];
BOOL islastid = [str containsString:@"event:"];
for(int i = 0 ; i < arrtemp.count; i++)
{
NSString *strson = arrtemp[i];
if(strson.length==0)continue;
NSRange rangeMessage = [strson rangeOfString:@"data:"];
if(rangeMessage.length>0)
{
NSArray *arrdatatmep = [strson componentsSeparatedByString:@"data:"];
for(int j=0;j<arrdatatmep.count;j++)
{
NSString *strValue = arrdatatmep[j];
strValue = [strValue stringByReplacingOccurrencesOfString:@"\n\n" withString:@""];
if(strValue.length==0 || [strValue isEqualToString:@"\n"])continue;
if(islastid&&i==arrtemp.count-1)
{
if(j==arrdatatmep.count-1)
{
self.backID(strValue);
}
}
else
{
[strAllTemp appendString:strValue];
if(i==arrtemp.count-1 && j==arrdatatmep.count-1)
{
self.backValue(strAllTemp,NO);
}
}
}
}
}
}
}
//
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {
// NSLog(@"");
- (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session
{
if(error)
{
// NSData *data = [NSJSONSerialization dataWithJSONObject:error.userInfo options:NSJSONWritingPrettyPrinted error:nil];
NSString *strerror = [error localizedDescription];
self.backError(strerror);
}
else
{
self.backValue(@"",YES);
}
}
@end

View File

@ -0,0 +1,41 @@
//
// ExamplePicModel.h
// ProductApp
//
// Created by 工作 on 2024/10/22.
//
#import "BaseModel.h"
NS_ASSUME_NONNULL_BEGIN
@class ExamplePicModelData,ExamplePicModelDataItems,ExamplePicModelDataItemsResult;
@interface ExamplePicModel : BaseModel
///
@property (nonatomic , strong) ExamplePicModelData *data;
@end
@interface ExamplePicModelData : NSObject
///
@property (nonatomic , strong) NSArray *items;
@end
@interface ExamplePicModelDataItems : NSObject
///
@property (nonatomic , strong) NSString *create_time;
///
@property (nonatomic , strong) NSString *ID;
///
@property (nonatomic , strong) NSArray *image;
///
@property (nonatomic , strong) ExamplePicModelDataItemsResult *result;
///pic_question
@property (nonatomic , strong) NSString *scene;
///
@property (nonatomic , strong) NSString *title;
@end
@interface ExamplePicModelDataItemsResult : NSObject
///
@property (nonatomic , strong) NSString *content;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,31 @@
//
// ExamplePicModel.m
// ProductApp
//
// Created by on 2024/10/22.
//
#import "ExamplePicModel.h"
@implementation ExamplePicModel
+ (NSDictionary *)modelContainerPropertyGenericClass {
return @{@"data" : [ExamplePicModelData class]};
}
@end
@implementation ExamplePicModelData
+ (NSDictionary *)modelContainerPropertyGenericClass {
return @{@"items" : [ExamplePicModelDataItems class]};
}
@end
@implementation ExamplePicModelDataItems
+ (NSDictionary *)modelContainerPropertyGenericClass {
return @{@"result" : [ExamplePicModelDataItemsResult class]};
}
+ (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper
{
return @{@"ID" : @"id"};
}
@end
@implementation ExamplePicModelDataItemsResult
@end

View File

@ -0,0 +1,19 @@
//
// SSEConfigModel.h
// ProductApp
//
// Created by 工作 on 2024/10/22.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SSEConfigModel : NSObject
///、、、qwen-plus
@property (nonatomic , strong) NSString *model;
///毫秒
@property (nonatomic , strong) NSString *time;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,12 @@
//
// SSEConfigModel.m
// ProductApp
//
// Created by on 2024/10/22.
//
#import "SSEConfigModel.h"
@implementation SSEConfigModel
@end

View File

@ -7,7 +7,7 @@
#import "StartPZXZViewController.h"
#import "StartPZXZView.h"
#import "NetWorkManager.h"
@interface StartPZXZViewController ()
@ -21,7 +21,7 @@
- (void)viewDidLoad {
[super viewDidLoad];
[self.navigationController setNavigationBarHidden:YES animated:NO];
[self showNaviGationView:YES];
[self.navigationView setHidden:YES];
[self.view setBackgroundColor:[UIColor blackColor]];
StartPZXZView *view = [[StartPZXZView alloc] init];
@ -29,7 +29,20 @@
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
[view setHidden:YES];
[LoadAlterView show];
[NetWorkManager requestExamplePicData:self.view role_id:[Tools isStringnil:self.strpid].length>0?self.strpid:self.role_id scene:@"" Callback:^(BOOL state, ExamplePicModel *responseObject, NSString * _Nullable describle) {
[LoadAlterView dismiss];
if(state)
{
view.arrdataYD = responseObject.data.items;
[view setHidden:NO];
}
else
{
[HXHud showMessage:responseObject.message afterDelayType:1];
}
}];
}
@end

View File

@ -6,12 +6,13 @@
//
#import <UIKit/UIKit.h>
#import "ExamplePicModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface StartPZXZPageView : UIView
@property (nonatomic , assign) CGSize yidongsize;
///
@property (nonatomic , strong) ExamplePicModelDataItems *model;
@end
NS_ASSUME_NONNULL_END

View File

@ -32,7 +32,6 @@
_scvback = scvback;
UIImageView *imgvback = [[UIImageView alloc] init];
[imgvback setImage:[UIImage imageNamed:@"yd_nomoxiangji"]];
[imgvback setContentMode:UIViewContentModeScaleAspectFit];
[scvback addSubview:imgvback];
[imgvback mas_makeConstraints:^(MASConstraintMaker *make) {
@ -45,6 +44,18 @@
}
return self;
}
-(void)setModel:(ExamplePicModelDataItems *)model
{
_model = model;
if(model.image.count>0)
{
[self.imgvback sd_setImageWithURL:[NSURL URLWithString:model.image.firstObject] placeholderImage:nil];
}
else
{
[self.imgvback setImage:[UIImage imageNamed:@"yd_nomoxiangji"]];
}
}
///1 x y
-(void)setYidongsize:(CGSize)yidongsize
{

View File

@ -10,7 +10,8 @@
NS_ASSUME_NONNULL_BEGIN
@interface StartPZXZView : UIView
///
@property (nonatomic , strong) NSArray *arrdataYD;
@end
NS_ASSUME_NONNULL_END

View File

@ -37,7 +37,6 @@
[self addSubview:scvback];
[scvback setPagingEnabled:YES];
[scvback setShowsHorizontalScrollIndicator:NO];
[scvback setContentSize:CGSizeMake(UISCREEN_WIDTH*3, 0)];
_scvback = scvback;
if (@available(iOS 11.0, *)) {
scvback.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
@ -45,27 +44,6 @@
self.viewController.automaticallyAdjustsScrollViewInsets =NO;
}
self.arrView = [NSMutableArray new];
for(int i = 0 ; i < 3; i++)
{
StartPZXZPageView *viewitem = [StartPZXZPageView new];
[scvback addSubview:viewitem];
[viewitem mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.height.width.equalTo(scvback);
make.left.offset(UISCREEN_WIDTH*i);
}];
[self.arrView addObject:viewitem];
}
UIView *viewbottom = [[UIView alloc] init];
[self addSubview:viewbottom];
[viewbottom mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self);
make.top.equalTo(scvback.mas_bottom);
}];
[self drawBottomView:viewbottom];
[self tuoluo];
}
return self;
}
@ -73,7 +51,7 @@
-(void)drawBottomView:(UIView *)view
{
float f_width = 90;
NSArray *arrtop = @[@"改写作文",@"拍题成文",@"拍照续写"];
NSArray *arrtop = self.arrdataYD;
UIView *viewback = [[UIView alloc] init];
[view addSubview:viewback];
[viewback mas_makeConstraints:^(MASConstraintMaker *make) {
@ -85,8 +63,20 @@
self.arrbtn = [NSMutableArray new];
for(int i = 0 ; i < arrtop.count;i++)
{
ExamplePicModelDataItems *model = arrtop[i];
UIButton *btitem = [[UIButton alloc] init];
[btitem setTitle:arrtop[i] forState:UIControlStateNormal];
if([model.scene isEqualToString:@"pic_rewrite"])
{
[btitem setTitle:@"拍照改写" forState:UIControlStateNormal];
}
else if([model.scene isEqualToString:@"pic_question"])
{
[btitem setTitle:@"拍题写作" forState:UIControlStateNormal];
}
else if([model.scene isEqualToString:@"pic_with_front"])
{
[btitem setTitle:@"拍照续写" forState:UIControlStateNormal];
}
[btitem setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[btitem setTitleColor:RGBCOLOR(255, 154, 18) forState:UIControlStateSelected];
[btitem.titleLabel setFont:[UIFont boldSystemFontOfSize:14]];
@ -121,6 +111,35 @@
[btpai addTarget:self action:@selector(paiAction) forControlEvents:UIControlEventTouchUpInside];
}
-(void)setArrdataYD:(NSArray *)arrdataYD
{
_arrdataYD = arrdataYD;
[self.scvback setContentSize:CGSizeMake(UISCREEN_WIDTH*arrdataYD.count, 0)];
self.arrView = [NSMutableArray new];
for(int i = 0 ; i < self.arrdataYD.count; i++)
{
StartPZXZPageView *viewitem = [StartPZXZPageView new];
[self.scvback addSubview:viewitem];
[viewitem mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.height.width.equalTo(self.scvback);
make.left.offset(UISCREEN_WIDTH*i);
}];
viewitem.model = self.arrdataYD[i];
[self.arrView addObject:viewitem];
}
UIView *viewbottom = [[UIView alloc] init];
[self addSubview:viewbottom];
[viewbottom mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self);
make.top.equalTo(self.scvback.mas_bottom);
}];
[self drawBottomView:viewbottom];
[self tuoluo];
}
-(void)itemAction:(UIButton *)sender
{
if(sender.tag==self.btselect.tag)return;
@ -136,7 +155,7 @@
NSInteger ipage = scrollView.contentOffset.x/UISCREEN_WIDTH;
if(ipage>self.arrbtn.count-1)ipage=self.arrbtn.count-1;
if(ipage<0)ipage=0;
self.btselect = self.arrbtn[ipage];
[self itemAction:self.arrbtn[ipage]];
}
-(void)tuoluo
@ -175,6 +194,7 @@
[self stopMotion];
///
StartPZXZDetailViewController *vc = [StartPZXZDetailViewController new];
vc.modelYD = self.arrdataYD[self.btselect.tag];
[self.viewController.navigationController pushViewController:vc animated:YES];
}
@end

View File

@ -6,10 +6,12 @@
//
#import "BaseViewController.h"
#import "ExamplePicModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface StartPZXZDetailViewController : BaseViewController
///
@property (nonatomic , strong) ExamplePicModelDataItems *modelYD;
@end

View File

@ -22,6 +22,22 @@
[self.navigationController setNavigationBarHidden:YES animated:animated];
[self showNaviGationView:YES];
[self.navigationView setTitle:@"改写成文" titleColor:RGBCOLOR(60, 60, 60)];
if(self.modelYD)
{
if([self.modelYD.scene isEqualToString:@"pic_rewrite"])
{
[self.navigationView setTitle:@"拍照改写" titleColor:RGBCOLOR(60, 60, 60)];
}
else if([self.modelYD.scene isEqualToString:@"pic_question"])
{
[self.navigationView setTitle:@"拍题写作" titleColor:RGBCOLOR(60, 60, 60)];
}
else if([self.modelYD.scene isEqualToString:@"pic_with_front"])
{
[self.navigationView setTitle:@"拍照续写" titleColor:RGBCOLOR(60, 60, 60)];
}
}
[self.navigationView setBackgroundColor:[UIColor whiteColor]];
[self.navigationView.backButton setHidden:YES];
}
@ -35,6 +51,7 @@
make.left.right.bottom.equalTo(self.view);
make.top.offset(NavHeight);
}];
view.modelYD = self.modelYD;
}

View File

@ -6,11 +6,12 @@
//
#import <UIKit/UIKit.h>
#import "ExamplePicModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface StartPZXZDetailView : UIView
///
@property (nonatomic , strong) ExamplePicModelDataItems *modelYD;
@end
NS_ASSUME_NONNULL_END

View File

@ -24,6 +24,11 @@
@property (nonatomic , strong) UIScrollView *scvback;
@property (nonatomic , assign) BOOL isDragging;
///
@property (nonatomic , strong) UILabel *lbname;
@property (nonatomic , strong) ViewLable *lbwz;
@end
@implementation StartPZXZDetailView
@ -142,6 +147,7 @@
make.width.equalTo(scvback).offset(-32);
}];
[lbname sizeToFit];
_lbname = lbname;
ViewLable *lbwz = [[ViewLable alloc] init];
[scvback addSubview:lbwz];
@ -151,8 +157,6 @@
}];
lbwz.textColor = RGBCOLOR(61, 61, 61);
lbwz.textFont = [UIFont systemFontOfSize:14];
lbwz.fspeed = 0.02;
lbwz.strValue = @" 假如我是一颗小星星,我愿意紧紧地围绕在月亮身边,静静地听她讲美丽动人的故事,嫦娥、玉兔,还有吴刚的桂花酒……\n 假如我是一颗小星星,我愿意做最亮的一颗,每当夜幕降临,我就高高地悬挂在夜空中,给人们送去珍贵的光明,为走夜路的人们照亮前进的方向,为在夜里害怕的孩子送去光明。";
[lbwz setBackHeight:^(float fheight, BOOL isend) {
if(isend)
{
@ -166,7 +170,7 @@
}
}
}];
_lbwz = lbwz;
[scvback mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(lbwz).offset(20);
}];
@ -243,4 +247,24 @@
{
self.isDragging = NO;
}
-(void)setModelYD:(ExamplePicModelDataItems *)modelYD
{
_modelYD = modelYD;
self.viweBack.model = self.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;
}
@end

View File

@ -8,8 +8,7 @@
#import "StartZNXZSiLuViewController.h"
#import "StartZNXZSiLuView.h"
#import "WebSocketManager.h"
#import "SSENetWorkManager.h"
@interface StartZNXZSiLuViewController ()
@ -37,11 +36,9 @@
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
// [[WebSocketManager shared] connectTo:[NSString stringWithFormat:@"https://aiw.batiao8.com/api/chat?scene=%@",@"write_outline"] stage:self.strtitle title:self.modelTitle.title require:[self.arrRequire componentsJoinedByString:@"、"] title_id:self.modelTitle.ID];
[[SSENetWorkManager shareManager] requestTo:[NSString stringWithFormat:@"https://aiw.batiao8.com/api/chat?scene=%@",@"write_outline"] stage:self.strtitle title:self.modelTitle.title require:[self.arrRequire componentsJoinedByString:@"、"] title_id:self.modelTitle.ID];
view.strtitle = self.strtitle;
view.arrRequire = self.arrRequire;
view.modelTitle = self.modelTitle;
}

View File

@ -6,11 +6,15 @@
//
#import <UIKit/UIKit.h>
#import "ExampleWriteList.h"
NS_ASSUME_NONNULL_BEGIN
@interface StartZNXZSiLuView : UIView
@property (nonatomic , strong) NSString *strtitle;
///
@property (nonatomic , strong) ExampleWriteListDataItems *modelTitle;
///
@property (nonatomic , strong) NSArray *arrRequire;
@end
NS_ASSUME_NONNULL_END

View File

@ -7,20 +7,33 @@
#import "StartZNXZSiLuView.h"
#import "StartPayViewController.h"
#import "SSENetWorkManager.h"
typedef void(^StartZNXZSiLuViewDrawEndBack)(UIView *viewlast);
@interface StartZNXZSiLuView ()<UIScrollViewDelegate>
///
@property (nonatomic , strong) UILabel *lbname;
///
@property (nonatomic , strong) UIView *viewback;
///
@property (nonatomic , strong) UIScrollView *scvback;
///
@property (nonatomic , strong) MASConstraint *scvBottom;
@property (nonatomic , assign) BOOL isDragging;
///
@property (nonatomic , strong) MASConstraint *scrollBottom;
@property (nonatomic , assign) BOOL isdrawEnd;
///
@property (nonatomic , strong) NSMutableArray *arrDraw;
@property (nonatomic , assign) NSInteger iDraw;
///
@property (nonatomic , strong) UIView *viewDarwLast;
///
@property (nonatomic , strong) SSEConfigModel *modelConfig;
@property (nonatomic , assign) BOOL isStartDrawText;
///
@property (nonatomic , strong) NSTimer *timerDraw;
@end
@implementation StartZNXZSiLuView
@ -50,6 +63,7 @@ typedef void(^StartZNXZSiLuViewDrawEndBack)(UIView *viewlast);
make.right.equalTo(self).offset(-14);
make.top.equalTo(imgvlog.mas_centerY).offset(-8);
}];
_lbname = lbname;
UIView *viewback = [[UIView alloc] init];
[viewback setBackgroundColor:[UIColor whiteColor]];
@ -63,7 +77,7 @@ typedef void(^StartZNXZSiLuViewDrawEndBack)(UIView *viewlast);
[viewback.layer setMasksToBounds:YES];
[viewback.layer setCornerRadius:20];
_viewback = viewback;
[self drawInfoView:viewback];
UIView *viewbottom = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, TabHeight+40)];
[viewbottom setBackgroundColor:[UIColor whiteColor]];
@ -158,30 +172,9 @@ typedef void(^StartZNXZSiLuViewDrawEndBack)(UIView *viewlast);
[scvback setDelegate:self];
_scvback = scvback;
[self startDraw:@[@{@"title":@"题材",@"values":@[@""]},
@{@"title":@"开头",@"values":@[@""]},
@{@"title":@"中间",@"values":@[@"",@"",@""]},
@{@"title":@"结尾",@"values":@[@""]}] tag:0 lastValue:nil];
}
-(void)startDraw:(NSArray *)arrtemp tag:(int)tag lastValue:(UIView *)lastValue
{
NSDictionary *dic = arrtemp[tag];
[self drawSubItemsView:self.scvback title:[dic objectForKey:@"title"] values:[dic objectForKey:@"values"] lastview:lastValue back:^(UIView *viewlast) {
if(tag<arrtemp.count-1)
{
[self startDraw:arrtemp tag:tag+1 lastValue:viewlast];
}
else
{
self.isdrawEnd = YES;
}
}];
}
-(void)drawSubItemsView:(UIView *)view title:(NSString *)title values:(NSArray *)values lastview:(UIView *)lastview back:(StartZNXZSiLuViewDrawEndBack)backvalue
#pragma mark - ///
-(UIView *)drawSubItemsView:(UIView *)view title:(NSString *)title lastview:(UIView *)lastview
{
UIView *viewtop= [[UIView alloc] init];
[view addSubview:viewtop];
@ -199,12 +192,10 @@ typedef void(^StartZNXZSiLuViewDrawEndBack)(UIView *viewlast);
}];
[self drawTitleView:viewtop title:title];
[self drawSUbItemView:view values:values lastview:viewtop tag:0 back:^(UIView *viewlast) {
backvalue(viewlast);
}];
return viewtop;
}
-(void)drawSUbItemView:(UIView *)view values:(NSArray *)values lastview:(UIView *)lastview tag:(int)tag back:(StartZNXZSiLuViewDrawEndBack)backvalue
#pragma mark -///
-(ViewLable *)drawSUbItemView:(UIView *)view lastview:(UIView *)lastview
{
UIView *viewtc = [[UIView alloc] init];
[view addSubview:viewtc];
@ -213,64 +204,33 @@ typedef void(^StartZNXZSiLuViewDrawEndBack)(UIView *viewlast);
make.width.equalTo(view).offset(-30);
make.top.equalTo(lastview.mas_bottom).offset(10);
}];
__strong UIView *viewlasttmep = viewtc;
[self drawItemTextView:viewtc value:@"以我心中的英雄--杨利伟为例,讲述他的热爱祖国的事迹。" back:^(UIView *viewlast) {
///
if(tag<values.count-1)
{
[self drawSUbItemView:view values:values lastview:viewlasttmep tag:tag+1 back:backvalue];
}
else
{
backvalue(viewlasttmep);
}
}];
if(self.scrollBottom)
{
[self.scrollBottom uninstall];
self.scrollBottom = nil;
}
[view mas_makeConstraints:^(MASConstraintMaker *make) {
self.scrollBottom = make.bottom.equalTo(viewtc).offset(10);
}];
}
-(void)drawItemTextView:(UIView *)view value:(NSString *)value back:(StartZNXZSiLuViewDrawEndBack)backvalue
{
[view setBackgroundColor:RGBCOLOR(240, 241, 254)];
[view.layer setMasksToBounds:YES];
[view.layer setCornerRadius:12];
[viewtc setBackgroundColor:RGBCOLOR(240, 241, 254)];
[viewtc.layer setMasksToBounds:YES];
[viewtc.layer setCornerRadius:12];
ViewLable *lbwz = [[ViewLable alloc] init];
[view addSubview:lbwz];
[viewtc addSubview:lbwz];
[lbwz mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.offset(10);
make.right.equalTo(view).offset(-10);
make.right.equalTo(viewtc).offset(-10);
}];
lbwz.textColor = RGBCOLOR(109, 109, 109);
lbwz.textFont = [UIFont systemFontOfSize:16];
lbwz.fspeed = 0.02;
lbwz.strValue = value;
[lbwz setBackHeight:^(float fheight, BOOL isend) {
if(isend)
{
backvalue(nil);
}
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];
}
}
}];
[view mas_makeConstraints:^(MASConstraintMaker *make) {
[viewtc mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(lbwz).offset(10);
}];
}
///scrollview
if(self.scvBottom)
{
[self.scvBottom uninstall];
}
[view mas_makeConstraints:^(MASConstraintMaker *make) {
self.scvBottom = make.bottom.equalTo(viewtc).offset(10);
}];
return lbwz;
}
-(void)bottomAction:(UIButton *)sender
{
@ -284,12 +244,12 @@ typedef void(^StartZNXZSiLuViewDrawEndBack)(UIView *viewlast);
self.isdrawEnd = NO;
[self.scvback removeFromSuperview];
self.scvback = nil;
self.scrollBottom = nil;
[self drawInfoView:self.viewback];
///
[self getdata:@"write_outline" title_id:@""];
}
else
{///(45*1.028+7)*x 53 61 69 77 86 95 104 113 123 133 143 154 165 176
///3 1 1
{///
StartPayViewController *vc = [StartPayViewController new];
[self.viewController.navigationController pushViewController:vc animated:YES];
}
@ -304,4 +264,182 @@ typedef void(^StartZNXZSiLuViewDrawEndBack)(UIView *viewlast);
{
self.isDragging = NO;
}
-(void)setModelTitle:(ExampleWriteListDataItems *)modelTitle
{
_modelTitle = modelTitle;
[self.lbname setText:[NSString stringWithFormat:@"%@、智能写作、%@、%@",self.strtitle,self.modelTitle.title,[self.arrRequire componentsJoinedByString:@"、"]]];
[self getdata:@"write_outline" title_id:self.modelTitle.ID];
}
-(void)getdata:(NSString *)scenct title_id:(NSString *)title_id
{
[self nomoData];
[self drawInfoView:self.viewback];
[[SSENetWorkManager shareManager] requestTo:[NSString stringWithFormat:@"https://aiw.batiao8.com/api/chat?scene=%@",scenct] stage:self.strtitle title:self.modelTitle.title require:[self.arrRequire componentsJoinedByString:@"、"] title_id:title_id config:^(SSEConfigModel * _Nonnull config) {
self.modelConfig = config;
} backValue:^(NSString * _Nonnull value, BOOL isfinish) {
// NSLog(@"%@",value);
if(value.length>10)
{
[self chuliShuJu:value isfinish:NO];
}
else
{
if(isfinish)
{
[self chuliShuJu:value isfinish:YES];
}
}
} error:^(NSString * _Nonnull errorString) {
[HXHud showMessage:errorString afterDelayType:0];
} ID:^(NSString * _Nonnull value) {
}];
}
-(void)nomoData
{
self.arrDraw = [NSMutableArray new];
self.iDraw = 0;
self.viewDarwLast = nil;
self.isStartDrawText = NO;
NSArray *arrt = @[@"题材",@"开头",@"中间",@"结尾"];
for(NSString *str in arrt)
{
SSEDrawModel *model = [SSEDrawModel new];
model.title = str;
model.arrViewLable = [NSMutableArray new];
[self.arrDraw addObject:model];
}
}
-(void)chuliShuJu:(NSString *)value isfinish:(BOOL)isfinish
{
if(isfinish)
{
for(SSEDrawModel *model in self.arrDraw)
{
model.isaddEnd = YES;
}
}
else
{
NSString *strshow = [value stringByReplacingOccurrencesOfString:@"# 题材" withString:@""];
strshow = [strshow stringByReplacingOccurrencesOfString:@"#题材" withString:@""];
strshow = [strshow stringByReplacingOccurrencesOfString:@"# 开头" withString:@"|&&|"];
strshow = [strshow stringByReplacingOccurrencesOfString:@"#开头" withString:@"|&&|"];
strshow = [strshow stringByReplacingOccurrencesOfString:@"# 中间段落" withString:@"|&&|"];
strshow = [strshow stringByReplacingOccurrencesOfString:@"#中间段落" withString:@"|&&|"];
strshow = [strshow stringByReplacingOccurrencesOfString:@"# 结尾" withString:@"|&&|"];
strshow = [strshow stringByReplacingOccurrencesOfString:@"#结尾" withString:@"|&&|"];
strshow = [strshow stringByReplacingOccurrencesOfString:@"#" withString:@"|&&|"];
NSArray *arrtt = [strshow componentsSeparatedByString:@"|&&|"];
SSEDrawModel *modellast;
for(int i = 0 ; i < arrtt.count;i++)
{
NSString *str = arrtt[i];
if([str rangeOfString:@"*"].length==0)break;
if(i>=self.arrDraw.count||str.length==0)break;
SSEDrawModel *model = self.arrDraw[i];
NSArray *arrson;
if([str rangeOfString:@"* "].length>0)
{
arrson = [str componentsSeparatedByString:@"* "];
}
else
{
arrson = [str componentsSeparatedByString:@"*"];
}
NSMutableArray *arrvalue = [NSMutableArray arrayWithArray:arrson];
[arrvalue removeObject:@""];
[arrvalue removeObject:@"\n"];
model.arrSon = arrvalue;
if(i>0)
{
if(arrvalue.count>0)
{
modellast.isaddEnd = YES;
}
}
modellast = model;
}
}
dispatch_async(dispatch_get_main_queue(), ^{
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];
}
});
}
-(void)drawTextInfo
{
if(self.iDraw>=self.arrDraw.count)
{
[self.timerDraw invalidate];
self.timerDraw = nil;
self.isdrawEnd = YES;
return;
}
SSEDrawModel *model = self.arrDraw[self.iDraw];
if(model.isDrawTitle==NO)
{
///
UIView *viewtc = [self drawSubItemsView:self.scvback title:model.title lastview:self.viewDarwLast];
model.isDrawTitle = YES;
self.viewDarwLast = viewtc;
model.idrawtag = 0;
}
///
ViewLable *lbwz;
if(model.arrViewLable.count<=model.idrawtag)
{
lbwz = [self drawSUbItemView:self.scvback lastview:self.viewDarwLast];
if(self.modelConfig.time.intValue>0)
{
lbwz.fspeed = self.modelConfig.time.intValue/1000.0;
}
[model.arrViewLable addObject:lbwz];
[lbwz setBackHeight:^(float fheight, BOOL isend) {
if(isend)
{
model.idrawtag +=1;
if(model.idrawtag>=model.arrSon.count)
{
self.iDraw+=1;
}
}
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];
}
}
}];
}
else
{
lbwz = model.arrViewLable[model.idrawtag];
}
if(model.arrSon.count-1>model.idrawtag||self.isdrawEnd==YES||self.iDraw>=self.arrDraw.count || model.isaddEnd==YES)
{
lbwz.isWriteEnd = YES;
}
lbwz.strValue = model.arrSon[model.idrawtag];
self.viewDarwLast = lbwz.superview;
}
@end

View File

@ -423,6 +423,7 @@
_modelDetailYDY = modelDetailYDY;
self.lbwz.strValue = modelDetailYDY.content;
self.lbwz.isWriteEnd = YES;
}
-(void)zhankaiAction:(UIButton *)sender
{

View File

@ -237,6 +237,7 @@ typedef void(^backenddraw)(void);
lbwz.textFont = [UIFont systemFontOfSize:15];
lbwz.fspeed = 0.02;
lbwz.strValue = value;
lbwz.isWriteEnd = YES;
[lbwz setBackHeight:^(float fheight, BOOL isend) {
if(isend)
{
@ -291,6 +292,7 @@ typedef void(^backenddraw)(void);
lbwz.textFont = [UIFont systemFontOfSize:15];
lbwz.fspeed = 0.02;
lbwz.strValue = strkt;
lbwz.isWriteEnd = YES;
[lbwz setBackHeight:^(float fheight, BOOL isend) {
if(isend)
{
@ -353,6 +355,7 @@ typedef void(^backenddraw)(void);
lbwz.textFont = [UIFont systemFontOfSize:15];
lbwz.fspeed = 0.02;
lbwz.strValue = strkt;
lbwz.isWriteEnd = YES;
[lbwz setBackHeight:^(float fheight, BOOL isend) {
if(isend)
{
@ -395,6 +398,7 @@ typedef void(^backenddraw)(void);
lbwz.textFont = [UIFont systemFontOfSize:14];
lbwz.fspeed = 0.02;
lbwz.strValue = self.modelResult.outline;
lbwz.isWriteEnd = YES;
__block MASConstraint *bottominfo;
[lbwz setBackHeight:^(float fheight, BOOL isend) {
if(isend)

View File

@ -82,6 +82,7 @@
lbwz.textFont = [UIFont systemFontOfSize:14];
lbwz.fspeed = 0.02;
lbwz.strValue = self.model.review_content;
lbwz.isWriteEnd = YES;
__strong ViewLable *lbwzself = lbwz;
__block MASConstraint *bottominfo;
[lbwz setBackHeight:^(float fheight, BOOL isend) {
@ -131,6 +132,7 @@
lbwz.textFont = [UIFont systemFontOfSize:14];
lbwz.fspeed = 0.02;
lbwz.strValue = [NSString stringWithFormat:@" %@",value];
lbwz.isWriteEnd = YES;
__strong ViewLable *lbwzself = lbwz;
__block MASConstraint *bottominfo;
[lbwz setBackHeight:^(float fheight, BOOL isend) {

View File

@ -120,6 +120,7 @@
lbwz.textFont = [UIFont systemFontOfSize:14];
lbwz.fspeed = 0.02;
lbwz.strValue = self.modelResult.complex_review.full_review.review_content;
lbwz.isWriteEnd = YES;
__strong ViewLable *lbwzself = lbwz;
__block MASConstraint *bottominfo;
[lbwz setBackHeight:^(float fheight, BOOL isend) {
@ -168,6 +169,7 @@
lbwz.textFont = [UIFont systemFontOfSize:14];
lbwz.fspeed = 0.02;
lbwz.strValue = [NSString stringWithFormat:@" %@",value];
lbwz.isWriteEnd = YES;
__strong ViewLable *lbwzself = lbwz;
__block MASConstraint *bottominfo;
[lbwz setBackHeight:^(float fheight, BOOL isend) {

View File

@ -129,6 +129,7 @@
lbwz.textFont = [UIFont systemFontOfSize:16];
lbwz.fspeed = 0.02;
lbwz.strValue = @" 你的作文非常出色,但是可以在语言表达上更加生动有趣,增加一些形象的比喻和细节描写,让读者更加深入地了解你的思考和感受。同时,可以适当增加一些个人的经历和感受,让作文更加具有个性化和独特性。";
lbwz.isWriteEnd = YES;
__strong ViewLable *lbwzSelf = lbwz;
__block MASConstraint *bottomScroll;
[lbwz setBackHeight:^(float fheight, BOOL isend) {
@ -180,6 +181,7 @@
self.isdrawEnd = NO;
ViewLable *lbwz = self.arrItems[sender.tag];
lbwz.strValue = @" 1233222222222你的作文非常出色但是可以在语言表达上更加生动有趣增加一些形象的比喻和细节描写让读者更加深入地了解你的思考和感受。同时可以适当增加一些个人的经历和感受让作文更加具有个性化和独特性。";
lbwz.isWriteEnd = YES;
[lbwz setBackHeight:^(float fheight, BOOL isend) {
if(isend)
{

View File

@ -114,6 +114,7 @@
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) {
@ -209,6 +210,7 @@
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)
{

View File

@ -151,6 +151,7 @@ typedef void(^ChuangZuoSiLuViewDraw)(void);
///
ViewLable *lbticai = [self drawItem:view lastview:viewtop];
lbticai.strValue = @"以我心中的英雄--杨利伟为例,讲述他的热爱祖国的事迹。";
lbticai.isWriteEnd = YES;
[lbticai setBackHeight:^(float fheight, BOOL isend) {
if(isend)
{///
@ -161,6 +162,7 @@ typedef void(^ChuangZuoSiLuViewDraw)(void);
ViewLable *lbticai1 = [self drawItem:view lastview:lbticai.superview];
lbticai1.strValue = @"以我心中的英雄--杨利伟为例,讲述他的热爱祖国的事迹。";
lbticai1.isWriteEnd = YES;
[lbticai1 setBackHeight:^(float fheight, BOOL isend) {
if(isend)
{///
@ -180,6 +182,7 @@ typedef void(^ChuangZuoSiLuViewDraw)(void);
{
ViewLable *lbticai = [self drawItem:view lastview:[self drawItemView:view title:title]];
lbticai.strValue = @"以我心中的英雄--杨利伟为例,讲述他的热爱祖国的事迹。";
lbticai.isWriteEnd = YES;
[lbticai setBackHeight:^(float fheight, BOOL isend) {
if(isend)
{

View File

@ -137,6 +137,7 @@
{
_strvalue = strvalue;
self.lbwz.strValue = strvalue;
self.lbwz.isWriteEnd = YES;
}
-(void)nextAction

View File

@ -98,6 +98,7 @@
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) {
@ -194,6 +195,7 @@
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)
{