Commit 96e9b1b736882eaf6f612509af1608552de2a68d

Authored by liushiyu
1 parent bd330553

添加更新弹框,对接界面数据,添加空白视图

Showing 35 changed files with 1074 additions and 152 deletions
metaCode.xcodeproj/project.pbxproj
@@ -9,6 +9,9 @@ @@ -9,6 +9,9 @@
9 /* Begin PBXBuildFile section */ 9 /* Begin PBXBuildFile section */
10 0D39E93D7229931C86EB1161 /* Pods_metaCode_metaCodeUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */; }; 10 0D39E93D7229931C86EB1161 /* Pods_metaCode_metaCodeUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */; };
11 1DD2808DF02C120276F99F4D /* Pods_metaCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1C55A719CFEE073C06D37CE /* Pods_metaCode.framework */; }; 11 1DD2808DF02C120276F99F4D /* Pods_metaCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1C55A719CFEE073C06D37CE /* Pods_metaCode.framework */; };
  12 + 790B1FB42A4153E90074CF00 /* CNLiveMineBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790B1FB32A4153E90074CF00 /* CNLiveMineBaseModel.swift */; };
  13 + 790B1FB62A41938F0074CF00 /* UIImage+CNLiveColorImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790B1FB52A41938F0074CF00 /* UIImage+CNLiveColorImage.swift */; };
  14 + 790B1FB82A41B6A60074CF00 /* CNLiveMineMessageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790B1FB72A41B6A60074CF00 /* CNLiveMineMessageViewController.swift */; };
12 790D01822A2D88FC00C5978D /* CNLiveConfigMacro.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790D01812A2D88FC00C5978D /* CNLiveConfigMacro.swift */; }; 15 790D01822A2D88FC00C5978D /* CNLiveConfigMacro.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790D01812A2D88FC00C5978D /* CNLiveConfigMacro.swift */; };
13 790D01852A2D89E100C5978D /* UIColor+CNHexColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790D01842A2D89E100C5978D /* UIColor+CNHexColor.swift */; }; 16 790D01852A2D89E100C5978D /* UIColor+CNHexColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790D01842A2D89E100C5978D /* UIColor+CNHexColor.swift */; };
14 790D018B2A2D8B3300C5978D /* CNLiveLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790D018A2A2D8B3300C5978D /* CNLiveLoginViewController.swift */; }; 17 790D018B2A2D8B3300C5978D /* CNLiveLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790D018A2A2D8B3300C5978D /* CNLiveLoginViewController.swift */; };
@@ -100,6 +103,9 @@ @@ -100,6 +103,9 @@
100 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_metaCode_metaCodeUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 103 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_metaCode_metaCodeUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
101 67F8190701D1AB7F7724E8BA /* Pods-metaCodeTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-metaCodeTests.release.xcconfig"; path = "Target Support Files/Pods-metaCodeTests/Pods-metaCodeTests.release.xcconfig"; sourceTree = "<group>"; }; 104 67F8190701D1AB7F7724E8BA /* Pods-metaCodeTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-metaCodeTests.release.xcconfig"; path = "Target Support Files/Pods-metaCodeTests/Pods-metaCodeTests.release.xcconfig"; sourceTree = "<group>"; };
102 721865F548C997EFAE525B6F /* Pods-metaCode-metaCodeUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-metaCode-metaCodeUITests.release.xcconfig"; path = "Target Support Files/Pods-metaCode-metaCodeUITests/Pods-metaCode-metaCodeUITests.release.xcconfig"; sourceTree = "<group>"; }; 105 721865F548C997EFAE525B6F /* Pods-metaCode-metaCodeUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-metaCode-metaCodeUITests.release.xcconfig"; path = "Target Support Files/Pods-metaCode-metaCodeUITests/Pods-metaCode-metaCodeUITests.release.xcconfig"; sourceTree = "<group>"; };
  106 + 790B1FB32A4153E90074CF00 /* CNLiveMineBaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineBaseModel.swift; sourceTree = "<group>"; };
  107 + 790B1FB52A41938F0074CF00 /* UIImage+CNLiveColorImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+CNLiveColorImage.swift"; sourceTree = "<group>"; };
  108 + 790B1FB72A41B6A60074CF00 /* CNLiveMineMessageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineMessageViewController.swift; sourceTree = "<group>"; };
103 790D01812A2D88FC00C5978D /* CNLiveConfigMacro.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveConfigMacro.swift; sourceTree = "<group>"; }; 109 790D01812A2D88FC00C5978D /* CNLiveConfigMacro.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveConfigMacro.swift; sourceTree = "<group>"; };
104 790D01842A2D89E100C5978D /* UIColor+CNHexColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+CNHexColor.swift"; sourceTree = "<group>"; }; 110 790D01842A2D89E100C5978D /* UIColor+CNHexColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+CNHexColor.swift"; sourceTree = "<group>"; };
105 790D018A2A2D8B3300C5978D /* CNLiveLoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveLoginViewController.swift; sourceTree = "<group>"; }; 111 790D018A2A2D8B3300C5978D /* CNLiveLoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveLoginViewController.swift; sourceTree = "<group>"; };
@@ -226,6 +232,7 @@ @@ -226,6 +232,7 @@
226 798A44EF2A305BC200815935 /* UIButton+CNLiveExtension.swift */, 232 798A44EF2A305BC200815935 /* UIButton+CNLiveExtension.swift */,
227 79396EEC2A319F220053E1AF /* NSObject+CNLiveCurrentVC.swift */, 233 79396EEC2A319F220053E1AF /* NSObject+CNLiveCurrentVC.swift */,
228 79BDDCBD2A3C3FC8008560FC /* NSObject+CNLiveJSONTool.swift */, 234 79BDDCBD2A3C3FC8008560FC /* NSObject+CNLiveJSONTool.swift */,
  235 + 790B1FB52A41938F0074CF00 /* UIImage+CNLiveColorImage.swift */,
229 ); 236 );
230 path = Extensions; 237 path = Extensions;
231 sourceTree = "<group>"; 238 sourceTree = "<group>";
@@ -294,6 +301,7 @@ @@ -294,6 +301,7 @@
294 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */, 301 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */,
295 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */, 302 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */,
296 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */, 303 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */,
  304 + 790B1FB72A41B6A60074CF00 /* CNLiveMineMessageViewController.swift */,
297 ); 305 );
298 path = Controller; 306 path = Controller;
299 sourceTree = "<group>"; 307 sourceTree = "<group>";
@@ -423,6 +431,7 @@ @@ -423,6 +431,7 @@
423 isa = PBXGroup; 431 isa = PBXGroup;
424 children = ( 432 children = (
425 7978A8422A396632007C86B8 /* CNLiveMineViewModel.swift */, 433 7978A8422A396632007C86B8 /* CNLiveMineViewModel.swift */,
  434 + 790B1FB32A4153E90074CF00 /* CNLiveMineBaseModel.swift */,
426 ); 435 );
427 path = ViewModel; 436 path = ViewModel;
428 sourceTree = "<group>"; 437 sourceTree = "<group>";
@@ -805,10 +814,12 @@ @@ -805,10 +814,12 @@
805 798A44FB2A30999900815935 /* CNLiveAlertTool.swift in Sources */, 814 798A44FB2A30999900815935 /* CNLiveAlertTool.swift in Sources */,
806 790D01A52A2DF65E00C5978D /* CNLiveLoginPickerView.swift in Sources */, 815 790D01A52A2DF65E00C5978D /* CNLiveLoginPickerView.swift in Sources */,
807 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */, 816 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */,
  817 + 790B1FB82A41B6A60074CF00 /* CNLiveMineMessageViewController.swift in Sources */,
808 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */, 818 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */,
809 790D01822A2D88FC00C5978D /* CNLiveConfigMacro.swift in Sources */, 819 790D01822A2D88FC00C5978D /* CNLiveConfigMacro.swift in Sources */,
810 7CD675482A274167008354C1 /* PGIndexBannerSubiew.m in Sources */, 820 7CD675482A274167008354C1 /* PGIndexBannerSubiew.m in Sources */,
811 790D019F2A2DD66E00C5978D /* CNLiveLoginViewModel.swift in Sources */, 821 790D019F2A2DD66E00C5978D /* CNLiveLoginViewModel.swift in Sources */,
  822 + 790B1FB62A41938F0074CF00 /* UIImage+CNLiveColorImage.swift in Sources */,
812 790D019D2A2DCBD000C5978D /* UIView+CNGradient.swift in Sources */, 823 790D019D2A2DCBD000C5978D /* UIView+CNGradient.swift in Sources */,
813 798A44F72A3077ED00815935 /* CNLiveHotButton.swift in Sources */, 824 798A44F72A3077ED00815935 /* CNLiveHotButton.swift in Sources */,
814 7CD6753D2A2740B0008354C1 /* CNMainView.swift in Sources */, 825 7CD6753D2A2740B0008354C1 /* CNMainView.swift in Sources */,
@@ -843,6 +854,7 @@ @@ -843,6 +854,7 @@
843 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, 854 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */,
844 790D01912A2DAC5E00C5978D /* CNLiveConfigFontMacro.swift in Sources */, 855 790D01912A2DAC5E00C5978D /* CNLiveConfigFontMacro.swift in Sources */,
845 790D01852A2D89E100C5978D /* UIColor+CNHexColor.swift in Sources */, 856 790D01852A2D89E100C5978D /* UIColor+CNHexColor.swift in Sources */,
  857 + 790B1FB42A4153E90074CF00 /* CNLiveMineBaseModel.swift in Sources */,
846 7978A8432A396632007C86B8 /* CNLiveMineViewModel.swift in Sources */, 858 7978A8432A396632007C86B8 /* CNLiveMineViewModel.swift in Sources */,
847 798A44EE2A305AAC00815935 /* CNLiveBaseNavigationController.swift in Sources */, 859 798A44EE2A305AAC00815935 /* CNLiveBaseNavigationController.swift in Sources */,
848 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, 860 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */,
@@ -1048,7 +1060,7 @@ @@ -1048,7 +1060,7 @@
1048 "$(inherited)", 1060 "$(inherited)",
1049 "@executable_path/Frameworks", 1061 "@executable_path/Frameworks",
1050 ); 1062 );
1051 - MARKETING_VERSION = 1.0; 1063 + MARKETING_VERSION = 0.9;
1052 PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.metaCode.debug; 1064 PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.metaCode.debug;
1053 PRODUCT_NAME = "$(TARGET_NAME)"; 1065 PRODUCT_NAME = "$(TARGET_NAME)";
1054 SWIFT_EMIT_LOC_STRINGS = YES; 1066 SWIFT_EMIT_LOC_STRINGS = YES;
@@ -1082,7 +1094,7 @@ @@ -1082,7 +1094,7 @@
1082 "$(inherited)", 1094 "$(inherited)",
1083 "@executable_path/Frameworks", 1095 "@executable_path/Frameworks",
1084 ); 1096 );
1085 - MARKETING_VERSION = 1.0; 1097 + MARKETING_VERSION = 0.9;
1086 PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.metaCode.debug; 1098 PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.metaCode.debug;
1087 PRODUCT_NAME = "$(TARGET_NAME)"; 1099 PRODUCT_NAME = "$(TARGET_NAME)";
1088 SWIFT_EMIT_LOC_STRINGS = YES; 1100 SWIFT_EMIT_LOC_STRINGS = YES;
metaCode/Classes/Common/Base/CNLiveBaseTabBarViewController.swift
@@ -34,6 +34,8 @@ class CNLiveBaseTabBarViewController: UITabBarController @@ -34,6 +34,8 @@ class CNLiveBaseTabBarViewController: UITabBarController
34 34
35 self.setUpTabBar() 35 self.setUpTabBar()
36 self.setupBackgroup() 36 self.setupBackgroup()
  37 +
  38 + selectedIndex = 1
