Commit d2ff432ac318c042182cbc41fbb514e9ff142700
Merge branch 'master' of http://bj.gitlab.cnlive.com/ios-team/CNLiveMateCode
Showing
34 changed files
with
1231 additions
and
96 deletions
Podfile
| ... | ... | @@ -43,7 +43,9 @@ target 'metaCode' do |
| 43 | 43 | pod 'JXSegmentedView', :git => 'https://gitee.com/mirrors/JXSegmentedView.git' |
| 44 | 44 | pod 'JXPagingView/Paging' |
| 45 | 45 | #轮播图 |
| 46 | - pod 'FSPagerView', '~> 0.8.3' | |
| 46 | + pod 'FSPagerView', '0.8.3' | |
| 47 | +# pod 'SDCycleScrollView', '~> 1.82' | |
| 48 | + | |
| 47 | 49 | #应用调试工具 |
| 48 | 50 | pod 'FWDebug', :configurations => ['Debug'] |
| 49 | 51 | ... | ... |
metaCode.xcodeproj/project.pbxproj
| ... | ... | @@ -12,6 +12,15 @@ |
| 12 | 12 | 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */; }; |
| 13 | 13 | 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */; }; |
| 14 | 14 | 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */; }; |
| 15 | + 19565EC02AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EBF2AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift */; }; | |
| 16 | + 19565EC22AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EC12AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift */; }; | |
| 17 | + 19565EC52AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EC42AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift */; }; | |
| 18 | + 19565EC72AF8AD38007D6727 /* CNLiveShopNewProductController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EC62AF8AD38007D6727 /* CNLiveShopNewProductController.swift */; }; | |
| 19 | + 19565EC92AF8BEC6007D6727 /* CNLiveShopGoodListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EC82AF8BEC6007D6727 /* CNLiveShopGoodListViewModel.swift */; }; | |
| 20 | + 19565ECB2AF8C59C007D6727 /* CNLiveShopGoodsListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565ECA2AF8C59C007D6727 /* CNLiveShopGoodsListModel.swift */; }; | |
| 21 | + 19565ECD2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565ECC2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift */; }; | |
| 22 | + 19565ECF2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565ECE2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift */; }; | |
| 23 | + 19565ED42AF9FEB4007D6727 /* CNLiveShopAddEditGoodsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565ED32AF9FEB4007D6727 /* CNLiveShopAddEditGoodsModel.swift */; }; | |
| 15 | 24 | 19BB1FDF2AEA3A450094D962 /* CNSlideBaseNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */; }; |
| 16 | 25 | 19BB1FE12AEB5C220094D962 /* CNLiveShopConsoleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FE02AEB5C220094D962 /* CNLiveShopConsoleController.swift */; }; |
| 17 | 26 | 19BB1FE32AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */; }; |
| ... | ... | @@ -157,6 +166,15 @@ |
| 157 | 166 | 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideViewController.swift; sourceTree = "<group>"; }; |
| 158 | 167 | 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideViewModel.swift; sourceTree = "<group>"; }; |
| 159 | 168 | 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideModel.swift; sourceTree = "<group>"; }; |
| 169 | + 19565EBF2AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopDetailBtnsCell.swift; sourceTree = "<group>"; }; | |
| 170 | + 19565EC12AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopDetailOrderAssetCell.swift; sourceTree = "<group>"; }; | |
| 171 | + 19565EC42AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopProductManagerController.swift; sourceTree = "<group>"; }; | |
| 172 | + 19565EC62AF8AD38007D6727 /* CNLiveShopNewProductController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopNewProductController.swift; sourceTree = "<group>"; }; | |
| 173 | + 19565EC82AF8BEC6007D6727 /* CNLiveShopGoodListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopGoodListViewModel.swift; sourceTree = "<group>"; }; | |
| 174 | + 19565ECA2AF8C59C007D6727 /* CNLiveShopGoodsListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopGoodsListModel.swift; sourceTree = "<group>"; }; | |
| 175 | + 19565ECC2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopGoodsListClassifyView.swift; sourceTree = "<group>"; }; | |
| 176 | + 19565ECE2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopGoodsListCell.swift; sourceTree = "<group>"; }; | |
| 177 | + 19565ED32AF9FEB4007D6727 /* CNLiveShopAddEditGoodsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopAddEditGoodsModel.swift; sourceTree = "<group>"; }; | |
| 160 | 178 | 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNSlideBaseNavigationController.swift; sourceTree = "<group>"; }; |
| 161 | 179 | 19BB1FE02AEB5C220094D962 /* CNLiveShopConsoleController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopConsoleController.swift; sourceTree = "<group>"; }; |
| 162 | 180 | 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopConsoleViewModel.swift; sourceTree = "<group>"; }; |
| ... | ... | @@ -317,9 +335,45 @@ |
| 317 | 335 | /* End PBXFrameworksBuildPhase section */ |
| 318 | 336 | |
| 319 | 337 | /* Begin PBXGroup section */ |
| 338 | + 19565EC32AF8ACC2007D6727 /* GoodsManager */ = { | |
| 339 | + isa = PBXGroup; | |
| 340 | + children = ( | |
| 341 | + 19565EC42AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift */, | |
| 342 | + 19565EC62AF8AD38007D6727 /* CNLiveShopNewProductController.swift */, | |
| 343 | + ); | |
| 344 | + path = GoodsManager; | |
| 345 | + sourceTree = "<group>"; | |
| 346 | + }; | |
| 347 | + 19565ED02AF8D904007D6727 /* GoodsList */ = { | |
| 348 | + isa = PBXGroup; | |
| 349 | + children = ( | |
| 350 | + 19565ECC2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift */, | |
| 351 | + 19565ECE2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift */, | |
| 352 | + ); | |
| 353 | + path = GoodsList; | |
| 354 | + sourceTree = "<group>"; | |
| 355 | + }; | |
| 356 | + 19565ED12AF9FE56007D6727 /* GoodsManager */ = { | |
| 357 | + isa = PBXGroup; | |
| 358 | + children = ( | |
| 359 | + 19565EC82AF8BEC6007D6727 /* CNLiveShopGoodListViewModel.swift */, | |
| 360 | + ); | |
| 361 | + path = GoodsManager; | |
| 362 | + sourceTree = "<group>"; | |
| 363 | + }; | |
| 364 | + 19565ED22AF9FE67007D6727 /* GoodsManager */ = { | |
| 365 | + isa = PBXGroup; | |
| 366 | + children = ( | |
| 367 | + 19565ECA2AF8C59C007D6727 /* CNLiveShopGoodsListModel.swift */, | |
| 368 | + 19565ED32AF9FEB4007D6727 /* CNLiveShopAddEditGoodsModel.swift */, | |
| 369 | + ); | |
| 370 | + path = GoodsManager; | |
| 371 | + sourceTree = "<group>"; | |
| 372 | + }; | |
| 320 | 373 | 19BB1FE42AEB93850094D962 /* Model */ = { |
| 321 | 374 | isa = PBXGroup; |
| 322 | 375 | children = ( |
| 376 | + 19565ED22AF9FE67007D6727 /* GoodsManager */, | |
| 323 | 377 | 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */, |
| 324 | 378 | 19BB1FE52AEB93B80094D962 /* CNLiveShopUserInfoModel.swift */, |
| 325 | 379 | 19BB1FE72AECAD060094D962 /* CNLiveShopConsoleModel.swift */, |
| ... | ... | @@ -678,6 +732,7 @@ |
| 678 | 732 | 7C83B43C2A52B899004BF4A4 /* ViewModel */ = { |
| 679 | 733 | isa = PBXGroup; |
| 680 | 734 | children = ( |
| 735 | + 19565ED12AF9FE56007D6727 /* GoodsManager */, | |
| 681 | 736 | 7C83B43D2A52B8BA004BF4A4 /* CNHomePageViewModel.swift */, |
| 682 | 737 | 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */, |
| 683 | 738 | 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */, |
| ... | ... | @@ -702,6 +757,7 @@ |
| 702 | 757 | 7CD675232A26F8F8008354C1 /* View */ = { |
| 703 | 758 | isa = PBXGroup; |
| 704 | 759 | children = ( |
| 760 | + 19565ED02AF8D904007D6727 /* GoodsList */, | |
| 705 | 761 | 7CD675372A2740B0008354C1 /* CNUpSlideViewRemindView.swift */, |
| 706 | 762 | 7CD6753B2A2740B0008354C1 /* CNDownSlideView.swift */, |
| 707 | 763 | 7CD675382A2740B0008354C1 /* CNMainView.swift */, |
| ... | ... | @@ -714,10 +770,12 @@ |
| 714 | 770 | 19F1C2322AB5728B0083D06C /* CNIDCardView.swift */, |
| 715 | 771 | 19FA20162AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift */, |
| 716 | 772 | 19FA20182AE22D98001F7186 /* CNLiveDownSlideTodayRecommendCell.swift */, |
| 717 | - 19CC4D462ADD006600308E2A /* CNDownSlideSingleCourseCell.swift */, | |
| 718 | 773 | 19CC4D4E2ADD0FC200308E2A /* CNUpSlideDetailScrollView.swift */, |
| 719 | 774 | 19BB1FE92AEF7B4A0094D962 /* CNLiveShopConsoleCell.swift */, |
| 720 | 775 | 19BB1FF12AF21A950094D962 /* CNLliveShopDetailBannerCell.swift */, |
| 776 | + 19CC4D462ADD006600308E2A /* CNDownSlideSingleCourseCell.swift */, | |
| 777 | + 19565EBF2AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift */, | |
| 778 | + 19565EC12AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift */, | |
| 721 | 779 | ); |
| 722 | 780 | name = View; |
| 723 | 781 | path = HomePage/View; |
| ... | ... | @@ -726,6 +784,7 @@ |
| 726 | 784 | 7CD6754D2A2840B9008354C1 /* Controller */ = { |
| 727 | 785 | isa = PBXGroup; |
| 728 | 786 | children = ( |
| 787 | + 19565EC32AF8ACC2007D6727 /* GoodsManager */, | |
| 729 | 788 | 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */, |
| 730 | 789 | 7CD6754E2A2840B9008354C1 /* CNMetaCodeHomePageController.swift */, |
| 731 | 790 | 19123FC02ABC11170075C883 /* CNWebViewController.swift */, |
| ... | ... | @@ -1041,6 +1100,7 @@ |
| 1041 | 1100 | isa = PBXSourcesBuildPhase; |
| 1042 | 1101 | buildActionMask = 2147483647; |
| 1043 | 1102 | files = ( |
| 1103 | + 19565EC92AF8BEC6007D6727 /* CNLiveShopGoodListViewModel.swift in Sources */, | |
| 1044 | 1104 | 19BB1FE82AECAD060094D962 /* CNLiveShopConsoleModel.swift in Sources */, |
| 1045 | 1105 | 19BB1FEE2AF0E1EC0094D962 /* CNLiveShopDetailViewModel.swift in Sources */, |
| 1046 | 1106 | 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */, |
| ... | ... | @@ -1052,16 +1112,20 @@ |
| 1052 | 1112 | 7989B5C72A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift in Sources */, |
| 1053 | 1113 | 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */, |
| 1054 | 1114 | 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */, |
| 1115 | + 19565ECB2AF8C59C007D6727 /* CNLiveShopGoodsListModel.swift in Sources */, | |
| 1055 | 1116 | 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */, |
| 1056 | 1117 | 798A44FB2A30999900815935 /* CNLiveAlertTool.swift in Sources */, |
| 1118 | + 19565EC02AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift in Sources */, | |
| 1057 | 1119 | 790D01A52A2DF65E00C5978D /* CNLiveLoginPickerView.swift in Sources */, |
| 1058 | 1120 | 79BA085D2AB18E8300D01875 /* CNLiveSaveAuthDB.swift in Sources */, |
| 1059 | 1121 | 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */, |
| 1060 | 1122 | 19D2CE632AE8B65D00691757 /* CNLiveDownSlideTool.swift in Sources */, |
| 1061 | 1123 | 790B1FB82A41B6A60074CF00 /* CNLiveMineMessageViewController.swift in Sources */, |
| 1062 | 1124 | 19BB202B2AF382150094D962 /* CNLiveAdaptTool.swift in Sources */, |
| 1125 | + 19565ECD2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift in Sources */, | |
| 1063 | 1126 | 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */, |
| 1064 | 1127 | 799172382AF090CD00DC01A8 /* CNLiveShopBodyListView.swift in Sources */, |
| 1128 | + 19565ED42AF9FEB4007D6727 /* CNLiveShopAddEditGoodsModel.swift in Sources */, | |
| 1065 | 1129 | 790D01822A2D88FC00C5978D /* CNLiveConfigMacro.swift in Sources */, |
| 1066 | 1130 | 19CC4D4B2ADD086F00308E2A /* CNUpSlideDetailViewController.swift in Sources */, |
| 1067 | 1131 | 7C83B4402A52BB2B004BF4A4 /* CNGlobalEnum.swift in Sources */, |
| ... | ... | @@ -1089,6 +1153,7 @@ |
| 1089 | 1153 | 19CC4D472ADD006600308E2A /* CNDownSlideSingleCourseCell.swift in Sources */, |
| 1090 | 1154 | 79E496E32AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift in Sources */, |
| 1091 | 1155 | 7C83B4422A541EBF004BF4A4 /* CALayer+CNLiveExtensions.swift in Sources */, |
| 1156 | + 19565EC72AF8AD38007D6727 /* CNLiveShopNewProductController.swift in Sources */, | |
| 1092 | 1157 | 798A44F72A3077ED00815935 /* CNLiveHotButton.swift in Sources */, |
| 1093 | 1158 | 7CD6753D2A2740B0008354C1 /* CNMainView.swift in Sources */, |
| 1094 | 1159 | 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */, |
| ... | ... | @@ -1121,6 +1186,7 @@ |
| 1121 | 1186 | 7C2703302A36CBE30061EC50 /* CNCertificationView.swift in Sources */, |
| 1122 | 1187 | 19CC4D542ADD163D00308E2A /* CNUpSlideCardPresentationController.swift in Sources */, |
| 1123 | 1188 | 790D01A32A2DDBA300C5978D /* CNLiveConfigManager.swift in Sources */, |
| 1189 | + 19565EC52AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift in Sources */, | |
| 1124 | 1190 | 19CC4D492ADD06C500308E2A /* UITableView+Extension.swift in Sources */, |
| 1125 | 1191 | 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */, |
| 1126 | 1192 | 7987BF3D2A497644000A1ABC /* CNLiveMineQuestViewController.swift in Sources */, |
| ... | ... | @@ -1136,6 +1202,7 @@ |
| 1136 | 1202 | 790D018B2A2D8B3300C5978D /* CNLiveLoginViewController.swift in Sources */, |
| 1137 | 1203 | 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */, |
| 1138 | 1204 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, |
| 1205 | + 19565EC22AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift in Sources */, | |
| 1139 | 1206 | 798A44EC2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift in Sources */, |
| 1140 | 1207 | 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, |
| 1141 | 1208 | 794BC1652AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift in Sources */, |
| ... | ... | @@ -1150,6 +1217,7 @@ |
| 1150 | 1217 | 7C4931292A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift in Sources */, |
| 1151 | 1218 | 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */, |
| 1152 | 1219 | 7CD6753F2A2740B0008354C1 /* CNDownSlideViewRemindView.swift in Sources */, |
| 1220 | + 19565ECF2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift in Sources */, | |
| 1153 | 1221 | 7CD6753C2A2740B0008354C1 /* CNUpSlideViewRemindView.swift in Sources */, |
| 1154 | 1222 | 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */, |
| 1155 | 1223 | 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */, | ... | ... |
metaCode/Classes/Common/Util/CNLiveCommonBaseModel.swift
| ... | ... | @@ -12,12 +12,12 @@ import WCDBSwift |
| 12 | 12 | |
| 13 | 13 | class BaseModel: HandyJSON { |
| 14 | 14 | |
| 15 | - var database:Database | |
| 15 | +// var database:Database | |
| 16 | 16 | |
| 17 | 17 | required init() { |
| 18 | 18 | //数据库地址 |
| 19 | - let filePath = NSHomeDirectory() + "/Documents/DB/CNLiveBaseModel.db" | |
| 20 | - database = Database(at: filePath) | |
| 19 | +// let filePath = NSHomeDirectory() + "/Documents/DB/CNLiveBaseModel.db" | |
| 20 | +// database = Database(at: filePath) | |
| 21 | 21 | |
| 22 | 22 | // super.init() |
| 23 | 23 | ... | ... |
metaCode/Classes/Config/CNLiveConfigUserInfo.swift
| ... | ... | @@ -11,7 +11,7 @@ import HandyJSON |
| 11 | 11 | |
| 12 | 12 | class UserInfoModel: BaseModel { |
| 13 | 13 | |
| 14 | - required init() {} | |
| 14 | +// required init() {} | |
| 15 | 15 | |
| 16 | 16 | var appId:String = "" |
| 17 | 17 | var appleUid:String = "" |
| ... | ... | @@ -120,6 +120,63 @@ class UserInfoManager: NSObject { |
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | +class DSUserInfoManager: NSObject{ | |
| 124 | + static let shared = DSUserInfoManager() | |
| 125 | + | |
| 126 | + fileprivate var _dsUserInfo : CNLiveShopUserInfoModel? | |
| 127 | + private(set) var dsUserInfo: CNLiveShopUserInfoModel { | |
| 128 | + | |
| 129 | + set { | |
| 130 | + _dsUserInfo = newValue | |
| 131 | + } | |
| 132 | + | |
| 133 | + get { | |
| 134 | + if _dsUserInfo != nil && _dsUserInfo?.id != nil { | |
| 135 | + return _dsUserInfo! | |
| 136 | + } | |
| 137 | + return DSUserInfoManager.readDSUserInfo() | |
| 138 | + } | |
| 139 | + } | |
| 140 | + | |
| 141 | + private override init() {} | |
| 142 | + | |
| 143 | + /// 缓存电商用户数据 | |
| 144 | + /// - Parameter dsuserInfo: 用户数据 存储字符串 | |
| 145 | + static public func cacheDSUserInfo(dsUserInfo: CNLiveShopUserInfoModel) { | |
| 146 | + DSUserInfoManager.clearDSUserInfo() | |
| 147 | + DSUserInfoManager.shared._dsUserInfo = dsUserInfo | |
| 148 | + UserDefaults.standard.set(dsUserInfo.toJSONString(), forKey: "mateCode_dsUserInfo") | |
| 149 | + if UserDefaults.standard.synchronize() { | |
| 150 | + print("电商用户信息存储成功") | |
| 151 | + } | |
| 152 | + } | |
| 153 | + | |
| 154 | + /// 读取用户数据 | |
| 155 | + /// - Returns: 用户数据 | |
| 156 | + static public func readDSUserInfo() -> CNLiveShopUserInfoModel { | |
| 157 | + let dsUser_info = UserDefaults.standard.object(forKey: "mateCode_dsUserInfo") | |
| 158 | + if dsUser_info == nil { | |
| 159 | + print("获取电商用户信息失败") | |
| 160 | + return CNLiveShopUserInfoModel() | |
| 161 | + } | |
| 162 | + if (dsUser_info as! String).count == 0 { | |
| 163 | + print("获取电商用户信息失败") | |
| 164 | + return CNLiveShopUserInfoModel() | |
| 165 | + } | |
| 166 | + let dsUserInfo = jsonToModel(dsUser_info as! String, CNLiveShopUserInfoModel.self) as! CNLiveShopUserInfoModel | |
| 167 | + DSUserInfoManager.shared._dsUserInfo = dsUserInfo | |
| 168 | + return dsUserInfo | |
| 169 | + } | |
| 170 | + | |
| 171 | + static public func clearDSUserInfo() { | |
| 172 | + UserDefaults.standard.removeObject(forKey: "mateCode_dsUserInfo") | |
| 173 | + DSUserInfoManager.shared._dsUserInfo = nil | |
| 174 | + if UserDefaults.standard.synchronize() { | |
| 175 | + print("电商用户信息删除成功") | |
| 176 | + } | |
| 177 | + } | |
| 178 | +} | |
| 179 | + | |
| 123 | 180 | class StandSortManager: NSObject { |
| 124 | 181 | |
| 125 | 182 | static let shared = StandSortManager() | ... | ... |
metaCode/Classes/Environment/CNLiveEnvironment.swift
| ... | ... | @@ -31,8 +31,6 @@ let APPBaseWjjUrl: String = CNLiveEnvironmentManager.shared.base_wjj_url |
| 31 | 31 | let APPBaseWjjBUrl: String = CNLiveEnvironmentManager.shared.base_wjj_b_url |
| 32 | 32 | /// 网家家内电商接口 |
| 33 | 33 | let APPBaseWjjShopUrl: String = CNLiveEnvironmentManager.shared.base_mjj_shop_url |
| 34 | -/// 商家版电商接口 | |
| 35 | -let APPBaseShopUrl: String = CNLiveEnvironmentManager.shared.base_shop_url | |
| 36 | 34 | /// cms接口 |
| 37 | 35 | let APPBaseCMSUrl: String = CNLiveEnvironmentManager.shared.base_cms_url |
| 38 | 36 | ///当前APP的环境 |
| ... | ... | @@ -80,8 +78,6 @@ class CNLiveEnvironmentManager: NSObject{ |
| 80 | 78 | var img_token_url: String |
| 81 | 79 | /// 网家家电商域名请求 |
| 82 | 80 | var base_mjj_shop_url: String |
| 83 | - /// 电商域名请求 | |
| 84 | - var base_shop_url: String | |
| 85 | 81 | /// 元码webViewUA设置 |
| 86 | 82 | var base_web_UA: String = "yuanma" |
| 87 | 83 | /// cms域名请求 |
| ... | ... | @@ -105,7 +101,6 @@ class CNLiveEnvironmentManager: NSObject{ |
| 105 | 101 | self.base_wjj_url = "" |
| 106 | 102 | self.base_wjj_b_url = "" |
| 107 | 103 | self.base_mjj_shop_url = "" |
| 108 | - self.base_shop_url = "" | |
| 109 | 104 | self.base_cms_url = "" |
| 110 | 105 | self.currentEnvironment = .development |
| 111 | 106 | } |
| ... | ... | @@ -148,7 +143,6 @@ class CNLiveEnvironmentManager: NSObject{ |
| 148 | 143 | self.base_wjj_b_url = "https://managemall.cnlive.com:8080" |
| 149 | 144 | self.base_wjj_url = "https://apiwjj.cnlive.com" |
| 150 | 145 | self.base_mjj_shop_url = "https://manageshop.cnlive.com" |
| 151 | - self.base_shop_url = "https://managemall.cnlive.com:8080" | |
| 152 | 146 | self.base_cms_url = "https://cmsapi.cnlive.com" |
| 153 | 147 | } |
| 154 | 148 | //testFlight 环境配置 |
| ... | ... | @@ -166,7 +160,6 @@ class CNLiveEnvironmentManager: NSObject{ |
| 166 | 160 | self.base_wjj_b_url = "https://managemall.cnlive.com:8080" |
| 167 | 161 | self.base_wjj_url = "https://apiwjj.cnlive.com" |
| 168 | 162 | self.base_mjj_shop_url = "https://manageshop.cnlive.com" |
| 169 | - self.base_shop_url = "https://managemall.cnlive.com:8080" | |
| 170 | 163 | self.base_cms_url = "https://cmsapi.cnlive.com" |
| 171 | 164 | } |
| 172 | 165 | //production 生产环境配置 |
| ... | ... | @@ -184,7 +177,6 @@ class CNLiveEnvironmentManager: NSObject{ |
| 184 | 177 | self.base_wjj_b_url = "https://managemall.cnlive.com:8080" |
| 185 | 178 | self.base_wjj_url = "https://apiwjj.cnlive.com" |
| 186 | 179 | self.base_mjj_shop_url = "https://manageshop.cnlive.com" |
| 187 | - self.base_shop_url = "https://managemall.cnlive.com:8080" | |
| 188 | 180 | self.base_cms_url = "https://cmsapi.cnlive.com" |
| 189 | 181 | } |
| 190 | 182 | ... | ... |
metaCode/Classes/Main/HomePage/Controller/CNLiveDownShopDetailController.swift
| ... | ... | @@ -13,12 +13,47 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD |
| 13 | 13 | let kCNLiveShopDetailHeaderViewID = "kCNLiveShopDetailHeaderViewID" |
| 14 | 14 | |
| 15 | 15 | let kCNLiveShopDetailBannerCellID = "kCNLiveShopDetailBannerCellID" |
| 16 | + let kCNLiveShopDetailBtnsCellID = "kCNLiveShopDetailBtnsCellID" | |
| 17 | + let kCNLiveShopDetailOrderAssetCellID = "kCNLiveShopDetailOrderAssetCellID" | |
| 16 | 18 | |
| 17 | 19 | |
| 18 | 20 | lazy var shopDetailModel: CNLiveShopDetailModel = { |
| 19 | 21 | let shopDetailModel = CNLiveShopDetailModel() |
| 20 | 22 | return shopDetailModel |
| 21 | 23 | }() |
| 24 | + override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { | |
| 25 | + let upSlideView = self.view.superview as! CNUpSlideView | |
| 26 | + let scrollView = upSlideView.superview as! UIScrollView | |
| 27 | + scrollView.setContentOffset(CGPoint(x: 0, y: scrollView.height), animated: true) | |
| 28 | + currentViewController()?.tabBarController?.tabBar.isHidden = false | |
| 29 | + | |
| 30 | + let metaVC = currentViewController() as! CNMetaCodeHomePageController | |
| 31 | + let index = metaVC.pageFlowView.currentPageIndex | |
| 32 | + let customIndexView = metaVC.pageFlowView.viewWithTag(100+index) as! CNCustomIndexView | |
| 33 | + customIndexView.superScrollView?.isScrollEnabled = true | |
| 34 | + } | |
| 35 | +// lazy var closeBtn: UIButton = { | |
| 36 | +// let closeBtn = UIButton(type: .custom) | |
| 37 | +// closeBtn.frame = CGRect(x: KSreenWidth-50, y: KStatusBarHeight, width: 50, height: KNavigationHeight-KStatusBarHeight) | |
| 38 | +// closeBtn.setImage(UIImage(named: "mine_header_icon_close"), for: .normal) | |
| 39 | +// closeBtn.addTarget(self, action: #selector(closeBtnAction), for: .touchUpInside) | |
| 40 | +// closeBtn.isUserInteractionEnabled = false | |
| 41 | +// return closeBtn | |
| 42 | +// }() | |
| 43 | + | |
| 44 | +// lazy var navView: UIView = { | |
| 45 | +// let closeBtn = UIView(frame: CGRect(x: 0, y: KStatusBarHeight, width: KSreenWidth-50, height: KNavigationHeight-KStatusBarHeight)) | |
| 46 | +// closeBtn.backgroundColor = .yellow | |
| 47 | +// return closeBtn | |
| 48 | +// }() | |
| 49 | + lazy var closeBtn: UIImageView = { | |
| 50 | + let closeBtn = UIImageView(frame: CGRect(x: KSreenWidth-35, y: KStatusBarHeight+(KNavigationHeight-KStatusBarHeight-20)*0.5, width: 20, height: 20)) | |
| 51 | + closeBtn.image = UIImage(named: "mine_header_icon_close") | |
| 52 | +// closeBtn.isUserInteractionEnabled = true | |
| 53 | +// let tap = UITapGestureRecognizer.init(target: self, action: #selector(closeBtnAction)) | |
| 54 | +// closeBtn.addGestureRecognizer(tap) | |
| 55 | + return closeBtn | |
| 56 | + }() | |
| 22 | 57 | |
| 23 | 58 | lazy var collectionView: UICollectionView = { |
| 24 | 59 | let layout = UICollectionViewFlowLayout.init() |
| ... | ... | @@ -29,6 +64,8 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD |
| 29 | 64 | // collectionView.register(CNLiveShopConsoleHeaderView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: kCNLiveShopConsoleCollectionReusableHeaderViewID) |
| 30 | 65 | collectionView.register(CNLliveShopDetailBannerCell.self, forCellWithReuseIdentifier: kCNLiveShopDetailBannerCellID) |
| 31 | 66 | collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: kCNLiveShopDetailDefaultCellID) |
| 67 | + collectionView.register(CNLiveShopDetailBtnsCell.self, forCellWithReuseIdentifier: kCNLiveShopDetailBtnsCellID) | |
| 68 | + collectionView.register(CNLiveShopDetailOrderAssetCell.self, forCellWithReuseIdentifier: kCNLiveShopDetailOrderAssetCellID) | |
| 32 | 69 | |
| 33 | 70 | return collectionView |
| 34 | 71 | }() |
| ... | ... | @@ -36,12 +73,29 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD |
| 36 | 73 | override func viewDidLoad() { |
| 37 | 74 | super.viewDidLoad() |
| 38 | 75 | self.getShopDetailApi() |
| 39 | - | |
| 40 | 76 | self.view.addSubview(collectionView) |
| 41 | 77 | collectionView.snp.makeConstraints { make in |
| 42 | 78 | make.top.equalToSuperview().offset(KNavigationHeight) |
| 43 | 79 | make.left.bottom.right.equalToSuperview() |
| 44 | 80 | } |
| 81 | + self.view.addSubview(closeBtn) | |
| 82 | +// self.view.addSubview(navView) | |
| 83 | + | |
| 84 | + } | |
| 85 | + | |
| 86 | + // MARK: BtnAction | |
| 87 | + @objc func closeBtnAction(){ | |
| 88 | + let upSlideView = self.view.superview as! CNUpSlideView | |
| 89 | + let scrollView = upSlideView.superview as! UIScrollView | |
| 90 | + scrollView.setContentOffset(CGPoint(x: 0, y: scrollView.height), animated: true) | |
| 91 | + currentViewController()?.tabBarController?.tabBar.isHidden = false | |
| 92 | + | |
| 93 | + let metaVC = currentViewController() as! CNMetaCodeHomePageController | |
| 94 | + let index = metaVC.pageFlowView.currentPageIndex | |
| 95 | + let customIndexView = metaVC.pageFlowView.viewWithTag(100+index) as! CNCustomIndexView | |
| 96 | + customIndexView.superScrollView?.isScrollEnabled = true | |
| 97 | +// customIndexView.baseScrollView.setContentOffset(CGPoint(x: 0, y: customIndexView.baseScrollView.height), animated: true) | |
| 98 | +// currentViewController()?.tabBarController?.tabBar.isHidden = false | |
| 45 | 99 | } |
| 46 | 100 | |
| 47 | 101 | // MARK: - UICollectionViewDelegate |
| ... | ... | @@ -82,15 +136,40 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD |
| 82 | 136 | // } |
| 83 | 137 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { |
| 84 | 138 | switch indexPath.section { |
| 85 | - case 0: | |
| 139 | + case 0://banner轮播图 | |
| 86 | 140 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailBannerCellID, for: indexPath) as! CNLliveShopDetailBannerCell |
| 87 | - | |
| 141 | + | |
| 88 | 142 | cell.shopDetailModel = self.shopDetailModel |
| 89 | 143 | return cell |
| 90 | -// case 1: | |
| 91 | -// | |
| 92 | -// case 2: | |
| 93 | -// case 3: | |
| 144 | + case 1://btn | |
| 145 | + if (self.shopDetailModel.is_seller != nil && self.shopDetailModel.is_seller == true) { | |
| 146 | + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailBtnsCellID, for: indexPath) as! CNLiveShopDetailBtnsCell | |
| 147 | + cell.shopDetailModel = self.shopDetailModel | |
| 148 | + return cell | |
| 149 | + }else{ | |
| 150 | + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailDefaultCellID, for: indexPath) | |
| 151 | + return cell | |
| 152 | + } | |
| 153 | + case 2://我的订单 | |
| 154 | + if (self.shopDetailModel.is_seller != nil && self.shopDetailModel.is_seller == true) { | |
| 155 | + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailOrderAssetCellID, for: indexPath) as! CNLiveShopDetailOrderAssetCell | |
| 156 | + cell.displayType = .CNLiveShopDetailDisplayTypeOrder | |
| 157 | + cell.shopDetailModel = self.shopDetailModel | |
| 158 | + return cell | |
| 159 | + }else{ | |
| 160 | + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailDefaultCellID, for: indexPath) | |
| 161 | + return cell | |
| 162 | + } | |
| 163 | + case 3://我的资产 | |
| 164 | + if (self.shopDetailModel.is_seller != nil && self.shopDetailModel.is_seller == true) { | |
| 165 | + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailOrderAssetCellID, for: indexPath) as! CNLiveShopDetailOrderAssetCell | |
| 166 | + cell.displayType = .CNLiveShopDetailDisplayTypeAsset | |
| 167 | + cell.shopDetailModel = self.shopDetailModel | |
| 168 | + return cell | |
| 169 | + }else{ | |
| 170 | + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailDefaultCellID, for: indexPath) | |
| 171 | + return cell | |
| 172 | + } | |
| 94 | 173 | // case 4: |
| 95 | 174 | default: |
| 96 | 175 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kCNLiveShopDetailDefaultCellID, for: indexPath) |
| ... | ... | @@ -103,15 +182,15 @@ class CNLiveDownShopDetailController:CNLiveBaseViewController, UICollectionViewD |
| 103 | 182 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { |
| 104 | 183 | if (self.shopDetailModel.is_seller != nil && self.shopDetailModel.is_seller == true) { |
| 105 | 184 | switch (indexPath.section) { |
| 106 | - case 0: | |
| 185 | + case 0://banner | |
| 107 | 186 | return CGSize(width: KSreenWidth, height: CNLiveAdaptTool.adaptLength(length: 210)) |
| 108 | - case 1: | |
| 109 | - return CGSize(width: KSreenWidth, height: 50) | |
| 110 | - case 2: | |
| 111 | - return CGSize(width: KSreenWidth, height: 50) | |
| 112 | - case 3: | |
| 113 | - return CGSize(width: KSreenWidth, height: 50) | |
| 114 | - case 4: | |
| 187 | + case 1://btn | |
| 188 | + return CGSize(width: KSreenWidth, height: 10+45+5+17+15) | |
| 189 | + case 2://我的订单 | |
| 190 | + return CGSize(width: KSreenWidth, height: 10+25+15+CNLiveAdaptTool.adaptLength(length: 128-55)+15) | |
| 191 | + case 3://我的资产 | |
| 192 | + return CGSize(width: KSreenWidth, height: 10+25+15+CNLiveAdaptTool.adaptLength(length: 128-55)+15) | |
| 193 | + case 4:// | |
| 115 | 194 | return CGSize(width: KSreenWidth, height: 50) |
| 116 | 195 | default: |
| 117 | 196 | return CGSizeZero | ... | ... |
metaCode/Classes/Main/HomePage/Controller/CNLiveShopConsoleController.swift
| ... | ... | @@ -88,9 +88,10 @@ class CNLiveShopConsoleController: CNLiveBaseViewController, UICollectionViewDel |
| 88 | 88 | if itemModel.type == CNLiveShopConsoleType.XZSP.rawValue{ |
| 89 | 89 | //商城新增商品 |
| 90 | 90 | |
| 91 | + | |
| 91 | 92 | }else if itemModel.type == CNLiveShopConsoleType.SPGL.rawValue{ |
| 92 | 93 | //商城商品管理 |
| 93 | - | |
| 94 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopProductManagerController.init(), animated: true) | |
| 94 | 95 | }else if itemModel.type == CNLiveShopConsoleType.XZYHQ.rawValue{ |
| 95 | 96 | //新增优惠券 |
| 96 | 97 | |
| ... | ... | @@ -122,7 +123,9 @@ class CNLiveShopConsoleController: CNLiveBaseViewController, UICollectionViewDel |
| 122 | 123 | |
| 123 | 124 | }else if itemModel.type == CNLiveShopConsoleType.OnManagerment.rawValue{ |
| 124 | 125 | //直播管理 |
| 125 | - | |
| 126 | + let webVC = CNWebViewController() | |
| 127 | + webVC.url = URL(string: "http://wjjh5.cnlive.com/apkdownloadShop.php") | |
| 128 | + currentViewController()?.navigationController?.pushViewController(webVC, animated: true) | |
| 126 | 129 | } |
| 127 | 130 | } |
| 128 | 131 | |
| ... | ... | @@ -135,6 +138,8 @@ class CNLiveShopConsoleController: CNLiveBaseViewController, UICollectionViewDel |
| 135 | 138 | |
| 136 | 139 | if status == .success{ |
| 137 | 140 | let shopUserModel = result as! CNLiveShopUserInfoModel |
| 141 | + DSUserInfoManager.cacheDSUserInfo(dsUserInfo: shopUserModel) | |
| 142 | + | |
| 138 | 143 | if shopUserModel.type != "3"{ |
| 139 | 144 | //type 1商家或者8达人 |
| 140 | 145 | let shopConsoleModel = CNLiveShopConsoleModel() | ... | ... |
metaCode/Classes/Main/HomePage/Controller/CNWebViewController.swift
| ... | ... | @@ -86,6 +86,14 @@ class CNWebViewController:CNLiveBaseViewController ,WKNavigationDelegate{ |
| 86 | 86 | @available(iOS 13.0, *) |
| 87 | 87 | func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, preferences: WKWebpagePreferences, decisionHandler: @escaping (WKNavigationActionPolicy, WKWebpagePreferences) -> Void) { |
| 88 | 88 | |
| 89 | + if navigationAction.navigationType == .other{ | |
| 90 | + //跳转Appstore | |
| 91 | + let url = URL(string: "https://apps.apple.com/cn/app/%E7%BD%91%E5%AE%B6%E5%AE%B6%E5%95%86%E5%AE%B6%E7%89%88/id1337575497") | |
| 92 | + if url == navigationAction.request.url { | |
| 93 | + if UIApplication.shared.canOpenURL(url!) { UIApplication.shared.open(url!, options: [:], completionHandler: nil) | |
| 94 | + } | |
| 95 | + } | |
| 96 | + } | |
| 89 | 97 | decisionHandler(.allow, preferences) |
| 90 | 98 | } |
| 91 | 99 | } | ... | ... |
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopNewProductController.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopNewProductController.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/11/6. | |
| 6 | +// 新增商品 | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +/// | |
| 11 | +enum CNLiveShopGoodsAddEditType{ | |
| 12 | + | |
| 13 | + /// 新增商品 | |
| 14 | + case add | |
| 15 | + /// 编辑商品 | |
| 16 | + case edit | |
| 17 | +} | |
| 18 | + | |
| 19 | +class CNLiveShopNewProductController:CNLiveBaseViewController{ | |
| 20 | + | |
| 21 | + var type:CNLiveShopGoodsAddEditType = .add | |
| 22 | + lazy var bgScrollView :UIScrollView = { | |
| 23 | + let bgScrollView = UIScrollView(frame: CGRect(x: 0, y: KNavigationHeight, width: KSreenWidth, height: KSreenHeight-KNavigationHeight-KTabBarHeight)) | |
| 24 | + bgScrollView.showsVerticalScrollIndicator = false | |
| 25 | + return bgScrollView | |
| 26 | + }() | |
| 27 | + | |
| 28 | + lazy var dataModel: CNLiveShopAddEditGoodsModel = { | |
| 29 | + let dataModel = CNLiveShopAddEditGoodsModel() | |
| 30 | + return dataModel | |
| 31 | + }() | |
| 32 | + | |
| 33 | + override func viewDidLoad() { | |
| 34 | + super.viewDidLoad() | |
| 35 | + self.setUI() | |
| 36 | + self.bgScrollView.backgroundColor = .red | |
| 37 | + self.view.addSubview(self.bgScrollView) | |
| 38 | + self.type = .add | |
| 39 | + } | |
| 40 | + func setUI(){ | |
| 41 | + navigationBarHidden = false | |
| 42 | + titleName = "新增商品" | |
| 43 | + | |
| 44 | + } | |
| 45 | + func initBgScrollViewContentView(){ | |
| 46 | + if self.type == .add{ | |
| 47 | + self.dataModel.initDataSource() | |
| 48 | + self.dataModel.list | |
| 49 | + }else if self.type == .edit{ | |
| 50 | + | |
| 51 | + }else{ | |
| 52 | + | |
| 53 | + } | |
| 54 | + | |
| 55 | + } | |
| 56 | + | |
| 57 | +} | ... | ... |
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopProductManagerController.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopProductManagerController.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/11/6. | |
| 6 | +// 商品管理 | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNLiveShopProductManagerController:CNLiveBaseViewController, UITableViewDataSource, UITableViewDelegate{ | |
| 11 | + | |
| 12 | + let kCNLiveShopGoodsListCellIdentifier = "kCNLiveShopGoodsListCellIdentifier" | |
| 13 | + | |
| 14 | + | |
| 15 | + // MARK: - 懒加载 | |
| 16 | + ///数据源 | |
| 17 | + lazy var dataArray: NSMutableArray = { | |
| 18 | + var dataArray = NSMutableArray() | |
| 19 | + return dataArray | |
| 20 | + }() | |
| 21 | + | |
| 22 | + lazy var classifyView: CNLiveShopGoodsListClassifyView = { | |
| 23 | + let classifyView = CNLiveShopGoodsListClassifyView(frame: CGRect(x: 0, y: KNavigationHeight, width: KSreenWidth, height: 44)) | |
| 24 | + classifyView.backgroundColor = .white | |
| 25 | + return classifyView | |
| 26 | + }() | |
| 27 | + lazy var addBtn: UIButton = { | |
| 28 | + let addBtn = UIButton(type: .custom) | |
| 29 | + addBtn.frame = CGRect(x: 0, y: 0, width: 100, height:KNavigationHeight-KStatusBarHeight ) | |
| 30 | + addBtn.addTarget(self, action: #selector(addBtnAction), for: .touchUpInside) | |
| 31 | + addBtn.setTitle("新增商品", for: .normal) | |
| 32 | + addBtn.setTitleColor(HexColor("#666666"), for: .normal) | |
| 33 | + return addBtn | |
| 34 | + }() | |
| 35 | + lazy var tableView : UITableView = { | |
| 36 | + let tableView = UITableView(frame: .zero, style: .plain) | |
| 37 | + tableView.dataSource = self | |
| 38 | + tableView.delegate = self | |
| 39 | + tableView.separatorStyle = .none | |
| 40 | + tableView.rowHeight = 167 | |
| 41 | + tableView.register(CNLiveShopGoodsListCell.self, forCellReuseIdentifier: kCNLiveShopGoodsListCellIdentifier) | |
| 42 | + return tableView | |
| 43 | + }() | |
| 44 | + | |
| 45 | + override func viewDidLoad() { | |
| 46 | + super.viewDidLoad() | |
| 47 | + self.setUI() | |
| 48 | + self.getGoodsListApi(page: "1") | |
| 49 | + } | |
| 50 | + func setUI(){ | |
| 51 | + navigationBarHidden = false | |
| 52 | + titleName = "商品管理" | |
| 53 | + rightNavBtns = [self.addBtn] | |
| 54 | + self.view.addSubview(self.classifyView) | |
| 55 | + self.view.addSubview(tableView) | |
| 56 | + tableView.frame = CGRect(x: 0, y:self.classifyView.bottom , width: KSreenWidth, height: KSreenHeight - self.classifyView.bottom) | |
| 57 | + } | |
| 58 | + | |
| 59 | + // MARK: - UITableViewDelegate | |
| 60 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
| 61 | + return self.dataArray.count | |
| 62 | + } | |
| 63 | + | |
| 64 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
| 65 | + let goodsModel = self.dataArray[indexPath.row] as! CNLiveShopGoodsListModel | |
| 66 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveShopGoodsListCellIdentifier) as? CNLiveShopGoodsListCell | |
| 67 | + else { | |
| 68 | + let cell = CNLiveShopGoodsListCell() | |
| 69 | + cell.goodsModel = goodsModel | |
| 70 | + return cell | |
| 71 | + } | |
| 72 | + | |
| 73 | + cell.goodsModel = goodsModel | |
| 74 | + return cell | |
| 75 | + } | |
| 76 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | |
| 77 | + | |
| 78 | + let goodsModel = self.dataArray[indexPath.row] as! CNLiveShopGoodsListModel | |
| 79 | + | |
| 80 | + } | |
| 81 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | |
| 82 | + return 167 | |
| 83 | + } | |
| 84 | + | |
| 85 | + // MARK: - BtnAction | |
| 86 | + @objc func addBtnAction(){ | |
| 87 | + | |
| 88 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopNewProductController(), animated: true) | |
| 89 | + } | |
| 90 | + | |
| 91 | + //MARK: - 网络请求获取商品列表 | |
| 92 | + func getGoodsListApi(page:String) | |
| 93 | + { | |
| 94 | + showLoading(message: "") | |
| 95 | + CNLiveShopGoodListViewModel.requestGoodsList(shopId: DSUserInfoManager.shared.dsUserInfo.id, sortType: "1", page: page) { result, status in | |
| 96 | + hiddenLoading() | |
| 97 | + if status == .success{ | |
| 98 | + self.dataArray.addObjects(from: result as! [CNLiveShopGoodsListModel]) | |
| 99 | + let newDataArray = NSMutableArray() | |
| 100 | + for goodsModel in self.dataArray { | |
| 101 | + if let model = goodsModel as? CNLiveShopGoodsListModel{ | |
| 102 | + newDataArray.add(model) | |
| 103 | + } | |
| 104 | + } | |
| 105 | + self.dataArray.removeAllObjects() | |
| 106 | + self.dataArray.addObjects(from: newDataArray as! [Any]) | |
| 107 | + | |
| 108 | + self.tableView.reloadData() | |
| 109 | + }else if (status == .failed){ | |
| 110 | +// self.NetApiStatus = .apiError | |
| 111 | + }else if (status == .noNetwork){ | |
| 112 | + | |
| 113 | +// self.NetApiStatus = .notNetwork | |
| 114 | + } | |
| 115 | + } | |
| 116 | +// | |
| 117 | + } | |
| 118 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/CNLiveShopDetailBtnsCell.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopDetailBtnsCell.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/11/3. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNLiveShopDetailBtnsCell: UICollectionViewCell { | |
| 11 | + | |
| 12 | + //shopDetailModel | |
| 13 | + var _shopDetailModel : CNLiveShopDetailModel? | |
| 14 | + var shopDetailModel : CNLiveShopDetailModel? { | |
| 15 | + get{ | |
| 16 | + _shopDetailModel | |
| 17 | + } | |
| 18 | + set{ | |
| 19 | + _shopDetailModel = newValue! | |
| 20 | + | |
| 21 | + } | |
| 22 | + } | |
| 23 | + | |
| 24 | + override init(frame: CGRect) { | |
| 25 | + super.init(frame: frame) | |
| 26 | + self.backgroundColor = .clear | |
| 27 | + self.setUI() | |
| 28 | + } | |
| 29 | + | |
| 30 | + required init?(coder: NSCoder) { | |
| 31 | + fatalError("init(coder:) has not been implemented") | |
| 32 | + } | |
| 33 | + | |
| 34 | + func setUI(){ | |
| 35 | + self.backgroundColor = .white | |
| 36 | + var titlesArr:Array<String> = [] | |
| 37 | + if DSUserInfoManager.shared.dsUserInfo.type != "3" { | |
| 38 | + titlesArr = ["发布动态", "商品管理", "订单管理", "交易记录"] | |
| 39 | + }else{ | |
| 40 | + //健康餐桌 不处理 | |
| 41 | + } | |
| 42 | + //替换icon | |
| 43 | + let icons = ["ds_Up_Btn", "ds_Up_Btn", "ds_Up_Btn", "ds_Up_Btn"] | |
| 44 | + if titlesArr.count > 0 { | |
| 45 | + for i in 0..<titlesArr.count { | |
| 46 | + let titleStr = titlesArr[i] | |
| 47 | + let iconStr = icons[i] | |
| 48 | + //icon | |
| 49 | + let imgWH = 45 | |
| 50 | + let imgGap = (Int(KSreenWidth)-4*imgWH)/5 | |
| 51 | + | |
| 52 | + let iconBtn = UIButton(type: .custom) | |
| 53 | + iconBtn.frame = CGRect(x: imgGap*(i+1)+imgWH*i, y: 10, width: imgWH, height: imgWH) | |
| 54 | + iconBtn.setBackgroundImage(UIImage(named: iconStr), for: .normal) | |
| 55 | + iconBtn.addTarget(self, action: #selector(iconBtnAction(_:)), for: .touchUpInside) | |
| 56 | + iconBtn.tag = i+100 | |
| 57 | + iconBtn.layer.cornerRadius = 11.5 | |
| 58 | + self.contentView.addSubview(iconBtn) | |
| 59 | + | |
| 60 | + let titleLbl = UILabel(frame: CGRect(x: iconBtn.left-5, y: iconBtn.bottom+5, width: iconBtn.width+10, height: 17)) | |
| 61 | + titleLbl.text = titleStr | |
| 62 | + titleLbl.textAlignment = .center | |
| 63 | + titleLbl.font = Font_12 | |
| 64 | + titleLbl.textColor = HexColor("#4A4A4A") | |
| 65 | + self.contentView.addSubview(titleLbl) | |
| 66 | + } | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + @objc func iconBtnAction(_ sender: UIButton){ | |
| 71 | + let tag = sender.tag | |
| 72 | + ///push VC | |
| 73 | + if tag == 100 { | |
| 74 | + //发布动态 | |
| 75 | + }else if tag == 101 { | |
| 76 | + //商品管理 | |
| 77 | + let webVC = CNWebViewController() | |
| 78 | + webVC.url = URL(string:"https://www.baidu.com") | |
| 79 | + currentViewController()?.navigationController?.pushViewController(webVC, animated: true) | |
| 80 | + | |
| 81 | + }else if tag == 102 { | |
| 82 | + //订单管理 | |
| 83 | + }else if tag == 103 { | |
| 84 | + //交易记录 | |
| 85 | + } | |
| 86 | + | |
| 87 | + } | |
| 88 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/CNLiveShopDetailOrderAssetCell.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopDetailOrderAssetCell.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/11/4. | |
| 6 | +// 我的订单,我的资产 | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +enum CNLiveShopDetailDisplayType { | |
| 10 | + case CNLiveShopDetailDisplayTypeOrder | |
| 11 | + case CNLiveShopDetailDisplayTypeAsset | |
| 12 | +} | |
| 13 | +class CNLiveShopDetailOrderAssetCell:UICollectionViewCell{ | |
| 14 | + | |
| 15 | + //订单,资产 | |
| 16 | + var displayType: CNLiveShopDetailDisplayType? | |
| 17 | + | |
| 18 | + //shopDetailModel | |
| 19 | + var _shopDetailModel : CNLiveShopDetailModel? | |
| 20 | + var shopDetailModel : CNLiveShopDetailModel? { | |
| 21 | + get{ | |
| 22 | + _shopDetailModel | |
| 23 | + } | |
| 24 | + set{ | |
| 25 | + _shopDetailModel = newValue! | |
| 26 | + self.setNewUI() | |
| 27 | + } | |
| 28 | + } | |
| 29 | + | |
| 30 | + var navTitle = UILabel() | |
| 31 | + var navsubBtn = UIButton() | |
| 32 | + var bgImageView = UIImageView() | |
| 33 | + | |
| 34 | + override init(frame: CGRect) { | |
| 35 | + super.init(frame: frame) | |
| 36 | + self.backgroundColor = .clear | |
| 37 | + self.setUI() | |
| 38 | + } | |
| 39 | + | |
| 40 | + required init?(coder: NSCoder) { | |
| 41 | + fatalError("init(coder:) has not been implemented") | |
| 42 | + } | |
| 43 | + | |
| 44 | + func setUI(){ | |
| 45 | + self.backgroundColor = .white | |
| 46 | + } | |
| 47 | + func setNewUI(){ | |
| 48 | + self.navTitle = UILabel(frame: CGRect(x: 15, y: 10, width: 80, height: 25)) | |
| 49 | + var navTitleText = "" | |
| 50 | + if self.displayType == .CNLiveShopDetailDisplayTypeOrder{ | |
| 51 | + navTitleText = "我的订单" | |
| 52 | + }else if self.displayType == .CNLiveShopDetailDisplayTypeAsset{ | |
| 53 | + navTitleText = "我的资产" | |
| 54 | + } | |
| 55 | + self.navTitle.text = navTitleText | |
| 56 | + self.navTitle.textAlignment = .left | |
| 57 | + self.navTitle.font = Font_18 | |
| 58 | + self.navTitle.textColor = HexColor("#4A4A4A") | |
| 59 | + self.contentView.addSubview(self.navTitle) | |
| 60 | + | |
| 61 | + self.navsubBtn = UIButton(type: .custom) | |
| 62 | + self.navsubBtn.frame = CGRect(x: 0, y: 10, width: 80, height: 19) | |
| 63 | + self.navsubBtn.right = self.contentView.width - 15 | |
| 64 | + self.navsubBtn.setImage(UIImage(named: "homepage_detail"), for: .normal) | |
| 65 | + self.navsubBtn.addTarget(self, action: #selector(navsubBtnAction(_:)), for: .touchUpInside) | |
| 66 | + self.navsubBtn.setTitleColor(HexColor("#999999"), for: .normal) | |
| 67 | + self.navsubBtn.titleLabel?.font = Font_13 | |
| 68 | + self.navsubBtn.setTitle("订单明细", for: .normal) | |
| 69 | + self.navsubBtn.setupButtonImageAndTitlePossitionWith(padding: 4, style:.right) | |
| 70 | + self.contentView.addSubview(self.navsubBtn) | |
| 71 | + | |
| 72 | + var imgName = "" | |
| 73 | + if self.displayType == .CNLiveShopDetailDisplayTypeOrder{ | |
| 74 | + imgName = "homepage_detail_order_bg" | |
| 75 | + }else if self.displayType == .CNLiveShopDetailDisplayTypeAsset{ | |
| 76 | + imgName = "homepage_detail_asset_bg" | |
| 77 | + } | |
| 78 | + let imageView = UIImageView(frame: CGRect(x: 15, y: self.navTitle.bottom + 15, width: self.contentView.width - 30, height: CNLiveAdaptTool.adaptLength(length: 128))) | |
| 79 | + imageView.image = UIImage(named: imgName) | |
| 80 | + self.bgImageView = imageView | |
| 81 | + self.contentView.addSubview(self.bgImageView) | |
| 82 | + | |
| 83 | + var numbers:Array<String> = [] | |
| 84 | + var titles:Array<String> = [] | |
| 85 | + if self.displayType == .CNLiveShopDetailDisplayTypeOrder{ | |
| 86 | + numbers = [_shopDetailModel?.seller_data?.day_order ?? "0", _shopDetailModel?.seller_data?.day_order_money ?? "0","0","0"] | |
| 87 | + titles = ["今日订单数", "今日订单金额", "店铺访客", "商品浏览量"] | |
| 88 | + }else if self.displayType == .CNLiveShopDetailDisplayTypeAsset{ | |
| 89 | + numbers = [_shopDetailModel?.seller_data?.total_money ?? "0", _shopDetailModel?.seller_data?.shop_money ?? "0",_shopDetailModel?.seller_data?.daren_money ?? "0","0"] | |
| 90 | + titles = ["余额总计/¥", "电商余额/¥", "扫码余额/¥", "可结算金额/¥"] | |
| 91 | + } | |
| 92 | + let titleW = 70 | |
| 93 | + let gap = Int((Int(self.contentView.width)-titleW*4)/5) | |
| 94 | + for i in 0..<4 { | |
| 95 | + | |
| 96 | + let titleLabel = UILabel(frame: CGRect(x: gap*(i+1)+i*titleW, y: Int(self.bgImageView.top)+15, width: titleW, height: 25)) | |
| 97 | + titleLabel.text = numbers[i] | |
| 98 | + titleLabel.textAlignment = .center | |
| 99 | + titleLabel.font = Font_18 | |
| 100 | + titleLabel.textColor = HexColor("#7A574A") | |
| 101 | + self.contentView.addSubview(titleLabel) | |
| 102 | + | |
| 103 | + let subTitleLabel = UILabel(frame: CGRect(x: gap*(i+1)+i*titleW, y: Int(titleLabel.bottom)+5, width: titleW, height: 14)) | |
| 104 | + subTitleLabel.text = titles[i] | |
| 105 | + subTitleLabel.textAlignment = .center | |
| 106 | + subTitleLabel.font = Font_10 | |
| 107 | + subTitleLabel.textColor = HexColor("#7A574A") | |
| 108 | + self.contentView.addSubview(subTitleLabel) | |
| 109 | + | |
| 110 | + let clickBtn = UIButton(type: .custom) | |
| 111 | + clickBtn.frame = CGRect(x: titleLabel.left, y: titleLabel.top, width: titleLabel.width, height: subTitleLabel.bottom-titleLabel.top) | |
| 112 | + clickBtn.addTarget(self, action: #selector(clickBtnAction(_:)), for: .touchUpInside) | |
| 113 | + clickBtn.tag = i+100 | |
| 114 | + self.contentView.addSubview(clickBtn) | |
| 115 | + | |
| 116 | + } | |
| 117 | + | |
| 118 | + } | |
| 119 | + | |
| 120 | + @objc func navsubBtnAction(_ sender: UIButton){ | |
| 121 | + if self.displayType == .CNLiveShopDetailDisplayTypeOrder{ | |
| 122 | + //push订单VC | |
| 123 | + }else if self.displayType == .CNLiveShopDetailDisplayTypeAsset{ | |
| 124 | + //push余额VC | |
| 125 | + } | |
| 126 | + } | |
| 127 | + @objc func clickBtnAction(_ sender: UIButton){ | |
| 128 | + let tag = sender.tag | |
| 129 | + if tag == 100 { | |
| 130 | + | |
| 131 | + }else if tag == 101 { | |
| 132 | + print(tag) | |
| 133 | + }else if tag == 102 { | |
| 134 | + | |
| 135 | + }else if tag == 103 { | |
| 136 | + | |
| 137 | + } | |
| 138 | + } | |
| 139 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/CNLliveShopDetailBannerCell.swift
| ... | ... | @@ -19,7 +19,7 @@ class CNLliveShopDetailBannerCell:UICollectionViewCell,FSPagerViewDataSource,FSP |
| 19 | 19 | viewPager.delegate = self |
| 20 | 20 | viewPager.register(FSPagerViewCell.self, forCellWithReuseIdentifier: kCNLliveShopDetailBannerCellID) |
| 21 | 21 | //设置自动翻页事件间隔,默认值为0 (不自动翻页) |
| 22 | - viewPager.automaticSlidingInterval = 1.0 | |
| 22 | + viewPager.automaticSlidingInterval = 0 | |
| 23 | 23 | //设置页面之间的间隔距离 |
| 24 | 24 | viewPager.interitemSpacing = 8.0 |
| 25 | 25 | //设置可以无限翻页,默认值为false,false时从尾部向前滚动到头部再继续循环滚动,true时可以无限滚动 |
| ... | ... | @@ -29,6 +29,22 @@ class CNLliveShopDetailBannerCell:UICollectionViewCell,FSPagerViewDataSource,FSP |
| 29 | 29 | return viewPager |
| 30 | 30 | }() |
| 31 | 31 | |
| 32 | + // 懒加载滚动图片浏下标 | |
| 33 | + lazy var pagerControl:FSPageControl = { | |
| 34 | + let pageControl = FSPageControl(frame: CGRect(x: 20, y: self.contentView.height-24, width: self.contentView.width-40, height: 4)) | |
| 35 | + //设置下标位置 | |
| 36 | + pageControl.contentHorizontalAlignment = .right | |
| 37 | + //设置下标指示器颜色(选中状态和普通状态) | |
| 38 | + pageControl.setFillColor(HexColor("#FFFFFF"), for: .normal) | |
| 39 | + pageControl.setFillColor(HexColor("#65C368"), for: .selected) | |
| 40 | + | |
| 41 | + //绘制下标指示器的形状 (roundedRect绘制绘制圆角或者圆形) | |
| 42 | + pageControl.setPath(UIBezierPath.init(roundedRect: CGRect.init(x: 0, y: 0, width: 8, height: 4),cornerRadius: 2.0), for: .selected) | |
| 43 | + pageControl.setPath(UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: 4, height: 4)), for: .normal) | |
| 44 | + return pageControl | |
| 45 | + | |
| 46 | + }() | |
| 47 | + | |
| 32 | 48 | //shopDetailModel |
| 33 | 49 | var _shopDetailModel : CNLiveShopDetailModel? |
| 34 | 50 | var shopDetailModel : CNLiveShopDetailModel? { |
| ... | ... | @@ -37,7 +53,11 @@ class CNLliveShopDetailBannerCell:UICollectionViewCell,FSPagerViewDataSource,FSP |
| 37 | 53 | } |
| 38 | 54 | set{ |
| 39 | 55 | _shopDetailModel = newValue! |
| 40 | - | |
| 56 | + //设置下标的个数 | |
| 57 | + self.pagerControl.numberOfPages = (_shopDetailModel?.banner.count)! | |
| 58 | + if _shopDetailModel?.banner.count == 1 { | |
| 59 | + self.viewPager.isInfinite = false | |
| 60 | + } | |
| 41 | 61 | } |
| 42 | 62 | } |
| 43 | 63 | |
| ... | ... | @@ -52,10 +72,13 @@ class CNLliveShopDetailBannerCell:UICollectionViewCell,FSPagerViewDataSource,FSP |
| 52 | 72 | } |
| 53 | 73 | |
| 54 | 74 | func setUI(){ |
| 55 | - self.backgroundColor = .red | |
| 75 | + self.backgroundColor = .white | |
| 56 | 76 | self.contentView.addSubview(self.viewPager) |
| 77 | + self.contentView.addSubview(self.pagerControl) | |
| 78 | + | |
| 57 | 79 | } |
| 58 | - | |
| 80 | + | |
| 81 | + | |
| 59 | 82 | // MARK: - FSPagerViewDataSource |
| 60 | 83 | func numberOfItems(in pagerView: FSPagerView) -> Int { |
| 61 | 84 | return (self.shopDetailModel?.banner.count)! |
| ... | ... | @@ -64,6 +87,18 @@ class CNLliveShopDetailBannerCell:UICollectionViewCell,FSPagerViewDataSource,FSP |
| 64 | 87 | let cell = pagerView.dequeueReusableCell(withReuseIdentifier: kCNLliveShopDetailBannerCellID, at: index) |
| 65 | 88 | let imgUrl = self.shopDetailModel?.banner[index].simg! |
| 66 | 89 | cell.imageView?.kf.setImage(with: URL(string: imgUrl!)) |
| 90 | + cell.imageView?.layer.cornerRadius = 9 | |
| 67 | 91 | return cell |
| 68 | 92 | } |
| 93 | + func pagerView(_ pagerView: FSPagerView, willDisplay cell: FSPagerViewCell, forItemAt index: Int) { | |
| 94 | + self.pagerControl.currentPage = index | |
| 95 | + | |
| 96 | + } | |
| 97 | + | |
| 98 | + func pagerView(_ pagerView: FSPagerView, didSelectItemAt index: Int) { | |
| 99 | + let bannerMdl = self.shopDetailModel?.banner[index] | |
| 100 | + let webVC = CNWebViewController() | |
| 101 | + webVC.url = URL(string: bannerMdl?.url ?? "") | |
| 102 | + currentViewController()?.navigationController?.pushViewController(webVC, animated: true) | |
| 103 | + } | |
| 69 | 104 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/CNUpSlideView.swift
| ... | ... | @@ -63,9 +63,15 @@ class CNUpSlideView:UIView{ |
| 63 | 63 | |
| 64 | 64 | override init(frame: CGRect) { |
| 65 | 65 | super.init(frame: frame) |
| 66 | + let tap = UITapGestureRecognizer.init(target: self, action: #selector(upSlideViewTap)) | |
| 67 | + tap.cancelsTouchesInView = false | |
| 68 | + self.addGestureRecognizer(tap) | |
| 66 | 69 | self.initUI() |
| 67 | 70 | |
| 68 | 71 | } |
| 72 | + @objc func upSlideViewTap() { | |
| 73 | + print("upSlideViewTap") | |
| 74 | + } | |
| 69 | 75 | |
| 70 | 76 | required init?(coder: NSCoder) { |
| 71 | 77 | fatalError("init(coder:) has not been implemented") |
| ... | ... | @@ -73,6 +79,7 @@ class CNUpSlideView:UIView{ |
| 73 | 79 | |
| 74 | 80 | func initUI() |
| 75 | 81 | { |
| 82 | + self.isUserInteractionEnabled = true | |
| 76 | 83 | self.backgroundColor = UIColor.clear |
| 77 | 84 | self.layer.cornerRadius = 20 |
| 78 | 85 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/GoodsList/CNLiveShopGoodsListCell.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopGoodsListCell.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/11/6. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNLiveShopGoodsListCell: UITableViewCell { | |
| 11 | + | |
| 12 | + //goodsModel | |
| 13 | + var _goodsModel : CNLiveShopGoodsListModel? | |
| 14 | + var goodsModel : CNLiveShopGoodsListModel? { | |
| 15 | + get{ | |
| 16 | + _goodsModel | |
| 17 | + } | |
| 18 | + set{ | |
| 19 | + _goodsModel = newValue! | |
| 20 | + setupNewUI(model: _goodsModel!) | |
| 21 | + } | |
| 22 | + } | |
| 23 | + //MARK: - 懒加载 | |
| 24 | + lazy var iconImgView :UIImageView = { | |
| 25 | + let iconImgView = UIImageView(frame: CGRect(x: 15, y: 15, width: 90, height: 90)) | |
| 26 | + return iconImgView | |
| 27 | + }() | |
| 28 | + ///编辑按钮 | |
| 29 | + lazy var editBtn: UIButton = { | |
| 30 | + let editBtn = UIButton(type: .custom) | |
| 31 | + editBtn.frame = CGRect(x: KSreenWidth-15*2-28, y: 0, width: 15*2+28, height: 15*2+20) | |
| 32 | + editBtn.setTitle("编辑", for: .normal) | |
| 33 | + editBtn.setTitleColor(HexColor("#333333"), for: .normal) | |
| 34 | + editBtn.titleLabel?.font = Font_15 | |
| 35 | + editBtn.addTarget(self, action: #selector(editBtnAction), for: .touchUpInside) | |
| 36 | + return editBtn | |
| 37 | + }() | |
| 38 | + ///标题 | |
| 39 | + lazy var titleLabel: UILabel = { | |
| 40 | + let titleLabel = UILabel.init(frame: CGRectMake(self.iconImgView.right+15, 15, self.editBtn.left-self.iconImgView.right-15*2, 21)) | |
| 41 | + titleLabel.textColor = HexColor("#333333") | |
| 42 | + titleLabel.textAlignment = .left | |
| 43 | + titleLabel.font = Font_15 | |
| 44 | + titleLabel.adjustsFontSizeToFitWidth=true | |
| 45 | + titleLabel.text = "啊啊啊啊啊" | |
| 46 | + return titleLabel | |
| 47 | + }() | |
| 48 | + ///副标题 | |
| 49 | + lazy var subTitleLabel: UILabel = { | |
| 50 | + let subTitleLabel = UILabel.init(frame: CGRectMake(self.iconImgView.right+15, self.editBtn.bottom, KSreenWidth-self.iconImgView.right-15*2, 18)) | |
| 51 | + subTitleLabel.textColor = HexColor("#999999") | |
| 52 | + subTitleLabel.textAlignment = .left | |
| 53 | + subTitleLabel.font = Font_13 | |
| 54 | + subTitleLabel.adjustsFontSizeToFitWidth=true | |
| 55 | + subTitleLabel.text = "啊啊啊啊" | |
| 56 | + return subTitleLabel | |
| 57 | + }() | |
| 58 | + ///价格 | |
| 59 | + lazy var priceLabel: UILabel = { | |
| 60 | + let priceLabel = UILabel.init(frame: CGRectMake(self.iconImgView.right+15, self.subTitleLabel.bottom+19, KSreenWidth-80-17-15*2-self.iconImgView.right, 27)) | |
| 61 | + priceLabel.textColor = HexColor("#FF3355") | |
| 62 | + priceLabel.textAlignment = .left | |
| 63 | + priceLabel.font = Font_19 | |
| 64 | + priceLabel.adjustsFontSizeToFitWidth=true | |
| 65 | + priceLabel.text = "10000.00" | |
| 66 | + return priceLabel | |
| 67 | + }() | |
| 68 | + ///底部line | |
| 69 | + lazy var bottomLineView :UIView = { | |
| 70 | + let bottomLineView = UIView(frame: CGRect(x: 0, y: 167-5, width: KSreenWidth, height: 5)) | |
| 71 | + bottomLineView.backgroundColor = UIColor(hue:0.00, saturation:0.00, brightness:0.98, alpha:1.00) | |
| 72 | + return bottomLineView | |
| 73 | + }() | |
| 74 | + ///库存 | |
| 75 | + lazy var countLabel: UILabel = { | |
| 76 | + let countLabel = UILabel.init(frame: CGRectMake(15, self.iconImgView.bottom+15, KSreenWidth-58-15-15*2, self.bottomLineView.top-self.iconImgView.bottom-15)) | |
| 77 | + countLabel.textColor = HexColor("#333333") | |
| 78 | + countLabel.textAlignment = .left | |
| 79 | + countLabel.font = Font_15 | |
| 80 | + countLabel.adjustsFontSizeToFitWidth=true | |
| 81 | + countLabel.text = "库存:10000" | |
| 82 | + return countLabel | |
| 83 | + }() | |
| 84 | + ///编辑库存按钮 | |
| 85 | + lazy var editCountBtn: UIButton = { | |
| 86 | + let editCountBtn = UIButton(type: .custom) | |
| 87 | + editCountBtn.frame = CGRect(x: KSreenWidth-15-58, y: self.countLabel.top, width: 58, height: self.countLabel.height) | |
| 88 | + editCountBtn.setTitle("编辑库存", for: .normal) | |
| 89 | + editCountBtn.setTitleColor(HexColor("#61C464"), for: .normal) | |
| 90 | + editCountBtn.titleLabel?.font = Font_14 | |
| 91 | + editCountBtn.addTarget(self, action: #selector(editCountBtnAction), for: .touchUpInside) | |
| 92 | + return editCountBtn | |
| 93 | + }() | |
| 94 | + | |
| 95 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | |
| 96 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | |
| 97 | + self.selectionStyle = .none | |
| 98 | + contentView.backgroundColor = .white | |
| 99 | + contentView.addSubview(self.iconImgView) | |
| 100 | + contentView.addSubview(self.editBtn) | |
| 101 | + contentView.addSubview(self.titleLabel) | |
| 102 | + contentView.addSubview(self.subTitleLabel) | |
| 103 | + contentView.addSubview(self.priceLabel) | |
| 104 | + contentView.addSubview(self.bottomLineView) | |
| 105 | + contentView.addSubview(self.countLabel) | |
| 106 | + contentView.addSubview(self.editCountBtn) | |
| 107 | + | |
| 108 | + } | |
| 109 | + | |
| 110 | + required init?(coder: NSCoder) { | |
| 111 | + fatalError("init(coder:) has not been implemented") | |
| 112 | + } | |
| 113 | + | |
| 114 | + func setupNewUI(model:CNLiveShopGoodsListModel){ | |
| 115 | + self.iconImgView.kf.setImage(with: URL(string: model.simg ?? "")) | |
| 116 | + self.titleLabel.text = model.title ?? "" | |
| 117 | + self.subTitleLabel.text = model.ads ?? "" | |
| 118 | + self.priceLabel.text = "¥"+(model.price ?? "0.00") | |
| 119 | + if model.state == 2{ | |
| 120 | + //设置 上架 | |
| 121 | + }else{ | |
| 122 | + //设置 下架 | |
| 123 | + } | |
| 124 | + self.countLabel.text = "库存: "+(model.count ?? "0") | |
| 125 | + } | |
| 126 | + | |
| 127 | + // MARK: - BtnAction | |
| 128 | + @objc func editBtnAction(){ | |
| 129 | + | |
| 130 | + } | |
| 131 | + @objc func editCountBtnAction(){ | |
| 132 | + | |
| 133 | + } | |
| 134 | + | |
| 135 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/GoodsList/CNLiveShopGoodsListClassifyView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopGoodsListClassifyView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/11/6. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNLiveShopGoodsListClassifyView: UIView { | |
| 11 | + | |
| 12 | + //最新 | |
| 13 | + lazy var lastestBtn: UIButton = { | |
| 14 | + let lastestBtn = UIButton(type: .custom) | |
| 15 | + lastestBtn.frame = CGRect(x: 0, y: 0, width: KSreenWidth*0.5, height: self.height) | |
| 16 | + lastestBtn.setTitle("最新", for: .normal) | |
| 17 | + lastestBtn.setTitle("最新", for: .selected) | |
| 18 | + lastestBtn.titleLabel?.font = Font_14 | |
| 19 | + lastestBtn.setTitleColor(HexColor("#999999"), for: .normal) | |
| 20 | + lastestBtn.setTitleColor(HexColor("#FC1541"), for: .selected) | |
| 21 | + lastestBtn.addTarget(self, action: #selector(lastestBtnAction), for: .touchUpInside) | |
| 22 | + return lastestBtn | |
| 23 | + }() | |
| 24 | + | |
| 25 | + //价格 后面再完善 | |
| 26 | + lazy var priceBtn: UIButton = { | |
| 27 | + let priceBtn = UIButton(type: .custom) | |
| 28 | + priceBtn.frame = CGRect(x: KSreenWidth*0.5, y: 0, width: KSreenWidth*0.5, height: self.height) | |
| 29 | + priceBtn.setTitle("价格", for: .normal) | |
| 30 | + priceBtn.setTitle("价格", for: .selected) | |
| 31 | + priceBtn.titleLabel?.font = Font_14 | |
| 32 | + priceBtn.setTitleColor(HexColor("#999999"), for: .normal) | |
| 33 | + priceBtn.setTitleColor(HexColor("#FC1541"), for: .selected) | |
| 34 | + priceBtn.addTarget(self, action: #selector(priceBtnAction), for: .touchUpInside) | |
| 35 | + return priceBtn | |
| 36 | + }() | |
| 37 | + | |
| 38 | + override init(frame: CGRect) { | |
| 39 | + super.init(frame: frame) | |
| 40 | + self.setUI() | |
| 41 | + } | |
| 42 | + | |
| 43 | + func setUI(){ | |
| 44 | + self.addSubview(self.lastestBtn) | |
| 45 | + self.addSubview(self.priceBtn) | |
| 46 | + self.lastestBtn.isSelected = true | |
| 47 | + } | |
| 48 | + | |
| 49 | + required init?(coder: NSCoder) { | |
| 50 | + fatalError("init(coder:) has not been implemented") | |
| 51 | + } | |
| 52 | + | |
| 53 | + @objc func priceBtnAction(){ | |
| 54 | + self.priceBtn.isSelected = true | |
| 55 | + self.lastestBtn.isSelected = false | |
| 56 | + } | |
| 57 | + @objc func lastestBtnAction(){ | |
| 58 | + self.lastestBtn.isSelected = true | |
| 59 | + self.priceBtn.isSelected = false | |
| 60 | + } | |
| 61 | +} | |
| 62 | + | ... | ... |
metaCode/Classes/Main/HomePage/ViewModel/CNLiveShopConsoleViewModel.swift
| ... | ... | @@ -17,7 +17,8 @@ class CNLiveShopConsoleViewModel: NSObject { |
| 17 | 17 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid") |
| 18 | 18 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 19 | 19 | CNLiveNetworking.setupShowDataResult(false) |
| 20 | - CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseShopUrl+"/api/v1/isSellerNew", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 20 | + CNLiveNetworking.setupDSRequest(true) | |
| 21 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/api/v1/isSellerNew", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 21 | 22 | hiddenLoading() |
| 22 | 23 | if (error == nil) { |
| 23 | 24 | let resp = result as! NSDictionary | ... | ... |
metaCode/Classes/Main/HomePage/ViewModel/CNLiveShopDetailViewModel.swift
| ... | ... | @@ -20,7 +20,8 @@ class CNLiveShopDetailViewModel:NSObject{ |
| 20 | 20 | |
| 21 | 21 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 22 | 22 | CNLiveNetworking.setupShowDataResult(false) |
| 23 | - CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseShopUrl+"/api/v1/index", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 23 | + CNLiveNetworking.setupDSRequest(true) | |
| 24 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/api/v1/index", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 24 | 25 | hiddenLoading() |
| 25 | 26 | if (error == nil) { |
| 26 | 27 | let resp = result as! NSDictionary | ... | ... |
metaCode/Classes/Main/HomePage/ViewModel/GoodsManager/CNLiveShopGoodListViewModel.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopGoodListViewModel.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/11/6. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import CNLiveRequestBastKit | |
| 10 | + | |
| 11 | +class CNLiveShopGoodListViewModel:NSObject{ | |
| 12 | + /// 商品列表获取 | |
| 13 | + /// - Parameters: | |
| 14 | + /// - shopId:id | |
| 15 | + /// - sortType:排序类型 1新品 2价格从底到高 3 价格从高到底 | |
| 16 | + /// - page:页数 1 | |
| 17 | + static func requestGoodsList(shopId:String?,sortType:String?,page:String?,resultBlock: @escaping downSlideResultBlock) { | |
| 18 | + let param = NSMutableDictionary() | |
| 19 | + param.setValue(shopId, forKey: "shop_id") | |
| 20 | + param.setValue(sortType ?? "1", forKey: "type") | |
| 21 | + param.setValue("0", forKey: "state") | |
| 22 | + param.setValue("", forKey: "category_id") | |
| 23 | + param.setValue("", forKey: "keyword") | |
| 24 | + param.setValue(page ?? "1", forKey: "page") | |
| 25 | + | |
| 26 | + | |
| 27 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 28 | + CNLiveNetworking.setupShowDataResult(false) | |
| 29 | + CNLiveNetworking.setupDSRequest(true) | |
| 30 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/getGoodsList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 31 | + hiddenLoading() | |
| 32 | + if (error == nil) { | |
| 33 | + let resp = result as! NSDictionary | |
| 34 | + var dataArr:[BaseModel] = [] | |
| 35 | + let respArr = resp["data"] as! NSArray | |
| 36 | + for dic in respArr{ | |
| 37 | + let dataDic = dic as! NSDictionary | |
| 38 | + let goodsListModel = newDictionaryToModel(dataDic as! [String : Any], CNLiveShopGoodsListModel.self) | |
| 39 | + dataArr.append(goodsListModel) | |
| 40 | + } | |
| 41 | + resultBlock(dataArr,.success) | |
| 42 | + }else{ | |
| 43 | + resultBlock(NSNull(),.failed) | |
| 44 | + } | |
| 45 | + } | |
| 46 | + } | |
| 47 | +} | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| ... | ... | @@ -267,40 +267,40 @@ class CNLiveMineViewModel: NSObject { |
| 267 | 267 | if (errorCode == "0") { |
| 268 | 268 | let listModel = dictionaryToModel(resp as! [String : Any], StandListBaseModel.self,"data") as! StandListBaseModel |
| 269 | 269 | if page == 1 && listModel.list.count > 0 { |
| 270 | - CNLiveSaveStandDB.shared.insertObjects(objects: listModel.list) | |
| 270 | +// CNLiveSaveStandDB.shared.insertObjects(objects: listModel.list) | |
| 271 | 271 | } |
| 272 | 272 | listModel.list = StandSortManager.sortAllListData(stands: listModel.list as NSArray) as! [StandListModel] |
| 273 | 273 | resultBlock(listModel,.success) |
| 274 | 274 | } else { |
| 275 | - let tempArray = CNLiveSaveStandDB.shared.searchAllObject() | |
| 276 | - if tempArray.count > 0 { | |
| 277 | - let listModel = StandListBaseModel.init() | |
| 278 | - listModel.pageNum = page | |
| 279 | - listModel.total = page | |
| 280 | - listModel.list = StandSortManager.sortAllListData(stands: tempArray as NSArray) as! [StandListModel] | |
| 281 | - resultBlock(listModel,.success) | |
| 282 | - }else{ | |
| 283 | - showMessage(message: resp["errorMessage"] as! String) | |
| 284 | - resultBlock(NSNull(),.failed) | |
| 285 | - } | |
| 275 | +// let tempArray = CNLiveSaveStandDB.shared.searchAllObject() | |
| 276 | +// if tempArray.count > 0 { | |
| 277 | +// let listModel = StandListBaseModel.init() | |
| 278 | +// listModel.pageNum = page | |
| 279 | +// listModel.total = page | |
| 280 | +// listModel.list = StandSortManager.sortAllListData(stands: tempArray as NSArray) as! [StandListModel] | |
| 281 | +// resultBlock(listModel,.success) | |
| 282 | +// }else{ | |
| 283 | +// showMessage(message: resp["errorMessage"] as! String) | |
| 284 | +// resultBlock(NSNull(),.failed) | |
| 285 | +// } | |
| 286 | 286 | } |
| 287 | 287 | } else { |
| 288 | - let tempArray = CNLiveSaveStandDB.shared.searchAllObject() | |
| 289 | - if tempArray.count > 0 { | |
| 290 | - let listModel = StandListBaseModel.init() | |
| 291 | - listModel.pageNum = page | |
| 292 | - listModel.total = page | |
| 293 | - listModel.list = StandSortManager.sortAllListData(stands: tempArray as NSArray) as! [StandListModel] | |
| 294 | - resultBlock(listModel,.success) | |
| 295 | - }else{ | |
| 296 | - if CNLiveNetworking.isNetworking() { | |
| 297 | - showMessage(message: "获取失败") | |
| 298 | - resultBlock(NSNull(),.failed) | |
| 299 | - } else { | |
| 300 | - showMessage(message: "似乎与网络断开链接") | |
| 301 | - resultBlock(NSNull(),.noNetwork) | |
| 302 | - } | |
| 303 | - } | |
| 288 | +// let tempArray = CNLiveSaveStandDB.shared.searchAllObject() | |
| 289 | +// if tempArray.count > 0 { | |
| 290 | +// let listModel = StandListBaseModel.init() | |
| 291 | +// listModel.pageNum = page | |
| 292 | +// listModel.total = page | |
| 293 | +// listModel.list = StandSortManager.sortAllListData(stands: tempArray as NSArray) as! [StandListModel] | |
| 294 | +// resultBlock(listModel,.success) | |
| 295 | +// }else{ | |
| 296 | +// if CNLiveNetworking.isNetworking() { | |
| 297 | +// showMessage(message: "获取失败") | |
| 298 | +// resultBlock(NSNull(),.failed) | |
| 299 | +// } else { | |
| 300 | +// showMessage(message: "似乎与网络断开链接") | |
| 301 | +// resultBlock(NSNull(),.noNetwork) | |
| 302 | +// } | |
| 303 | +// } | |
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | } |
| ... | ... | @@ -325,40 +325,40 @@ class CNLiveMineViewModel: NSObject { |
| 325 | 325 | if (errorCode == "0" && !(resp["data"] is NSNull)) { |
| 326 | 326 | let listModel = dictionaryToModel(resp as! [String : Any], MineAuthListBaseModel.self,"data") as! MineAuthListBaseModel |
| 327 | 327 | if page == 1 && listModel.list.count > 0 { |
| 328 | - CNLiveSaveAuthDB.shared.insertObjects(objects: listModel.list) | |
| 328 | +// CNLiveSaveAuthDB.shared.insertObjects(objects: listModel.list) | |
| 329 | 329 | } |
| 330 | 330 | listModel.list = StandSortManager.sortMyListData(auths: listModel.list as NSArray) as! [MineAuthListModel] |
| 331 | 331 | resultBlock(listModel,.success) |
| 332 | 332 | } else { |
| 333 | - let tempArray = CNLiveSaveAuthDB.shared.searchAllObject() | |
| 334 | - if tempArray.count > 0 { | |
| 335 | - let listModel = MineAuthListBaseModel.init() | |
| 336 | - listModel.pageNum = page | |
| 337 | - listModel.total = page | |
| 338 | - listModel.list = StandSortManager.sortMyListData(auths: tempArray as NSArray) as! [MineAuthListModel] | |
| 339 | - resultBlock(listModel,.success) | |
| 340 | - }else{ | |
| 341 | - showMessage(message: resp["errorMessage"] as! String) | |
| 342 | - resultBlock(NSNull(),.failed) | |
| 343 | - } | |
| 333 | +// let tempArray = CNLiveSaveAuthDB.shared.searchAllObject() | |
| 334 | +// if tempArray.count > 0 { | |
| 335 | +// let listModel = MineAuthListBaseModel.init() | |
| 336 | +// listModel.pageNum = page | |
| 337 | +// listModel.total = page | |
| 338 | +// listModel.list = StandSortManager.sortMyListData(auths: tempArray as NSArray) as! [MineAuthListModel] | |
| 339 | +// resultBlock(listModel,.success) | |
| 340 | +// }else{ | |
| 341 | +// showMessage(message: resp["errorMessage"] as! String) | |
| 342 | +// resultBlock(NSNull(),.failed) | |
| 343 | +// } | |
| 344 | 344 | } |
| 345 | 345 | } else { |
| 346 | - let tempArray = CNLiveSaveAuthDB.shared.searchAllObject() | |
| 347 | - if tempArray.count > 0 { | |
| 348 | - let listModel = MineAuthListBaseModel.init() | |
| 349 | - listModel.pageNum = page | |
| 350 | - listModel.total = page | |
| 351 | - listModel.list = StandSortManager.sortMyListData(auths: tempArray as NSArray) as! [MineAuthListModel] | |
| 352 | - resultBlock(listModel,.success) | |
| 353 | - }else{ | |
| 354 | - if CNLiveNetworking.isNetworking() { | |
| 355 | - showMessage(message: "获取失败") | |
| 356 | - resultBlock(NSNull(),.failed) | |
| 357 | - } else { | |
| 358 | - showMessage(message: "似乎与网络断开链接") | |
| 359 | - resultBlock(NSNull(),.noNetwork) | |
| 360 | - } | |
| 361 | - } | |
| 346 | +// let tempArray = CNLiveSaveAuthDB.shared.searchAllObject() | |
| 347 | +// if tempArray.count > 0 { | |
| 348 | +// let listModel = MineAuthListBaseModel.init() | |
| 349 | +// listModel.pageNum = page | |
| 350 | +// listModel.total = page | |
| 351 | +// listModel.list = StandSortManager.sortMyListData(auths: tempArray as NSArray) as! [MineAuthListModel] | |
| 352 | +// resultBlock(listModel,.success) | |
| 353 | +// }else{ | |
| 354 | +// if CNLiveNetworking.isNetworking() { | |
| 355 | +// showMessage(message: "获取失败") | |
| 356 | +// resultBlock(NSNull(),.failed) | |
| 357 | +// } else { | |
| 358 | +// showMessage(message: "似乎与网络断开链接") | |
| 359 | +// resultBlock(NSNull(),.noNetwork) | |
| 360 | +// } | |
| 361 | +// } | |
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | } |
| ... | ... | @@ -603,9 +603,8 @@ class CNLiveMineViewModel: NSObject { |
| 603 | 603 | custom_param.setValue(APPKey_wjj, forKey: "appKey") |
| 604 | 604 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 605 | 605 | CNLiveNetworking.setupShowDataResult(false) |
| 606 | - CNLiveNetworking.setupDSRequest(true) | |
| 607 | 606 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 608 | - CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjShopUrl+"/Api/Index3/myOrderCount", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 607 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/Api/Index3/myOrderCount", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 609 | 608 | hiddenLoading() |
| 610 | 609 | if (error == nil) { |
| 611 | 610 | let resp = result as! NSDictionary | ... | ... |
metaCode/Classes/Main/Model/CNLiveShopDetailModel.swift
metaCode/Classes/Main/Model/CNLiveShopUserInfoModel.swift
| ... | ... | @@ -9,6 +9,7 @@ import Foundation |
| 9 | 9 | |
| 10 | 10 | //获取用户信息 |
| 11 | 11 | class CNLiveShopUserInfoModel:BaseModel{ |
| 12 | + | |
| 12 | 13 | ///darenid生成付款码时用到 |
| 13 | 14 | var daren_id: String? |
| 14 | 15 | ///uid 用于请求老达人信息接口 |
| ... | ... | @@ -31,6 +32,7 @@ class CNLiveShopUserInfoModel:BaseModel{ |
| 31 | 32 | var title: String? |
| 32 | 33 | ///商家logo |
| 33 | 34 | var logo: String? |
| 35 | + | |
| 34 | 36 | } |
| 35 | 37 | /** |
| 36 | 38 | Printing description of ((__NSDictionaryI *)0x000000010884eca0): | ... | ... |
metaCode/Classes/Main/Model/GoodsManager/CNLiveShopAddEditGoodsModel.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopAddEditGoodsModel.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/11/7. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNLiveShopAddEditGoodsModel: BaseModel { | |
| 11 | + ///列表 | |
| 12 | + var list = [CNLiveShopAddEditGoodsListModel]() | |
| 13 | + func initDataSource(){ | |
| 14 | + var dataSource = | |
| 15 | + [ ["style":"1","isHaveTo":true,"title":"商品分类","contentType":"2"], | |
| 16 | + ["style":"1","isHaveTo":true,"title":"店铺分类","contentType":"2"], | |
| 17 | + ["style":"2","title":"基本信息"], | |
| 18 | + ["style":"3","isHaveTo":true,"title":"商品轮播","isDisplayLine":true,"isAbleSelectVideo":true,"isAbleSelectCover":true,"maxSelectImageCount":"7"], | |
| 19 | + ["style":"1","isHaveTo":true,"title":"商品名称","isDisplayLine":true,"contentType":"1"], | |
| 20 | + ["style":"4","isHaveTo":false,"title":"商品副标题","isDisplayLine":true,"placeholder":"请在此输入..."], | |
| 21 | + ["style":"1","isHaveTo":true,"title":"本店售价","subtitle":"(实际售价)","isDisplayLine":true,"contentTextFieldkeyboardType":"2","decimalLength":"2","contentTextColor":"0xFC1541","contentType":"1"], | |
| 22 | + ["style":"1","isHaveTo":true,"title":"市场售价","isDisplayLine":true,"contentTextFieldkeyboardType":"2","decimalLength":"2","contentType":"1"], | |
| 23 | + ["style":"1","isHaveTo":false,"title":"商品重量","subtitle":"(kg)","isDisplayLine":true,"contentTextFieldkeyboardType":"2","decimalLength":"3","contentType":"1"], | |
| 24 | + ["style":"5","isHaveTo":false,"title":"最低起售","subtitle":"(件)","isDisplayLine":true,"desc":"如起售数超出库存买家无法购买","decimalLength":"3","contentType":"4"], | |
| 25 | + ["style":"1","isHaveTo":false,"title":"上架","contentType":"3"], | |
| 26 | + ["style":"2","title":"通用信息"], | |
| 27 | + ["style":"3","isHaveTo":true,"title":"商品详情图","isDisplayLine":true,"maxSelectImageCount":"9"], | |
| 28 | + ["style":"1","isHaveTo":false,"title":"商品运费","subtitle":"(0为包邮)","isDisplayLine":true,"contentTextFieldkeyboardType":"2","decimalLength":"2","contentType":"1"], | |
| 29 | + ["style":"1","isHaveTo":false,"title":"是否支持退货","isDisplayLine":true,"contentType":"3"], | |
| 30 | + ["style":"1","isHaveTo":false,"title":"商品单位","contentTextFieldkeyboardType":"1","isDisplayLine":true,"contentType":"1"], | |
| 31 | + ["style":"2","title":"通用参数(*为必填)","touchSubtitle":"添加通用参数"], | |
| 32 | + ["style":"1","isHaveTo":true,"title":"品名","isDisplayLine":true,"contentType":"1"], | |
| 33 | + ["style":"1","isHaveTo":true,"title":"规格","isDisplayLine":true,"contentType":"1"], | |
| 34 | + ["style":"4","isHaveTo":true,"title":"寄送区域","isDisplayLine":true,"contentType":"1","placeholder":"请填写不配送**地区、仅配送**地区或全国包邮"], | |
| 35 | + ["style":"1","isHaveTo":true,"title":"发货时效","isDisplayLine":true,"contentType":"1"], | |
| 36 | + ["style":"1","isHaveTo":false,"title":"口味","contentTextFieldkeyboardType":"1","isDisplayLine":true,"contentType":"1","isDelect":true], | |
| 37 | + ["style":"1","isHaveTo":false,"title":"产地","contentTextFieldkeyboardType":"1","isDisplayLine":true,"contentType":"1","isDelect":true], | |
| 38 | + ["style":"1","isHaveTo":false,"title":"存储方式及期限","contentTextFieldkeyboardType":"1","isDisplayLine":true,"contentType":"1","isDelect":true] | |
| 39 | + ] | |
| 40 | + | |
| 41 | + for dic in dataSource{ | |
| 42 | + let mdl = newDictionaryToModel(dic, CNLiveShopAddEditGoodsListModel.self) | |
| 43 | + list.append(mdl as! CNLiveShopAddEditGoodsListModel) | |
| 44 | + | |
| 45 | + } | |
| 46 | + } | |
| 47 | +} | |
| 48 | + | |
| 49 | + | |
| 50 | +class CNLiveShopAddEditGoodsListModel: BaseModel { | |
| 51 | + /// 商品id | |
| 52 | + var id: String? | |
| 53 | + /// 样式4中 二是标题 三是选取图片 四是输入框 五添加起售数量 | |
| 54 | + var style:Int = 0 | |
| 55 | + /// 是否必须 | |
| 56 | + var isHaveTo: Bool? | |
| 57 | + /// 标题 | |
| 58 | + var title: String? | |
| 59 | + /// 副标题 | |
| 60 | + var subtitle: String? | |
| 61 | + /// 对主标题下方进行说明文字 | |
| 62 | + var desc: String? | |
| 63 | + /// 自定义规格内容输入 | |
| 64 | + var content: String? | |
| 65 | + /// 副标题点击样式 | |
| 66 | + var touchSubtitle: String? | |
| 67 | + /// style=4 占位标识 | |
| 68 | + var placeholder: String? | |
| 69 | + /// 是否显示底部的线 | |
| 70 | + var isDisplayLine: Bool? | |
| 71 | + /// 样式一属性 内容输入框键盘类型 1默认类型 2数字类型带小数点 | |
| 72 | + var contentTextFieldkeyboardType:Int = 0 | |
| 73 | + /// 样式一属性 小数点位数 | |
| 74 | + var decimalLength:Int = 0 | |
| 75 | + /// 样式一属性 内容输入框颜色 默认0x787878 | |
| 76 | + var contentTextColor: String? | |
| 77 | + /// 样式一属性 1输入框 2选择 3开关 4可以增加数量 | |
| 78 | + var contentType:Int = 0 | |
| 79 | + /// 样式一属性 是不是显示输入框右边删除按钮 | |
| 80 | + var isDelect: Bool? | |
| 81 | + /// 样式三属性 是否可以选择视频 | |
| 82 | + var isAbleSelectVideo: Bool? | |
| 83 | + /// 样式三属性 是否可以选择主页 | |
| 84 | + var isAbleSelectCover: Bool? | |
| 85 | + /// 样式三属性 最多可以选取多少张图片 | |
| 86 | + var maxSelectImageCount:Int = 0 | |
| 87 | +} | ... | ... |
metaCode/Classes/Main/Model/GoodsManager/CNLiveShopGoodsListModel.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopGoodsListModel.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/11/6. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNLiveShopGoodsListModel:BaseModel{ | |
| 11 | + ///商品id | |
| 12 | + var id: String? | |
| 13 | + ///商品名称 | |
| 14 | + var title: String? | |
| 15 | + ///商品图片 | |
| 16 | + var simg: String? | |
| 17 | +// var img: String? | |
| 18 | + ///商品价格 | |
| 19 | + var price: String? | |
| 20 | + ///商品介绍 | |
| 21 | + var ads: String? | |
| 22 | + ///商品分类 | |
| 23 | + var groupid: String? | |
| 24 | + ///店铺id | |
| 25 | + var shopid: String? | |
| 26 | +// var shop_id: String? | |
| 27 | + ///店铺分类id | |
| 28 | + var category_id: String? | |
| 29 | + ///1下架 2上架 | |
| 30 | + var state: Int? | |
| 31 | + ///库存 | |
| 32 | + var count: String? | |
| 33 | + ///1普通商品 2文创商品 | |
| 34 | + var shop_type: String? | |
| 35 | + ///排序 | |
| 36 | + var ord: String? | |
| 37 | + ///商品是否被选中(本地标记) | |
| 38 | + var select: Bool? | |
| 39 | + ///最小购买数量 | |
| 40 | + var min_buy_num: String? | |
| 41 | +} | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Home/ds_Up_Btn.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "ds_Up_Btn@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "author" : "xcode", | |
| 19 | + "version" : 1 | |
| 20 | + } | |
| 21 | +} | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Home/ds_Up_Btn.imageset/ds_Up_Btn@2x.png
0 → 100644
7.26 KB
metaCode/Supporting Files/Assets.xcassets/Home/homepage_detail.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "homepage_detail@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "author" : "xcode", | |
| 19 | + "version" : 1 | |
| 20 | + } | |
| 21 | +} | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Home/homepage_detail.imageset/homepage_detail@2x.png
0 → 100644
293 Bytes
metaCode/Supporting Files/Assets.xcassets/Home/homepage_detail_asset_bg.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "homepage_detail_asset_bg@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "author" : "xcode", | |
| 19 | + "version" : 1 | |
| 20 | + } | |
| 21 | +} | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Home/homepage_detail_asset_bg.imageset/homepage_detail_asset_bg@2x.png
0 → 100644
56.3 KB
metaCode/Supporting Files/Assets.xcassets/Home/homepage_detail_dongtai_bg.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "homepage_detail_dongtai_bg@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "author" : "xcode", | |
| 19 | + "version" : 1 | |
| 20 | + } | |
| 21 | +} | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Home/homepage_detail_dongtai_bg.imageset/homepage_detail_dongtai_bg@2x.png
0 → 100644
38.1 KB
metaCode/Supporting Files/Assets.xcassets/Home/homepage_detail_order_bg.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "homepage_detail_order_bg@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "author" : "xcode", | |
| 19 | + "version" : 1 | |
| 20 | + } | |
| 21 | +} | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Home/homepage_detail_order_bg.imageset/homepage_detail_order_bg@2x.png
0 → 100644
48.1 KB