Commit 3695053385a3662325a65c616844f330eb932ea2

Authored by 张旭
1 parent 54a0be3a

商品管理-搜索

Showing 18 changed files with 1124 additions and 4 deletions
@@ -50,6 +50,8 @@ target 'metaCode' do @@ -50,6 +50,8 @@ target 'metaCode' do
50 50
51 #视频播放器 51 #视频播放器
52 pod 'PLPlayerKit' 52 pod 'PLPlayerKit'
  53 + #UI框架
  54 + pod 'QMUIKit'
53 55
54 target 'metaCodeTests' do 56 target 'metaCodeTests' do
55 inherit! :search_paths 57 inherit! :search_paths
metaCode.xcodeproj/project.pbxproj
@@ -69,6 +69,8 @@ @@ -69,6 +69,8 @@
69 1917335E2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917335D2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift */; }; 69 1917335E2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917335D2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift */; };
70 191733602B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917335F2B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift */; }; 70 191733602B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917335F2B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift */; };
71 191733622B3538DC007BCC04 /* CNLiveShopCouponsManagerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733612B3538DC007BCC04 /* CNLiveShopCouponsManagerViewController.swift */; }; 71 191733622B3538DC007BCC04 /* CNLiveShopCouponsManagerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733612B3538DC007BCC04 /* CNLiveShopCouponsManagerViewController.swift */; };
  72 + 191733642B392011007BCC04 /* CNLiveShopGoodsSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733632B392011007BCC04 /* CNLiveShopGoodsSearchViewController.swift */; };
  73 + 191733662B39237D007BCC04 /* CNLiveShopGoodsManageListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733652B39237D007BCC04 /* CNLiveShopGoodsManageListTableViewCell.swift */; };
72 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */; }; 74 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */; };
73 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */; }; 75 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */; };
74 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */; }; 76 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */; };
@@ -103,6 +105,8 @@ @@ -103,6 +105,8 @@
103 19CC4D542ADD163D00308E2A /* CNUpSlideCardPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D532ADD163D00308E2A /* CNUpSlideCardPresentationController.swift */; }; 105 19CC4D542ADD163D00308E2A /* CNUpSlideCardPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D532ADD163D00308E2A /* CNUpSlideCardPresentationController.swift */; };
104 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D552ADD19C200308E2A /* String+Extension.swift */; }; 106 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19CC4D552ADD19C200308E2A /* String+Extension.swift */; };
105 19D2CE632AE8B65D00691757 /* CNLiveDownSlideTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */; }; 107 19D2CE632AE8B65D00691757 /* CNLiveDownSlideTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */; };
  108 + 19E9D1602B3A98C200D0FB30 /* CNLiveShopAssociatedGoodsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19E9D15F2B3A98C200D0FB30 /* CNLiveShopAssociatedGoodsTableViewCell.swift */; };
  109 + 19E9D1622B3BBB2E00D0FB30 /* CNLiveFileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19E9D1612B3BBB2E00D0FB30 /* CNLiveFileManager.swift */; };
106 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */; }; 110 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */; };
107 19FA20172AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19FA20162AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift */; }; 111 19FA20172AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19FA20162AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift */; };
108 19FA20192AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19FA20182AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift */; }; 112 19FA20192AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19FA20182AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift */; };
@@ -301,6 +305,8 @@ @@ -301,6 +305,8 @@
301 1917335D2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCouponListTableViewCell.swift; sourceTree = "<group>"; }; 305 1917335D2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCouponListTableViewCell.swift; sourceTree = "<group>"; };
302 1917335F2B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCouponGoodsListTableViewCell.swift; sourceTree = "<group>"; }; 306 1917335F2B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCouponGoodsListTableViewCell.swift; sourceTree = "<group>"; };
303 191733612B3538DC007BCC04 /* CNLiveShopCouponsManagerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopCouponsManagerViewController.swift; sourceTree = "<group>"; }; 307 191733612B3538DC007BCC04 /* CNLiveShopCouponsManagerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopCouponsManagerViewController.swift; sourceTree = "<group>"; };
  308 + 191733632B392011007BCC04 /* CNLiveShopGoodsSearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopGoodsSearchViewController.swift; sourceTree = "<group>"; };
  309 + 191733652B39237D007BCC04 /* CNLiveShopGoodsManageListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopGoodsManageListTableViewCell.swift; sourceTree = "<group>"; };
304 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideViewController.swift; sourceTree = "<group>"; }; 310 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideViewController.swift; sourceTree = "<group>"; };
305 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideViewModel.swift; sourceTree = "<group>"; }; 311 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideViewModel.swift; sourceTree = "<group>"; };
306 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideModel.swift; sourceTree = "<group>"; }; 312 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideModel.swift; sourceTree = "<group>"; };
@@ -335,6 +341,8 @@ @@ -335,6 +341,8 @@
335 19CC4D532ADD163D00308E2A /* CNUpSlideCardPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideCardPresentationController.swift; sourceTree = "<group>"; }; 341 19CC4D532ADD163D00308E2A /* CNUpSlideCardPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideCardPresentationController.swift; sourceTree = "<group>"; };
336 19CC4D552ADD19C200308E2A /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = "<group>"; }; 342 19CC4D552ADD19C200308E2A /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = "<group>"; };
337 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideTool.swift; sourceTree = "<group>"; }; 343 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideTool.swift; sourceTree = "<group>"; };
  344 + 19E9D15F2B3A98C200D0FB30 /* CNLiveShopAssociatedGoodsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopAssociatedGoodsTableViewCell.swift; sourceTree = "<group>"; };
  345 + 19E9D1612B3BBB2E00D0FB30 /* CNLiveFileManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveFileManager.swift; sourceTree = "<group>"; };
338 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNIDCardView.swift; sourceTree = "<group>"; }; 346 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNIDCardView.swift; sourceTree = "<group>"; };
339 19FA20162AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideRecommendCell.swift; sourceTree = "<group>"; }; 347 19FA20162AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideRecommendCell.swift; sourceTree = "<group>"; };
340 19FA20182AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideTodayRecommendCell.swift; sourceTree = "<group>"; }; 348 19FA20182AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideTodayRecommendCell.swift; sourceTree = "<group>"; };
@@ -591,6 +599,7 @@ @@ -591,6 +599,7 @@
591 children = ( 599 children = (
592 19565EC42AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift */, 600 19565EC42AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift */,
593 19565EC62AF8AD38007D6727 /* CNLiveShopNewProductController.swift */, 601 19565EC62AF8AD38007D6727 /* CNLiveShopNewProductController.swift */,
  602 + 191733632B392011007BCC04 /* CNLiveShopGoodsSearchViewController.swift */,
594 191732E42B05FFE8007BCC04 /* CNLiveModalPresentationViewController.swift */, 603 191732E42B05FFE8007BCC04 /* CNLiveModalPresentationViewController.swift */,
595 1965FA412AFB79EA00F0F435 /* CNLiveGoodsCategoryController.swift */, 604 1965FA412AFB79EA00F0F435 /* CNLiveGoodsCategoryController.swift */,
596 191732EE2B075C3A007BCC04 /* CNLiveCreateShopClassifyViewController.swift */, 605 191732EE2B075C3A007BCC04 /* CNLiveCreateShopClassifyViewController.swift */,
@@ -604,6 +613,8 @@ @@ -604,6 +613,8 @@
604 children = ( 613 children = (
605 19565ECC2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift */, 614 19565ECC2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift */,
606 19565ECE2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift */, 615 19565ECE2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift */,
  616 + 191733652B39237D007BCC04 /* CNLiveShopGoodsManageListTableViewCell.swift */,
  617 + 19E9D15F2B3A98C200D0FB30 /* CNLiveShopAssociatedGoodsTableViewCell.swift */,
607 1965FA3D2AFB176E00F0F435 /* CNLiveShopAddGoodsSingleView.swift */, 618 1965FA3D2AFB176E00F0F435 /* CNLiveShopAddGoodsSingleView.swift */,
608 1965FA3F2AFB38AA00F0F435 /* CNLiveAddGoodsSelectUploadImageView.swift */, 619 1965FA3F2AFB38AA00F0F435 /* CNLiveAddGoodsSelectUploadImageView.swift */,
609 191733012B0C4EAB007BCC04 /* CNLiveSelUplSingleImageView.swift */, 620 191733012B0C4EAB007BCC04 /* CNLiveSelUplSingleImageView.swift */,
@@ -664,6 +675,7 @@ @@ -664,6 +675,7 @@
664 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */, 675 19D2CE622AE8B65D00691757 /* CNLiveDownSlideTool.swift */,
665 19BB202A2AF382150094D962 /* CNLiveAdaptTool.swift */, 676 19BB202A2AF382150094D962 /* CNLiveAdaptTool.swift */,
666 191733302B170537007BCC04 /* CNLiveCommonManager.swift */, 677 191733302B170537007BCC04 /* CNLiveCommonManager.swift */,
  678 + 19E9D1612B3BBB2E00D0FB30 /* CNLiveFileManager.swift */,
667 ); 679 );
668 path = Util; 680 path = Util;
669 sourceTree = "<group>"; 681 sourceTree = "<group>";
@@ -891,8 +903,8 @@ @@ -891,8 +903,8 @@
891 796398952A260C3700D045EB /* Supporting Files */ = { 903 796398952A260C3700D045EB /* Supporting Files */ = {
892 isa = PBXGroup; 904 isa = PBXGroup;
893 children = ( 905 children = (
894 - 818163C12A25CFCC00579C86 /* Main.storyboard */,  
895 818163C42A25CFCF00579C86 /* Assets.xcassets */, 906 818163C42A25CFCF00579C86 /* Assets.xcassets */,
  907 + 818163C12A25CFCC00579C86 /* Main.storyboard */,
896 818163C62A25CFCF00579C86 /* LaunchScreen.storyboard */, 908 818163C62A25CFCF00579C86 /* LaunchScreen.storyboard */,
897 ); 909 );
898 path = "Supporting Files"; 910 path = "Supporting Files";
@@ -1057,8 +1069,8 @@ @@ -1057,8 +1069,8 @@
1057 7CD675372A2740B0008354C1 /* CNUpSlideViewRemindView.swift */, 1069 7CD675372A2740B0008354C1 /* CNUpSlideViewRemindView.swift */,
1058 7CD6753B2A2740B0008354C1 /* CNDownSlideView.swift */, 1070 7CD6753B2A2740B0008354C1 /* CNDownSlideView.swift */,
1059 7CD675382A2740B0008354C1 /* CNMainView.swift */, 1071 7CD675382A2740B0008354C1 /* CNMainView.swift */,
1060 - 7CD675392A2740B0008354C1 /* CNUpSlideView.swift */,  
1061 7CD6753A2A2740B0008354C1 /* CNDownSlideViewRemindView.swift */, 1072 7CD6753A2A2740B0008354C1 /* CNDownSlideViewRemindView.swift */,
  1073 + 7CD675392A2740B0008354C1 /* CNUpSlideView.swift */,
1062 7CD675412A2740F8008354C1 /* CNCustomIndexView.swift */, 1074 7CD675412A2740F8008354C1 /* CNCustomIndexView.swift */,
1063 7C4931302A2F142F000E44B4 /* CNHomePageBackgroupView.swift */, 1075 7C4931302A2F142F000E44B4 /* CNHomePageBackgroupView.swift */,
1064 7C4931372A307BDB000E44B4 /* CNHomePageGuideView.swift */, 1076 7C4931372A307BDB000E44B4 /* CNHomePageGuideView.swift */,
@@ -1456,6 +1468,7 @@ @@ -1456,6 +1468,7 @@
1456 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */, 1468 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */,
1457 7C7C62F62A4D72E9007A912E /* CNLiveIdentityDB.swift in Sources */, 1469 7C7C62F62A4D72E9007A912E /* CNLiveIdentityDB.swift in Sources */,
1458 19CC4D4F2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift in Sources */, 1470 19CC4D4F2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift in Sources */,
  1471 + 191733642B392011007BCC04 /* CNLiveShopGoodsSearchViewController.swift in Sources */,
1459 79EABB892AB4497700F3A4E2 /* CNLiveSaveStandDB.swift in Sources */, 1472 79EABB892AB4497700F3A4E2 /* CNLiveSaveStandDB.swift in Sources */,
1460 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */, 1473 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */,
1461 19BB1FEA2AEF7B4A0094D962 /* CNLiveShopConsoleCell.swift in Sources */, 1474 19BB1FEA2AEF7B4A0094D962 /* CNLiveShopConsoleCell.swift in Sources */,
@@ -1475,6 +1488,7 @@ @@ -1475,6 +1488,7 @@
1475 799172362AF08D4500DC01A8 /* CNLiveShopBaseModel.swift in Sources */, 1488 799172362AF08D4500DC01A8 /* CNLiveShopBaseModel.swift in Sources */,
1476 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */, 1489 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */,
1477 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */, 1490 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */,
  1491 + 19E9D1622B3BBB2E00D0FB30 /* CNLiveFileManager.swift in Sources */,
1478 79E496E82AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift in Sources */, 1492 79E496E82AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift in Sources */,
1479 19CC4D472ADD006600308E2A /* CNDownSlideSingleCourseCell.swift in Sources */, 1493 19CC4D472ADD006600308E2A /* CNDownSlideSingleCourseCell.swift in Sources */,
1480 191733232B14601A007BCC04 /* CNLivePlayerProgressSlider.swift in Sources */, 1494 191733232B14601A007BCC04 /* CNLivePlayerProgressSlider.swift in Sources */,
@@ -1485,6 +1499,7 @@ @@ -1485,6 +1499,7 @@
1485 19565EC72AF8AD38007D6727 /* CNLiveShopNewProductController.swift in Sources */, 1499 19565EC72AF8AD38007D6727 /* CNLiveShopNewProductController.swift in Sources */,
1486 798A44F72A3077ED00815935 /* CNLiveHotButton.swift in Sources */, 1500 798A44F72A3077ED00815935 /* CNLiveHotButton.swift in Sources */,
1487 7CD6753D2A2740B0008354C1 /* CNMainView.swift in Sources */, 1501 7CD6753D2A2740B0008354C1 /* CNMainView.swift in Sources */,
  1502 + 191733662B39237D007BCC04 /* CNLiveShopGoodsManageListTableViewCell.swift in Sources */,
1488 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */, 1503 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */,
1489 1917334E2B2C1A08007BCC04 /* CNLiveSelectCouponTapView.swift in Sources */, 1504 1917334E2B2C1A08007BCC04 /* CNLiveSelectCouponTapView.swift in Sources */,
1490 191733272B148BB1007BCC04 /* CNLivePlayerFastForwardPreviewView.swift in Sources */, 1505 191733272B148BB1007BCC04 /* CNLivePlayerFastForwardPreviewView.swift in Sources */,
@@ -1537,6 +1552,7 @@ @@ -1537,6 +1552,7 @@
1537 790D01A32A2DDBA300C5978D /* CNLiveConfigManager.swift in Sources */, 1552 790D01A32A2DDBA300C5978D /* CNLiveConfigManager.swift in Sources */,
1538 19565EC52AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift in Sources */, 1553 19565EC52AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift in Sources */,
1539 19CC4D492ADD06C500308E2A /* UITableView+Extension.swift in Sources */, 1554 19CC4D492ADD06C500308E2A /* UITableView+Extension.swift in Sources */,
  1555 + 19E9D1602B3A98C200D0FB30 /* CNLiveShopAssociatedGoodsTableViewCell.swift in Sources */,
1540 191732CE2B04AACD007BCC04 /* CNLiveShopTextView.swift in Sources */, 1556 191732CE2B04AACD007BCC04 /* CNLiveShopTextView.swift in Sources */,
1541 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */, 1557 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */,
1542 7987BF3D2A497644000A1ABC /* CNLiveMineQuestViewController.swift in Sources */, 1558 7987BF3D2A497644000A1ABC /* CNLiveMineQuestViewController.swift in Sources */,
metaCode/Classes/Common/Base/CNLiveBaseNavigationController.swift
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 7
8 import Foundation 8 import Foundation
9 9
10 -class CNLiveBaseNavigationController : UINavigationController, UIGestureRecognizerDelegate,UINavigationControllerDelegate { 10 +class CNLiveBaseNavigationController : UINavigationController,UINavigationControllerDelegate {
11 11
12 override func viewDidLoad() { 12 override func viewDidLoad() {
13 super.viewDidLoad() 13 super.viewDidLoad()
@@ -26,7 +26,8 @@ class CNLiveBaseNavigationController : UINavigationController, UIGestureRecogniz @@ -26,7 +26,8 @@ class CNLiveBaseNavigationController : UINavigationController, UIGestureRecogniz
26 // MARK: - <UIGestureRecognizerDelegate> 26 // MARK: - <UIGestureRecognizerDelegate>
27 // 什么时候调用:每次触发手势之前都会询问下代理,是否触发。 27 // 什么时候调用:每次触发手势之前都会询问下代理,是否触发。
28 // 作用:拦截手势触发,手势识别器对象会调用这个代理方法来决定手势是否有效 28 // 作用:拦截手势触发,手势识别器对象会调用这个代理方法来决定手势是否有效
29 - func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { 29 + override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
  30 + super.gestureRecognizerShouldBegin(gestureRecognizer)
30 // if (gestureRecognizer == self.navigationController?.interactivePopGestureRecognizer) && (self.navigationController?.visibleViewController == self.navigationController?.viewControllers.first) { 31 // if (gestureRecognizer == self.navigationController?.interactivePopGestureRecognizer) && (self.navigationController?.visibleViewController == self.navigationController?.viewControllers.first) {
31 // return false 32 // return false
32 // } 33 // }
metaCode/Classes/Config/CNLiveConfigManager.swift
@@ -80,5 +80,7 @@ extension Notification.Name { @@ -80,5 +80,7 @@ extension Notification.Name {
80 public static let kDSGoodsManageEditNotification = Notification.Name("kDSGoodsManageEditNotification") 80 public static let kDSGoodsManageEditNotification = Notification.Name("kDSGoodsManageEditNotification")
81 //删除商品通知 81 //删除商品通知
82 public static let kDSGoodsManageDeleteNotification = Notification.Name("kDSGoodsManageDeleteNotification") 82 public static let kDSGoodsManageDeleteNotification = Notification.Name("kDSGoodsManageDeleteNotification")
  83 + //搜索确认处理
  84 + public static let kDSSelectGoodsNotification = Notification.Name("kDSSelectGoodsNotification")
83 } 85 }
84 } 86 }
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopGoodsSearchViewController.swift 0 → 100644
  1 +//
  2 +// CNLiveShopGoodsSearchViewController.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/12/25.
  6 +//
  7 +
  8 +import Foundation
  9 +import MJRefresh
  10 +import QMUIKit
  11 +enum CNSearchType{
  12 +
  13 + /// 搜索普通商品类型
  14 + case defaultGoods
  15 + /// 搜索关联商品类型
  16 + case associateGoods
  17 +}
  18 +
  19 +class CNLiveShopGoodsSearchViewController:CNLiveBaseViewController,UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate{
  20 +
  21 +
  22 +
  23 + /// 搜索历史最大缓存数量
  24 + let kCNLiveMaxCacheSearchKeywordKey = 30
  25 + /// 历史记录本地缓存key
  26 + let kDSSaveShopSearchHistroyData = "kDSSaveShopSearchHistroyData"
  27 + /// 搜索关键字
  28 + var keyWord:String?
  29 + var rightNavBtn:UIButton?
  30 +
  31 + lazy var tableView : UITableView = {
  32 + let tableView = UITableView(frame: CGRect(x: 0, y: KNavigationHeight, width: KSreenWidth, height: KSreenHeight-KNavigationHeight), style: .plain)
  33 + tableView.dataSource = self
  34 + tableView.delegate = self
  35 + tableView.backgroundColor = .white
  36 + tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom:getSystemTabbarUiOffsetHeight , right: 0)
  37 +// tableView.emptyDataSetSource = self
  38 +// tableView.emptyDataSetDelegate = self
  39 + tableView.separatorStyle = .none
  40 + tableView.tableFooterView = UIView.init()
  41 + tableView.tableHeaderView = self.cn_tableHeaderView()
  42 + tableView.mj_footer = MJRefreshAutoNormalFooter.init(refreshingBlock: {[weak self] in
  43 + self!.loadMoreAction()
  44 + })
  45 + tableView.mj_footer?.isHidden = true
  46 + tableView.register(CNLiveShopGoodsManageListTableViewCell.self, forCellReuseIdentifier: kDSShopGoodsManageListTableViewCellID)
  47 + tableView.register(CNLiveShopAssociatedGoodsTableViewCell.self, forCellReuseIdentifier: kDSShopAssociatedGoodsTableViewCellID)
  48 + return tableView
  49 + }()
  50 + /// 搜索结果数据源
  51 + lazy var dataArr: NSMutableArray = {
  52 + return NSMutableArray()
  53 + }()
  54 + /// 历史记录数据
  55 + lazy var hisDataArr = {
  56 + return NSMutableArray()
  57 + }()
  58 + var searchTextField:UITextField?
  59 + /// 页码
  60 + var page:Int = 0
  61 + var searchType:CNSearchType = .defaultGoods
  62 +
  63 + /// 选中的关联商品
  64 + var selectAssociatedGoodsModel:ShopOrderAssociatedGoodsModel?
  65 +
  66 + init(searchType:CNSearchType) {
  67 + super.init(nibName: nil, bundle: nil)
  68 + self.searchType = searchType
  69 + }
  70 +
  71 + required init?(coder: NSCoder) {
  72 + fatalError("init(coder:) has not been implemented")
  73 + }
  74 +
  75 + override func viewDidLoad() {
  76 + super.viewDidLoad()
  77 + self.view.backgroundColor = .white
  78 + navigationBarHidden = false
  79 + self.initTopNav()
  80 + self.view.addSubview(self.tableView)
  81 + }
  82 +
  83 + override func viewDidAppear(_ animated: Bool) {
  84 + super.viewDidAppear(animated)
  85 + self.searchTextField?.becomeFirstResponder()
  86 + self.popGestureRecognizerEnable = false
  87 + }
  88 +
  89 + override func viewDidDisappear(_ animated: Bool) {
  90 + super.viewDidDisappear(animated)
  91 + self.popGestureRecognizerEnable = true
  92 + }
  93 +
  94 + override func viewWillLayoutSubviews() {
  95 + super.viewWillLayoutSubviews()
  96 + self.tableView.frame = CGRect(x: 0, y: KNavigationHeight, width: KSreenWidth, height: self.view.height-KNavigationHeight)
  97 +
  98 + }
  99 +
  100 + // MARK: - initTopNav
  101 + func initTopNav(){
  102 + let searchBgView = CNLiveRoundedRectView(frame: CGRect(x: 52, y: get_system_statusBar_height()+(get_system_nav_ui_height()-30)/2, width: self.topNavView.width-52*2, height: 30))
  103 + searchBgView.fillColor = HexColor("#F2F2F2")
  104 + searchBgView.radius = searchBgView.height/2
  105 + self.topNavView.addSubview(searchBgView)
  106 +
  107 + let searchImageView = UIImageView(frame: CGRect(x: 15, y: (searchBgView.height-16)/2, width: 16, height: 16))
  108 + searchImageView.clipsToBounds = true
  109 + searchImageView.contentMode = .scaleAspectFit
  110 + searchImageView.image = UIImage(named: "DS_goods_search_icon")
  111 + searchBgView.addSubview(searchImageView)
  112 +
  113 + let searchLine = UIImageView(frame: CGRect(x: searchImageView.right+10, y: (searchBgView.height-11)/2, width: DS_RRV_ONE_PIXEL, height: 11))
  114 + searchLine.backgroundColor = HexColor("#999999")
  115 + searchBgView.addSubview(searchLine)
  116 +
  117 + let searchTextField = UITextField(frame: CGRect(x: searchLine.right+10, y: 0, width: searchBgView.width-(searchLine.right+10+15), height: searchBgView.height))
  118 + searchTextField.attributedPlaceholder = NSAttributedString(string: "请输你要搜索的商品", attributes: [.foregroundColor: HexColor("#D2D2D2")!])
  119 + searchTextField.textColor = HexColor("#333333")
  120 + searchTextField.font = Font_13
  121 + searchTextField.delegate = self
  122 + searchTextField.returnKeyType = .search
  123 + searchTextField.clearButtonMode = .whileEditing
  124 + searchBgView.addSubview(searchTextField)
  125 + self.searchTextField = searchTextField
  126 + searchTextField.addTarget(self, action: #selector(textFieldDidOnClearAndBecomeFirstResponder), for: .editingChanged)
  127 +
  128 + self.rightNavBtn = UIButton(type: .custom)
  129 + self.rightNavBtn?.setTitle("取消", for: .normal)
  130 + self.rightNavBtn?.frame = CGRect(x: 0, y: KStatusBarHeight, width: KNavigationHeight-KStatusBarHeight, height: KNavigationHeight-KStatusBarHeight)
  131 + self.rightNavBtn?.setTitleColor(HexColor("#ff725c"), for: .normal)
  132 + self.rightNavBtn?.addTarget(self, action: #selector(cancelNavBtnAction), for: .touchUpInside)
  133 + self.rightNavBtns = [self.rightNavBtn!]
  134 +
  135 + let leftNavBtn = UIButton(type: .custom)
  136 + leftNavBtn.setImage(UIImage(named: "DS_goods_search_back_icon"), for: .normal)
  137 + leftNavBtn.addTarget(self, action: #selector(rightNavBtnAction), for: .touchUpInside)
  138 + self.leftNavBtns = [leftNavBtn]
  139 + }
  140 +
  141 + // MARK: - UITableView 代理
  142 + func numberOfSections(in tableView: UITableView) -> Int {
  143 + if (self.dataArr.count == 0) {
  144 + return 0
  145 + }
  146 + return 1
  147 + }
  148 + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  149 + return self.dataArr.count
  150 + }
  151 + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  152 + if self.searchType == .associateGoods{
  153 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kDSShopAssociatedGoodsTableViewCellID) as? CNLiveShopAssociatedGoodsTableViewCell
  154 + else {
  155 + let cell = CNLiveShopAssociatedGoodsTableViewCell()
  156 + return cell
  157 + }
  158 + let goodsModel = self.dataArr[indexPath.row] as! ShopOrderAssociatedGoodsModel
  159 + var isSelect = false
  160 + if goodsModel.id == self.selectAssociatedGoodsModel!.id{
  161 + isSelect = true
  162 + }
  163 + cell.setModel(model: goodsModel, isSelect: isSelect, keyword: self.keyWord!)
  164 + return cell
  165 + }else{
  166 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kDSShopGoodsManageListTableViewCellID) as? CNLiveShopGoodsManageListTableViewCell
  167 + else {
  168 + let cell = CNLiveShopGoodsManageListTableViewCell()
  169 + return cell
  170 + }
  171 + cell.editCallBack = { model in
  172 + self.editGoodsModel(goodsModel: model)
  173 + }
  174 + cell.operStateCallBack = { model ,state in
  175 + self.operStateWithGoodsModel(goodsModel: model, state: state)
  176 + }
  177 + cell.editCountCallBack = { model in
  178 + self.editGoodsCountModel(goodsModel: model)
  179 + }
  180 + let model = self.dataArr[indexPath.row] as! ShopOrderAssociatedGoodsModel
  181 + cell.setSearchModel(model: model, keyWork: self.keyWord!)
  182 + return cell
  183 + }
  184 + }
  185 + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
  186 + let tempView = UIView(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: 50))
  187 + tempView.backgroundColor = .white
  188 + if section == 1{
  189 + tempView.height = 60
  190 + let topView = UIView(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: 10))
  191 + topView.backgroundColor = HexColor("#F9F9F9")
  192 + tempView.addSubview(topView)
  193 + }
  194 +
  195 + let nameLabel = UILabel(frame: CGRect(x: 10, y: 12 + (section == 1 ? 10 : 0), width: KSreenWidth - 90, height: 26))
  196 + nameLabel.textColor = HexColor("#333333")
  197 + nameLabel.font = UIFont.boldSystemFont(ofSize: 16)
  198 + nameLabel.lineBreakMode = .byTruncatingTail
  199 + nameLabel.numberOfLines = 1
  200 + nameLabel.text = String(format: "%@-商品", self.keyWord!)
  201 + tempView.addSubview(nameLabel)
  202 +
  203 + let lineLabel = UILabel(frame: CGRect(x: 10, y: 49 + (section == 1 ? 10 : 0), width: KSreenWidth - 20, height: DS_RRV_ONE_PIXEL))
  204 + lineLabel.backgroundColor = HexColor("#F2F2F2")
  205 + tempView.addSubview(lineLabel)
  206 +
  207 + return tempView
  208 + }
  209 +
  210 + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  211 + switch self.searchType {
  212 + case .defaultGoods:
  213 + return 167//100
  214 + case .associateGoods:
  215 + return 167
  216 + }
  217 + }
  218 + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
  219 + return 50
  220 + }
  221 + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  222 + let goodsModel = self.dataArr[indexPath.row] as! ShopOrderAssociatedGoodsModel
  223 + switch self.searchType {
  224 + case .defaultGoods:
  225 + let vc = CNLiveShopGoodsDetailsViewController()
  226 + vc.goodsId = goodsModel.id
  227 +// navigationViewController().pushViewController(vc, animated: pushAnimated)
  228 + break
  229 + case .associateGoods:
  230 + self.selectAssociatedGoodsModel = goodsModel
  231 + self.rightNavBtn?.setTitle("确认", for: .normal)
  232 + self.tableView.reloadData()
  233 + }
  234 + }
  235 + // MARK: - UIScrollViewDelegate
  236 + func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
  237 + self.view.endEditing(true)
  238 + }
  239 +
  240 + // MARK: - UITextFieldDelegate
  241 + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
  242 + if textField.tag == 666{
  243 + let isAllow = (string as NSString).allowWriteString(string: "0123456789")
  244 + return !isAllow
  245 + }
  246 + return true
  247 + }
  248 + func textFieldDidEndEditing(_ textField: UITextField) {
  249 + if textField.text?.count ?? 0 > 20{
  250 + textField.text = (textField.text! as NSString).substring(to: 20)
  251 + }
  252 + }
  253 +
  254 + func textFieldShouldReturn(_ textField: UITextField) -> Bool {
  255 + self.cn_skipGoodsListWithSearchKeyword(searchKeyword: textField.text ?? "")
  256 + return true
  257 + }
  258 +
  259 + @objc func textFieldShouldClear(_ textField: UITextField) -> Bool {
  260 + self.textFieldDidOnClearAndBecomeFirstResponder(textField: textField)
  261 + return true
  262 + }
  263 + @objc func textFieldDidOnClearAndBecomeFirstResponder(textField:UITextField){
  264 + if textField.text?.count == 0{
  265 + self.rightNavBtn?.setTitle("取消", for: .normal)
  266 + self.dataArr.removeAllObjects()
  267 + self.tableView.mj_footer?.isHidden = true
  268 + self.searchTextField?.text = ""
  269 + self.tableView.tableHeaderView = self.cn_tableHeaderView()
  270 + self.tableView.reloadData()
  271 + self.searchTextField?.becomeFirstResponder()
  272 + }
  273 + if textField.text?.count ?? 0 > 20{
  274 + showMessage(message: "最长20个字!超出部分会在输入完成时自动删除")
  275 + }
  276 + }
  277 + // MARK: - response method
  278 + /// 点击历史记录
  279 + /// @param button
  280 + @objc func hisBtnClick(_ button:UIButton){
  281 + self.searchTextField?.text = button.titleLabel?.text
  282 + self.cn_skipGoodsListWithSearchKeyword(searchKeyword: button.titleLabel?.text ?? "")
  283 + }
  284 +
  285 + /// 删除历史记录
  286 + @objc func deleteAllData(){
  287 + CNLiveFileManager.shared.deleteKey(resetKey: kDSSaveShopSearchHistroyData)
  288 + self.tableView.tableHeaderView = self.cn_tableHeaderView()
  289 + self.tableView.reloadData()
  290 +
  291 + }
  292 +
  293 + /// 返回事件
  294 + /// @param button 戳发按钮
  295 + @objc func rightNavBtnAction(_ button:UIButton){
  296 + navigationViewController().popViewController(animated: false)
  297 + }
  298 +
  299 + /// 取消或确认选中的搜索商品 事件
  300 + /// @param button 戳发按钮
  301 + @objc func cancelNavBtnAction(_ button:UIButton){
  302 + if self.searchType == .associateGoods && self.selectAssociatedGoodsModel != nil{
  303 + // 搜索确认处理
  304 + NotificationCenter.default.post(name: Notification.Name.ShopGoodsManage.kDSSelectGoodsNotification, object: self.selectAssociatedGoodsModel)
  305 + let vcArray = self.navigationController?.viewControllers
  306 + for vc in vcArray!{
  307 +// if vc.isKind(of: CNDSDarenReleaseDynamicViewController.self){
  308 +// navigationViewController().popToViewController(vc, animated: true)
  309 +// return
  310 +// }
  311 + }
  312 + }else{
  313 + self.navigationController?.popViewController(animated: true)
  314 + }
  315 + }
  316 +
  317 + func loadMoreAction(){
  318 + self.page += 1
  319 + self.requestSearchWordDataWithKeyword(keyword: self.keyWord!, page: self.page)
  320 + }
  321 + /// 编辑商品
  322 + /// @param goodsModel 商品数据
  323 + func editGoodsModel(goodsModel:ShopOrderAssociatedGoodsModel){
  324 + let vc = CNLiveShopNewProductController()
  325 + vc.type = .edit
  326 + vc.goodsId = goodsModel.id!
  327 + navigationViewController().pushViewController(vc, animated: true)
  328 + }
  329 +
  330 + /// 编辑商品库存
  331 + /// @param goodsModel 商品数据
  332 + func editGoodsCountModel(goodsModel:ShopOrderAssociatedGoodsModel){
  333 + let alert = UIAlertController(title: "编辑商品库存", message: "请输入库存数量", preferredStyle: .alert)
  334 + alert.addTextField { textField in
  335 + textField.delegate = self
  336 + textField.keyboardType = .numberPad
  337 + textField.returnKeyType = .done
  338 + textField.tag = 666
  339 + }
  340 + alert.addAction(UIAlertAction(title: "取消", style: .cancel, handler: nil))
  341 +
  342 + alert.addAction(UIAlertAction(title: "修改", style: .default, handler: { action in
  343 + self.view.endEditing(true)
  344 + let textField = alert.textFields?.first
  345 + if textField?.text?.count == 0 || textField?.text?.count ?? 0 >= 6{
  346 + showMessage(message: "请输入有效的商品库存数量")
  347 + return
  348 + }
  349 + self.requsetEditGoodsCount(count: textField?.text ?? "", goodsModel: goodsModel)
  350 + }))
  351 + present(alert, animated: true, completion: nil)
  352 + }
  353 +
  354 + /// 编辑商品上下架状态
  355 + /// @param goodsModel 商品数据
  356 + /// @param state 1:上架 2:下架
  357 + func operStateWithGoodsModel(goodsModel:ShopOrderAssociatedGoodsModel,state:Int){
  358 + var message = ""
  359 + if (state == 2) {
  360 + message = "确认下架?"
  361 + }else {
  362 + message = "确认上架?"
  363 + }
  364 + ConfigAlertManager.shared.presentAlert(title: "", message: message, actionTitles: ["取消","确认"]) { index in
  365 + if index == 1 {
  366 + showLoading(message: "")
  367 + CNLiveShopGoodListViewModel.postChangeGoodsStateWithGoodsId(goodsId: goodsModel.id!, state: "") { result, status in
  368 + if status == .success{
  369 + for (_,obj) in self.dataArr.enumerated(){
  370 + let model = obj as! ShopOrderAssociatedGoodsModel
  371 + if model.id == goodsModel.id{
  372 + if (model.state == "2") {
  373 + model.state = "1"
  374 + }else {
  375 + model.state = "2"
  376 + }
  377 + self.tableView.reloadData()
  378 + }
  379 + }
  380 + }else{
  381 + showMessage(message: "失败")
  382 + return
  383 + }
  384 + }
  385 + }
  386 + }
  387 + }
  388 + // MARK: - 网络请求
  389 + /// 搜索接口
  390 + /// @param keyword 关键字
  391 + func requestSearchWordDataWithKeyword(keyword:String,page:Int){
  392 + showLoading(message: "")
  393 + CNLiveShopGoodListViewModel.getGetGoodsListWithShopId(shopId: DSUserInfoManager.shared.dsUserInfo.id, sortType: "1", state: 0, categoryId: nil, keyword: keyword, page: page) { result, status in
  394 + hiddenLoading()
  395 + if status == .success{
  396 + let dataArr = result as! [ShopOrderAssociatedGoodsModel]
  397 + if (self.page == 1 && dataArr.count == 0) {
  398 + showMessage(message: "未搜索到相关结果")
  399 + self.dataArr.removeAllObjects()
  400 + self.tableView.tableHeaderView = self.cn_tableHeaderView()
  401 + self.tableView.reloadData()
  402 + self.rightNavBtn?.setTitle("取消", for: .normal)
  403 + self.searchTextField?.becomeFirstResponder()
  404 + }else{
  405 + if (page == 1) {
  406 + self.dataArr.removeAllObjects()
  407 + self.tableView.mj_footer?.isHidden = false
  408 + }
  409 +
  410 + /**没有更多数据判断依据为:每页数据默认为20条,如果当前获取的这页数据小于20条,说明没有下页数据*/
  411 + if (dataArr.count < 20) {
  412 + self.tableView.mj_footer?.isHidden = true
  413 + }
  414 + self.dataArr.addObjects(from: dataArr)
  415 + self.tableView.tableHeaderView = UIView()
  416 + self.tableView.reloadData()
  417 + }
  418 + }else{
  419 + showMessage(message: "搜索失败")
  420 + }
  421 + }
  422 + }
  423 + /// 设置库存数
  424 + /// @param count 库存数
  425 + /// @param goodsModel 商品数据
  426 + func requsetEditGoodsCount(count:String,goodsModel:ShopOrderAssociatedGoodsModel){
  427 + showLoading(message: "")
  428 + CNLiveShopGoodListViewModel.postGoodsEditAttrWithShopId(shopId: DSUserInfoManager.shared.dsUserInfo.id!, goodsId: goodsModel.id!, type: 1, value: count) { result, status in
  429 + if status == .success{
  430 + goodsModel.count = count
  431 + self.tableView.reloadData()
  432 + }else{
  433 + showMessage(message: "操作失败")
  434 + }
  435 + }
  436 + }
  437 +
  438 + func cn_tableHeaderView() -> UIView{
  439 + let headerView = UIView(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: 0))
  440 + let whiteView = UIView(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: 0))
  441 + whiteView.backgroundColor = .white
  442 + headerView.addSubview(whiteView)
  443 +
  444 + let markLab = UILabel(frame: CGRect(x: 25, y: 10, width: KSreenWidth-50, height: 30))
  445 + markLab.textColor = HexColor("#898989")
  446 + markLab.text = "历史搜索"
  447 + markLab.font = Font_15
  448 + whiteView.addSubview(markLab)
  449 +
  450 + self.hisDataArr.removeAllObjects()
  451 + if (CNLiveFileManager.shared.takeDataKey(key: kDSSaveShopSearchHistroyData)) != nil {
  452 + let arr = CNLiveFileManager.shared.takeDataKey(key: kDSSaveShopSearchHistroyData)!
  453 + self.hisDataArr.addObjects(from: arr)
  454 + }
  455 + if self.hisDataArr.count == 0{
  456 + whiteView.height = markLab.bottom
  457 + headerView.height = whiteView.bottom + 5
  458 + return whiteView
  459 + }
  460 +
  461 + let floatLayoutView = QMUIFloatLayoutView()
  462 + floatLayoutView.padding = UIEdgeInsets(top: 12, left: 12, bottom: 12, right: 12)
  463 + floatLayoutView.itemMargins = UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 10)
  464 + floatLayoutView.minimumItemSize = CGSizeMake(40, 29)// 以2个字的按钮作为最小宽度
  465 + whiteView.addSubview(floatLayoutView)
  466 +
  467 + for i in 0..<self.hisDataArr.count{
  468 + let button = UIButton(type: .custom)
  469 + button.backgroundColor = HexColor("#F9F9F9")
  470 + button.setTitleColor(HexColor("#666666"), for: .normal)
  471 + button.layer.cornerRadius = 5
  472 + button.titleLabel?.lineBreakMode = .byTruncatingTail
  473 + button.setTitle(self.hisDataArr[i] as? String, for: .normal)
  474 + button.titleLabel?.font = Font_13
  475 + button.contentEdgeInsets = UIEdgeInsets(top: 6, left: 10, bottom: 6, right: 10)
  476 + button.addTarget(self, action: #selector(hisBtnClick), for: .touchUpInside)
  477 + floatLayoutView.addSubview(button)
  478 + }
  479 + let padding = UIEdgeInsets(top: markLab.bottom, left: 10, bottom: 100, right: 10)
  480 + let contentWidth = whiteView.width - UIEdgeInsetsGetHorizontalValue(padding)
  481 + let floatLayoutViewSize = floatLayoutView.sizeThatFits(CGSize(width: contentWidth, height: CGFLOAT_MAX))
  482 + floatLayoutView.frame = CGRect(x: padding.left, y: padding.top, width: contentWidth, height: floatLayoutViewSize.height)
  483 +
  484 + let lineView = UIView(frame: CGRect(x: 10, y: floatLayoutView.bottom, width: KSreenWidth-20, height: DS_RRV_ONE_PIXEL))
  485 + lineView.backgroundColor = HexColor("#F2F2F2")
  486 + whiteView.addSubview(lineView)
  487 +
  488 + let deleteAllBtn = UIButton(type: .custom)
  489 + deleteAllBtn.frame = CGRect(x: 10, y: lineView.bottom+10, width: KSreenWidth-20, height: 30)
  490 + deleteAllBtn.addTarget(self, action: #selector(deleteAllData), for: .touchUpInside)
  491 + deleteAllBtn.titleLabel?.font = Font_15
  492 + deleteAllBtn.setTitleColor(HexColor("#f5a623"), for: .normal)
  493 + deleteAllBtn.setTitle("清除搜索历史", for: .normal)
  494 + whiteView.addSubview(deleteAllBtn)
  495 + whiteView.height = deleteAllBtn.bottom+10
  496 + headerView.height = whiteView.bottom+5
  497 + return headerView
  498 + }
  499 + func cn_skipGoodsListWithSearchKeyword(searchKeyword:String){
  500 + var searchKeywordStr = searchKeyword
  501 + let text = searchKeywordStr.replacingOccurrences(of: "\u{FFFC}", with: "")
  502 + //去除掉首尾的空白字符和换行字符
  503 + searchKeywordStr = searchKeywordStr.trimmingCharacters(in: .whitespacesAndNewlines)
  504 + if (searchKeywordStr.isEmpty) {
  505 + showMessage(message: "搜索关键字不能为空")
  506 + return
  507 + }
  508 + self.view.endEditing(true)
  509 + if self.hisDataArr.contains(searchKeywordStr){
  510 + self.hisDataArr.remove(searchKeywordStr)
  511 + }
  512 + self.hisDataArr.insert(searchKeyword, at: 0)
  513 + if self.hisDataArr.count > kCNLiveMaxCacheSearchKeywordKey{
  514 + self.hisDataArr.removeObjects(in: NSMakeRange(kCNLiveMaxCacheSearchKeywordKey - 1, self.hisDataArr.count - (kCNLiveMaxCacheSearchKeywordKey - 1) - 1))
  515 + }
  516 + CNLiveFileManager.shared.saveData(object: Array(self.hisDataArr), key: kDSSaveShopSearchHistroyData)
  517 + self.page = 1
  518 + self.keyWord = searchKeywordStr
  519 + self.requestSearchWordDataWithKeyword(keyword: self.keyWord!, page: self.page)
  520 +
  521 + }
  522 +}
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopProductManagerController.swift
@@ -89,6 +89,23 @@ class CNLiveShopProductManagerController:CNLiveBaseViewController, UITableViewDa @@ -89,6 +89,23 @@ class CNLiveShopProductManagerController:CNLiveBaseViewController, UITableViewDa
89 navigationBarHidden = false 89 navigationBarHidden = false
90 titleName = "商品管理" 90 titleName = "商品管理"
91 rightNavBtns = [self.addBtn] 91 rightNavBtns = [self.addBtn]
  92 +
  93 + let leftNavBtn = UIButton(type: .custom)
  94 + leftNavBtn.setImage(UIImage(named: "DS_goods_search_back_icon"), for: .normal)
  95 + leftNavBtn.addTarget(self, action: #selector(changeCancelAction), for: .touchUpInside)
  96 + leftNavBtn.width = 44
  97 + leftNavBtn.height = 44
  98 +
  99 + let leftSearchNavBtn = UIButton(type: .custom)
  100 + leftSearchNavBtn.setImage(UIImage(named: "DS_goods_manager_searchNav"), for: .normal)
  101 + leftSearchNavBtn.addTarget(self, action: #selector(searchBtnClick), for: .touchUpInside)
  102 + leftSearchNavBtn.width = 44
  103 + leftSearchNavBtn.height = 44
  104 + for btn in self.leftNavBtns{
  105 + btn.removeFromSuperview()
  106 + }
  107 + self.leftNavBtns = [leftNavBtn,leftSearchNavBtn]
  108 +
92 self.pageNum = 1 109 self.pageNum = 1
93 self.view.addSubview(self.classifyView) 110 self.view.addSubview(self.classifyView)
94 self.view.addSubview(tableView) 111 self.view.addSubview(tableView)
@@ -291,10 +308,16 @@ class CNLiveShopProductManagerController:CNLiveBaseViewController, UITableViewDa @@ -291,10 +308,16 @@ class CNLiveShopProductManagerController:CNLiveBaseViewController, UITableViewDa
291 308
292 309
293 // MARK: - BtnAction 310 // MARK: - BtnAction
  311 + @objc func changeCancelAction() {
  312 + self.navigationController?.popViewController(animated: true)
  313 + }
294 @objc func addBtnAction(){ 314 @objc func addBtnAction(){
295 navigationViewController().pushViewController(CNLiveShopNewProductController(), animated: pushAnimated) 315 navigationViewController().pushViewController(CNLiveShopNewProductController(), animated: pushAnimated)
296 // currentViewController()?.navigationController?.pushViewController(CNLiveShopNewProductController(), animated: pushAnimated) 316 // currentViewController()?.navigationController?.pushViewController(CNLiveShopNewProductController(), animated: pushAnimated)
297 } 317 }
  318 + @objc func searchBtnClick(){
  319 + navigationViewController().pushViewController(CNLiveShopGoodsSearchViewController(searchType: .defaultGoods), animated: pushAnimated)
  320 + }
298 321
299 // MARK: - 商品编辑通知 322 // MARK: - 商品编辑通知
300 @objc func goodsManageAddNotification(notification:Notification) { 323 @objc func goodsManageAddNotification(notification:Notification) {
metaCode/Classes/Main/HomePage/View/GoodsManager/CNLiveShopAssociatedGoodsTableViewCell.swift 0 → 100644
  1 +//
  2 +// CNLiveShopAssociatedGoodsTableViewCell.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/12/26.
  6 +//
  7 +
  8 +import Foundation
  9 +let kDSShopAssociatedGoodsTableViewCellID = "kDSShopAssociatedGoodsTableViewCellID"
  10 +class CNLiveShopAssociatedGoodsTableViewCell:UITableViewCell{
  11 + var model:ShopOrderAssociatedGoodsModel?
  12 + var isSelect:Bool = false
  13 + var goodsImageView:UIImageView?
  14 + var goodsTitleLab:UILabel?
  15 + var goodsTypeLab:UILabel?
  16 + var goodsPriceLab:UILabel?
  17 + var selectImageView:UIImageView?
  18 + var line:UIImageView?
  19 +
  20 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  21 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  22 + self.selectionStyle = .none
  23 + self.contentView.backgroundColor = .white
  24 + self.initUI()
  25 + }
  26 +
  27 + required init?(coder: NSCoder) {
  28 + fatalError("init(coder:) has not been implemented")
  29 + }
  30 +
  31 + // MARK: - initUI
  32 + func initUI(){
  33 + self.selectionStyle = .none
  34 + let goodsImageView = UIImageView()
  35 + goodsImageView.clipsToBounds = true
  36 + goodsImageView.contentMode = .scaleAspectFill
  37 + self.goodsImageView = goodsImageView
  38 + self.addSubview(goodsImageView)
  39 +
  40 + let goodsTitleLab = UILabel()
  41 + goodsTitleLab.textColor = HexColor("#333333")
  42 + goodsTitleLab.font = UIFont.systemFont(ofSize: 15, weight: .regular)
  43 + self.goodsTitleLab = goodsTitleLab
  44 + self.addSubview(goodsTitleLab)
  45 +
  46 + let goodsTypeLab = UILabel()
  47 + goodsTypeLab.textColor = HexColor("#999999")
  48 + goodsTypeLab.font = UIFont.systemFont(ofSize: 13, weight: .light)
  49 + self.goodsTypeLab = goodsTypeLab
  50 + self.addSubview(goodsTypeLab)
  51 +
  52 + let goodsPriceLab = UILabel()
  53 + goodsPriceLab.textColor = HexColor("#FF3355")
  54 + goodsPriceLab.font = UIFont.systemFont(ofSize: 19, weight: .medium)
  55 + self.goodsPriceLab = goodsPriceLab
  56 + self.addSubview(goodsPriceLab)
  57 +
  58 + let selectImageView = UIImageView()
  59 + selectImageView.clipsToBounds = true
  60 + selectImageView.contentMode = .scaleAspectFit
  61 + self.selectImageView = selectImageView
  62 + self.addSubview(selectImageView)
  63 +
  64 + let line = UIImageView()
  65 + line.backgroundColor = HexColor("#e4e4e4")
  66 + self.line = line
  67 + self.addSubview(line)
  68 + }
  69 +
  70 + // MARK: - 赋值
  71 + func setModel(model:ShopOrderAssociatedGoodsModel,isSelect:Bool){
  72 + self.setModel(model: model, isSelect: isSelect, keyword: "")
  73 + }
  74 + func setModel(model:ShopOrderAssociatedGoodsModel,isSelect:Bool,keyword:String){
  75 + self.model = model
  76 + self.isSelect = isSelect
  77 + self.goodsImageView?.kf.setImage(with: URL(string: self.model?.simg ?? ""))
  78 + let titleAtt = NSMutableAttributedString(string: self.model?.title ?? "")
  79 + if let range = self.model!.title!.range(of: keyword) {
  80 + titleAtt.addAttribute(.foregroundColor, value:HexColor("#FC1541")! as UIColor, range: NSRange(range, in: self.model!.title!))
  81 + self.goodsTitleLab?.attributedText = titleAtt
  82 + self.goodsTypeLab?.text = self.model?.ads ?? ""
  83 +
  84 + var price = NSMutableAttributedString(string: String(format: "¥ %@", self.model?.price ?? ""))
  85 + price.addAttributes([NSAttributedString.Key.font:Font_13], range: NSRange(location: 0, length: 2))
  86 + self.goodsPriceLab?.attributedText = price
  87 +
  88 + if self.isSelect{
  89 + self.selectImageView?.image = UIImage(named: "DS_shop_AssGoods_select")
  90 + }else{
  91 + self.selectImageView?.image = UIImage(named: "DS_shop_AssGoods_noselect")
  92 + }
  93 + }
  94 + }
  95 +}
metaCode/Classes/Main/HomePage/View/GoodsManager/CNLiveShopGoodsManageListTableViewCell.swift 0 → 100644
  1 +//
  2 +// CNLiveShopGoodsManageListTableViewCell.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/12/25.
  6 +//
  7 +
  8 +import Foundation
  9 +import Kingfisher
  10 +import SnapKit
  11 +/// 操作上下架回调 1上架 2下架
  12 +typealias operStateCallBackBlock = (_ model:ShopOrderAssociatedGoodsModel , _ state:Int)->Void
  13 +/// 编辑商品回调
  14 +typealias editCallBackBlock = (_ model:ShopOrderAssociatedGoodsModel)->Void
  15 +/// 编辑商品数量回调
  16 +typealias editCountCallBackBlock = (_ model:ShopOrderAssociatedGoodsModel)->Void
  17 +
  18 +let kDSShopGoodsManageListTableViewCellID = "kDSShopGoodsManageListTableViewCellID"
  19 +
  20 +class CNLiveShopGoodsManageListTableViewCell:UITableViewCell{
  21 +
  22 + var operStateCallBack:operStateCallBackBlock?
  23 + var editCallBack:editCallBackBlock?
  24 + var editCountCallBack:editCountCallBackBlock?
  25 +
  26 + var _model:ShopOrderAssociatedGoodsModel?
  27 + var model:ShopOrderAssociatedGoodsModel?{
  28 + get{
  29 + _model
  30 + }
  31 + set{
  32 + _model = newValue
  33 + self.goodsImageView?.kf.setImage(with: URL(string: _model?.simg ?? ""))
  34 + self.goodsTitleLab?.text = _model?.title ?? ""
  35 + self.goodsTypeLab?.text = _model?.ads ?? ""
  36 + let price = NSMutableAttributedString(string: String(format: "¥ %@", _model?.price ?? ""))
  37 + price.addAttributes([NSAttributedString.Key.font: Font_13], range: NSRange(location: 0, length: 2))
  38 + self.goodsPriceLab?.attributedText = price
  39 + if _model?.state == "2"{
  40 + self.stateView?.selectIndex = 1
  41 + }else{
  42 + self.stateView?.selectIndex = 0
  43 + }
  44 + self.countLab?.text = String(format: "库存:%@", _model?.count ?? "")
  45 +
  46 + }
  47 + }
  48 +
  49 + var goodsImageView:UIImageView?
  50 + var editBtn:UIButton?
  51 + var stateView:CNLiveSwitchView?
  52 + var goodsTitleLab:UILabel?
  53 + var goodsTypeLab:UILabel?
  54 + var goodsPriceLab:UILabel?
  55 + var line:UIImageView?
  56 + var countLab:UILabel?
  57 + var editCountBtn:UIButton?
  58 + var line1:UIImageView?
  59 +
  60 + required init?(coder: NSCoder) {
  61 + fatalError("init(coder:) has not been implemented")
  62 + }
  63 +
  64 + // MARK: - init
  65 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  66 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  67 + self.selectionStyle = .none
  68 + self.initUI()
  69 + }
  70 +
  71 + override func layoutSubviews() {
  72 + super.layoutSubviews()
  73 + self.goodsImageView?.frame = CGRect(x: 15, y: 15, width: 90, height: 90)
  74 + self.editBtn?.frame = CGRect(x: self.width - 15*2 - 28, y: 0, width: 15*2+28, height: 15*2+20)
  75 + self.goodsTitleLab?.frame = CGRect(x: self.goodsImageView!.right+15, y: 15, width: self.editBtn!.left - (self.goodsImageView!.right+15*2), height: 21)
  76 + self.goodsTypeLab?.frame = CGRect(x: self.goodsImageView!.right+15, y: self.goodsTitleLab!.bottom+5, width: self.width-(self.goodsImageView!.right+15*2), height: 18)
  77 + self.stateView?.frame = CGRect(x: self.width - 80 - 17, y: 0, width: 80, height: 20)
  78 + self.stateView?.radius = self.stateView!.height / 2
  79 + self.goodsPriceLab?.frame = CGRect(x: self.goodsTypeLab!.left, y: self.goodsTypeLab!.bottom+19, width: self.stateView!.left-(self.goodsImageView!.right+15*2), height: 27)
  80 + self.goodsPriceLab?.snp.makeConstraints({ make in
  81 + make.left.equalTo(self.goodsTypeLab!.snp.left)
  82 + make.top.equalTo(self.goodsTypeLab!.snp.bottom).offset(19)
  83 + })
  84 + self.stateView?.centerY = self.goodsPriceLab!.centerY
  85 + self.line?.frame = CGRect(x: 15, y: self.goodsImageView!.bottom+15, width: self.width-15*2, height: DS_RRV_ONE_PIXEL)
  86 + self.line1?.frame = CGRect(x: 0, y: self.height - 5, width: self.width, height: 5)
  87 + self.editCountBtn?.frame = CGRect(x: self.width-58-15, y: self.line!.bottom, width: 58, height: self.line1!.top-self.line!.bottom)
  88 + self.countLab?.frame = CGRect(x: 15, y: self.line!.bottom, width: self.editCountBtn!.left-15*2, height: self.line1!.top-self.line!.bottom)
  89 +
  90 + }
  91 +
  92 + // MARK: - initUI
  93 + func initUI(){
  94 + self.goodsImageView = UIImageView()
  95 + self.goodsImageView?.clipsToBounds = true
  96 + self.goodsImageView?.contentMode = .scaleAspectFill
  97 + self.contentView.addSubview(self.goodsImageView!)
  98 +
  99 + self.goodsTitleLab = UILabel()
  100 + self.goodsTitleLab?.textColor = HexColor("#333333")
  101 + self.goodsTitleLab?.font = Font_15
  102 + self.contentView.addSubview(self.goodsTitleLab!)
  103 +
  104 + self.goodsTypeLab = UILabel()
  105 + self.goodsTypeLab?.textColor = HexColor("#999999")
  106 + self.goodsTypeLab?.font = Font_13
  107 + self.contentView.addSubview(self.goodsTypeLab!)
  108 +
  109 + self.goodsPriceLab = UILabel()
  110 + self.goodsPriceLab?.textColor = HexColor("#FF3355")
  111 + self.goodsPriceLab?.font = Font_19
  112 + self.contentView.addSubview(self.goodsPriceLab!)
  113 +
  114 + self.editBtn = UIButton(type: .custom)
  115 + self.editBtn?.setTitle("编辑", for: .normal)
  116 + self.editBtn?.setTitleColor(HexColor("#666666"), for: .normal)
  117 + self.editBtn?.titleLabel?.font = Font_14
  118 + self.editBtn?.addTarget(self, action: #selector(editBtnClick), for: .touchUpInside)
  119 + self.contentView.addSubview(self.editBtn!)
  120 +
  121 + self.stateView = CNLiveSwitchView()
  122 + self.stateView?.selectedBgColor = HexColor("#61C464")
  123 + self.stateView?.selectedTitleColor = HexColor("#FFFFFF")
  124 + self.stateView?.unselectedBgColor = HexColor("#F0F0F0")
  125 + self.stateView?.unselectedTitleColor = HexColor("#999999")
  126 + self.stateView?.titleFont = Font_11
  127 + self.stateView?.titles = ["下架","上架"]
  128 + self.stateView?.switchBlock = { index in
  129 + var state = 0
  130 + if index == 0{
  131 + state = 2
  132 + }else{
  133 + state = 1
  134 + }
  135 + self.operStateCallBack!(self.model!, state)
  136 + }
  137 + self.contentView.addSubview(self.stateView!)
  138 +
  139 + self.line = UIImageView()
  140 + self.line?.backgroundColor = HexColor("#e4e4e4")
  141 + self.contentView.addSubview(self.line!)
  142 +
  143 + self.countLab = UILabel()
  144 + self.countLab?.textColor = HexColor("#333333")
  145 + self.countLab?.font = Font_14
  146 + self.contentView.addSubview(self.countLab!)
  147 +
  148 + self.editCountBtn = UIButton(type: .custom)
  149 + self.editCountBtn?.setTitle("编辑库存", for: .normal)
  150 + self.editCountBtn?.setTitleColor(HexColor("#61C464"), for: .normal)
  151 + self.editCountBtn?.titleLabel?.font = Font_14
  152 + self.editCountBtn?.addTarget(self, action: #selector(editCountBtnClick), for: .touchUpInside)
  153 + self.contentView.addSubview(self.editCountBtn!)
  154 +
  155 + self.line1 = UIImageView()
  156 + self.line1?.backgroundColor = HexColor("#f9f9f9")
  157 + self.contentView.addSubview(self.line1!)
  158 + }
  159 +
  160 + // MARK: - 触发事件
  161 + @objc func editBtnClick(){
  162 + self.editCallBack!(self.model!)
  163 + }
  164 +
  165 + @objc func editCountBtnClick(){
  166 + self.editCountCallBack!(self.model!)
  167 + }
  168 +
  169 + func setSearchModel(model:ShopOrderAssociatedGoodsModel,keyWork:String){
  170 + self.model = model
  171 + if self.model?.title?.isEmpty == false{
  172 + let titleString = NSMutableAttributedString(string: _model!.title!)
  173 + if let range = _model!.title!.range(of: keyWork) {
  174 + titleString.addAttribute(.foregroundColor, value:HexColor("#FC1541")! as UIColor, range: NSRange(range, in: _model!.title!))
  175 + self.goodsTitleLab?.attributedText = titleString
  176 + }
  177 + }else{
  178 + self.goodsTitleLab?.attributedText = NSMutableAttributedString(string: "")
  179 + }
  180 + self.goodsImageView?.kf.setImage(with: URL(string: self.model?.simg ?? ""))
  181 + self.goodsTypeLab?.text = self.model?.ads ?? ""
  182 + let price = NSMutableAttributedString(string: String(format: "¥ %@", self.model?.price ?? ""))
  183 + price.addAttributes([NSAttributedString.Key.font:Font_13], range: NSRange(location: 0, length: 2))
  184 + self.goodsPriceLab?.attributedText = price
  185 + if self.model?.state == "2"{
  186 + self.stateView?.selectIndex = 1
  187 + }else{
  188 + self.stateView?.selectIndex = 0
  189 + }
  190 + self.countLab?.text = String(format: "库存:%@", self.model?.count ?? "")
  191 + }
  192 +
  193 + /// 获取字符串中与关键字匹配的所有位置
  194 + /// @param str 字符串
  195 + /// @param keyWork 关键字
  196 + func cn_getRedRangStr(string:NSString,keyWork:NSString) -> Array<Any>
  197 + {
  198 + let array = NSMutableArray()
  199 + var str = string
  200 + var range = str.range(of: String(keyWork))
  201 + while range.length>0{
  202 + array.add(NSStringFromRange(range))
  203 + if range.length>0{
  204 + let mutableString = NSMutableString(capacity: keyWork.length)
  205 + for _ in 0..<keyWork.length {
  206 + mutableString.append(" ")
  207 + }
  208 + str = str.replacingCharacters(in: range, with: String(mutableString)) as NSString
  209 + }
  210 + range = str.range(of: keyWork as String)
  211 + }
  212 + return Array(array.copy() as! [Any])
  213 + }
  214 +}
metaCode/Classes/Main/Util/CNLiveFileManager.swift 0 → 100644
  1 +//
  2 +// CNLiveFileManager.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/12/27.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +class CNLiveFileManager:NSObject{
  11 + //单例类
  12 + static let shared = CNLiveFileManager()
  13 + // MARK: - 属性
  14 + /// 用户id 切换用户时会把当前用户存储路径指空
  15 + var _userId:String?
  16 + var userId:String?{
  17 + get{
  18 + _userId
  19 + }
  20 + set{
  21 + if _userId == newValue{
  22 + self.useDSFileDir = ""
  23 + }
  24 + _userId = newValue
  25 + }
  26 + }
  27 +
  28 + // MARK: - 储存路径
  29 + /// 存储路径 ~/Document/DS
  30 + var _dsFileDir:String?
  31 + var dsFileDir:String?{
  32 + get{
  33 + if _dsFileDir == nil{
  34 + let path = String(format: "%@/Documents/metaCode/SearchGoods", NSHomeDirectory())
  35 + let fileManager = FileManager.default
  36 + var isDir : ObjCBool = false
  37 + let exist = fileManager.fileExists(atPath: path, isDirectory: &isDir)
  38 + if !(isDir.boolValue && exist) {
  39 + do {
  40 + try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true)
  41 + } catch {
  42 + debugPrint("文件目录创建失败")
  43 + return ""
  44 + }
  45 + }
  46 + _dsFileDir = path
  47 + }
  48 + return _dsFileDir
  49 + }
  50 + }
  51 + /// 当前用户储存路径
  52 + /// 没userId ~/Document/DS/Common/
  53 + /// 有userId ~/Document/DS/userId_XXX/
  54 + // MARK: - 网络缓存
  55 + private lazy var useDSFileDir: String = {
  56 + let userFileDir = NSString()
  57 + var path: String = ""
  58 + path = "\(dsFileDir!)/userId_\(DSUserInfoManager.shared.dsUserInfo.uid!)/"
  59 + let fileManager = FileManager.default
  60 + var isDir: ObjCBool = false
  61 + let exist: Bool = fileManager.fileExists(atPath: path, isDirectory: &isDir)
  62 + if !(isDir.boolValue && exist) {
  63 + do {
  64 + try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true)
  65 + } catch {
  66 + debugPrint("文件目录创建失败")
  67 + return ""
  68 + }
  69 + }
  70 + return path as String
  71 + }()
  72 +
  73 + var _path:String?
  74 + var path:String?{
  75 + get{
  76 + String(format: "%@/storage.plist", self.useDSFileDir )
  77 + }
  78 + }
  79 +
  80 + // MARK: - 存储、读取、删除
  81 + /// write file 储存
  82 + /// @param object 存储的对象
  83 + /// @param key 存储对象的key
  84 + func saveData(object:Array<Any>,key:String){
  85 + var dic = NSMutableDictionary(contentsOfFile: self.path!)
  86 + if dic == nil{
  87 + dic = NSMutableDictionary()
  88 + }
  89 + dic?.setObject(object, forKey: key as NSCopying)
  90 + dic?.write(toFile: self.path!, atomically: true)
  91 + }
  92 +
  93 + /// write file 读取
  94 + /// @param key 存储对象的key
  95 + func takeDataKey(key:String) -> Array<Any>?{
  96 + var dic = NSMutableDictionary(contentsOfFile: self.path!)
  97 + if dic == nil{
  98 + return nil
  99 + }
  100 + return dic![key] as? Array<Any>
  101 + }
  102 + /// 获取存储的所有数据
  103 + func takeAllSaveData() -> NSDictionary?{
  104 + var dic = NSMutableDictionary(contentsOfFile: self.path!)
  105 + if dic == nil{
  106 + return nil
  107 + }
  108 + return dic!
  109 + }
  110 + /// 删除存储中所有的key
  111 + func resetAllSaveData(){
  112 + var dic = NSMutableDictionary(contentsOfFile: self.path!)
  113 + if dic != nil{
  114 + dic!.removeAllObjects()
  115 + dic!.write(toFile: self.path!, atomically: true)
  116 + }
  117 + }
  118 + /// 删除存储中对应的key
  119 + /// @param resetKey 删除的key
  120 + func deleteKey(resetKey:String){
  121 + var dic = NSMutableDictionary(contentsOfFile: self.path!)
  122 + if dic != nil{
  123 + dic!.removeObject(forKey: resetKey)
  124 + dic!.write(toFile: self.path!, atomically: true)
  125 + }
  126 + }
  127 +
  128 + /// 计算储存路径目录下所有文件大小 单位字节b
  129 + func calcDSFileDirCacheSize() -> CGFloat {
  130 + let fileManager = FileManager.default
  131 + var size: UInt64 = 0
  132 + var isDir: ObjCBool = false
  133 +
  134 + do {
  135 + let directoryAttributes = try fileManager.attributesOfItem(atPath: self.dsFileDir!)
  136 + isDir = directoryAttributes[FileAttributeKey.type] as? ObjCBool ?? false
  137 + } catch {
  138 + print("Error getting attributes of directory: \(error)")
  139 + }
  140 +
  141 + if isDir.boolValue {
  142 + let fileList = try? fileManager.contentsOfDirectory(atPath: self.dsFileDir!)
  143 + for filePath in fileList ?? [] {
  144 + do {
  145 + let fileAttributes = try fileManager.attributesOfItem(atPath: (self.dsFileDir! as NSString).appendingPathComponent(filePath))
  146 + size += fileAttributes[.size] as? UInt64 ?? 0
  147 + } catch {
  148 + print("Error getting attributes of file: \(error)")
  149 + }
  150 + }
  151 + } else {
  152 + print("The path is not a directory.")
  153 + }
  154 +
  155 + return CGFloat(size)
  156 + }
  157 +
  158 + /// 清空储存路径缓存
  159 + /// @param completion 清空完成回调
  160 + func clearDSFileDirCacheCompletion(_ completion: @escaping () -> Void) {
  161 + DispatchQueue.global(qos: .userInitiated).async {
  162 + let fileManager = FileManager.default
  163 + let files = try? fileManager.contentsOfDirectory(atPath: self.dsFileDir!)
  164 + for file in files! {
  165 + let path = (self.dsFileDir! as NSString).appendingPathComponent(file)
  166 + do {
  167 + if FileManager.default.fileExists(atPath: path) {
  168 + try FileManager.default.removeItem(atPath: path)
  169 + }
  170 + } catch {
  171 + print("Error removing item at path: \(path), error: \(error)")
  172 + }
  173 + }
  174 + DispatchQueue.main.async {
  175 + completion()
  176 + }
  177 + }
  178 + }
  179 +}
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_manager_searchNav.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "DS_goods_manager_searchNav@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "DS_goods_manager_searchNav@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_manager_searchNav.imageset/DS_goods_manager_searchNav@2x.png 0 → 100644

906 Bytes

metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_manager_searchNav.imageset/DS_goods_manager_searchNav@3x.png 0 → 100644

1.59 KB

metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_search_back_icon.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "DS_goods_search_back_icon@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "DS_goods_search_back_icon@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_search_back_icon.imageset/DS_goods_search_back_icon@2x.png 0 → 100644

413 Bytes

metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_search_back_icon.imageset/DS_goods_search_back_icon@3x.png 0 → 100644

1.36 KB

metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_search_icon.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "DS_goods_search_icon@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "DS_goods_search_icon@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_search_icon.imageset/DS_goods_search_icon@2x.png 0 → 100644

806 Bytes

metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_search_icon.imageset/DS_goods_search_icon@3x.png 0 → 100644

1.49 KB