diff --git a/ProductApp/ProductApp.xcodeproj/project.pbxproj b/ProductApp/ProductApp.xcodeproj/project.pbxproj index 1ef7bf6..190f89e 100644 --- a/ProductApp/ProductApp.xcodeproj/project.pbxproj +++ b/ProductApp/ProductApp.xcodeproj/project.pbxproj @@ -231,6 +231,13 @@ CA8181B02C9EB96000EE7E6E /* StartKTXZPGDetailFJView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA8181AF2C9EB96000EE7E6E /* StartKTXZPGDetailFJView.m */; }; CA8181B32C9EB96F00EE7E6E /* StartKTXZPGDetailXZView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA8181B22C9EB96F00EE7E6E /* StartKTXZPGDetailXZView.m */; }; CA8181B62C9ECB5800EE7E6E /* StartKTXZPGDetailFJItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA8181B52C9ECB5800EE7E6E /* StartKTXZPGDetailFJItemView.m */; }; + CA8EE5172CC88B22009D73E3 /* ExamplePptModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA8EE5162CC88B22009D73E3 /* ExamplePptModel.m */; }; + CA8EE51A2CC89319009D73E3 /* ExamplePptDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA8EE5192CC89319009D73E3 /* ExamplePptDetailModel.m */; }; + CA8EE51D2CC8C835009D73E3 /* TongYiXieYiAlterView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA8EE51C2CC8C835009D73E3 /* TongYiXieYiAlterView.m */; }; + CA8EE5202CC8C89E009D73E3 /* NomoVerbAlterView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA8EE51F2CC8C89E009D73E3 /* NomoVerbAlterView.m */; }; + CA8EE5232CC8C914009D73E3 /* PayManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CA8EE5222CC8C914009D73E3 /* PayManager.m */; }; + CA8EE5262CC8C920009D73E3 /* VistaInAppPurchaseManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CA8EE5252CC8C920009D73E3 /* VistaInAppPurchaseManager.m */; }; + CA8EE5292CC905BD009D73E3 /* NomoAlterView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA8EE5272CC905BD009D73E3 /* NomoAlterView.m */; }; CAA600CD2CA92FB700026CF4 /* FXErView.m in Sources */ = {isa = PBXBuildFile; fileRef = CAA600CC2CA92FB700026CF4 /* FXErView.m */; }; CAA600D12CA9565500026CF4 /* KeTangXieZuoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CAA600D02CA9565500026CF4 /* KeTangXieZuoViewController.m */; }; CAA600D52CA9579800026CF4 /* KeTangXieZuoCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = CAA600D42CA9579800026CF4 /* KeTangXieZuoCollectionViewCell.m */; }; @@ -899,6 +906,20 @@ CA8181B22C9EB96F00EE7E6E /* StartKTXZPGDetailXZView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StartKTXZPGDetailXZView.m; sourceTree = ""; }; CA8181B42C9ECB5800EE7E6E /* StartKTXZPGDetailFJItemView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StartKTXZPGDetailFJItemView.h; sourceTree = ""; }; CA8181B52C9ECB5800EE7E6E /* StartKTXZPGDetailFJItemView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StartKTXZPGDetailFJItemView.m; sourceTree = ""; }; + CA8EE5152CC88B22009D73E3 /* ExamplePptModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExamplePptModel.h; sourceTree = ""; }; + CA8EE5162CC88B22009D73E3 /* ExamplePptModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExamplePptModel.m; sourceTree = ""; }; + CA8EE5182CC89319009D73E3 /* ExamplePptDetailModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExamplePptDetailModel.h; sourceTree = ""; }; + CA8EE5192CC89319009D73E3 /* ExamplePptDetailModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExamplePptDetailModel.m; sourceTree = ""; }; + CA8EE51B2CC8C835009D73E3 /* TongYiXieYiAlterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TongYiXieYiAlterView.h; sourceTree = ""; }; + CA8EE51C2CC8C835009D73E3 /* TongYiXieYiAlterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TongYiXieYiAlterView.m; sourceTree = ""; }; + CA8EE51E2CC8C89D009D73E3 /* NomoVerbAlterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NomoVerbAlterView.h; sourceTree = ""; }; + CA8EE51F2CC8C89E009D73E3 /* NomoVerbAlterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NomoVerbAlterView.m; sourceTree = ""; }; + CA8EE5212CC8C914009D73E3 /* PayManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PayManager.h; sourceTree = ""; }; + CA8EE5222CC8C914009D73E3 /* PayManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PayManager.m; sourceTree = ""; }; + CA8EE5242CC8C91F009D73E3 /* VistaInAppPurchaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VistaInAppPurchaseManager.h; sourceTree = ""; }; + CA8EE5252CC8C920009D73E3 /* VistaInAppPurchaseManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VistaInAppPurchaseManager.m; sourceTree = ""; }; + CA8EE5272CC905BD009D73E3 /* NomoAlterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NomoAlterView.m; sourceTree = ""; }; + CA8EE5282CC905BD009D73E3 /* NomoAlterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NomoAlterView.h; sourceTree = ""; }; CAA600CB2CA92FB700026CF4 /* FXErView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FXErView.h; sourceTree = ""; }; CAA600CC2CA92FB700026CF4 /* FXErView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FXErView.m; sourceTree = ""; }; CAA600CF2CA9565500026CF4 /* KeTangXieZuoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeTangXieZuoViewController.h; sourceTree = ""; }; @@ -1857,6 +1878,12 @@ CA3868682CC211FE009C98B0 /* LoadAlterView.m */, CA07CD122CC5E5C500AF41ED /* XieYiAlterView.h */, CA07CD132CC5E5C500AF41ED /* XieYiAlterView.m */, + CA8EE51B2CC8C835009D73E3 /* TongYiXieYiAlterView.h */, + CA8EE51C2CC8C835009D73E3 /* TongYiXieYiAlterView.m */, + CA8EE51E2CC8C89D009D73E3 /* NomoVerbAlterView.h */, + CA8EE51F2CC8C89E009D73E3 /* NomoVerbAlterView.m */, + CA8EE5282CC905BD009D73E3 /* NomoAlterView.h */, + CA8EE5272CC905BD009D73E3 /* NomoAlterView.m */, ); path = alter; sourceTree = ""; @@ -2889,6 +2916,10 @@ CA07CD1F2CC6572E00AF41ED /* WebSocketManager.m */, CA07CD212CC6601500AF41ED /* SSENetWorkManager.h */, CA07CD222CC6601500AF41ED /* SSENetWorkManager.m */, + CA8EE5242CC8C91F009D73E3 /* VistaInAppPurchaseManager.h */, + CA8EE5252CC8C920009D73E3 /* VistaInAppPurchaseManager.m */, + CA8EE5212CC8C914009D73E3 /* PayManager.h */, + CA8EE5222CC8C914009D73E3 /* PayManager.m */, ); path = NetWorkManager; sourceTree = ""; @@ -3000,6 +3031,10 @@ CA10DF972CC74FC70094FEEE /* SSEConfigModel.m */, CA10DF9C2CC7AC040094FEEE /* ExamplePicModel.h */, CA10DF9D2CC7AC040094FEEE /* ExamplePicModel.m */, + CA8EE5152CC88B22009D73E3 /* ExamplePptModel.h */, + CA8EE5162CC88B22009D73E3 /* ExamplePptModel.m */, + CA8EE5182CC89319009D73E3 /* ExamplePptDetailModel.h */, + CA8EE5192CC89319009D73E3 /* ExamplePptDetailModel.m */, ); path = models; sourceTree = ""; @@ -4399,6 +4434,7 @@ CAC806562CA1382500C21AA7 /* StartZNXZView.m in Sources */, CA07CD1D2CC646AA00AF41ED /* ExampleWriteList.m in Sources */, CA4257BD2CA2C65600A36A10 /* StartPayTQViewCell.m in Sources */, + CA8EE5202CC8C89E009D73E3 /* NomoVerbAlterView.m in Sources */, CABD8CA72CBFA7A3009A5E5E /* GongJuImageToTextView.m in Sources */, CA5D03272CC0DDF0007B3BA5 /* PayPublicView.m in Sources */, CA5D02A82CC0B2DE007B3BA5 /* ZhangHuGuanLiAlterView.m in Sources */, @@ -4478,6 +4514,7 @@ CA5D03682CC0DE8D007B3BA5 /* YouHuiQuanDuiHuanView.m in Sources */, CAA600D92CA95AAC00026CF4 /* KeTangXieZuoNJViewController.m in Sources */, CA0C3AB92CB51D5900E01A72 /* ZhiNengPPTCollectionViewCell.m in Sources */, + CA8EE5262CC8C920009D73E3 /* VistaInAppPurchaseManager.m in Sources */, CAF76E692CBE0A1C00825E5E /* ToolsTypeModel.m in Sources */, CB489F8D2744A0BD00DA044A /* NaviGationView.m in Sources */, CB489F9C2744A0BD00DA044A /* LogTableViewCell.m in Sources */, @@ -4528,6 +4565,7 @@ CB489F512744A0BD00DA044A /* PGJSearchView.m in Sources */, CABD8C952CBF974E009A5E5E /* GongJuFanYiView.m in Sources */, CA5D02A42CC0B2DE007B3BA5 /* ImageCollectionViewCell.m in Sources */, + CA8EE5232CC8C914009D73E3 /* PayManager.m in Sources */, CA0D084F2CA53B970086855E /* ShouYeLingYuViewController.m in Sources */, CA0D087C2CA55BB80086855E /* ShouYeLiShiJiLuPPTTableViewCell.m in Sources */, CA8181B02C9EB96000EE7E6E /* StartKTXZPGDetailFJView.m in Sources */, @@ -4562,6 +4600,7 @@ CA0D085D2CA543EE0086855E /* ShouYeZCXZTableViewCell.m in Sources */, CA0FD6A82CA900E2009A4417 /* FXTextView.m in Sources */, CA0D086D2CA548F70086855E /* ShouYeLiShiJiLuPPTTableViewController.m in Sources */, + CA8EE5292CC905BD009D73E3 /* NomoAlterView.m in Sources */, CA487D932CA4055B00AE773B /* StartPayGoodsCollectionViewCell.m in Sources */, CA4257B62CA2BBB000A36A10 /* StartPayView.m in Sources */, CB489DDB27449D5D00DA044A /* main.m in Sources */, @@ -4618,12 +4657,14 @@ CB489F982744A0BD00DA044A /* BaseModel.m in Sources */, CA4257B92CA2C42E00A36A10 /* StartPayTQView.m in Sources */, CAA600D52CA9579800026CF4 /* KeTangXieZuoCollectionViewCell.m in Sources */, + CA8EE5172CC88B22009D73E3 /* ExamplePptModel.m in Sources */, CB489F9B2744A0BD00DA044A /* YSAPIClient.m in Sources */, CB489F822744A0BD00DA044A /* NSData+Base64.m in Sources */, CA3868692CC211FE009C98B0 /* LoadAlterView.m in Sources */, CB489FA62744A0BD00DA044A /* ZJScrollSegmentView.m in Sources */, CA5D035D2CC0DE8D007B3BA5 /* TiXianViewController.m in Sources */, CA0D08332CA4FFB90086855E /* ShouYeBannerTableViewCell.m in Sources */, + CA8EE51D2CC8C835009D73E3 /* TongYiXieYiAlterView.m in Sources */, CAA600CD2CA92FB700026CF4 /* FXErView.m in Sources */, CA5D03122CC0DDF0007B3BA5 /* PayPublicYouHuiTableViewCell.m in Sources */, CA0C3A872CB4C34800E01A72 /* HuanGeSiLuView.m in Sources */, @@ -4633,6 +4674,7 @@ CA3868572CC1F66E009C98B0 /* LoginAppleView.m in Sources */, CAC806642CA151ED00C21AA7 /* StartZNXZSiLuViewController.m in Sources */, CB489F962744A0BD00DA044A /* SmsloginCodeModel.m in Sources */, + CA8EE51A2CC89319009D73E3 /* ExamplePptDetailModel.m in Sources */, CA0D08612CA547C60086855E /* ShouYeLiShiJiLuViewController.m in Sources */, CA11ED642CA6851200209DFC /* CamreTiShiAlterView.m in Sources */, CB489F712744A0BD00DA044A /* RootTabBarController.m in Sources */, diff --git a/ProductApp/ProductApp.xcworkspace/xcuserdata/gongzuo.xcuserdatad/UserInterfaceState.xcuserstate b/ProductApp/ProductApp.xcworkspace/xcuserdata/gongzuo.xcuserdatad/UserInterfaceState.xcuserstate index 265ba73..f01aa69 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 d38a636..e4a239c 100644 --- a/ProductApp/ProductApp.xcworkspace/xcuserdata/gongzuo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/ProductApp/ProductApp.xcworkspace/xcuserdata/gongzuo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -14,8 +14,8 @@ filePath = "ProductApp/ProductMain/引导/智能PPT/StartZNPPTViewController.m" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "69" - endingLineNumber = "69" + startingLineNumber = "82" + endingLineNumber = "82" landmarkName = "-getpasteInfo" landmarkType = "7"> @@ -30,8 +30,8 @@ filePath = "ProductApp/ProductMain/引导/智能PPT/StartZNPPTViewController.m" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "66" - endingLineNumber = "66" + startingLineNumber = "79" + endingLineNumber = "79" landmarkName = "-getpasteInfo" landmarkType = "7"> @@ -68,22 +68,6 @@ landmarkType = "7"> - - - - +#import + + +@interface AppDelegate () @end @@ -57,6 +61,9 @@ [IFlySpeechUtility createUtility:initString]; + [WXApi registerApp:WeiXinAPPID universalLink:WeiXinUrlLink]; + + ///禁止黑暗模式 #if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 if(@available(iOS 13.0,*)){ @@ -103,6 +110,74 @@ self.window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight; // }); } - +-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options +{ + if ([url.host isEqualToString:@"safepay"]) + { + // 支付跳转支付宝钱包进行支付,处理支付结果 + [[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) { + [[NSNotificationCenter defaultCenter] postNotificationName:ZhiFuBaoPayNotifi object:resultDic]; + }]; + } +// if([MobClickLink handleLinkURL:url delegate:self]) +// { +// return YES; +// } + + return [WXApi handleOpenURL:url delegate:self]; +} +- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray> * __nullable restorableObjects))restorationHandler { + +// if([MobClickLink handleUniversalLink:userActivity delegate:self]) +// { +// return YES; +// } + + + return [WXApi handleOpenUniversalLink:userActivity delegate:self]; +} +-(void) onReq:(BaseReq*)reqonReq +{ + NSLog(@"111"); +} +-(void) onResp:(BaseResp*)resp +{ + if ([resp isKindOfClass: [SendAuthResp class]]) { + SendAuthResp* authResp = (SendAuthResp*)resp; + if (authResp.errCode == 0) { + // 用户确认授权,发送全局通知,处理逻辑 + [[NSNotificationCenter defaultCenter] postNotificationName: WeiXinDengLuSQ + object: authResp]; + } else { + // 用户取消授权,发送全局通知,处理逻辑 + [[NSNotificationCenter defaultCenter] postNotificationName: WeiXinDengLuSQ + object: nil]; + } + } + else if ([resp isKindOfClass:[PayResp class]]) + { + PayResp *response=(PayResp*)resp; + switch (response.errCode) { + case WXSuccess: + { + [[NSNotificationCenter defaultCenter] postNotificationName: WeiXinZhiFuSQ object: @"1"]; + } + break; + case WXErrCodeUserCancel: + { + [[NSNotificationCenter defaultCenter] postNotificationName: WeiXinZhiFuSQ object: @"-1"]; + [HXHud showMessage:response.errStr.length==0?@"用户取消支付":response.errStr afterDelayType:0]; + } + break; + default: + { + [[NSNotificationCenter defaultCenter] postNotificationName: WeiXinZhiFuSQ object: @"0"]; + [HXHud showMessage:response.errStr.length==0?@"用户取消支付":response.errStr afterDelayType:0]; + } + break; + } + } + +} @end diff --git a/ProductApp/ProductApp/Assets.xcassets/引导页/yd_doc.imageset/Contents.json b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_doc.imageset/Contents.json new file mode 100644 index 0000000..599f74c --- /dev/null +++ b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_doc.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "组@2x(1).png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "组@3x(1).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ProductApp/ProductApp/Assets.xcassets/引导页/yd_doc.imageset/组@2x(1).png b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_doc.imageset/组@2x(1).png new file mode 100644 index 0000000..6520a22 Binary files /dev/null and b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_doc.imageset/组@2x(1).png differ diff --git a/ProductApp/ProductApp/Assets.xcassets/引导页/yd_doc.imageset/组@3x(1).png b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_doc.imageset/组@3x(1).png new file mode 100644 index 0000000..35e8084 Binary files /dev/null and b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_doc.imageset/组@3x(1).png differ diff --git a/ProductApp/ProductApp/Assets.xcassets/引导页/yd_docx.imageset/Contents.json b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_docx.imageset/Contents.json new file mode 100644 index 0000000..2cc4fb5 --- /dev/null +++ b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_docx.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "组@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "组@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ProductApp/ProductApp/Assets.xcassets/引导页/yd_docx.imageset/组@2x.png b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_docx.imageset/组@2x.png new file mode 100644 index 0000000..402e7ec Binary files /dev/null and b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_docx.imageset/组@2x.png differ diff --git a/ProductApp/ProductApp/Assets.xcassets/引导页/yd_docx.imageset/组@3x.png b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_docx.imageset/组@3x.png new file mode 100644 index 0000000..3538bce Binary files /dev/null and b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_docx.imageset/组@3x.png differ diff --git a/ProductApp/ProductApp/Assets.xcassets/引导页/yd_pdf.imageset/Contents.json b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_pdf.imageset/Contents.json new file mode 100644 index 0000000..f9a50ef --- /dev/null +++ b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_pdf.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "组 44073@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "组 44073@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ProductApp/ProductApp/Assets.xcassets/引导页/yd_pdf.imageset/组 44073@2x.png b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_pdf.imageset/组 44073@2x.png new file mode 100644 index 0000000..89054cb Binary files /dev/null and b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_pdf.imageset/组 44073@2x.png differ diff --git a/ProductApp/ProductApp/Assets.xcassets/引导页/yd_pdf.imageset/组 44073@3x.png b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_pdf.imageset/组 44073@3x.png new file mode 100644 index 0000000..f2582dd Binary files /dev/null and b/ProductApp/ProductApp/Assets.xcassets/引导页/yd_pdf.imageset/组 44073@3x.png differ diff --git a/ProductApp/ProductApp/BaseControl/Category/UITableView+MoveCell.m b/ProductApp/ProductApp/BaseControl/Category/UITableView+MoveCell.m index 06c1d4c..a62267b 100644 --- a/ProductApp/ProductApp/BaseControl/Category/UITableView+MoveCell.m +++ b/ProductApp/ProductApp/BaseControl/Category/UITableView+MoveCell.m @@ -217,7 +217,14 @@ } }else{ - [self.dataArray exchangeObjectAtIndex:self.indexPath.row withObjectAtIndex:moveIndexPath.row]; + @try { + [self.dataArray exchangeObjectAtIndex:self.indexPath.row withObjectAtIndex:moveIndexPath.row]; + } @catch (NSException *exception) { + + } @finally { + + } + } self.block(self.dataArray); diff --git a/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.h b/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.h index 9522693..8c16202 100644 --- a/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.h +++ b/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.h @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN #define UserInfoModelConfig @"UserInfoModelConfig" #define UserInfoModelTemp @"UserInfoModelTemp" - +@class RoleTreeModelData; @interface UserInfoModel : NSObject +(UserInfoModel *)shareModel; ///登录状态 1已登录 @@ -45,14 +45,20 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic , strong) NSString *vip; @property (nonatomic , assign) BOOL isloadconfig; -///领域1教育 2职场 -@property (nonatomic , strong) NSString *lingyu; -///1学生 2家长 3老师 -@property (nonatomic , strong) NSString *shenfen; +/////领域1教育 2职场 +//@property (nonatomic , strong) NSString *lingyu; +/////1学生 2家长 3老师 +//@property (nonatomic , strong) NSString *shenfen; ///余额 @property (nonatomic , strong) NSString *balance; +///年级是否全选 +@property (nonatomic , strong) NSString *isAllLevel; +///0学生 1家长 2老师 3职场 +@property (nonatomic , strong) NSString *identityType; +@property (nonatomic , strong) RoleTreeModelData *user_stage; + +(void)setLoingState:(NSString *)value; +(void)setToken:(NSString *)value; +(void)setName:(NSString *)value; @@ -78,6 +84,8 @@ NS_ASSUME_NONNULL_BEGIN +(BOOL)PayWXQuanXian; ///获取系统的支付fs +(NSMutableArray *)getSyetemPay; +///根据身份获取字符串 ++(NSString *)getidentityTypeString; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.m b/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.m index c4152d9..a2cfdec 100644 --- a/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.m +++ b/ProductApp/ProductApp/BaseControl/UserInfo/UserInfoModel.m @@ -230,4 +230,31 @@ static UserInfoModel *userinfo; return arrcc; } +///根据身份获取字符串 ++(NSString *)getidentityTypeString +{ + NSString *str = @"学生"; + + switch ([UserInfoModel shareModel].identityType.intValue) { + case 1: + { + str = @"家长"; + } + break; + case 2: + { + str = @"老师"; + } + break; + case 3: + { + str = @"上班族"; + } + break; + default: + break; + } + + return str; +} @end diff --git a/ProductApp/ProductApp/Configure/ConfigireSetting.h b/ProductApp/ProductApp/Configure/ConfigireSetting.h index 240610b..cca68ff 100644 --- a/ProductApp/ProductApp/Configure/ConfigireSetting.h +++ b/ProductApp/ProductApp/Configure/ConfigireSetting.h @@ -27,6 +27,16 @@ NS_ASSUME_NONNULL_BEGIN #define WeiXinStringPay @"5b6u5L+h5pSv5LuY" #define ZhiFuBaoStringPay @"5pSv5LuY5a6d5pSv5LuY" +///zfb +#define ZhiFuBaoPayNotifi @"ZhiFuBaoPayNotifi" +#define WeiXinDengLuSQ @"WeiXinDengLuSQ" ///登录 +#define WeiXinZhiFuSQ @"WeiXinZhiFuSQ" ///支付 + + +#define WeiXinAPPID @"wx31efd88bd33ae068" +#define WeiXinUrlLink @"https://aiw.batiao8.com/ulink/" + + /// 个推开发者网站中申请App时,注册的AppId、AppKey、AppSecret #define kGtAppId @"bgxjUoVnGE65VaJLpy40T6" #define kGtAppKey @"o20R2nHKevAixnfCD66ZO9" @@ -119,9 +129,6 @@ alpha:alphaValue] #define UserYinSiUrl @"" #define UserXieUrl @"" -///微信登录通知 -#define WeiXinDengLuSQ @"WeiXinDengLuSQ" - ///协议弹窗 #define UserXieYiOk @"UserXieYiOk" diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.h b/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.h index 27d32a7..cc124ed 100644 --- a/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.h +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.h @@ -15,7 +15,7 @@ #import "ExampleCorrectList.h" #import "ExampleWriteList.h" #import "ExamplePicModel.h" - +#import "ExamplePptDetailModel.h" NS_ASSUME_NONNULL_BEGIN @@ -80,6 +80,24 @@ NS_ASSUME_NONNULL_BEGIN scene:(NSString *)scene Callback:(completeModeBlock)callback; +/* + 引导页ppt + /api/example/ppt + role_id + */ ++ (void)requestExamplePptData:(UIView *)view + Callback:(completeModeBlock)callback; + +/* + 引导页ppt详情 + /api/example/ppt/detail + id + */ ++ (void)requestExamplePptDetailData:(UIView *)view + ID:(NSString *)ID + Callback:(completeModeBlock)callback; + +#pragma mark - 工具 /* 工具类型 /api/tools/type @@ -113,6 +131,35 @@ NS_ASSUME_NONNULL_BEGIN query:(NSString *)query Callback:(completeModeBlock)callback; +/* + 收藏初始化 + /api/tools/fav/init + */ ++ (void)requestToolsFavInitData:(UIView *)view + Callback:(completeModeBlock)callback; + +/* + 工具收藏列表 + /api/tools/fav + page + size + */ ++ (void)requestToolsFavData:(UIView *)view + page:(int)page + size:(NSString *)size + Callback:(completeModeBlock)callback; + +/* + 添加工具收藏 + /api/tools/fav + tool_id + type 0收藏 1取消 + */ ++ (void)requestToolsFavCollectData:(UIView *)view + type:(int)type + tool_id:(NSString *)tool_id + Callback:(completeModeBlock)callback; + /* 语言列表key分组 /api/translate/language/key diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.m b/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.m index 8fa07f1..ee0a158 100644 --- a/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.m +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/NetWorkManager.m @@ -230,7 +230,75 @@ } }]; } +/* + 引导页ppt + /api/example/ppt + role_id + */ ++ (void)requestExamplePptData:(UIView *)view + Callback:(completeModeBlock)callback +{ + NSMutableDictionary *dicQuery = [NSMutableDictionary new]; + + NSMutableDictionary *dicHeader = [NSMutableDictionary new]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + + [YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:1 url:@"api/example/ppt" 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,[ExamplePptModel yy_modelWithJSON:dicAll],describle); + } + }]; +} +/* + 引导页ppt详情 + /api/example/ppt/detail + id + */ ++ (void)requestExamplePptDetailData:(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/example/ppt/detail" 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,[ExamplePptDetailModel yy_modelWithJSON:dicAll],describle); + } + }]; +} + +#pragma mark - 工具 /* 工具类型 @@ -347,6 +415,123 @@ } }]; } +/* + 收藏初始化 + /api/tools/fav/init + */ ++ (void)requestToolsFavInitData:(UIView *)view + Callback:(completeModeBlock)callback +{ + NSMutableDictionary *dicQuery = [NSMutableDictionary new]; + + NSMutableDictionary *dicHeader = [NSMutableDictionary new]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + + [YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:2 url:@"api/tools/fav/init" 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); + } + }]; +} + +/* + 工具收藏列表 + /api/tools/fav + page + size + */ ++ (void)requestToolsFavData:(UIView *)view + page:(int)page + size:(NSString *)size + Callback:(completeModeBlock)callback +{ + NSMutableDictionary *dicQuery = [NSMutableDictionary new]; + [dicQuery setObject:[NSString stringWithFormat:@"%d",page] forKey:@"page"]; + [dicQuery setObject:size forKey:@"size"]; + + NSMutableDictionary *dicHeader = [NSMutableDictionary new]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + + [YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:1 url:@"api/tools/fav" 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,[ToolsListModel yy_modelWithJSON:dicAll],describle); + } + }]; +} +/* + 添加工具收藏 + /api/tools/fav + tool_id + type 0收藏 1取消 + */ ++ (void)requestToolsFavCollectData:(UIView *)view + type:(int)type + tool_id:(NSString *)tool_id + Callback:(completeModeBlock)callback +{ + NSMutableDictionary *dicQuery = [NSMutableDictionary new]; + + + NSMutableDictionary *dicHeader = [NSMutableDictionary new]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + + int pushtype = 2; + if(type==1) + { + pushtype = 4; + [dicQuery setObject:[Tools isStringnil:tool_id] forKey:@"tool_id"]; + } + else + { + [dicpush setObject:[Tools isStringnil:tool_id] forKey:@"tool_id"]; + } + + [YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:pushtype url:@"api/tools/fav" 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); + } + }]; +} + /* 语言列表key分组 diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/PayManager.h b/ProductApp/ProductApp/ProductMain/NetWorkManager/PayManager.h new file mode 100644 index 0000000..4f42636 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/PayManager.h @@ -0,0 +1,30 @@ +// +// PayManager.h +// ProductApp +// 支付管理工具 +// Created by 工作 on 2024/8/6. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@protocol PayManagerDelegate + +-(void)paySuccess; +-(void)payCancle; +-(void)payFaile; +-(void)goodsPrice:(NSArray *)product; +@end +@interface PayManager : NSObject +/// +@property (nonatomic , strong) NSString *orderId; +/// +@property (nonatomic , weak) iddelegate; ++(instancetype)sharedInstance; +///coupon 优惠券的ID,目前支持单个优惠券 +-(void)creatOrderGoodsid:(NSString *)goods_id pay_type:(NSString *)pay_type source:(NSString *)source extra:(NSDictionary *)extra applegoodsid:(NSString *)applegoodsid applegoodsNumber:(int)number coupon:(NSString *)coupon; +///获取所有苹果商品价格 +-(void)getGoodsPrice:(NSArray *)arr; +@end + +NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/PayManager.m b/ProductApp/ProductApp/ProductMain/NetWorkManager/PayManager.m new file mode 100644 index 0000000..7fff670 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/PayManager.m @@ -0,0 +1,350 @@ +// +// PayManager.m +// ProductApp +// +// Created by 工作 on 2024/8/6. +// + +#import "PayManager.h" +#import "PublicNetWorkManager.h" +#import +#import +#import "VistaInAppPurchaseManager.h" + +static PayManager *manager = nil; + +@interface PayManager () + + +/// +@property (nonatomic , strong) NSString *outTradeNo; +/// +@property (nonatomic , assign) int number; + +/// +@property (nonatomic , strong) VistaInAppPurchaseManager *payManager; + +/// +@property (nonatomic , strong) NSString *source; + +@property (nonatomic , assign) NSInteger orderNumber; + + +@end +@implementation PayManager ++(instancetype)sharedInstance{ + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + if (manager == nil) { + manager = [[PayManager alloc]init]; + } + + }); + return manager; +} +-(void)creatOrderGoodsid:(NSString *)goods_id pay_type:(NSString *)pay_type source:(NSString *)source extra:(NSDictionary *)extra applegoodsid:(NSString *)applegoodsid applegoodsNumber:(int)number coupon:(NSString *)coupon +{ + self.source = source; + self.number = number; + + [LoadAlterView show]; + [PublicNetWorkManager requestOrderData:nil goods_id:goods_id pay_type:pay_type source:source pay_source:@"app" coupon:coupon Callback:^(BOOL state, PayOrderModel *responseObject, NSString * _Nullable describle) { + if(state) + { + self.outTradeNo = responseObject.data.outTradeNo; + self.orderId = responseObject.data.orderId; + if([pay_type isEqualToString:@"weixin"]) + { + if([Tools isStringnil:responseObject.data.partnerId].length==0) + { + [self getOrderState]; + } + else + { + [self weixinPay:responseObject.data]; + } + } + else if([pay_type isEqualToString:@"alipay"]) + { + if([Tools isStringnil:responseObject.data.payParam].length==0) + { + [self getOrderState]; + } + else + { + [self zhifubaoPay:responseObject.data]; + } + } + else if([pay_type isEqualToString:@"balance"]) + { + [self getOrderState]; + } + else + { + [self applePay:@[[Tools isStringnil:applegoodsid]]]; + } + } + else + { + [LoadAlterView dismiss]; + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; +} + +#pragma mark - wx +-(void)weixinPay:(PayOrderModelData *)model +{ + + @try { + [[NSNotificationCenter defaultCenter] removeObserver:self name:WeiXinZhiFuSQ object:nil]; + } @catch (NSException *exception) { + + } @finally { + + } + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(weixinPayNotiti:) name:WeiXinZhiFuSQ object:nil]; + [LoadAlterView dismiss]; + PayReq *request = [[PayReq alloc] init]; + request.partnerId = model.partnerId; + request.prepayId= model.prepayId; + request.package = model.package; + request.nonceStr= model.nonceStr; + request.timeStamp = model.timeStamp.intValue; + request.sign= model.sign; + [WXApi sendReq:request completion:^(BOOL success) { + }]; +} + +-(void)weixinPayNotiti:(NSNotification *)notifi +{ + if([notifi.object intValue] == 1) + {///支付成功 + [LoadAlterView show]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + self.orderNumber = 0; + [self getOrderState]; + }); + } + else if([notifi.object intValue] == -1) + {///用户取消 + if(self.delegate&&[self.delegate respondsToSelector:@selector(payCancle)]) + { + [self.delegate payCancle]; + } + } + else + { + [LoadAlterView dismiss]; + if(self.delegate&&[self.delegate respondsToSelector:@selector(payFaile)]) + { + [self.delegate payFaile]; + } + [UserInfoModel shijianShangBao:1 key:@"client.wxpay.err" value:@"" extra:@""]; + } +} +#pragma mark -zfb +-(void)zhifubaoPay:(PayOrderModelData *)model +{ + [LoadAlterView dismiss]; + @try { + [[NSNotificationCenter defaultCenter] removeObserver:self name:ZhiFuBaoPayNotifi object:nil]; + } @catch (NSException *exception) { + + } @finally { + + } + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(zhifubaoPayNotifi:) name:ZhiFuBaoPayNotifi object:nil]; + [[AlipaySDK defaultService] payOrder:model.payParam fromScheme:@"ailipayAIWrite" callback:^(NSDictionary *resultDic) { + [self zfbDic:resultDic]; + }]; +} + +-(void)zhifubaoPayNotifi:(NSNotification *)notifi +{ + NSDictionary *dic = notifi.object; + [self zfbDic:dic]; +} +-(void)zfbDic:(NSDictionary *)dic +{ + if([[dic objectForKey:@"resultStatus"] intValue] == 9000) + {///成功 + [LoadAlterView show]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + self.orderNumber = 0; + [self getOrderState]; + }); + } + else + {///失败 + if([[dic objectForKey:@"resultStatus"] intValue] == 6001) + {///取消支付 + if(self.delegate&&[self.delegate respondsToSelector:@selector(payCancle)]) + { + [self.delegate payCancle]; + } + + } + else + { + if(self.delegate&&[self.delegate respondsToSelector:@selector(payFaile)]) + { + [self.delegate payFaile]; + } + [UserInfoModel shijianShangBao:1 key:@"client.alipay.err" value:@"" extra:@""]; + } + } +} + +///获取苹果商店商品价格 +-(void)getAppleGoodsPrice:(NSArray *)arr +{ + if(self.payManager==nil) + { + self.payManager = [VistaInAppPurchaseManager sharedInstance]; + [self.payManager setDelegate:self]; + } + [self.payManager requestAllGoodsPrice:arr]; +} + +#pragma mark - apple +-(void)applePay:(NSArray *)arrGoodsID +{ + if(self.payManager==nil) + { + self.payManager = [VistaInAppPurchaseManager sharedInstance]; + [self.payManager setDelegate:self]; + } + [self.payManager requestProductWithIDs:arrGoodsID]; +} +///获取所有苹果商品价格 +-(void)getGoodsPrice:(NSArray *)arr +{ + if(self.payManager==nil) + { + self.payManager = [VistaInAppPurchaseManager sharedInstance]; + [self.payManager setDelegate:self]; + } + [self.payManager requestAllGoodsPrice:arr]; +} +#pragma mark - Apple支付 +///所有商品价格信息 +-(void)receiveProductInfos:(NSArray *)product +{ + if(self.delegate) + { + [self.delegate goodsPrice:product]; + } +} + +//购买商品回调 +-(void)receiveProductInfo:(SKProduct *)product{ + if (product != nil) { + if (![self.payManager purchaseProudct:product outTradeNo:self.outTradeNo goodsNumber:self.number]) { + [HXHud showMessage:@"您禁止了应用内购买权限,请到设置中开启" afterDelayType:0]; + } + NSLog(@"SKProduct 描述信息%@", [product description]); + NSLog(@"产品标题 %@" , product.localizedTitle); + NSLog(@"产品描述信息: %@" , product.localizedDescription); + NSLog(@"价格: %@" , product.price); + NSLog(@"Product id: %@" , product.productIdentifier); + }else{ + [LoadAlterView dismiss]; + [HXHud showMessage:@"无法连接App store!" afterDelayType:0]; + [UserInfoModel shijianShangBao:1 key:@"client.apple.err" value:self.source extra:@"无法连接App store!"]; + if(self.delegate&&[self.delegate respondsToSelector:@selector(payFaile)]) + { + [self.delegate payFaile]; + } + } +} +#pragma mark-VistaInAppPurchaseManagerDelegate +-(void)successfulPurchaseOfId:(NSString *)productID andReceipt:(NSData *)transactionReceipt{ + NSString *transactionReceiptString = [transactionReceipt base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed]; + [LoadAlterView show]; + [PublicNetWorkManager requestOrderNotifyAppleData:nil order_id:self.orderId receipt:transactionReceiptString Callback:^(BOOL state, BaseModel *responseObject, NSString * _Nullable describle) { + if(state) + { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + self.orderNumber = 0; + [self getOrderState]; + }); + } + else + { + [UserInfoModel shijianShangBao:1 key:@"client.apple.err" value:self.source extra:[Tools isStringnil:responseObject.message]]; + [LoadAlterView dismiss]; + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; +} +//失败回调 +- (void)failedPurchaseWithError:(NSString *)errorDescripiton { + [UserInfoModel shijianShangBao:1 key:@"client.apple.err" value:self.source extra:[Tools isStringnil:errorDescripiton]]; + if(self.delegate&&[self.delegate respondsToSelector:@selector(payFaile)]) + { + [self.delegate payFaile]; + } + [LoadAlterView dismiss]; + [HXHud showMessage:errorDescripiton afterDelayType:0]; +} + +///获取订单状态 +-(void)getOrderState +{ + NSLog(@"cg"); + [PublicNetWorkManager requestOrderGetData:nil order_id:self.orderId Callback:^(BOOL state, OrderInfoModel *responseObject, NSString * _Nullable describle) { + if(state) + { + self.orderNumber+=1; + if(responseObject.data.status.intValue == 2) + { + [LoadAlterView dismiss]; + [HXHud showMessage:@"购买成功" afterDelayType:1]; + if(self.delegate) + { + [self.delegate paySuccess]; + } + } + else + { + if(self.orderNumber>=10) + { + [LoadAlterView dismiss]; + [HXHud showMessage:@"请确认是否支付成功" afterDelayType:1]; + } + else + { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self getOrderState]; + }); + } + } +// if(responseObject.data.status.intValue == 1 ) +// { +// [LoadAlterView dismiss]; +// [HXHud showMessage:@"请确认是否支付成功" afterDelayType:1]; +// } +// else if(responseObject.data.status.intValue == 2) +// { +// [LoadAlterView dismiss]; +// [HXHud showMessage:@"购买成功" afterDelayType:1]; +// if(self.delegate) +// { +// [self.delegate paySuccess]; +// } +// } +// else +// { +// [LoadAlterView dismiss]; +// [HXHud showMessage:@"请确认是否支付成功" afterDelayType:1]; +// } + } + else + { + [LoadAlterView dismiss]; + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; +} +@end diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/PublicModel/UserModel.h b/ProductApp/ProductApp/ProductMain/NetWorkManager/PublicModel/UserModel.h index adebcf1..0e89689 100644 --- a/ProductApp/ProductApp/ProductMain/NetWorkManager/PublicModel/UserModel.h +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/PublicModel/UserModel.h @@ -8,7 +8,7 @@ #import "BaseModel.h" NS_ASSUME_NONNULL_BEGIN -@class UserModelData,UserModelDataOrigin; +@class UserModelData,UserModelDataOrigin,RoleTreeModelData; @interface UserModel : BaseModel /// @property (nonatomic , strong) UserModelData *data; @@ -51,11 +51,6 @@ NS_ASSUME_NONNULL_BEGIN /// @property (nonatomic , strong) UserModelDataOrigin *origin; -///本月下载字节数 -@property (nonatomic , strong) NSString *month_download_size; - -///本月下载次数 -@property (nonatomic , strong) NSString *month_download_count; ///余额 @property (nonatomic , strong) NSString *balance; ///优惠券数量 @@ -68,6 +63,12 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic , strong) NSString *bank_user_name; @property (nonatomic , strong) NSString *bank_phone; +///年级是否全选 +@property (nonatomic , strong) NSString *isAllLevel; +///0学生 1家长 2老师 3职场 +@property (nonatomic , strong) NSString *identityType; +@property (nonatomic , strong) RoleTreeModelData *user_stage; + @end @interface UserModelDataOrigin : NSObject @@ -90,5 +91,4 @@ NS_ASSUME_NONNULL_BEGIN @end - NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/PublicModel/UserModel.m b/ProductApp/ProductApp/ProductMain/NetWorkManager/PublicModel/UserModel.m index 4f6bce8..c281286 100644 --- a/ProductApp/ProductApp/ProductMain/NetWorkManager/PublicModel/UserModel.m +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/PublicModel/UserModel.m @@ -6,6 +6,7 @@ // #import "UserModel.h" +#import "RoleTreeModel.h" @implementation UserModel + (NSDictionary *)modelContainerPropertyGenericClass { @@ -14,9 +15,11 @@ @end @implementation UserModelData + (NSDictionary *)modelContainerPropertyGenericClass { - return @{@"origin" : [UserModelDataOrigin class]}; + return @{@"origin" : [UserModelDataOrigin class], + @"user_stage" : [RoleTreeModelData class]}; } @end @implementation UserModelDataOrigin @end + diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/VistaInAppPurchaseManager.h b/ProductApp/ProductApp/ProductMain/NetWorkManager/VistaInAppPurchaseManager.h new file mode 100644 index 0000000..164a9a7 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/VistaInAppPurchaseManager.h @@ -0,0 +1,42 @@ +// +// VistaInAppPurchaseManager.h +// ProductApp +// 内购管理 +// Created by 工作 on 2024/7/1. +// + +#import +#import +NS_ASSUME_NONNULL_BEGIN + +@protocol VistaInAppPurchaseManagerDelegate +//接收到商品信息 +-(void)receiveProductInfo:(SKProduct *)product; +///所有商品价格信息 +-(void)receiveProductInfos:(NSArray *)product; + +//购买成功反馈 +-(void)successfulPurchaseOfId:(NSString *)productID andReceipt:(NSData *)transactionReceipt; +//购买失败反馈 +-(void)failedPurchaseWithError:(NSString *)errorDescripiton; +@end + +@interface VistaInAppPurchaseManager : NSObject +@property (nonatomic, weak)id delegate; +//单例 ++(instancetype)sharedInstance; +#pragma mark - 获取内购商品价格 +-(void)requestAllGoodsPrice:(NSArray *)arr; +/* + * 请求商品信息,productID 商品ID +*/ +-(void)requestProductWithID:(NSString *)productID; +-(void)requestProductWithIDs:(NSArray *)productIDs; +/* + * 购买商品 outTradeNo订单编号 如果有需要,在这里可以加入商品数量 + */ +-(BOOL)purchaseProudct:(SKProduct *)skProduct outTradeNo:(NSString *)outTradeNo goodsNumber:(NSInteger)number; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/VistaInAppPurchaseManager.m b/ProductApp/ProductApp/ProductMain/NetWorkManager/VistaInAppPurchaseManager.m new file mode 100644 index 0000000..9fe48fe --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/VistaInAppPurchaseManager.m @@ -0,0 +1,176 @@ +// +// VistaInAppPurchaseManager.m +// ProductApp +// +// Created by 工作 on 2024/7/1. +// + +#import "VistaInAppPurchaseManager.h" + +static VistaInAppPurchaseManager *manager = nil; + +@interface VistaInAppPurchaseManager () +{ + SKProduct *myProduct; + + BOOL isjiage; +} + +@end + + +@implementation VistaInAppPurchaseManager + ++(instancetype)sharedInstance{ + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + if (manager == nil) { + manager = [[VistaInAppPurchaseManager alloc]init]; + } + + }); + return manager; +} + +#pragma mark - 获取内购商品价格 +-(void)requestAllGoodsPrice:(NSArray *)arr +{ + isjiage = YES; + NSMutableSet *setcc = [NSMutableSet new]; + [setcc addObjectsFromArray:arr]; + + SKProductsRequest *productRequest = [[SKProductsRequest alloc]initWithProductIdentifiers:setcc]; + productRequest.delegate = self; + [productRequest start]; +} + +#pragma mark ------ public Methods +-(void)requestProductWithID:(NSString *)productID{ + isjiage = NO; + if (productID.length > 0) { + SKProductsRequest *productRequest = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithObject:productID]]; + productRequest.delegate = self; + [productRequest start]; + + }else{ + + [LoadAlterView dismiss]; + NSLog(@"productID为空"); + } +} +-(void)requestProductWithIDs:(NSArray *)productIDs +{ + isjiage = NO; + SKProductsRequest *productRequest = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithArray:productIDs]]; + productRequest.delegate = self; + [productRequest start]; +} +-(BOOL)purchaseProudct:(SKProduct *)skProduct outTradeNo:(NSString *)outTradeNo goodsNumber:(NSInteger)number{ + + if (skProduct != nil) { + if ([SKPaymentQueue canMakePayments]) { + SKMutablePayment *payment = [SKMutablePayment paymentWithProduct:skProduct]; + payment.applicationUsername = outTradeNo; + payment.quantity = number; + [[SKPaymentQueue defaultQueue] addTransactionObserver:self]; + [[SKPaymentQueue defaultQueue] addPayment:payment]; + return YES; + }else{ + NSLog(@"失败,用户禁止应用内付费购买."); + [LoadAlterView dismiss]; + [_delegate receiveProductInfo:myProduct]; + } + } + return NO; +} + +#pragma mark ------ SKProductsRequestDelegate + +-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{ + NSArray *productArr = response.products; + if (productArr.count >0) { + if(isjiage) + { + if(_delegate && [_delegate respondsToSelector:@selector(receiveProductInfos:)]) + { + [_delegate receiveProductInfos:productArr]; + } + } + else + { + myProduct = [productArr objectAtIndex:0]; + [_delegate receiveProductInfo:myProduct]; + } + }else{ + NSLog(@"无法购买商品信息,购买失败"); + [LoadAlterView dismiss]; + [_delegate receiveProductInfo:myProduct]; + } +} + +#pragma mark ------ SKPaymentTransactionObserver + +-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{ + for (SKPaymentTransaction *transaction in transactions) { + switch (transaction.transactionState) { + case SKPaymentTransactionStatePurchasing://商品添加进列表 + NSLog(@"商品:%@被添加进购买列表",myProduct.localizedTitle); +// [LoadAlterView dismiss]; + break; + case SKPaymentTransactionStatePurchased://交易成功 +// [LoadAlterView showView]; + [self completeTransaction:transaction]; + break; + case SKPaymentTransactionStateFailed://交易失败 + [self failedTransaction:transaction]; + [LoadAlterView dismiss]; + NSLog(@"交易失败"); + //发送通知 + [[NSNotificationCenter defaultCenter] postNotificationName:@"failNotification" object:self userInfo:nil]; + break; + case SKPaymentTransactionStateRestored://已购买过该商品 + [LoadAlterView dismiss]; + break; + + case SKPaymentTransactionStateDeferred://交易延迟 + [LoadAlterView dismiss]; + default: + [LoadAlterView dismiss]; + break; + } + } +} + +#pragma mark ---- private Methods + +-(void)completeTransaction:(SKPaymentTransaction *)transaction{ + NSURL *receiptUrl = [[NSBundle mainBundle] appStoreReceiptURL]; + NSData *receiptData = [NSData dataWithContentsOfURL:receiptUrl]; + [_delegate successfulPurchaseOfId:transaction.payment.productIdentifier andReceipt:receiptData]; +// NSString *str = transaction.payment.applicationUsername; +// [[NSUserDefaults standardUserDefaults] setObject:receiptData forKey:@"receiptData"]; +// [[NSUserDefaults standardUserDefaults] synchronize]; + [[SKPaymentQueue defaultQueue]finishTransaction:transaction]; +} + +- (void)failedTransaction:(SKPaymentTransaction *)transaction{ + [LoadAlterView dismiss]; + if (transaction.error.code != SKErrorPaymentCancelled && transaction.error.code != SKErrorUnknown) { + [_delegate failedPurchaseWithError:transaction.error.localizedDescription]; + } + else if (transaction.error.code == SKErrorPaymentCancelled) + { + [_delegate failedPurchaseWithError:@"用户取消支付"]; + } + else + { + [_delegate failedPurchaseWithError:transaction.error.localizedDescription]; + } + [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; +} + +-(void)dealloc{ + [[SKPaymentQueue defaultQueue] removeTransactionObserver:self]; +} + +@end diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/models/ExamplePptDetailModel.h b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/ExamplePptDetailModel.h new file mode 100644 index 0000000..e27d9e1 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/ExamplePptDetailModel.h @@ -0,0 +1,68 @@ +// +// ExamplePptDetailModel.h +// ProductApp +// +// Created by 工作 on 2024/10/23. +// + +#import "BaseModel.h" +#import "ExamplePptModel.h" +NS_ASSUME_NONNULL_BEGIN +@class ExamplePptDetailModelData,ExamplePptDetailModelDataResult,ExamplePptDetailModelDataResultImages,ExamplePptDetailModelDataResultOutline,ExamplePptDetailModelDataResultOutlineChapters,ExamplePptDetailModelDataResultOutlineChaptersItem; +@interface ExamplePptDetailModel : BaseModel +/// +@property (nonatomic , strong) ExamplePptDetailModelData *data; +@end +@interface ExamplePptDetailModelData : NSObject +/// +@property (nonatomic , strong) NSString *ID; +/// +@property (nonatomic , strong) NSString *name; +/// +@property (nonatomic , strong) NSString *image; +/// +@property (nonatomic , strong) ExamplePptDetailModelDataResult *result; +/// +@property (nonatomic , strong) NSString *create_time; +@property (nonatomic , strong) ExamplePptModelDataItemsConfig *config; +@end +@interface ExamplePptDetailModelDataResult : NSObject +/// +@property (nonatomic , strong) NSArray *images; +/// +@property (nonatomic , strong) ExamplePptDetailModelDataResultOutline *outline; +@end +@interface ExamplePptDetailModelDataResultImages : NSObject +/// +@property (nonatomic , strong) NSString *url; +/// +@property (nonatomic , strong) NSString *desc; +@end +@interface ExamplePptDetailModelDataResultOutline : NSObject +/// +@property (nonatomic , strong) NSArray *chapters; +/// +@property (nonatomic , strong) NSString *subTitle; +/// +@property (nonatomic , strong) NSString *title; +/// +@property (nonatomic , strong) NSString *end; +/// +@property (nonatomic , strong) NSString *fileId; +@end +@interface ExamplePptDetailModelDataResultOutlineChapters : NSObject +/// +@property (nonatomic , strong) NSString *chapterTitle; +/// +@property (nonatomic , strong) NSArray *chapterContents; + +///自己添加的字段 +@property (nonatomic , assign) BOOL isTitle; + +@end +@interface ExamplePptDetailModelDataResultOutlineChaptersItem : NSObject +/// +@property (nonatomic , strong) NSString *chapterTitle; +@end + +NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/models/ExamplePptDetailModel.m b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/ExamplePptDetailModel.m new file mode 100644 index 0000000..ca04fcf --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/ExamplePptDetailModel.m @@ -0,0 +1,47 @@ +// +// ExamplePptDetailModel.m +// ProductApp +// +// Created by 工作 on 2024/10/23. +// + +#import "ExamplePptDetailModel.h" + +@implementation ExamplePptDetailModel ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"data" : [ExamplePptDetailModelData class]}; +} +@end +@implementation ExamplePptDetailModelData ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"result" : [ExamplePptDetailModelDataResult class], + @"config" : [ExamplePptModelDataItemsConfig class]}; +} ++ (nullable NSDictionary *)modelCustomPropertyMapper +{ + return @{@"ID" : @"id"}; +} +@end +@implementation ExamplePptDetailModelDataResult ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"images" : [ExamplePptDetailModelDataResultImages class], + @"outline":[ExamplePptDetailModelDataResultOutline class]}; +} +@end +@implementation ExamplePptDetailModelDataResultImages + +@end +@implementation ExamplePptDetailModelDataResultOutline ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"chapters" : [ExamplePptDetailModelDataResultOutlineChapters class]}; +} +@end +@implementation ExamplePptDetailModelDataResultOutlineChapters ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"chapterContents" : [ExamplePptDetailModelDataResultOutlineChaptersItem class]}; +} +@end +@implementation ExamplePptDetailModelDataResultOutlineChaptersItem + +@end + diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/models/ExamplePptModel.h b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/ExamplePptModel.h new file mode 100644 index 0000000..dea43a6 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/ExamplePptModel.h @@ -0,0 +1,45 @@ +// +// ExamplePptModel.h +// ProductApp +// +// Created by 工作 on 2024/10/23. +// + +#import "BaseModel.h" + +NS_ASSUME_NONNULL_BEGIN +@class ExamplePptModelData,ExamplePptModelDataItems,ExamplePptModelDataItemsConfig; +@interface ExamplePptModel : BaseModel +/// +@property (nonatomic , strong) ExamplePptModelData *data; +@end +@interface ExamplePptModelData : NSObject +/// +@property (nonatomic , strong) NSArray *items; +@end +@interface ExamplePptModelDataItems : NSObject +/// +@property (nonatomic , strong) NSString *ID; +/// +@property (nonatomic , strong) NSString *name; +/// +@property (nonatomic , strong) NSString *image; +/// +@property (nonatomic , strong) ExamplePptModelDataItemsConfig *config; +/// +@property (nonatomic , strong) NSString *create_time; + +@end + +@interface ExamplePptModelDataItemsConfig : NSObject +/// +@property (nonatomic , strong) NSString *file; +/// +@property (nonatomic , strong) NSString *file_type; +/// +@property (nonatomic , strong) NSString *query; +/// +@property (nonatomic , strong) NSArray *tag; + +@end +NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/NetWorkManager/models/ExamplePptModel.m b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/ExamplePptModel.m new file mode 100644 index 0000000..dfbe51d --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/NetWorkManager/models/ExamplePptModel.m @@ -0,0 +1,31 @@ +// +// ExamplePptModel.m +// ProductApp +// +// Created by 工作 on 2024/10/23. +// + +#import "ExamplePptModel.h" + +@implementation ExamplePptModel ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"data" : [ExamplePptModelData class]}; +} +@end +@implementation ExamplePptModelData ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"items" : [ExamplePptModelDataItems class]}; +} +@end +@implementation ExamplePptModelDataItems ++ (nullable NSDictionary *)modelCustomPropertyMapper +{ + return @{@"ID" : @"id"}; +} ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{@"config" : [ExamplePptModelDataItemsConfig class]}; +} +@end +@implementation ExamplePptModelDataItemsConfig + +@end diff --git a/ProductApp/ProductApp/ProductMain/alter/NomoAlterView.h b/ProductApp/ProductApp/ProductMain/alter/NomoAlterView.h new file mode 100644 index 0000000..f9c1749 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/alter/NomoAlterView.h @@ -0,0 +1,16 @@ +// +// NomoAlterView.h +// ProductApp +// 按钮扁平 +// Created by 工作 on 2024/6/20. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NomoAlterView : UIView ++(void)showInfo:(NSString *)title SelectTag:(nullable void (^)(NSInteger tag))BackSelectTag; +@end + +NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/alter/NomoAlterView.m b/ProductApp/ProductApp/ProductMain/alter/NomoAlterView.m new file mode 100644 index 0000000..a4b1e44 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/alter/NomoAlterView.m @@ -0,0 +1,135 @@ +// +// NomoAlterView.m +// ProductApp +// +// Created by 工作 on 2024/6/20. +// + +#import "NomoAlterView.h" +#import "AppDelegate.h" + +typedef void(^NomoAlterViewBack)(NSInteger selectTag); + +@interface NomoAlterView () +@property (nonatomic , strong) UILabel *lbname; + +/// +@property (nonatomic , strong) NSString *strtitle; + +/// +@property (nonatomic , strong) NomoAlterViewBack bakcValue; + +@end + +@implementation NomoAlterView + +-(id)initWithFrame:(CGRect)frame +{ + if(self = [super initWithFrame:frame]) + { + [self setBackgroundColor:RGBACOLOR(0, 0, 0, 0.4)]; + + UIView *viewback = [[UIView alloc] init]; + [viewback setBackgroundColor:[UIColor whiteColor]]; + [self addSubview:viewback]; + [viewback mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.offset(50); + make.right.equalTo(self).offset(-50); + make.center.equalTo(self); + }]; + [viewback.layer setMasksToBounds:YES]; + [viewback.layer setCornerRadius:20]; + + + UILabel *lbname = [[UILabel alloc] init]; + [lbname setText:@"是否删除"]; + [lbname setTextColor:RGBCOLOR(51, 51, 51)]; + [lbname setTextAlignment:NSTextAlignmentCenter]; + [lbname setFont:[UIFont boldSystemFontOfSize:18]]; + [lbname setNumberOfLines:0]; + [viewback addSubview:lbname]; + [lbname mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.offset(20); + make.left.offset(20); + make.right.equalTo(viewback).offset(-20); + }]; + _lbname = lbname; + + UIView *viewline = [[UIView alloc] init]; + [viewline setBackgroundColor:RGBCOLOR(242, 242, 242)]; + [viewback addSubview:viewline]; + [viewline mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(viewback); + make.top.equalTo(lbname.mas_bottom).offset(20); + make.height.offset(1); + }]; + + NSArray *arr = @[@"取消",@"确认"]; + float f_w = (UISCREEN_WIDTH-100)/2.0; + for(int i = 0; i< arr.count; i++) + { + UIButton *btitem = [[UIButton alloc] init]; + [btitem setTitle:arr[i] forState:UIControlStateNormal]; + [btitem setTitleColor:RGBCOLOR(102, 102, 102) forState:UIControlStateNormal]; + [btitem.titleLabel setFont:[UIFont systemFontOfSize:14]]; + if(i==1) + { + [btitem setTitleColor:RGBCOLOR(249, 73, 73) forState:UIControlStateNormal]; + [btitem.titleLabel setFont:[UIFont boldSystemFontOfSize:14]]; + } + [viewback addSubview:btitem]; + [btitem mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(viewline.mas_bottom); + make.left.offset(f_w*i); + make.width.offset(f_w); + make.height.offset(40); + }]; + [btitem setTag:i]; + [btitem addTarget:self action:@selector(btAction:) forControlEvents:UIControlEventTouchUpInside]; + if(i==0) + { + UIView *viewline1 = [[UIView alloc] init]; + [viewline1 setBackgroundColor:RGBCOLOR(242, 242, 242)]; + [viewback addSubview:viewline1]; + [viewline1 mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(btitem.mas_right); + make.top.equalTo(btitem); + make.bottom.equalTo(viewback); + make.width.offset(1); + }]; + } + } + + + [viewback mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(viewline).offset(40); + }]; + + } + return self; +} +-(void)setStrtitle:(NSString *)strtitle +{ + self.lbname.text = strtitle; +} +-(void)btAction:(UIButton *)sender +{ + if(self.bakcValue) + { + self.bakcValue(sender.tag); + } + [self removeFromSuperview]; +} + ++(void)showInfo:(NSString *)title SelectTag:(nullable void (^)(NSInteger tag))BackSelectTag +{ + NomoAlterView *view = [[NomoAlterView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)]; + AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate; + view.strtitle = title; + [app.window addSubview:view]; + [view setBakcValue:^(NSInteger selectTag) { + BackSelectTag(selectTag); + }]; +} + +@end diff --git a/ProductApp/ProductApp/ProductMain/alter/NomoVerbAlterView.h b/ProductApp/ProductApp/ProductMain/alter/NomoVerbAlterView.h new file mode 100644 index 0000000..283dec1 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/alter/NomoVerbAlterView.h @@ -0,0 +1,16 @@ +// +// NomoVerbAlterView.h +// ProductApp +// 按钮突出 +// Created by 工作 on 2024/6/20. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NomoVerbAlterView : UIView ++(void)showTitle:(NSString *)title info:(NSString *)info SelectTag:(nullable void (^)(NSInteger tag))BackSelectTag; +@end + +NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/alter/NomoVerbAlterView.m b/ProductApp/ProductApp/ProductMain/alter/NomoVerbAlterView.m new file mode 100644 index 0000000..4952dd9 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/alter/NomoVerbAlterView.m @@ -0,0 +1,157 @@ +// +// NomoVerbAlterView.m +// ProductApp +// +// Created by 工作 on 2024/6/20. +// + +#import "NomoVerbAlterView.h" +#import "AppDelegate.h" + + +typedef void(^NomoVerbAlterViewBack)(NSInteger selectTag); + +@interface NomoVerbAlterView () +@property (nonatomic , strong) UILabel *lbname; +@property (nonatomic , strong) UILabel *lbinfo; + +/// +@property (nonatomic , strong) NSString *strtitle; +@property (nonatomic , strong) NSString *strinfo; +/// +@property (nonatomic , strong) NomoVerbAlterViewBack bakcValue; +@end + +@implementation NomoVerbAlterView + +-(id)initWithFrame:(CGRect)frame +{ + if(self = [super initWithFrame:frame]) + { + [self setBackgroundColor:RGBACOLOR(0, 0, 0, 0.4)]; + + UIView *viewback = [[UIView alloc] init]; + [viewback setBackgroundColor:[UIColor whiteColor]]; + [self addSubview:viewback]; + [viewback mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.offset(50); + make.right.equalTo(self).offset(-50); + make.center.equalTo(self); + }]; + [viewback.layer setMasksToBounds:YES]; + [viewback.layer setCornerRadius:20]; + + + UILabel *lbname = [[UILabel alloc] init]; + [lbname setText:@"是否删除"]; + [lbname setTextColor:RGBCOLOR(51, 51, 51)]; + [lbname setTextAlignment:NSTextAlignmentCenter]; + [lbname setFont:[UIFont boldSystemFontOfSize:18]]; + [lbname setNumberOfLines:0]; + [viewback addSubview:lbname]; + [lbname mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.offset(20); + make.left.offset(20); + make.right.equalTo(viewback).offset(-20); + }]; + _lbname = lbname; + + UILabel *lbinfo = [[UILabel alloc] init]; + [lbinfo setText:@""]; + [lbinfo setTextColor:RGBCOLOR(177, 177, 177)]; + [lbinfo setTextAlignment:NSTextAlignmentCenter]; + [lbinfo setFont:[UIFont systemFontOfSize:12]]; + [lbinfo setNumberOfLines:0]; + [viewback addSubview:lbinfo]; + [lbinfo mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.offset(40); + make.right.equalTo(viewback).offset(-40); + make.top.equalTo(lbname.mas_bottom).offset(10); + }]; + _lbinfo = lbinfo; + + UIButton *btlast = nil; + NSArray *arr = @[@"确认",@"取消"]; + float f_w = (UISCREEN_WIDTH-192)/2.0; + for(int i = 0; i< arr.count; i++) + { + UIButton *btitem = [[UIButton alloc] init]; + [btitem setTitle:arr[i] forState:UIControlStateNormal]; + [btitem setTitleColor:RGBCOLOR(51, 51, 51) forState:UIControlStateNormal]; + [btitem.titleLabel setFont:[UIFont boldSystemFontOfSize:16]]; + if(i==1) + { + [btitem setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [btitem.titleLabel setFont:[UIFont boldSystemFontOfSize:16]]; + [btitem setBackgroundColor:RGBCOLOR(255, 102, 102)]; + } + else + { + [btitem.layer setBorderWidth:1]; + [btitem.layer setBorderColor:RGBCOLOR(216, 216, 216).CGColor]; + } + [btitem.layer setMasksToBounds:YES]; + [btitem.layer setCornerRadius:15]; + [viewback addSubview:btitem]; + [btitem mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(lbinfo.mas_bottom).offset(20); + if(i==1) + { + make.left.equalTo(viewback.mas_centerX).offset(10); + } + else + { + make.right.equalTo(viewback.mas_centerX).offset(-10); + } + make.width.offset(f_w); + make.height.offset(40); + }]; + [btitem setTag:i]; + [btitem addTarget:self action:@selector(btAction:) forControlEvents:UIControlEventTouchUpInside]; + btlast = btitem; + } + + + [viewback mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(btlast).offset(20); + }]; + + } + return self; +} +-(void)setStrtitle:(NSString *)strtitle +{ + self.lbname.text = strtitle; +} +-(void)setStrinfo:(NSString *)strinfo +{ + self.lbinfo.text = strinfo; + if(strinfo.length>0) + { + [self.lbinfo mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.lbname.mas_bottom).offset(20); + }]; + } +} +-(void)btAction:(UIButton *)sender +{ + if(self.bakcValue) + { + self.bakcValue(sender.tag); + } + [self removeFromSuperview]; +} + ++(void)showTitle:(NSString *)title info:(NSString *)info SelectTag:(nullable void (^)(NSInteger tag))BackSelectTag +{ + NomoVerbAlterView *view = [[NomoVerbAlterView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)]; + AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate; + view.strtitle = title; + view.strinfo = info; + [app.window addSubview:view]; + [view setBakcValue:^(NSInteger selectTag) { + BackSelectTag(selectTag); + }]; +} + +@end diff --git a/ProductApp/ProductApp/ProductMain/alter/TongYiXieYiAlterView.h b/ProductApp/ProductApp/ProductMain/alter/TongYiXieYiAlterView.h new file mode 100644 index 0000000..199e74a --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/alter/TongYiXieYiAlterView.h @@ -0,0 +1,16 @@ +// +// TongYiXieYiAlterView.h +// ProductApp +// +// Created by 工作 on 2024/7/2. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +typedef void(^TongYiXieYiAlterViewBack)(int type); +@interface TongYiXieYiAlterView : UIView ++(void)showName:(NSString *)name strinfo:(NSString *)strinfo back:(TongYiXieYiAlterViewBack)backValue; +@end + +NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/alter/TongYiXieYiAlterView.m b/ProductApp/ProductApp/ProductMain/alter/TongYiXieYiAlterView.m new file mode 100644 index 0000000..27b1e19 --- /dev/null +++ b/ProductApp/ProductApp/ProductMain/alter/TongYiXieYiAlterView.m @@ -0,0 +1,136 @@ +// +// TongYiXieYiAlterView.m +// ProductApp +// +// Created by 工作 on 2024/7/2. +// + +#import "TongYiXieYiAlterView.h" +#import "AppDelegate.h" + +@interface TongYiXieYiAlterView () + +@property (nonatomic , strong) UILabel *lbtitle; +@property (nonatomic , strong) UILabel *lbinfo; + +/// +@property (nonatomic , strong) NSString *strtitle; +@property (nonatomic , strong) NSString *strinfo; + +/// +@property (nonatomic , strong) TongYiXieYiAlterViewBack backValue; + +@end + +@implementation TongYiXieYiAlterView + +-(id)initWithFrame:(CGRect)frame +{ + if(self = [super initWithFrame:frame]) + { + [self setBackgroundColor:RGBACOLOR(0, 0, 0, 0.4)]; + + UIView *viewback = [[UIView alloc] init]; + [viewback setBackgroundColor:[UIColor whiteColor]]; + [self addSubview:viewback]; + [viewback mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.offset(50); + make.right.equalTo(self).offset(-50); + make.center.equalTo(self); + }]; + [viewback.layer setMasksToBounds:YES]; + [viewback.layer setCornerRadius:20]; + + UILabel *lbtitle = [[UILabel alloc] init]; + [lbtitle setText:@"温馨提示"]; + [lbtitle setTextColor:RGBCOLOR(255, 213, 108)]; + [lbtitle setTextAlignment:NSTextAlignmentLeft]; + [lbtitle setFont:[UIFont fontWithName:@"PangMenZhengDao" size:30]]; + [lbtitle setNumberOfLines:2]; + [viewback addSubview:lbtitle]; + [lbtitle mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(viewback); + make.top.offset(23); + }]; + _lbtitle = lbtitle; + + UILabel *lbinfo = [[UILabel alloc] init]; + [lbinfo setText:@""]; + [lbinfo setTextColor:RGBCOLOR(107, 107, 107)]; + [lbinfo setLineBreakMode:NSLineBreakByWordWrapping]; + [lbinfo setTextAlignment:NSTextAlignmentLeft]; + [lbinfo setFont:[UIFont systemFontOfSize:14]]; + [lbinfo setNumberOfLines:0]; + [viewback addSubview:lbinfo]; + [lbinfo mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.offset(40); + make.right.equalTo(viewback).offset(-40); + make.top.equalTo(lbtitle.mas_bottom).offset(20); + }]; + _lbinfo = lbinfo; + + + UIButton *btok = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH-210, 40)]; + [btok setTitle:@"我已查看并同意" forState:UIControlStateNormal]; + [btok setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [btok.titleLabel setFont:[UIFont systemFontOfSize:16]]; + [btok.layer setMasksToBounds:YES]; + [btok.layer setCornerRadius:10]; + [viewback addSubview:btok]; + [btok mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.offset(65); + make.right.equalTo(viewback).offset(-65); + make.top.equalTo(lbinfo.mas_bottom).offset(38); + make.height.offset(40); + }]; + [btok addTarget:self action:@selector(okAction) forControlEvents:UIControlEventTouchUpInside]; + [btok.layer setMasksToBounds:YES]; + [btok.layer setCornerRadius:6]; + [Tools changedView:btok colors:MainJBColors startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)]; + + UIButton *btdis = [[UIButton alloc] init]; + [btdis setTitle:@"在考虑一下" forState:UIControlStateNormal]; + [btdis setTitleColor:RGBCOLOR(102, 102, 102) forState:UIControlStateNormal]; + [btdis.titleLabel setFont:[UIFont systemFontOfSize:12]]; + [viewback addSubview:btdis]; + [btdis mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(btok); + make.top.equalTo(btok.mas_bottom); + make.height.offset(40); + }]; + [btdis addTarget:self action:@selector(disAction) forControlEvents:UIControlEventTouchUpInside]; + + [viewback mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(btdis); + }]; + + } + return self; +} +-(void)setStrtitle:(NSString *)strtitle +{ + self.lbtitle.text = strtitle; +} +-(void)setStrinfo:(NSString *)strinfo +{ + self.lbinfo.text = strinfo; +} +-(void)disAction +{ + [self removeFromSuperview]; +} +-(void)okAction +{ + self.backValue(1); + [self disAction]; +} ++(void)showName:(NSString *)name strinfo:(NSString *)strinfo back:(TongYiXieYiAlterViewBack)backValue +{ + TongYiXieYiAlterView *view = [[TongYiXieYiAlterView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)]; + AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate; + view.strtitle = name; + view.strinfo = strinfo; + view.backValue = backValue; + [app.window addSubview:view]; +} +@end diff --git a/ProductApp/ProductApp/ProductMain/工具/cell/GongJuListTableViewCell.m b/ProductApp/ProductApp/ProductMain/工具/cell/GongJuListTableViewCell.m index c4237be..2b701ed 100644 --- a/ProductApp/ProductApp/ProductMain/工具/cell/GongJuListTableViewCell.m +++ b/ProductApp/ProductApp/ProductMain/工具/cell/GongJuListTableViewCell.m @@ -6,6 +6,8 @@ // #import "GongJuListTableViewCell.h" +#import "NetWorkManager.h" +#import "NomoAlterView.h" @interface GongJuListTableViewCell () /// @@ -90,7 +92,45 @@ -(void)collectAction:(UIButton *)sender { - + if(self.model.is_fav.intValue == 1) + { + [NomoAlterView showInfo:@"是否取消收藏" SelectTag:^(NSInteger tag) { + if(tag==1) + { + [self pushData]; + } + }]; + } + else + { + [self pushData]; + } +} +-(void)pushData +{ + [LoadAlterView show]; + [NetWorkManager requestToolsFavCollectData:self type:[self.model.is_fav isEqualToString:@"true"]?1:0 tool_id:self.model.ID Callback:^(BOOL state, BaseModel *responseObject, NSString * _Nullable describle) { + [LoadAlterView dismiss]; + if(state) + { + if([self.model.is_fav isEqualToString:@"true"]) + { + self.model.is_fav = @"false"; + [self.btcollect setSelected:NO]; + [HXHud showMessage:@"取消收藏成功" afterDelayType:1]; + } + else + { + self.model.is_fav = @"true"; + [self.btcollect setSelected:YES]; + [HXHud showMessage:@"收藏成功" afterDelayType:1]; + } + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; } -(void)setModel:(ToolsListModelDataItems *)model @@ -100,7 +140,7 @@ self.lbname.text = [Tools isStringnilkong:model.tool_name]; self.lbinfo.text = [Tools isStringnilkong:model.Descriptions]; [self.btcollect setTitle:[Tools isStringnilkong:model.use_count] forState:UIControlStateNormal]; - if(model.is_fav.intValue == 1) + if([model.is_fav isEqualToString:@"true"]) { [self.btcollect setSelected:YES]; } diff --git a/ProductApp/ProductApp/ProductMain/引导/StartGNViewController.m b/ProductApp/ProductApp/ProductMain/引导/StartGNViewController.m index 508e94e..9a2fdf3 100644 --- a/ProductApp/ProductApp/ProductMain/引导/StartGNViewController.m +++ b/ProductApp/ProductApp/ProductMain/引导/StartGNViewController.m @@ -8,6 +8,7 @@ #import "StartGNViewController.h" #import "StartGNTiShiView.h" #import "StartGNView.h" +#import "PublicNetWorkManager.h" @interface StartGNViewController () diff --git a/ProductApp/ProductApp/ProductMain/引导/StartNJViewController.m b/ProductApp/ProductApp/ProductMain/引导/StartNJViewController.m index 636253b..dd8032c 100644 --- a/ProductApp/ProductApp/ProductMain/引导/StartNJViewController.m +++ b/ProductApp/ProductApp/ProductMain/引导/StartNJViewController.m @@ -10,6 +10,7 @@ #import "TextHeaderCollectionViewCell.h" #import "StartGNViewController.h" #import "NetWorkManager.h" +#import "PublicNetWorkManager.h" @interface StartNJViewController () /// @@ -193,7 +194,37 @@ vc.strpid = strpid; vc.strtitle = strtitle; [self.navigationController pushViewController:vc animated:YES]; + + + [self updataUserInfo]; } + +-(void)updataUserInfo +{ + NSMutableArray *arrselect = [NSMutableArray new]; + for(RoleTreeModelData *modelone in self.arrGetData) + { + for(RoleTreeModelData *model in modelone.node) + { + if(model.select) + { + [arrselect addObject:model]; + } + } + } + RoleTreeModelData *modelson = arrselect[arrselect.count/2]; + NSDictionary *dicuser_stage = [modelson yy_modelToJSONObject]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:dicuser_stage forKey:@"user_stage"]; + [dicpush setObject:[NSNumber numberWithBool:arrselect.count>1?YES:NO] forKey:@"isAllLevel"]; + [dicpush setObject:[NSNumber numberWithInt:(int)self.type] forKey:@"identityType"]; + + [PublicNetWorkManager requestUserPutData:self.view body:dicpush Callback:^(BOOL state, id _Nullable responseObject, NSString * _Nullable describle) { + + }]; +} + -(void)btHeaderAction:(UIButton *)sender { sender.selected = YES; diff --git a/ProductApp/ProductApp/ProductMain/引导/StartViewController.m b/ProductApp/ProductApp/ProductMain/引导/StartViewController.m index 03bfb2a..c9a5bc0 100644 --- a/ProductApp/ProductApp/ProductMain/引导/StartViewController.m +++ b/ProductApp/ProductApp/ProductMain/引导/StartViewController.m @@ -23,6 +23,9 @@ #import #import +#import "NetWorkManager.h" +#import "PublicNetWorkManager.h" + @interface StartViewController () /// @property (nonatomic , strong) NSMutableArray *arrLB; @@ -195,6 +198,10 @@ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self.view setUserInteractionEnabled:YES]; + [[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:YingDaoYe]; + ///初始化收藏工具 + [self pushCollectInit]; + /// if(sender.tag==0) { StartSFViewController *vc = [[StartSFViewController alloc] init]; @@ -202,13 +209,47 @@ } else { + [self getNianJiData]; StartGNViewController *vc = [StartGNViewController new]; vc.type = 3; [self.navigationController pushViewController:vc animated:YES]; } }); } +-(void)pushCollectInit +{ + [NetWorkManager requestToolsFavInitData:self.view Callback:^(BOOL state, id _Nullable responseObject, NSString * _Nullable describle) { + + }]; +} +-(void)getNianJiData +{ + [LoadAlterView show]; + [NetWorkManager requestRoleTreeData:self.view Callback:^(BOOL state, RoleTreeModel *responseObject, NSString * _Nullable describle) { + [LoadAlterView dismiss]; + if(state) + { + for(RoleTreeModelData *model in responseObject.data) + { + if([model.name isEqualToString:@"职场"]) + {///更新用户信息 + RoleTreeModelData *modelson = model.node.firstObject; + NSDictionary *dicuser_stage = [modelson yy_modelToJSONObject]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:dicuser_stage forKey:@"user_stage"]; + [dicpush setObject:[NSNumber numberWithBool:NO] forKey:@"isAllLevel"]; + [dicpush setObject:[NSNumber numberWithInt:3] forKey:@"identityType"]; + + [PublicNetWorkManager requestUserPutData:self.view body:dicpush Callback:^(BOOL state, id _Nullable responseObject, NSString * _Nullable describle) { + + }]; + } + } + } + }]; +} #pragma mark - 数据处理 -(void)network @@ -346,4 +387,6 @@ } } +//[[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:YingDaoYe]; + @end diff --git a/ProductApp/ProductApp/ProductMain/引导/支付页/StartPayViewController.m b/ProductApp/ProductApp/ProductMain/引导/支付页/StartPayViewController.m index c590256..4e6bdee 100644 --- a/ProductApp/ProductApp/ProductMain/引导/支付页/StartPayViewController.m +++ b/ProductApp/ProductApp/ProductMain/引导/支付页/StartPayViewController.m @@ -25,13 +25,6 @@ [self.navigationView setHidden:YES]; [self.navigationController setNavigationBarHidden:YES animated:NO]; - if(self.ptype==0) - { -// if(DEBUG) -// [[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:YingDaoYe]; - } - - StartPayView *view = [[StartPayView alloc] init]; [self.view addSubview:view]; [view mas_makeConstraints:^(MASConstraintMaker *make) { diff --git a/ProductApp/ProductApp/ProductMain/引导/支付页/view/StartPayGoodsView.m b/ProductApp/ProductApp/ProductMain/引导/支付页/view/StartPayGoodsView.m index f5a546d..f49b118 100644 --- a/ProductApp/ProductApp/ProductMain/引导/支付页/view/StartPayGoodsView.m +++ b/ProductApp/ProductApp/ProductMain/引导/支付页/view/StartPayGoodsView.m @@ -65,25 +65,6 @@ [viewtime setBackgroundColor:RGBACOLOR(255, 255, 255, 0.5)]; _viewtime = viewtime; - ////////////更改为新版支付 - /// - /* - StartPayGoodsPayView *viewpay = [StartPayGoodsPayView new]; - [self addSubview:viewpay]; - [viewpay mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.equalTo(self); - make.top.equalTo(viewtime.mas_bottom).offset(20); - make.height.offset(120); - }]; - [viewpay setBackSelect:^(NSInteger tag) { - ///1 weixin 2 alipay - - }]; - _viewpay = viewpay; - - self.viewpay.arrPay = @[@"weixin",@"alipay"]; - */ - ///支付 PayPublicView *viewpay = [PayPublicView new]; [self addSubview:viewpay]; @@ -94,7 +75,7 @@ _viewpay = viewpay; [self drawpay]; [viewpay setBackValue:^{ - + self.backSelectGoods(self.modelSelect); }]; [viewpay setBackGoValue:^{ YaoQingViewController *vc = [YaoQingViewController new]; @@ -198,11 +179,11 @@ -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { ///做选中操作 - for(baseInfoModel *model in self.arrGoods) + for(OrderGoodsModelData *model in self.arrGoods) { model.select = NO; } - baseInfoModel *model = self.arrGoods[indexPath.row]; + OrderGoodsModelData *model = self.arrGoods[indexPath.row]; model.select = YES; self.modelSelect = model; self.backSelectGoods(self.modelSelect); diff --git a/ProductApp/ProductApp/ProductMain/引导/支付页/view/StartPayView.m b/ProductApp/ProductApp/ProductMain/引导/支付页/view/StartPayView.m index d39b7a9..d072787 100644 --- a/ProductApp/ProductApp/ProductMain/引导/支付页/view/StartPayView.m +++ b/ProductApp/ProductApp/ProductMain/引导/支付页/view/StartPayView.m @@ -12,7 +12,13 @@ #import "AppDelegate.h" #import "PublicNetWorkManager.h" -@interface StartPayView () +#import "TongYiXieYiAlterView.h" +#import "NomoVerbAlterView.h" +#import "PayManager.h" +#import "VistaInAppPurchaseManager.h" + + +@interface StartPayView () /// @property (nonatomic , strong) StartPayGoodsView *viewgoods; /// @@ -26,6 +32,9 @@ /// @property (nonatomic , strong) OrderGoodsModelData *modelSelect; +/// +@property (nonatomic , strong) PayManager *manager; + @end @implementation StartPayView @@ -324,9 +333,29 @@ -(void)refBottomShow { - [self.lbjiage setText:@"199元"]; - [self.lbyuanjia setText:@"已优惠999元"]; + [self setXieYiShow]; + + float fyhqmoney = 0.0; + if(self.viewgoods.viewpay.modelYHQ.coupon_type.intValue == 2) + { + fyhqmoney = (1-self.viewgoods.viewpay.modelYHQ.coupon_value.floatValue)*self.modelSelect.price.floatValue; + } + else + { + fyhqmoney = self.viewgoods.viewpay.modelYHQ.coupon_value.floatValue/100; + } + float fprice = self.modelSelect.price.floatValue-fyhqmoney; + if(fprice<0)fprice=0; + + [self.lbjiage setText:[NSString stringWithFormat:@"%@元",[Tools backprice:[NSString stringWithFormat:@"%.2lf",fprice]]]]; self.lbjiage.attributedText = [Tools arrstring:self.lbjiage.text andstart:(int)self.lbjiage.text.length-1 andend:1 andfont:[UIFont boldSystemFontOfSize:14] andcolor:RGBCOLOR(249, 37, 95)]; + + + float fjian = self.modelSelect.origin_price.intValue-self.modelSelect.price.intValue+fyhqmoney; + if(fjian>self.modelSelect.origin_price.floatValue)fjian = self.modelSelect.origin_price.floatValue; + + [self.lbyuanjia setText:[NSString stringWithFormat:@"已优惠%@元",[Tools backprice:[NSString stringWithFormat:@"%.2lf",fjian]]]]; + } -(void)xieyiAction:(UIButton *)sender { @@ -340,6 +369,18 @@ { _arrGoods = arrGoods; self.viewgoods.arrGoods = arrGoods; + + if([UserInfoModel PayWXQuanXian]==NO) + { + NSMutableArray *arr = [NSMutableArray new]; + for(OrderGoodsModelData *model in arrGoods) + { + [arr addObject:[Tools isStringnil:model.apple_buy_id]]; + } + + [self.manager getGoodsPrice:arr]; + } + } @@ -362,9 +403,131 @@ -(void)payAction { - [self.viewgoods removeTime]; + ///需要判断是否需要登录 + [UserInfoModel pushLoinVC:self.viewController ispush:YES]; + + NSString *strc = [[UserInfoModel shareModel].config objectForKey:@"client.agreement.dialog"]; + if((strc.intValue == 1 || [Tools isStringnil:strc].length==0) && self.btxiyi.selected == NO) + { + [TongYiXieYiAlterView showName:@"温馨提示" strinfo:[NSString stringWithFormat:@"开通会员之前须先查看并同意%@",self.lbinfo.text] back:^(int type) { + self.btxiyi.selected = YES; + [self pushData]; + }]; + } + else + { + if(self.btxiyi.selected == NO) + { + [HXHud showMessage:@"请同意协议" afterDelayType:0]; + return; + } + [self pushData]; + } + +// [self.viewgoods removeTime]; +} + +-(void)pushData +{ + NSString *strvalue = [self getpaytype]; + + if([strvalue isEqualToString:@"balance"]) + { + [NomoVerbAlterView showTitle:@"提示" info:@"是否使用余额支付" SelectTag:^(NSInteger tag) { + if(tag==0) + { + [self pushPayData]; + } + }]; + return; + } + + [self pushPayData]; +} +-(void)pushPayData +{ + + NSString *strvalue = [self getpaytype]; + [UserInfoModel shijianShangBao:0 key:@"client.pay.pay" value:strvalue extra:[self.modelSelect yy_modelToJSONString]]; + + NSString *strtempcence = @"center"; + + [self.manager creatOrderGoodsid:self.modelSelect.goods_id pay_type:strvalue source:strtempcence extra:@{} applegoodsid:self.modelSelect.apple_buy_id applegoodsNumber:1 coupon:self.viewgoods.viewpay.modelYHQ.ID]; +} + + +-(NSString *)getpaytype +{ + NSString *strvalue = @""; + if(self.viewgoods.viewpay.btselect.tag == 1) + { + strvalue = @"weixin"; + } + else if(self.viewgoods.viewpay.btselect.tag == 2) + { + strvalue = @"alipay"; + } + else if(self.viewgoods.viewpay.btselect.tag == 10) + { + strvalue = @"balance"; + } + else + { + strvalue = @"apple"; + } + return strvalue; +} + +#pragma mark - payManager +#pragma mark - Apple支付 +///所有商品价格信息 +-(void)goodsPrice:(NSArray *)product +{ + for(SKProduct *proc in product) + { + for(OrderGoodsModelData *model in self.arrGoods) + { + if([model.apple_buy_id isEqualToString:proc.productIdentifier]) + { + NSString *xtr = [Tools backprice:[NSString stringWithFormat:@"%@",proc.price]]; + model.price = xtr; + } + } + } + dispatch_async(dispatch_get_main_queue(), ^{ + self.viewgoods.arrGoods = self.arrGoods; + }); +} +-(void)paySuccess +{ + NSString *strvalue = [self getpaytype]; + NSString *strtempcence = @"center"; + + [UserInfoModel shijianShangBao:0 key:@"client.pay.success" value:[NSString stringWithFormat:@"%@:%@",strvalue,strtempcence] extra:self.modelSelect.goods_id]; + [self.viewController.navigationController popViewControllerAnimated:YES]; +} +-(void)payCancle +{ + + NSString *strvalue = [self getpaytype]; + NSString *strtempcence = @"center"; + + [UserInfoModel shijianShangBao:0 key:@"client.pay.cancel" value:[NSString stringWithFormat:@"%@:%@",strvalue,strtempcence] extra:self.modelSelect.goods_id]; +} +-(void)payFaile +{ } +-(PayManager *)manager +{ + if(!_manager) + { + PayManager *manager = [PayManager sharedInstance]; + [manager setDelegate:self]; + _manager = manager; + } + return _manager; +} @end diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/StartZNPPTViewController.m b/ProductApp/ProductApp/ProductMain/引导/智能PPT/StartZNPPTViewController.m index cdc15a0..8a18f6c 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/StartZNPPTViewController.m +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/StartZNPPTViewController.m @@ -7,7 +7,7 @@ #import "StartZNPPTViewController.h" #import "StartZNPPTView.h" - +#import "NetWorkManager.h" @interface StartZNPPTViewController () @@ -44,8 +44,21 @@ make.left.right.bottom.equalTo(self.view); make.top.offset(NavHeight); }]; + [view setHidden:YES]; - + [LoadAlterView show]; + [NetWorkManager requestExamplePptData:self.view Callback:^(BOOL state, ExamplePptModel *responseObject, NSString * _Nullable describle) { + [LoadAlterView dismiss]; + if(state) + { + view.arrdata = responseObject.data.items; + [view setHidden:NO]; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; } ///获取粘贴板的文件 diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/cell/StartZNPPTCell.h b/ProductApp/ProductApp/ProductMain/引导/智能PPT/cell/StartZNPPTCell.h index 0e24e4c..943c8b7 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/cell/StartZNPPTCell.h +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/cell/StartZNPPTCell.h @@ -6,11 +6,12 @@ // #import "JhtBannerCardView.h" - +#import "ExamplePptModel.h" NS_ASSUME_NONNULL_BEGIN @interface StartZNPPTCell : JhtBannerCardView - +/// +@property (nonatomic , strong) ExamplePptModelDataItems *model; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/cell/StartZNPPTCell.m b/ProductApp/ProductApp/ProductMain/引导/智能PPT/cell/StartZNPPTCell.m index 77d2520..3ee88a8 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/cell/StartZNPPTCell.m +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/cell/StartZNPPTCell.m @@ -9,7 +9,10 @@ @interface StartZNPPTCell () - +/// +@property (nonatomic , strong) UIImageView *imgvback; +/// +@property (nonatomic , strong) UILabel *lbbiaoti; @end @implementation StartZNPPTCell @@ -27,38 +30,46 @@ [viewback.layer setMasksToBounds:YES]; [viewback.layer setCornerRadius:6]; - UILabel *lbname = [[UILabel alloc] init]; - [lbname setText:@"年终总结"]; - [lbname setTextColor:RGBCOLOR(51, 51, 51)]; - [lbname setTextAlignment:NSTextAlignmentLeft]; - [lbname setFont:[UIFont boldSystemFontOfSize:16]]; - [viewback addSubview:lbname]; - [lbname mas_makeConstraints:^(MASConstraintMaker *make) { - make.centerX.equalTo(viewback); - make.bottom.equalTo(viewback.mas_centerY).offset(-20); + UIImageView *imgvback = [[UIImageView alloc] init]; + [imgvback setContentMode:UIViewContentModeScaleAspectFill]; + [viewback addSubview:imgvback]; + [imgvback mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(viewback); }]; + _imgvback = imgvback; - UILabel *lbbt = [[UILabel alloc] init]; - [lbbt setText:@"回顾过去展望未来"]; - [lbbt setTextColor:RGBCOLOR(241, 141, 107)]; - [lbbt setTextAlignment:NSTextAlignmentLeft]; - [lbbt setFont:[UIFont boldSystemFontOfSize:14]]; - [viewback addSubview:lbbt]; - [lbbt mas_makeConstraints:^(MASConstraintMaker *make) { - make.centerX.equalTo(lbname); - make.top.equalTo(lbname.mas_bottom).offset(15); - }]; - - UILabel *lbren = [[UILabel alloc] init]; - [lbren setText:@"汇报人:xxx"]; - [lbren setTextColor:RGBCOLOR(51, 51, 51)]; - [lbren setTextAlignment:NSTextAlignmentLeft]; - [lbren setFont:[UIFont systemFontOfSize:8]]; - [viewback addSubview:lbren]; - [lbren mas_makeConstraints:^(MASConstraintMaker *make) { - make.centerX.equalTo(lbname); - make.top.equalTo(lbbt.mas_bottom).offset(20); - }]; +// UILabel *lbname = [[UILabel alloc] init]; +// [lbname setText:@"年终总结"]; +// [lbname setTextColor:RGBCOLOR(51, 51, 51)]; +// [lbname setTextAlignment:NSTextAlignmentLeft]; +// [lbname setFont:[UIFont boldSystemFontOfSize:16]]; +// [viewback addSubview:lbname]; +// [lbname mas_makeConstraints:^(MASConstraintMaker *make) { +// make.centerX.equalTo(viewback); +// make.bottom.equalTo(viewback.mas_centerY).offset(-20); +// }]; +// +// UILabel *lbbt = [[UILabel alloc] init]; +// [lbbt setText:@"回顾过去展望未来"]; +// [lbbt setTextColor:RGBCOLOR(241, 141, 107)]; +// [lbbt setTextAlignment:NSTextAlignmentLeft]; +// [lbbt setFont:[UIFont boldSystemFontOfSize:14]]; +// [viewback addSubview:lbbt]; +// [lbbt mas_makeConstraints:^(MASConstraintMaker *make) { +// make.centerX.equalTo(lbname); +// make.top.equalTo(lbname.mas_bottom).offset(15); +// }]; +// +// UILabel *lbren = [[UILabel alloc] init]; +// [lbren setText:@"汇报人:xxx"]; +// [lbren setTextColor:RGBCOLOR(51, 51, 51)]; +// [lbren setTextAlignment:NSTextAlignmentLeft]; +// [lbren setFont:[UIFont systemFontOfSize:8]]; +// [viewback addSubview:lbren]; +// [lbren mas_makeConstraints:^(MASConstraintMaker *make) { +// make.centerX.equalTo(lbname); +// make.top.equalTo(lbbt.mas_bottom).offset(20); +// }]; UILabel *lbbiaoti = [[UILabel alloc] init]; [lbbiaoti setText:@"企业工作汇报商务风PPT套装"]; @@ -70,8 +81,16 @@ make.centerX.equalTo(self); make.top.equalTo(viewback.mas_bottom).offset(14); }]; + _lbbiaoti = lbbiaoti; } return self; } +-(void)setModel:(ExamplePptModelDataItems *)model +{ + _model = model; + + self.lbbiaoti.text = [Tools isStringnilkong:model.name]; + [self.imgvback sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:nil]; +} @end diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/view/StartZNPPTView.h b/ProductApp/ProductApp/ProductMain/引导/智能PPT/view/StartZNPPTView.h index 015f19b..923b39d 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/view/StartZNPPTView.h +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/view/StartZNPPTView.h @@ -10,7 +10,8 @@ NS_ASSUME_NONNULL_BEGIN @interface StartZNPPTView : UIView - +/// +@property (nonatomic , strong) NSArray *arrdata; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/view/StartZNPPTView.m b/ProductApp/ProductApp/ProductMain/引导/智能PPT/view/StartZNPPTView.m index 373b12a..0183e43 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/view/StartZNPPTView.m +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/view/StartZNPPTView.m @@ -11,11 +11,19 @@ #import "FSTextView.h" #import "StartZNPPTHUDAlter.h" #import "StartZNPPTDaGangViewController.h" - +#import "NetWorkManager.h" @interface StartZNPPTView () @property (nonatomic, strong) JhtBannerScrollView *bannerView; +/// +@property (nonatomic , strong) FSTextView *textview; +/// +@property (nonatomic , strong) UIView *viewItems; +/// +@property (nonatomic , strong) UIImageView *imgvico; +/// +@property (nonatomic , strong) UILabel *lbfilename; @end @implementation StartZNPPTView @@ -114,27 +122,17 @@ make.height.offset(110); }]; textview.text = @"年终总结"; - [textview setUserInteractionEnabled:NO]; + [textview setEditable:NO]; + _textview = textview; - NSArray *arrt = @[@"中文(简体)",@"演讲备注",@"智能配图"]; - NSArray *arrColor = @[RGBCOLOR(255, 114, 65),RGBCOLOR(255, 170, 16),RGBCOLOR(108, 119, 246)]; - for(int i = 0; i < 3; i++) - { - UILabel *lbitem = [[UILabel alloc] init]; - [lbitem setText:arrt[i]]; - [lbitem setTextColor:arrColor[i]]; - [lbitem setTextAlignment:NSTextAlignmentCenter]; - [lbitem setFont:[UIFont systemFontOfSize:13]]; - [lbitem setBackgroundColor:[arrColor[i] colorWithAlphaComponent:0.1]]; - [lbitem.layer setMasksToBounds:YES]; - [lbitem.layer setCornerRadius:4]; - [view addSubview:lbitem]; - [lbitem mas_makeConstraints:^(MASConstraintMaker *make) { - make.size.sizeOffset(CGSizeMake(77, 24)); - make.top.equalTo(textview.mas_bottom).offset(12); - make.left.offset(12+85*i); - }]; - } + UIView *viewItems = [[UIView alloc] init]; + [view addSubview:viewItems]; + [viewItems mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(view); + make.top.equalTo(textview.mas_bottom).offset(12); + make.height.offset(24); + }]; + _viewItems = viewItems; UIView *viewline = [[UIView alloc] init]; [viewline setBackgroundColor:RGBCOLOR(238, 238, 238)]; @@ -184,6 +182,7 @@ make.width.height.offset(33); make.top.offset(0); }]; + _imgvico = imgvico; UILabel *lbfilename = [[UILabel alloc] init]; [lbfilename setText:@"年终总结手稿.txt"]; @@ -196,7 +195,7 @@ make.left.right.equalTo(viewfileson); make.top.equalTo(imgvico.mas_bottom).offset(4); }]; - + _lbfilename = lbfilename; [viewfileson mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.equalTo(lbfilename); }]; @@ -228,6 +227,41 @@ }]; } +-(void)drawItemsArr:(NSArray *)arrt +{ + for(UIView *view in self.viewItems.subviews) + { + [view removeFromSuperview]; + } + NSArray *arrColor = @[RGBCOLOR(255, 114, 65),RGBCOLOR(255, 170, 16),RGBCOLOR(108, 119, 246)]; + for(int i = 0; i < 3; i++) + { + if(i>=arrt.count||i>=arrColor.count)break; + UILabel *lbitem = [[UILabel alloc] init]; + [lbitem setText:arrt[i]]; + [lbitem setTextColor:arrColor[i]]; + [lbitem setTextAlignment:NSTextAlignmentCenter]; + [lbitem setFont:[UIFont systemFontOfSize:13]]; + [lbitem setBackgroundColor:[arrColor[i] colorWithAlphaComponent:0.1]]; + [lbitem.layer setMasksToBounds:YES]; + [lbitem.layer setCornerRadius:4]; + [self.viewItems addSubview:lbitem]; + [lbitem mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.sizeOffset(CGSizeMake(77, 24)); + make.top.offset(0); + make.left.offset(12+85*i); + }]; + } +} + +-(void)setArrdata:(NSArray *)arrdata +{ + _arrdata = arrdata; + if(arrdata.count==0)return; + [self showViewInfoModel:self.arrdata[0]]; + [self.bannerView reloadData]; +} + -(void)fileAction { @@ -236,19 +270,36 @@ -(void)nextAction { [StartZNPPTHUDAlter show]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + ExamplePptModelDataItems *model = self.arrdata[self.bannerView.currentIndex]; + [NetWorkManager requestExamplePptDetailData:self ID:model.ID Callback:^(BOOL state, ExamplePptDetailModel *responseObject, NSString * _Nullable describle) { [StartZNPPTHUDAlter dismis]; - StartZNPPTDaGangViewController *vc = [StartZNPPTDaGangViewController new]; - vc.isyindao = YES; - [self.viewController.navigationController pushViewController:vc animated:YES]; - }); + if(state) + { + StartZNPPTDaGangViewController *vc = [StartZNPPTDaGangViewController new]; + vc.isyindao = YES; + vc.modelDetail = responseObject.data; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; +} + +-(void)showViewInfoModel:(ExamplePptModelDataItems *)model +{ + [self drawItemsArr:model.config.tag]; + self.textview.text = model.config.query; + self.lbfilename.text = [Tools isStringnilkong:model.config.file]; + self.imgvico.image = [UIImage imageNamed:[NSString stringWithFormat:@"yd_%@",model.config.file_type]]; } #pragma mark - JhtBannerScrollViewDataSource /** 显示cardView 个数 */ - (NSInteger)numberOfCardViewInBannerView:(JhtBannerScrollView *)bannerView { - return 5; + return self.arrdata.count; } /** 单个cardView */ @@ -259,7 +310,7 @@ cardView = [[StartZNPPTCell alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH*0.8, 180)]; cardView.tag = index; } - + cardView.model = self.arrdata[index]; return cardView; } @@ -273,7 +324,8 @@ /** 滚动到了某一个cardView */ - (void)bannerView:(JhtBannerScrollView *)bannerView didScrollToCardViewWithIndex:(NSInteger)index { - + ExamplePptModelDataItems *model = self.arrdata[index]; + [self showViewInfoModel:model]; } /** 点击了第几个cardView diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/StartZNPPTDaGangViewController.h b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/StartZNPPTDaGangViewController.h index 0780899..8b44e07 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/StartZNPPTDaGangViewController.h +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/StartZNPPTDaGangViewController.h @@ -6,11 +6,15 @@ // #import "BaseViewController.h" - +#import "ExamplePptDetailModel.h" NS_ASSUME_NONNULL_BEGIN @interface StartZNPPTDaGangViewController : BaseViewController @property (nonatomic , assign) BOOL isyindao; + +/// +@property (nonatomic , strong) ExamplePptDetailModelData *modelDetail; + @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/StartZNPPTDaGangViewController.m b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/StartZNPPTDaGangViewController.m index d6871fb..7518efb 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/StartZNPPTDaGangViewController.m +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/StartZNPPTDaGangViewController.m @@ -36,6 +36,7 @@ make.top.offset(NavHeight); }]; view.isyindao = self.isyindao; + view.modelDetail = self.modelDetail; } @end diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangSonTableViewCell.h b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangSonTableViewCell.h index 3eea812..9132329 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangSonTableViewCell.h +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangSonTableViewCell.h @@ -6,11 +6,11 @@ // #import - +#import "ExamplePptDetailModel.h" NS_ASSUME_NONNULL_BEGIN @interface StartZNPPTDaGangSonTableViewCell : UITableViewCell - +@property (nonatomic , strong) ExamplePptDetailModelDataResultOutlineChaptersItem *model; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangSonTableViewCell.m b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangSonTableViewCell.m index e3adcba..ca68c2e 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangSonTableViewCell.m +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangSonTableViewCell.m @@ -7,7 +7,7 @@ #import "StartZNPPTDaGangSonTableViewCell.h" -@interface StartZNPPTDaGangSonTableViewCell () +@interface StartZNPPTDaGangSonTableViewCell () /// @property (nonatomic , strong) UITextField *fieldname; /// @@ -93,9 +93,26 @@ make.height.offset(30); make.width.offset(35); }]; + [btedit addTarget:self action:@selector(editFieldAction) forControlEvents:UIControlEventTouchUpInside]; _btedit = btedit; } return self; } - +-(void)setModel:(ExamplePptDetailModelDataResultOutlineChaptersItem *)model +{ + _model = model; + [self.fieldname setUserInteractionEnabled:NO]; + self.fieldname.text = model.chapterTitle; +} +-(void)editFieldAction +{ + [self.fieldname setDelegate:self]; + [self.fieldname setUserInteractionEnabled:YES]; + [self.fieldname becomeFirstResponder]; +} +- (BOOL)textFieldShouldEndEditing:(UITextField *)textField +{ + self.model.chapterTitle = textField.text; + return YES; +} @end diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangTableViewCell.h b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangTableViewCell.h index 54dfc43..573a31a 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangTableViewCell.h +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangTableViewCell.h @@ -6,14 +6,15 @@ // #import - +#import "ExamplePptDetailModel.h" NS_ASSUME_NONNULL_BEGIN @interface StartZNPPTDaGangTableViewCell : UITableViewCell ///0上面 1下面 2全部 @property (nonatomic , assign) NSInteger typeline; +@property (nonatomic , assign) NSInteger irow; /// -@property (nonatomic , strong) baseInfoModel *model; +@property (nonatomic , strong) ExamplePptDetailModelDataResultOutlineChapters *model; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangTableViewCell.m b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangTableViewCell.m index b973386..1bf2f53 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangTableViewCell.m +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/cell/StartZNPPTDaGangTableViewCell.m @@ -9,7 +9,7 @@ #import "UITableView+MoveCell.h" #import "StartZNPPTDaGangSonTableViewCell.h" -@interface StartZNPPTDaGangTableViewCell () +@interface StartZNPPTDaGangTableViewCell () /// @property (nonatomic , strong) UIView *viewback; /// @@ -127,6 +127,7 @@ make.height.offset(30); make.width.offset(35); }]; + [btedit addTarget:self action:@selector(editFieldAction) forControlEvents:UIControlEventTouchUpInside]; _btedit = btedit; UITableView *tableView = [[UITableView alloc] init]; @@ -145,11 +146,20 @@ __weak typeof(self) weakSelf = self; [tableView setDataWithArray:self.arrData withBlock:^(NSMutableArray *newArray) { weakSelf.arrData = newArray; + self.model.chapterContents = newArray; }]; } return self; } + +-(void)editFieldAction +{ + [self.fieldtitle setDelegate:self]; + [self.fieldtitle setUserInteractionEnabled:YES]; + [self.fieldtitle becomeFirstResponder]; +} + -(void)setTypeline:(NSInteger)typeline { _typeline = typeline; @@ -185,20 +195,43 @@ [self.viewline setHidden:YES]; } } --(void)setModel:(baseInfoModel *)model +-(void)setModel:(ExamplePptDetailModelDataResultOutlineChapters *)model { _model = model; - [self.arrData removeAllObjects]; - if(model.arrvalue) + [self.fieldtitle setUserInteractionEnabled:NO]; + self.fieldtitle.text = model.chapterTitle; + if(model.isTitle) { - [self.arrData addObjectsFromArray:model.arrvalue]; + if(self.irow==1) + { + self.lbname.text = @"副标题"; + } + else + { + self.lbname.text = @"主标题"; + } + } + else + { + self.lbname.text = [NSString stringWithFormat:@"章节%ld",self.irow+1]; + } + + + [self.arrData removeAllObjects]; + if(model.chapterContents) + { + [self.arrData addObjectsFromArray:model.chapterContents]; self.tableView.dataArray = self.arrData; } [self.tableView reloadData]; } - +- (BOOL)textFieldShouldEndEditing:(UITextField *)textField +{ + self.model.chapterTitle = textField.text; + return YES; +} #pragma mark - UITableView -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { @@ -214,7 +247,7 @@ [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; [cell setBackgroundColor:[UIColor clearColor]]; } - + cell.model = self.arrData[indexPath.row]; return cell; } diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangAlterView.h b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangAlterView.h index 1607ccc..5f94768 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangAlterView.h +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangAlterView.h @@ -11,6 +11,7 @@ NS_ASSUME_NONNULL_BEGIN @interface StartZNPPTDaGangAlterView : UIView +(void)show; ++(void)setShowValue:(float)value; +(void)dismis; @end diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangAlterView.m b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangAlterView.m index 8c287a6..efa1349 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangAlterView.m +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangAlterView.m @@ -75,7 +75,7 @@ static StartZNPPTDaGangAlterView *viewShow; make.height.offset(22); make.top.equalTo(viewline.mas_bottom).offset(44); }]; - viewjd.fblv = 0.5; + viewjd.fblv = 0.0; _viewjd = viewjd; [viewback mas_makeConstraints:^(MASConstraintMaker *make) { @@ -96,6 +96,10 @@ static StartZNPPTDaGangAlterView *viewShow; [appde.window addSubview:view]; viewShow = view; } ++(void)setShowValue:(float)value +{ + viewShow.viewjd.fblv = value; +} +(void)dismis { if(viewShow) diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangView.h b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangView.h index a2418bd..3f95387 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangView.h +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangView.h @@ -6,11 +6,13 @@ // #import - +#import "ExamplePptDetailModel.h" NS_ASSUME_NONNULL_BEGIN @interface StartZNPPTDaGangView : UIView @property (nonatomic , assign) BOOL isyindao; +/// +@property (nonatomic , strong) ExamplePptDetailModelData *modelDetail; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangView.m b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangView.m index d15ed7f..bfda20b 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangView.m +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/大纲/view/StartZNPPTDaGangView.m @@ -82,7 +82,7 @@ }]; /// - [self setnomoData]; + __weak typeof(self) weakSelf = self; [tableView setDataWithArray:self.arrTitle withBlock:^(NSMutableArray *newArray) { weakSelf.arrTitle = newArray; @@ -91,6 +91,7 @@ /// [tableViewinfo setDataWithArray:self.arrContent withBlock:^(NSMutableArray *newArray) { weakSelf.arrContent = newArray; + self.modelDetail.result.outline.chapters = newArray; }]; UIButton *btnext = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 144, 46)]; @@ -114,14 +115,51 @@ -(void)nextAction { - + for(int i = 0 ; i < self.arrTitle.count; i++) + { + ExamplePptDetailModelDataResultOutlineChapters *model = self.arrTitle[i]; + if(i==1) + { + self.modelDetail.result.outline.subTitle = model.chapterTitle; + } + else + { + self.modelDetail.result.outline.title = model.chapterTitle; + } + } [StartZNPPTDaGangAlterView show]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [StartZNPPTDaGangAlterView dismis]; - StartZNPPTYuLanViewController *vc = [StartZNPPTYuLanViewController new]; - vc.isyindao = self.isyindao; - [self.viewController.navigationController pushViewController:vc animated:YES]; - }); + if(self.isyindao) + { + __block float fvalue = 0.0; + + [NSTimer scheduledTimerWithTimeInterval:0.01 repeats:YES block:^(NSTimer * _Nonnull timer) { + fvalue = (fvalue*100+0.2)/100; + if(fvalue<=1) + { + [StartZNPPTDaGangAlterView setShowValue:fvalue]; + } + else + { + [timer invalidate]; + [StartZNPPTDaGangAlterView dismis]; + StartZNPPTYuLanViewController *vc = [StartZNPPTYuLanViewController new]; + vc.isyindao = self.isyindao; + vc.modelDetail = self.modelDetail; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + }]; + } + else + { + + } +} +-(void)setModelDetail:(ExamplePptDetailModelData *)modelDetail +{ + _modelDetail = modelDetail; + [self setnomoData]; + [self.tableView reloadData]; + [self.tableViewinfo reloadData]; } -(void)setnomoData @@ -129,26 +167,26 @@ self.arrTitle = [NSMutableArray new]; for(int i = 0 ; i < 2; i++) { - baseInfoModel *model = [baseInfoModel new]; + ExamplePptDetailModelDataResultOutlineChapters *model = [ExamplePptDetailModelDataResultOutlineChapters new]; + model.chapterTitle = self.modelDetail.result.outline.title; + if(i==1) + { + model.chapterTitle = self.modelDetail.result.outline.subTitle; + } + model.isTitle = YES; [self.arrTitle addObject:model]; } - + self.tableView.dataArray = self.arrTitle; float fheight = 0; self.arrContent = [NSMutableArray new]; - for(int i = 0 ; i < 4; i++) + for(ExamplePptDetailModelDataResultOutlineChapters *modelChapters in self.modelDetail.result.outline.chapters) { fheight+=47; - baseInfoModel *model = [baseInfoModel new]; - NSMutableArray *arrson = [NSMutableArray new]; - for(int j = 0 ; j < 4; j++) - { - [arrson addObject:[NSString stringWithFormat:@"%d",j]]; - fheight+=47; - } - model.arrvalue = arrson; - [self.arrContent addObject:model]; + fheight+=47*modelChapters.chapterContents.count; } + [self.arrContent addObjectsFromArray:self.modelDetail.result.outline.chapters]; + self.tableViewinfo.dataArray = self.arrContent; [self.tableViewinfo mas_updateConstraints:^(MASConstraintMaker *make) { make.height.offset(fheight+10); @@ -193,10 +231,10 @@ if(arr.count==1) { cell.typeline = 3; - baseInfoModel *model = arr[indexPath.row]; - if(model.arrvalue!=nil) + ExamplePptDetailModelDataResultOutlineChapters *model = arr[indexPath.row]; + if(model.chapterContents!=nil) { - if(model.arrvalue.count>0) + if(model.chapterContents.count>0) { cell.typeline = 1; } @@ -211,10 +249,10 @@ else if(indexPath.row==arr.count-1) { cell.typeline = 0; - baseInfoModel *model = arr[indexPath.row]; - if(model.arrvalue!=nil) + ExamplePptDetailModelDataResultOutlineChapters *model = arr[indexPath.row]; + if(model.chapterContents!=nil) { - if(model.arrvalue.count>0) + if(model.chapterContents.count>0) { cell.typeline = 2; } @@ -225,12 +263,13 @@ cell.typeline = 2; } } + cell.irow = indexPath.row; cell.model = arr[indexPath.row]; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - baseInfoModel *model; + ExamplePptDetailModelDataResultOutlineChapters *model; if(tableView.tag==1) { model = self.arrContent[indexPath.row]; @@ -240,9 +279,9 @@ model = self.arrTitle[indexPath.row]; } float fheigh = 47; - if(model.arrvalue!=nil) + if(model.chapterContents!=nil) { - fheigh+=model.arrvalue.count*47; + fheigh+=model.chapterContents.count*47; } return fheigh; } diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/StartZNPPTYuLanViewController.h b/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/StartZNPPTYuLanViewController.h index 14dc1b0..732146c 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/StartZNPPTYuLanViewController.h +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/StartZNPPTYuLanViewController.h @@ -6,11 +6,15 @@ // #import "BaseViewController.h" - +#import "ExamplePptDetailModel.h" NS_ASSUME_NONNULL_BEGIN @interface StartZNPPTYuLanViewController : BaseViewController @property (nonatomic , assign) BOOL isyindao; + +/// +@property (nonatomic , strong) ExamplePptDetailModelData *modelDetail; + @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/StartZNPPTYuLanViewController.m b/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/StartZNPPTYuLanViewController.m index b165211..a611065 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/StartZNPPTYuLanViewController.m +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/StartZNPPTYuLanViewController.m @@ -8,6 +8,7 @@ #import "StartZNPPTYuLanViewController.h" #import "StartZNPPTYuLanTableViewCell.h" #import "StartPayViewController.h" +#import "XLPhotoBrowser.h" @interface StartZNPPTYuLanViewController () /// @@ -31,7 +32,7 @@ [self.navigationView.backButton setHidden:YES]; [self drawTopView]; - UITableView *tableView = [[UITableView alloc] init]; + UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; [tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; [tableView setBackgroundColor:[UIColor clearColor]]; [tableView setDelegate:self]; @@ -48,7 +49,7 @@ -(void)drawTopView { UILabel *lbname = [[UILabel alloc] init]; - [lbname setText:@"演讲文稿 31页"]; + [lbname setText:[NSString stringWithFormat:@"演讲文稿 %ld页",self.modelDetail.result.images.count]]; [lbname setTextColor:RGBCOLOR(51, 51, 51)]; [lbname setTextAlignment:NSTextAlignmentLeft]; [lbname setFont:[UIFont systemFontOfSize:14]]; @@ -86,11 +87,20 @@ StartPayViewController *vc = [StartPayViewController new]; [self.navigationController pushViewController:vc animated:YES]; } - +-(void)showImages:(NSInteger)irow +{ + NSMutableArray *arrtemp = [NSMutableArray new]; + for(ExamplePptDetailModelDataResultImages *model in self.modelDetail.result.images) + { + [arrtemp addObject:[Tools isStringnil:model.url]]; + } + + [XLPhotoBrowser showPhotoBrowserWithImages:arrtemp currentImageIndex:irow].pageControlStyle = XLPhotoBrowserPageControlStyleNone; +} #pragma mark - UITableView -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return 10; + return self.modelDetail.result.images.count; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { @@ -102,7 +112,11 @@ [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; [cell setBackgroundColor:[UIColor clearColor]]; } - + cell.irow = indexPath.row; + cell.model = self.modelDetail.result.images[indexPath.row]; + [cell setBackValue:^(NSInteger irow) { + [self showImages:irow]; + }]; return cell; } -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section @@ -115,7 +129,10 @@ } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return 284; + float fheight = (UISCREEN_WIDTH-32)*180/343+35; + ExamplePptDetailModelDataResultImages *model = self.modelDetail.result.images[indexPath.row]; + fheight+=[Tools getLabelHeightWithText:model.desc width:(UISCREEN_WIDTH - 52) font:12 linHeight:5]+1; + return fheight; } -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/cell/StartZNPPTYuLanTableViewCell.h b/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/cell/StartZNPPTYuLanTableViewCell.h index f5149d9..3410bb1 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/cell/StartZNPPTYuLanTableViewCell.h +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/cell/StartZNPPTYuLanTableViewCell.h @@ -6,11 +6,16 @@ // #import - +#import "ExamplePptDetailModel.h" NS_ASSUME_NONNULL_BEGIN +typedef void(^StartZNPPTYuLanTableViewCellBack)(NSInteger irow); @interface StartZNPPTYuLanTableViewCell : UITableViewCell - +@property (nonatomic , assign) NSInteger irow; +/// +@property (nonatomic , strong) ExamplePptDetailModelDataResultImages *model; +/// +@property (nonatomic , strong) StartZNPPTYuLanTableViewCellBack backValue; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/cell/StartZNPPTYuLanTableViewCell.m b/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/cell/StartZNPPTYuLanTableViewCell.m index aa7ecab..f1eadb1 100644 --- a/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/cell/StartZNPPTYuLanTableViewCell.m +++ b/ProductApp/ProductApp/ProductMain/引导/智能PPT/预览PPT/cell/StartZNPPTYuLanTableViewCell.m @@ -37,15 +37,17 @@ UIImageView *imgvback = [[UIImageView alloc] init]; [imgvback setContentMode:UIViewContentModeScaleAspectFill]; - [imgvback setImage:[UIImage imageNamed:@"yd_zy_0"]]; [viewback addSubview:imgvback]; [imgvback mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.right.equalTo(viewback); - make.height.offset(160); + make.height.offset((UISCREEN_WIDTH-32)*180/343); }]; [imgvback.layer setMasksToBounds:YES]; [imgvback.layer setCornerRadius:6]; _imgvback = imgvback; + [imgvback setUserInteractionEnabled:YES]; + UITapGestureRecognizer *tapimg = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageAction)]; + [imgvback addGestureRecognizer:tapimg]; UILabel *lbpage = [[UILabel alloc] init]; [lbpage setText:@"01"]; @@ -75,17 +77,45 @@ }]; _lbcontent = lbcontent; - NSString *str = @"尊敬的各位同事,随着年末的临近,我们共同走过了又一季的历程。今天,我们将以“年终总结”为主题,回顾这一年来的辛勤耕耘与辉煌成就。让我们共同聚焦于过去的成就、未来的规划,以及持续的进步。接下来,请各位与我一同翻开这一页,开启我们的年度回顾之旅。"; - ///行间距 - NSMutableParagraphStyle *style = [NSMutableParagraphStyle new]; - style.lineSpacing = 5; - style.lineBreakMode = NSLineBreakByWordWrapping; - style.alignment = NSTextAlignmentCenter; - - NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:str]; - [attrString addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, str.length)]; - lbcontent.attributedText = attrString; +// NSString *str = @"尊敬的各位同事,随着年末的临近,我们共同走过了又一季的历程。今天,我们将以“年终总结”为主题,回顾这一年来的辛勤耕耘与辉煌成就。让我们共同聚焦于过去的成就、未来的规划,以及持续的进步。接下来,请各位与我一同翻开这一页,开启我们的年度回顾之旅。"; +// ///行间距 +// NSMutableParagraphStyle *style = [NSMutableParagraphStyle new]; +// style.lineSpacing = 5; +// style.lineBreakMode = NSLineBreakByWordWrapping; +// style.alignment = NSTextAlignmentCenter; +// +// NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:str]; +// [attrString addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, str.length)]; +// lbcontent.attributedText = attrString; } return self; } +-(void)setModel:(ExamplePptDetailModelDataResultImages *)model +{ + self.lbpage.text = [NSString stringWithFormat:@"%ld",self.irow+1]; + if(self.irow<9) + { + self.lbpage.text = [NSString stringWithFormat:@"0%ld",self.irow+1]; + } + + [self.imgvback sd_setImageWithURL:[NSURL URLWithString:model.url] placeholderImage:nil]; + + NSString *str = model.desc; + ///行间距 + NSMutableParagraphStyle *style = [NSMutableParagraphStyle new]; + style.lineSpacing = 5; + style.lineBreakMode = NSLineBreakByWordWrapping; + style.alignment = NSTextAlignmentCenter; + + NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:str]; + [attrString addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, str.length)]; + self.lbcontent.attributedText = attrString; +} +-(void)imageAction +{ + if(self.backValue) + { + self.backValue(self.irow); + } +} @end diff --git a/ProductApp/ProductApp/ProductMain/引导/课堂写作/批改信息/view/StartKTXZPGDetailView.m b/ProductApp/ProductApp/ProductMain/引导/课堂写作/批改信息/view/StartKTXZPGDetailView.m index 0789fd0..5c7f9f6 100644 --- a/ProductApp/ProductApp/ProductMain/引导/课堂写作/批改信息/view/StartKTXZPGDetailView.m +++ b/ProductApp/ProductApp/ProductMain/引导/课堂写作/批改信息/view/StartKTXZPGDetailView.m @@ -183,6 +183,7 @@ } -(void)setIsshiyong:(BOOL)isshiyong { + _isshiyong = isshiyong; if(!isshiyong) { [self.btpigai setTitle:@"改写润色" forState:UIControlStateNormal]; diff --git a/ProductApp/ProductApp/ProductMain/首页/ShouYeViewController.m b/ProductApp/ProductApp/ProductMain/首页/ShouYeViewController.m index fb26193..71eee81 100644 --- a/ProductApp/ProductApp/ProductMain/首页/ShouYeViewController.m +++ b/ProductApp/ProductApp/ProductMain/首页/ShouYeViewController.m @@ -18,12 +18,19 @@ #import "ShouYeZCPPTTableViewCell.h" #import "ShouYeZCXZTableViewCell.h" #import "ShouYeLiShiJiLuViewController.h" +#import "PublicNetWorkManager.h" +#import "NetWorkManager.h" @interface ShouYeViewController () /// +@property (nonatomic , strong) UIButton *btnianji; +/// @property (nonatomic , strong) UITableView *tableView ; +/// +@property (nonatomic , strong) NSArray *arrTools; + @end @implementation ShouYeViewController @@ -37,6 +44,8 @@ { [self.tableView reloadData]; } + [self updateBtShow]; + [self getTools]; } - (void)viewDidLoad { [super viewDidLoad]; @@ -60,6 +69,9 @@ make.top.offset(NavHeight+15); }]; _tableView = tableView; + + [self getUserData]; + } -(void)drawTopView @@ -87,6 +99,7 @@ [btnianji setIconInRightWithSpacing:6]; [btnianji setTag:0]; [btnianji addTarget:self action:@selector(topAction:) forControlEvents:UIControlEventTouchUpInside]; + _btnianji = btnianji; UIButton *btlishi = [[UIButton alloc] init]; [btlishi setImage:[UIImage imageNamed:@"home_lishi"] forState:UIControlStateNormal]; @@ -110,14 +123,14 @@ else {///身份选择 ///未选择过身份或者是职场 - if([UserInfoModel shareModel].lingyu.intValue == 1) + if([UserInfoModel shareModel].identityType.intValue == 3 || [UserInfoModel shareModel].user_stage==nil) { - ShouYeShenFenViewController *vc = [ShouYeShenFenViewController new]; + ShouYeLingYuViewController *vc = [ShouYeLingYuViewController new]; [self.navigationController pushViewController:vc animated:YES]; } else { - ShouYeLingYuViewController *vc = [ShouYeLingYuViewController new]; + ShouYeShenFenViewController *vc = [ShouYeShenFenViewController new]; [self.navigationController pushViewController:vc animated:YES]; } } @@ -126,7 +139,7 @@ #pragma mark - UITableView -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - if([UserInfoModel shareModel].lingyu.intValue==2)return 4; + if([UserInfoModel shareModel].identityType.intValue==3)return 4; return 5; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section @@ -139,10 +152,11 @@ } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - int type = [UserInfoModel shareModel].lingyu.intValue; + ///0学生 1家长 2老师 3职场 + int type = [UserInfoModel shareModel].identityType.intValue; if(indexPath.section==0) { - if(type==2) + if(type==3) {///职场 static NSString *strcell = @"ShouYeZCPPTTableViewCell"; ShouYeZCPPTTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell]; @@ -157,9 +171,8 @@ } else { - ///1学生 2家长 3老师 - int shenfen = [UserInfoModel shareModel].shenfen.intValue; - if (shenfen==3||shenfen==2) + int shenfen = [UserInfoModel shareModel].identityType.intValue; + if (shenfen==1||shenfen==2) { static NSString *strcell = @"ShouYeLSZWPGTableViewCell"; ShouYeLSZWPGTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell]; @@ -189,7 +202,7 @@ } else if(indexPath.section==1) { - if(type==2) + if(type==3) {///职场 static NSString *strcell = @"ShouYeZCXZTableViewCell"; ShouYeZCXZTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell]; @@ -204,9 +217,8 @@ } else { - ///1学生 2家长 3老师 - int shenfen = [UserInfoModel shareModel].shenfen.intValue; - if (shenfen==3||shenfen==2) + int shenfen = [UserInfoModel shareModel].identityType.intValue; + if (shenfen==1||shenfen==2) { static NSString *strcell = @"ShouYeLSKTPGTableViewCell"; ShouYeLSKTPGTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strcell]; @@ -257,6 +269,7 @@ [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; [cell setBackgroundColor:[UIColor clearColor]]; } + cell.arrdata = self.arrTools; return cell; } @@ -303,8 +316,8 @@ } else if(indexPath.section==1) { - int type = [UserInfoModel shareModel].lingyu.intValue; - if(type==2) + int type = [UserInfoModel shareModel].identityType.intValue; + if(type==3) { return 140; } @@ -318,7 +331,12 @@ { /// 没得工具52 有 +86一行 第一行是76; float fheight = 52; - fheight+=86-10; + NSInteger iline = self.arrTools.count/4; + if(self.arrTools.count%4!=0)iline+=1; + if(iline>0) + { + fheight+=86*iline-10; + } return fheight; } return 75; @@ -392,6 +410,58 @@ { } +///用户信息 +-(void)getUserData +{ + [PublicNetWorkManager requestUserData:self.view Callback:^(BOOL state, UserModel *responseObject, NSString * _Nullable describle) { + if(state) + { + [UserInfoModel shareModel].isAllLevel = responseObject.data.isAllLevel; + [UserInfoModel shareModel].identityType = responseObject.data.identityType; + [UserInfoModel shareModel].user_stage = responseObject.data.user_stage; + + [self updateBtShow]; + } + }]; +} +///常用工具 +-(void)getTools +{ + [NetWorkManager requestToolsFavData:self.view page:1 size:@"100" Callback:^(BOOL state, ToolsListModel *responseObject, NSString * _Nullable describle) { + if(state) + { + self.arrTools = responseObject.data.items; + [self.tableView reloadData]; + } + }]; +} + +-(void)updateBtShow +{ + if([UserInfoModel shareModel].identityType.intValue==3) + { + [self.btnianji setTitle:[NSString stringWithFormat:@"%@",[UserInfoModel getidentityTypeString]] forState:UIControlStateNormal]; + } + else + { + if([UserInfoModel shareModel].user_stage==nil) + { + [self.btnianji setTitle:@"请选择" forState:UIControlStateNormal]; + } + else + { + if([UserInfoModel shareModel].isAllLevel.intValue==1) + { + [self.btnianji setTitle:[NSString stringWithFormat:@"%@-%@",[UserInfoModel getidentityTypeString],[UserInfoModel shareModel].user_stage.parent_name] forState:UIControlStateNormal]; + } + else + { + [self.btnianji setTitle:[NSString stringWithFormat:@"%@-%@",[UserInfoModel getidentityTypeString],[UserInfoModel shareModel].user_stage.name] forState:UIControlStateNormal]; + } + } + } + [self.btnianji setIconInRightWithSpacing:6]; +} @end diff --git a/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeBannerTableViewCell.m b/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeBannerTableViewCell.m index 183746d..a69baba 100644 --- a/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeBannerTableViewCell.m +++ b/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeBannerTableViewCell.m @@ -6,7 +6,8 @@ // #import "ShouYeBannerTableViewCell.h" - +#import "StartPayViewController.h" +#import "KeTangXieZuoViewController.h" @interface ShouYeBannerTableViewCell () //轮播 @@ -19,6 +20,12 @@ { if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + UIView *viewback = [[UIView alloc] init]; + [self.contentView addSubview:viewback]; + [viewback mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self); + }]; + SDCycleScrollView *cleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero imageNamesGroup:@[]]; cleScrollView.scrollDirection = UICollectionViewScrollDirectionHorizontal; cleScrollView.delegate = self; @@ -27,28 +34,72 @@ cleScrollView.titleLabelTextColor = [UIColor darkGrayColor]; cleScrollView.titleLabelTextFont = [UIFont systemFontOfSize:[Tools sizeFont:14]]; cleScrollView.autoScrollTimeInterval = 3.0; - cleScrollView.placeholderImage = [UIImage imageNamed:@"home_bannernomo"]; +// cleScrollView.placeholderImage = [UIImage imageNamed:@"home_bannernomo"]; cleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill; [cleScrollView setShowPageControl:YES]; cleScrollView.pageControlBottomOffset = -5; cleScrollView.pageControlDotSize = CGSizeMake(4, 4); - [self addSubview:cleScrollView]; + [viewback addSubview:cleScrollView]; [cleScrollView mas_makeConstraints:^(MASConstraintMaker *make) { - make.edges.equalTo(self); + make.edges.equalTo(viewback); }]; [cleScrollView.layer setMasksToBounds:YES]; [cleScrollView.layer setCornerRadius:8]; + [cleScrollView setUserInteractionEnabled:YES]; _cleScrollView = cleScrollView; - cleScrollView.imageURLStringsGroup = @[@"",@"",@""]; - + NSArray *arrbanner = [[UserInfoModel shareModel].config objectForKey:@"client.home.banner.urls"]; + NSMutableArray *arrurls = [NSMutableArray new]; + for(NSDictionary *dic in arrbanner) + { + [arrurls addObject:[Tools isStringnil:[dic objectForKey:@"image"]]]; + } + cleScrollView.imageURLStringsGroup = arrurls; + } return self; +} +#pragma mark - SDCycleScrollView +- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index +{ + } /** 点击图片回调 */ - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index { + [self pushAction:index]; +} + +-(void)pushAction:(NSInteger)index +{ + NSArray *arrbanner = [[UserInfoModel shareModel].config objectForKey:@"client.home.banner.urls"]; + + NSDictionary *dic = arrbanner[index]; + NSString *strpage = [Tools isStringnil:[dic objectForKey:@"page"]]; + if([strpage isEqualToString:@"recharge"]) + { + StartPayViewController *vc = [StartPayViewController new]; + vc.ptype = 1; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + else if([strpage isEqualToString:@"composition"]) + { + [[NSNotificationCenter defaultCenter] postNotificationName:@"carnumberChangeNotifi" object:@"1"]; + } + else if([strpage isEqualToString:@"write_tools"]) + { + [[NSNotificationCenter defaultCenter] postNotificationName:@"carnumberChangeNotifi" object:@"3"]; + } + else if([strpage isEqualToString:@"classroom_write"]) + { + KeTangXieZuoViewController *vc = [KeTangXieZuoViewController new]; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + else if([strpage isEqualToString:@"write_assistant"]) + { + [[NSNotificationCenter defaultCenter] postNotificationName:@"carnumberChangeNotifi" object:@"2"]; + } } diff --git a/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeToolsTableViewCell.h b/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeToolsTableViewCell.h index 8ca94fa..56d8df5 100644 --- a/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeToolsTableViewCell.h +++ b/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeToolsTableViewCell.h @@ -10,7 +10,8 @@ NS_ASSUME_NONNULL_BEGIN @interface ShouYeToolsTableViewCell : UITableViewCell - +/// +@property (nonatomic , strong) NSArray *arrdata; @end NS_ASSUME_NONNULL_END diff --git a/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeToolsTableViewCell.m b/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeToolsTableViewCell.m index 4ed2851..75762f8 100644 --- a/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeToolsTableViewCell.m +++ b/ProductApp/ProductApp/ProductMain/首页/cell/ShouYeToolsTableViewCell.m @@ -7,11 +7,23 @@ #import "ShouYeToolsTableViewCell.h" #import "ShouYeToolsCollectionViewCell.h" +#import "ToolsListModel.h" + +#import "GongJuCreateViewController.h" +#import "KeTangXieZuoViewController.h" +#import "GongJuTextViewController.h" +#import "GongJuWenBenViewController.h" +#import "GongJuFanYiViewController.h" +#import "GongJuImageToTextViewController.h" +#import "GongJuMinGanCiController.h" + @interface ShouYeToolsTableViewCell () /// @property (nonatomic , strong) UICollectionView *collect; +/// +@property (nonatomic , strong) UIButton *btmore ; @end @@ -55,6 +67,7 @@ }]; [btmore setIconInRightWithSpacing:2]; [btmore addTarget:self action:@selector(moreAction) forControlEvents:UIControlEventTouchUpInside]; + _btmore = btmore; UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; layout.minimumLineSpacing = 0; @@ -69,7 +82,7 @@ make.left.offset(0); make.right.equalTo(viewback); make.top.equalTo(lbname.mas_bottom).offset(2); - make.height.offset(86); + make.bottom.equalTo(viewback); }]; [collect registerClass:[ShouYeToolsCollectionViewCell class] forCellWithReuseIdentifier:@"ShouYeToolsCollectionViewCell"]; _collect = collect; @@ -79,17 +92,42 @@ } -(void)moreAction { + [[NSNotificationCenter defaultCenter] postNotificationName:@"carnumberChangeNotifi" object:@"3"]; +} +-(void)setArrdata:(NSArray *)arrdata +{ + _arrdata = arrdata; + if(arrdata.count==0) + { + [self.btmore setTitle:@"前往收藏" forState:UIControlStateNormal]; + } + else + { + [self.btmore setTitle:@"查看更多" forState:UIControlStateNormal]; + } + + [self.collect reloadData]; } #pragma mark - UICollectionView - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { - return 4; + return self.arrdata.count; } - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { ShouYeToolsCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ShouYeToolsCollectionViewCell" forIndexPath:indexPath]; + ToolsListModelDataItems *model = self.arrdata[indexPath.row]; + cell.lbname.text = [Tools isStringnilkong:model.tool_name]; + if([model.tool_icon containsString:@"http"]) + { + [cell.imgvback sd_setImageWithURL:[NSURL URLWithString:model.tool_icon] placeholderImage:nil]; + } + else + { + cell.imgvback.image = [UIImage imageNamed:[NSString stringWithFormat:@"gj_%@",model.ID]]; + } return cell; } //定义每个section的间距 @@ -112,7 +150,46 @@ } -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - ///做选中操作 - + ToolsListModelDataItems *model = self.arrdata[indexPath.row]; + if(model.ID.intValue>=1 && model.ID.intValue<=9) + { + if(model.ID.intValue==9) + { + KeTangXieZuoViewController *vc = [KeTangXieZuoViewController new]; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + else if(model.ID.intValue==6||model.ID.intValue==7||model.ID.intValue==8||model.ID.intValue==3) + { + GongJuTextViewController *vc = [GongJuTextViewController new]; + vc.strtitle = model.tool_name; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + else if(model.ID.intValue==5) + { + GongJuMinGanCiController *vc = [GongJuMinGanCiController new]; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + else if(model.ID.intValue==4) + { + GongJuFanYiViewController *vc = [GongJuFanYiViewController new]; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + else if(model.ID.intValue==2) + { + GongJuWenBenViewController *vc = [GongJuWenBenViewController new]; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + else if(model.ID.intValue==1) + { + GongJuImageToTextViewController *vc = [GongJuImageToTextViewController new]; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } + } + else + { + GongJuCreateViewController *vc = [GongJuCreateViewController new]; + vc.modelDetail = model; + [self.viewController.navigationController pushViewController:vc animated:YES]; + } } @end diff --git a/ProductApp/ProductApp/ProductMain/首页/切换身份/ShouYeLingYuViewController.m b/ProductApp/ProductApp/ProductMain/首页/切换身份/ShouYeLingYuViewController.m index 5c05945..4bc9583 100644 --- a/ProductApp/ProductApp/ProductMain/首页/切换身份/ShouYeLingYuViewController.m +++ b/ProductApp/ProductApp/ProductMain/首页/切换身份/ShouYeLingYuViewController.m @@ -7,11 +7,16 @@ #import "ShouYeLingYuViewController.h" #import "ShouYeShenFenViewController.h" +#import "NetWorkManager.h" +#import "PublicNetWorkManager.h" @interface ShouYeLingYuViewController () /// @property (nonatomic , strong) NSMutableArray *arrLB; +/// +@property (nonatomic , strong) NSArray *arrdata; + @end @implementation ShouYeLingYuViewController @@ -75,6 +80,7 @@ UILabel *lbitem = [self drawItemView:viewitem title:arrtt[i] tag:i]; [self.arrLB addObject:lbitem]; } + [self getNianJiData]; } -(UILabel *)drawItemView:(UIView *)view title:(NSString *)title tag:(int)tag { @@ -136,7 +142,6 @@ [self.view setUserInteractionEnabled:YES]; if(sender.tag==0) { - [UserInfoModel shareModel].lingyu = @"1"; NSArray *arrvc = self.navigationController.viewControllers; for(UIViewController *vc in arrvc) { @@ -151,11 +156,57 @@ } else { - [UserInfoModel shareModel].lingyu = @"2"; - [self.navigationController popToRootViewControllerAnimated:YES]; + [self updataUserInfo]; } }); } +-(void)getNianJiData +{ + [LoadAlterView show]; + [NetWorkManager requestRoleTreeData:self.view Callback:^(BOOL state, RoleTreeModel *responseObject, NSString * _Nullable describle) { + [LoadAlterView dismiss]; + if(state) + { + self.arrdata = responseObject.data; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; +} + +-(void)updataUserInfo +{ + for(RoleTreeModelData *model in self.arrdata) + { + if([model.name isEqualToString:@"职场"]) + {///更新用户信息 + RoleTreeModelData *modelson = model.node.firstObject; + NSDictionary *dicuser_stage = [modelson yy_modelToJSONObject]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:dicuser_stage forKey:@"user_stage"]; + [dicpush setObject:[NSNumber numberWithBool:NO] forKey:@"isAllLevel"]; + [dicpush setObject:[NSNumber numberWithInt:3] forKey:@"identityType"]; + + [PublicNetWorkManager requestUserPutData:self.view body:dicpush Callback:^(BOOL state, BaseModel *responseObject, NSString * _Nullable describle) { + if(state) + { + [UserInfoModel shareModel].user_stage = modelson; + [UserInfoModel shareModel].isAllLevel = [NSString stringWithFormat:@"%@",[NSNumber numberWithBool:NO]]; + [UserInfoModel shareModel].identityType = @"3"; + [self.navigationController popToRootViewControllerAnimated:YES]; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; + } + } +} + @end diff --git a/ProductApp/ProductApp/ProductMain/首页/切换身份/ShouYeShenFenViewController.m b/ProductApp/ProductApp/ProductMain/首页/切换身份/ShouYeShenFenViewController.m index 035dfad..1c43083 100644 --- a/ProductApp/ProductApp/ProductMain/首页/切换身份/ShouYeShenFenViewController.m +++ b/ProductApp/ProductApp/ProductMain/首页/切换身份/ShouYeShenFenViewController.m @@ -7,7 +7,8 @@ #import "ShouYeShenFenViewController.h" #import "ShouYeShenFenView.h" - +#import "NetWorkManager.h" +#import "PublicNetWorkManager.h" @interface ShouYeShenFenViewController () /// @@ -48,7 +49,23 @@ make.left.right.bottom.equalTo(self.view); make.top.offset(NavHeight); }]; + [view setHidden:YES]; _viewshow = view; + + [LoadAlterView show]; + [NetWorkManager requestRoleTreeData:self.view Callback:^(BOOL state, RoleTreeModel *responseObject, NSString * _Nullable describle) { + [LoadAlterView dismiss]; + if(state) + { + view.arrdata = responseObject.data; + [self.viewshow setHidden:NO]; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; + } -(void)drawTop @@ -71,7 +88,5 @@ -(void)okAction { [self.viewshow okAction]; - [self.navigationController popToRootViewControllerAnimated:YES]; } - @end diff --git a/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenNianJiView.h b/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenNianJiView.h index 08c96ab..b10f43c 100644 --- a/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenNianJiView.h +++ b/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenNianJiView.h @@ -13,7 +13,10 @@ NS_ASSUME_NONNULL_BEGIN ///0学生 1家长 2老师 @property (nonatomic , assign) NSInteger type; --(NSString *)getSelectNJ; +/// +@property (nonatomic , strong) NSArray *arrdata; + +-(NSArray *)getSelectNJ; @end diff --git a/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenNianJiView.m b/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenNianJiView.m index ae270ce..880a778 100644 --- a/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenNianJiView.m +++ b/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenNianJiView.m @@ -8,12 +8,11 @@ #import "ShouYeShenFenNianJiView.h" #import "TextCollectionViewCell.h" #import "TextHeaderCollectionViewCell.h" +#import "RoleTreeModel.h" @interface ShouYeShenFenNianJiView () /// @property (nonatomic , strong) UICollectionView *collect; -/// -@property (nonatomic , strong) NSMutableArray *arrData; /// @property (nonatomic , strong) NSArray *arrGetData; @@ -48,7 +47,6 @@ [collect registerClass:[TextHeaderCollectionViewCell class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"TextHeaderCollectionViewCell"]; _collect = collect; - [self setdata]; [self mas_makeConstraints:^(MASConstraintMaker *make) { make.height.offset(403); @@ -62,95 +60,100 @@ [self setSelectNoModel]; [self.collect reloadData]; } --(void)setdata +-(void)setArrdata:(NSArray *)arrdata { - NSArray *arr = @[@[@"一年级",@"二年级",@"三年级",@"四年级",@"五年级",@"六年级"],@[@"七年级",@"八年级",@"九年级"],@[@"高一",@"高二",@"高三"]]; - self.arrData = [NSMutableArray new]; - for(NSArray *arrtemp in arr) + _arrdata = arrdata; + + if([UserInfoModel shareModel].user_stage) { - NSMutableArray *arritem = [NSMutableArray new]; - for(NSString *str in arrtemp) - { - baseInfoModel *model = [baseInfoModel new]; - model.title = str; - [arritem addObject:model]; + if([UserInfoModel shareModel].isAllLevel.intValue == 1) + {///全选一个学段 + for(RoleTreeModelData *modelsuper in self.arrdata) + { + if(modelsuper.ID.intValue == [UserInfoModel shareModel].user_stage.pid.intValue) + { + for(RoleTreeModelData *model in modelsuper.node) + { + model.select = YES; + } + break; + } + } + } + else + {///选择一个年级 + for(RoleTreeModelData *modelsuper in self.arrdata) + { + for(RoleTreeModelData *model in modelsuper.node) + { + if(model.ID.intValue == [UserInfoModel shareModel].user_stage.ID.intValue) + { + model.select = YES; + break; + } + } + } + } - [self.arrData addObject:arritem]; } + [self.collect reloadData]; } -(void)btHeaderAction:(UIButton *)sender { sender.selected = YES; - for(NSArray *arr in self.arrData) + for(RoleTreeModelData *modelsuper in self.arrdata) { - for(baseInfoModel *model in arr) + for(RoleTreeModelData *model in modelsuper.node) { model.select = NO; } } - NSArray *arr = self.arrData[sender.tag]; - for(baseInfoModel *model in arr) + RoleTreeModelData *modelsuper = self.arrdata[sender.tag]; + for(RoleTreeModelData *model in modelsuper.node) { model.select = sender.selected; } [self.collect reloadData]; } --(NSString *)getSelectNJ +-(NSArray *)getSelectNJ { NSMutableArray *arrselect = [NSMutableArray new]; - for(NSArray *arr in self.arrData) + for(RoleTreeModelData *modelsuper in self.arrdata) { - for(baseInfoModel *model in arr) + for(RoleTreeModelData *model in modelsuper.node) { if(model.select) { - [arrselect addObject:model.title]; + [arrselect addObject:model]; } } } if(arrselect.count==0) { [HXHud showMessage:@"请选择年级" afterDelayType:0]; - return @""; - } - if(arrselect.count==1) - { - return arrselect.firstObject; - } - else - { - if(self.btselect.tag==0) - { - return @"小学"; - } - else if(self.btselect.tag==1) - { - return @"初中"; - } - else - { - return @"高中"; - } + return @[]; } + return arrselect; } #pragma mark - UICollectionView - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { - return self.arrData.count; + return self.arrdata.count>3?3:self.arrdata.count; } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { - NSArray *arr = self.arrData[section]; - return arr.count; + RoleTreeModelData *model = self.arrdata[section]; + + return model.node.count; } - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { TextCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TextCollectionViewCell" forIndexPath:indexPath]; - NSArray *arr = self.arrData[indexPath.section]; - cell.model = arr[indexPath.row]; + RoleTreeModelData *model = self.arrdata[indexPath.section]; + cell.model = model.node[indexPath.row]; return cell; } //定义每个section的间距 @@ -180,27 +183,17 @@ if (kind == UICollectionElementKindSectionHeader) { TextHeaderCollectionViewCell *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"TextHeaderCollectionViewCell" forIndexPath:indexPath]; - if(indexPath.section==0) - { - header.strtitle = @"小学"; - } - else if(indexPath.section==1) - { - header.strtitle = @"初中"; - } - else - { - header.strtitle = @"高中"; - } + RoleTreeModelData *modelsuper = self.arrdata[indexPath.section]; + header.strtitle = modelsuper.name; + if(self.type==2) { [header.btselect setHidden:NO]; [header.btselect setTag:indexPath.section]; [header.btselect addTarget:self action:@selector(btHeaderAction:) forControlEvents:UIControlEventTouchUpInside]; - NSArray *arr = self.arrData[indexPath.section]; BOOL isselectAll = YES; - for(baseInfoModel *model in arr) + for(RoleTreeModelData *model in modelsuper.node) { if(model.select == NO) { @@ -228,8 +221,9 @@ } -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - NSArray *arr = self.arrData[indexPath.section]; - baseInfoModel *model = arr[indexPath.row]; + RoleTreeModelData *modelsuper = self.arrdata[indexPath.section]; + + RoleTreeModelData *model = modelsuper.node[indexPath.row]; [self setSelectNoModel]; model.select = YES; [self.collect reloadData]; @@ -237,9 +231,9 @@ -(void)setSelectNoModel { - for(NSArray *arr in self.arrData) + for(RoleTreeModelData *modelsuper in self.arrdata) { - for(baseInfoModel *model in arr) + for(RoleTreeModelData *model in modelsuper.node) { model.select = NO; } diff --git a/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenView.h b/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenView.h index 6432adb..19c6466 100644 --- a/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenView.h +++ b/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenView.h @@ -10,6 +10,8 @@ NS_ASSUME_NONNULL_BEGIN @interface ShouYeShenFenView : UIView +/// +@property (nonatomic , strong) NSArray *arrdata; -(void)okAction; @end diff --git a/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenView.m b/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenView.m index 6bbded5..1c052b3 100644 --- a/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenView.m +++ b/ProductApp/ProductApp/ProductMain/首页/切换身份/view/ShouYeShenFenView.m @@ -10,6 +10,9 @@ #import "ShouYeShenFenNianJiView.h" #import "ShouYeLingYuViewController.h" +#import "PublicNetWorkManager.h" +#import "RoleTreeModel.h" + @interface ShouYeShenFenView () /// @property (nonatomic , strong) UICollectionView *collect; @@ -136,6 +139,12 @@ }]; [btqh addTarget:self action:@selector(qiehuanAction) forControlEvents:UIControlEventTouchUpInside]; } +-(void)setArrdata:(NSArray *)arrdata +{ + _arrdata = arrdata; + + self.viewnj.arrdata = self.arrdata; +} ///切换领域 -(void)qiehuanAction { @@ -150,10 +159,14 @@ { baseInfoModel *model = [baseInfoModel new]; model.name = arr[i]; - model.Id = [NSString stringWithFormat:@"%d",i+1]; + model.Id = [NSString stringWithFormat:@"%d",i]; + if([UserInfoModel shareModel].identityType.intValue==i) + { + model.select = YES; + self.viewnj.type = i; + } [self.arrjx addObject:model]; } - } -(void)okAction @@ -171,16 +184,40 @@ [HXHud showMessage:@"请选择身份" afterDelayType:0]; return; } - NSString *strnj = [self.viewnj getSelectNJ]; - if(strnj.length==0) + NSArray *arrnj = [self.viewnj getSelectNJ]; + + if(arrnj.count==0) { - [HXHud showMessage:@"请选择年级" afterDelayType:0]; return; } - [UserInfoModel shareModel].shenfen = modelselect.Id; + ///更新用户信息 + [self updataUserInfo:arrnj[arrnj.count/2] type:modelselect.Id.intValue isall:arrnj.count>1?YES:NO]; +} +-(void)updataUserInfo:(RoleTreeModelData *)modelson type:(int)type isall:(BOOL)isall +{ + NSDictionary *dicuser_stage = [modelson yy_modelToJSONObject]; + + NSMutableDictionary *dicpush = [NSMutableDictionary new]; + [dicpush setObject:dicuser_stage forKey:@"user_stage"]; + [dicpush setObject:[NSNumber numberWithBool:isall] forKey:@"isAllLevel"]; + [dicpush setObject:[NSNumber numberWithInt:type] forKey:@"identityType"]; + + [PublicNetWorkManager requestUserPutData:self body:dicpush Callback:^(BOOL state, BaseModel *responseObject, NSString * _Nullable describle) { + if(state) + { + modelson.select = NO; + [UserInfoModel shareModel].user_stage = modelson; + [UserInfoModel shareModel].isAllLevel = [NSString stringWithFormat:@"%@",[NSNumber numberWithBool:isall]]; + [UserInfoModel shareModel].identityType = [NSString stringWithFormat:@"%d",type]; + [self.viewController.navigationController popToRootViewControllerAnimated:YES]; + } + else + { + [HXHud showMessage:responseObject.message afterDelayType:1]; + } + }]; } - #pragma mark - UICollectionView - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {