Commit eed5749002492d25f4ef0e767ad8f56df077dd26
1 parent
d4bb1991
提交登录修改
Showing
26 changed files
with
527 additions
and
160 deletions
Podfile
| @@ -53,6 +53,7 @@ target 'metaCode' do | @@ -53,6 +53,7 @@ target 'metaCode' do | ||
| 53 | pod 'ZFPlayer/ijkplayer', :git => 'https://gitee.com/mirrors/ZFPlayer.git' | 53 | pod 'ZFPlayer/ijkplayer', :git => 'https://gitee.com/mirrors/ZFPlayer.git' |
| 54 | #分享 | 54 | #分享 |
| 55 | pod 'CNLiveShareToolKit' | 55 | pod 'CNLiveShareToolKit' |
| 56 | +# pod 'CNLiveTencentopenapi', :git => 'https://github.com/CNLiveiOSTeam/CNLiveTencentopenapi.git' | ||
| 56 | # pod 'CNLiveTencentopenapi' | 57 | # pod 'CNLiveTencentopenapi' |
| 57 | # pod 'WechatOpenSDK' | 58 | # pod 'WechatOpenSDK' |
| 58 | #网家家输入组件 | 59 | #网家家输入组件 |
metaCode.xcodeproj/project.pbxproj
| @@ -206,7 +206,6 @@ | @@ -206,7 +206,6 @@ | ||
| 206 | 79A212C22B0B5D0700BFA8E3 /* CNLiveShopBodyCouponManagerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79A212C12B0B5D0700BFA8E3 /* CNLiveShopBodyCouponManagerView.swift */; }; | 206 | 79A212C22B0B5D0700BFA8E3 /* CNLiveShopBodyCouponManagerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79A212C12B0B5D0700BFA8E3 /* CNLiveShopBodyCouponManagerView.swift */; }; |
| 207 | 79A267832AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */; }; | 207 | 79A267832AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */; }; |
| 208 | 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */; }; | 208 | 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */; }; |
| 209 | - 79B6CCD72B58C2630041B445 /* CNLiveShareView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79B6CCD62B58C2630041B445 /* CNLiveShareView.swift */; }; | ||
| 210 | 79BA085D2AB18E8300D01875 /* CNLiveSaveAuthDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */; }; | 209 | 79BA085D2AB18E8300D01875 /* CNLiveSaveAuthDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */; }; |
| 211 | 79BB1C142B05C51900C5720C /* CNLiveShopCouponViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB1C132B05C51900C5720C /* CNLiveShopCouponViewController.swift */; }; | 210 | 79BB1C142B05C51900C5720C /* CNLiveShopCouponViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB1C132B05C51900C5720C /* CNLiveShopCouponViewController.swift */; }; |
| 212 | 79BB1C162B05C62900C5720C /* CNLiveShopBodyCouponView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB1C152B05C62900C5720C /* CNLiveShopBodyCouponView.swift */; }; | 211 | 79BB1C162B05C62900C5720C /* CNLiveShopBodyCouponView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB1C152B05C62900C5720C /* CNLiveShopBodyCouponView.swift */; }; |
| @@ -470,7 +469,6 @@ | @@ -470,7 +469,6 @@ | ||
| 470 | 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyCustomView.swift; sourceTree = "<group>"; }; | 469 | 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyCustomView.swift; sourceTree = "<group>"; }; |
| 471 | 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; }; | 470 | 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; }; |
| 472 | 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveConfigModuleInline.swift"; sourceTree = "<group>"; }; | 471 | 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveConfigModuleInline.swift"; sourceTree = "<group>"; }; |
| 473 | - 79B6CCD62B58C2630041B445 /* CNLiveShareView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShareView.swift; sourceTree = "<group>"; }; | ||
| 474 | 79B6CCD82B58C5B50041B445 /* WechatOpenSDK-XCFramework.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = "WechatOpenSDK-XCFramework.xcframework"; path = "Pods/WechatOpenSDK-XCFramework/WechatOpenSDK-XCFramework.xcframework"; sourceTree = "<group>"; }; | 472 | 79B6CCD82B58C5B50041B445 /* WechatOpenSDK-XCFramework.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = "WechatOpenSDK-XCFramework.xcframework"; path = "Pods/WechatOpenSDK-XCFramework/WechatOpenSDK-XCFramework.xcframework"; sourceTree = "<group>"; }; |
| 475 | 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveAuthDB.swift; sourceTree = "<group>"; }; | 473 | 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveAuthDB.swift; sourceTree = "<group>"; }; |
| 476 | 79BB1C132B05C51900C5720C /* CNLiveShopCouponViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopCouponViewController.swift; sourceTree = "<group>"; }; | 474 | 79BB1C132B05C51900C5720C /* CNLiveShopCouponViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopCouponViewController.swift; sourceTree = "<group>"; }; |
| @@ -1121,14 +1119,6 @@ | @@ -1121,14 +1119,6 @@ | ||
| 1121 | path = View; | 1119 | path = View; |
| 1122 | sourceTree = "<group>"; | 1120 | sourceTree = "<group>"; |
| 1123 | }; | 1121 | }; |
| 1124 | - 794294A82B4D3018008AAFA0 /* Share */ = { | ||
| 1125 | - isa = PBXGroup; | ||
| 1126 | - children = ( | ||
| 1127 | - 79B6CCD62B58C2630041B445 /* CNLiveShareView.swift */, | ||
| 1128 | - ); | ||
| 1129 | - path = Share; | ||
| 1130 | - sourceTree = "<group>"; | ||
| 1131 | - }; | ||
| 1132 | 79579CAA2AAAE905006E5B38 /* Database */ = { | 1122 | 79579CAA2AAAE905006E5B38 /* Database */ = { |
| 1133 | isa = PBXGroup; | 1123 | isa = PBXGroup; |
| 1134 | children = ( | 1124 | children = ( |
| @@ -1207,7 +1197,6 @@ | @@ -1207,7 +1197,6 @@ | ||
| 1207 | 796398912A260C0100D045EB /* Common */ = { | 1197 | 796398912A260C0100D045EB /* Common */ = { |
| 1208 | isa = PBXGroup; | 1198 | isa = PBXGroup; |
| 1209 | children = ( | 1199 | children = ( |
| 1210 | - 794294A82B4D3018008AAFA0 /* Share */, | ||
| 1211 | 792E57D52A3AA28E005834DB /* Util */, | 1200 | 792E57D52A3AA28E005834DB /* Util */, |
| 1212 | 7963989B2A260E6200D045EB /* Base */, | 1201 | 7963989B2A260E6200D045EB /* Base */, |
| 1213 | ); | 1202 | ); |
| @@ -1788,7 +1777,6 @@ | @@ -1788,7 +1777,6 @@ | ||
| 1788 | 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */, | 1777 | 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */, |
| 1789 | 79A212C02B0B5C5400BFA8E3 /* CNLiveShopCouponManagerViewController.swift in Sources */, | 1778 | 79A212C02B0B5C5400BFA8E3 /* CNLiveShopCouponManagerViewController.swift in Sources */, |
| 1790 | 7C2703362A3AFD3A0061EC50 /* CNLiveEnvironment.swift in Sources */, | 1779 | 7C2703362A3AFD3A0061EC50 /* CNLiveEnvironment.swift in Sources */, |
| 1791 | - 79B6CCD72B58C2630041B445 /* CNLiveShareView.swift in Sources */, | ||
| 1792 | 798A44FD2A309EBA00815935 /* CNLiveTypeFeedBackViewController.swift in Sources */, | 1780 | 798A44FD2A309EBA00815935 /* CNLiveTypeFeedBackViewController.swift in Sources */, |
| 1793 | 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */, | 1781 | 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */, |
| 1794 | 19CC4D522ADD129800308E2A /* CNUpSlideAnimationTransition.swift in Sources */, | 1782 | 19CC4D522ADD129800308E2A /* CNUpSlideAnimationTransition.swift in Sources */, |
metaCode/Classes/Common/Share/CNLiveShareView.swift deleted
100644 → 0
metaCode/Classes/Environment/CNLiveEnvironment.swift
| @@ -146,8 +146,8 @@ class CNLiveEnvironmentManager: NSObject{ | @@ -146,8 +146,8 @@ class CNLiveEnvironmentManager: NSObject{ | ||
| 146 | func developmentEnvironment(){ | 146 | func developmentEnvironment(){ |
| 147 | self.appId = "802_li40qhp922" | 147 | self.appId = "802_li40qhp922" |
| 148 | self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac" | 148 | self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac" |
| 149 | - self.appId_wjj = "769_jetj7bq525" | ||
| 150 | - self.appKey_wjj = "0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d" | 149 | + self.appId_wjj = "802_jhlqbq4475" |
| 150 | + self.appKey_wjj = "d25cf0dce30e7d7ddc7c857b85ab0dde670d491fc2ffe4" | ||
| 151 | self.appId_wjj_b = "769_jnjxdh3w53" | 151 | self.appId_wjj_b = "769_jnjxdh3w53" |
| 152 | self.appKey_wjj_b = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCpeLgK0vk5POU5PQ" | 152 | self.appKey_wjj_b = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCpeLgK0vk5POU5PQ" |
| 153 | self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9" | 153 | self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9" |
metaCode/Classes/Main/LoginPage/ViewModel/CNLiveLoginViewModel.swift
| @@ -38,8 +38,8 @@ class CNLiveLoginViewModel : NSObject { | @@ -38,8 +38,8 @@ class CNLiveLoginViewModel : NSObject { | ||
| 38 | showLoading(message: "") | 38 | showLoading(message: "") |
| 39 | let param = ["mobile":phone,"countryCode":code] | 39 | let param = ["mobile":phone,"countryCode":code] |
| 40 | let custom_param = NSMutableDictionary() | 40 | let custom_param = NSMutableDictionary() |
| 41 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 42 | - custom_param.setValue(APPKey, forKey: "appKey") | 41 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 42 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 43 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 43 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 44 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 44 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 45 | CNLiveNetworking.setupShowDataResult(false) | 45 | CNLiveNetworking.setupShowDataResult(false) |
| @@ -95,8 +95,8 @@ class CNLiveLoginViewModel : NSObject { | @@ -95,8 +95,8 @@ class CNLiveLoginViewModel : NSObject { | ||
| 95 | showLoading(message: "") | 95 | showLoading(message: "") |
| 96 | let param = ["userName":userName,"countryCode":countryCode,"verificationCode":verCode,"inviterId":""] | 96 | let param = ["userName":userName,"countryCode":countryCode,"verificationCode":verCode,"inviterId":""] |
| 97 | let custom_param = NSMutableDictionary() | 97 | let custom_param = NSMutableDictionary() |
| 98 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 99 | - custom_param.setValue(APPKey, forKey: "appKey") | 98 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 99 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 100 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 100 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 101 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 101 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 102 | CNLiveNetworking.setupShowDataResult(false) | 102 | CNLiveNetworking.setupShowDataResult(false) |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| @@ -65,8 +65,13 @@ class CNLiveMineViewModel: NSObject { | @@ -65,8 +65,13 @@ class CNLiveMineViewModel: NSObject { | ||
| 65 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid") | 65 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid") |
| 66 | param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token") | 66 | param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token") |
| 67 | showLoading(message: "") | 67 | showLoading(message: "") |
| 68 | + let custom_param = NSMutableDictionary() | ||
| 69 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") | ||
| 70 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 71 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 68 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 72 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 69 | CNLiveNetworking.setupShowDataResult(false) | 73 | CNLiveNetworking.setupShowDataResult(false) |
| 74 | + CNLiveNetworking.setupShowResult(true) | ||
| 70 | CNLiveNetworking.requestNetwork(with: .POST, urlString: APPLoginHost+"/open/api2/user/updateUserById", param: param as! [String : Any], cacheType: .networkOnly) { task, result, error in | 75 | CNLiveNetworking.requestNetwork(with: .POST, urlString: APPLoginHost+"/open/api2/user/updateUserById", param: param as! [String : Any], cacheType: .networkOnly) { task, result, error in |
| 71 | hiddenLoading() | 76 | hiddenLoading() |
| 72 | if (error == nil) { | 77 | if (error == nil) { |
| @@ -100,6 +105,10 @@ class CNLiveMineViewModel: NSObject { | @@ -100,6 +105,10 @@ class CNLiveMineViewModel: NSObject { | ||
| 100 | param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token") | 105 | param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token") |
| 101 | param.setValue(UserInfoManager.shared.userInfo.access_token, forKey: "access_token") | 106 | param.setValue(UserInfoManager.shared.userInfo.access_token, forKey: "access_token") |
| 102 | showLoading(message: "修改头像中...") | 107 | showLoading(message: "修改头像中...") |
| 108 | + let custom_param = NSMutableDictionary() | ||
| 109 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") | ||
| 110 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 111 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 103 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 112 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 104 | CNLiveNetworking.setupShowDataResult(false) | 113 | CNLiveNetworking.setupShowDataResult(false) |
| 105 | CNLiveNetworking.setupShowResult(true) | 114 | CNLiveNetworking.setupShowResult(true) |
| @@ -144,6 +153,10 @@ class CNLiveMineViewModel: NSObject { | @@ -144,6 +153,10 @@ class CNLiveMineViewModel: NSObject { | ||
| 144 | param.setValue(APPId, forKey: "appId") | 153 | param.setValue(APPId, forKey: "appId") |
| 145 | param.setValue(APPSecret, forKey: "secret") | 154 | param.setValue(APPSecret, forKey: "secret") |
| 146 | showLoading(message: "") | 155 | showLoading(message: "") |
| 156 | + let custom_param = NSMutableDictionary() | ||
| 157 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") | ||
| 158 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 159 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 147 | CNLiveNetworking.setAllowRequestDefaultArgument(false) | 160 | CNLiveNetworking.setAllowRequestDefaultArgument(false) |
| 148 | CNLiveNetworking.setupShowDataResult(false) | 161 | CNLiveNetworking.setupShowDataResult(false) |
| 149 | CNLiveNetworking.requestNetwork(with: .POST, urlString: APPLoginHost+"/open/api2/token", param: (param as! [AnyHashable : Any]), cacheType: .networkOnly) { task, result, error in | 162 | CNLiveNetworking.requestNetwork(with: .POST, urlString: APPLoginHost+"/open/api2/token", param: (param as! [AnyHashable : Any]), cacheType: .networkOnly) { task, result, error in |
| @@ -199,8 +212,8 @@ class CNLiveMineViewModel: NSObject { | @@ -199,8 +212,8 @@ class CNLiveMineViewModel: NSObject { | ||
| 199 | param.setValue(UIDevice.current.identifierForVendor?.uuidString.replacingOccurrences(of: "-", with: "") ?? "", forKey: "deviceId") | 212 | param.setValue(UIDevice.current.identifierForVendor?.uuidString.replacingOccurrences(of: "-", with: "") ?? "", forKey: "deviceId") |
| 200 | showLoading(message: "") | 213 | showLoading(message: "") |
| 201 | let custom_param = NSMutableDictionary() | 214 | let custom_param = NSMutableDictionary() |
| 202 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 203 | - custom_param.setValue(APPKey, forKey: "appKey") | 215 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 216 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 204 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 217 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 205 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 218 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 206 | CNLiveNetworking.setupShowDataResult(false) | 219 | CNLiveNetworking.setupShowDataResult(false) |
| @@ -227,8 +240,8 @@ class CNLiveMineViewModel: NSObject { | @@ -227,8 +240,8 @@ class CNLiveMineViewModel: NSObject { | ||
| 227 | static func requestMessage(resultBlock: @escaping resultNewsBlock) { | 240 | static func requestMessage(resultBlock: @escaping resultNewsBlock) { |
| 228 | showLoading(message: "") | 241 | showLoading(message: "") |
| 229 | let custom_param = NSMutableDictionary() | 242 | let custom_param = NSMutableDictionary() |
| 230 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 231 | - custom_param.setValue(APPKey, forKey: "appKey") | 243 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 244 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 232 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 245 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 233 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 246 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 234 | CNLiveNetworking.setupShowDataResult(false) | 247 | CNLiveNetworking.setupShowDataResult(false) |
| @@ -266,8 +279,8 @@ class CNLiveMineViewModel: NSObject { | @@ -266,8 +279,8 @@ class CNLiveMineViewModel: NSObject { | ||
| 266 | param.setValue("30", forKey: "pageSize") | 279 | param.setValue("30", forKey: "pageSize") |
| 267 | param.setValue("\(page)", forKey: "page") | 280 | param.setValue("\(page)", forKey: "page") |
| 268 | let custom_param = NSMutableDictionary() | 281 | let custom_param = NSMutableDictionary() |
| 269 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 270 | - custom_param.setValue(APPKey, forKey: "appKey") | 282 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 283 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 271 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 284 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 272 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 285 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 273 | CNLiveNetworking.setupShowDataResult(false) | 286 | CNLiveNetworking.setupShowDataResult(false) |
| @@ -328,8 +341,8 @@ class CNLiveMineViewModel: NSObject { | @@ -328,8 +341,8 @@ class CNLiveMineViewModel: NSObject { | ||
| 328 | param.setValue("\(page)", forKey: "page") | 341 | param.setValue("\(page)", forKey: "page") |
| 329 | param.setValue("30", forKey: "pageSize") | 342 | param.setValue("30", forKey: "pageSize") |
| 330 | let custom_param = NSMutableDictionary() | 343 | let custom_param = NSMutableDictionary() |
| 331 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 332 | - custom_param.setValue(APPKey, forKey: "appKey") | 344 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 345 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 333 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 346 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 334 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 347 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 335 | CNLiveNetworking.setupShowDataResult(false) | 348 | CNLiveNetworking.setupShowDataResult(false) |
| @@ -416,8 +429,8 @@ class CNLiveMineViewModel: NSObject { | @@ -416,8 +429,8 @@ class CNLiveMineViewModel: NSObject { | ||
| 416 | request.httpBody = data | 429 | request.httpBody = data |
| 417 | showLoading(message: "") | 430 | showLoading(message: "") |
| 418 | let custom_param = NSMutableDictionary() | 431 | let custom_param = NSMutableDictionary() |
| 419 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 420 | - custom_param.setValue(APPKey, forKey: "appKey") | 432 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 433 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 421 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 434 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 422 | CNLiveNetworking.setAllowRequestDefaultArgument(false) | 435 | CNLiveNetworking.setAllowRequestDefaultArgument(false) |
| 423 | CNLiveNetworking.setupShowDataResult(false) | 436 | CNLiveNetworking.setupShowDataResult(false) |
| @@ -457,8 +470,8 @@ class CNLiveMineViewModel: NSObject { | @@ -457,8 +470,8 @@ class CNLiveMineViewModel: NSObject { | ||
| 457 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | 470 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 458 | param.setValue(identityId, forKey: "identityId") | 471 | param.setValue(identityId, forKey: "identityId") |
| 459 | let custom_param = NSMutableDictionary() | 472 | let custom_param = NSMutableDictionary() |
| 460 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 461 | - custom_param.setValue(APPKey, forKey: "appKey") | 473 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 474 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 462 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 475 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 463 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 476 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 464 | CNLiveNetworking.setupShowDataResult(false) | 477 | CNLiveNetworking.setupShowDataResult(false) |
| @@ -509,8 +522,8 @@ class CNLiveMineViewModel: NSObject { | @@ -509,8 +522,8 @@ class CNLiveMineViewModel: NSObject { | ||
| 509 | let param = NSMutableDictionary() | 522 | let param = NSMutableDictionary() |
| 510 | param.setValue("2", forKey: "appType") | 523 | param.setValue("2", forKey: "appType") |
| 511 | let custom_param = NSMutableDictionary() | 524 | let custom_param = NSMutableDictionary() |
| 512 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 513 | - custom_param.setValue(APPKey, forKey: "appKey") | 525 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 526 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 514 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 527 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 515 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 528 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 516 | CNLiveNetworking.setupShowDataResult(false) | 529 | CNLiveNetworking.setupShowDataResult(false) |
| @@ -556,8 +569,8 @@ class CNLiveMineViewModel: NSObject { | @@ -556,8 +569,8 @@ class CNLiveMineViewModel: NSObject { | ||
| 556 | param.setValue("\(page)", forKey: "page") | 569 | param.setValue("\(page)", forKey: "page") |
| 557 | param.setValue("10", forKey: "pageSize") | 570 | param.setValue("10", forKey: "pageSize") |
| 558 | let custom_param = NSMutableDictionary() | 571 | let custom_param = NSMutableDictionary() |
| 559 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 560 | - custom_param.setValue(APPKey, forKey: "appKey") | 572 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 573 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 561 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 574 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 562 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 575 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 563 | CNLiveNetworking.setupShowDataResult(false) | 576 | CNLiveNetworking.setupShowDataResult(false) |
metaCode/Classes/Main/VideoPage/Controller/CNLiveShortVideoViewController.swift
| @@ -72,8 +72,10 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -72,8 +72,10 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 72 | return dataArray | 72 | return dataArray |
| 73 | }() | 73 | }() |
| 74 | 74 | ||
| 75 | + | ||
| 75 | var aid: String! = "" | 76 | var aid: String! = "" |
| 76 | var pageNum: NSInteger! = 1 | 77 | var pageNum: NSInteger! = 1 |
| 78 | + var isSelectable: Bool! = false | ||
| 77 | var currentIndex: NSInteger! = 0 | 79 | var currentIndex: NSInteger! = 0 |
| 78 | var footerRefreshView: CNLiveFooterRefresh! | 80 | var footerRefreshView: CNLiveFooterRefresh! |
| 79 | var playerManager = ZFIJKPlayerManager.init() | 81 | var playerManager = ZFIJKPlayerManager.init() |
| @@ -88,6 +90,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -88,6 +90,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 88 | init(aid: String,page: NSInteger, currentIndex: NSInteger, dataArray: [CNLiveAlbumListModel]) { | 90 | init(aid: String,page: NSInteger, currentIndex: NSInteger, dataArray: [CNLiveAlbumListModel]) { |
| 89 | self.aid = aid | 91 | self.aid = aid |
| 90 | self.pageNum = page | 92 | self.pageNum = page |
| 93 | + self.isSelectable = true | ||
| 91 | self.currentIndex = currentIndex | 94 | self.currentIndex = currentIndex |
| 92 | super.init(nibName:nil, bundle:nil) | 95 | super.init(nibName:nil, bundle:nil) |
| 93 | self.dataArray.addObjects(from: dataArray) | 96 | self.dataArray.addObjects(from: dataArray) |
| @@ -101,12 +104,13 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -101,12 +104,13 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 101 | /// - Parameter aid: 专辑 id | 104 | /// - Parameter aid: 专辑 id |
| 102 | init(aid: String) { | 105 | init(aid: String) { |
| 103 | self.aid = aid | 106 | self.aid = aid |
| 107 | + self.isSelectable = false | ||
| 104 | super.init(nibName:nil, bundle:nil) | 108 | super.init(nibName:nil, bundle:nil) |
| 105 | } | 109 | } |
| 106 | 110 | ||
| 107 | override func viewWillAppear(_ animated: Bool) { | 111 | override func viewWillAppear(_ animated: Bool) { |
| 108 | super.viewWillAppear(animated) | 112 | super.viewWillAppear(animated) |
| 109 | - if self.dataArray.count == 0 { | 113 | + if self.dataArray.count > 0 && self.isSelectable { |
| 110 | self.playTheIndex(index: self.currentIndex) | 114 | self.playTheIndex(index: self.currentIndex) |
| 111 | } | 115 | } |
| 112 | } | 116 | } |
| @@ -152,9 +156,18 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -152,9 +156,18 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 152 | self.controlView.videoPlayer((self.player)!, currentTime: self.player.currentTime, totalTime: self.player.totalTime) | 156 | self.controlView.videoPlayer((self.player)!, currentTime: self.player.currentTime, totalTime: self.player.totalTime) |
| 153 | let index = self.dataURLArray.index(of: assetURL.absoluteString) | 157 | let index = self.dataURLArray.index(of: assetURL.absoluteString) |
| 154 | let homeModel = self.dataArray[index] as! CNLiveAlbumListModel | 158 | let homeModel = self.dataArray[index] as! CNLiveAlbumListModel |
| 155 | - if (homeModel.product!.albumProductType != "0") { | 159 | + if (homeModel.product!.check == true) { |
| 156 | (self.player)!.stopCurrentPlayingCell() | 160 | (self.player)!.stopCurrentPlayingCell() |
| 157 | } | 161 | } |
| 162 | + if homeModel.product?.check == true { | ||
| 163 | + if homeModel.product?.albumProductType != "0" { | ||
| 164 | + (self.player)!.stopCurrentPlayingCell() | ||
| 165 | + } | ||
| 166 | + } else { | ||
| 167 | + if homeModel.product?.albumProductType != "0" { | ||
| 168 | + (self.player)!.stopCurrentPlayingCell() | ||
| 169 | + } | ||
| 170 | + } | ||
| 158 | } | 171 | } |
| 159 | // 更新另一个控制层的时间 | 172 | // 更新另一个控制层的时间 |
| 160 | player.playerPlayTimeChanged = { [weak self] asset, currentTime, duration in | 173 | player.playerPlayTimeChanged = { [weak self] asset, currentTime, duration in |
| @@ -207,7 +220,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -207,7 +220,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 207 | 220 | ||
| 208 | override func viewWillLayoutSubviews() { | 221 | override func viewWillLayoutSubviews() { |
| 209 | super.viewWillLayoutSubviews() | 222 | super.viewWillLayoutSubviews() |
| 210 | - self.backBtn.frame = CGRectMake(15, CGRectGetMaxY(UIApplication.shared.statusBarFrame), 45, 45) | 223 | + self.backBtn.frame = CGRectMake(15, KStatusBarHeight + 15, 45, 45) |
| 211 | } | 224 | } |
| 212 | 225 | ||
| 213 | func requestData(resultBlock: @escaping () -> Void) { | 226 | func requestData(resultBlock: @escaping () -> Void) { |
| @@ -314,7 +327,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -314,7 +327,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 314 | extension CNLiveShortVideoViewController { | 327 | extension CNLiveShortVideoViewController { |
| 315 | 328 | ||
| 316 | func likeActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) { | 329 | func likeActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) { |
| 317 | - CNLiveShortVideoViewModel.requestRankWithLike(contentId: viewcell.homeModel.pid, contentTitle: viewcell.homeModel.title, contentSid: viewcell.homeModel.icon!.id, support: viewcell.homeModel.tool!.liked, tagName: viewcell.homeModel.tagName) {result, respStatue in | 330 | + CNLiveShortVideoViewModel.requestRankWithLike(contentId: viewcell.homeModel.pid, contentTitle: viewcell.homeModel.title, contentSid: viewcell.homeModel.icon!.id, support: viewcell.homeModel.tool!.liked, isShare: false) {result, respStatue in |
| 318 | if respStatue == .success { | 331 | if respStatue == .success { |
| 319 | viewcell.homeModel.tool!.liked = !viewcell.homeModel.tool!.liked | 332 | viewcell.homeModel.tool!.liked = !viewcell.homeModel.tool!.liked |
| 320 | if viewcell.homeModel.tool!.liked { | 333 | if viewcell.homeModel.tool!.liked { |
| @@ -333,16 +346,32 @@ extension CNLiveShortVideoViewController { | @@ -333,16 +346,32 @@ extension CNLiveShortVideoViewController { | ||
| 333 | }) | 346 | }) |
| 334 | } | 347 | } |
| 335 | func shareActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) { | 348 | func shareActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) { |
| 336 | - CNLiveShareManager.showShareViewWithParam(forShareTitle: viewcell.homeModel.title, shareUrl: viewcell.homeModel.shareUrl, shareDesc: viewcell.homeModel.subTitle, shareImage: viewcell.homeModel.poster, screenFull: false, hiddenWjj: true, hiddenQQ: false, hiddenWB: true, hiddenLifeCircle: true, hiddenWechatCircle: false, hiddenWechat: false, hiddenSafari: true, formVC: self, topImage: [], topTitles: [], platformType: .all) { title in} completerBlock: {[weak self] resultType, platformType, typeString in | ||
| 337 | - guard let self = self else { return } | ||
| 338 | - | 349 | + CNLiveShareManager.showShareViewWithParam(forShareTitle: viewcell.homeModel.title, shareUrl: viewcell.homeModel.shareUrl, shareDesc: viewcell.homeModel.subTitle, shareImage: viewcell.homeModel.poster, screenFull: false, hiddenWjj: true, hiddenQQ: false, hiddenWB: true, hiddenLifeCircle: true, hiddenWechatCircle: false, hiddenWechat: false, hiddenSafari: true, formVC: self, topImage: [], topTitles: [], platformType: .all) { title in} completerBlock: {resultType, platformType, typeString in |
| 350 | + if resultType == .succ { | ||
| 351 | + showLoading(message: "") | ||
| 352 | + CNLiveShortVideoViewModel.requestRankWithLike(contentId: viewcell.homeModel.pid, contentTitle: viewcell.homeModel.title, contentSid: viewcell.homeModel.icon!.id, support: true, isShare: true) {result, respStatue in | ||
| 353 | + if respStatue == .success { | ||
| 354 | + viewcell.homeModel.tool?.shareNum = "\(Int(viewcell.homeModel.tool!.shareNum)! + 1)" | ||
| 355 | + button.setTitle(viewcell.homeModel.tool?.shareNum, for: .normal) | ||
| 356 | + } | ||
| 357 | + } | ||
| 358 | + } | ||
| 339 | } | 359 | } |
| 340 | } | 360 | } |
| 341 | func iconActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) { | 361 | func iconActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) { |
| 342 | self.navigationController?.pushViewController(CNLivePlayletHomePageController(aid: aid), animated: true) | 362 | self.navigationController?.pushViewController(CNLivePlayletHomePageController(aid: aid), animated: true) |
| 343 | } | 363 | } |
| 344 | - func faviActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) { | ||
| 345 | - | 364 | + func faviActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: APButton) { |
| 365 | + button.startAnimating() | ||
| 366 | + CNLiveShortVideoViewModel.requestCollect(aid: aid, type: viewcell.homeModel.tool!.collectioned) { result, respStatue in | ||
| 367 | + if respStatue == .success { | ||
| 368 | + showMessage(message: result as! String) | ||
| 369 | + viewcell.homeModel.tool!.collectioned = !viewcell.homeModel.tool!.collectioned | ||
| 370 | + DispatchQueue.main.asyncAfter(deadline: .now() + 1) { | ||
| 371 | + button.isHidden = true | ||
| 372 | + } | ||
| 373 | + } | ||
| 374 | + } | ||
| 346 | } | 375 | } |
| 347 | func listActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) { | 376 | func listActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) { |
| 348 | CNLiveShortVideoContentListView.showVideoContentListView(title: viewcell.homeModel.albumMsgModel!.albumName,dataArray: dataArray, result: {[weak self] listModel in | 377 | CNLiveShortVideoContentListView.showVideoContentListView(title: viewcell.homeModel.albumMsgModel!.albumName,dataArray: dataArray, result: {[weak self] listModel in |
| @@ -366,7 +395,6 @@ extension CNLiveShortVideoViewController { | @@ -366,7 +395,6 @@ extension CNLiveShortVideoViewController { | ||
| 366 | let index = self.dataArray.index(of: viewcell.homeModel as Any) | 395 | let index = self.dataArray.index(of: viewcell.homeModel as Any) |
| 367 | self.playTheIndex(index: index) | 396 | self.playTheIndex(index: index) |
| 368 | } | 397 | } |
| 369 | - | ||
| 370 | } | 398 | } |
| 371 | } | 399 | } |
| 372 | 400 |
metaCode/Classes/Main/VideoPage/Model/CNLiveShortVideoHomeModel.swift
| @@ -42,7 +42,7 @@ class ShortVideoHomeCommentFListModel: BaseModel { | @@ -42,7 +42,7 @@ class ShortVideoHomeCommentFListModel: BaseModel { | ||
| 42 | var facepath: String? = "" | 42 | var facepath: String? = "" |
| 43 | var content: String? = "" | 43 | var content: String? = "" |
| 44 | var created_at: String? = "" | 44 | var created_at: String? = "" |
| 45 | - var praise: String? = "" | 45 | + var praise: Int? = 0 |
| 46 | var plat: String? = "" | 46 | var plat: String? = "" |
| 47 | var isOffical: Bool? = false | 47 | var isOffical: Bool? = false |
| 48 | var model: String? = "" | 48 | var model: String? = "" |
| @@ -57,34 +57,13 @@ class ShortVideoHomeCommentFListModel: BaseModel { | @@ -57,34 +57,13 @@ class ShortVideoHomeCommentFListModel: BaseModel { | ||
| 57 | var textLayout: YYTextLayout! | 57 | var textLayout: YYTextLayout! |
| 58 | var cellH: CGFloat! = 0 | 58 | var cellH: CGFloat! = 0 |
| 59 | 59 | ||
| 60 | -// override func mapping(mapper: HelpingMapper) { | ||
| 61 | -// mapper <<< | ||
| 62 | -// self.content <-- TransformOf(fromJSON: { (raw) -> String in | ||
| 63 | -// if raw!.count > 0 { | ||
| 64 | -// let modifier = CNLiveShortVideoMateCodeLinePositionModifier(font: medium_adapt_font(pointSize: 16), paddingTop: 5, paddingBottom: 5, lineHeightMultiple: 2) | ||
| 65 | -// let comment = CNLiveBusinessTools.replaceQQemoji(withCustomText: self.content ?? "") | ||
| 66 | -// let attributes = NSMutableAttributedString(attributedString: comment) | ||
| 67 | -// attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.white, range: NSRange(location: 0, length: comment.length)) | ||
| 68 | -// attributes.addAttribute(NSAttributedString.Key.font, value: medium_adapt_font(pointSize: 16), range: NSRange(location: 0, length: comment.length)) | ||
| 69 | -// let textContainer = YYTextContainer(size: CGSize(width: KSreenWidth-80, height: CGFloat(HUGE))) | ||
| 70 | -// textContainer.linePositionModifier = modifier; | ||
| 71 | -// let textLayout = YYTextLayout(container: textContainer, text: attributes) | ||
| 72 | -// self.textLayout = textLayout | ||
| 73 | -// self.cellH = 70 + (textLayout?.textBoundingRect.size.height ?? 0) | ||
| 74 | -// } | ||
| 75 | -// return raw! | ||
| 76 | -// }, toJSON: { (tuple) -> String? in | ||
| 77 | -// return tuple | ||
| 78 | -// }); | ||
| 79 | -// } | ||
| 80 | - | ||
| 81 | override func didFinishMapping() { | 60 | override func didFinishMapping() { |
| 82 | super.didFinishMapping() | 61 | super.didFinishMapping() |
| 83 | 62 | ||
| 84 | let modifier = CNLiveShortVideoMateCodeLinePositionModifier(font: medium_adapt_font(pointSize: 16), paddingTop: 5, paddingBottom: 5, lineHeightMultiple: 2) | 63 | let modifier = CNLiveShortVideoMateCodeLinePositionModifier(font: medium_adapt_font(pointSize: 16), paddingTop: 5, paddingBottom: 5, lineHeightMultiple: 2) |
| 85 | let comment = CNLiveBusinessTools.replaceQQemoji(withCustomText: self.content ?? "") | 64 | let comment = CNLiveBusinessTools.replaceQQemoji(withCustomText: self.content ?? "") |
| 86 | let attributes = NSMutableAttributedString(attributedString: comment) | 65 | let attributes = NSMutableAttributedString(attributedString: comment) |
| 87 | - attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.white, range: NSRange(location: 0, length: comment.length)) | 66 | + attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: HexColor("#333333")!, range: NSRange(location: 0, length: comment.length)) |
| 88 | attributes.addAttribute(NSAttributedString.Key.font, value: medium_adapt_font(pointSize: 16), range: NSRange(location: 0, length: comment.length)) | 67 | attributes.addAttribute(NSAttributedString.Key.font, value: medium_adapt_font(pointSize: 16), range: NSRange(location: 0, length: comment.length)) |
| 89 | let textContainer = YYTextContainer(size: CGSize(width: KSreenWidth-80, height: CGFloat(HUGE))) | 68 | let textContainer = YYTextContainer(size: CGSize(width: KSreenWidth-80, height: CGFloat(HUGE))) |
| 90 | textContainer.linePositionModifier = modifier; | 69 | textContainer.linePositionModifier = modifier; |
| @@ -128,7 +107,7 @@ class ShortVideoHomeCommentRListItemModel: BaseModel { | @@ -128,7 +107,7 @@ class ShortVideoHomeCommentRListItemModel: BaseModel { | ||
| 128 | let modifier = CNLiveShortVideoMateCodeLinePositionModifier(font: semibold_adapt_font(pointSize: 14), paddingTop: 0, paddingBottom: 0, lineHeightMultiple: 1.5) | 107 | let modifier = CNLiveShortVideoMateCodeLinePositionModifier(font: semibold_adapt_font(pointSize: 14), paddingTop: 0, paddingBottom: 0, lineHeightMultiple: 1.5) |
| 129 | let comment = CNLiveBusinessTools.replaceQQemoji(withCustomText: content ?? "") | 108 | let comment = CNLiveBusinessTools.replaceQQemoji(withCustomText: content ?? "") |
| 130 | let attributes = NSMutableAttributedString(attributedString: comment) | 109 | let attributes = NSMutableAttributedString(attributedString: comment) |
| 131 | - attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.white, range: NSRange(location: 0, length: comment.length)) | 110 | + attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: HexColor("#333333")!, range: NSRange(location: 0, length: comment.length)) |
| 132 | attributes.addAttribute(NSAttributedString.Key.font, value: medium_adapt_font(pointSize: 16), range: NSRange(location: 0, length: comment.length)) | 111 | attributes.addAttribute(NSAttributedString.Key.font, value: medium_adapt_font(pointSize: 16), range: NSRange(location: 0, length: comment.length)) |
| 133 | let textContainer = YYTextContainer(size: CGSize(width: KSreenWidth-80-40, height: CGFloat(HUGE))) | 112 | let textContainer = YYTextContainer(size: CGSize(width: KSreenWidth-80-40, height: CGFloat(HUGE))) |
| 134 | textContainer.linePositionModifier = modifier; | 113 | textContainer.linePositionModifier = modifier; |
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoCommentListView.swift
| @@ -12,8 +12,10 @@ import CNLiveCustomUI | @@ -12,8 +12,10 @@ import CNLiveCustomUI | ||
| 12 | import Kingfisher | 12 | import Kingfisher |
| 13 | import YYText | 13 | import YYText |
| 14 | import APButton | 14 | import APButton |
| 15 | +import QMUIKit | ||
| 15 | typealias CloseCommentListResultBlock = (_ commentModel: Any) ->Void | 16 | typealias CloseCommentListResultBlock = (_ commentModel: Any) ->Void |
| 16 | typealias ReloadCommentListResultBlock = (_ commentModel: Any) ->Void | 17 | typealias ReloadCommentListResultBlock = (_ commentModel: Any) ->Void |
| 18 | +typealias ChangeCommentListResultBlock = (_ commentModel: Any) ->Void | ||
| 17 | typealias DeleteCommentListResultBlock = (_ commentModel: Any) ->Void | 19 | typealias DeleteCommentListResultBlock = (_ commentModel: Any) ->Void |
| 18 | class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate { | 20 | class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate { |
| 19 | 21 | ||
| @@ -25,13 +27,13 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | @@ -25,13 +27,13 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | ||
| 25 | 27 | ||
| 26 | lazy var contentView: UIView = { | 28 | lazy var contentView: UIView = { |
| 27 | let view = UIView.init() | 29 | let view = UIView.init() |
| 28 | - view.backgroundColor = HexColor("#010101") | 30 | + view.backgroundColor = HexColor("#FEFFFF") |
| 29 | return view | 31 | return view |
| 30 | }() | 32 | }() |
| 31 | 33 | ||
| 32 | lazy var closeButton: UIButton = { | 34 | lazy var closeButton: UIButton = { |
| 33 | let button = UIButton(type: .custom) | 35 | let button = UIButton(type: .custom) |
| 34 | - button.setImage(UIImage(named: "short_video_close"), for: .normal) | 36 | + button.setImage(UIImage(named: "short_video_comment_close"), for: .normal) |
| 35 | button.backgroundColor = .clear | 37 | button.backgroundColor = .clear |
| 36 | button.addTarget(self, action: #selector(closeMethod), for: .touchUpInside) | 38 | button.addTarget(self, action: #selector(closeMethod), for: .touchUpInside) |
| 37 | return button | 39 | return button |
| @@ -39,7 +41,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | @@ -39,7 +41,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | ||
| 39 | 41 | ||
| 40 | lazy var titleLabel: UILabel = { | 42 | lazy var titleLabel: UILabel = { |
| 41 | let label = UILabel() | 43 | let label = UILabel() |
| 42 | - label.textColor = UIColor.white | 44 | + label.textColor = HexColor("#333333") |
| 43 | label.font = semibold_adapt_font(pointSize: 19) | 45 | label.font = semibold_adapt_font(pointSize: 19) |
| 44 | label.textAlignment = .left | 46 | label.textAlignment = .left |
| 45 | label.text = "0条评论" | 47 | label.text = "0条评论" |
| @@ -50,7 +52,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | @@ -50,7 +52,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | ||
| 50 | 52 | ||
| 51 | lazy var sendButton: UIButton = { | 53 | lazy var sendButton: UIButton = { |
| 52 | let button = UIButton(type: .custom) | 54 | let button = UIButton(type: .custom) |
| 53 | - button.backgroundColor = HexColor("#f8f8f8") | 55 | + button.backgroundColor = HexColor("#F0F0F0") |
| 54 | button.setTitle("我来说一下...", for: .normal) | 56 | button.setTitle("我来说一下...", for: .normal) |
| 55 | button.layer.cornerRadius = 20 | 57 | button.layer.cornerRadius = 20 |
| 56 | button.layer.masksToBounds = true | 58 | button.layer.masksToBounds = true |
| @@ -73,7 +75,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | @@ -73,7 +75,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | ||
| 73 | 75 | ||
| 74 | lazy var lineLabel: UILabel = { | 76 | lazy var lineLabel: UILabel = { |
| 75 | let lineLabel = UILabel.init() | 77 | let lineLabel = UILabel.init() |
| 76 | - lineLabel.backgroundColor = HexColor("#686868") | 78 | + lineLabel.backgroundColor = HexColor("#E6E6E6") |
| 77 | return lineLabel | 79 | return lineLabel |
| 78 | }() | 80 | }() |
| 79 | 81 | ||
| @@ -86,11 +88,11 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | @@ -86,11 +88,11 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | ||
| 86 | tableView.emptyDataSetDelegate = self | 88 | tableView.emptyDataSetDelegate = self |
| 87 | tableView.estimatedSectionFooterHeight = 0 | 89 | tableView.estimatedSectionFooterHeight = 0 |
| 88 | tableView.estimatedSectionHeaderHeight = 0 | 90 | tableView.estimatedSectionHeaderHeight = 0 |
| 89 | - tableView.backgroundColor = HexColor("#010101") | 91 | + tableView.backgroundColor = HexColor("#FEFFFF") |
| 90 | tableView.tableFooterView = UIView.init() | 92 | tableView.tableFooterView = UIView.init() |
| 91 | tableView.separatorStyle = .none | 93 | tableView.separatorStyle = .none |
| 92 | tableView.scrollsToTop = false | 94 | tableView.scrollsToTop = false |
| 93 | - tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: get_system_tabbar_ui_offsetHeight(), right: 0) | 95 | + tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) |
| 94 | tableView.contentInsetAdjustmentBehavior = .never; | 96 | tableView.contentInsetAdjustmentBehavior = .never; |
| 95 | tableView.register(CNLiveShortVideoCommentListTableViewCell.self, forCellReuseIdentifier: kShortVideoCommentListTableViewCellIdentifier) | 97 | tableView.register(CNLiveShortVideoCommentListTableViewCell.self, forCellReuseIdentifier: kShortVideoCommentListTableViewCellIdentifier) |
| 96 | return tableView | 98 | return tableView |
| @@ -101,6 +103,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | @@ -101,6 +103,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | ||
| 101 | return array | 103 | return array |
| 102 | }() | 104 | }() |
| 103 | 105 | ||
| 106 | + var total_hd: Int! = 0 | ||
| 104 | var videoId: String! | 107 | var videoId: String! |
| 105 | var contentSid: String! | 108 | var contentSid: String! |
| 106 | var pageNum: NSInteger! = 0 | 109 | var pageNum: NSInteger! = 0 |
| @@ -116,7 +119,8 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | @@ -116,7 +119,8 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | ||
| 116 | } | 119 | } |
| 117 | let listArray = (result as! ShortVideoHomeCommentModel).comments | 120 | let listArray = (result as! ShortVideoHomeCommentModel).comments |
| 118 | self.dataArray.addObjects(from: listArray) | 121 | self.dataArray.addObjects(from: listArray) |
| 119 | - self.titleLabel.text = "\((result as! ShortVideoHomeCommentModel).total_hd ?? 0)条评论" | 122 | + self.total_hd = (result as! ShortVideoHomeCommentModel).total_hd ?? 0 |
| 123 | + self.titleLabel.text = "\(self.total_hd ?? 0)条评论" | ||
| 120 | if self.tableView.mj_footer != nil { | 124 | if self.tableView.mj_footer != nil { |
| 121 | self.tableView.mj_footer?.endRefreshing() | 125 | self.tableView.mj_footer?.endRefreshing() |
| 122 | } | 126 | } |
| @@ -144,16 +148,20 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | @@ -144,16 +148,20 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | ||
| 144 | } | 148 | } |
| 145 | 149 | ||
| 146 | func addRefreshView() { | 150 | func addRefreshView() { |
| 147 | - self.tableView.mj_header = CNLiveHeaderRefresh(refreshingBlock: { [weak self] in | 151 | + let headerRefreshView: CNLiveHeaderRefresh = CNLiveHeaderRefresh(refreshingBlock: { [weak self] in |
| 148 | guard let self = self else { return } | 152 | guard let self = self else { return } |
| 149 | self.pageNum = 0 | 153 | self.pageNum = 0 |
| 150 | self.requestDataSource() | 154 | self.requestDataSource() |
| 151 | }) | 155 | }) |
| 156 | + headerRefreshView.loadingView?.color = .black | ||
| 157 | + self.tableView.mj_header = headerRefreshView | ||
| 152 | footerRefreshView = CNLiveFooterRefresh(refreshingBlock: { [weak self] in | 158 | footerRefreshView = CNLiveFooterRefresh(refreshingBlock: { [weak self] in |
| 153 | guard let self = self else { return } | 159 | guard let self = self else { return } |
| 154 | self.pageNum += 1 | 160 | self.pageNum += 1 |
| 155 | self.requestDataSource() | 161 | self.requestDataSource() |
| 156 | }) | 162 | }) |
| 163 | + footerRefreshView.stateLabel!.textColor = .black | ||
| 164 | + footerRefreshView.loadingView?.color = .black | ||
| 157 | } | 165 | } |
| 158 | 166 | ||
| 159 | init(frame: CGRect, pid: String, toSid: String) { | 167 | init(frame: CGRect, pid: String, toSid: String) { |
| @@ -269,10 +277,31 @@ extension CNLiveShortVideoCommentListView { | @@ -269,10 +277,31 @@ extension CNLiveShortVideoCommentListView { | ||
| 269 | guard let self = self else { return } | 277 | guard let self = self else { return } |
| 270 | self.tableView.mj_header?.beginRefreshing() | 278 | self.tableView.mj_header?.beginRefreshing() |
| 271 | } | 279 | } |
| 280 | + cell.changeBlock = {[weak self] commentModel in | ||
| 281 | + guard let self = self else { return } | ||
| 282 | + self.titleLabel.text = "\(self.total_hd - 1)条评论" | ||
| 283 | + } | ||
| 272 | cell.deleteBlock = {[weak self] commentModel in | 284 | cell.deleteBlock = {[weak self] commentModel in |
| 273 | guard let self = self else { return } | 285 | guard let self = self else { return } |
| 274 | - self.dataArray.remove(commentModel) | ||
| 275 | - self.tableView.deleteRows(at: [indexPath], with: .automatic) | 286 | + self.pageNum = 1 |
| 287 | + self.requestDataSource() | ||
| 288 | + | ||
| 289 | +// let tempArray = NSMutableArray(array: self.dataArray) | ||
| 290 | +// let tempModel = commentModel as! ShortVideoHomeCommentFListModel | ||
| 291 | +// tempArray.forEach { itemModel in | ||
| 292 | +// let model: ShortVideoHomeCommentListModel = itemModel as! ShortVideoHomeCommentListModel | ||
| 293 | +// if tempModel.commentId == model.comment.commentId { | ||
| 294 | +// let index = self.dataArray.index(of: itemModel) | ||
| 295 | +// let indexPath_current: IndexPath = IndexPath(row: index, section: 0) | ||
| 296 | +// self.dataArray.remove(itemModel) | ||
| 297 | +// self.tableView.beginUpdates() | ||
| 298 | +// self.tableView.deleteRows(at: [indexPath_current], with: .automatic) | ||
| 299 | +// self.tableView.endUpdates() | ||
| 300 | +// self.titleLabel.text = "\(self.total_hd - (model.replyData.total_hd! + 1))条评论" | ||
| 301 | +// self.tableView.reloadData() | ||
| 302 | +// return | ||
| 303 | +// } | ||
| 304 | +// } | ||
| 276 | } | 305 | } |
| 277 | cell.videoId = videoId | 306 | cell.videoId = videoId |
| 278 | cell.contentSid = contentSid | 307 | cell.contentSid = contentSid |
| @@ -287,7 +316,13 @@ extension CNLiveShortVideoCommentListView { | @@ -287,7 +316,13 @@ extension CNLiveShortVideoCommentListView { | ||
| 287 | self.resultBlock(model) | 316 | self.resultBlock(model) |
| 288 | } | 317 | } |
| 289 | func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { | 318 | func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { |
| 290 | - return UIImage(named: "short_video_default") | 319 | + return UIImage(named: "short_video_comment_empty") |
| 320 | + } | ||
| 321 | + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? { | ||
| 322 | + let attributes = NSMutableAttributedString(string: "暂无评论~") | ||
| 323 | + attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: HexColor("#666666")!, range: NSRange(location: 0, length: 5)) | ||
| 324 | + attributes.addAttribute(NSAttributedString.Key.font, value: medium_adapt_font(pointSize: 16), range: NSRange(location: 0, length: 5)) | ||
| 325 | + return attributes | ||
| 291 | } | 326 | } |
| 292 | } | 327 | } |
| 293 | 328 | ||
| @@ -303,9 +338,17 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -303,9 +338,17 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 303 | return imageView | 338 | return imageView |
| 304 | }() | 339 | }() |
| 305 | 340 | ||
| 341 | + lazy var owerView: UIImageView = { | ||
| 342 | + let imageView = UIImageView.init() | ||
| 343 | + imageView.image = UIImage(named: "short_video_comment_ower") | ||
| 344 | + imageView.contentMode = .scaleAspectFill | ||
| 345 | + imageView.isHidden = true | ||
| 346 | + return imageView | ||
| 347 | + }() | ||
| 348 | + | ||
| 306 | lazy var titleLabel: UILabel = { | 349 | lazy var titleLabel: UILabel = { |
| 307 | let titleLabel = UILabel.init() | 350 | let titleLabel = UILabel.init() |
| 308 | - titleLabel.textColor = .white | 351 | + titleLabel.textColor = HexColor("#AFAFAF") |
| 309 | titleLabel.lineBreakMode = .byTruncatingTail | 352 | titleLabel.lineBreakMode = .byTruncatingTail |
| 310 | titleLabel.numberOfLines = 2 | 353 | titleLabel.numberOfLines = 2 |
| 311 | titleLabel.font = medium_adapt_font(pointSize: 12) | 354 | titleLabel.font = medium_adapt_font(pointSize: 12) |
| @@ -314,7 +357,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -314,7 +357,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 314 | 357 | ||
| 315 | lazy var commentLabel: YYLabel = { | 358 | lazy var commentLabel: YYLabel = { |
| 316 | let commentLabel = YYLabel() | 359 | let commentLabel = YYLabel() |
| 317 | - commentLabel.textColor = .white | 360 | + commentLabel.textColor = HexColor("#333333") |
| 318 | commentLabel.displaysAsynchronously = true | 361 | commentLabel.displaysAsynchronously = true |
| 319 | commentLabel.clearContentsBeforeAsynchronouslyDisplay = false | 362 | commentLabel.clearContentsBeforeAsynchronouslyDisplay = false |
| 320 | commentLabel.fadeOnAsynchronouslyDisplay = false | 363 | commentLabel.fadeOnAsynchronouslyDisplay = false |
| @@ -332,7 +375,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -332,7 +375,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 332 | 375 | ||
| 333 | lazy var timeLabel: UILabel = { | 376 | lazy var timeLabel: UILabel = { |
| 334 | let timeLabel = UILabel.init() | 377 | let timeLabel = UILabel.init() |
| 335 | - timeLabel.textColor = .white | 378 | + timeLabel.textColor = HexColor("#969696") |
| 336 | timeLabel.font = light_adapt_font(pointSize: 13) | 379 | timeLabel.font = light_adapt_font(pointSize: 13) |
| 337 | return timeLabel | 380 | return timeLabel |
| 338 | }() | 381 | }() |
| @@ -343,6 +386,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -343,6 +386,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 343 | replyButton.activityIndicator.color = .white | 386 | replyButton.activityIndicator.color = .white |
| 344 | replyButton.backgroundColor = .clear | 387 | replyButton.backgroundColor = .clear |
| 345 | replyButton.setTitle("回复", for: .normal) | 388 | replyButton.setTitle("回复", for: .normal) |
| 389 | + replyButton.setTitleColor(HexColor("#969696"), for: .normal) | ||
| 346 | replyButton.titleLabel?.font = medium_adapt_font(pointSize: 13) | 390 | replyButton.titleLabel?.font = medium_adapt_font(pointSize: 13) |
| 347 | replyButton.addTarget(self, action: #selector(replyMethod), for: .touchUpInside) | 391 | replyButton.addTarget(self, action: #selector(replyMethod), for: .touchUpInside) |
| 348 | return replyButton | 392 | return replyButton |
| @@ -351,13 +395,13 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -351,13 +395,13 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 351 | lazy var likeButton: QMUIButton = { | 395 | lazy var likeButton: QMUIButton = { |
| 352 | let button = QMUIButton() | 396 | let button = QMUIButton() |
| 353 | button.imagePosition = .left | 397 | button.imagePosition = .left |
| 354 | - button.spacingBetweenImageAndTitle = 0 | ||
| 355 | - button.setTitleColor(UIColor.white, for: .normal) | 398 | + button.spacingBetweenImageAndTitle = 2 |
| 399 | + button.setTitleColor(HexColor("#333333"), for: .normal) | ||
| 356 | button.setTitle("0", for: .normal) | 400 | button.setTitle("0", for: .normal) |
| 357 | button.imageView?.contentMode = .scaleAspectFit | 401 | button.imageView?.contentMode = .scaleAspectFit |
| 358 | - button.setImage(UIImage(named: "short_video_zan_nomal"), for: .normal) | ||
| 359 | - button.setImage(UIImage(named: "short_video_zan_select"), for: .selected) | ||
| 360 | - button.titleLabel?.font = regular_adapt_font(pointSize: 14) | 402 | + button.setImage(UIImage(named: "short_comment_zan_nomal"), for: .normal) |
| 403 | + button.setImage(UIImage(named: "short_comment_zan_select"), for: .selected) | ||
| 404 | + button.titleLabel?.font = semibold_adapt_font(pointSize: 14) | ||
| 361 | button.addTarget(self, action: #selector(likeActionMethod), for: .touchUpInside) | 405 | button.addTarget(self, action: #selector(likeActionMethod), for: .touchUpInside) |
| 362 | return button | 406 | return button |
| 363 | }() | 407 | }() |
| @@ -369,7 +413,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -369,7 +413,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 369 | tableView.delegate = self | 413 | tableView.delegate = self |
| 370 | tableView.estimatedSectionFooterHeight = 0 | 414 | tableView.estimatedSectionFooterHeight = 0 |
| 371 | tableView.estimatedSectionHeaderHeight = 0 | 415 | tableView.estimatedSectionHeaderHeight = 0 |
| 372 | - tableView.backgroundColor = HexColor("#010101") | 416 | + tableView.backgroundColor = .white |
| 373 | tableView.tableFooterView = UIView.init() | 417 | tableView.tableFooterView = UIView.init() |
| 374 | tableView.separatorStyle = .none | 418 | tableView.separatorStyle = .none |
| 375 | tableView.scrollsToTop = false | 419 | tableView.scrollsToTop = false |
| @@ -379,16 +423,18 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -379,16 +423,18 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 379 | 423 | ||
| 380 | var videoId: String! | 424 | var videoId: String! |
| 381 | var contentSid: String! | 425 | var contentSid: String! |
| 426 | + var changeBlock: ChangeCommentListResultBlock! | ||
| 382 | var deleteBlock: DeleteCommentListResultBlock! | 427 | var deleteBlock: DeleteCommentListResultBlock! |
| 383 | var reloadBlcok: ReloadCommentListResultBlock! | 428 | var reloadBlcok: ReloadCommentListResultBlock! |
| 429 | + var deleteItemBlock: DeleteCommentListResultBlock! | ||
| 384 | var commentModel: ShortVideoHomeCommentFListModel! | 430 | var commentModel: ShortVideoHomeCommentFListModel! |
| 385 | var replyModel: ShortVideoHomeCommentRListModel! | 431 | var replyModel: ShortVideoHomeCommentRListModel! |
| 386 | var replyItemModel: ShortVideoHomeCommentRListItemModel! | 432 | var replyItemModel: ShortVideoHomeCommentRListItemModel! |
| 387 | 433 | ||
| 388 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | 434 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { |
| 389 | super.init(style: style, reuseIdentifier: reuseIdentifier) | 435 | super.init(style: style, reuseIdentifier: reuseIdentifier) |
| 390 | - contentView.backgroundColor = .clear | ||
| 391 | - backgroundColor = .clear | 436 | + contentView.backgroundColor = HexColor("#FEFFFF") |
| 437 | + backgroundColor = HexColor("#FEFFFF") | ||
| 392 | selectionStyle = .none | 438 | selectionStyle = .none |
| 393 | 439 | ||
| 394 | contentView.addSubview(iconView) | 440 | contentView.addSubview(iconView) |
| @@ -404,6 +450,11 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -404,6 +450,11 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 404 | make.right.equalToSuperview().offset(-10) | 450 | make.right.equalToSuperview().offset(-10) |
| 405 | make.height.equalTo(20) | 451 | make.height.equalTo(20) |
| 406 | } | 452 | } |
| 453 | + contentView.addSubview(owerView) | ||
| 454 | + owerView.snp.makeConstraints { make in | ||
| 455 | + make.centerY.equalTo(titleLabel) | ||
| 456 | + make.left.equalTo(titleLabel.snp.right).offset(10) | ||
| 457 | + } | ||
| 407 | contentView.addSubview(commentLabel) | 458 | contentView.addSubview(commentLabel) |
| 408 | commentLabel.snp.makeConstraints { make in | 459 | commentLabel.snp.makeConstraints { make in |
| 409 | make.top.equalTo(titleLabel.snp.bottom).offset(10) | 460 | make.top.equalTo(titleLabel.snp.bottom).offset(10) |
| @@ -432,8 +483,6 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -432,8 +483,6 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 432 | make.top.equalTo(commentLabel.snp.bottom).offset(10) | 483 | make.top.equalTo(commentLabel.snp.bottom).offset(10) |
| 433 | } | 484 | } |
| 434 | contentView.addSubview(tableView) | 485 | contentView.addSubview(tableView) |
| 435 | - | ||
| 436 | - | ||
| 437 | } | 486 | } |
| 438 | 487 | ||
| 439 | func setupWithDataSource(commentData: ShortVideoHomeCommentFListModel, replyData: ShortVideoHomeCommentRListModel, tableView_h: CGFloat) { | 488 | func setupWithDataSource(commentData: ShortVideoHomeCommentFListModel, replyData: ShortVideoHomeCommentRListModel, tableView_h: CGFloat) { |
| @@ -443,8 +492,14 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -443,8 +492,14 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 443 | iconView.kf.setImage(with: URL(string: commentData.icon!), placeholder: UIImage(named: "short_video_default")) | 492 | iconView.kf.setImage(with: URL(string: commentData.icon!), placeholder: UIImage(named: "short_video_default")) |
| 444 | titleLabel.text = commentData.nick | 493 | titleLabel.text = commentData.nick |
| 445 | likeButton.isSelected = commentData.isPraised! | 494 | likeButton.isSelected = commentData.isPraised! |
| 446 | - likeButton.setTitle(commentData.praise, for: .normal) | 495 | + likeButton.setTitle("\(commentData.praiseCount ?? 0)", for: .normal) |
| 447 | timeLabel.text = commentData.created_at | 496 | timeLabel.text = commentData.created_at |
| 497 | + owerView.isHidden = !(contentSid == commentData.uid) | ||
| 498 | + if ((contentSid == UserInfoManager.shared.userInfo.uid) || (commentData.uid == UserInfoManager.shared.userInfo.uid)) { | ||
| 499 | + replyButton.setTitle("删除", for: .normal) | ||
| 500 | + } else { | ||
| 501 | + replyButton.setTitle("回复", for: .normal) | ||
| 502 | + } | ||
| 448 | DispatchQueue.main.async {[weak self] in | 503 | DispatchQueue.main.async {[weak self] in |
| 449 | guard let self = self else { return } | 504 | guard let self = self else { return } |
| 450 | self.commentLabel.textLayout = commentData.textLayout | 505 | self.commentLabel.textLayout = commentData.textLayout |
| @@ -475,6 +530,11 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -475,6 +530,11 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 475 | likeButton.isSelected = replyModel.isPraised! | 530 | likeButton.isSelected = replyModel.isPraised! |
| 476 | likeButton.setTitle("\(replyModel.praiseCount ?? 0)", for: .normal) | 531 | likeButton.setTitle("\(replyModel.praiseCount ?? 0)", for: .normal) |
| 477 | timeLabel.text = replyModel.created_at | 532 | timeLabel.text = replyModel.created_at |
| 533 | + if ((contentSid == UserInfoManager.shared.userInfo.uid) || (replyItemModel.fromSid == UserInfoManager.shared.userInfo.uid)) { | ||
| 534 | + replyButton.setTitle("删除", for: .normal) | ||
| 535 | + } else { | ||
| 536 | + replyButton.setTitle("回复", for: .normal) | ||
| 537 | + } | ||
| 478 | DispatchQueue.main.async {[weak self] in | 538 | DispatchQueue.main.async {[weak self] in |
| 479 | guard let self = self else { return } | 539 | guard let self = self else { return } |
| 480 | self.commentLabel.textLayout = replyModel.textLayout | 540 | self.commentLabel.textLayout = replyModel.textLayout |
| @@ -487,34 +547,93 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -487,34 +547,93 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 487 | } | 547 | } |
| 488 | } | 548 | } |
| 489 | 549 | ||
| 490 | - @objc func replyMethod() { | ||
| 491 | - CNLiveContentToolTextView.showCommentViewForCustom(withCommType: .reply, fromNick: commentModel == nil ? replyItemModel.fromNick : commentModel.nick, firstRespFace: false, successBlcok: {[weak self] commentString, toolbarView in | ||
| 492 | - guard let self = self else { return } | ||
| 493 | - CNLiveShortVideoViewModel.requestCommentWithReply(commentId: self.commentModel.commentId!, comment: commentString ?? "", toSid: commentModel.uid!, fromSid: UserInfoManager.shared.userInfo.uid, level: "1") {[weak self] result, respStatue in | 550 | + @objc func replyMethod(button: UIButton) { |
| 551 | + if button.titleLabel?.text == "回复" { | ||
| 552 | + CNLiveContentToolTextView.showCommentViewForCustom(withCommType: .reply, fromNick: commentModel == nil ? replyItemModel.fromNick : commentModel.nick, firstRespFace: false, successBlcok: {[weak self] commentString, toolbarView in | ||
| 494 | guard let self = self else { return } | 553 | guard let self = self else { return } |
| 495 | - if respStatue == .success { | ||
| 496 | - showMessage(message: result as! String) | ||
| 497 | - self.reloadBlcok(self.commentModel == nil ? replyItemModel! : commentModel!) | 554 | + CNLiveShortVideoViewModel.requestCommentWithReply(commentId: self.commentModel.commentId!, comment: commentString ?? "", toSid: commentModel.uid!, fromSid: UserInfoManager.shared.userInfo.uid, level: "1") {[weak self] result, respStatue in |
| 555 | + guard let self = self else { return } | ||
| 556 | + if respStatue == .success { | ||
| 557 | + showMessage(message: result as! String) | ||
| 558 | + self.reloadBlcok(self.commentModel == nil ? replyItemModel! : commentModel!) | ||
| 559 | + } | ||
| 560 | + } | ||
| 561 | + }, dissBlock: { toolbarView in}) | ||
| 562 | + } else { | ||
| 563 | + | ||
| 564 | + AlertTool.systemAlert(title: "确认删除该条\(commentModel != nil ? "评论" : "回复")吗?", message: "", cancelTitle: "取消", confirmTitle: "确定") {[weak self] index in | ||
| 565 | + guard let self = self else { return } | ||
| 566 | + if index == 1 { | ||
| 567 | + if commentModel != nil { | ||
| 568 | + showLoading(message: "") | ||
| 569 | + CNLiveShortVideoViewModel.requestCommentDelete(videoId: commentModel.topicId!, commentId: commentModel.commentId!) {[weak self] result, respStatue in | ||
| 570 | + guard let self = self else { return } | ||
| 571 | + if respStatue == .success { | ||
| 572 | + self.deleteBlock(self.commentModel!) | ||
| 573 | + } | ||
| 574 | + } | ||
| 575 | + } | ||
| 576 | + if replyItemModel != nil { | ||
| 577 | + showLoading(message: "") | ||
| 578 | + CNLiveShortVideoViewModel.requestCommentReplyDelete(replyId: replyItemModel.replyId!, commentId: replyItemModel.commentId!) {[weak self] result, respStatue in | ||
| 579 | + guard let self = self else { return } | ||
| 580 | + if respStatue == .success { | ||
| 581 | + self.deleteItemBlock(self.replyItemModel!) | ||
| 582 | + } | ||
| 583 | + } | ||
| 584 | + } | ||
| 498 | } | 585 | } |
| 499 | } | 586 | } |
| 500 | - }, dissBlock: { toolbarView in}) | 587 | + } |
| 501 | } | 588 | } |
| 502 | 589 | ||
| 503 | @objc func longPressGestureRecognizerAction(gestureRecognizer: UIGestureRecognizer) { | 590 | @objc func longPressGestureRecognizerAction(gestureRecognizer: UIGestureRecognizer) { |
| 504 | if gestureRecognizer.state == .began { | 591 | if gestureRecognizer.state == .began { |
| 505 | if commentModel.uid == UserInfoManager.shared.userInfo.uid || contentSid == UserInfoManager.shared.userInfo.uid { | 592 | if commentModel.uid == UserInfoManager.shared.userInfo.uid || contentSid == UserInfoManager.shared.userInfo.uid { |
| 506 | - CNLiveShortVideoViewModel.requestCommentDelete(videoId: videoId, commentId: commentModel.commentId!) {[weak self] result, respStatue in | 593 | + AlertTool.systemAlert(title: "确认删除该条评论吗?", message: "", cancelTitle: "取消", confirmTitle: "确定") {[weak self] index in |
| 507 | guard let self = self else { return } | 594 | guard let self = self else { return } |
| 508 | - if respStatue == .success { | ||
| 509 | - self.deleteBlock(self.commentModel!) | 595 | + if index == 1 { |
| 596 | + showLoading(message: "") | ||
| 597 | + CNLiveShortVideoViewModel.requestCommentDelete(videoId: self.videoId, commentId: self.commentModel.commentId!) {result, respStatue in | ||
| 598 | + if respStatue == .success { | ||
| 599 | + self.deleteBlock(self.commentModel!) | ||
| 600 | + } | ||
| 601 | + } | ||
| 510 | } | 602 | } |
| 511 | } | 603 | } |
| 512 | } | 604 | } |
| 513 | } | 605 | } |
| 514 | } | 606 | } |
| 515 | 607 | ||
| 516 | - @objc func likeActionMethod() { | ||
| 517 | - | 608 | + @objc func likeActionMethod(button: UIButton) { |
| 609 | + let contentId: String = commentModel == nil ? replyItemModel.replyId! : commentModel.commentId! | ||
| 610 | + let support: Bool = commentModel == nil ? replyItemModel.isPraised! : commentModel.isPraised! | ||
| 611 | + let isComment: Bool = commentModel != nil | ||
| 612 | + CNLiveShortVideoViewModel.requestCommentWithLike(contentId: contentId, support: support, isComment: isComment) {[weak self] result, respStatue in | ||
| 613 | + guard let self = self else { return } | ||
| 614 | + if respStatue == .success { | ||
| 615 | + showMessage(message: result as! String) | ||
| 616 | + if isComment { | ||
| 617 | + commentModel.isPraised = !commentModel.isPraised! | ||
| 618 | + if commentModel.isPraised! { | ||
| 619 | + commentModel.praiseCount = commentModel.praiseCount! + 1 | ||
| 620 | + } else { | ||
| 621 | + commentModel.praiseCount = commentModel.praiseCount! - 1 | ||
| 622 | + } | ||
| 623 | + button.setTitle("\(commentModel.praiseCount ?? 0)", for: .normal) | ||
| 624 | + button.isSelected = commentModel.isPraised! | ||
| 625 | + } else { | ||
| 626 | + replyItemModel.isPraised = !replyItemModel.isPraised! | ||
| 627 | + if replyItemModel.isPraised! { | ||
| 628 | + replyItemModel.praiseCount = replyItemModel.praiseCount! + 1 | ||
| 629 | + } else { | ||
| 630 | + replyItemModel.praiseCount = replyItemModel.praiseCount! - 1 | ||
| 631 | + } | ||
| 632 | + button.setTitle("\(replyItemModel.praiseCount ?? 0)", for: .normal) | ||
| 633 | + button.isSelected = replyItemModel.isPraised! | ||
| 634 | + } | ||
| 635 | + } | ||
| 636 | + } | ||
| 518 | } | 637 | } |
| 519 | 638 | ||
| 520 | required init?(coder: NSCoder) { | 639 | required init?(coder: NSCoder) { |
| @@ -534,7 +653,27 @@ extension CNLiveShortVideoCommentListTableViewCell { | @@ -534,7 +653,27 @@ extension CNLiveShortVideoCommentListTableViewCell { | ||
| 534 | guard let cell = tableView.dequeueReusableCell(withIdentifier: kShortVideoReplyListTableViewCellIdentifier) as? CNLiveShortVideoCommentListTableViewCell else { | 653 | guard let cell = tableView.dequeueReusableCell(withIdentifier: kShortVideoReplyListTableViewCellIdentifier) as? CNLiveShortVideoCommentListTableViewCell else { |
| 535 | return CNLiveShortVideoCommentListTableViewCell() | 654 | return CNLiveShortVideoCommentListTableViewCell() |
| 536 | } | 655 | } |
| 537 | - cell.setupWithReplyModel(replyModel: replyModel.replys[indexPath.row] ) | 656 | + cell.setupWithReplyModel(replyModel: replyModel.replys[indexPath.row]) |
| 657 | + cell.deleteItemBlock = {[weak self] commentModel in | ||
| 658 | + guard let self = self else { return } | ||
| 659 | + self.reloadBlcok(commentModel) | ||
| 660 | +// let tempArray = NSMutableArray(array: replyModel.replys) | ||
| 661 | +// let tempModel = commentModel as! ShortVideoHomeCommentRListItemModel | ||
| 662 | +// tempArray.forEach { itemModel in | ||
| 663 | +// let model: ShortVideoHomeCommentRListItemModel = itemModel as! ShortVideoHomeCommentRListItemModel | ||
| 664 | +// if tempModel.replyId == model.replyId { | ||
| 665 | +// let index = tempArray.index(of: model) | ||
| 666 | +// let indexPath_current: IndexPath = IndexPath(row: index, section: 0) | ||
| 667 | +// tempArray.remove(itemModel) | ||
| 668 | +// self.replyModel.replys = tempArray as! [ShortVideoHomeCommentRListItemModel] | ||
| 669 | +// self.tableView.beginUpdates() | ||
| 670 | +// self.tableView.deleteRows(at: [indexPath_current], with: .automatic) | ||
| 671 | +// self.tableView.endUpdates() | ||
| 672 | +// self.changeBlock(itemModel) | ||
| 673 | +// return | ||
| 674 | +// } | ||
| 675 | +// } | ||
| 676 | + } | ||
| 538 | return cell | 677 | return cell |
| 539 | } | 678 | } |
| 540 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | 679 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { |
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoListTableViewCell.swift
| @@ -15,7 +15,7 @@ protocol CNLiveShortVideoListTableViewCellDelegate : AnyObject { | @@ -15,7 +15,7 @@ protocol CNLiveShortVideoListTableViewCellDelegate : AnyObject { | ||
| 15 | func commentActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) | 15 | func commentActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) |
| 16 | func shareActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) | 16 | func shareActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) |
| 17 | func iconActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) | 17 | func iconActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) |
| 18 | - func faviActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) | 18 | + func faviActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: APButton) |
| 19 | func listActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) | 19 | func listActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) |
| 20 | func payActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) | 20 | func payActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) |
| 21 | } | 21 | } |
| @@ -186,9 +186,14 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { | @@ -186,9 +186,14 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { | ||
| 186 | likeBtn.isSelected = model.tool!.liked | 186 | likeBtn.isSelected = model.tool!.liked |
| 187 | titleLabel.text = model.shortTitle | 187 | titleLabel.text = model.shortTitle |
| 188 | descLabel.text = model.title | 188 | descLabel.text = model.title |
| 189 | + faviBtn.isHidden = model.albumMsgModel!.collection | ||
| 189 | listBtn.setTitle(model.albumMsgModel?.albumName, for: .normal) | 190 | listBtn.setTitle(model.albumMsgModel?.albumName, for: .normal) |
| 190 | 191 | ||
| 191 | - hiddenView(isHidden: homeModel.product!.albumProductType != "0") | 192 | + |
| 193 | + | ||
| 194 | + | ||
| 195 | + | ||
| 196 | + | ||
| 192 | 197 | ||
| 193 | let imageV: UIImageView = payView.viewWithTag(1000) as! UIImageView | 198 | let imageV: UIImageView = payView.viewWithTag(1000) as! UIImageView |
| 194 | imageV.kf.indicatorType = .activity | 199 | imageV.kf.indicatorType = .activity |
| @@ -198,12 +203,24 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { | @@ -198,12 +203,24 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { | ||
| 198 | let timeL: UILabel = payView.viewWithTag(1002) as! UILabel | 203 | let timeL: UILabel = payView.viewWithTag(1002) as! UILabel |
| 199 | timeL.text = model.duration | 204 | timeL.text = model.duration |
| 200 | let payButton: APButton = payView.viewWithTag(1003) as! APButton | 205 | let payButton: APButton = payView.viewWithTag(1003) as! APButton |
| 201 | - if model.product?.albumProductType != "0" { | ||
| 202 | - payButton.setTitle("\(model.product!.point)积分解锁全集", for: .normal) | 206 | + |
| 207 | + if model.product?.check == true { | ||
| 208 | + //免费 | ||
| 209 | + if model.product?.albumProductType == "0" { | ||
| 210 | + hiddenView(isHidden: true) | ||
| 211 | + } else { | ||
| 212 | + hiddenView(isHidden: false) | ||
| 213 | + payButton.setTitle("\(model.product!.point)积分解锁全集", for: .normal) | ||
| 214 | + } | ||
| 215 | + } else { | ||
| 216 | + //需要付费 | ||
| 217 | + if model.product?.albumProductType == "0" { | ||
| 218 | + hiddenView(isHidden: true) | ||
| 219 | + } else { | ||
| 220 | + hiddenView(isHidden: false) | ||
| 221 | + payButton.setTitle("\(model.product!.point)积分解锁全集", for: .normal) | ||
| 222 | + } | ||
| 203 | } | 223 | } |
| 204 | -// if model.product?.albumProductType == "2" { | ||
| 205 | -// payButton.setTitle("\(Double(model.product!.iosOriginalRmb)!/100.0)元解锁全集", for: .normal) | ||
| 206 | -// } | ||
| 207 | } | 224 | } |
| 208 | 225 | ||
| 209 | open func hiddenView(isHidden: Bool) { | 226 | open func hiddenView(isHidden: Bool) { |
| @@ -219,7 +236,7 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { | @@ -219,7 +236,7 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { | ||
| 219 | self.payView.isHidden = false | 236 | self.payView.isHidden = false |
| 220 | } else { | 237 | } else { |
| 221 | self.commentBtn.isHidden = false | 238 | self.commentBtn.isHidden = false |
| 222 | - self.faviBtn.isHidden = false | 239 | + self.faviBtn.isHidden = homeModel.albumMsgModel!.collection |
| 223 | self.shareBtn.isHidden = false | 240 | self.shareBtn.isHidden = false |
| 224 | self.likeBtn.isHidden = false | 241 | self.likeBtn.isHidden = false |
| 225 | self.iconBtn.isHidden = false | 242 | self.iconBtn.isHidden = false |
| @@ -321,7 +338,7 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { | @@ -321,7 +338,7 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { | ||
| 321 | } | 338 | } |
| 322 | 339 | ||
| 323 | @objc func faviMothod(button: UIButton) { | 340 | @objc func faviMothod(button: UIButton) { |
| 324 | - self.delegate.faviActionMethod(viewcell: self, button: button) | 341 | + self.delegate.faviActionMethod(viewcell: self, button: button as! APButton) |
| 325 | } | 342 | } |
| 326 | 343 | ||
| 327 | @objc func listMethod(button: UIButton) { | 344 | @objc func listMethod(button: UIButton) { |
metaCode/Classes/Main/VideoPage/ViewModel/CNLiveShortVideoViewModel.swift
| @@ -11,6 +11,9 @@ import QMUIKit | @@ -11,6 +11,9 @@ import QMUIKit | ||
| 11 | typealias resultShortVideoBlock = (_ result: Any,_ respStatue :CNLiveMineResponseType) -> Void | 11 | typealias resultShortVideoBlock = (_ result: Any,_ respStatue :CNLiveMineResponseType) -> Void |
| 12 | class CNLiveShortVideoViewModel: NSObject { | 12 | class CNLiveShortVideoViewModel: NSObject { |
| 13 | 13 | ||
| 14 | + static let appId_c : String = APPId_wjj | ||
| 15 | + static let appKey_c : String = APPKey_wjj | ||
| 16 | + | ||
| 14 | /// 获取短视频数据 | 17 | /// 获取短视频数据 |
| 15 | /// - Parameters: | 18 | /// - Parameters: |
| 16 | /// - aid: 专辑 id | 19 | /// - aid: 专辑 id |
| @@ -23,8 +26,8 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -23,8 +26,8 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 23 | param.setValue("10", forKey: "pageSize") | 26 | param.setValue("10", forKey: "pageSize") |
| 24 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | 27 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 25 | let custom_param = NSMutableDictionary() | 28 | let custom_param = NSMutableDictionary() |
| 26 | - custom_param.setValue(APPId_wjj, forKey: "appId") | ||
| 27 | - custom_param.setValue(APPKey_wjj, forKey: "appKey") | 29 | + custom_param.setValue(appId_c, forKey: "appId") |
| 30 | + custom_param.setValue(appKey_c, forKey: "appKey") | ||
| 28 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 31 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 29 | CNLiveNetworking.setupShowDataResult(false) | 32 | CNLiveNetworking.setupShowDataResult(false) |
| 30 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 33 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| @@ -92,8 +95,8 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -92,8 +95,8 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 92 | param.setValue(aid, forKey: "aid") | 95 | param.setValue(aid, forKey: "aid") |
| 93 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | 96 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 94 | let custom_param = NSMutableDictionary() | 97 | let custom_param = NSMutableDictionary() |
| 95 | - custom_param.setValue(APPId_wjj, forKey: "appId") | ||
| 96 | - custom_param.setValue(APPKey_wjj, forKey: "appKey") | 98 | + custom_param.setValue( appId_c, forKey: "appId") |
| 99 | + custom_param.setValue(appKey_c, forKey: "appKey") | ||
| 97 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 100 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 98 | CNLiveNetworking.setupShowDataResult(false) | 101 | CNLiveNetworking.setupShowDataResult(false) |
| 99 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 102 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| @@ -126,28 +129,36 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -126,28 +129,36 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 126 | } | 129 | } |
| 127 | 130 | ||
| 128 | 131 | ||
| 129 | - /// 短视频点赞功能 | 132 | + /// 短视频点赞分享功能 |
| 130 | /// - Parameters: | 133 | /// - Parameters: |
| 131 | /// - contentId: 点赞内容 id | 134 | /// - contentId: 点赞内容 id |
| 132 | /// - contentTitle: 点赞的视频标题 | 135 | /// - contentTitle: 点赞的视频标题 |
| 133 | /// - support: 1:点赞 0:取消点赞 | 136 | /// - support: 1:点赞 0:取消点赞 |
| 137 | + /// - isShare: 是否是分享 | ||
| 134 | /// - reultShortVideoBlock: 返回 | 138 | /// - reultShortVideoBlock: 返回 |
| 135 | - static func requestRankWithLike(contentId: String, contentTitle: String, contentSid: String, support: Bool,tagName: String,reultShortVideoBlock: @escaping resultShortVideoBlock) { | 139 | + static func requestRankWithLike(contentId: String, contentTitle: String, contentSid: String, support: Bool,isShare: Bool,reultShortVideoBlock: @escaping resultShortVideoBlock) { |
| 136 | let param = NSMutableDictionary() | 140 | let param = NSMutableDictionary() |
| 137 | - param.setValue(contentId, forKey: "contentId") | ||
| 138 | - param.setValue(APPId, forKey: "appId") | 141 | + if isShare { |
| 142 | + param.setValue("\(contentId)_share", forKey: "contentId") | ||
| 143 | + param.setValue("1", forKey: "support") | ||
| 144 | + } else { | ||
| 145 | + param.setValue(contentId, forKey: "contentId") | ||
| 146 | + param.setValue(support ? "0":"1", forKey: "support") | ||
| 147 | + } | ||
| 148 | + param.setValue(CNLiveEnvironmentManager.shared.appId_wjj, forKey: "appId") | ||
| 139 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | 149 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 140 | param.setValue(contentTitle, forKey: "contentTitle") | 150 | param.setValue(contentTitle, forKey: "contentTitle") |
| 141 | param.setValue(contentSid, forKey: "contentSid") | 151 | param.setValue(contentSid, forKey: "contentSid") |
| 142 | - param.setValue(support ? "1":"0", forKey: "support") | ||
| 143 | param.setValue("false", forKey: "isRank") | 152 | param.setValue("false", forKey: "isRank") |
| 144 | param.setValue("1", forKey: "isUgc") | 153 | param.setValue("1", forKey: "isUgc") |
| 145 | - param.setValue(tagName, forKey: "contentTag") | 154 | + param.setValue("i", forKey: "plat") |
| 155 | + param.setValue("", forKey: "contentTag") | ||
| 146 | let custom_param = NSMutableDictionary() | 156 | let custom_param = NSMutableDictionary() |
| 147 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 148 | - custom_param.setValue(APPKey, forKey: "appKey") | 157 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId_wjj, forKey: "appId") |
| 158 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey_wjj, forKey: "appKey") | ||
| 149 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 159 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 150 | CNLiveNetworking.setupShowDataResult(false) | 160 | CNLiveNetworking.setupShowDataResult(false) |
| 161 | + CNLiveNetworking.setupShowResult(true) | ||
| 151 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 162 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 152 | CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseTokenUrl+"/support/supportBySpIdForRank/insert", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | 163 | CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseTokenUrl+"/support/supportBySpIdForRank/insert", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in |
| 153 | hiddenLoading() | 164 | hiddenLoading() |
| @@ -155,7 +166,51 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -155,7 +166,51 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 155 | let resp = result as! NSDictionary | 166 | let resp = result as! NSDictionary |
| 156 | let errorCode = "\(resp["errorCode"] ?? "0")" | 167 | let errorCode = "\(resp["errorCode"] ?? "0")" |
| 157 | if (errorCode == "0") { | 168 | if (errorCode == "0") { |
| 158 | - reultShortVideoBlock(support ? "取消点赞成功" : "点赞成功", .success) | 169 | + if isShare { |
| 170 | + reultShortVideoBlock("分享成功", .success) | ||
| 171 | + } else { | ||
| 172 | + reultShortVideoBlock(support ? "取消点赞成功" : "点赞成功", .success) | ||
| 173 | + } | ||
| 174 | + } else { | ||
| 175 | + showMessage(message: resp["errorMessage"] as! String) | ||
| 176 | + reultShortVideoBlock(NSNull(),.failed) | ||
| 177 | + } | ||
| 178 | + } else { | ||
| 179 | + if CNLiveNetworking.isNetworking() { | ||
| 180 | + showMessage(message: "请求失败") | ||
| 181 | + reultShortVideoBlock(NSNull(),.failed) | ||
| 182 | + } else { | ||
| 183 | + showMessage(message: "似乎与网络断开链接") | ||
| 184 | + reultShortVideoBlock(NSNull(),.noNetwork) | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + /// 对专辑进行收藏 | ||
| 191 | + /// - Parameters: | ||
| 192 | + /// - aid: 专辑 id | ||
| 193 | + /// - type: 是否收藏 | ||
| 194 | + /// - reultShortVideoBlock: 返回 | ||
| 195 | + static func requestCollect(aid: String, type: Bool,reultShortVideoBlock: @escaping resultShortVideoBlock) { | ||
| 196 | + let param = NSMutableDictionary() | ||
| 197 | + param.setValue(aid, forKey: "aid") | ||
| 198 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | ||
| 199 | + param.setValue(type ? "2": "1", forKey: "type") | ||
| 200 | + let custom_param = NSMutableDictionary() | ||
| 201 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId_wjj, forKey: "appId") | ||
| 202 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey_wjj, forKey: "appKey") | ||
| 203 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | ||
| 204 | + CNLiveNetworking.setupShowDataResult(false) | ||
| 205 | + CNLiveNetworking.setupShowDataResult(true) | ||
| 206 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 207 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseCMSUrl+"/contentApi/albumCollect", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | ||
| 208 | + hiddenLoading() | ||
| 209 | + if (error == nil) { | ||
| 210 | + let resp = result as! NSDictionary | ||
| 211 | + let errorCode = "\(resp["errorCode"] ?? "0")" | ||
| 212 | + if (errorCode == "0") { | ||
| 213 | + reultShortVideoBlock(type ? "取消收藏成功" : "收藏成功", .success) | ||
| 159 | } else { | 214 | } else { |
| 160 | showMessage(message: resp["errorMessage"] as! String) | 215 | showMessage(message: resp["errorMessage"] as! String) |
| 161 | reultShortVideoBlock(NSNull(),.failed) | 216 | reultShortVideoBlock(NSNull(),.failed) |
| @@ -172,6 +227,8 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -172,6 +227,8 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 172 | } | 227 | } |
| 173 | } | 228 | } |
| 174 | 229 | ||
| 230 | + | ||
| 231 | + | ||
| 175 | //!!!: 评论相关 | 232 | //!!!: 评论相关 |
| 176 | 233 | ||
| 177 | /// 获取评论列表数 | 234 | /// 获取评论列表数 |
| @@ -183,13 +240,13 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -183,13 +240,13 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 183 | let param = NSMutableDictionary() | 240 | let param = NSMutableDictionary() |
| 184 | param.setValue(pid, forKey: "topicId") | 241 | param.setValue(pid, forKey: "topicId") |
| 185 | param.setValue("i", forKey: "plat") | 242 | param.setValue("i", forKey: "plat") |
| 186 | - param.setValue(APPId, forKey: "appId") | 243 | + param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 187 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | 244 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 188 | param.setValue("\(page)", forKey: "seqId") | 245 | param.setValue("\(page)", forKey: "seqId") |
| 189 | param.setValue("10", forKey: "count") | 246 | param.setValue("10", forKey: "count") |
| 190 | let custom_param = NSMutableDictionary() | 247 | let custom_param = NSMutableDictionary() |
| 191 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 192 | - custom_param.setValue(APPKey, forKey: "appKey") | 248 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 249 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 193 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 250 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 194 | CNLiveNetworking.setupShowDataResult(false) | 251 | CNLiveNetworking.setupShowDataResult(false) |
| 195 | CNLiveNetworking.setupShowResult(true) | 252 | CNLiveNetworking.setupShowResult(true) |
| @@ -231,14 +288,14 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -231,14 +288,14 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 231 | static func requestCommentWithSend(videoId: String, comment: String, isAuthor: Bool,reultShortVideoBlock: @escaping resultShortVideoBlock) { | 288 | static func requestCommentWithSend(videoId: String, comment: String, isAuthor: Bool,reultShortVideoBlock: @escaping resultShortVideoBlock) { |
| 232 | let param = NSMutableDictionary() | 289 | let param = NSMutableDictionary() |
| 233 | param.setValue(videoId, forKey: "topicId") | 290 | param.setValue(videoId, forKey: "topicId") |
| 234 | - param.setValue(APPId, forKey: "appId") | 291 | + param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 235 | param.setValue("i", forKey: "plat") | 292 | param.setValue("i", forKey: "plat") |
| 236 | param.setValue(comment.qmui_trim, forKey: "comment") | 293 | param.setValue(comment.qmui_trim, forKey: "comment") |
| 237 | param.setValue(isAuthor ? "1" : "0", forKey: "isAuthor") | 294 | param.setValue(isAuthor ? "1" : "0", forKey: "isAuthor") |
| 238 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | 295 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 239 | let custom_param = NSMutableDictionary() | 296 | let custom_param = NSMutableDictionary() |
| 240 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 241 | - custom_param.setValue(APPKey, forKey: "appKey") | 297 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 298 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 242 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 299 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 243 | CNLiveNetworking.setupShowDataResult(false) | 300 | CNLiveNetworking.setupShowDataResult(false) |
| 244 | CNLiveNetworking.setupDSRequest(false) | 301 | CNLiveNetworking.setupDSRequest(false) |
| @@ -279,15 +336,15 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -279,15 +336,15 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 279 | static func requestCommentWithReply(commentId: String, comment: String, toSid: String, fromSid: String, level: String,reultShortVideoBlock: @escaping resultShortVideoBlock) { | 336 | static func requestCommentWithReply(commentId: String, comment: String, toSid: String, fromSid: String, level: String,reultShortVideoBlock: @escaping resultShortVideoBlock) { |
| 280 | let param = NSMutableDictionary() | 337 | let param = NSMutableDictionary() |
| 281 | param.setValue(commentId, forKey: "commentId") | 338 | param.setValue(commentId, forKey: "commentId") |
| 282 | - param.setValue(APPId, forKey: "appId") | 339 | + param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 283 | param.setValue(comment, forKey: "comment") | 340 | param.setValue(comment, forKey: "comment") |
| 284 | param.setValue(toSid, forKey: "toSid") | 341 | param.setValue(toSid, forKey: "toSid") |
| 285 | param.setValue(fromSid, forKey: "fromSid") | 342 | param.setValue(fromSid, forKey: "fromSid") |
| 286 | param.setValue(level, forKey: "level") | 343 | param.setValue(level, forKey: "level") |
| 287 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | 344 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 288 | let custom_param = NSMutableDictionary() | 345 | let custom_param = NSMutableDictionary() |
| 289 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 290 | - custom_param.setValue(APPKey, forKey: "appKey") | 346 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 347 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 291 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 348 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 292 | CNLiveNetworking.setupShowDataResult(false) | 349 | CNLiveNetworking.setupShowDataResult(false) |
| 293 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 350 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| @@ -326,8 +383,8 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -326,8 +383,8 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 326 | param.setValue("\(page)", forKey: "seqId")//从 0 开始 | 383 | param.setValue("\(page)", forKey: "seqId")//从 0 开始 |
| 327 | param.setValue("10", forKey: "count") | 384 | param.setValue("10", forKey: "count") |
| 328 | let custom_param = NSMutableDictionary() | 385 | let custom_param = NSMutableDictionary() |
| 329 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 330 | - custom_param.setValue(APPKey, forKey: "appKey") | 386 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 387 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 331 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 388 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 332 | CNLiveNetworking.setupShowDataResult(false) | 389 | CNLiveNetworking.setupShowDataResult(false) |
| 333 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 390 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| @@ -374,12 +431,12 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -374,12 +431,12 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 374 | static func requestCommentDelete(videoId: String, commentId: String, reultShortVideoBlock: @escaping resultShortVideoBlock) { | 431 | static func requestCommentDelete(videoId: String, commentId: String, reultShortVideoBlock: @escaping resultShortVideoBlock) { |
| 375 | let param = NSMutableDictionary() | 432 | let param = NSMutableDictionary() |
| 376 | param.setValue(commentId, forKey: "commentId") | 433 | param.setValue(commentId, forKey: "commentId") |
| 377 | - param.setValue(APPId, forKey: "appId") | 434 | + param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 378 | param.setValue(videoId, forKey: "topicId") | 435 | param.setValue(videoId, forKey: "topicId") |
| 379 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | 436 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 380 | let custom_param = NSMutableDictionary() | 437 | let custom_param = NSMutableDictionary() |
| 381 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 382 | - custom_param.setValue(APPKey, forKey: "appKey") | 438 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 439 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 383 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 440 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 384 | CNLiveNetworking.setupShowDataResult(false) | 441 | CNLiveNetworking.setupShowDataResult(false) |
| 385 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 442 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| @@ -414,12 +471,12 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -414,12 +471,12 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 414 | static func requestCommentReplyDelete(replyId: String, commentId: String, reultShortVideoBlock: @escaping resultShortVideoBlock) { | 471 | static func requestCommentReplyDelete(replyId: String, commentId: String, reultShortVideoBlock: @escaping resultShortVideoBlock) { |
| 415 | let param = NSMutableDictionary() | 472 | let param = NSMutableDictionary() |
| 416 | param.setValue(commentId, forKey: "commentId") | 473 | param.setValue(commentId, forKey: "commentId") |
| 417 | - param.setValue(APPId, forKey: "appId") | 474 | + param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 418 | param.setValue(replyId, forKey: "replyId") | 475 | param.setValue(replyId, forKey: "replyId") |
| 419 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | 476 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 420 | let custom_param = NSMutableDictionary() | 477 | let custom_param = NSMutableDictionary() |
| 421 | - custom_param.setValue(APPId, forKey: "appId") | ||
| 422 | - custom_param.setValue(APPKey, forKey: "appKey") | 478 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId") |
| 479 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey") | ||
| 423 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 480 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 424 | CNLiveNetworking.setupShowDataResult(false) | 481 | CNLiveNetworking.setupShowDataResult(false) |
| 425 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 482 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| @@ -446,4 +503,52 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -446,4 +503,52 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 446 | } | 503 | } |
| 447 | } | 504 | } |
| 448 | 505 | ||
| 506 | + | ||
| 507 | + /// 对回复和评论进行点赞 | ||
| 508 | + /// - Parameters: | ||
| 509 | + /// - contentId: 内容 id | ||
| 510 | + /// - support: 是否点赞 0 取消 1点赞 | ||
| 511 | + /// - isComment: 是不是对评论进行点赞 | ||
| 512 | + /// - reultShortVideoBlock: 返回 | ||
| 513 | + static func requestCommentWithLike(contentId: String, support: Bool,isComment: Bool,reultShortVideoBlock: @escaping resultShortVideoBlock) { | ||
| 514 | + let param = NSMutableDictionary() | ||
| 515 | + if isComment { | ||
| 516 | + param.setValue("ugc_hd_comment:\(contentId)", forKey: "id") | ||
| 517 | + } else { | ||
| 518 | + param.setValue("ugc_hd_reply:\(contentId)", forKey: "id") | ||
| 519 | + } | ||
| 520 | + param.setValue(support ? "0":"1", forKey: "support") | ||
| 521 | + param.setValue(CNLiveEnvironmentManager.shared.appId_wjj, forKey: "appId") | ||
| 522 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | ||
| 523 | + param.setValue("i", forKey: "plat") | ||
| 524 | + let custom_param = NSMutableDictionary() | ||
| 525 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appId_wjj, forKey: "appId") | ||
| 526 | + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey_wjj, forKey: "appKey") | ||
| 527 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | ||
| 528 | + CNLiveNetworking.setupShowDataResult(false) | ||
| 529 | + CNLiveNetworking.setupShowResult(true) | ||
| 530 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 531 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseTokenUrl+"/support/supportBySpId/insert", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | ||
| 532 | + hiddenLoading() | ||
| 533 | + if (error == nil) { | ||
| 534 | + let resp = result as! NSDictionary | ||
| 535 | + let errorCode = "\(resp["errorCode"] ?? "0")" | ||
| 536 | + if (errorCode == "0") { | ||
| 537 | + reultShortVideoBlock(support ? "取消点赞成功" : "点赞成功", .success) | ||
| 538 | + } else { | ||
| 539 | + showMessage(message: resp["errorMessage"] as! String) | ||
| 540 | + reultShortVideoBlock(NSNull(),.failed) | ||
| 541 | + } | ||
| 542 | + } else { | ||
| 543 | + if CNLiveNetworking.isNetworking() { | ||
| 544 | + showMessage(message: "请求失败") | ||
| 545 | + reultShortVideoBlock(NSNull(),.failed) | ||
| 546 | + } else { | ||
| 547 | + showMessage(message: "似乎与网络断开链接") | ||
| 548 | + reultShortVideoBlock(NSNull(),.noNetwork) | ||
| 549 | + } | ||
| 550 | + } | ||
| 551 | + } | ||
| 552 | + } | ||
| 553 | + | ||
| 449 | } | 554 | } |
metaCode/Supporting Files/Assets.xcassets/Video/short_comment_zan_nomal.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "short_comment_zan_nomal@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "short_comment_zan_nomal@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/Video/short_comment_zan_nomal.imageset/short_comment_zan_nomal@2x.png
0 → 100644
1.42 KB
metaCode/Supporting Files/Assets.xcassets/Video/short_comment_zan_nomal.imageset/short_comment_zan_nomal@3x.png
0 → 100644
2.64 KB
metaCode/Supporting Files/Assets.xcassets/Video/short_comment_zan_select.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "short_comment_zan_select@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "short_comment_zan_select@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/Video/short_comment_zan_select.imageset/short_comment_zan_select@2x.png
0 → 100644
1.39 KB
metaCode/Supporting Files/Assets.xcassets/Video/short_comment_zan_select.imageset/short_comment_zan_select@3x.png
0 → 100644
2.52 KB
metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_close.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "short_video_comment_close@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "short_video_comment_close@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/Video/short_video_comment_close.imageset/short_video_comment_close@2x.png
0 → 100644
572 Bytes
metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_close.imageset/short_video_comment_close@3x.png
0 → 100644
1.03 KB
metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_empty.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "short_video_comment_empty@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "short_video_comment_empty@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/Video/short_video_comment_empty.imageset/short_video_comment_empty@2x.png
0 → 100644
21.9 KB
metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_empty.imageset/short_video_comment_empty@3x.png
0 → 100644
48.1 KB
metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_ower.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "short_video_comment_ower@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "short_video_comment_ower@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/Video/short_video_comment_ower.imageset/short_video_comment_ower@2x.png
0 → 100644
1.44 KB
metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_ower.imageset/short_video_comment_ower@3x.png
0 → 100644
2.52 KB