Commit 77754ff62ab814b3de81047a767e1f6bb3e100cb
Merge branch 'master' of http://bj.gitlab.cnlive.com/ios-team/CNLiveMateCode
Showing
13 changed files
with
306 additions
and
31 deletions
metaCode.xcodeproj/project.pbxproj
| ... | ... | @@ -70,6 +70,7 @@ |
| 70 | 70 | 79282A402A2F055100B5F8CF /* CNLiveConfigUserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A3F2A2F055100B5F8CF /* CNLiveConfigUserInfo.swift */; }; |
| 71 | 71 | 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A432A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift */; }; |
| 72 | 72 | 79282A462A2F457D00B5F8CF /* CNLiveMineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A452A2F457D00B5F8CF /* CNLiveMineViewController.swift */; }; |
| 73 | + 792B53282AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 792B53272AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift */; }; | |
| 73 | 74 | 792E57D92A3AA2F2005834DB /* CNLiveCommonBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 792E57D82A3AA2F2005834DB /* CNLiveCommonBaseModel.swift */; }; |
| 74 | 75 | 792E57DB2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 792E57DA2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift */; }; |
| 75 | 76 | 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */; }; |
| ... | ... | @@ -234,6 +235,7 @@ |
| 234 | 235 | 79282A3F2A2F055100B5F8CF /* CNLiveConfigUserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveConfigUserInfo.swift; sourceTree = "<group>"; }; |
| 235 | 236 | 79282A432A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveLoginAuthView.swift; sourceTree = "<group>"; }; |
| 236 | 237 | 79282A452A2F457D00B5F8CF /* CNLiveMineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineViewController.swift; sourceTree = "<group>"; }; |
| 238 | + 792B53272AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderExpressDetailViewController.swift; sourceTree = "<group>"; }; | |
| 237 | 239 | 792E57D82A3AA2F2005834DB /* CNLiveCommonBaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCommonBaseModel.swift; sourceTree = "<group>"; }; |
| 238 | 240 | 792E57DA2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCommonQiniuTool.swift; sourceTree = "<group>"; }; |
| 239 | 241 | 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveExtensions.swift"; sourceTree = "<group>"; }; |
| ... | ... | @@ -703,6 +705,7 @@ |
| 703 | 705 | 791C1C852AFB2EB4003E6362 /* CNLiveShopOrderExpressViewController.swift */, |
| 704 | 706 | 791C1C872AFB6FD7003E6362 /* CNLiveShopOrderExpressFirmViewController.swift */, |
| 705 | 707 | 791C1C892AFB84EE003E6362 /* CNLiveShopOrderExpressListViewController.swift */, |
| 708 | + 792B53272AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift */, | |
| 706 | 709 | ); |
| 707 | 710 | path = Controller; |
| 708 | 711 | sourceTree = "<group>"; |
| ... | ... | @@ -1131,6 +1134,7 @@ |
| 1131 | 1134 | 19BB1FF02AF0E5B30094D962 /* CNLiveShopDetailModel.swift in Sources */, |
| 1132 | 1135 | 796398942A260C0100D045EB /* AppDelegate.swift in Sources */, |
| 1133 | 1136 | 7989B5C72A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift in Sources */, |
| 1137 | + 792B53282AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift in Sources */, | |
| 1134 | 1138 | 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */, |
| 1135 | 1139 | 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */, |
| 1136 | 1140 | 19565ECB2AF8C59C007D6727 /* CNLiveShopGoodsListModel.swift in Sources */, |
| ... | ... | @@ -1435,7 +1439,7 @@ |
| 1435 | 1439 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
| 1436 | 1440 | CLANG_ENABLE_MODULES = YES; |
| 1437 | 1441 | CODE_SIGN_STYLE = Automatic; |
| 1438 | - CURRENT_PROJECT_VERSION = 1.0.1.23.11.09.13; | |
| 1442 | + CURRENT_PROJECT_VERSION = 1.0.1.23.11.09.17; | |
| 1439 | 1443 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 1440 | 1444 | EXCLUDED_ARCHS = ""; |
| 1441 | 1445 | GENERATE_INFOPLIST_FILE = YES; |
| ... | ... | @@ -1480,7 +1484,7 @@ |
| 1480 | 1484 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
| 1481 | 1485 | CLANG_ENABLE_MODULES = YES; |
| 1482 | 1486 | CODE_SIGN_STYLE = Automatic; |
| 1483 | - CURRENT_PROJECT_VERSION = 1.0.1.23.11.09.13; | |
| 1487 | + CURRENT_PROJECT_VERSION = 1.0.1.23.11.09.17; | |
| 1484 | 1488 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 1485 | 1489 | EXCLUDED_ARCHS = ""; |
| 1486 | 1490 | GENERATE_INFOPLIST_FILE = YES; | ... | ... |
metaCode/Classes/Main/LoginPage/ViewModel/CNLiveLoginViewModel.swift
| ... | ... | @@ -37,9 +37,13 @@ class CNLiveLoginViewModel : NSObject { |
| 37 | 37 | } |
| 38 | 38 | showLoading(message: "") |
| 39 | 39 | let param = ["mobile":phone,"countryCode":code] |
| 40 | + let custom_param = NSMutableDictionary() | |
| 41 | + custom_param.setValue(APPId, forKey: "appId") | |
| 42 | + custom_param.setValue(APPKey, forKey: "appKey") | |
| 43 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 40 | 44 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 41 | 45 | CNLiveNetworking.setupShowDataResult(false) |
| 42 | - CNLiveNetworking.requestNetwork(with: .POST, urlString: "/open/api2/user/sendVerifyCode", param: param, cacheType: .networkOnly) { task, result, error in | |
| 46 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPLoginHost+"/open/api2/user/sendVerifyCode", param: param, cacheType: .networkOnly) { task, result, error in | |
| 43 | 47 | hiddenLoading() |
| 44 | 48 | if (error == nil) { |
| 45 | 49 | let resp = result as! NSDictionary |
| ... | ... | @@ -90,9 +94,13 @@ class CNLiveLoginViewModel : NSObject { |
| 90 | 94 | |
| 91 | 95 | showLoading(message: "") |
| 92 | 96 | let param = ["userName":userName,"countryCode":countryCode,"verificationCode":verCode,"inviterId":""] |
| 97 | + let custom_param = NSMutableDictionary() | |
| 98 | + custom_param.setValue(APPId, forKey: "appId") | |
| 99 | + custom_param.setValue(APPKey, forKey: "appKey") | |
| 100 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 93 | 101 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 94 | 102 | CNLiveNetworking.setupShowDataResult(false) |
| 95 | - CNLiveNetworking.requestNetwork(with: .POST, urlString: "/open/api2/user/loginInMetaCode", param: param, cacheType: .networkOnly) { task, result, error in | |
| 103 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPLoginHost+"/open/api2/user/loginInMetaCode", param: param, cacheType: .networkOnly) { task, result, error in | |
| 96 | 104 | hiddenLoading() |
| 97 | 105 | if (error == nil) { |
| 98 | 106 | let resp = result as! NSDictionary | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
| ... | ... | @@ -46,8 +46,9 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, |
| 46 | 46 | dataArray.add(array03) |
| 47 | 47 | |
| 48 | 48 | |
| 49 | -// let array04 : [Dictionary] = [["name":"订单列表","icon":"mine_list_icon_help_feedback"]] | |
| 50 | -// dataArray.add(array04) | |
| 49 | +// dataArray.add([["name":"订单列表","icon":"mine_list_icon_help_feedback"]]) | |
| 50 | + | |
| 51 | + | |
| 51 | 52 | return dataArray |
| 52 | 53 | }() |
| 53 | 54 | |
| ... | ... | @@ -170,9 +171,9 @@ extension CNLiveMineViewController { |
| 170 | 171 | self.navigationController?.pushViewController(CNLiveTypeFeedBackViewController.init(show_type: .setting), animated: true) |
| 171 | 172 | } |
| 172 | 173 | |
| 173 | -// if indexPath.section == 4 { | |
| 174 | -// self.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: true) | |
| 175 | -// } | |
| 174 | + if indexPath.section == 4 { | |
| 175 | + self.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: true) | |
| 176 | + } | |
| 176 | 177 | |
| 177 | 178 | } |
| 178 | 179 | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineInfoAlertView.swift
| ... | ... | @@ -715,12 +715,13 @@ class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSour |
| 715 | 715 | let pickerView = MineStandListAlertView.init(frame: .zero, infos: infos, show_type: show_type) |
| 716 | 716 | pickerView.result = result |
| 717 | 717 | pickerView.nameLable.text = name |
| 718 | - let window = UIApplication.shared.windows.last | |
| 719 | - window?.addSubview(pickerView) | |
| 718 | + let delegate = UIApplication.shared.delegate as! AppDelegate | |
| 719 | +// let window = UIApplication.shared.windows.last | |
| 720 | + delegate.window?.addSubview(pickerView) | |
| 720 | 721 | pickerView.snp.makeConstraints { make in |
| 721 | 722 | make.edges.equalToSuperview() |
| 722 | 723 | } |
| 723 | - window?.layoutIfNeeded() | |
| 724 | + delegate.window?.layoutIfNeeded() | |
| 724 | 725 | pickerView.alpha = 0 |
| 725 | 726 | UIView.animate(withDuration: 0.1) { |
| 726 | 727 | pickerView.alpha = 1 | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineInputMessageView.swift
| ... | ... | @@ -210,7 +210,7 @@ class MineInputTextShopCustomView: UIView, UITextViewDelegate, UITextFieldDelega |
| 210 | 210 | make.centerY.equalToSuperview() |
| 211 | 211 | } |
| 212 | 212 | make.left.equalToSuperview().offset(10) |
| 213 | - make.width.lessThanOrEqualTo(adapt_length(length: 150)) | |
| 213 | + make.width.lessThanOrEqualTo(adapt_length(length: 160)) | |
| 214 | 214 | } |
| 215 | 215 | addSubview(contentTextField) |
| 216 | 216 | contentTextField.snp.makeConstraints { make in | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| ... | ... | @@ -67,7 +67,7 @@ class CNLiveMineViewModel: NSObject { |
| 67 | 67 | showLoading(message: "") |
| 68 | 68 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 69 | 69 | CNLiveNetworking.setupShowDataResult(false) |
| 70 | - CNLiveNetworking.requestNetwork(with: .POST, urlString: "/open/api2/user/updateUserById", param: param as! [String : Any], cacheType: .networkOnly) { task, result, error in | |
| 70 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPLoginHost+"/open/api2/user/updateUserById", param: param as! [String : Any], cacheType: .networkOnly) { task, result, error in | |
| 71 | 71 | hiddenLoading() |
| 72 | 72 | if (error == nil) { |
| 73 | 73 | let resp = result as! NSDictionary |
| ... | ... | @@ -103,7 +103,7 @@ class CNLiveMineViewModel: NSObject { |
| 103 | 103 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 104 | 104 | CNLiveNetworking.setupShowDataResult(false) |
| 105 | 105 | CNLiveNetworking.setupShowResult(true) |
| 106 | - CNLiveNetworking.uploadNetwork(withURLString: "/open/api2/user/updateUserFaceById", param: param as? [AnyHashable : Any]) { formData in | |
| 106 | + CNLiveNetworking.uploadNetwork(withURLString: APPLoginHost+"/open/api2/user/updateUserFaceById", param: param as? [AnyHashable : Any]) { formData in | |
| 107 | 107 | let imageData = image.imageWithZip() |
| 108 | 108 | formData?.appendPart(withFileData: imageData as Data, name: "face", fileName: ".jpg", mimeType: "image/jpg") |
| 109 | 109 | } progressBlock: { progress in |
| ... | ... | @@ -146,7 +146,7 @@ class CNLiveMineViewModel: NSObject { |
| 146 | 146 | showLoading(message: "") |
| 147 | 147 | CNLiveNetworking.setAllowRequestDefaultArgument(false) |
| 148 | 148 | CNLiveNetworking.setupShowDataResult(false) |
| 149 | - CNLiveNetworking.requestNetwork(with: .POST, urlString: "/open/api2/token", param: (param as! [AnyHashable : Any]), cacheType: .networkOnly) { task, result, error in | |
| 149 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPLoginHost+"/open/api2/token", param: (param as! [AnyHashable : Any]), cacheType: .networkOnly) { task, result, error in | |
| 150 | 150 | hiddenLoading() |
| 151 | 151 | if (error == nil) { |
| 152 | 152 | let resp = result as! NSDictionary |
| ... | ... | @@ -198,6 +198,10 @@ class CNLiveMineViewModel: NSObject { |
| 198 | 198 | param.setValue(Bundle.main.infoDictionary?["CFBundleVersion"] as! String, forKey: "version") |
| 199 | 199 | param.setValue(UIDevice.current.identifierForVendor?.uuidString.replacingOccurrences(of: "-", with: "") ?? "", forKey: "deviceId") |
| 200 | 200 | showLoading(message: "") |
| 201 | + let custom_param = NSMutableDictionary() | |
| 202 | + custom_param.setValue(APPId, forKey: "appId") | |
| 203 | + custom_param.setValue(APPKey, forKey: "appKey") | |
| 204 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 201 | 205 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 202 | 206 | CNLiveNetworking.setupShowDataResult(false) |
| 203 | 207 | CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseMCUrl+"/commonApi/collectFeedback", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in |
| ... | ... | @@ -222,6 +226,10 @@ class CNLiveMineViewModel: NSObject { |
| 222 | 226 | /// - Parameter resultBlock: 结果返回 |
| 223 | 227 | static func requestMessage(resultBlock: @escaping resultNewsBlock) { |
| 224 | 228 | showLoading(message: "") |
| 229 | + let custom_param = NSMutableDictionary() | |
| 230 | + custom_param.setValue(APPId, forKey: "appId") | |
| 231 | + custom_param.setValue(APPKey, forKey: "appKey") | |
| 232 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 225 | 233 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 226 | 234 | CNLiveNetworking.setupShowDataResult(false) |
| 227 | 235 | CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/newsApi/getNews", param: ["sid":UserInfoManager.shared.userInfo.uid], cacheType: .networkOnly) { task, result, error in |
| ... | ... | @@ -257,6 +265,10 @@ class CNLiveMineViewModel: NSObject { |
| 257 | 265 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 258 | 266 | param.setValue("30", forKey: "pageSize") |
| 259 | 267 | param.setValue("\(page)", forKey: "page") |
| 268 | + let custom_param = NSMutableDictionary() | |
| 269 | + custom_param.setValue(APPId, forKey: "appId") | |
| 270 | + custom_param.setValue(APPKey, forKey: "appKey") | |
| 271 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 260 | 272 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 261 | 273 | CNLiveNetworking.setupShowDataResult(false) |
| 262 | 274 | CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/allList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in |
| ... | ... | @@ -315,6 +327,10 @@ class CNLiveMineViewModel: NSObject { |
| 315 | 327 | param.setValue("1", forKey: "type") //0正在审核 1已认证 -1审核失败 |
| 316 | 328 | param.setValue("\(page)", forKey: "page") |
| 317 | 329 | param.setValue("30", forKey: "pageSize") |
| 330 | + let custom_param = NSMutableDictionary() | |
| 331 | + custom_param.setValue(APPId, forKey: "appId") | |
| 332 | + custom_param.setValue(APPKey, forKey: "appKey") | |
| 333 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 318 | 334 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 319 | 335 | CNLiveNetworking.setupShowDataResult(false) |
| 320 | 336 | CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/myList", param: param as! [String: String], cacheType: .networkOnly) { task, result, error in |
| ... | ... | @@ -399,6 +415,10 @@ class CNLiveMineViewModel: NSObject { |
| 399 | 415 | let data = try JSONSerialization.data(withJSONObject: values, options: .prettyPrinted) |
| 400 | 416 | request.httpBody = data |
| 401 | 417 | showLoading(message: "") |
| 418 | + let custom_param = NSMutableDictionary() | |
| 419 | + custom_param.setValue(APPId, forKey: "appId") | |
| 420 | + custom_param.setValue(APPKey, forKey: "appKey") | |
| 421 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 402 | 422 | CNLiveNetworking.setAllowRequestDefaultArgument(false) |
| 403 | 423 | CNLiveNetworking.setupShowDataResult(false) |
| 404 | 424 | CNLiveNetworking.setBuildCustomUrlRequest(request as URLRequest) { task, result, error in |
| ... | ... | @@ -436,6 +456,10 @@ class CNLiveMineViewModel: NSObject { |
| 436 | 456 | let param = NSMutableDictionary() |
| 437 | 457 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 438 | 458 | param.setValue(identityId, forKey: "identityId") |
| 459 | + let custom_param = NSMutableDictionary() | |
| 460 | + custom_param.setValue(APPId, forKey: "appId") | |
| 461 | + custom_param.setValue(APPKey, forKey: "appKey") | |
| 462 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 439 | 463 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 440 | 464 | CNLiveNetworking.setupShowDataResult(false) |
| 441 | 465 | CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/getIdentity", param: param as! [String: String], cacheType: .networkOnly) { task, result, error in |
| ... | ... | @@ -484,6 +508,10 @@ class CNLiveMineViewModel: NSObject { |
| 484 | 508 | static func requestSystemNews(resultBlock: @escaping resultNewsBlock) { |
| 485 | 509 | let param = NSMutableDictionary() |
| 486 | 510 | param.setValue("2", forKey: "appType") |
| 511 | + let custom_param = NSMutableDictionary() | |
| 512 | + custom_param.setValue(APPId, forKey: "appId") | |
| 513 | + custom_param.setValue(APPKey, forKey: "appKey") | |
| 514 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 487 | 515 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 488 | 516 | CNLiveNetworking.setupShowDataResult(false) |
| 489 | 517 | CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/commonApi/getVersion", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in |
| ... | ... | @@ -527,6 +555,10 @@ class CNLiveMineViewModel: NSObject { |
| 527 | 555 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 528 | 556 | param.setValue("\(page)", forKey: "page") |
| 529 | 557 | param.setValue("10", forKey: "pageSize") |
| 558 | + let custom_param = NSMutableDictionary() | |
| 559 | + custom_param.setValue(APPId, forKey: "appId") | |
| 560 | + custom_param.setValue(APPKey, forKey: "appKey") | |
| 561 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 530 | 562 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 531 | 563 | CNLiveNetworking.setupShowDataResult(false) |
| 532 | 564 | CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/list", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | ... | ... |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderDetailViewController.swift
| ... | ... | @@ -195,9 +195,9 @@ extension CNLiveShopOrderDetailViewController { |
| 195 | 195 | /// - Parameter detailModel: 数据源 |
| 196 | 196 | private func pushExpressVC(detailModel: ShopOrderDetailModel) { |
| 197 | 197 | if detailModel.send_num > 1 || detailModel.is_send == "0" { |
| 198 | - self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: detailModel.orderid! as NSString), animated: true) | |
| 198 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: detailModel.id! as NSString), animated: true) | |
| 199 | 199 | } else { |
| 200 | - | |
| 200 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(), animated: true) | |
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | ... | ... |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderExpressDetailViewController.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopOrderExpressDetailViewController.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by open on 2023/11/9. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import EmptyDataSet_Swift | |
| 10 | +enum CNLiveShopOrderExpressDetailShowType { | |
| 11 | + case orderExpress //订单详情快递 | |
| 12 | + case byYourself //自提 | |
| 13 | + case refundExpress //退款详情快递 | |
| 14 | +} | |
| 15 | +class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate { | |
| 16 | + | |
| 17 | + | |
| 18 | + lazy var tableView : UITableView = { | |
| 19 | + let tableView = UITableView(frame: .zero, style: .plain) | |
| 20 | + tableView.dataSource = self | |
| 21 | + tableView.delegate = self | |
| 22 | + tableView.emptyDataSetSource = self | |
| 23 | + tableView.emptyDataSetDelegate = self | |
| 24 | + tableView.backgroundColor = HexColor("#f1f2f6") | |
| 25 | + tableView.tableFooterView = UIView.init() | |
| 26 | + tableView.separatorStyle = .none | |
| 27 | + tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCellIdentifier") | |
| 28 | + return tableView | |
| 29 | + }() | |
| 30 | + | |
| 31 | + lazy var dataArray: NSMutableArray = { | |
| 32 | + let dataArray = NSMutableArray.init() | |
| 33 | + return dataArray | |
| 34 | + }() | |
| 35 | + | |
| 36 | + var network_type: CNLiveMineResponseType! | |
| 37 | + override func viewDidLoad() { | |
| 38 | + super.viewDidLoad() | |
| 39 | + navigationBarHidden = false | |
| 40 | + titleName = "物流详情" | |
| 41 | + | |
| 42 | + loadDataSourceAction() | |
| 43 | + | |
| 44 | + view.addSubview(tableView) | |
| 45 | + tableView.snp.makeConstraints { make in | |
| 46 | + make.top.equalTo(KNavigationHeight) | |
| 47 | + make.left.right.equalToSuperview() | |
| 48 | + make.bottom.equalToSuperview().offset(get_system_tabbar_height() - get_system_tabbar_ui_height()) | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + func loadDataSourceAction() { | |
| 53 | + | |
| 54 | + } | |
| 55 | +} | |
| 56 | + | |
| 57 | +extension CNLiveShopOrderExpressDetailViewController { | |
| 58 | + func numberOfSections(in tableView: UITableView) -> Int { | |
| 59 | + return 1 | |
| 60 | + } | |
| 61 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
| 62 | + return self.dataArray.count | |
| 63 | + } | |
| 64 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
| 65 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCellIdentifier") else { | |
| 66 | + return UITableViewCell() | |
| 67 | + } | |
| 68 | + return cell | |
| 69 | + } | |
| 70 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | |
| 71 | + return adapt_length(length: 0.01) | |
| 72 | + } | |
| 73 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | |
| 74 | + } | |
| 75 | +} | |
| 76 | + | |
| 77 | +extension CNLiveShopOrderExpressDetailViewController { | |
| 78 | + | |
| 79 | + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { | |
| 80 | + if network_type == .failed || network_type == .unkonw { | |
| 81 | + return UIImage(named: "mine_list_source_unusual_failed") | |
| 82 | + } | |
| 83 | + if dataArray.count == 0 { | |
| 84 | + return UIImage(named: "mine_list_source_unusual_empty") | |
| 85 | + } | |
| 86 | + if network_type == .noNetwork { | |
| 87 | + return UIImage(named: "mine_list_source_unusual_noNet") | |
| 88 | + } | |
| 89 | + return UIImage(named: "mine_list_source_unusual_empty") | |
| 90 | + } | |
| 91 | + | |
| 92 | + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? { | |
| 93 | + var defult_string = "" | |
| 94 | + if network_type == .failed || network_type == .unkonw { | |
| 95 | + defult_string = "接口请求错误,刷新试试~" | |
| 96 | + } | |
| 97 | + if network_type == .noNetwork { | |
| 98 | + defult_string = "网络开小差了,刷新试试~" | |
| 99 | + } | |
| 100 | + if dataArray.count == 0 { | |
| 101 | + defult_string = "暂时没有数据~" | |
| 102 | + } | |
| 103 | + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!]) | |
| 104 | + } | |
| 105 | + | |
| 106 | + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? { | |
| 107 | + if network_type == .failed || network_type == .noNetwork { | |
| 108 | + let attributes = [NSAttributedString.Key.font:Font_16_Fit, | |
| 109 | + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")] | |
| 110 | + return NSAttributedString(string: "刷一刷", attributes: attributes as [NSAttributedString.Key : Any]) | |
| 111 | + } | |
| 112 | + return nil | |
| 113 | + } | |
| 114 | + | |
| 115 | + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) { | |
| 116 | + if network_type == .failed || network_type == .noNetwork { | |
| 117 | + loadDataSourceAction() | |
| 118 | + } | |
| 119 | + } | |
| 120 | +} | |
| 121 | + | ... | ... |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderExpressListViewController.swift
| ... | ... | @@ -80,13 +80,16 @@ extension CNLiveShopOrderExpressListViewController { |
| 80 | 80 | return self.dataArray.count |
| 81 | 81 | } |
| 82 | 82 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| 83 | - guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderExpressListTableViewCellIdentifier) as? ShopBodyOrderExpressFirmTableViewCell else { | |
| 84 | - return ShopBodyOrderExpressFirmTableViewCell() | |
| 83 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderExpressListTableViewCellIdentifier) as? ShopBodyOrderExpressListTableViewCell else { | |
| 84 | + return ShopBodyOrderExpressListTableViewCell() | |
| 85 | 85 | } |
| 86 | + cell.setupDataSource(listModel: dataArray[indexPath.row] as! ShopOrderExpressListModel) | |
| 86 | 87 | return cell |
| 87 | 88 | } |
| 88 | 89 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { |
| 89 | - return adapt_length(length: 0.01)//130) | |
| 90 | + let listModel = dataArray[indexPath.row] as! ShopOrderExpressListModel | |
| 91 | + let height = listModel.expressNew.AcceptStation?.calculateHeightWith(width: KSreenWidth - adapt_length(length: 30), font: regular_adapt_font(pointSize: 12)) | |
| 92 | + return CGFloat(adapt_length(length: 213) + (listModel.expressNew.AcceptStation!.isNotBlank() ? height! : 0)) | |
| 90 | 93 | } |
| 91 | 94 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| 92 | 95 | ... | ... |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderListViewController.swift
| ... | ... | @@ -71,7 +71,6 @@ class CNLiveShopOrderListViewController: CNLiveBaseViewController, UITableViewDe |
| 71 | 71 | make.top.equalToSuperview() |
| 72 | 72 | make.bottom.left.right.equalToSuperview() |
| 73 | 73 | } |
| 74 | - addRefreshView() | |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | 76 | func loadDataSourceAction(page: NSInteger) { |
| ... | ... | @@ -91,6 +90,9 @@ class CNLiveShopOrderListViewController: CNLiveBaseViewController, UITableViewDe |
| 91 | 90 | if self!.pageNum == 1 { |
| 92 | 91 | self!.dataArray.removeAllObjects() |
| 93 | 92 | self!.dataArray.addObjects(from: result as! [ShopOrderListModel]) |
| 93 | + if self!.dataArray.count > 0 { | |
| 94 | + self!.addRefreshView() | |
| 95 | + } | |
| 94 | 96 | } |
| 95 | 97 | if self!.pageNum > 1 { |
| 96 | 98 | self!.dataArray.addObjects(from: result as! [ShopOrderListModel]) |
| ... | ... | @@ -278,10 +280,10 @@ extension CNLiveShopOrderListViewController { |
| 278 | 280 | /// - Parameter detailModel: 数据源 |
| 279 | 281 | private func pushExpressVC(listModel: ShopOrderListModel) { |
| 280 | 282 | if listModel.send_num > 1 || listModel.is_send == "0" { |
| 281 | -// self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: listModel.id! as NSString), animated: true) | |
| 282 | - self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: "1000073435"), animated: true) | |
| 283 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: listModel.id! as NSString), animated: true) | |
| 284 | +// self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: "1000073435"), animated: true) | |
| 283 | 285 | } else { |
| 284 | - | |
| 286 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(), animated: true) | |
| 285 | 287 | } |
| 286 | 288 | } |
| 287 | 289 | ... | ... |
metaCode/Classes/Main/ShopPage/Model/CNLiveShopBaseModel.swift
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyExpressView.swift
| ... | ... | @@ -6,12 +6,15 @@ |
| 6 | 6 | // |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | +import EmptyDataSet_Swift | |
| 9 | 10 | |
| 10 | 11 | class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDataSource, UICollectionViewDelegate{ |
| 11 | 12 | |
| 12 | 13 | lazy var logoImageView: UIImageView = { |
| 13 | 14 | let logoImageView = UIImageView.init() |
| 14 | 15 | logoImageView.backgroundColor = .white |
| 16 | + logoImageView.layer.cornerRadius = 4 | |
| 17 | + logoImageView.layer.masksToBounds = true | |
| 15 | 18 | return logoImageView |
| 16 | 19 | }() |
| 17 | 20 | |
| ... | ... | @@ -69,6 +72,8 @@ class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDa |
| 69 | 72 | collectionView.delegate = self |
| 70 | 73 | collectionView.backgroundColor = .white |
| 71 | 74 | collectionView.register(ShopBodyOrderExpressListCollectionViewCell.self, forCellWithReuseIdentifier: kShopBodyOrderExpressListCollectionViewCellIdentifier) |
| 75 | + let tap = UITapGestureRecognizer.init(target: self, action: #selector(pushExpressDetail)) | |
| 76 | + collectionView.addGestureRecognizer(tap) | |
| 72 | 77 | return collectionView |
| 73 | 78 | }() |
| 74 | 79 | |
| ... | ... | @@ -132,11 +137,39 @@ class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDa |
| 132 | 137 | } |
| 133 | 138 | } |
| 134 | 139 | |
| 140 | + required init?(coder: NSCoder) { | |
| 141 | + fatalError("init(coder:) has not been implemented") | |
| 142 | + } | |
| 143 | + | |
| 135 | 144 | |
| 136 | 145 | var _listModel: ShopOrderExpressListModel! |
| 137 | 146 | func setupDataSource(listModel: ShopOrderExpressListModel) { |
| 138 | 147 | _listModel = listModel |
| 139 | 148 | |
| 149 | + logoImageView.kf.setImage(with: URL(string: listModel.simg!)) | |
| 150 | + expressName.text = listModel.express | |
| 151 | + expressName.sizeToFit() | |
| 152 | + expressNo.text = "快递编号:\(listModel.express_num ?? "0")" | |
| 153 | + totleExpress.text = "共\(listModel.detail_goods.count)件商品" | |
| 154 | + totleExpress.sizeToFit() | |
| 155 | + | |
| 156 | + expressTime.text = listModel.expressNew.AcceptTime | |
| 157 | + expressTime.sizeToFit() | |
| 158 | + | |
| 159 | + var address : String = "" | |
| 160 | + if listModel.expressNew.AcceptStation!.isNotBlank() { | |
| 161 | + address = listModel.expressNew.AcceptStation! | |
| 162 | + } else { | |
| 163 | + address = "包裹正在等待揽收" | |
| 164 | + } | |
| 165 | + expressAddress.text = address | |
| 166 | + expressAddress.sizeToFit() | |
| 167 | + collectionView.reloadData() | |
| 168 | + setNeedsLayout() | |
| 169 | + } | |
| 170 | + | |
| 171 | + @objc func pushExpressDetail() { | |
| 172 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(), animated: true) | |
| 140 | 173 | } |
| 141 | 174 | |
| 142 | 175 | @objc func actionClick(sender: UIButton) { |
| ... | ... | @@ -156,17 +189,19 @@ class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDa |
| 156 | 189 | return _listModel.detail_goods.count |
| 157 | 190 | } |
| 158 | 191 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { |
| 159 | - return UICollectionViewCell.init() | |
| 192 | + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kShopBodyOrderExpressListCollectionViewCellIdentifier, for: indexPath) as? ShopBodyOrderExpressListCollectionViewCell else { | |
| 193 | + return ShopBodyOrderExpressListCollectionViewCell() | |
| 194 | + } | |
| 195 | + let goodsModel = _listModel.detail_goods[indexPath.row] | |
| 196 | + cell.goodsImage.kf.setImage(with: URL(string: goodsModel.simg!)) | |
| 197 | + cell.expressNum.text = "\(goodsModel.num ?? 0)件" | |
| 198 | + return cell | |
| 160 | 199 | } |
| 161 | 200 | |
| 162 | 201 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| 163 | 202 | |
| 164 | 203 | } |
| 165 | 204 | |
| 166 | - required init?(coder: NSCoder) { | |
| 167 | - fatalError("init(coder:) has not been implemented") | |
| 168 | - } | |
| 169 | - | |
| 170 | 205 | } |
| 171 | 206 | |
| 172 | 207 | class ShopBodyOrderExpressListCollectionViewCell: UICollectionViewCell { |
| ... | ... | @@ -175,6 +210,7 @@ class ShopBodyOrderExpressListCollectionViewCell: UICollectionViewCell { |
| 175 | 210 | let goodsImage = UIImageView.init() |
| 176 | 211 | goodsImage.contentMode = .scaleAspectFill |
| 177 | 212 | goodsImage.layer.cornerRadius = 6 |
| 213 | + goodsImage.layer.masksToBounds = true | |
| 178 | 214 | return goodsImage |
| 179 | 215 | }() |
| 180 | 216 | |
| ... | ... | @@ -183,7 +219,9 @@ class ShopBodyOrderExpressListCollectionViewCell: UICollectionViewCell { |
| 183 | 219 | expressNum.font = regular_adapt_font(pointSize: 9) |
| 184 | 220 | expressNum.textColor = HexColor("#ffffff") |
| 185 | 221 | expressNum.backgroundColor = HexColor("#000000") |
| 186 | - expressNum.textAlignment | |
| 222 | + expressNum.textAlignment = .center | |
| 223 | + expressNum.alpha = 0.5 | |
| 224 | + expressNum.layer.cornerRadius = 6 | |
| 187 | 225 | return expressNum |
| 188 | 226 | }() |
| 189 | 227 | |
| ... | ... | @@ -191,6 +229,15 @@ class ShopBodyOrderExpressListCollectionViewCell: UICollectionViewCell { |
| 191 | 229 | super.init(frame: frame) |
| 192 | 230 | contentView.backgroundColor = .white |
| 193 | 231 | |
| 232 | + contentView.addSubview(goodsImage) | |
| 233 | + goodsImage.snp.makeConstraints { make in | |
| 234 | + make.edges.equalToSuperview() | |
| 235 | + } | |
| 236 | + contentView.addSubview(expressNum) | |
| 237 | + expressNum.snp.makeConstraints { make in | |
| 238 | + make.left.bottom.right.equalToSuperview() | |
| 239 | + make.height.equalTo(adapt_length(length: 15)) | |
| 240 | + } | |
| 194 | 241 | } |
| 195 | 242 | |
| 196 | 243 | required init?(coder: NSCoder) { | ... | ... |
metaCode/Classes/Main/ShopPage/ViewModel/CNLiveShopViewModel.swift
| ... | ... | @@ -8,6 +8,12 @@ |
| 8 | 8 | import Foundation |
| 9 | 9 | import CNLiveRequestBastKit |
| 10 | 10 | |
| 11 | +enum CNLiveShopOrderExpressDetailNetworkType { | |
| 12 | + case express // 订单详情查快递 | |
| 13 | + case step // 订单详情查进度 | |
| 14 | + case refundId// 查询快递(退款详情) | |
| 15 | +} | |
| 16 | + | |
| 11 | 17 | typealias resultShopBlock = (_ result: Any,_ respStatue :CNLiveMineResponseType) -> Void |
| 12 | 18 | class CNLiveShopViewModel: NSObject { |
| 13 | 19 | |
| ... | ... | @@ -519,4 +525,52 @@ class CNLiveShopViewModel: NSObject { |
| 519 | 525 | } |
| 520 | 526 | } |
| 521 | 527 | |
| 528 | + /// 订单详情查快递 | |
| 529 | + /// - Parameters: | |
| 530 | + /// - orderId: 订单id | |
| 531 | + /// - expId: 物流id | |
| 532 | + /// - resultBlock: 返回 | |
| 533 | + static func requestExpressDetail(orderId: NSString, expId: NSString, resultBlock: @escaping resultShopBlock) { | |
| 534 | + let param = NSMutableDictionary() | |
| 535 | + param.setValue(orderId, forKey: "id") | |
| 536 | + param.setValue(expId, forKey: "exp_id") | |
| 537 | + let custom_param = NSMutableDictionary() | |
| 538 | + custom_param.setValue(APPId_wjj, forKey: "appId") | |
| 539 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | |
| 540 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 541 | + CNLiveNetworking.setupShowDataResult(false) | |
| 542 | + CNLiveNetworking.setupDSRequest(true) | |
| 543 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 544 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/express", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 545 | + hiddenLoading() | |
| 546 | + if (error == nil) { | |
| 547 | + let resp = result as! NSDictionary | |
| 548 | + let errorCode = "\(resp["code"] ?? "0")" | |
| 549 | + if (errorCode == "200") { | |
| 550 | + if resp["data"] is NSNull { | |
| 551 | + resultBlock(NSNull(),.failed) | |
| 552 | + } else { | |
| 553 | + let array = resp["data"] as! NSArray | |
| 554 | + let tempArray = NSMutableArray() | |
| 555 | + for item in array { | |
| 556 | + let listModel = dictionaryToModel(item as! [String : Any], ShopOrderExpressDetailModel.self,"") as! ShopOrderExpressDetailModel | |
| 557 | + } | |
| 558 | + resultBlock(tempArray, .success) | |
| 559 | + } | |
| 560 | + } else { | |
| 561 | + showMessage(message: resp["message"] as! String) | |
| 562 | + resultBlock(NSNull(),.failed) | |
| 563 | + } | |
| 564 | + } else { | |
| 565 | + if CNLiveNetworking.isNetworking() { | |
| 566 | + showMessage(message: "请求失败") | |
| 567 | + resultBlock(NSNull(),.failed) | |
| 568 | + } else { | |
| 569 | + showMessage(message: "似乎与网络断开链接") | |
| 570 | + resultBlock(NSNull(),.noNetwork) | |
| 571 | + } | |
| 572 | + } | |
| 573 | + } | |
| 574 | + } | |
| 575 | + | |
| 522 | 576 | } | ... | ... |