37 39
38 } 40 }
39 41
@@ -43,6 +45,12 @@ class CNLiveBaseTabBarViewController: UITabBarController @@ -43,6 +45,12 @@ class CNLiveBaseTabBarViewController: UITabBarController
43 override func viewDidAppear(_ animated: Bool) { 45 override func viewDidAppear(_ animated: Bool) {
44 super.viewDidAppear(animated) 46 super.viewDidAppear(animated)
45 print("获取用户用户数据=====>\(UserInfoManager.shared.userInfo.uid)") 47 print("获取用户用户数据=====>\(UserInfoManager.shared.userInfo.uid)")
  48 +
  49 + CNLiveMineViewModel.requestSystemNews { result, respStatue in
  50 + if respStatue == .success {
  51 + UpdataAlertView.showUpdataView(updataModel: result as! UpdateInfoModel)
  52 + }
  53 + }
46 } 54 }
47 // MARK: - 控制器的信息 55 // MARK: - 控制器的信息
48 func setUpTabBar() { 56 func setUpTabBar() {
metaCode/Classes/Common/Util/CNLiveCommonQiniuTool.swift
@@ -10,13 +10,12 @@ import Qiniu @@ -10,13 +10,12 @@ import Qiniu
10 import YYCategories 10 import YYCategories
11 import CNLiveRequestBastKit 11 import CNLiveRequestBastKit
12 12
13 -typealias ProgressBlcok = (String,CGFloat)  
14 -typealias SuccessBlock = (String,String) 13 +typealias ProgressBlcok = (_ key: String,_ percent: CGFloat) -> Void
  14 +typealias SuccessBlock = (_ key: String,_ url: String) -> Void
15 class UploadManager: NSObject { 15 class UploadManager: NSObject {
16 16
17 - var successBlock: SuccessBlock?  
18 - var progressBlcok: ProgressBlcok?  
19 - private var _qnUploadManager = QNUploadManager() 17 + var uploadModels = NSMutableArray()
  18 + var qnUploadManager = QNUploadManager()
20 static let shared = UploadManager() 19 static let shared = UploadManager()
21 private override init() { 20 private override init() {
22 super.init() 21 super.init()
@@ -26,48 +25,77 @@ class UploadManager: NSObject { @@ -26,48 +25,77 @@ class UploadManager: NSObject {
26 builder?.recorder = try QNFileRecorder(folder: "元码") 25 builder?.recorder = try QNFileRecorder(folder: "元码")
27 } catch {} 26 } catch {}
28 } 27 }
29 - _qnUploadManager = QNUploadManager(configuration: config) 28 + qnUploadManager = QNUploadManager(configuration: config)
30 } 29 }
31 30
32 31
33 32
34 - static func uploadImage(imageData: NSData, progressBlock: ProgressBlcok, successBlock: SuccessBlock) { 33 + /// 上传图片
  34 + /// - Parameters:
  35 + /// - imageData: 图片数据
  36 + /// - progressBlock: 进度回调
  37 + /// - successBlock: 成功回调
  38 + static func uploadImage(imageData: NSData, progressBlock:@escaping ProgressBlcok, successBlock: @escaping SuccessBlock) {
35 let key = UploadManager.createImageFileName() 39 let key = UploadManager.createImageFileName()
36 - UploadManager.shared.successBlock = successBlock  
37 - UploadManager.shared.progressBlcok = progressBlock  
38 - UploadManager.uploadData(data: imageData, key: key) 40 + UploadManager.uploadData(madiaData: imageData, key: key, progress: progressBlock, success: successBlock)
39 } 41 }
40 42
41 43
42 44
43 - /// 上传图片 45 + /// 上传到七牛
44 /// - Parameters: 46 /// - Parameters:
45 /// - data: 上传数据 47 /// - data: 上传数据
46 /// - key: key 48 /// - key: key
47 /// - uploadProgress: 上传进度 49 /// - uploadProgress: 上传进度
48 /// - resultBlock: 结果 50 /// - resultBlock: 结果
49 - static private func uploadData(data: NSData, key: String) {  
50 - 51 + static private func uploadData(madiaData: NSData, key: String, progress: ProgressBlcok?, success: SuccessBlock?) {
  52 + let param = NSMutableDictionary()
  53 + param.setValue(APPId, forKey: "appId")
  54 + param.setValue("POST", forKey: "verb")
  55 + param.setValue("2", forKey: "storageType")
  56 + param.setValue(kBucketName_QN, forKey: "bucket")
  57 + showLoading(message: "上传处理中...")
51 CNLiveNetworking.setAllowRequestDefaultArgument(true) 58 CNLiveNetworking.setAllowRequestDefaultArgument(true)
52 CNLiveNetworking.setupShowDataResult(false) 59 CNLiveNetworking.setupShowDataResult(false)
53 - CNLiveNetworking.requestNetwork(with: .POST, urlString: "\(CNLiveEnvironmentManager.shared.baseUrl_shop)/Api/Index3/getQiniuToken", param: [:], cacheType: .networkOnly) { task, result, error in 60 + CNLiveNetworking.requestNetwork(with: .POST, urlString: "\(CNLiveEnvironmentManager.shared.img_token_url)/vod_epg/getUploadAuthForApp", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  61 + hiddenLoading()
54 if (error == nil) { 62 if (error == nil) {
55 let resp = result as! NSDictionary 63 let resp = result as! NSDictionary
56 - let errorCode = "\(resp["code"] ?? 0)" 64 + let errorCode = "\(resp["errorCode"] ?? 0)"
57 if (errorCode == "0") { 65 if (errorCode == "0") {
58 let data = resp["data"] as! Dictionary<String, Any> 66 let data = resp["data"] as! Dictionary<String, Any>
59 let token = data["token"] as! String 67 let token = data["token"] as! String
60 if token.isNotBlank() { 68 if token.isNotBlank() {
61 - var uploadModel = QiNiuUploadModel.init() 69 + let uploadModel = QiNiuUploadModel.init()
62 uploadModel.isCancel = false 70 uploadModel.isCancel = false
63 uploadModel.key = key 71 uploadModel.key = key
64 let uploadOption = QNUploadOption.init(mime: nil, progressHandler: { key, percent in 72 let uploadOption = QNUploadOption.init(mime: nil, progressHandler: { key, percent in
65 DispatchQueue.main.async { 73 DispatchQueue.main.async {
66 -// UploadManager.shared.progressBlock 74 + progress!(key!, CGFloat(percent))
67 } 75 }
68 }, params: nil, checkCrc: false) { 76 }, params: nil, checkCrc: false) {
69 return uploadModel.isCancel 77 return uploadModel.isCancel
70 } 78 }
  79 + uploadModel.uploadOption = uploadOption!
  80 + UploadManager.shared.uploadModels.add(uploadModel)
  81 + showLoading(message: "上传中...")
  82 + let url_key = "http://wjjtest.ys2.cnliveimg.com/"+key
  83 + UploadManager.shared.qnUploadManager?.put(madiaData as Data, key: key, token: token, complete: { info, key, resp in
  84 + hiddenLoading()
  85 + //删除上传选项
  86 + UploadManager.shared.uploadModels.remove(uploadModel)
  87 + if info?.statusCode == 200 {
  88 + if success != nil {
  89 + success!(key!, url_key)
  90 + }
  91 + } else {
  92 + if info?.statusCode == -999 {
  93 + showMessage(message: "上传取消")
  94 + } else {
  95 + showLoading(message: "上传失败")
  96 + }
  97 + }
  98 + }, option: uploadOption)
71 } 99 }
72 } else { 100 } else {
73 showMessage(message: resp["message"] as! String) 101 showMessage(message: resp["message"] as! String)
@@ -81,9 +109,7 @@ class UploadManager: NSObject { @@ -81,9 +109,7 @@ class UploadManager: NSObject {
81 /// 设置图片名称 109 /// 设置图片名称
82 /// - Returns: 图片名 110 /// - Returns: 图片名
83 static private func createImageFileName() -> String { 111 static private func createImageFileName() -> String {
84 - let date = NSDate()  
85 - let currentTimeInterval = NSDate(timeIntervalSince1970: 0)  
86 - let imageName = "802/mateCode/img/\(date.string(withFormat: "yyyyMMdd") ?? "0000")/\(arc4random()%10).jpg" 112 + let imageName = "802/mateCode/img/\(NSDate().string(withFormat: "yyyyMMdd") ?? "0000")/\(arc4random()).jpg"
87 return imageName 113 return imageName
88 } 114 }
89 } 115 }
metaCode/Classes/Constant/CNLiveConstant.swift
@@ -19,6 +19,9 @@ let KNavigationHeight:CGFloat = (KStatusBarHeight + 44) @@ -19,6 +19,9 @@ let KNavigationHeight:CGFloat = (KStatusBarHeight + 44)
19 ///tabbar高度 19 ///tabbar高度
20 let KTabBarHeight:CGFloat = (KStatusBarHeight == 44 ? 83 : 49) 20 let KTabBarHeight:CGFloat = (KStatusBarHeight == 44 ? 83 : 49)
21 21
  22 +//MARK: - 常用三方key
  23 +let kBucketName_QN:String = "mam-wjjtest-802"
  24 +
22 //MARK: - 常用背景色 25 //MARK: - 常用背景色
23 ///控制器背景色 26 ///控制器背景色
24 let KVCBackgroupColor = UIColor("#F9F9F9") 27 let KVCBackgroupColor = UIColor("#F9F9F9")
metaCode/Classes/Environment/CNLiveEnvironment.swift
@@ -15,6 +15,8 @@ let APPKey: String = CNLiveEnvironmentManager.shared.appKey @@ -15,6 +15,8 @@ let APPKey: String = CNLiveEnvironmentManager.shared.appKey
15 let APPBaseUrl: String! = CNLiveEnvironmentManager.shared.baseUrl 15 let APPBaseUrl: String! = CNLiveEnvironmentManager.shared.baseUrl
16 ///当前应用的Secret 16 ///当前应用的Secret
17 let APPSecret: String = CNLiveEnvironmentManager.shared.appSecret 17 let APPSecret: String = CNLiveEnvironmentManager.shared.appSecret
  18 +///当前应用的部分请求接口
  19 +let APPBaseMCUrl: String = CNLiveEnvironmentManager.shared.base_mc_url
18 20
19 ///当前APP的环境 21 ///当前APP的环境
20 let APPCurrentEnvironment: CNLiveEnvironment = CNLiveEnvironmentManager.shared.currentEnvironment 22 let APPCurrentEnvironment: CNLiveEnvironment = CNLiveEnvironmentManager.shared.currentEnvironment
@@ -46,7 +48,9 @@ class CNLiveEnvironmentManager: NSObject{ @@ -46,7 +48,9 @@ class CNLiveEnvironmentManager: NSObject{
46 var appKey: String 48 var appKey: String
47 var baseUrl: String 49 var baseUrl: String
48 var appSecret: String 50 var appSecret: String
49 - var baseUrl_shop: String 51 + var base_mc_url: String
  52 + var img_token_url: String
  53 +
50 54
51 ///当前环境 55 ///当前环境
52 var currentEnvironment: CNLiveEnvironment 56 var currentEnvironment: CNLiveEnvironment
@@ -57,7 +61,8 @@ class CNLiveEnvironmentManager: NSObject{ @@ -57,7 +61,8 @@ class CNLiveEnvironmentManager: NSObject{
57 self.appKey = "" 61 self.appKey = ""
58 self.baseUrl = "" 62 self.baseUrl = ""
59 self.appSecret = "" 63 self.appSecret = ""
60 - self.baseUrl_shop = "" 64 + self.base_mc_url = ""
  65 + self.img_token_url = ""
61 self.currentEnvironment = .development 66 self.currentEnvironment = .development
62 } 67 }
63 //重新copy 和 mutableCopy 方法 68 //重新copy 和 mutableCopy 方法
@@ -90,7 +95,8 @@ class CNLiveEnvironmentManager: NSObject{ @@ -90,7 +95,8 @@ class CNLiveEnvironmentManager: NSObject{
90 self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac" 95 self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac"
91 self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9" 96 self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9"
92 self.baseUrl = "https://api.cnlive.com" 97 self.baseUrl = "https://api.cnlive.com"
93 - self.baseUrl_shop = "https://wjjshop.cnlive.com" 98 + self.img_token_url = "https://api.cnlive.com/open/api2"
  99 + self.base_mc_url = "https://metacode.cnlive.com/api"
94 } 100 }
95 //testFlight 环境配置 101 //testFlight 环境配置
96 func testFlightEnvironment(){ 102 func testFlightEnvironment(){
@@ -98,7 +104,8 @@ class CNLiveEnvironmentManager: NSObject{ @@ -98,7 +104,8 @@ class CNLiveEnvironmentManager: NSObject{
98 self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac" 104 self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac"
99 self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9" 105 self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9"
100 self.baseUrl = "https://api.cnlive.com" 106 self.baseUrl = "https://api.cnlive.com"
101 - self.baseUrl_shop = "https://wjjshop.cnlive.com" 107 + self.img_token_url = "https://api.cnlive.com/open/api2"
  108 + self.base_mc_url = "https://metacode.cnlive.com/api"
102 } 109 }
103 //production 生产环境配置 110 //production 生产环境配置
104 func productionEnvironment(){ 111 func productionEnvironment(){
@@ -106,7 +113,8 @@ class CNLiveEnvironmentManager: NSObject{ @@ -106,7 +113,8 @@ class CNLiveEnvironmentManager: NSObject{
106 self.appKey = "064f392f84dfe7bbe9f1eabeda53ea02044213019b0406" 113 self.appKey = "064f392f84dfe7bbe9f1eabeda53ea02044213019b0406"
107 self.appSecret = "68b5cc42fbdb466d56c2e22b00b1494feec8149f9dd32e" 114 self.appSecret = "68b5cc42fbdb466d56c2e22b00b1494feec8149f9dd32e"
108 self.baseUrl = "https://api.cnlive.com" 115 self.baseUrl = "https://api.cnlive.com"
109 - self.baseUrl_shop = "https://managemall.cnlive.com" 116 + self.img_token_url = "https://api.cnlive.com/open/api2"
  117 + self.base_mc_url = "https://metacode.cnlive.com/api"
110 } 118 }
111 119
112 } 120 }
metaCode/Classes/Extensions/NSObject+CNLiveJSONTool.swift
@@ -35,7 +35,7 @@ func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type) -&gt;[Base @@ -35,7 +35,7 @@ func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type) -&gt;[Base
35 let data = jsonArrayStr.data(using: String.Encoding.utf8) 35 let data = jsonArrayStr.data(using: String.Encoding.utf8)
36 let peoplesArray = try! JSONSerialization.jsonObject(with:data!, options: JSONSerialization.ReadingOptions()) as? [AnyObject] 36 let peoplesArray = try! JSONSerialization.jsonObject(with:data!, options: JSONSerialization.ReadingOptions()) as? [AnyObject]
37 for people in peoplesArray! { 37 for people in peoplesArray! {
38 - modelArray.append(dictionaryToModel(people as! [String : Any], modelType)) 38 + modelArray.append(dictionaryToModel(people as! [String : Any], modelType,""))
39 } 39 }
40 return modelArray 40 return modelArray
41 41
@@ -43,14 +43,14 @@ func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type) -&gt;[Base @@ -43,14 +43,14 @@ func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type) -&gt;[Base
43 /** 43 /**
44 * 字典转对象 44 * 字典转对象
45 */ 45 */
46 -func dictionaryToModel(_ dictionStr:[String:Any],_ modelType:HandyJSON.Type) -> BaseModel { 46 +func dictionaryToModel(_ dictionStr:[String:Any],_ modelType:HandyJSON.Type,_ path: String) -> BaseModel {
47 if dictionStr.count == 0 { 47 if dictionStr.count == 0 {
48 #if DEBUG 48 #if DEBUG
49 print("dictionaryToModel:字符串为空") 49 print("dictionaryToModel:字符串为空")
50 #endif 50 #endif
51 return BaseModel() 51 return BaseModel()
52 } 52 }
53 - return modelType.deserialize(from: dictionStr) as! BaseModel 53 + return modelType.deserialize(from: dictionStr, designatedPath: path) as! BaseModel
54 } 54 }
55 55
56 /** 56 /**
metaCode/Classes/Extensions/UIImage+CNLiveColorImage.swift 0 → 100644
  1 +//
  2 +// UIImage+CNLiveColorImage.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/6/20.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +extension UIImage {
  11 + class func imageWithColor(color: UIColor, size: CGSize) -> UIImage {
  12 + let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height)
  13 + UIGraphicsBeginImageContextWithOptions(rect.size, false, 0)
  14 + let context = UIGraphicsGetCurrentContext()
  15 + context?.setFillColor(color.cgColor)
  16 + context?.fill(rect)
  17 + let image = UIGraphicsGetImageFromCurrentImageContext()
  18 + UIGraphicsEndImageContext()
  19 + return image!
  20 + }
  21 +}
metaCode/Classes/Main/LoginPage/Controller/CNLiveLoginViewController.swift
@@ -254,17 +254,17 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { @@ -254,17 +254,17 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate {
254 extension CNLiveLoginViewController { 254 extension CNLiveLoginViewController {
255 255
256 @objc func changeCityNumberMothod(sender : UIButton) { 256 @objc func changeCityNumberMothod(sender : UIButton) {
257 - CNLiveLoginPickerView.showSelectView { [self] text in  
258 - country = text  
259 - areaButton.setTitle("+\(text)", for: .normal)  
260 - areaButton.setTitle("+\(text)", for: .highlighted) 257 + CNLiveLoginPickerView.showSelectView { [weak self] text in
  258 + self!.country = text
  259 + self!.areaButton.setTitle("+\(text)", for: .normal)
  260 + self!.areaButton.setTitle("+\(text)", for: .highlighted)
261 } 261 }
262 } 262 }
263 263
264 @objc func sendVerifiCodeMothod(sender : UIButton) { 264 @objc func sendVerifiCodeMothod(sender : UIButton) {
265 view.endEditing(true) 265 view.endEditing(true)
266 - CNLiveLoginViewModel.requestVerCodeAction(phone: phoneText.text ?? "", code: country) { [self] in  
267 - setupCountdownAction(sender: sender) 266 + CNLiveLoginViewModel.requestVerCodeAction(phone: phoneText.text ?? "", code: country) { [weak self] in
  267 + self!.setupCountdownAction(sender: sender)
268 } 268 }
269 } 269 }
270 270
metaCode/Classes/Main/LoginPage/ViewModel/CNLiveLoginViewModel.swift
@@ -17,6 +17,11 @@ typealias resultLoginBlock = () -&gt; Void @@ -17,6 +17,11 @@ typealias resultLoginBlock = () -&gt; Void
17 17
18 class CNLiveLoginViewModel : NSObject { 18 class CNLiveLoginViewModel : NSObject {
19 19
  20 + /// 获取验证码
  21 + /// - Parameters:
  22 + /// - phone: 手机号
  23 + /// - code: 验证码
  24 + /// - resultBlock: 登陆结果
20 static func requestVerCodeAction(phone: String, code: String, resultBlock: @escaping resultCodeBlock) { 25 static func requestVerCodeAction(phone: String, code: String, resultBlock: @escaping resultCodeBlock) {
21 26
22 if !phone.isNotBlank() { 27 if !phone.isNotBlank() {
@@ -52,6 +57,12 @@ class CNLiveLoginViewModel : NSObject { @@ -52,6 +57,12 @@ class CNLiveLoginViewModel : NSObject {
52 } 57 }
53 } 58 }
54 59
  60 + /// 登陆
  61 + /// - Parameters:
  62 + /// - userName: 手机号
  63 + /// - countryCode: 国家区号
  64 + /// - verCode: 验证码
  65 + /// - resultBlock: 结果回调
55 static func requestLoginAction(userName: String, countryCode: String, verCode: String, resultBlock: @escaping resultLoginBlock) { 66 static func requestLoginAction(userName: String, countryCode: String, verCode: String, resultBlock: @escaping resultLoginBlock) {
56 if !userName.isNotBlank() { 67 if !userName.isNotBlank() {
57 showMessage(message: "请输入手机号") 68 showMessage(message: "请输入手机号")
@@ -91,7 +102,7 @@ class CNLiveLoginViewModel : NSObject { @@ -91,7 +102,7 @@ class CNLiveLoginViewModel : NSObject {
91 if resp.allKeys.contains(where: { item in 102 if resp.allKeys.contains(where: { item in
92 return item as! String == "data" 103 return item as! String == "data"
93 }) { 104 }) {
94 - let userInfoModel = dictionaryToModel(resp["data"] as! [String : Any], UserInfoModel.self) 105 + let userInfoModel = dictionaryToModel(resp as! [String : Any], UserInfoModel.self,"data")
95 UserInfoManager.cacheUserInfo(userInfo: userInfoModel as! UserInfoModel) 106 UserInfoManager.cacheUserInfo(userInfo: userInfoModel as! UserInfoModel)
96 UserDefaults.standard.set(true,forKey: "is_login") 107 UserDefaults.standard.set(true,forKey: "is_login")
97 resultBlock() 108 resultBlock()
@@ -103,22 +114,5 @@ class CNLiveLoginViewModel : NSObject { @@ -103,22 +114,5 @@ class CNLiveLoginViewModel : NSObject {
103 showMessage(message: "登陆失败") 114 showMessage(message: "登陆失败")
104 } 115 }
105 } 116 }
106 -// DispatchQueue.main.asyncAfter(deadline: .now()+0.5, execute: {  
107 -// hiddenLoading()  
108 -// let resp = CNLiveLoginViewModel.dict() as NSDictionary  
109 -// let errorCode = resp["errorCode"]  
110 -// if (errorCode as! String == "0") {  
111 -// if resp.allKeys.contains(where: { item in  
112 -// return item as! String == "data"  
113 -// }) {  
114 -// let userInfoModel = JsonUtil.dictionaryToModel(resp["data"] as! [String : Any], UserInfoModel.self)  
115 -// UserInfoManager.cacheUserInfo(userInfo: userInfoModel as! UserInfoModel)  
116 -// UserDefaults.standard.set(true,forKey: "is_login")  
117 -// resultBlock()  
118 -// }  
119 -// } else {  
120 -// showMessage(message: resp["errorMessage"] as! String)  
121 -// }  
122 -// })  
123 } 117 }
124 } 118 }
metaCode/Classes/Main/MinePage/Controller/CNLiveInputFeedBackViewController.swift
@@ -59,12 +59,14 @@ class CNLiveInputFeedBackViewController: CNLiveBaseViewController, UITextViewDel @@ -59,12 +59,14 @@ class CNLiveInputFeedBackViewController: CNLiveBaseViewController, UITextViewDel
59 }() 59 }()
60 60
61 lazy var photoView: MinePhotoUploadView = { 61 lazy var photoView: MinePhotoUploadView = {
62 - let pView = MinePhotoUploadView.init(frame: .zero) { [self] index in 62 +
  63 + let pView = MinePhotoUploadView.init(frame: .zero, resutBlock: { [weak self] index, imageUrl in
63 let mString = NSMutableAttributedString(string: "上传截图 (选填 \(index)/3)") 64 let mString = NSMutableAttributedString(string: "上传截图 (选填 \(index)/3)")
64 mString.addAttributes([.foregroundColor: UIColor.black,.font: BoldFont_18], range: NSRange(location: 0, length: 4)) 65 mString.addAttributes([.foregroundColor: UIColor.black,.font: BoldFont_18], range: NSRange(location: 0, length: 4))
65 mString.addAttributes([.foregroundColor: HexColor("#B4B4B4")!,.font: Font_14], range: NSRange(location: 4, length: 9)) 66 mString.addAttributes([.foregroundColor: HexColor("#B4B4B4")!,.font: Font_14], range: NSRange(location: 4, length: 9))
66 - photoLabel.attributedText = mString  
67 - } 67 + self!.photoLabel.attributedText = mString
  68 + self!.imageUrlArray.replaceObject(at: Int(index)! - 1, with: imageUrl)
  69 + })
68 pView.backgroundColor = .clear 70 pView.backgroundColor = .clear
69 return pView 71 return pView
70 }() 72 }()
@@ -109,6 +111,8 @@ class CNLiveInputFeedBackViewController: CNLiveBaseViewController, UITextViewDel @@ -109,6 +111,8 @@ class CNLiveInputFeedBackViewController: CNLiveBaseViewController, UITextViewDel
109 return sendButton 111 return sendButton
110 }() 112 }()
111 113
  114 + lazy var imageUrlArray: NSMutableArray = ["","",""]
  115 +
112 required init?(coder aDecoder:NSCoder) { 116 required init?(coder aDecoder:NSCoder) {
113 fatalError("init(coder:) has not been implemented") 117 fatalError("init(coder:) has not been implemented")
114 } 118 }
@@ -208,9 +212,12 @@ class CNLiveInputFeedBackViewController: CNLiveBaseViewController, UITextViewDel @@ -208,9 +212,12 @@ class CNLiveInputFeedBackViewController: CNLiveBaseViewController, UITextViewDel
208 } 212 }
209 213
210 @objc func sendInfoActionMothod() { 214 @objc func sendInfoActionMothod() {
211 - let array = photoView.selectedImages  
212 - array.remove("")  
213 - print("获取的图片:\(array) 内容:\(p_textView.text ?? "") 手机号:\(mobileField.text ?? "")") 215 + CNLiveMineViewModel.requestFeedBack(text: p_textView.text ?? "", contactWay: UserInfoManager.shared.userInfo.mobile, images: imageUrlArray) { result in
  216 + if result {
  217 + showMessage(message: "内容提交成功")
  218 + self.navigationController?.popViewController(animated: true)
  219 + }
  220 + }
214 } 221 }
215 } 222 }
216 223
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAddInfoViewController.swift
@@ -14,6 +14,7 @@ enum CNLiveMineInfoShowType { @@ -14,6 +14,7 @@ enum CNLiveMineInfoShowType {
14 case message//消息中心 14 case message//消息中心
15 } 15 }
16 16
  17 +
17 class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, UITableViewDragDelegate, UITableViewDropDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate{ 18 class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, UITableViewDragDelegate, UITableViewDropDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate{
18 19
19 let kCNLiveMineInfoLListTableViewIdentifier = "kCNLiveMineInfoLListTableViewIdentifier" 20 let kCNLiveMineInfoLListTableViewIdentifier = "kCNLiveMineInfoLListTableViewIdentifier"
@@ -37,7 +38,7 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel @@ -37,7 +38,7 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
37 }() 38 }()
38 39
39 lazy var dataArray: NSMutableArray = { 40 lazy var dataArray: NSMutableArray = {
40 - let dataArray = NSMutableArray() 41 + var dataArray = NSMutableArray()
41 if _show_type == .add { 42 if _show_type == .add {
42 dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者身份"]) 43 dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者身份"])
43 dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份"]) 44 dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份"])
@@ -46,13 +47,14 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel @@ -46,13 +47,14 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
46 dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者身份","number":"证件编号:410800111127954"]) 47 dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者身份","number":"证件编号:410800111127954"])
47 dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份","number":"证件编号:410800111127954"]) 48 dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份","number":"证件编号:410800111127954"])
48 } 49 }
49 - if _show_type == .message {  
50 -// dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者云","number":"志愿者大礼包发放中,快来领取吧!","time":"03-12"])  
51 -// dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者·志愿云","number":"志愿者大礼包快来领取吧~","time":"03-12"])  
52 - }  
53 return dataArray 50 return dataArray
54 }() 51 }()
55 52
  53 + private lazy var listArray: Array<NewsListModel> = {
  54 + let listArray = Array<NewsListModel>()
  55 + return listArray
  56 + }()
  57 +
56 lazy var setButton = { 58 lazy var setButton = {
57 let setButton = UIButton.init(type: .custom) 59 let setButton = UIButton.init(type: .custom)
58 setButton.frame = CGRectMake(KSreenWidth - 35, (get_system_nav_height() - (get_system_statusBar_height() + 20))/2 + get_system_statusBar_height(), 20, 20) 60 setButton.frame = CGRectMake(KSreenWidth - 35, (get_system_nav_height() - (get_system_statusBar_height() + 20))/2 + get_system_statusBar_height(), 20, 20)
@@ -73,6 +75,7 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel @@ -73,6 +75,7 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
73 return copyButton 75 return copyButton
74 }() 76 }()
75 77
  78 + var network_type: CNLiveMineResponseType!
76 var _show_type:CNLiveMineInfoShowType! 79 var _show_type:CNLiveMineInfoShowType!
77 init(show_type:CNLiveMineInfoShowType) { 80 init(show_type:CNLiveMineInfoShowType) {
78 super.init(nibName:nil, bundle:nil) 81 super.init(nibName:nil, bundle:nil)
@@ -93,8 +96,10 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel @@ -93,8 +96,10 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
93 tableView.dragInteractionEnabled = true 96 tableView.dragInteractionEnabled = true
94 case .message: 97 case .message:
95 titleName = "消息中心" 98 titleName = "消息中心"
96 - topNavView.addSubview(setButton)  
97 - topNavView.addSubview(copyButton) 99 + loadData()
  100 +// topNavView.addSubview(setButton)
  101 +// topNavView.addSubview(copyButton)
  102 +
98 case .none: 103 case .none:
99 break 104 break
100 } 105 }
@@ -107,6 +112,21 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel @@ -107,6 +112,21 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
107 } 112 }
108 } 113 }
109 114
  115 + func loadData() {
  116 + CNLiveMineViewModel.requestMessage { [weak self] result, respStatue in
  117 + self!.network_type = respStatue
  118 + if respStatue == .success {
  119 + DispatchQueue.main.asyncAfter(deadline: .now()+2) {
  120 + self!.listArray = (result as! NewsModel).list
  121 + self!.tableView.reloadData()
  122 + }
  123 + }else{
  124 + self!.tableView.reloadEmptyDataSet()
  125 + }
  126 + }
  127 + }
  128 +
  129 +
110 @objc func noteSetAction() { 130 @objc func noteSetAction() {
111 131
112 } 132 }
@@ -117,23 +137,52 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel @@ -117,23 +137,52 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
117 137
118 extension CNLiveMineAddInfoViewController { 138 extension CNLiveMineAddInfoViewController {
119 func image(forEmptyDataSet scrollView: UIScrollView!) -> UIImage! { 139 func image(forEmptyDataSet scrollView: UIScrollView!) -> UIImage! {
120 - return UIImage(named: "mine_list_source_empty") 140 + if network_type == .failed || network_type == .unkonw {
  141 + return UIImage(named: "mine_list_source_unusual_failed")
  142 + }
  143 + if _show_type == .message && listArray.count == 0 {
  144 + return UIImage(named: "mine_list_source_unusual_empty")
  145 + }
  146 + if network_type == .noNetwork {
  147 + return UIImage(named: "mine_list_source_unusual_noNet")
  148 + }
  149 + return UIImage(named: "mine_list_source_unusual_empty")
121 } 150 }
122 151
123 func title(forEmptyDataSet scrollView: UIScrollView!) -> NSAttributedString! { 152 func title(forEmptyDataSet scrollView: UIScrollView!) -> NSAttributedString! {
124 var defult_string = "" 153 var defult_string = ""
  154 + if network_type == .failed || network_type == .unkonw {
  155 + defult_string = "接口请求错误,刷新试试~"
  156 + }
  157 + if network_type == .noNetwork {
  158 + defult_string = "网络开小差了,刷新试试~"
  159 + }
125 switch _show_type { 160 switch _show_type {
126 case .add: 161 case .add:
127 defult_string = "暂时没有可添加的身份~" 162 defult_string = "暂时没有可添加的身份~"
128 case .info: 163 case .info:
129 defult_string = "暂时没有身份信息~" 164 defult_string = "暂时没有身份信息~"
130 case .message: 165 case .message:
131 - defult_string = "暂时没有可读的消息~" 166 + if listArray.count == 0 && network_type == .success{
  167 + defult_string = "暂时没有可读的消息~"
  168 + }
132 case .none: 169 case .none:
133 break 170 break
134 } 171 }
135 return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!]) 172 return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!])
136 } 173 }
  174 + func buttonTitle(forEmptyDataSet scrollView: UIScrollView!, for state: UIControl.State) -> NSAttributedString! {
  175 + if _show_type == .message && (network_type == .failed || network_type == .noNetwork) {
  176 + let attributes = [NSAttributedString.Key.font:Font_16_Fit,
  177 + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")]
  178 + return NSAttributedString(string: "刷新", attributes: attributes as [NSAttributedString.Key : Any])
  179 + }
  180 + return nil
  181 + }
  182 +
  183 + func emptyDataSet(_ scrollView: UIScrollView!, didTap button: UIButton!) {
  184 + loadData()
  185 + }
137 186
138 } 187 }
139 188
@@ -143,6 +192,9 @@ extension CNLiveMineAddInfoViewController { @@ -143,6 +192,9 @@ extension CNLiveMineAddInfoViewController {
143 return 1 192 return 1
144 } 193 }
145 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 194 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  195 + if _show_type == .message {
  196 + return listArray.count
  197 + }
146 return dataArray.count 198 return dataArray.count
147 } 199 }
148 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 200 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
@@ -159,8 +211,8 @@ extension CNLiveMineAddInfoViewController { @@ -159,8 +211,8 @@ extension CNLiveMineAddInfoViewController {
159 guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineStandInfoTableViewIdentifier) as? MineStandInfoTableViewCell else { 211 guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineStandInfoTableViewIdentifier) as? MineStandInfoTableViewCell else {
160 return MineStandInfoTableViewCell() 212 return MineStandInfoTableViewCell()
161 } 213 }
162 - let dict = dataArray[indexPath.row] as! Dictionary<String, Any>  
163 - cell.setupWithDataSource(icon: dict["image"] as! String, name: dict["name"] as! String,number: dict["number"] as! String, time: dict["time"] as! String) 214 + let listModel = listArray[indexPath.row]
  215 + cell.setupWithDataSource(icon: listModel.poster, name: listModel.title,number: listModel.subTitle, time: listModel.createTimeString)
164 cell.userInteractionEnabledWhileDragging = true 216 cell.userInteractionEnabledWhileDragging = true
165 return cell 217 return cell
166 } else { 218 } else {
@@ -173,6 +225,12 @@ extension CNLiveMineAddInfoViewController { @@ -173,6 +225,12 @@ extension CNLiveMineAddInfoViewController {
173 return cell 225 return cell
174 } 226 }
175 } 227 }
  228 + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  229 + if _show_type == .message {
  230 + let listModel = listArray[indexPath.row]
  231 + self.navigationController?.pushViewController(CNLiveMineMessageViewController.init(listModel: listModel), animated: true)
  232 + }
  233 + }
176 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 234 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
177 return 100 235 return 100
178 } 236 }
metaCode/Classes/Main/MinePage/Controller/CNLiveMineInfoViewController.swift
@@ -123,10 +123,12 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl @@ -123,10 +123,12 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl
123 } 123 }
124 124
125 @objc func changeSendAction() { 125 @objc func changeSendAction() {
126 - CNLiveMineViewModel.requestUploadIconAction(_select_image) { [self] in  
127 - //再这里进行图片上传  
128 - self.reslut(_select_image)  
129 - self.navigationController?.popViewController(animated: true) 126 + CNLiveMineViewModel.requestUploadIconAction(_select_image) { [weak self] statue in
  127 + if statue {
  128 + //再这里进行图片上传
  129 + self!.reslut(self!._select_image)
  130 + self!.navigationController?.popViewController(animated: true)
  131 + }
130 } 132 }
131 } 133 }
132 134
@@ -153,17 +155,17 @@ extension CNLiveMineInfoViewController { @@ -153,17 +155,17 @@ extension CNLiveMineInfoViewController {
153 155
154 func pickerController(_ pickerController: PhotoPickerController, 156 func pickerController(_ pickerController: PhotoPickerController,
155 didFinishSelection result: PickerResult) { 157 didFinishSelection result: PickerResult) {
156 - result.getImage { [self] (image, photoAsset, index) in 158 + result.getImage { [weak self] (image, photoAsset, index) in
157 if let image = image { 159 if let image = image {
158 - _select_image = image 160 + self!._select_image = image
159 }else { 161 }else {
160 print("failed") 162 print("failed")
161 } 163 }
162 - } completionHandler: { [self] (images) in  
163 - imageView.image = images.first  
164 - cancelBtn.isHidden = false  
165 - sendBtn.isHidden = false  
166 - changeBtn.isHidden = true 164 + } completionHandler: { [weak self] (images) in
  165 + self!.imageView.image = images.first
  166 + self!.cancelBtn.isHidden = false
  167 + self!.sendBtn.isHidden = false
  168 + self!.changeBtn.isHidden = true
167 } 169 }
168 } 170 }
169 } 171 }
metaCode/Classes/Main/MinePage/Controller/CNLiveMineMessageViewController.swift 0 → 100644
  1 +//
  2 +// CNLiveMineMessageViewController.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/6/20.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +class CNLiveMineMessageViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource {
  11 +
  12 + let kCNLiveMineMessageIdentifier = "kCNLiveMineMessageIdentifier"
  13 + var _listModel : NewsListModel!
  14 + init(listModel: NewsListModel) {
  15 + super.init(nibName: nil, bundle: nil)
  16 + _listModel = listModel
  17 + }
  18 +
  19 + required init?(coder: NSCoder) {
  20 + fatalError("init(coder:) has not been implemented")
  21 + }
  22 +
  23 + lazy var tableView: UITableView = {
  24 + let tableView = UITableView(frame: .zero, style: .plain)
  25 + tableView.backgroundColor = HexColor("#F7F8FA")
  26 + tableView.delegate = self
  27 + tableView.dataSource = self
  28 + tableView.separatorStyle = .none
  29 + tableView.tableFooterView = UIView.init()
  30 + tableView.tableHeaderView = UIView.init()
  31 + tableView.register(MessageDescTableViewCell.self, forCellReuseIdentifier: kCNLiveMineMessageIdentifier)
  32 + return tableView
  33 + }()
  34 +
  35 + override func viewDidLoad() {
  36 + super.viewDidLoad()
  37 + navigationBarHidden = false
  38 + titleName = _listModel.title
  39 +
  40 + view.addSubview(tableView)
  41 + tableView.snp.makeConstraints { make in
  42 + make.top.equalTo(get_system_nav_height())
  43 + make.left.right.bottom.equalToSuperview()
  44 + }
  45 + }
  46 +
  47 +}
  48 +
  49 +extension CNLiveMineMessageViewController {
  50 + func numberOfSections(in tableView: UITableView) -> Int {
  51 + return 1
  52 + }
  53 +
  54 + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  55 + return 1
  56 + }
  57 +
  58 + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  59 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineMessageIdentifier) as? MessageDescTableViewCell else {
  60 + return MessageDescTableViewCell()
  61 + }
  62 + cell.setupWithDataSource(listModel: _listModel)
  63 + return cell
  64 + }
  65 + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  66 + return 100 + _listModel.textHeight
  67 + }
  68 +
  69 +}
metaCode/Classes/Main/MinePage/Controller/CNLiveMineNickViewController.swift
@@ -86,10 +86,12 @@ class CNLiveMineNickViewController: CNLiveBaseViewController, UITextFieldDelegat @@ -86,10 +86,12 @@ class CNLiveMineNickViewController: CNLiveBaseViewController, UITextFieldDelegat
86 86
87 87
88 @objc func clickSaveAction() { 88 @objc func clickSaveAction() {
89 - CNLiveMineViewModel.requestUpdateUserInfoAction(type: .nickName, value: nickField.text ?? "", resultBlock: { [self] in  
90 - let userInfo = UserInfoManager.shared.userInfo  
91 - userInfo.nickName = nickField.text ?? ""  
92 - UserInfoManager.cacheUserInfo(userInfo: userInfo) 89 + CNLiveMineViewModel.requestUpdateUserInfoAction(type: .nickName, value: nickField.text ?? "", resultBlock: { [weak self] result in
  90 + if result {
  91 + let userInfo = UserInfoManager.shared.userInfo
  92 + userInfo.nickName = self!.nickField.text ?? ""
  93 + UserInfoManager.cacheUserInfo(userInfo: userInfo)
  94 + }
93 }) 95 })
94 } 96 }
95 97
metaCode/Classes/Main/MinePage/Controller/CNLiveTypeFeedBackViewController.swift
@@ -287,13 +287,13 @@ extension CNLiveTypeFeedBackViewController { @@ -287,13 +287,13 @@ extension CNLiveTypeFeedBackViewController {
287 self.navigationController?.pushViewController(mineInfoVC, animated: true) 287 self.navigationController?.pushViewController(mineInfoVC, animated: true)
288 } 288 }
289 if indexPath.section == 2 { 289 if indexPath.section == 2 {
290 - MineInfoAlertView.showSelectView(showType: .gender) { [self] text in  
291 - updateWithDataSource() 290 + MineInfoAlertView.showSelectView(showType: .gender) { [weak self] text in
  291 + self!.updateWithDataSource()
292 } 292 }
293 } 293 }
294 if indexPath.section == 3 { 294 if indexPath.section == 3 {
295 - MineInfoAlertView.showSelectView(showType: .birthday) { [self] text in  
296 - updateWithDataSource() 295 + MineInfoAlertView.showSelectView(showType: .birthday) { [weak self] text in
  296 + self!.updateWithDataSource()
297 } 297 }
298 } 298 }
299 } 299 }
metaCode/Classes/Main/MinePage/View/CNLiveMineHeaderView.swift
@@ -139,7 +139,7 @@ class MineAboutHeaderView: UIView { @@ -139,7 +139,7 @@ class MineAboutHeaderView: UIView {
139 } 139 }
140 140
141 141
142 -typealias ClickResultBlock = (_ index: String) ->Void 142 +typealias ClickResultBlock = (_ index: String,_ imageUrl: String) ->Void
143 class MinePhotoUploadView: UIView, PhotoPickerControllerDelegate { 143 class MinePhotoUploadView: UIView, PhotoPickerControllerDelegate {
144 144
145 lazy var imageView01: UIImageView = { 145 lazy var imageView01: UIImageView = {
@@ -252,22 +252,34 @@ extension MinePhotoUploadView { @@ -252,22 +252,34 @@ extension MinePhotoUploadView {
252 252
253 func pickerController(_ pickerController: PhotoPickerController, 253 func pickerController(_ pickerController: PhotoPickerController,
254 didFinishSelection result: PickerResult) { 254 didFinishSelection result: PickerResult) {
255 - result.getImage { [self] (image, photoAsset, index) in 255 + result.getImage { [weak self] (image, photoAsset, index) in
256 if let image = image { 256 if let image = image {
257 - temp_imageView.image = image  
258 - if temp_imageView == imageView01 {  
259 - imageView02.isHidden = false  
260 - selectedImages.replaceObject(at: 0, with: image)  
261 - _resutBlock!("1") 257 + self!.temp_imageView.image = image
  258 + if self!.temp_imageView == self!.imageView01 {
  259 + UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in
  260 + print("获取进度==>\(progress)")
  261 + }, successBlock: { [weak self] key,url in
  262 + self!.imageView02.isHidden = false
  263 + self!.selectedImages.replaceObject(at: 0, with: image)
  264 + self!._resutBlock!("1",url)
  265 + })
262 } 266 }
263 - if temp_imageView == imageView02 {  
264 - imageView03.isHidden = false  
265 - selectedImages.replaceObject(at: 1, with: image)  
266 - _resutBlock!("2") 267 + if self!.temp_imageView == self!.imageView02 {
  268 + UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in
  269 + print("获取进度==>\(progress)")
  270 + }, successBlock: { [weak self] key,url in
  271 + self!.imageView03.isHidden = false
  272 + self!.selectedImages.replaceObject(at: 1, with: image)
  273 + self!._resutBlock!("2",url)
  274 + })
267 } 275 }
268 - if temp_imageView == imageView03 {  
269 - selectedImages.replaceObject(at: 2, with: image)  
270 - _resutBlock!("3") 276 + if self!.temp_imageView == self!.imageView03 {
  277 + UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in
  278 + print("获取进度==>\(progress)")
  279 + }, successBlock: { [weak self] key,url in
  280 + self!.selectedImages.replaceObject(at: 2, with: image)
  281 + self!._resutBlock!("3",url)
  282 + })
271 } 283 }
272 }else { 284 }else {
273 print("failed") 285 print("failed")
metaCode/Classes/Main/MinePage/View/CNLiveMineInfoAlertView.swift
@@ -310,16 +310,18 @@ class MineInfoAlertView: UIView { @@ -310,16 +310,18 @@ class MineInfoAlertView: UIView {
310 if type == .gender { 310 if type == .gender {
311 value = gender ?? "" 311 value = gender ?? ""
312 } 312 }
313 - CNLiveMineViewModel.requestUpdateUserInfoAction(type: type!, value: value) { [self] in  
314 - let userInfo = UserInfoManager.shared.userInfo  
315 - if type == .gender {  
316 - userInfo.gender = (value == "m" ? "男" : "女")  
317 - }  
318 - if type == .birthday {  
319 - userInfo.birthday = value 313 + CNLiveMineViewModel.requestUpdateUserInfoAction(type: type!, value: value) { [weak self] statue in
  314 + if statue {
  315 + let userInfo = UserInfoManager.shared.userInfo
  316 + if self!.type == .gender {
  317 + userInfo.gender = (value == "m" ? "男" : "女")
  318 + }
  319 + if self!.type == .birthday {
  320 + userInfo.birthday = value
  321 + }
  322 + UserInfoManager.cacheUserInfo(userInfo: userInfo)
  323 + self!.result!(value)
320 } 324 }
321 - UserInfoManager.cacheUserInfo(userInfo: userInfo)  
322 - result!(value)  
323 } 325 }
324 } 326 }
325 327
@@ -343,3 +345,184 @@ class MineInfoAlertView: UIView { @@ -343,3 +345,184 @@ class MineInfoAlertView: UIView {
343 gender = "m" 345 gender = "m"
344 } 346 }
345 } 347 }
  348 +
  349 +
  350 +class UpdataAlertView: UIView {
  351 +
  352 + lazy var grayMaskView: UIView = {
  353 + let grayMaskView = UIView()
  354 + grayMaskView.backgroundColor = UIColor.black.withAlphaComponent(0.2)
  355 + return grayMaskView
  356 + }()
  357 +
  358 + lazy var backView: UIView = {
  359 + let backView = UIView()
  360 + backView.backgroundColor = .clear
  361 + backView.layer.cornerRadius = 15
  362 + backView.layer.masksToBounds = true
  363 + return backView
  364 + }()
  365 +
  366 + lazy var contentView : UIView = {
  367 + let contentView = UIView.init()
  368 + contentView.backgroundColor = .white
  369 + contentView.layer.cornerRadius = 15
  370 + contentView.clipsToBounds = true
  371 + return contentView
  372 + }()
  373 +
  374 + lazy var headerView: UIImageView = {
  375 + let headerView = UIImageView.init()
  376 + headerView.backgroundColor = .clear
  377 + headerView.image = UIImage(named: "main_apper_alert_header_updata")
  378 + headerView.contentMode = .scaleToFill
  379 + return headerView
  380 + }()
  381 +
  382 + lazy var versionLabel: UILabel = {
  383 + let versionLabel = UILabel.init()
  384 + versionLabel.backgroundColor = .clear
  385 + versionLabel.textColor = .white
  386 + versionLabel.font = BoldFont_18_Fit
  387 + return versionLabel
  388 + }()
  389 +
  390 + lazy var descLabel: UILabel = {
  391 + let descLabel = UILabel.init()
  392 + descLabel.textColor = HexColor("#333333")
  393 + descLabel.font = Font_15
  394 + descLabel.lineBreakMode = .byWordWrapping
  395 + descLabel.numberOfLines = 0
  396 + return descLabel
  397 + }()
  398 +
  399 + lazy var updataButton: UIButton = {
  400 + let updataButton = UIButton(type: .custom)
  401 + updataButton.setTitle("立即更新", for: .normal)
  402 + updataButton.setTitleColor(.white, for: .normal)
  403 + updataButton.titleLabel?.font = BoldFont_16_Fit
  404 + updataButton.layer.cornerRadius = 20
  405 + updataButton.layer.masksToBounds = true
  406 + updataButton.addTarget(self, action: #selector(sendLoginActionMothod), for: .touchUpInside)
  407 + return updataButton
  408 + }()
  409 +
  410 + lazy var cancelButton: UIButton = {
  411 + let cancelButton = UIButton(type: .custom)
  412 + cancelButton.setTitleColor(HexColor("#999999"), for: .normal)
  413 + cancelButton.setTitle("下次再说", for: .normal)
  414 + cancelButton.titleLabel?.font = Font_13
  415 + cancelButton.backgroundColor = .white
  416 + cancelButton.addTarget(self, action: #selector(setupCloseButtonAction), for: .touchUpInside)
  417 + return cancelButton
  418 + }()
  419 +
  420 + var _updateModel: UpdateInfoModel?
  421 + init(frame: CGRect, updateModel: UpdateInfoModel) {
  422 + super.init(frame: frame)
  423 +
  424 + _updateModel = updateModel
  425 + addSubview(grayMaskView)
  426 + addSubview(backView)
  427 + backView.addSubview(headerView)
  428 + headerView.addSubview(versionLabel)
  429 + backView.addSubview(contentView)
  430 + contentView.addSubview(descLabel)
  431 + contentView.addSubview(updataButton)
  432 + contentView.addSubview(cancelButton)
  433 +
  434 + cancelButton.isHidden = ((_updateModel?.isForce) == nil)
  435 + versionLabel.text = updateModel.version
  436 +
  437 + let paraph = NSMutableParagraphStyle()
  438 + paraph.lineSpacing = 10
  439 + let attributes = [NSAttributedString.Key.font:Font_16_Fit,
  440 + NSAttributedString.Key.paragraphStyle: paraph]
  441 + descLabel.attributedText = NSAttributedString(string: updateModel.upgradePoint, attributes: attributes)
  442 +
  443 +
  444 + setConstraints()
  445 + }
  446 +
  447 + func setConstraints() {
  448 + grayMaskView.snp.makeConstraints { make in
  449 + make.edges.equalToSuperview()
  450 + }
  451 + backView.snp.makeConstraints { make in
  452 + make.center.equalToSuperview()
  453 + make.width.equalTo(KSreenWidth - 60)
  454 + make.height.equalTo((KSreenWidth - 60) * 1.4)
  455 + }
  456 + headerView.snp.makeConstraints { make in
  457 + make.centerX.equalToSuperview()
  458 + make.top.left.right.equalToSuperview()
  459 + make.height.equalTo(200)
  460 + }
  461 + versionLabel.snp.makeConstraints { make in
  462 + make.left.equalToSuperview().offset(23)
  463 + make.bottom.equalToSuperview().offset(-55)
  464 + }
  465 + contentView.snp.makeConstraints { make in
  466 + make.centerX.equalToSuperview()
  467 + make.top.equalTo(headerView.snp.bottom).offset(-15)
  468 + make.left.right.equalToSuperview()
  469 + make.height.equalTo((KSreenWidth - 60) * 1.4 - 185)
  470 + }
  471 + descLabel.snp.makeConstraints { make in
  472 + make.centerX.equalToSuperview()
  473 + make.top.equalToSuperview().offset(45)
  474 + make.left.equalToSuperview().offset(20)
  475 + make.right.equalToSuperview().offset(-20)
  476 + }
  477 + cancelButton.snp.makeConstraints { make in
  478 + make.centerX.equalToSuperview()
  479 + make.bottom.equalToSuperview().offset(-20)
  480 + make.width.equalTo(KSreenWidth - 100)
  481 + make.height.equalTo(20)
  482 + }
  483 + updataButton.snp.makeConstraints { make in
  484 + make.centerX.equalToSuperview()
  485 + if ((_updateModel?.isForce) == nil) {
  486 + make.bottom.equalToSuperview().offset(-30)
  487 + } else {
  488 + make.bottom.equalToSuperview().offset(-50)
  489 + }
  490 + make.left.equalToSuperview().offset(30)
  491 + make.right.equalToSuperview().offset(-30)
  492 + make.height.equalTo(40)
  493 + }
  494 +
  495 + updataButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 1),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5))
  496 + }
  497 +
  498 + required init?(coder: NSCoder) {
  499 + fatalError("init(coder:) has not been implemented")
  500 + }
  501 +
  502 + static public func showUpdataView(updataModel: UpdateInfoModel){
  503 +
  504 + let updateView = UpdataAlertView(frame: .zero, updateModel: updataModel)
  505 +
  506 + let window = UIApplication.shared.windows.last
  507 + window?.addSubview(updateView)
  508 + updateView.snp.makeConstraints { make in
  509 + make.edges.equalToSuperview()
  510 + }
  511 + window?.layoutIfNeeded()
  512 + updateView.alpha = 0
  513 + UIView.animate(withDuration: 0.1) {
  514 + updateView.alpha = 1
  515 + }
  516 + }
  517 +
  518 +
  519 + @objc func sendLoginActionMothod() -> Void {
  520 + print("跳转到appstore")
  521 + showMessage(message: "跳转到AppStore")
  522 + }
  523 +
  524 + @objc func setupCloseButtonAction() -> Void {
  525 + removeFromSuperview()
  526 + }
  527 +
  528 +}
metaCode/Classes/Main/MinePage/View/CNLiveMineSubBodyListView.swift
@@ -146,7 +146,11 @@ class MineStandInfoTableViewCell: UITableViewCell { @@ -146,7 +146,11 @@ class MineStandInfoTableViewCell: UITableViewCell {
146 } 146 }
147 147
148 public func setupWithDataSource(icon: String, name: String,number: String, time: String) { 148 public func setupWithDataSource(icon: String, name: String,number: String, time: String) {
149 - iconView.image = UIImage(named: icon) 149 + if !icon.isEmpty {
  150 + iconView.kf.setImage(with: URL(string: icon), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 40, height: 40)))
  151 + } else {
  152 + iconView.image = UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 40, height: 40))
  153 + }
150 titleLabel.text = name 154 titleLabel.text = name
151 numberLabel.text = number 155 numberLabel.text = number
152 timeLabel.text = time 156 timeLabel.text = time
@@ -259,3 +263,152 @@ class MineFeedBackListCollectViewCell : UICollectionViewCell { @@ -259,3 +263,152 @@ class MineFeedBackListCollectViewCell : UICollectionViewCell {
259 fatalError("init(coder:) has not been implemented") 263 fatalError("init(coder:) has not been implemented")
260 } 264 }
261 } 265 }
  266 +
  267 +
  268 +class MessageDescTableViewCell: UITableViewCell {
  269 +
  270 + lazy var timeLabel: UILabel = {
  271 + let timeLabel = UILabel.init()
  272 + timeLabel.textColor = HexColor("#9F9F9F")
  273 + timeLabel.font = Font_13
  274 + timeLabel.textAlignment = .center
  275 + return timeLabel
  276 + }()
  277 +
  278 + lazy var iconView: UIImageView = {
  279 + let iconView = UIImageView.init()
  280 + iconView.backgroundColor = .white
  281 + iconView.layer.cornerRadius = 20
  282 + iconView.layer.masksToBounds = true
  283 + iconView.contentMode = .scaleToFill
  284 + iconView.image = UIImage.imageWithColor(color: .red, size: CGSizeMake(40, 40))
  285 + return iconView
  286 + }()
  287 +
  288 + lazy var cView: UIView = {
  289 + let cView = UIView.init()
  290 + cView.backgroundColor = .white
  291 + cView.layer.cornerRadius = 10
  292 + cView.layer.masksToBounds = true
  293 + return cView
  294 + }()
  295 +
  296 + lazy var contentLabel: UILabel = {
  297 + let contentLabel = UILabel.init()
  298 + contentLabel.backgroundColor = .white
  299 + contentLabel.textColor = HexColor("#666666")
  300 + contentLabel.lineBreakMode = .byCharWrapping
  301 + contentLabel.numberOfLines = 0
  302 + contentLabel.font = Font_14_Fit
  303 + return contentLabel
  304 + }()
  305 +
  306 + lazy var lineLabel: UILabel = {
  307 + let lineLabel = UILabel.init()
  308 + lineLabel.backgroundColor = HexColor("#EAEAEA")
  309 + return lineLabel
  310 + }()
  311 +
  312 + lazy var textButton: UIButton = {
  313 + let textButton = UIButton.init(type: .custom)
  314 + textButton.setTitle("查看详情", for: .normal)
  315 + textButton.setTitleColor(HexColor("#609BFF"), for: .normal)
  316 + textButton.titleLabel?.font = Font_13
  317 + textButton.addTarget(self, action: #selector(textButtonAction), for: .touchUpInside)
  318 + return textButton
  319 + }()
  320 +
  321 + lazy var textView: UIImageView = {
  322 + let textView = UIImageView.init()
  323 + textView.image = UIImage(named: "mine_header_message_blue_more")
  324 + textView.contentMode = .scaleToFill
  325 + textView.backgroundColor = .white
  326 + return textView
  327 + }()
  328 +
  329 +
  330 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  331 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  332 + self.selectionStyle = .none
  333 + self.backgroundColor = .clear
  334 +
  335 + addSubview(timeLabel)
  336 + addSubview(iconView)
  337 + addSubview(cView)
  338 + cView.addSubview(contentLabel)
  339 + cView.addSubview(lineLabel)
  340 + cView.addSubview(textButton)
  341 + cView.addSubview(textView)
  342 +
  343 + setConstraints()
  344 + }
  345 +
  346 + func setConstraints() {
  347 + timeLabel.snp.makeConstraints { make in
  348 + make.centerX.equalToSuperview()
  349 + make.top.equalToSuperview().offset(10)
  350 + }
  351 + iconView.snp.makeConstraints { make in
  352 + make.top.equalTo(timeLabel.snp.bottom).offset(10)
  353 + make.left.equalToSuperview().offset(10)
  354 + make.size.equalTo(40)
  355 + }
  356 + cView.snp.makeConstraints { make in
  357 + make.top.equalTo(timeLabel.snp.bottom).offset(10)
  358 + make.left.equalTo(iconView.snp.right).offset(10)
  359 + make.right.equalToSuperview().offset(-30)
  360 + make.height.equalTo(0)
  361 + }
  362 + textButton.snp.makeConstraints { make in
  363 + make.bottom.equalToSuperview().offset(-10)
  364 + make.right.equalToSuperview().offset(-20)
  365 + make.height.equalTo(20)
  366 + }
  367 + textView.snp.makeConstraints { make in
  368 + make.centerY.equalTo(textButton)
  369 + make.height.equalTo(10)
  370 + make.right.equalToSuperview().offset(-10)
  371 + make.width.equalTo(5)
  372 + }
  373 + lineLabel.snp.makeConstraints { make in
  374 + make.bottom.equalTo(textButton.snp.top).offset(-10)
  375 + make.left.equalToSuperview().offset(10)
  376 + make.right.equalToSuperview().offset(-10)
  377 + make.height.equalTo(1)
  378 + }
  379 + contentLabel.snp.makeConstraints { make in
  380 + make.left.top.equalToSuperview().offset(10)
  381 + make.right.equalToSuperview().offset(-10)
  382 + make.width.equalTo(KSreenWidth - 110)
  383 + make.height.equalTo(0)
  384 + }
  385 + }
  386 +
  387 + public func setupWithDataSource(listModel: NewsListModel) {
  388 + let paraph = NSMutableParagraphStyle()
  389 + paraph.lineSpacing = 10
  390 + let attributes = [NSAttributedString.Key.font:Font_16_Fit,
  391 + NSAttributedString.Key.paragraphStyle: paraph]
  392 + contentLabel.attributedText = NSAttributedString(string: listModel.content, attributes: attributes)
  393 + timeLabel.text = listModel.timeString
  394 + if listModel.poster.isEmpty {
  395 + iconView.image = UIImage.imageWithColor(color: .red, size: CGSizeMake(40, 40))
  396 + } else {
  397 + iconView.kf.setImage(with: URL(string: listModel.poster), placeholder: UIImage.imageWithColor(color: .red, size: CGSizeMake(40, 40)))
  398 + }
  399 + cView.snp.updateConstraints { make in
  400 + make.height.equalTo(listModel.textHeight + 60)
  401 + }
  402 + contentLabel.snp.updateConstraints { make in
  403 + make.height.equalTo(listModel.textHeight)
  404 + }
  405 + }
  406 +
  407 + required init?(coder: NSCoder) {
  408 + fatalError("init(coder:) has not been implemented")
  409 + }
  410 +
  411 + @objc func textButtonAction() {
  412 +
  413 + }
  414 +}
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift 0 → 100644
  1 +//
  2 +// CNLiveMineBaseModel.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/6/20.
  6 +//
  7 +
  8 +import Foundation
  9 +import HandyJSON
  10 +
  11 +
  12 +class UpdateInfoModel: BaseModel {
  13 +
  14 + required init() {}
  15 +
  16 + var id:String = ""
  17 + var appId:String = ""
  18 + var appType:String = ""
  19 + var version:String = ""
  20 + var versionCode:String = ""
  21 + var isForce:Bool = false//是不是强制更新
  22 + var apkUrl:String = ""
  23 + var upgradePoint:String = ""
  24 + var status:String = ""
  25 + var createTime:String = ""
  26 +}
  27 +
  28 +class NewsModel: BaseModel {
  29 + required init() {}
  30 +
  31 + var prePage: Int = 0
  32 + var pageSize: Int = 0
  33 + var startRow: Int = 0
  34 + var navigateLastPage: Int = 0
  35 + var firstPage: Int = 0
  36 + var nextPage: Int = 0
  37 + var size: Int = 0
  38 + var endRow: Int = 0
  39 + var isLastPage: Bool = false
  40 + var hasNextPage: Bool = false
  41 + var navigateFirstPage: Int = 0
  42 + var lastPage: Int = 0
  43 + var total: Int = 0
  44 + var list = [NewsListModel]()
  45 + var navigatepageNums = [Int]()
  46 + var isFirstPage: Bool = false
  47 + var hasPreviousPage: Bool = false
  48 + var navigatePages: Int = 0
  49 + var pageNum: Int = 0
  50 + var pages: Int = 0
  51 +}
  52 +
  53 +
  54 +class NewsListModel: BaseModel {
  55 + var content: String = ""
  56 + var status: Int = 0
  57 + var id: Int = 0
  58 + var poster: String = ""
  59 + var title: String = ""
  60 + var sid: String = ""
  61 + var createTime: Int = 0
  62 + var createTimeString: String = ""
  63 + var timeString: String = ""
  64 + var subTitle: String = ""
  65 + var read: Bool = false
  66 +
  67 + var textHeight: CGFloat {
  68 + get {
  69 + let paraph = NSMutableParagraphStyle()
  70 + paraph.lineSpacing = 10
  71 + let attributes = [NSAttributedString.Key.font:Font_16_Fit,
  72 + NSAttributedString.Key.paragraphStyle: paraph]
  73 + let h = content.boundingRect(with: CGSize(width: KSreenWidth - 110, height: CGFloat(MAXFLOAT)), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size.height
  74 + return h
  75 + }
  76 + }
  77 +
  78 + override func mapping(mapper: HelpingMapper) {
  79 + mapper <<<
  80 + self.createTime <-- TransformOf(fromJSON: { [weak self] (raw) -> Int in
  81 + if (raw ?? 0)! > 0 {
  82 + let date = NSDate(timeIntervalSince1970: TimeInterval((raw!)/1000))
  83 + let dateFormatter = DateFormatter()
  84 + dateFormatter.locale = Locale.init(identifier: "zh_CN")
  85 + dateFormatter.dateFormat = "MM-dd"
  86 + self?.createTimeString = dateFormatter.string(from: date as Date)
  87 + let dateFormatter_time = DateFormatter()
  88 + dateFormatter_time.locale = Locale.init(identifier: "zh_CN")
  89 + dateFormatter_time.dateFormat = "yyyy年MM月dd日 HH:mm"
  90 + self?.timeString = dateFormatter_time.string(from: date as Date)
  91 + }
  92 + return raw!
  93 + }, toJSON: { (tuple) -> Int? in
  94 + return tuple
  95 + })
  96 +// mapper <<<
  97 +// self.content <-- TransformOf(fromJSON: { result -> String in
  98 +// return result! + "金正恩和老兵有说有笑,欣赏着精彩绝伦的烟花表演,一起憧憬朝鲜走向繁荣富强。金正恩最后面向全体朝鲜老兵进行90度的鞠躬,再次对他们表达深深的尊重和感激。他没有忘记为国家立下汗马功劳的朝鲜老兵,更没有忘记老一辈。"
  99 +// }, toJSON: { result -> String? in
  100 +// return result
  101 +// })
  102 + }
  103 +}
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
@@ -15,16 +15,21 @@ enum CNLiveMineRequestType { @@ -15,16 +15,21 @@ enum CNLiveMineRequestType {
15 case location 15 case location
16 case birthday 16 case birthday
17 } 17 }
18 -// 成功  
19 -typealias resultSuccessBlock = () -> Void  
20 - 18 +enum CNLiveMineResponseType {
  19 + case success
  20 + case failed
  21 + case noNetwork
  22 + case unkonw
  23 +}
  24 +typealias resultBlock = (_ result: Bool) -> Void
  25 +typealias resultNewsBlock = (_ result: Any,_ respStatue :CNLiveMineResponseType) -> Void
21 class CNLiveMineViewModel: NSObject { 26 class CNLiveMineViewModel: NSObject {
22 27
23 /// 提交更新用户单项数据 28 /// 提交更新用户单项数据
24 /// - Parameters: 29 /// - Parameters:
25 /// - type: nickName-昵称,gender-性别,email-邮箱, location-联系方式,birthday-生日yyyy-MM-dd 30 /// - type: nickName-昵称,gender-性别,email-邮箱, location-联系方式,birthday-生日yyyy-MM-dd
26 /// - value: 对应的信息,性别,m:男、f:女、n:未知 31 /// - value: 对应的信息,性别,m:男、f:女、n:未知
27 - static func requestUpdateUserInfoAction(type: CNLiveMineRequestType,value: String, resultBlock: @escaping resultSuccessBlock) { 32 + static func requestUpdateUserInfoAction(type: CNLiveMineRequestType,value: String, resultBlock: @escaping resultBlock) {
28 33
29 let param = NSMutableDictionary.init() 34 let param = NSMutableDictionary.init()
30 if type == .nickName { 35 if type == .nickName {
@@ -60,12 +65,14 @@ class CNLiveMineViewModel: NSObject { @@ -60,12 +65,14 @@ class CNLiveMineViewModel: NSObject {
60 let errorCode = resp["errorCode"] 65 let errorCode = resp["errorCode"]
61 if (errorCode as! String == "0") { 66 if (errorCode as! String == "0") {
62 showMessage(message: "更改成功") 67 showMessage(message: "更改成功")
63 - resultBlock() 68 + resultBlock(true)
64 } else { 69 } else {
65 showMessage(message: resp["errorMessage"] as! String) 70 showMessage(message: resp["errorMessage"] as! String)
  71 + resultBlock(false)
66 } 72 }
67 } else { 73 } else {
68 showMessage(message: "修改信息失败") 74 showMessage(message: "修改信息失败")
  75 + resultBlock(false)
69 } 76 }
70 } 77 }
71 } 78 }
@@ -75,47 +82,53 @@ class CNLiveMineViewModel: NSObject { @@ -75,47 +82,53 @@ class CNLiveMineViewModel: NSObject {
75 /// - Parameters: 82 /// - Parameters:
76 /// - image: 头像 83 /// - image: 头像
77 /// - resultBlock: 返回 84 /// - resultBlock: 返回
78 - static func requestUploadIconAction(_ image: UIImage,resultBlock: @escaping resultSuccessBlock) { 85 + static func requestUploadIconAction(_ image: UIImage,resultBlock: @escaping resultBlock) {
79 86
80 - CNLiveMineViewModel.requestAccessTokenAction() {  
81 - let param = NSMutableDictionary.init()  
82 - param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid")  
83 - param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token")  
84 - param.setValue(UserInfoManager.shared.userInfo.access_token, forKey: "access_token")  
85 - showLoading(message: "修改头像中...")  
86 - CNLiveNetworking.setAllowRequestDefaultArgument(true)  
87 - CNLiveNetworking.setupShowDataResult(false)  
88 - CNLiveNetworking.uploadNetwork(withURLString: "/open/api2/user/updateUserFaceById", param: param as? [AnyHashable : Any]) { formData in  
89 - let imageData = image.jpegData(compressionQuality: 1.0)  
90 - formData?.appendPart(withFileData: imageData! as Data, name: "face", fileName: ".jpg", mimeType: "image/jpg")  
91 - } progressBlock: { progress in  
92 - print("已上传==>\(progress!.fractionCompleted*100)")  
93 - } completionBlock: { task, result, error in  
94 - hiddenLoading()  
95 - if (error == nil) {  
96 - let resp = result as! NSDictionary  
97 - let errorCode = resp["errorCode"]  
98 - if (errorCode as! String == "0") {  
99 - showMessage(message: "头像更改成功")  
100 - let data = resp["data"] as! Dictionary<String, Any>  
101 - let userInfo = UserInfoManager.shared.userInfo  
102 - userInfo.faceUrl = data["faceUrl"] as! String  
103 - userInfo.bigFaceUrl = data["bigFaceUrl"] as! String  
104 - UserInfoManager.cacheUserInfo(userInfo: userInfo)  
105 - resultBlock() 87 + CNLiveMineViewModel.requestAccessTokenAction() { result in
  88 + if result {
  89 + let param = NSMutableDictionary.init()
  90 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid")
  91 + param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token")
  92 + param.setValue(UserInfoManager.shared.userInfo.access_token, forKey: "access_token")
  93 + showLoading(message: "修改头像中...")
  94 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  95 + CNLiveNetworking.setupShowDataResult(false)
  96 + CNLiveNetworking.uploadNetwork(withURLString: "/open/api2/user/updateUserFaceById", param: param as? [AnyHashable : Any]) { formData in
  97 + let imageData = image.jpegData(compressionQuality: 1.0)
  98 + formData?.appendPart(withFileData: imageData! as Data, name: "face", fileName: ".jpg", mimeType: "image/jpg")
  99 + } progressBlock: { progress in
  100 + print("已上传==>\(progress!.fractionCompleted*100)")
  101 + } completionBlock: { task, result, error in
  102 + hiddenLoading()
  103 + if (error == nil) {
  104 + let resp = result as! NSDictionary
  105 + let errorCode = resp["errorCode"]
  106 + if (errorCode as! String == "0") {
  107 + showMessage(message: "头像更改成功")
  108 + let data = resp["data"] as! Dictionary<String, Any>
  109 + let userInfo = UserInfoManager.shared.userInfo
  110 + userInfo.faceUrl = data["faceUrl"] as! String
  111 + userInfo.bigFaceUrl = data["bigFaceUrl"] as! String
  112 + UserInfoManager.cacheUserInfo(userInfo: userInfo)
  113 + resultBlock(true)
  114 + } else {
  115 + showMessage(message: resp["errorMessage"] as! String)
  116 + resultBlock(false)
  117 + }
106 } else { 118 } else {
107 - showMessage(message: resp["errorMessage"] as! String) 119 + showMessage(message: "头像更改成功")
  120 + resultBlock(false)
108 } 121 }
109 - } else {  
110 - showMessage(message: "头像更改成功")  
111 } 122 }
  123 + } else {
  124 + resultBlock(false)
112 } 125 }
113 } 126 }
114 } 127 }
115 128
116 /// 获取access_token 129 /// 获取access_token
117 /// - Parameter resultBlock: 结果返回 130 /// - Parameter resultBlock: 结果返回
118 - static func requestAccessTokenAction(resultBlock: @escaping resultSuccessBlock) { 131 + static func requestAccessTokenAction(resultBlock: @escaping resultBlock) {
119 //当前时间大于最大允许时间则表明当前access_token已经过期需要重新请求 132 //当前时间大于最大允许时间则表明当前access_token已经过期需要重新请求
120 if CNLiveMineViewModel.timeStamp > NSNumber(string: UserInfoManager.shared.userInfo.expires_in)?.intValue ?? 0 { 133 if CNLiveMineViewModel.timeStamp > NSNumber(string: UserInfoManager.shared.userInfo.expires_in)?.intValue ?? 0 {
121 let param = NSMutableDictionary.init() 134 let param = NSMutableDictionary.init()
@@ -136,16 +149,129 @@ class CNLiveMineViewModel: NSObject { @@ -136,16 +149,129 @@ class CNLiveMineViewModel: NSObject {
136 let expires_in = data["expires_in"] as! NSNumber 149 let expires_in = data["expires_in"] as! NSNumber
137 userInfo.expires_in = "\(expires_in.intValue+CNLiveMineViewModel.timeStamp)" 150 userInfo.expires_in = "\(expires_in.intValue+CNLiveMineViewModel.timeStamp)"
138 UserInfoManager.cacheUserInfo(userInfo: userInfo) 151 UserInfoManager.cacheUserInfo(userInfo: userInfo)
139 - resultBlock() 152 + resultBlock(true)
140 } else { 153 } else {
141 showMessage(message: resp["errorMessage"] as! String) 154 showMessage(message: resp["errorMessage"] as! String)
  155 + resultBlock(false)
142 } 156 }
143 } else { 157 } else {
144 showMessage(message: "修改头像失败") 158 showMessage(message: "修改头像失败")
  159 + resultBlock(false)
145 } 160 }
146 } 161 }
147 } else { 162 } else {
148 - resultBlock() 163 + resultBlock(false)
  164 + }
  165 + }
  166 +
  167 + /// 上传反馈意见接口
  168 + /// - Parameter resultBlock: 成功回调
  169 + static func requestFeedBack(text: String,contactWay: String,images: NSMutableArray,resultBlock: @escaping resultBlock) {
  170 + if (text.count == 0) {
  171 + showMessage(message: "反馈内容不能为空")
  172 + return
  173 + }
  174 + images.remove("")
  175 + let imageUrl = NSMutableString()
  176 + if images.count > 0 {
  177 + images.forEach { image_url in
  178 + imageUrl.append(image_url as! String)
  179 + imageUrl.append(",")
  180 + }
  181 + imageUrl.deleteCharacters(in: NSRange(location: imageUrl.length - 1, length: 1))
  182 + }
  183 + let param = NSMutableDictionary()
  184 + param.setValue(imageUrl, forKey: "images")
  185 + param.setValue(text, forKey: "text")
  186 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
  187 + param.setValue(contactWay, forKey: "contactWay")
  188 + param.setValue(UserInfoManager.shared.userInfo.nickName, forKey: "contactName")
  189 + param.setValue("", forKey: "category")
  190 + param.setValue("ios", forKey: "plat")
  191 + param.setValue(Bundle.main.infoDictionary?["CFBundleVersion"] as! String, forKey: "version")
  192 + param.setValue(UIDevice.current.identifierForVendor?.uuidString.replacingOccurrences(of: "-", with: "") ?? "", forKey: "deviceId")
  193 + showLoading(message: "")
  194 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  195 + CNLiveNetworking.setupShowDataResult(false)
  196 + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseMCUrl+"/commonApi/collectFeedback", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  197 + hiddenLoading()
  198 + if (error == nil) {
  199 + let resp = result as! NSDictionary
  200 + let errorCode = "\(resp["errorCode"] ?? "0")"
  201 + if (errorCode == "0") {
  202 + resultBlock(true)
  203 + } else {
  204 + showMessage(message: resp["errorMessage"] as! String)
  205 + resultBlock(false)
  206 + }
  207 + } else {
  208 + showMessage(message: "提交失败")
  209 + resultBlock(false)
  210 + }
  211 + }
  212 + }
  213 +
  214 + /// 获取系统消息
  215 + /// - Parameter resultBlock: 结果返回
  216 + static func requestMessage(resultBlock: @escaping resultNewsBlock) {
  217 + showLoading(message: "")
  218 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  219 + CNLiveNetworking.setupShowDataResult(false)
  220 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/newsApi/getNews", param: ["sid":UserInfoManager.shared.userInfo.uid], cacheType: .networkOnly) { task, result, error in
  221 + hiddenLoading()
  222 + if (error == nil) {
  223 + let resp = result as! NSDictionary
  224 + let errorCode = "\(resp["errorCode"] ?? "0")"
  225 + if (errorCode == "0") {
  226 + let newsModel = dictionaryToModel(resp as! [String : Any], NewsModel.self,"data") as! NewsModel
  227 + resultBlock(newsModel,.success)
  228 + } else {
  229 + showMessage(message: resp["errorMessage"] as! String)
  230 + resultBlock(NSNull(),.failed)
  231 + }
  232 + } else {
  233 + if CNLiveNetworking.isNetworking() {
  234 + showMessage(message: "获取失败")
  235 + resultBlock(NSNull(),.failed)
  236 + } else {
  237 + showMessage(message: "似乎与网络断开链接")
  238 + resultBlock(NSNull(),.noNetwork)
  239 + }
  240 + }
  241 + }
  242 + }
  243 +
  244 + /// 获取最新app版本
  245 + /// - Parameter resultBlock: 结果回调
  246 + static func requestSystemNews(resultBlock: @escaping resultNewsBlock) {
  247 + let param = NSMutableDictionary()
  248 + param.setValue("2", forKey: "appType")
  249 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  250 + CNLiveNetworking.setupShowDataResult(false)
  251 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/commonApi/getVersion", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  252 + if (error == nil) {
  253 + let resp = result as! NSDictionary
  254 + let errorCode = "\(resp["errorCode"] ?? "0")"
  255 + if (errorCode == "0") {
  256 + let userInfoModel = dictionaryToModel(resp as! [String : Any], UpdateInfoModel.self,"data") as! UpdateInfoModel
  257 + let ver1 = "\(userInfoModel.version.split(separator: "_").last ?? "0")"
  258 + let ver2 = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
  259 + print("获取的新版本号=>\(ver1),原来的版本号=>\(ver2)")
  260 + if CNLiveMineViewModel.compare(v1: ver1, v2: ver2) {
  261 + resultBlock(userInfoModel,.success)
  262 + } else {
  263 + print("没有新版本")
  264 + }
  265 + } else {
  266 + resultBlock(NSNull(),.failed)
  267 + }
  268 + } else {
  269 + if CNLiveNetworking.isNetworking() {
  270 + resultBlock(NSNull(),.failed)
  271 + } else {
  272 + resultBlock(NSNull(),.noNetwork)
  273 + }
  274 + }
149 } 275 }
150 } 276 }
151 277
@@ -155,4 +281,51 @@ class CNLiveMineViewModel: NSObject { @@ -155,4 +281,51 @@ class CNLiveMineViewModel: NSObject {
155 let timeStamp = Int(timeInterval) 281 let timeStamp = Int(timeInterval)
156 return timeStamp 282 return timeStamp
157 } 283 }
  284 +
  285 + /// 比较版本大小,返回是否需要更新
  286 + /// - Parameters:
  287 + /// - v1: 版本1-新版本
  288 + /// - v2: 版本2-当前版本
  289 + /// - Returns: true:v1>v2 false: v1<=v2
  290 + static fileprivate func compare(v1: String, v2: String) -> Bool {
  291 +
  292 + if v1.isEmpty && v2.isEmpty || v1.isEmpty {
  293 + return false
  294 + }
  295 +
  296 + if v2.isEmpty {
  297 + return true
  298 + }
  299 +
  300 + let array1 = v1.components(separatedBy: ".")
  301 + let array2 = v2.components(separatedBy: ".")
  302 + let mineCount = array1.count > array2.count ? (array2.count - 1) : (array1.count - 1)
  303 +
  304 + var value1: Int = 0
  305 + var value2: Int = 0
  306 +
  307 + for i in 0...mineCount {
  308 +
  309 + if !(array1[i]).isPurnInt() || !(array2[i]).isPurnInt() {
  310 + return false
  311 + }
  312 + value1 = Int(array1[i])!
  313 + value2 = Int(array2[i])!
  314 +
  315 + //v1版本字段大于v2版本字段
  316 + if value1 > value2 {
  317 + return true
  318 + } else if (value1 < value2) {
  319 + return false
  320 + }
  321 + //v1版本==v2版本字段 继续循环
  322 + }
  323 + if array1.count > array2.count {
  324 + return true
  325 + } else if (array1.count <= array2.count) {
  326 + return false
  327 + }
  328 + return false
  329 + }
  330 +
158 } 331 }
metaCode/Supporting Files/Assets.xcassets/MinePage/mine_header_message_blue_more.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_header_message_blue_more@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_header_message_blue_more@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
metaCode/Supporting Files/Assets.xcassets/MinePage/mine_header_message_blue_more.imageset/mine_header_message_blue_more@2x.png 0 → 100644

358 Bytes

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_header_message_blue_more.imageset/mine_header_message_blue_more@3x.png 0 → 100644

645 Bytes

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_list_source_empty.imageset/Contents.json renamed to metaCode/Supporting Files/Assets.xcassets/MinePage/mine_list_source_unusual_empty.imageset/Contents.json
metaCode/Supporting Files/Assets.xcassets/MinePage/mine_list_source_empty.imageset/mine_list_source_empty@2x.png renamed to metaCode/Supporting Files/Assets.xcassets/MinePage/mine_list_source_unusual_empty.imageset/mine_list_source_empty@2x.png

21.8 KB

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_list_source_empty.imageset/mine_list_source_empty@3x.png renamed to metaCode/Supporting Files/Assets.xcassets/MinePage/mine_list_source_unusual_empty.imageset/mine_list_source_empty@3x.png

48.1 KB

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

21.2 KB

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_list_source_unusual_failed.imageset/mine_list_source_unusual_failed@3x.png 0 → 100644

44.7 KB

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

24 KB

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_list_source_unusual_noNet.imageset/mine_list_source_unusual_noNet@3x.png 0 → 100644

48.8 KB

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

89.2 KB

metaCode/Supporting Files/Assets.xcassets/TabBar/main_apper_alert_header_updata.imageset/main_apper_alert_header_updata@3x.png 0 → 100644

235 KB