diff --git a/GIGA.xcodeproj/project.pbxproj b/GIGA.xcodeproj/project.pbxproj index cd7a2dd..c73f1cd 100644 --- a/GIGA.xcodeproj/project.pbxproj +++ b/GIGA.xcodeproj/project.pbxproj @@ -93,6 +93,8 @@ 838388D3212FB7D700D14C53 /* JXTAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = 838388CE212FB7D700D14C53 /* JXTAlertController.m */; }; 838388D4212FB7D700D14C53 /* JXTAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 838388D2212FB7D700D14C53 /* JXTAlertView.m */; }; 838388DA2130046D00D14C53 /* emojizone.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 838388D92130046D00D14C53 /* emojizone.mp4 */; }; + 8384643E214A484400F12B33 /* MaskTestResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 8384643D214A484400F12B33 /* MaskTestResult.m */; }; + 83846441214A4BFF00F12B33 /* MaskTestResultVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 83846440214A4BFF00F12B33 /* MaskTestResultVC.m */; }; 838500DC2137F3F7003514A3 /* GiGaAttributedLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 838500DB2137F3F7003514A3 /* GiGaAttributedLabel.m */; }; 83928FFA2134D8F60077D2E8 /* GiGaFlyingCommitInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83928FF92134D8F60077D2E8 /* GiGaFlyingCommitInputView.m */; }; 83928FFE2134F37D0077D2E8 /* GiGaSocketRocketUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 83928FFD2134F37D0077D2E8 /* GiGaSocketRocketUtility.m */; }; @@ -294,6 +296,10 @@ 838388D1212FB7D700D14C53 /* JXTAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JXTAlertView.h; sourceTree = ""; }; 838388D2212FB7D700D14C53 /* JXTAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JXTAlertView.m; sourceTree = ""; }; 838388D92130046D00D14C53 /* emojizone.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = emojizone.mp4; sourceTree = ""; }; + 8384643C214A484400F12B33 /* MaskTestResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MaskTestResult.h; sourceTree = ""; }; + 8384643D214A484400F12B33 /* MaskTestResult.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MaskTestResult.m; sourceTree = ""; }; + 8384643F214A4BFF00F12B33 /* MaskTestResultVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MaskTestResultVC.h; sourceTree = ""; }; + 83846440214A4BFF00F12B33 /* MaskTestResultVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MaskTestResultVC.m; sourceTree = ""; }; 838500DA2137F3F7003514A3 /* GiGaAttributedLabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaAttributedLabel.h; sourceTree = ""; }; 838500DB2137F3F7003514A3 /* GiGaAttributedLabel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaAttributedLabel.m; sourceTree = ""; }; 83928FF82134D8F60077D2E8 /* GiGaFlyingCommitInputView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaFlyingCommitInputView.h; sourceTree = ""; }; @@ -863,6 +869,8 @@ children = ( 83835BC1212E677C001480F2 /* GiGaQuestionVC.h */, 83835BC2212E677C001480F2 /* GiGaQuestionVC.m */, + 8384643F214A4BFF00F12B33 /* MaskTestResultVC.h */, + 83846440214A4BFF00F12B33 /* MaskTestResultVC.m */, ); path = Controller; sourceTree = ""; @@ -876,6 +884,8 @@ 83773FBB214769230014EE4C /* ExercisesModel.m */, 83BC8A882148D28300820437 /* QustionAnswer.h */, 83BC8A892148D28300820437 /* QustionAnswer.m */, + 8384643C214A484400F12B33 /* MaskTestResult.h */, + 8384643D214A484400F12B33 /* MaskTestResult.m */, ); path = Model; sourceTree = ""; @@ -1278,6 +1288,7 @@ buildActionMask = 2147483647; files = ( 835060AD212D4D0C007E6220 /* GiGaFileNanager.m in Sources */, + 83846441214A4BFF00F12B33 /* MaskTestResultVC.m in Sources */, 83346AC5212BBC8C0054D597 /* GiGaRegistViewController.m in Sources */, 83346AD7212C18F50054D597 /* GiGaAppGaurdVC.m in Sources */, 8349585C212511040064DB6C /* AppDelegate+ThirdParty.m in Sources */, @@ -1293,6 +1304,7 @@ 8361B4382121847600238FEB /* UINavigationBar+Custom.m in Sources */, 83BFAE6C213CD0E3004EF801 /* GiGaMineInfoViewCell.m in Sources */, 83BC8A872148BE8A00820437 /* NYPopover.m in Sources */, + 8384643E214A484400F12B33 /* MaskTestResult.m in Sources */, 83346AD4212BFF6E0054D597 /* UserGuardViewController.m in Sources */, 83BC8A8A2148D28300820437 /* QustionAnswer.m in Sources */, 8357ADC92123BFCA000816F2 /* GiGaUserManager.m in Sources */, diff --git a/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/Contents.json b/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/Contents.json index f80543f..6f9a863 100644 --- a/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/Contents.json +++ b/GIGA/Assets.xcassets/maskTime/ceshi_number.imageset/Contents.json @@ -1,5 +1,9 @@ { "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, { "idiom" : "universal", "filename" : "ceshi_number@2x.png", diff --git a/GIGA/Assets.xcassets/maskTime/mask_img_hair.imageset/Contents.json b/GIGA/Assets.xcassets/maskTime/mask_img_hair.imageset/Contents.json new file mode 100644 index 0000000..43aee8c --- /dev/null +++ b/GIGA/Assets.xcassets/maskTime/mask_img_hair.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "mask_img_hair.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "mask_img_hair@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "mask_img_hair@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/maskTime/mask_img_hair.imageset/mask_img_hair.png b/GIGA/Assets.xcassets/maskTime/mask_img_hair.imageset/mask_img_hair.png new file mode 100644 index 0000000..0e2ac29 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/mask_img_hair.imageset/mask_img_hair.png differ diff --git a/GIGA/Assets.xcassets/maskTime/mask_img_hair.imageset/mask_img_hair@2x.png b/GIGA/Assets.xcassets/maskTime/mask_img_hair.imageset/mask_img_hair@2x.png new file mode 100644 index 0000000..4574055 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/mask_img_hair.imageset/mask_img_hair@2x.png differ diff --git a/GIGA/Assets.xcassets/maskTime/mask_img_hair.imageset/mask_img_hair@3x.png b/GIGA/Assets.xcassets/maskTime/mask_img_hair.imageset/mask_img_hair@3x.png new file mode 100644 index 0000000..76cc722 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/mask_img_hair.imageset/mask_img_hair@3x.png differ diff --git a/GIGA/Assets.xcassets/maskTime/mask_img_head.imageset/Contents.json b/GIGA/Assets.xcassets/maskTime/mask_img_head.imageset/Contents.json new file mode 100644 index 0000000..2f3de9d --- /dev/null +++ b/GIGA/Assets.xcassets/maskTime/mask_img_head.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "mask_img_head.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "mask_img_head@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "mask_img_head@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/maskTime/mask_img_head.imageset/mask_img_head.png b/GIGA/Assets.xcassets/maskTime/mask_img_head.imageset/mask_img_head.png new file mode 100644 index 0000000..12ba593 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/mask_img_head.imageset/mask_img_head.png differ diff --git a/GIGA/Assets.xcassets/maskTime/mask_img_head.imageset/mask_img_head@2x.png b/GIGA/Assets.xcassets/maskTime/mask_img_head.imageset/mask_img_head@2x.png new file mode 100644 index 0000000..3178004 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/mask_img_head.imageset/mask_img_head@2x.png differ diff --git a/GIGA/Assets.xcassets/maskTime/mask_img_head.imageset/mask_img_head@3x.png b/GIGA/Assets.xcassets/maskTime/mask_img_head.imageset/mask_img_head@3x.png new file mode 100644 index 0000000..80213e1 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/mask_img_head.imageset/mask_img_head@3x.png differ diff --git a/GIGA/Assets.xcassets/maskTime/mask_img_mask.imageset/Contents.json b/GIGA/Assets.xcassets/maskTime/mask_img_mask.imageset/Contents.json new file mode 100644 index 0000000..be871ff --- /dev/null +++ b/GIGA/Assets.xcassets/maskTime/mask_img_mask.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "mask_img_mask.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "mask_img_mask@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "mask_img_mask@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/maskTime/mask_img_mask.imageset/mask_img_mask.png b/GIGA/Assets.xcassets/maskTime/mask_img_mask.imageset/mask_img_mask.png new file mode 100644 index 0000000..51ae75f Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/mask_img_mask.imageset/mask_img_mask.png differ diff --git a/GIGA/Assets.xcassets/maskTime/mask_img_mask.imageset/mask_img_mask@2x.png b/GIGA/Assets.xcassets/maskTime/mask_img_mask.imageset/mask_img_mask@2x.png new file mode 100644 index 0000000..63eaaa9 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/mask_img_mask.imageset/mask_img_mask@2x.png differ diff --git a/GIGA/Assets.xcassets/maskTime/mask_img_mask.imageset/mask_img_mask@3x.png b/GIGA/Assets.xcassets/maskTime/mask_img_mask.imageset/mask_img_mask@3x.png new file mode 100644 index 0000000..6512443 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/mask_img_mask.imageset/mask_img_mask@3x.png differ diff --git a/GIGA/Assets.xcassets/maskTime/masking_img_mask.imageset/Contents.json b/GIGA/Assets.xcassets/maskTime/masking_img_mask.imageset/Contents.json new file mode 100644 index 0000000..4eb3355 --- /dev/null +++ b/GIGA/Assets.xcassets/maskTime/masking_img_mask.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "masking_img_mask.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "masking_img_mask@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "masking_img_mask@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/maskTime/masking_img_mask.imageset/masking_img_mask.png b/GIGA/Assets.xcassets/maskTime/masking_img_mask.imageset/masking_img_mask.png new file mode 100644 index 0000000..a1bbb31 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/masking_img_mask.imageset/masking_img_mask.png differ diff --git a/GIGA/Assets.xcassets/maskTime/masking_img_mask.imageset/masking_img_mask@2x.png b/GIGA/Assets.xcassets/maskTime/masking_img_mask.imageset/masking_img_mask@2x.png new file mode 100644 index 0000000..9c7bc58 Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/masking_img_mask.imageset/masking_img_mask@2x.png differ diff --git a/GIGA/Assets.xcassets/maskTime/masking_img_mask.imageset/masking_img_mask@3x.png b/GIGA/Assets.xcassets/maskTime/masking_img_mask.imageset/masking_img_mask@3x.png new file mode 100644 index 0000000..9e9be0b Binary files /dev/null and b/GIGA/Assets.xcassets/maskTime/masking_img_mask.imageset/masking_img_mask@3x.png differ diff --git a/GIGA/Assets.xcassets/userCenter/Contents.json b/GIGA/Assets.xcassets/userCenter/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/GIGA/Assets.xcassets/userCenter/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/userCenter/nav_point_bg.imageset/Contents.json b/GIGA/Assets.xcassets/userCenter/nav_point_bg.imageset/Contents.json new file mode 100644 index 0000000..1ce3be1 --- /dev/null +++ b/GIGA/Assets.xcassets/userCenter/nav_point_bg.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "nav_point_bg.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/userCenter/nav_point_bg.imageset/nav_point_bg.png b/GIGA/Assets.xcassets/userCenter/nav_point_bg.imageset/nav_point_bg.png new file mode 100644 index 0000000..c5f8c58 Binary files /dev/null and b/GIGA/Assets.xcassets/userCenter/nav_point_bg.imageset/nav_point_bg.png differ diff --git a/GIGA/Assets.xcassets/userCenter/user_history.imageset/Contents.json b/GIGA/Assets.xcassets/userCenter/user_history.imageset/Contents.json new file mode 100644 index 0000000..c8e0b75 --- /dev/null +++ b/GIGA/Assets.xcassets/userCenter/user_history.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "user_history@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "user_history@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/userCenter/user_history.imageset/user_history@2x.png b/GIGA/Assets.xcassets/userCenter/user_history.imageset/user_history@2x.png new file mode 100644 index 0000000..57a22a6 Binary files /dev/null and b/GIGA/Assets.xcassets/userCenter/user_history.imageset/user_history@2x.png differ diff --git a/GIGA/Assets.xcassets/userCenter/user_history.imageset/user_history@3x.png b/GIGA/Assets.xcassets/userCenter/user_history.imageset/user_history@3x.png new file mode 100644 index 0000000..6b7d9b0 Binary files /dev/null and b/GIGA/Assets.xcassets/userCenter/user_history.imageset/user_history@3x.png differ diff --git a/GIGA/Assets.xcassets/userCenter/user_indicator_right.imageset/Contents.json b/GIGA/Assets.xcassets/userCenter/user_indicator_right.imageset/Contents.json new file mode 100644 index 0000000..e7e6092 --- /dev/null +++ b/GIGA/Assets.xcassets/userCenter/user_indicator_right.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "user_indicator_right@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "user_indicator_right@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/userCenter/user_indicator_right.imageset/user_indicator_right@2x.png b/GIGA/Assets.xcassets/userCenter/user_indicator_right.imageset/user_indicator_right@2x.png new file mode 100644 index 0000000..e588612 Binary files /dev/null and b/GIGA/Assets.xcassets/userCenter/user_indicator_right.imageset/user_indicator_right@2x.png differ diff --git a/GIGA/Assets.xcassets/userCenter/user_indicator_right.imageset/user_indicator_right@3x.png b/GIGA/Assets.xcassets/userCenter/user_indicator_right.imageset/user_indicator_right@3x.png new file mode 100644 index 0000000..338ead3 Binary files /dev/null and b/GIGA/Assets.xcassets/userCenter/user_indicator_right.imageset/user_indicator_right@3x.png differ diff --git a/GIGA/Assets.xcassets/userCenter/user_indicator_white.imageset/Contents.json b/GIGA/Assets.xcassets/userCenter/user_indicator_white.imageset/Contents.json new file mode 100644 index 0000000..434a081 --- /dev/null +++ b/GIGA/Assets.xcassets/userCenter/user_indicator_white.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "user_indicator_white@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "user_indicator_white@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/userCenter/user_indicator_white.imageset/user_indicator_white@2x.png b/GIGA/Assets.xcassets/userCenter/user_indicator_white.imageset/user_indicator_white@2x.png new file mode 100644 index 0000000..f083cac Binary files /dev/null and b/GIGA/Assets.xcassets/userCenter/user_indicator_white.imageset/user_indicator_white@2x.png differ diff --git a/GIGA/Assets.xcassets/userCenter/user_indicator_white.imageset/user_indicator_white@3x.png b/GIGA/Assets.xcassets/userCenter/user_indicator_white.imageset/user_indicator_white@3x.png new file mode 100644 index 0000000..0523767 Binary files /dev/null and b/GIGA/Assets.xcassets/userCenter/user_indicator_white.imageset/user_indicator_white@3x.png differ diff --git a/GIGA/Assets.xcassets/userCenter/user_setup.imageset/Contents.json b/GIGA/Assets.xcassets/userCenter/user_setup.imageset/Contents.json new file mode 100644 index 0000000..b5c32bd --- /dev/null +++ b/GIGA/Assets.xcassets/userCenter/user_setup.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "user_setup@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "user_setup@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/userCenter/user_setup.imageset/user_setup@2x.png b/GIGA/Assets.xcassets/userCenter/user_setup.imageset/user_setup@2x.png new file mode 100644 index 0000000..ccfc99b Binary files /dev/null and b/GIGA/Assets.xcassets/userCenter/user_setup.imageset/user_setup@2x.png differ diff --git a/GIGA/Assets.xcassets/userCenter/user_setup.imageset/user_setup@3x.png b/GIGA/Assets.xcassets/userCenter/user_setup.imageset/user_setup@3x.png new file mode 100644 index 0000000..4a31a62 Binary files /dev/null and b/GIGA/Assets.xcassets/userCenter/user_setup.imageset/user_setup@3x.png differ diff --git a/GIGA/Assets.xcassets/userCenter/user_test.imageset/Contents.json b/GIGA/Assets.xcassets/userCenter/user_test.imageset/Contents.json new file mode 100644 index 0000000..8d5ffb9 --- /dev/null +++ b/GIGA/Assets.xcassets/userCenter/user_test.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "user_test@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "user_test@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/GIGA/Assets.xcassets/userCenter/user_test.imageset/user_test@2x.png b/GIGA/Assets.xcassets/userCenter/user_test.imageset/user_test@2x.png new file mode 100644 index 0000000..c559856 Binary files /dev/null and b/GIGA/Assets.xcassets/userCenter/user_test.imageset/user_test@2x.png differ diff --git a/GIGA/Assets.xcassets/userCenter/user_test.imageset/user_test@3x.png b/GIGA/Assets.xcassets/userCenter/user_test.imageset/user_test@3x.png new file mode 100644 index 0000000..634819e Binary files /dev/null and b/GIGA/Assets.xcassets/userCenter/user_test.imageset/user_test@3x.png differ diff --git a/GIGA/Common/GiGaHelper.m b/GIGA/Common/GiGaHelper.m index e0e8146..6c24959 100644 --- a/GIGA/Common/GiGaHelper.m +++ b/GIGA/Common/GiGaHelper.m @@ -229,12 +229,16 @@ return nil; } //⚠️ 13.2.0库编码采用 isoLatin1 + + //NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; + NSData *jsonData = [jsonString dataUsingEncoding:NSISOLatin1StringEncoding]; NSError *err; NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&err]; + if(err) { NSLog(@"json解析失败:%@",err); @@ -243,4 +247,11 @@ return dic; } ++(NSString *)_859ToUTF8:(NSString *)oldStr +{ + NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingISOLatin1); + + return [NSString stringWithUTF8String:[oldStr cStringUsingEncoding:enc]]; +} + @end diff --git a/GIGA/Common/GiGaNetTool/GiGaBaseAPiRequest.m b/GIGA/Common/GiGaNetTool/GiGaBaseAPiRequest.m index 73bbbe0..32d94c9 100644 --- a/GIGA/Common/GiGaNetTool/GiGaBaseAPiRequest.m +++ b/GIGA/Common/GiGaNetTool/GiGaBaseAPiRequest.m @@ -107,7 +107,7 @@ - (void)analyseResponseInfo:(NSDictionary *)responseData headerFileds:(NSDictionary *)headerFields error:(NSError *)error { self.responseHeaderFields = headerFields; - NSString *token = headerFields[@"access-token"]; + NSString *token = headerFields[@"token"]; if (token && token.length > 0) { //更新token //[FFBMSConfig shareInstance].token = token; diff --git a/GIGA/Common/GiGaNetTool/GiGaNetManager.m b/GIGA/Common/GiGaNetTool/GiGaNetManager.m index 0acb02b..dcd33f0 100644 --- a/GIGA/Common/GiGaNetTool/GiGaNetManager.m +++ b/GIGA/Common/GiGaNetTool/GiGaNetManager.m @@ -9,6 +9,7 @@ #import "GiGaNetManager.h" #import "AFNetworking.h" #import "GiGaServerConfig.h" +#import "GiGaUserDefault.h" @interface GiGaNetManager() @@ -23,7 +24,11 @@ // AFHTTPSessionManager*manager=[[AFHTTPSessionManager alloc] initWithBaseURL:baseUrl sessionConfiguration:configuration]; AFHTTPSessionManager*manager=[[AFHTTPSessionManager alloc] init]; manager.responseSerializer=[AFHTTPResponseSerializer serializer]; - + NSString *token = [GiGaUserDefault getCurentToken]; + if (token) { + [manager.requestSerializer setValue:token forHTTPHeaderField:@"token"]; + } + switch (requestMethod) { case RequestGetMethod: diff --git a/GIGA/Common/GiGaUserDB/GiGaUserDefault.m b/GIGA/Common/GiGaUserDB/GiGaUserDefault.m index 4d6b7de..e8c93f0 100644 --- a/GIGA/Common/GiGaUserDB/GiGaUserDefault.m +++ b/GIGA/Common/GiGaUserDB/GiGaUserDefault.m @@ -48,7 +48,7 @@ NSString *const kGiGaToken = @"GiGatoken"; +(BOOL)isUserLogin{ - NSString *uid = UD_GET_VALUE(GIGADEFAULTKEY_USERID); + NSString *uid = UD_GET_VALUE(kGiGaToken); return uid ? YES : NO; } diff --git a/GIGA/Common/GiGaUserDB/GiGaUserManager.m b/GIGA/Common/GiGaUserDB/GiGaUserManager.m index 105b07f..f9d8777 100644 --- a/GIGA/Common/GiGaUserDB/GiGaUserManager.m +++ b/GIGA/Common/GiGaUserDB/GiGaUserManager.m @@ -57,10 +57,12 @@ const static NSInteger GIGADB_USER_VER = 0;//当前数据库版本号 self.user = user; NSString *userTableId = [NSString stringWithFormat:@"%@",user.userId]; self.userTabId = userTableId; - //暂定只保留一个用户 + NSDictionary *userDic = [user toDictionary]; [_userArr removeAllObjects]; - [_userArr addObject:user]; + [_userArr addObject:userDic]; + + [_store putObject:_userArr withId:userTableId intoTable:GIGA_USER_TABLE]; [GiGaUserDefault saveUserId:userTableId]; @@ -72,7 +74,10 @@ const static NSInteger GIGADB_USER_VER = 0;//当前数据库版本号 NSString *useriD = [GiGaUserDefault getCurentUserId]; NSArray *usrA= [_store getObjectById:useriD fromTable:GIGA_USER_TABLE]; if (usrA && usrA.count > 0) { - self.user = usrA[0]; + //self.user = usrA[0]; + NSDictionary *userdic = usrA[0]; + GiGaUser *user = [[GiGaUser alloc] initWithDictionary:userdic error:nil];; + self.user = user; } return self.user; } diff --git a/GIGA/Modules/LogIn/Controller/GiGaUserLoginVC.m b/GIGA/Modules/LogIn/Controller/GiGaUserLoginVC.m index b82b7aa..5d41356 100644 --- a/GIGA/Modules/LogIn/Controller/GiGaUserLoginVC.m +++ b/GIGA/Modules/LogIn/Controller/GiGaUserLoginVC.m @@ -78,7 +78,6 @@ -(void)textFieldUI{ - UIView *acountView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; UIImageView *acountViewIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15,9, 12, 22)]; acountViewIcon.image = [UIImage imageNamed:@"ic_number"]; @@ -283,25 +282,19 @@ NSString *url = [NSString stringWithFormat:@"%@sys/v1/wechatlogin",[GiGaServerConfig getMainUrl]]; [GiGaNetManager requestMethod:RequestPostMethod Url:url params:weiXinUserinfo responseBlock:^(NSDictionary *responseDict, NSDictionary *responseHeaderFields, NSError *error) { [self.view hideToastActivity]; - if (!error) { if ([responseDict[@"code"] integerValue] == 0) { - //[self userloginSussecess:responseDict]; - [self.view makeToast:responseDict[@"msg"] duration:2.0 position:CSToastPositionCenter]; - [self jxt_showAlertWithTitle:@"温馨提示" message:@"请先绑定或注册手机号" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) { - alertMaker.addActionCancelTitle(@"知道了"); - } actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) { - - }]; + [self userloginSussecess:responseDict]; + }else if([responseDict[@"code"] integerValue] == 500){ //登录流程待定 -// [self.view makeToast:responseDict[@"msg"] duration:2.0 position:CSToastPositionCenter]; -// [self jxt_showAlertWithTitle:@"温馨提示" message:@"请绑定手机号" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) { -// -// } actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) { -// -// }]; + [self.view makeToast:responseDict[@"msg"] duration:2.0 position:CSToastPositionCenter]; + [self jxt_showAlertWithTitle:@"温馨提示" message:@"请绑定手机号" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) { + + } actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) { + + }]; }else{ @@ -313,17 +306,18 @@ GILog(@"上传微信用户信息error:\n%@",error.localizedDescription); } }]; - } -(void)userloginSussecess:(NSDictionary *)resDic{ - //token + //token 登陆标志 [GiGaUserDefault saveToken:resDic[@"token"]]; + //埋点 [MobClick endEvent:MobClick_UserLogin]; - //暂定123 登陆标志 - [GiGaUserDefault saveUserId:@"123"]; +// //暂定123 登陆标志 +// [GiGaUserDefault saveUserId:@"123"]; + GIGA_WIndowTost(@"登录成功!"); [self dismissViewControllerAnimated:YES completion:nil]; diff --git a/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m b/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m index 9f3e9c6..b3b76b2 100644 --- a/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m +++ b/GIGA/Modules/Mask/Controller/GiGaMaskTaskViewController.m @@ -36,6 +36,8 @@ @property(nonatomic,strong)MaskViewBootomWaringView *waringView; @property(nonatomic,strong) UIImageView *maskImageView; @property(nonatomic,strong) UIImageView *faceView; +@property (nonatomic,strong) UIImageView *hairImageView; + @property(nonatomic) CGPoint attachPoint; @property(nonatomic,strong) MaskTimeCircularProgressView *cicleProgressView; @property(nonatomic,strong) UIImageView *swipeGaurdimagView; @@ -53,7 +55,7 @@ _maskImageView = [[UIImageView alloc] init]; _maskImageView.userInteractionEnabled = YES; //_maskImageView.backgroundColor = [UIColor purpleColor]; - _maskImageView.image = [UIImage imageNamed:@"img_mask"]; + _maskImageView.image = [UIImage imageNamed:@"mask_img_mask"]; UISwipeGestureRecognizer * upSwipeGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(maskupSwipeGesture)]; [upSwipeGesture setDirection:(UISwipeGestureRecognizerDirectionUp)]; @@ -65,6 +67,17 @@ } return _maskImageView; } +//头发 +- (UIImageView *)hairImageView{ + + if (!_hairImageView) { + _hairImageView = [[UIImageView alloc] init]; + _hairImageView.image = [UIImage imageNamed:@"mask_img_hair"]; + + } + return _hairImageView; +} + //人脸 - (UIImageView *)faceView{ @@ -72,16 +85,17 @@ _faceView = [[UIImageView alloc] init]; //_faceView.backgroundColor = [UIColor lightGrayColor]; _faceView.userInteractionEnabled = YES; - _faceView.image = [UIImage imageNamed:@"bg_img_face"]; + _faceView.image = [UIImage imageNamed:@"mask_img_head"]; } return _faceView; } + //倒计时圆环 - (MaskTimeCircularProgressView *)cicleProgressView{ if (!_cicleProgressView) { - _cicleProgressView = [[MaskTimeCircularProgressView alloc] initWithFrame:CGRectMake(100, 500, 136, 136) backColor:GIGARGB(88, 0, 2, 1) progressColor:[UIColor blueColor] lineWidth:10 timeinterval:10]; + _cicleProgressView = [[MaskTimeCircularProgressView alloc] initWithFrame:CGRectMake(100, 251, 125, 125) backColor:GIGARGB(88, 0, 2, 1) progressColor:[UIColor blueColor] lineWidth:10 timeinterval:10]; _cicleProgressView.delegate = self; _cicleProgressView.hidden = YES; @@ -168,6 +182,7 @@ -(void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; + [self.navigationController.navigationBar setTranslucent:NO]; if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.navigationController.interactivePopGestureRecognizer.enabled = YES; } @@ -199,7 +214,7 @@ [self animaMask]; } -#pragma mark - 开始面膜时间动画 +#pragma mark - 开始面膜时间动画 合并 -(void)animaMask{ @@ -207,18 +222,51 @@ self.startMaskButton.hidden = YES; [self.view layoutIfNeeded]; [UIView animateWithDuration:1.0 animations:^{ - [self.maskImageView mas_updateConstraints:^(MASConstraintMaker *make) { - make.top.mas_equalTo(self.attachPoint.y - 87 + 4); - }]; + [self.faceView mas_updateConstraints:^(MASConstraintMaker *make) { - make.top.mas_equalTo(self.attachPoint.y -124); + make.top.mas_equalTo(self.attachPoint.y -94); }]; + [self.hairImageView mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.attachPoint.y - 94 - 34); + }]; + + [self.maskImageView mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.attachPoint.y - 87); + }]; + [self.maskImageView setImage:[UIImage imageNamed:@"masking_img_mask"]]; + [self.view layoutIfNeeded]; + } completion:^(BOOL finished) { +// self.cicleProgressView.hidden = NO; +// self.maskImageView.userInteractionEnabled = NO; + //开始面膜时间 + //[self startMaskTime]; + [self updateMaskingView]; + }]; +} +#pragma mark 面膜中头像位置 +-(void)updateMaskingView{ + + [self.view layoutIfNeeded]; + [UIView animateWithDuration:1.0 animations:^{ + + [self.faceView mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(124 + PhoneX_TopMargin); + }]; + + [self.hairImageView mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(90 + PhoneX_TopMargin); + }]; + + [self.maskImageView mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.view.mas_top).offset(90 + PhoneX_TopMargin +43); + }]; + [self.view layoutIfNeeded]; + } completion:^(BOOL finished) { self.cicleProgressView.hidden = NO; self.maskImageView.userInteractionEnabled = NO; - //开始面膜时间 [self startMaskTime]; }]; } @@ -226,21 +274,29 @@ #pragma mark 面膜时间结束复原动画 -(void)endMaskAnimation{ + [self.maskImageView setImage:[UIImage imageNamed:@"mask_img_mask"]]; self.cicleProgressView.hidden = YES; self.swipeGaurdimagView.hidden = NO; self.startMaskButton.hidden = NO; [self.view layoutIfNeeded]; [UIView animateWithDuration:1.0 animations:^{ + + + [self.faceView mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(124 + PhoneX_TopMargin); + }]; + + [self.hairImageView mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(90 + PhoneX_TopMargin); + }]; + [self.maskImageView mas_updateConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(254 + PhoneX_TopMargin); }]; - [self.faceView mas_updateConstraints:^(MASConstraintMaker *make) { - make.top.mas_equalTo(91 + PhoneX_TopMargin); - }]; - [self.view layoutIfNeeded]; + //[self.view layoutIfNeeded]; } completion:^(BOOL finished) { self.maskImageView.userInteractionEnabled = YES; @@ -252,28 +308,47 @@ -(void)initUI{ self.view.backgroundColor = GIGA_MAIN_BGCOLOR; - [self.view addSubview:self.maskImageView]; + [self.view addSubview:self.faceView]; - [self.view bringSubviewToFront:self.maskImageView]; + [self.view addSubview:self.maskImageView]; + [self.view addSubview:self.hairImageView]; + + //[self.view bringSubviewToFront:self.maskImageView]; [self.view addSubview:self.swipeGaurdimagView]; [self.view addSubview:self.startMaskButton]; [self.view addSubview:self.startTestButton]; [self.view addSubview:self.cicleProgressView]; //face - [self.faceView mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.mas_equalTo(self.view.mas_top).offset(91 + PhoneX_TopMargin); - make.size.mas_equalTo(CGSizeMake(99, 124)); + make.top.mas_equalTo(self.view.mas_top).offset(124 + PhoneX_TopMargin); + make.size.mas_equalTo(CGSizeMake(77, 94)); make.centerX.mas_equalTo(self.view.mas_centerX); + //make.left.mas_equalTo(self.view.mas_left).offset(153); }]; + //hair + [self.hairImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.view.mas_top).offset(90 + PhoneX_TopMargin); + make.size.mas_equalTo(CGSizeMake(97, 109)); + //make.centerX.mas_equalTo(self.view.mas_centerX); + make.left.mas_equalTo(self.faceView.mas_left).offset(-14); + }]; + //mask [self.maskImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.view.mas_top).offset(254 + PhoneX_TopMargin); make.size.mas_equalTo(CGSizeMake(72, 87)); + //make.centerX.mas_equalTo(self.view.mas_centerX); + make.left.mas_equalTo(self.faceView.mas_left); + }]; + + //circle + [self.cicleProgressView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.view.mas_top).offset(251 + PhoneX_TopMargin); + make.size.mas_equalTo(CGSizeMake(125, 125)); make.centerX.mas_equalTo(self.view.mas_centerX); }]; @@ -292,6 +367,7 @@ make.centerX.mas_equalTo(self.view.mas_centerX); }]; + //startTest [self.startTestButton mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.view.mas_top).offset(486 + PhoneX_TopMargin); @@ -415,11 +491,6 @@ GiGaQuestionVC *questionVC = [[GiGaQuestionVC alloc] init]; [self.navigationController pushViewController:questionVC animated:YES]; -// }else{ -// GiGaUserLoginVC *userlogInVC= [[GiGaUserLoginVC alloc] init]; -// GiGaBaseNavViewController *baseNav = [[GiGaBaseNavViewController alloc] initWithRootViewController:userlogInVC]; -// [self presentViewController:baseNav animated:YES completion:nil]; -// } } -(void)addNotify{ diff --git a/GIGA/Modules/Mask/Exercises/Controller/GiGaQuestionVC.m b/GIGA/Modules/Mask/Exercises/Controller/GiGaQuestionVC.m index 0a10975..e5a195e 100644 --- a/GIGA/Modules/Mask/Exercises/Controller/GiGaQuestionVC.m +++ b/GIGA/Modules/Mask/Exercises/Controller/GiGaQuestionVC.m @@ -15,12 +15,15 @@ #import "ExercisesModel.h" #import "QustionAnswer.h" #import "GiGaServerConfig.h" +#import "MaskTestResult.h" +#import "GiGaUserDefault.h" +#import "GiGaUserLoginVC.h" +#import "MaskTestResultVC.h" @interface GiGaQuestionVC () @property (nonatomic,weak) MaskQuestionView *questionView; @property (nonatomic,assign) NSInteger page; -@property (nonatomic,assign) NSInteger curentAnswerIdex; @property (nonatomic,strong) NSMutableArray *questonArray; @property (nonatomic,strong) NSMutableArray *answerArray; @@ -44,10 +47,6 @@ // self.title = @"测试肤质"; _page = 1; - //默认 - _curentAnswerIdex = 0; - - // [self loadRequestQuestions]; } @@ -192,6 +191,7 @@ //[tit insertObject:mode.answer atIndex:0]; [tit addObject:mode.answer]; } + titles = tit; if (self.questionView) { [self.questionView removeFromSuperview]; @@ -199,27 +199,48 @@ } [self.view layoutIfNeeded]; - MaskQuestionView *questionView = [[MaskQuestionView alloc] initQuestionView:CGRectMake(0,248, self.view.frame.size.width,212) style:style titles:titles]; - questionView.answerList = _currentModel.answerList; + MaskQuestionView *questionView = [[MaskQuestionView alloc] initQuestionView:CGRectMake(0,248, self.view.frame.size.width,212) style:style titles:titles current:_currentModel]; NSLog(@"_currentModel--ID:%d",_currentModel.questionId); questionView.delegate = self; - [self.view addSubview:questionView]; self.questionView = questionView; } -- (void)sliderChangeValueShouldChoiceModelAt:(NSInteger)index +- (void)sliderChangeValueShouldChoiceModelAt:(int)index slider:(float)value + { - NSLog(@"答案下标:%ld",(long)index); - _curentAnswerIdex = index; -} - -- (void)yesOrNoChoiceModelAt:(NSInteger)index{ + if (index > _currentModel.answerList.count) { + return; + } - _curentAnswerIdex = index; + NSLog(@"答案下标:%d",index); + //修改答案默认下标 + _currentModel.slidervalue = value; + [self changeAnswerDefaultflag:index]; + } + +- (void)yesOrNoChoiceModelAt:(int)index{ + + _currentModel.slidervalue = index; + [self changeAnswerDefaultflag:index]; +} + +-(void)changeAnswerDefaultflag:(int)index{ + + NSArray *temparr = [NSArray arrayWithArray:_currentModel.answerList]; + [temparr enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + QustionAnswer *model = obj; + if ((int)index == idx) { + model.defaultFlag = 1; + }else{ + model.defaultFlag = 0; + } + + }]; +} -(void)loadRequestQuestions{ NSDictionary *params = @{}; @@ -227,16 +248,41 @@ [self.view makeToastActivity:CSToastPositionCenter]; [request requstDataWithResult:^(GiGaAPIResult *result) { + [self.view hideToastActivity]; if (result.success) { - [self.view hideToastActivity]; NSLog(@"result:%@",result.dic); NSArray *list = result.dic[@"list"]; for (NSDictionary *answerDic in list) { ExercisesModel *model = [[ExercisesModel alloc] initWithDictionary:answerDic error:nil]; + model.slidervalue = 0; + if (model.optionsStyle == 2) { + //1是 0否 + NSArray *answerlsit = [NSArray arrayWithArray:model.answerList]; + [answerlsit enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + QustionAnswer *answer = obj; + if (answer.defaultFlag == 1) { + model.slidervalue = (float)idx; + } + }]; + + }else{ + NSArray *answerlsit = [NSArray arrayWithArray:model.answerList]; + [answerlsit enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + QustionAnswer *answer = obj; + if (answer.defaultFlag == 1) { + model.slidervalue = (answerlsit.count -1 -idx) / (answerlsit.count - 1); + //GILog(@"model.slidervalue%.2f",model.slidervalue); + } + }]; + + } + [self.questonArray addObject:model]; + } self.currentModel = self.questonArray[0]; + [self initUI]; } }]; @@ -289,16 +335,14 @@ } - -(void)nextBtnAction{ + [self saveProgress]; - if (_page == self.questonArray.count ) { GIGA_ShowToast(@"没有了"); [self submitAnswer]; return; } - _page ++ ; //获取题目信息 @@ -317,11 +361,38 @@ [GiGaNetManager userbodyRequest:url params:params completionHandler:^(NSURLResponse *response, NSDictionary *resDic, NSError * _Nullable error) { [self.view hideToastActivity]; GiGaAPIResult *result = [[GiGaAPIResult alloc] initWithDictionary:resDic]; - GILog(@"**答案提交***\n code:%ld\n message:%@\n *******\n dic:%@",result.code,result.message,result.dic); - + GILog(@"**测试结果***\n code:%ld\n message:%@\n *******\n dic:%@",result.code,result.message,result.dic); + [self userTestEnd]; }]; } +-(void)userTestEnd{ + + BOOL isUserLogin = [GiGaUserDefault isUserLogin]; + if (isUserLogin) { + //展示结果 + MaskTestResultVC *reusltVC = [[MaskTestResultVC alloc] init]; + [self.navigationController pushViewController:reusltVC animated:YES]; + }else{ + [self jxt_showAlertWithTitle:@"对不起您还没有登录" message:@"请登录后查看肤质测试结果" appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) { + alertMaker.addActionCancelTitle(@"返回首页"); + alertMaker.addActionDestructiveTitle(@"登录"); + } actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) { + + if (buttonIndex == 0) { + [self.navigationController popViewControllerAnimated:YES]; + }else{ + GiGaUserLoginVC *userlogInVC= [[GiGaUserLoginVC alloc] init]; + GiGaBaseNavViewController *baseNav = [[GiGaBaseNavViewController alloc] initWithRootViewController:userlogInVC]; + [self presentViewController:baseNav animated:YES completion:nil]; + } + + }]; + } + + +} + -(void)preBtnAction{ _page -- ; @@ -334,18 +405,28 @@ -(void)saveProgress{ int questionId = _currentModel.questionId; - QustionAnswer *curentAnswer = _currentModel.answerList[_curentAnswerIdex]; - int answerid = curentAnswer.answer_id; + + __block int answerid = 0; + NSArray *answerArr = [NSArray arrayWithArray:_currentModel.answerList]; + [answerArr enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + QustionAnswer *model = obj; + if (model.defaultFlag == 1) { + answerid = model.answer_id; + } + }]; GILog(@"问题ID:%d\n 角标id(答案号):%d\n 题号:%ld",questionId,answerid,(long)_page); + NSDictionary *answerDic = @{@"questionId":[NSString stringWithFormat:@"%d",questionId],@"answerId":[NSString stringWithFormat:@"%d",answerid]}; - for (NSDictionary *dic in self.answerArray) { - // 返回时覆盖 - if (questionId == [dic[@"questionId"] intValue]) { - //先删除再添加 上传测试结果顺序任意 + NSArray *tempArr= [NSArray arrayWithArray:self.answerArray]; + //返回时处理 + [tempArr enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + + NSDictionary *dic = obj; + if ([dic[@"questionId"] intValue] == questionId) { [self.answerArray removeObject:dic]; } - } + }]; [self.answerArray addObject:answerDic]; diff --git a/GIGA/Modules/Mask/Exercises/Controller/MaskTestResultVC.h b/GIGA/Modules/Mask/Exercises/Controller/MaskTestResultVC.h new file mode 100644 index 0000000..f190d57 --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/Controller/MaskTestResultVC.h @@ -0,0 +1,13 @@ +// +// MaskTestResultVC.h +// GIGA +// +// Created by lianxiang on 2018/9/13. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import "GiGaBaseViewController.h" + +@interface MaskTestResultVC : GiGaBaseViewController + +@end diff --git a/GIGA/Modules/Mask/Exercises/Controller/MaskTestResultVC.m b/GIGA/Modules/Mask/Exercises/Controller/MaskTestResultVC.m new file mode 100644 index 0000000..4d02224 --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/Controller/MaskTestResultVC.m @@ -0,0 +1,38 @@ +// +// MaskTestResultVC.m +// GIGA +// +// Created by lianxiang on 2018/9/13. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import "MaskTestResultVC.h" + +@interface MaskTestResultVC () + +@end + +@implementation MaskTestResultVC + +- (void)viewDidLoad { + [super viewDidLoad]; + [self addNavTitile:@"测试结果"]; + // Do any additional setup after loading the view. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/GIGA/Modules/Mask/Exercises/Model/ExercisesModel.h b/GIGA/Modules/Mask/Exercises/Model/ExercisesModel.h index eb86176..b623d63 100644 --- a/GIGA/Modules/Mask/Exercises/Model/ExercisesModel.h +++ b/GIGA/Modules/Mask/Exercises/Model/ExercisesModel.h @@ -23,6 +23,10 @@ //optionsStyle:样式(单选或滑动) 1滑动,2单选 ,3滑动带指示 ,4滑动渐变, @property (nonatomic,assign) int optionsStyle; @property (nonatomic,assign) int questionId; +//用户选择的当前题目答案下标 未选择时为默认值 +@property (nonatomic,assign) NSInteger answerIndex; +@property (nonatomic,assign) float slidervalue; + @end diff --git a/GIGA/Modules/Mask/Exercises/Model/MaskTestResult.h b/GIGA/Modules/Mask/Exercises/Model/MaskTestResult.h new file mode 100644 index 0000000..d44ac1c --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/Model/MaskTestResult.h @@ -0,0 +1,21 @@ +// +// MaskTestResult.h +// GIGA +// +// Created by lianxiang on 2018/9/13. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import + +@interface MaskTestResult : JSONModel + +@property(nonatomic,copy) NSString *dryness; +@property(nonatomic,copy) NSString *drynessPercent; +@property(nonatomic,copy) NSString *mask; +@property(nonatomic,copy) NSString *minute; +@property(nonatomic,copy) NSString *oiliness; +@property(nonatomic,copy) NSString *oilinessPercent; + + +@end diff --git a/GIGA/Modules/Mask/Exercises/Model/MaskTestResult.m b/GIGA/Modules/Mask/Exercises/Model/MaskTestResult.m new file mode 100644 index 0000000..3f396d8 --- /dev/null +++ b/GIGA/Modules/Mask/Exercises/Model/MaskTestResult.m @@ -0,0 +1,13 @@ +// +// MaskTestResult.m +// GIGA +// +// Created by lianxiang on 2018/9/13. +// Copyright © 2018年 com.giga.ios. All rights reserved. +// + +#import "MaskTestResult.h" + +@implementation MaskTestResult + +@end diff --git a/GIGA/Modules/Mask/Exercises/Model/QustionAnswer.h b/GIGA/Modules/Mask/Exercises/Model/QustionAnswer.h index 513a33d..a171806 100644 --- a/GIGA/Modules/Mask/Exercises/Model/QustionAnswer.h +++ b/GIGA/Modules/Mask/Exercises/Model/QustionAnswer.h @@ -15,5 +15,7 @@ @property (nonatomic,assign) int dryness; @property (nonatomic,assign) int fx; @property (nonatomic,assign) int answer_id; +//默认答案 1选中 0 非选中 +@property (nonatomic,assign) int defaultFlag; @end diff --git a/GIGA/Modules/Mask/Exercises/View/GIGaQuestionSlider.m b/GIGA/Modules/Mask/Exercises/View/GIGaQuestionSlider.m index 5bd8fd0..934c526 100644 --- a/GIGA/Modules/Mask/Exercises/View/GIGaQuestionSlider.m +++ b/GIGA/Modules/Mask/Exercises/View/GIGaQuestionSlider.m @@ -23,7 +23,7 @@ self.minimumValue = 0.0; self.maximumValue = 1.0; - self.value = 0.5; + [self creatSubView:type]; } @@ -77,7 +77,6 @@ self.minimumValue = 0.0; self.maximumValue = 1.0; - self.value = 0.5; self.minimumTrackTintColor = GIGARGB(216,216, 216, 1); self.maximumTrackTintColor = GIGARGB(216,216, 216, 1); diff --git a/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.h b/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.h index 752f5e3..1eb1ee0 100644 --- a/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.h +++ b/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.h @@ -7,6 +7,7 @@ // #import +#import "ExercisesModel.h" typedef NS_ENUM(NSInteger,MaskQuetionViewStyle) { @@ -19,8 +20,8 @@ typedef NS_ENUM(NSInteger,MaskQuetionViewStyle) @protocol QeustionViewDelegate; @optional --(void)sliderChangeValueShouldChoiceModelAt:(NSInteger)index; --(void)yesOrNoChoiceModelAt:(NSInteger)index; +-(void)sliderChangeValueShouldChoiceModelAt:(int)index slider:(float)value; +-(void)yesOrNoChoiceModelAt:(int)index; @end @interface MaskQuestionView : UIView @@ -28,7 +29,8 @@ typedef NS_ENUM(NSInteger,MaskQuetionViewStyle) @property(nonatomic,assign) iddelegate; @property(nonatomic,assign) MaskQuetionViewStyle style; @property(nonatomic,strong) NSArray *answerList; +@property(nonatomic,strong) ExercisesModel *currentModel; --(instancetype)initQuestionView:(CGRect)frame style:(MaskQuetionViewStyle)style titles:(NSArray *)titles; +-(instancetype)initQuestionView:(CGRect)frame style:(MaskQuetionViewStyle)style titles:(NSArray *)titles current:(ExercisesModel *)currentModel; @end diff --git a/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.m b/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.m index 37e3b70..4f10bb8 100644 --- a/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.m +++ b/GIGA/Modules/Mask/Exercises/View/MaskQuestionView.m @@ -17,6 +17,8 @@ @property(nonatomic,strong) UITableView *tableView; @property(nonatomic,strong) GIGaQuestionSlider *slider; @property(nonatomic,strong) NYSliderPopover *poSlider; +@property(nonatomic,strong) UIButton *noBtn; +@property(nonatomic,strong) UIButton *yesBtn; @end @@ -30,11 +32,13 @@ } --(instancetype)initQuestionView:(CGRect)frame style:(MaskQuetionViewStyle)style titles:(NSArray *)titles{ +-(instancetype)initQuestionView:(CGRect)frame style:(MaskQuetionViewStyle)style titles:(NSArray *)titles current:(ExercisesModel *)currentModel{ self = [super initWithFrame:frame]; if (self) { self.dataArr = titles; + self.currentModel = currentModel; + self.answerList = currentModel.answerList; self.style = style; [self creatSubs:style titles:titles]; } @@ -81,6 +85,7 @@ [slider addTarget:self action:@selector(updateValue:) forControlEvents:UIControlEventValueChanged]; self.poSlider = slider; [self addSubview:slider]; + //self.poSlider.value = self.currentModel.slidervalue; self.poSlider.transform = CGAffineTransformMakeRotation(- M_PI/2); } @@ -94,6 +99,7 @@ GIGaQuestionSlider *slider = [[GIGaQuestionSlider alloc] initWithFrame:CGRectMake(0,self.frame.size.height,self.frame.size.height, 13) type:type]; [slider addTarget:self action:@selector(updateValue:) forControlEvents:UIControlEventValueChanged]; self.slider = slider; + [self.slider setValue:self.currentModel.slidervalue]; [self addSubview:slider]; self.slider.transform = CGAffineTransformMakeRotation(- M_PI/2); } @@ -116,39 +122,72 @@ -(void)creatYseNoView{ UIButton *yesBtn = [UIButton buttonWithType:UIButtonTypeCustom]; - yesBtn.backgroundColor = GIGARGB(181, 14, 14, 1); yesBtn.frame = CGRectMake(self.center.x - 120/2, 40, 120, 34); - [yesBtn addTarget:self action:@selector(yesBtnAction) forControlEvents:UIControlEventTouchUpInside]; - NSAttributedString *preTitle = [[NSAttributedString alloc] initWithString:@"是" attributes:@{NSFontAttributeName:[UIFont fontWithName:GIGA_FONTBOLD size:18],NSForegroundColorAttributeName:[UIColor whiteColor]}]; - [yesBtn setAttributedTitle:preTitle forState:UIControlStateNormal]; + [yesBtn addTarget:self action:@selector(yesBtnAction:) forControlEvents:UIControlEventTouchUpInside]; + yesBtn.layer.borderWidth = 1; + yesBtn.layer.borderColor = GIGARGB(181, 14, 14, 1).CGColor; yesBtn.layer.masksToBounds = YES; yesBtn.layer.cornerRadius = 2; + self.yesBtn = yesBtn; [self addSubview:yesBtn]; UIButton *noBtn = [UIButton buttonWithType:UIButtonTypeCustom]; - noBtn.backgroundColor = [UIColor whiteColor]; noBtn.frame = CGRectMake(self.center.x - 120/2,CGRectGetMaxY(yesBtn.frame) + 31, 120, 34); - [noBtn addTarget:self action:@selector(noBtnAction) forControlEvents:UIControlEventTouchUpInside]; - NSAttributedString *noBtnTitle = [[NSAttributedString alloc] initWithString:@"否" attributes:@{NSFontAttributeName:[UIFont fontWithName:GIGA_FONTBOLD size:18],NSForegroundColorAttributeName:GIGARGB(181, 14, 14, 1)}]; - [noBtn setAttributedTitle:noBtnTitle forState:UIControlStateNormal]; + [noBtn addTarget:self action:@selector(noBtnAction:) forControlEvents:UIControlEventTouchUpInside]; noBtn.layer.borderWidth = 1; noBtn.layer.borderColor = GIGARGB(181, 14, 14, 1).CGColor; noBtn.layer.masksToBounds = YES; noBtn.layer.cornerRadius = 2; + self.noBtn = noBtn; [self addSubview:noBtn]; - + //slidervalue 题目 是(是 否)类型 对应答案下标 + if (self.currentModel.slidervalue == 1 ) { + + [self selectNOBtnState:self.noBtn]; + }else{ + + [self selctYesBtnState:self.yesBtn]; + } } #pragma mark 是 --(void)yesBtnAction{ +-(void)yesBtnAction:(UIButton *)btn{ + + [self selctYesBtnState:btn]; if (self.delegate && [self.delegate performSelector:@selector(yesOrNoChoiceModelAt:)]) { [self.delegate yesOrNoChoiceModelAt:0]; } } #pragma mark 否 --(void)noBtnAction{ - [self.delegate yesOrNoChoiceModelAt:1]; +-(void)noBtnAction:(UIButton *)btn{ + + [self selectNOBtnState:btn]; + if (self.delegate && [self.delegate performSelector:@selector(yesOrNoChoiceModelAt:)]) { + [self.delegate yesOrNoChoiceModelAt:1]; + } +} +// +-(void)selctYesBtnState:(UIButton *)btn{ + NSAttributedString *preTitle = [[NSAttributedString alloc] initWithString:@"是" attributes:@{NSFontAttributeName:[UIFont fontWithName:GIGA_FONTBOLD size:18],NSForegroundColorAttributeName:[UIColor whiteColor]}]; + [btn setAttributedTitle:preTitle forState:UIControlStateNormal]; + btn.backgroundColor = GIGARGB(181, 14, 14, 1); + + NSAttributedString *noBtnTitle = [[NSAttributedString alloc] initWithString:@"否" attributes:@{NSFontAttributeName:[UIFont fontWithName:GIGA_FONTBOLD size:18],NSForegroundColorAttributeName:GIGARGB(181, 14, 14, 1)}]; + [self.noBtn setAttributedTitle:noBtnTitle forState:UIControlStateNormal]; + self.noBtn.backgroundColor = [UIColor whiteColor]; + +} + +-(void)selectNOBtnState:(UIButton *)btn{ + NSAttributedString *preTitle = [[NSAttributedString alloc] initWithString:@"否" attributes:@{NSFontAttributeName:[UIFont fontWithName:GIGA_FONTBOLD size:18],NSForegroundColorAttributeName:[UIColor whiteColor]}]; + [btn setAttributedTitle:preTitle forState:UIControlStateNormal]; + btn.backgroundColor = GIGARGB(181, 14, 14, 1); + + NSAttributedString *yesTitle = [[NSAttributedString alloc] initWithString:@"是" attributes:@{NSFontAttributeName:[UIFont fontWithName:GIGA_FONTBOLD size:18],NSForegroundColorAttributeName:GIGARGB(181, 14, 14, 1)}]; + + [self.yesBtn setAttributedTitle:yesTitle forState:UIControlStateNormal]; + self.yesBtn.backgroundColor = [UIColor whiteColor]; } -(void)updateValue:(UISlider *)slider{ @@ -163,24 +202,41 @@ if (_answerList.count <=2) { return; } + NSInteger totalCount = _answerList.count; - //设置权值 20 ~ 50 - - CGFloat sliderFormatValue = value*30 + 20; - if (self.poSlider) { [self.poSlider showPopover]; - self.poSlider.popover.textLabel.text = [NSString stringWithFormat:@"%.f",sliderFormatValue]; - - } - //从下到上 范围50 ~ 20 - //每一份高度 - int powSize = 30 / (totalCount - 1); - //第几份 - NSInteger index = (sliderFormatValue - 20) / powSize; + //设置权值 20 ~ 60 + NSString * valueF = [NSString stringWithFormat:@"%.2f",value]; + CGFloat sliderFormatValue = [valueF floatValue]*40.f + 20.f; + if (sliderFormatValue == 20.f) { + self.poSlider.popover.textLabel.text = @"20-"; + }else if (sliderFormatValue == 60.f){ + self.poSlider.popover.textLabel.text = @"60+"; + }else{ + self.poSlider.popover.textLabel.text = [NSString stringWithFormat:@"%.f",sliderFormatValue]; + } - if (self.delegate && [self.delegate performSelector:@selector(sliderChangeValueShouldChoiceModelAt:)]) { - [self.delegate sliderChangeValueShouldChoiceModelAt:index]; + } + + // 范围0 ~ 100 + //每一份高度 + CGFloat powSize = 100.f / (totalCount -1); + //当前值 + CGFloat currentValue = value * 100.f; + + //答案游标 1开始 + int count = currentValue / powSize; + + //答案数组下标 + int index = 0 ; + index = (int)_answerList.count - 1 -count; + if (index < 0) { + index = 0; + } + + if (self.delegate && [self.delegate performSelector:@selector(sliderChangeValueShouldChoiceModelAt: slider:)]) { + [self.delegate sliderChangeValueShouldChoiceModelAt:index slider:value]; } } diff --git a/GIGA/Modules/Mask/Exercises/View/NYSliderPopover/NYSliderPopover.m b/GIGA/Modules/Mask/Exercises/View/NYSliderPopover/NYSliderPopover.m index 8634a03..004c421 100755 --- a/GIGA/Modules/Mask/Exercises/View/NYSliderPopover/NYSliderPopover.m +++ b/GIGA/Modules/Mask/Exercises/View/NYSliderPopover/NYSliderPopover.m @@ -149,7 +149,6 @@ self.minimumValue = 0.0; self.maximumValue = 1.0; - self.value = 0.5; self.minimumTrackTintColor = GIGARGB(216,216, 216, 1); self.maximumTrackTintColor = GIGARGB(216,216, 216, 1); diff --git a/GIGA/Modules/Me/Controller/GiGaMeViewController.m b/GIGA/Modules/Me/Controller/GiGaMeViewController.m index a29b39a..7505547 100644 --- a/GIGA/Modules/Me/Controller/GiGaMeViewController.m +++ b/GIGA/Modules/Me/Controller/GiGaMeViewController.m @@ -13,8 +13,11 @@ #import "GiSysSettingsVC.h" #import "GiMaskTimeHistoryVC.h" #import "UINavigationBar+Custom.h" +#import "GiGaBaseAPiRequest.h" +#import "GiGaUserManager.h" @interface GiGaMeViewController () +@property (nonatomic,strong) GiGaUser *user; @end @@ -28,14 +31,52 @@ [self.view addSubview:self.tableView]; self.tableView.delegate = self; self.tableView.dataSource = self; - self.tableView.backgroundColor = [UIColor lightGrayColor]; + self.tableView.backgroundColor = [UIColor whiteColor]; self.tableView.separatorStyle = UITableViewCellSelectionStyleNone; self.tableView.sectionFooterHeight = 0; self.tableView.estimatedSectionFooterHeight= 0; self.tableView.estimatedSectionHeaderHeight = 0; + self.tableView.bounces = NO; + self.tableView.frame = CGRectMake(0, PhoneX_TopMargin + 1, KMainW,KMainH - PhoneX_BottomMargin); + [self loadUserInfo]; } +-(void)loadUserInfo{ + GiGaUser *user = [[GiGaUserManager shareUser] getCurrentUser]; + + if (!user) { + + [self requstUserinfo]; + + }else{ + self.user = user; + } +} +-(void)requstUserinfo{ + + GiGaBaseAPiRequest *requst = [GiGaBaseAPiRequest initWithRequestPath:@"user/v1/info" method:RequestPostMethod parms:nil]; + [self.view makeToastActivity:CSToastPositionCenter]; + weakify(self); + [requst requstDataWithResult:^(GiGaAPIResult *result) { + [self.view hideToastActivity]; + if (result.success) { + //更新用户信息 + NSDictionary *userDic = result.dic[@"userInfo"]; + GiGaUser *user = [[GiGaUser alloc] initWithDictionary:userDic error:nil]; + weakSelf.user = user; + [[GiGaUserManager shareUser] saveUser:user]; + + NSIndexSet *set = [NSIndexSet indexSetWithIndex:0]; + + [self.tableView reloadSections:set withRowAnimation:UITableViewRowAnimationNone]; + + NSLog(@"user dic ***\n%@",result.dic); + } + }]; + +} + - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 2; } @@ -45,7 +86,7 @@ if (section == 0){ return 1; } - return 2; + return 3; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ @@ -55,6 +96,10 @@ cell = [[[NSBundle mainBundle] loadNibNamed:@"GiGaMineUserViewCell" owner:self options:nil] lastObject]; } + + if (self.user) { + [cell loadUserinfoWith:self.user]; + } return cell; } GiGaMineInfoViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GiGaMineInfoViewCell"]; @@ -83,21 +128,20 @@ GiMaskTimeHistoryVC *historyVC= [[GiMaskTimeHistoryVC alloc] init]; [self.navigationController pushViewController:historyVC animated:YES]; + }else if (indexPath.section == 1 && indexPath.row == 1){ + }else{ //系统设置 GiSysSettingsVC*settingsVC= [[GiSysSettingsVC alloc] init]; [self.navigationController pushViewController:settingsVC animated:YES]; } - } - } - + - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ if(indexPath.section==0){ - return 180; - + return 139; }else { return 54; } @@ -109,11 +153,20 @@ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ if (section == 1){ - return 20; + return 6; } return 0.1; } + +-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ + if (section == 1) { + UIView *view = [[UIView alloc] init]; + view.backgroundColor = GIGARGB(222, 222, 222, 1); + return view; + } + return nil; +} - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; diff --git a/GIGA/Modules/Me/Model/GiGaUser.h b/GIGA/Modules/Me/Model/GiGaUser.h index de62b91..0de8d66 100644 --- a/GIGA/Modules/Me/Model/GiGaUser.h +++ b/GIGA/Modules/Me/Model/GiGaUser.h @@ -11,10 +11,24 @@ @interface GiGaUser : JSONModel @property(nonatomic,copy) NSString *userId; -@property(nonatomic,copy) NSString *name; -@property(nonatomic,copy) NSString *avatar;//头像 -@property(nonatomic,copy) NSString *tel; -@property(nonatomic,copy) NSString *token; + +@property(nonatomic,copy) NSString *areaId; +@property(nonatomic,copy) NSString *areaName; +@property(nonatomic,copy) NSString *birthday; +@property(nonatomic,copy) NSString *cityId; +@property(nonatomic,copy) NSString *cityName; +@property(nonatomic,copy) NSString *headImgUrl; + +@property(nonatomic,copy) NSString *mobileMask; +@property(nonatomic,assign) NSInteger mobileStatus; +@property(nonatomic,copy) NSString *mobileStatusName; +@property(nonatomic,copy) NSString *nickName; +@property(nonatomic,copy) NSString *occupationCode; +@property(nonatomic,copy) NSString *provinceId; +@property(nonatomic,copy) NSString *provinceName; +@property(nonatomic,copy) NSString *sexCode; +@property(nonatomic,copy) NSString *sexName; +@property(nonatomic,copy) NSString *weixin; @end diff --git a/GIGA/Modules/Me/Model/GiGaUser.m b/GIGA/Modules/Me/Model/GiGaUser.m index ecaf377..e25d5a5 100644 --- a/GIGA/Modules/Me/Model/GiGaUser.m +++ b/GIGA/Modules/Me/Model/GiGaUser.m @@ -10,4 +10,9 @@ @implementation GiGaUser ++ (BOOL)propertyIsOptional:(NSString *)propertyName{ + + return YES; +} + @end diff --git a/GIGA/Modules/Me/View/GiGaMineInfoViewCell.m b/GIGA/Modules/Me/View/GiGaMineInfoViewCell.m index 6836da2..4b4a462 100644 --- a/GIGA/Modules/Me/View/GiGaMineInfoViewCell.m +++ b/GIGA/Modules/Me/View/GiGaMineInfoViewCell.m @@ -17,15 +17,13 @@ - (void)loadCellData:(NSIndexPath *)indexPath{ - if(indexPath.section == 1 && indexPath.row == 0){ - - self.listImageView.image = [UIImage imageNamed:@""]; - self.descLabel.text = @"历史记录"; - - }else{ - self.listImageView.image = [UIImage imageNamed:@""]; - self.descLabel.text = @"系统设置"; - } + NSArray *arr =@[@"历史记录",@"历史测试",@"系统设置"]; + NSArray *imageName = @[@"user_history",@"user_test",@"user_setup"]; + self.descLabel.text = arr[indexPath.row]; + self.listImageView.image = [UIImage imageNamed:imageName[indexPath.row]]; + + + } diff --git a/GIGA/Modules/Me/View/GiGaMineInfoViewCell.xib b/GIGA/Modules/Me/View/GiGaMineInfoViewCell.xib index 903bfa1..d7f5f92 100644 --- a/GIGA/Modules/Me/View/GiGaMineInfoViewCell.xib +++ b/GIGA/Modules/Me/View/GiGaMineInfoViewCell.xib @@ -12,43 +12,51 @@ - + - + - - - + + - - + + - + + + + + + + + - + + + @@ -62,4 +70,7 @@ + + + diff --git a/GIGA/Modules/Me/View/GiGaMineUserViewCell.h b/GIGA/Modules/Me/View/GiGaMineUserViewCell.h index bc385d9..8848c60 100644 --- a/GIGA/Modules/Me/View/GiGaMineUserViewCell.h +++ b/GIGA/Modules/Me/View/GiGaMineUserViewCell.h @@ -7,7 +7,13 @@ // #import +#import "GiGaUser.h" @interface GiGaMineUserViewCell : UITableViewCell +@property (weak, nonatomic) IBOutlet UIImageView *userAvator; +@property (weak, nonatomic) IBOutlet UILabel *userName; +@property (weak, nonatomic) IBOutlet UIButton *vipLabe; + +-(void)loadUserinfoWith:(GiGaUser *)user; @end diff --git a/GIGA/Modules/Me/View/GiGaMineUserViewCell.m b/GIGA/Modules/Me/View/GiGaMineUserViewCell.m index 51a4f26..eba6d95 100644 --- a/GIGA/Modules/Me/View/GiGaMineUserViewCell.m +++ b/GIGA/Modules/Me/View/GiGaMineUserViewCell.m @@ -8,12 +8,34 @@ //我的 - 个人中心cell #import "GiGaMineUserViewCell.h" +#import "UIImageView+WebCache.h" @implementation GiGaMineUserViewCell - (void)awakeFromNib { [super awakeFromNib]; // Initialization code + self.vipLabe.layer.masksToBounds = YES; + self.vipLabe.layer.cornerRadius = self.vipLabe.frame.size.height /2; + self.vipLabe.layer.borderWidth = 1; + self.vipLabe.layer.borderColor = [UIColor whiteColor].CGColor; + + self.userAvator.layer.masksToBounds = YES; + self.userAvator.layer.cornerRadius = self.userAvator.frame.size.height /2 ; + +} + +-(void)loadUserinfoWith:(GiGaUser *)user{ + + if (user.headImgUrl && ![user.nickName isKindOfClass:[NSNull class]]) { + [self.userAvator sd_setImageWithURL:[NSURL URLWithString:user.headImgUrl]]; + } + if (!user.nickName && ![user.nickName isKindOfClass:[NSNull class]]) { + self.userName.text = user.nickName; + }else{ + self.userName.text = @"GIGAUser666"; + } + } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { diff --git a/GIGA/Modules/Me/View/GiGaMineUserViewCell.xib b/GIGA/Modules/Me/View/GiGaMineUserViewCell.xib index 3e138bd..4d91120 100644 --- a/GIGA/Modules/Me/View/GiGaMineUserViewCell.xib +++ b/GIGA/Modules/Me/View/GiGaMineUserViewCell.xib @@ -12,35 +12,69 @@ - - + + - + - - - - + + + + + + - + + + + + + + + + + - + - + + + + + + + + + +