Commit 5870efa88920e724e969e4398d691acb6d1ce201

Authored by liushiyu
1 parent f89b8f7b

提示toast 添加修改头像逻辑

Showing 23 changed files with 557 additions and 290 deletions
@@ -6,6 +6,7 @@ source 'https://cdn.cocoapods.org' @@ -6,6 +6,7 @@ source 'https://cdn.cocoapods.org'
6 6
7 source 'http://bj.gitlab.cnlive.com/ios-team/CNLiveRepos.git' 7 source 'http://bj.gitlab.cnlive.com/ios-team/CNLiveRepos.git'
8 source 'http://bj.gitlab.cnlive.com/DSIOSTeam/DSSpecRepos.git' 8 source 'http://bj.gitlab.cnlive.com/DSIOSTeam/DSSpecRepos.git'
  9 +use_frameworks!
9 10
10 target 'metaCode' do 11 target 'metaCode' do
11 # Comment the next line if you don't want to use dynamic frameworks 12 # Comment the next line if you don't want to use dynamic frameworks
@@ -26,10 +27,10 @@ target 'metaCode' do @@ -26,10 +27,10 @@ target 'metaCode' do
26 pod 'MBProgressHUD' 27 pod 'MBProgressHUD'
27 #模型转换工具 28 #模型转换工具
28 pod 'HandyJSON' 29 pod 'HandyJSON'
29 - #轻量级缓存工具  
30 - pod 'SwiftyUserDefaults'  
31 #图片视频选择器 30 #图片视频选择器
32 pod 'HXPHPicker' 31 pod 'HXPHPicker'
  32 + #七牛
  33 + pod 'Qiniu'
33 #加载GIF 34 #加载GIF
34 pod 'SwiftGifOrigin', '~> 1.7.0' 35 pod 'SwiftGifOrigin', '~> 1.7.0'
35 36
metaCode.xcodeproj/project.pbxproj
@@ -20,10 +20,12 @@ @@ -20,10 +20,12 @@
20 790D01A52A2DF65E00C5978D /* CNLiveLoginPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790D01A42A2DF65E00C5978D /* CNLiveLoginPickerView.swift */; }; 20 790D01A52A2DF65E00C5978D /* CNLiveLoginPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790D01A42A2DF65E00C5978D /* CNLiveLoginPickerView.swift */; };
21 790D01A72A2DF84C00C5978D /* countries.plist in Resources */ = {isa = PBXBuildFile; fileRef = 790D01A62A2DF84C00C5978D /* countries.plist */; }; 21 790D01A72A2DF84C00C5978D /* countries.plist in Resources */ = {isa = PBXBuildFile; fileRef = 790D01A62A2DF84C00C5978D /* countries.plist */; };
22 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A3B2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift */; }; 22 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A3B2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift */; };
23 - 79282A3E2A2EFDA000B5F8CF /* CNLiveLoginModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A3D2A2EFDA000B5F8CF /* CNLiveLoginModel.swift */; };  
24 79282A402A2F055100B5F8CF /* CNLiveConfigUserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A3F2A2F055100B5F8CF /* CNLiveConfigUserInfo.swift */; }; 23 79282A402A2F055100B5F8CF /* CNLiveConfigUserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A3F2A2F055100B5F8CF /* CNLiveConfigUserInfo.swift */; };
25 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A432A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift */; }; 24 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A432A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift */; };
26 79282A462A2F457D00B5F8CF /* CNLiveMineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A452A2F457D00B5F8CF /* CNLiveMineViewController.swift */; }; 25 79282A462A2F457D00B5F8CF /* CNLiveMineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A452A2F457D00B5F8CF /* CNLiveMineViewController.swift */; };
  26 + 792E57D72A3AA2AC005834DB /* CNLiveCommonJsonUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 792E57D62A3AA2AC005834DB /* CNLiveCommonJsonUtil.swift */; };
  27 + 792E57D92A3AA2F2005834DB /* CNLiveCommonBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 792E57D82A3AA2F2005834DB /* CNLiveCommonBaseModel.swift */; };
  28 + 792E57DB2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 792E57DA2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift */; };
27 79396EED2A319F220053E1AF /* NSObject+CNLiveCurrentVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EEC2A319F220053E1AF /* NSObject+CNLiveCurrentVC.swift */; }; 29 79396EED2A319F220053E1AF /* NSObject+CNLiveCurrentVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EEC2A319F220053E1AF /* NSObject+CNLiveCurrentVC.swift */; };
28 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */; }; 30 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */; };
29 796398942A260C0100D045EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963988D2A260C0100D045EB /* AppDelegate.swift */; }; 31 796398942A260C0100D045EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963988D2A260C0100D045EB /* AppDelegate.swift */; };
@@ -35,7 +37,6 @@ @@ -35,7 +37,6 @@
35 798A44EE2A305AAC00815935 /* CNLiveBaseNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44ED2A305AAC00815935 /* CNLiveBaseNavigationController.swift */; }; 37 798A44EE2A305AAC00815935 /* CNLiveBaseNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44ED2A305AAC00815935 /* CNLiveBaseNavigationController.swift */; };
36 798A44F02A305BC200815935 /* UIButton+CNLiveExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44EF2A305BC200815935 /* UIButton+CNLiveExtension.swift */; }; 38 798A44F02A305BC200815935 /* UIButton+CNLiveExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44EF2A305BC200815935 /* UIButton+CNLiveExtension.swift */; };
37 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44F12A30674200815935 /* CNLiveMineSubBodyListView.swift */; }; 39 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44F12A30674200815935 /* CNLiveMineSubBodyListView.swift */; };
38 - 798A44F62A3077ED00815935 /* CNLiveTips.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44F42A3077ED00815935 /* CNLiveTips.swift */; };  
39 798A44F72A3077ED00815935 /* CNLiveHotButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44F52A3077ED00815935 /* CNLiveHotButton.swift */; }; 40 798A44F72A3077ED00815935 /* CNLiveHotButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44F52A3077ED00815935 /* CNLiveHotButton.swift */; };
40 798A44F92A30835400815935 /* CNLiveHelpFeedBackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44F82A30835400815935 /* CNLiveHelpFeedBackViewController.swift */; }; 41 798A44F92A30835400815935 /* CNLiveHelpFeedBackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44F82A30835400815935 /* CNLiveHelpFeedBackViewController.swift */; };
41 798A44FB2A30999900815935 /* CNLiveAlertTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44FA2A30999900815935 /* CNLiveAlertTool.swift */; }; 42 798A44FB2A30999900815935 /* CNLiveAlertTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44FA2A30999900815935 /* CNLiveAlertTool.swift */; };
@@ -44,7 +45,6 @@ @@ -44,7 +45,6 @@
44 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; 45 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; };
45 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; 46 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; };
46 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */; }; 47 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */; };
47 - 79F4B1182A32C5FA00993C03 /* CNLiveBaseMoel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1172A32C5FA00993C03 /* CNLiveBaseMoel.swift */; };  
48 79F4B11A2A32F21400993C03 /* CNLiveMineNickViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */; }; 48 79F4B11A2A32F21400993C03 /* CNLiveMineNickViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */; };
49 79F4B11C2A33036E00993C03 /* CNLiveMineInfoAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B11B2A33036E00993C03 /* CNLiveMineInfoAlertView.swift */; }; 49 79F4B11C2A33036E00993C03 /* CNLiveMineInfoAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B11B2A33036E00993C03 /* CNLiveMineInfoAlertView.swift */; };
50 7C2703302A36CBE30061EC50 /* CNCertificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */; }; 50 7C2703302A36CBE30061EC50 /* CNCertificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */; };
@@ -110,10 +110,12 @@ @@ -110,10 +110,12 @@
110 790D01A42A2DF65E00C5978D /* CNLiveLoginPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveLoginPickerView.swift; sourceTree = "<group>"; }; 110 790D01A42A2DF65E00C5978D /* CNLiveLoginPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveLoginPickerView.swift; sourceTree = "<group>"; };
111 790D01A62A2DF84C00C5978D /* countries.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = countries.plist; sourceTree = "<group>"; }; 111 790D01A62A2DF84C00C5978D /* countries.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = countries.plist; sourceTree = "<group>"; };
112 79282A3B2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSString+CNLiveExtensions.swift"; sourceTree = "<group>"; }; 112 79282A3B2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSString+CNLiveExtensions.swift"; sourceTree = "<group>"; };
113 - 79282A3D2A2EFDA000B5F8CF /* CNLiveLoginModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveLoginModel.swift; sourceTree = "<group>"; };  
114 79282A3F2A2F055100B5F8CF /* CNLiveConfigUserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveConfigUserInfo.swift; sourceTree = "<group>"; }; 113 79282A3F2A2F055100B5F8CF /* CNLiveConfigUserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveConfigUserInfo.swift; sourceTree = "<group>"; };
115 79282A432A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveLoginAuthView.swift; sourceTree = "<group>"; }; 114 79282A432A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveLoginAuthView.swift; sourceTree = "<group>"; };
116 79282A452A2F457D00B5F8CF /* CNLiveMineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineViewController.swift; sourceTree = "<group>"; }; 115 79282A452A2F457D00B5F8CF /* CNLiveMineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineViewController.swift; sourceTree = "<group>"; };
  116 + 792E57D62A3AA2AC005834DB /* CNLiveCommonJsonUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCommonJsonUtil.swift; sourceTree = "<group>"; };
  117 + 792E57D82A3AA2F2005834DB /* CNLiveCommonBaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCommonBaseModel.swift; sourceTree = "<group>"; };
  118 + 792E57DA2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCommonQiniuTool.swift; sourceTree = "<group>"; };
117 79396EEC2A319F220053E1AF /* NSObject+CNLiveCurrentVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveCurrentVC.swift"; sourceTree = "<group>"; }; 119 79396EEC2A319F220053E1AF /* NSObject+CNLiveCurrentVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveCurrentVC.swift"; sourceTree = "<group>"; };
118 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInfoShowViewController.swift; sourceTree = "<group>"; }; 120 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInfoShowViewController.swift; sourceTree = "<group>"; };
119 7963988D2A260C0100D045EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 121 7963988D2A260C0100D045EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@@ -125,7 +127,6 @@ @@ -125,7 +127,6 @@
125 798A44ED2A305AAC00815935 /* CNLiveBaseNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveBaseNavigationController.swift; sourceTree = "<group>"; }; 127 798A44ED2A305AAC00815935 /* CNLiveBaseNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveBaseNavigationController.swift; sourceTree = "<group>"; };
126 798A44EF2A305BC200815935 /* UIButton+CNLiveExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+CNLiveExtension.swift"; sourceTree = "<group>"; }; 128 798A44EF2A305BC200815935 /* UIButton+CNLiveExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+CNLiveExtension.swift"; sourceTree = "<group>"; };
127 798A44F12A30674200815935 /* CNLiveMineSubBodyListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineSubBodyListView.swift; sourceTree = "<group>"; }; 129 798A44F12A30674200815935 /* CNLiveMineSubBodyListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineSubBodyListView.swift; sourceTree = "<group>"; };
128 - 798A44F42A3077ED00815935 /* CNLiveTips.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveTips.swift; sourceTree = "<group>"; };  
129 798A44F52A3077ED00815935 /* CNLiveHotButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveHotButton.swift; sourceTree = "<group>"; }; 130 798A44F52A3077ED00815935 /* CNLiveHotButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveHotButton.swift; sourceTree = "<group>"; };
130 798A44F82A30835400815935 /* CNLiveHelpFeedBackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveHelpFeedBackViewController.swift; sourceTree = "<group>"; }; 131 798A44F82A30835400815935 /* CNLiveHelpFeedBackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveHelpFeedBackViewController.swift; sourceTree = "<group>"; };
131 798A44FA2A30999900815935 /* CNLiveAlertTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveAlertTool.swift; sourceTree = "<group>"; }; 132 798A44FA2A30999900815935 /* CNLiveAlertTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveAlertTool.swift; sourceTree = "<group>"; };
@@ -133,7 +134,6 @@ @@ -133,7 +134,6 @@
133 798A44FE2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInputFeedBackViewController.swift; sourceTree = "<group>"; }; 134 798A44FE2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInputFeedBackViewController.swift; sourceTree = "<group>"; };
134 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; }; 135 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; };
135 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInfoViewController.swift; sourceTree = "<group>"; }; 136 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInfoViewController.swift; sourceTree = "<group>"; };
136 - 79F4B1172A32C5FA00993C03 /* CNLiveBaseMoel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveBaseMoel.swift; sourceTree = "<group>"; };  
137 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineNickViewController.swift; sourceTree = "<group>"; }; 137 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineNickViewController.swift; sourceTree = "<group>"; };
138 79F4B11B2A33036E00993C03 /* CNLiveMineInfoAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInfoAlertView.swift; sourceTree = "<group>"; }; 138 79F4B11B2A33036E00993C03 /* CNLiveMineInfoAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInfoAlertView.swift; sourceTree = "<group>"; };
139 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNCertificationView.swift; sourceTree = "<group>"; }; 139 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNCertificationView.swift; sourceTree = "<group>"; };
@@ -242,7 +242,6 @@ @@ -242,7 +242,6 @@
242 isa = PBXGroup; 242 isa = PBXGroup;
243 children = ( 243 children = (
244 790D019E2A2DD66E00C5978D /* CNLiveLoginViewModel.swift */, 244 790D019E2A2DD66E00C5978D /* CNLiveLoginViewModel.swift */,
245 - 79282A3D2A2EFDA000B5F8CF /* CNLiveLoginModel.swift */,  
246 ); 245 );
247 path = ViewModel; 246 path = ViewModel;
248 sourceTree = "<group>"; 247 sourceTree = "<group>";
@@ -296,6 +295,16 @@ @@ -296,6 +295,16 @@
296 path = Controller; 295 path = Controller;
297 sourceTree = "<group>"; 296 sourceTree = "<group>";
298 }; 297 };
  298 + 792E57D52A3AA28E005834DB /* Util */ = {
  299 + isa = PBXGroup;
  300 + children = (
  301 + 792E57D62A3AA2AC005834DB /* CNLiveCommonJsonUtil.swift */,
  302 + 792E57D82A3AA2F2005834DB /* CNLiveCommonBaseModel.swift */,
  303 + 792E57DA2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift */,
  304 + );
  305 + path = Util;
  306 + sourceTree = "<group>";
  307 + };
299 7963988A2A260B3300D045EB /* Classes */ = { 308 7963988A2A260B3300D045EB /* Classes */ = {
300 isa = PBXGroup; 309 isa = PBXGroup;
301 children = ( 310 children = (
@@ -359,6 +368,7 @@ @@ -359,6 +368,7 @@
359 796398912A260C0100D045EB /* Common */ = { 368 796398912A260C0100D045EB /* Common */ = {
360 isa = PBXGroup; 369 isa = PBXGroup;
361 children = ( 370 children = (
  371 + 792E57D52A3AA28E005834DB /* Util */,
362 7963989B2A260E6200D045EB /* Base */, 372 7963989B2A260E6200D045EB /* Base */,
363 ); 373 );
364 path = Common; 374 path = Common;
@@ -391,7 +401,6 @@ @@ -391,7 +401,6 @@
391 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */, 401 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */,
392 7C4931282A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift */, 402 7C4931282A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift */,
393 798A44ED2A305AAC00815935 /* CNLiveBaseNavigationController.swift */, 403 798A44ED2A305AAC00815935 /* CNLiveBaseNavigationController.swift */,
394 - 79F4B1172A32C5FA00993C03 /* CNLiveBaseMoel.swift */,  
395 ); 404 );
396 path = Base; 405 path = Base;
397 sourceTree = "<group>"; 406 sourceTree = "<group>";
@@ -418,7 +427,6 @@ @@ -418,7 +427,6 @@
418 798A44F32A3077ED00815935 /* CustomView */ = { 427 798A44F32A3077ED00815935 /* CustomView */ = {
419 isa = PBXGroup; 428 isa = PBXGroup;
420 children = ( 429 children = (
421 - 798A44F42A3077ED00815935 /* CNLiveTips.swift */,  
422 798A44F52A3077ED00815935 /* CNLiveHotButton.swift */, 430 798A44F52A3077ED00815935 /* CNLiveHotButton.swift */,
423 798A44FA2A30999900815935 /* CNLiveAlertTool.swift */, 431 798A44FA2A30999900815935 /* CNLiveAlertTool.swift */,
424 ); 432 );
@@ -798,20 +806,21 @@ @@ -798,20 +806,21 @@
798 7C4931382A307BDB000E44B4 /* CNHomePageGuideView.swift in Sources */, 806 7C4931382A307BDB000E44B4 /* CNHomePageGuideView.swift in Sources */,
799 7CD6753E2A2740B0008354C1 /* CNPayMoneyCodeView.swift in Sources */, 807 7CD6753E2A2740B0008354C1 /* CNPayMoneyCodeView.swift in Sources */,
800 7CD675402A2740B0008354C1 /* CNCollectMoneyCodeView.swift in Sources */, 808 7CD675402A2740B0008354C1 /* CNCollectMoneyCodeView.swift in Sources */,
  809 + 792E57D92A3AA2F2005834DB /* CNLiveCommonBaseModel.swift in Sources */,
801 798A44FD2A309EBA00815935 /* CNLiveTypeFeedBackViewController.swift in Sources */, 810 798A44FD2A309EBA00815935 /* CNLiveTypeFeedBackViewController.swift in Sources */,
802 7CD6754F2A2840B9008354C1 /* CNMetaCodeHomePageController.swift in Sources */, 811 7CD6754F2A2840B9008354C1 /* CNMetaCodeHomePageController.swift in Sources */,
  812 + 792E57DB2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift in Sources */,
803 7CD675472A274167008354C1 /* NewPagedFlowView.m in Sources */, 813 7CD675472A274167008354C1 /* NewPagedFlowView.m in Sources */,
804 - 798A44F62A3077ED00815935 /* CNLiveTips.swift in Sources */,  
805 79F4B11A2A32F21400993C03 /* CNLiveMineNickViewController.swift in Sources */, 814 79F4B11A2A32F21400993C03 /* CNLiveMineNickViewController.swift in Sources */,
806 798A44FF2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift in Sources */, 815 798A44FF2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift in Sources */,
807 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */, 816 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */,
808 7C2703302A36CBE30061EC50 /* CNCertificationView.swift in Sources */, 817 7C2703302A36CBE30061EC50 /* CNCertificationView.swift in Sources */,
  818 + 792E57D72A3AA2AC005834DB /* CNLiveCommonJsonUtil.swift in Sources */,
809 790D01A32A2DDBA300C5978D /* CNLiveConfigManager.swift in Sources */, 819 790D01A32A2DDBA300C5978D /* CNLiveConfigManager.swift in Sources */,
810 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */, 820 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */,
811 798A44EA2A30135D00815935 /* CNLiveMineBodyListView.swift in Sources */, 821 798A44EA2A30135D00815935 /* CNLiveMineBodyListView.swift in Sources */,
812 798A44F92A30835400815935 /* CNLiveHelpFeedBackViewController.swift in Sources */, 822 798A44F92A30835400815935 /* CNLiveHelpFeedBackViewController.swift in Sources */,
813 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */, 823 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */,
814 - 79282A3E2A2EFDA000B5F8CF /* CNLiveLoginModel.swift in Sources */,  
815 790D01852A2D89E100C5978D /* UIColor+CNHexColor.swift in Sources */, 824 790D01852A2D89E100C5978D /* UIColor+CNHexColor.swift in Sources */,
816 79396EED2A319F220053E1AF /* NSObject+CNLiveCurrentVC.swift in Sources */, 825 79396EED2A319F220053E1AF /* NSObject+CNLiveCurrentVC.swift in Sources */,
817 7C4931312A2F142F000E44B4 /* CNHomePageBackgroupView.swift in Sources */, 826 7C4931312A2F142F000E44B4 /* CNHomePageBackgroupView.swift in Sources */,
@@ -824,7 +833,6 @@ @@ -824,7 +833,6 @@
824 798A44EE2A305AAC00815935 /* CNLiveBaseNavigationController.swift in Sources */, 833 798A44EE2A305AAC00815935 /* CNLiveBaseNavigationController.swift in Sources */,
825 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, 834 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */,
826 7C4931292A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift in Sources */, 835 7C4931292A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift in Sources */,
827 - 79F4B1182A32C5FA00993C03 /* CNLiveBaseMoel.swift in Sources */,  
828 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */, 836 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */,
829 7CD6753F2A2740B0008354C1 /* CNTopCollectMoneyRemindView.swift in Sources */, 837 7CD6753F2A2740B0008354C1 /* CNTopCollectMoneyRemindView.swift in Sources */,
830 7CD6753C2A2740B0008354C1 /* CNBottomPayMoneyRemindView.swift in Sources */, 838 7CD6753C2A2740B0008354C1 /* CNBottomPayMoneyRemindView.swift in Sources */,
metaCode/Classes/Common/Base/CNLiveBaseTabBarViewController.swift
@@ -39,12 +39,10 @@ class CNLiveBaseTabBarViewController: UITabBarController @@ -39,12 +39,10 @@ class CNLiveBaseTabBarViewController: UITabBarController
39 39
40 override func viewWillAppear(_ animated: Bool) { 40 override func viewWillAppear(_ animated: Bool) {
41 super.viewWillAppear(animated) 41 super.viewWillAppear(animated)
42 -  
43 } 42 }
44 override func viewDidAppear(_ animated: Bool) { 43 override func viewDidAppear(_ animated: Bool) {
45 super.viewDidAppear(animated) 44 super.viewDidAppear(animated)
46 -  
47 - 45 + print("获取用户用户数据=====>\(UserInfoManager.shared.userInfo.uid)")
48 } 46 }
49 // MARK: - 控制器的信息 47 // MARK: - 控制器的信息
50 func setUpTabBar() { 48 func setUpTabBar() {
metaCode/Classes/Common/Base/CNLiveBaseMoel.swift renamed to metaCode/Classes/Common/Util/CNLiveCommonBaseModel.swift
1 // 1 //
2 -// CNLiveBaseMoel.swift 2 +// CNLiveCommonBaseModel.swift
3 // metaCode 3 // metaCode
4 // 4 //
5 -// Created by open on 2023/6/9. 5 +// Created by open on 2023/6/15.
6 // 6 //
7 7
8 import Foundation 8 import Foundation
  9 +import UIKit
9 import HandyJSON 10 import HandyJSON
10 11
11 class BaseModel: HandyJSON { 12 class BaseModel: HandyJSON {
12 13
13 required init() {} 14 required init() {}
14 - 15 +
15 func mapping(mapper: HelpingMapper) { 16 func mapping(mapper: HelpingMapper) {
16 17
17 } 18 }
metaCode/Classes/Common/Util/CNLiveCommonJsonUtil.swift 0 → 100644
  1 +//
  2 +// CNLiveCommonJsonUtil.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/6/15.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +import UIKit
  11 +import HandyJSON
  12 +
  13 +class JsonUtil: NSObject {
  14 + /**
  15 + * Json转对象
  16 + */
  17 + static func jsonToModel(_ jsonStr:String,_ modelType:HandyJSON.Type) -> BaseModel {
  18 + if jsonStr == "" || jsonStr.count == 0 {
  19 + #if DEBUG
  20 + print("jsonoModel:字符串为空")
  21 + #endif
  22 + return BaseModel()
  23 + }
  24 + return modelType.deserialize(from: jsonStr) as! BaseModel
  25 +
  26 + }
  27 +
  28 + /**
  29 + * Json转数组对象
  30 + */
  31 + static func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type) ->[BaseModel] {
  32 + if jsonArrayStr == "" || jsonArrayStr.count == 0 {
  33 + #if DEBUG
  34 + print("jsonToModelArray:字符串为空")
  35 + #endif
  36 + return []
  37 + }
  38 + var modelArray:[BaseModel] = []
  39 + let data = jsonArrayStr.data(using: String.Encoding.utf8)
  40 + let peoplesArray = try! JSONSerialization.jsonObject(with:data!, options: JSONSerialization.ReadingOptions()) as? [AnyObject]
  41 + for people in peoplesArray! {
  42 + modelArray.append(dictionaryToModel(people as! [String : Any], modelType))
  43 + }
  44 + return modelArray
  45 +
  46 + }
  47 +
  48 + /**
  49 + * 字典转对象
  50 + */
  51 + static func dictionaryToModel(_ dictionStr:[String:Any],_ modelType:HandyJSON.Type) -> BaseModel {
  52 + if dictionStr.count == 0 {
  53 + #if DEBUG
  54 + print("dictionaryToModel:字符串为空")
  55 + #endif
  56 + return BaseModel()
  57 + }
  58 + return modelType.deserialize(from: dictionStr) as! BaseModel
  59 + }
  60 +
  61 + /**
  62 + * 对象转JSON
  63 + */
  64 + static func modelToJson(_ model:BaseModel?) -> String {
  65 + if model == nil {
  66 + #if DEBUG
  67 + print("modelToJson:model为空")
  68 + #endif
  69 + return ""
  70 + }
  71 + return (model?.toJSONString())!
  72 + }
  73 +
  74 + /**
  75 + * 对象转字典
  76 + */
  77 + static func modelToDictionary(_ model:BaseModel?) -> [String:Any] {
  78 + if model == nil {
  79 + #if DEBUG
  80 + print("modelToJson:model为空")
  81 + #endif
  82 + return [:]
  83 + }
  84 + return (model?.toJSON())!
  85 + }
  86 +}
metaCode/Classes/Common/Util/CNLiveCommonQiniuTool.swift 0 → 100644
  1 +//
  2 +// CNLiveCommonQiniuTool.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/6/15.
  6 +//
  7 +
  8 +import Foundation
  9 +import Qiniu
  10 +
  11 +class UploadManager: NSObject {
  12 +
  13 + private let _qnUploadManager = QNUploadManager()
  14 + static let shared = UploadManager()
  15 + private override init() {
  16 + super.init()
  17 + let config = QNConfiguration.build { builder in
  18 + builder?.useHttps = true;
  19 + do {
  20 + builder?.recorder = try QNFileRecorder(folder: "元码")
  21 + } catch {}
  22 + }
  23 +// _qnUploadManager = QNUploadManager(configuration: config)
  24 + }
  25 +
  26 +
  27 +
  28 +}
metaCode/Classes/Config/CNLiveConfigUserInfo.swift
@@ -6,62 +6,113 @@ @@ -6,62 +6,113 @@
6 // 6 //
7 7
8 import Foundation 8 import Foundation
9 -import SwiftyUserDefaults 9 +import UIKit
  10 +import HandyJSON
10 11
11 -extension DefaultsKeys { 12 +class UserInfoModel: BaseModel {
12 13
13 - var userInfoKey: DefaultsKey<CNLiveLoginModel?>{  
14 - DefaultsKey.init("userInfo")  
15 - } 14 + required init() {}
  15 +
  16 + var appId:String = ""
  17 + var appleUid:String = ""
  18 + var bigFaceUrl:String = ""
  19 + var birthday:String = ""
  20 + var countryCode:String = ""
  21 + var email:String = ""
  22 + var extInfo:String = ""
  23 + var faceUrl:String = ""
  24 + var frmId:String = ""
  25 + var gender:String = ""
  26 + var hUid:String = ""
  27 + var isNewUser:String = ""
  28 + var location:String = ""
  29 + var mobile:String = ""
  30 + var newAccount:String = ""
  31 + var nickName:String = ""
  32 + var platformId:String = ""
  33 + var qqUid:String = ""
  34 + var renrenUid:String = ""
  35 + var sinaUid:String = ""
  36 + var token:String = ""
  37 + var uid:String = ""
  38 + var wxUid:String = ""
  39 + var access_token:String = ""
  40 + var expires_in:String = ""//过期时间
16 41
  42 + override func mapping(mapper: HelpingMapper) {
  43 +
  44 + mapper <<<
  45 + self.gender <-- TransformOf(fromJSON: { (rawString) -> String? in
  46 +
  47 + if let _str = rawString {
  48 +
  49 + if _str == "m" || _str == "男" {
  50 + return "男"
  51 + }
  52 + if _str == "f" || _str == "女" {
  53 + return "女"
  54 + }
  55 + }
  56 + return "未知"
  57 + }, toJSON: { (srcString) -> String? in
  58 + return srcString
  59 + })
  60 + }
17 } 61 }
18 62
19 class UserInfoManager: NSObject { 63 class UserInfoManager: NSObject {
20 64
21 static let shared = UserInfoManager() 65 static let shared = UserInfoManager()
22 66
23 - public var is_login: Bool {  
24 - get {  
25 - return userInfo.uid.lengthOfBytes(using: .utf8) > 0  
26 - }  
27 - }  
28 -  
29 - fileprivate var _userInfo : CNLiveLoginModel?  
30 - private(set) var userInfo: CNLiveLoginModel { 67 + fileprivate var _userInfo : UserInfoModel?
  68 + private(set) var userInfo: UserInfoModel {
31 69
32 set { 70 set {
33 _userInfo = newValue 71 _userInfo = newValue
34 } 72 }
35 73
36 get { 74 get {
37 - if (_userInfo != nil && (_userInfo?.uid.lengthOfBytes(using: .utf8))! > 0) { 75 + if _userInfo != nil && (_userInfo?.uid.count)! > 0 {
38 return _userInfo! 76 return _userInfo!
39 } 77 }
40 - return readUserInfo() 78 + return UserInfoManager.readUserInfo()
41 } 79 }
42 } 80 }
43 81
44 private override init() {} 82 private override init() {}
45 83
46 /// 缓存用户数据 84 /// 缓存用户数据
47 - /// - Parameter userInfo: 用户数据  
48 - public func cacheUserInfo(userInfo: CNLiveLoginModel) {  
49 - _userInfo = userInfo  
50 - Defaults[\.userInfoKey] = userInfo 85 + /// - Parameter userInfo: 用户数据 存储字符串
  86 + static public func cacheUserInfo(userInfo: UserInfoModel) {
  87 + UserInfoManager.clearUserInfo()
  88 + UserInfoManager.shared._userInfo = userInfo
  89 + //JsonUtil.modelToJson(userInfo)
  90 + UserDefaults.standard.set(userInfo.toJSONString(), forKey: "mateCode_userInfo")
  91 + if UserDefaults.standard.synchronize() {
  92 + print("用户信息存储成功")
  93 + }
51 } 94 }
52 95
53 /// 读取用户数据 96 /// 读取用户数据
54 /// - Returns: 用户数据 97 /// - Returns: 用户数据
55 - public func readUserInfo() -> CNLiveLoginModel {  
56 - if (Defaults.hasKey(\.userInfoKey)) {  
57 - return Defaults[\.userInfoKey]!  
58 - }else{  
59 - return CNLiveLoginModel() 98 + static public func readUserInfo() -> UserInfoModel {
  99 + let user_info = UserDefaults.standard.object(forKey: "mateCode_userInfo")
  100 + if user_info == nil && (user_info as! String).count == 0 {
  101 + print("获取用户信息失败")
  102 + return UserInfoModel()
60 } 103 }
  104 + let userInfo = JsonUtil.jsonToModel(user_info as! String, UserInfoModel.self) as! UserInfoModel
  105 + UserInfoManager.shared._userInfo = userInfo
  106 + return userInfo
61 } 107 }
62 108
63 - public func clearUserInfo() {  
64 - _userInfo = nil  
65 - Defaults.remove(\.userInfoKey) 109 + static public func clearUserInfo() {
  110 + UserDefaults.standard.removeObject(forKey: "mateCode_userInfo")
  111 + UserInfoManager.shared._userInfo = nil
  112 + if UserDefaults.standard.synchronize() {
  113 + print("用户信息删除成功")
  114 + }
66 } 115 }
67 } 116 }
  117 +
  118 +
metaCode/Classes/CustomView/CNLiveTips.swift deleted 100644 → 0
1 -//  
2 -// CNLiveTips.swift  
3 -// metaCode  
4 -//  
5 -// Created by open on 2023/6/5.  
6 -//  
7 -  
8 -import Foundation  
9 -import UIKit  
10 -import YYCategories  
11 -import MBProgressHUD  
12 -  
13 -class tip {  
14 -  
15 - static func showMessage(message : String) {  
16 -  
17 - if !message.isNotBlank() {  
18 - return  
19 - }  
20 -  
21 - let delegate = UIApplication.shared.delegate as! AppDelegate  
22 -  
23 - let bgView = UIView.init()  
24 - bgView.backgroundColor = UIColor(white: 0.1, alpha: 0.7)  
25 - bgView.layer.cornerRadius = 8.0  
26 - bgView.clipsToBounds = true  
27 - delegate.window?.addSubview(bgView)  
28 -  
29 - let remindLab = UILabel.init()  
30 - remindLab.textColor = .white  
31 - remindLab.font = Font_15_Fit  
32 - remindLab.textAlignment = .center  
33 - remindLab.numberOfLines = 1  
34 - remindLab.backgroundColor = .clear  
35 - remindLab.text = message  
36 - bgView.addSubview(remindLab)  
37 -  
38 - var width = message.boundingRect(with: CGSize(width: CGFloat(MAXFLOAT), height: delegate.window?.bounds.size.height ?? 0), options:.usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font:Font_15_Fit], context: nil).size.width  
39 - if width > (delegate.window?.bounds.size.width ?? 0)/4.0 * 3.0 {  
40 - width = (delegate.window?.bounds.size.width ?? 0)/4.0 * 3.0  
41 - }  
42 -  
43 - let height = message.boundingRect(with: CGSize(width: width, height: CGFloat(MAXFLOAT)), options: .usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font:Font_15_Fit], context: nil).size.height  
44 -  
45 - bgView.bounds = CGRect(x: 0, y: 0, width: width + 20, height: height + 20)  
46 - bgView.layer.position = CGPoint(x: (delegate.window?.bounds.size.width ?? 0) / 2.0, y: ( (delegate.window?.bounds.size.height ?? 0) - CNLiveConfigManager.shared.keyboardDisplayHeight) / 2.0)  
47 -  
48 - remindLab.bounds = CGRect(x: 0, y: 0, width: width, height: height)  
49 - remindLab.layer.position = CGPoint(x: bgView.bounds.size.width / 2, y: bgView.bounds.size.height / 2)  
50 -  
51 - UIView.animate(withDuration: 1, delay: 1, options: .curveEaseOut) {  
52 - bgView.alpha = 0  
53 - } completion: { finish in  
54 - bgView.removeFromSuperview()  
55 - }  
56 - }  
57 -  
58 - static func showLoading(message: String) {  
59 -  
60 - let delegate = UIApplication.shared.delegate as! AppDelegate  
61 -  
62 - delegate.window?.subviews.forEach({ view in  
63 - if view.isKind(of: MBProgressHUD.layerClass) {  
64 - let hub = view as! MBProgressHUD  
65 - hub.removeFromSuperview()  
66 - }  
67 - })  
68 -  
69 - let hub = MBProgressHUD.showAdded(to: delegate.window!, animated: true)  
70 - hub.mode = .indeterminate  
71 - hub.animationType = .fade  
72 - hub.contentColor = .white  
73 - hub.bezelView.backgroundColor = .black  
74 - hub.label.textColor = .white  
75 - if message.isNotBlank() {  
76 - hub.label.text = message  
77 - }  
78 - }  
79 -  
80 - static func hiddenLoading() {  
81 - let delegate = UIApplication.shared.delegate as! AppDelegate  
82 - MBProgressHUD.hide(for: delegate.window!, animated: true)  
83 - }  
84 -  
85 -}  
86 -  
metaCode/Classes/Extensions/NSObject+CNLiveCurrentVC.swift
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 // 6 //
7 7
8 import Foundation 8 import Foundation
  9 +import MBProgressHUD
9 10
10 func currentViewController() -> (UIViewController?) { 11 func currentViewController() -> (UIViewController?) {
11 var window = UIApplication.shared.keyWindow 12 var window = UIApplication.shared.keyWindow
@@ -42,3 +43,77 @@ private func currentVC(_ vc :UIViewController?) -&gt; UIViewController? { @@ -42,3 +43,77 @@ private func currentVC(_ vc :UIViewController?) -&gt; UIViewController? {
42 return vc 43 return vc
43 } 44 }
44 } 45 }
  46 +
  47 +
  48 +/// 弹框提示
  49 +/// - Parameter message: 内容提示
  50 +func showMessage(message: String) {
  51 + if !message.isNotBlank() {
  52 + return
  53 + }
  54 +
  55 + let delegate = UIApplication.shared.delegate as! AppDelegate
  56 +
  57 + let bgView = UIView.init()
  58 + bgView.backgroundColor = UIColor(white: 0.1, alpha: 0.7)
  59 + bgView.layer.cornerRadius = 8.0
  60 + bgView.clipsToBounds = true
  61 + delegate.window?.addSubview(bgView)
  62 +
  63 + let remindLab = UILabel.init()
  64 + remindLab.textColor = .white
  65 + remindLab.font = Font_15_Fit
  66 + remindLab.textAlignment = .center
  67 + remindLab.numberOfLines = 1
  68 + remindLab.backgroundColor = .clear
  69 + remindLab.text = message
  70 + bgView.addSubview(remindLab)
  71 +
  72 + var width = message.boundingRect(with: CGSize(width: CGFloat(MAXFLOAT), height: delegate.window?.bounds.size.height ?? 0), options:.usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font:Font_15_Fit], context: nil).size.width
  73 + if width > (delegate.window?.bounds.size.width ?? 0)/4.0 * 3.0 {
  74 + width = (delegate.window?.bounds.size.width ?? 0)/4.0 * 3.0
  75 + }
  76 +
  77 + let height = message.boundingRect(with: CGSize(width: width, height: CGFloat(MAXFLOAT)), options: .usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font:Font_15_Fit], context: nil).size.height
  78 +
  79 + bgView.bounds = CGRect(x: 0, y: 0, width: width + 20, height: height + 20)
  80 + bgView.layer.position = CGPoint(x: (delegate.window?.bounds.size.width ?? 0) / 2.0, y: ( (delegate.window?.bounds.size.height ?? 0) - CNLiveConfigManager.shared.keyboardDisplayHeight) / 2.0)
  81 +
  82 + remindLab.bounds = CGRect(x: 0, y: 0, width: width, height: height)
  83 + remindLab.layer.position = CGPoint(x: bgView.bounds.size.width / 2, y: bgView.bounds.size.height / 2)
  84 +
  85 + UIView.animate(withDuration: 1, delay: 1, options: .curveEaseOut) {
  86 + bgView.alpha = 0
  87 + } completion: { finish in
  88 + bgView.removeFromSuperview()
  89 + }
  90 +}
  91 +
  92 +/// 展示等待框
  93 +/// - Parameter message: 提示词
  94 +func showLoading(message: String) {
  95 + let delegate = UIApplication.shared.delegate as! AppDelegate
  96 +
  97 + delegate.window?.subviews.forEach({ view in
  98 + if view.isKind(of: MBProgressHUD.layerClass) {
  99 + let hub = view as! MBProgressHUD
  100 + hub.removeFromSuperview()
  101 + }
  102 + })
  103 +
  104 + let hub = MBProgressHUD.showAdded(to: delegate.window!, animated: true)
  105 + hub.mode = .indeterminate
  106 + hub.animationType = .fade
  107 + hub.contentColor = .white
  108 + hub.bezelView.backgroundColor = .black
  109 + hub.label.textColor = .white
  110 + if message.isNotBlank() {
  111 + hub.label.text = message
  112 + }
  113 +}
  114 +
  115 +/// 隐藏提示词
  116 +func hiddenLoading() {
  117 + let delegate = UIApplication.shared.delegate as! AppDelegate
  118 + MBProgressHUD.hide(for: delegate.window!, animated: true)
  119 +}
metaCode/Classes/Extensions/UIButton+CNLiveExtension.swift
@@ -9,12 +9,12 @@ import Foundation @@ -9,12 +9,12 @@ import Foundation
9 9
10 extension UIButton { 10 extension UIButton {
11 11
12 - /// 根据图片生成UIBarButtonItem 12 + /// 根据图片生成UIButton
13 static func imageItem(imageName:String,target:AnyObject,action:Selector) -> UIButton { 13 static func imageItem(imageName:String,target:AnyObject,action:Selector) -> UIButton {
14 return customItem(title: "", titleColor: UIColor.white, imageName: imageName, target: target, action: action,contentHorizontalAlignment: .center) 14 return customItem(title: "", titleColor: UIColor.white, imageName: imageName, target: target, action: action,contentHorizontalAlignment: .center)
15 } 15 }
16 16
17 - /// 根据文字生成UIBarButtonItem 17 + /// 根据文字生成UIButton
18 static func textItem(title:String,titleColor:UIColor,target:AnyObject,action:Selector) -> UIButton { 18 static func textItem(title:String,titleColor:UIColor,target:AnyObject,action:Selector) -> UIButton {
19 return customItem(title: title, titleColor: titleColor, imageName: "", target: target, action: action,contentHorizontalAlignment: .center) 19 return customItem(title: title, titleColor: titleColor, imageName: "", target: target, action: action,contentHorizontalAlignment: .center)
20 } 20 }
@@ -24,7 +24,7 @@ extension UIButton { @@ -24,7 +24,7 @@ extension UIButton {
24 return customItem(title: "", titleColor: UIColor.white, imageName: imageName, target: target, action: action,contentHorizontalAlignment: .left,isBack: true) 24 return customItem(title: "", titleColor: UIColor.white, imageName: imageName, target: target, action: action,contentHorizontalAlignment: .left,isBack: true)
25 } 25 }
26 26
27 - /// 快速初始化一个UIBarButtonItem,内部是按钮 27 + /// 快速初始化一个UIButton,内部是按钮
28 static func customItem(title:String,titleColor:UIColor,imageName:String,target:AnyObject,action:Selector, 28 static func customItem(title:String,titleColor:UIColor,imageName:String,target:AnyObject,action:Selector,
29 contentHorizontalAlignment:UIControl.ContentHorizontalAlignment,isBack:Bool=false) -> UIButton { 29 contentHorizontalAlignment:UIControl.ContentHorizontalAlignment,isBack:Bool=false) -> UIButton {
30 let button = UIButton() 30 let button = UIButton()
metaCode/Classes/Main/LoginPage/Controller/CNLiveLoginViewController.swift
@@ -15,7 +15,7 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { @@ -15,7 +15,7 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate {
15 lazy var headerView : UIImageView = { 15 lazy var headerView : UIImageView = {
16 let headerView = UIImageView() 16 let headerView = UIImageView()
17 headerView.backgroundColor = .white 17 headerView.backgroundColor = .white
18 - headerView.contentMode = .scaleAspectFit 18 + headerView.contentMode = .scaleToFill
19 headerView.image = UIImage(named: "Login_page_header_icon") 19 headerView.image = UIImage(named: "Login_page_header_icon")
20 return headerView 20 return headerView
21 }() 21 }()
@@ -25,7 +25,7 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { @@ -25,7 +25,7 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate {
25 areaButton.backgroundColor = .white 25 areaButton.backgroundColor = .white
26 areaButton.setTitle("+86", for: .normal) 26 areaButton.setTitle("+86", for: .normal)
27 areaButton.setTitle("+86", for: .highlighted) 27 areaButton.setTitle("+86", for: .highlighted)
28 - areaButton.titleLabel?.font = BoldFont_16_Fit 28 + areaButton.titleLabel?.font = BoldFont_16
29 areaButton.setTitleColor(HexColor("#333333"), for: .normal) 29 areaButton.setTitleColor(HexColor("#333333"), for: .normal)
30 areaButton.setTitleColor(HexColor("#333333"), for: .highlighted) 30 areaButton.setTitleColor(HexColor("#333333"), for: .highlighted)
31 areaButton.addTarget(self, action: #selector(changeCityNumberMothod), for: .touchUpInside) 31 areaButton.addTarget(self, action: #selector(changeCityNumberMothod), for: .touchUpInside)
@@ -112,7 +112,7 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { @@ -112,7 +112,7 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate {
112 areaButton.snp.makeConstraints { make in 112 areaButton.snp.makeConstraints { make in
113 make.centerY.equalTo(phoneV) 113 make.centerY.equalTo(phoneV)
114 make.left.equalTo(phoneV.left).offset(40) 114 make.left.equalTo(phoneV.left).offset(40)
115 - make.width.lessThanOrEqualTo(45) 115 + make.width.lessThanOrEqualTo(50)
116 } 116 }
117 117
118 let v_line = UILabel.init() 118 let v_line = UILabel.init()
@@ -169,7 +169,7 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate { @@ -169,7 +169,7 @@ class CNLiveLoginViewController : CNLiveBaseViewController, UITextViewDelegate {
169 codeButton.backgroundColor = .white 169 codeButton.backgroundColor = .white
170 codeButton.setTitle("获取验证码", for: .normal) 170 codeButton.setTitle("获取验证码", for: .normal)
171 codeButton.setTitle("获取验证码", for: .highlighted) 171 codeButton.setTitle("获取验证码", for: .highlighted)
172 - codeButton.titleLabel?.font = Font_16_Fit 172 + codeButton.titleLabel?.font = Font_16
173 codeButton.setTitleColor(HexColor("#0066FE"), for: .normal) 173 codeButton.setTitleColor(HexColor("#0066FE"), for: .normal)
174 codeButton.setTitleColor(HexColor("#0066FE"), for: .highlighted) 174 codeButton.setTitleColor(HexColor("#0066FE"), for: .highlighted)
175 codeButton.addTarget(self, action: #selector(sendVerifiCodeMothod), for: .touchUpInside) 175 codeButton.addTarget(self, action: #selector(sendVerifiCodeMothod), for: .touchUpInside)
@@ -278,23 +278,22 @@ extension CNLiveLoginViewController { @@ -278,23 +278,22 @@ extension CNLiveLoginViewController {
278 278
279 @objc func sendLoginActionMothod(sender : UIButton) { 279 @objc func sendLoginActionMothod(sender : UIButton) {
280 if !is_agree { 280 if !is_agree {
281 - tip.showMessage(message: "请先阅读并同意协议") 281 + showMessage(message: "请先阅读并同意协议")
282 return 282 return
283 } 283 }
284 view.endEditing(true) 284 view.endEditing(true)
285 CNLiveLoginViewModel.requestLoginAction(userName: phoneText.text ?? "", countryCode: country, verCode: veriText.text ?? "") { 285 CNLiveLoginViewModel.requestLoginAction(userName: phoneText.text ?? "", countryCode: country, verCode: veriText.text ?? "") {
286 - UserInfoManager.shared.clearUserInfo()  
287 let window = UIApplication.shared.delegate?.window 286 let window = UIApplication.shared.delegate?.window
288 window??.rootViewController = CNLiveBaseTabBarViewController.init() 287 window??.rootViewController = CNLiveBaseTabBarViewController.init()
289 } 288 }
290 } 289 }
291 290
292 @objc func pushAgreeActionMothod() { 291 @objc func pushAgreeActionMothod() {
293 - tip.showMessage(message: "APP用户服务协议") 292 + self.navigationController?.pushViewController(CNLiveInfoShowViewController.init(show_type: .service), animated: true)
294 } 293 }
295 294
296 @objc func pushInfoActionMothod() { 295 @objc func pushInfoActionMothod() {
297 - tip.showMessage(message: "个人信息保护政策") 296 + self.navigationController?.pushViewController(CNLiveInfoShowViewController.init(show_type: .privacy), animated: true)
298 } 297 }
299 } 298 }
300 299
metaCode/Classes/Main/LoginPage/View/CNLiveLoginPickerView.swift
@@ -163,12 +163,14 @@ extension CNLiveLoginPickerView { @@ -163,12 +163,14 @@ extension CNLiveLoginPickerView {
163 } 163 }
164 164
165 func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { 165 func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
166 - let param = country_array[row] as! NSMutableDictionary  
167 - return param["name"] as? String 166 + let param = country_array[row] as! NSDictionary
  167 + let name = param["name"] as? String
  168 + let code = param["code"] as? String
  169 + return "\(name ?? "")"+"(+\(code ?? ""))"
168 } 170 }
169 171
170 func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { 172 func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
171 - let param = country_array[row] as! NSMutableDictionary 173 + let param = country_array[row] as! NSDictionary
172 result_string = param["code"] as! String 174 result_string = param["code"] as! String
173 } 175 }
174 } 176 }
metaCode/Classes/Main/LoginPage/ViewModel/CNLiveLoginModel.swift deleted 100644 → 0
1 -//  
2 -// CNLiveLoginModel.swift  
3 -// metaCode  
4 -//  
5 -// Created by open on 2023/6/6.  
6 -//  
7 -  
8 -import Foundation  
9 -import SwiftyUserDefaults  
10 -import HandyJSON  
11 -  
12 -class CNLiveLoginModel : BaseModel, DefaultsSerializable, Codable {  
13 -  
14 -  
15 - required init() {}  
16 -  
17 - var appId:String = ""  
18 - var appleUid:String = ""  
19 - var bigFaceUrl:String = ""  
20 - var birthday:String = ""  
21 - var countryCode:String = ""  
22 - var email:String = ""  
23 - var extInfo:String = ""  
24 - var faceUrl:String = ""  
25 - var frmId:String = ""  
26 - var gender:String = ""  
27 - var hUid:String = ""  
28 - var isNewUser:String = ""  
29 - var location:String = ""  
30 - var mobile:String = ""  
31 - var newAccount:String = ""  
32 - var nickName:String = ""  
33 - var platformId:String = ""  
34 - var qqUid:String = ""  
35 - var renrenUid:String = ""  
36 - var sinaUid:String = ""  
37 - var token:String = ""  
38 - var uid:String = ""  
39 - var wxUid:String = ""  
40 -  
41 - override func mapping(mapper: HelpingMapper) {  
42 - mapper.specify(property: &gender) { rawString -> String in  
43 - var g = "未知"  
44 - if rawString == "m" {  
45 - g = "男"  
46 - } else {  
47 - g = "女"  
48 - }  
49 - return g  
50 - }  
51 - }  
52 -  
53 -}  
metaCode/Classes/Main/LoginPage/ViewModel/CNLiveLoginViewModel.swift
@@ -7,9 +7,10 @@ @@ -7,9 +7,10 @@
7 7
8 import Foundation 8 import Foundation
9 import YYCategories 9 import YYCategories
10 -import HandyJSON  
11 import CNLiveRequestBastKit 10 import CNLiveRequestBastKit
12 -import SwiftyUserDefaults 11 +import HandyJSON
  12 +
  13 +import MJExtension
13 14
14 //验证码发送成功回调 15 //验证码发送成功回调
15 typealias resultCodeBlock = () -> Void 16 typealias resultCodeBlock = () -> Void
@@ -21,84 +22,105 @@ class CNLiveLoginViewModel : NSObject { @@ -21,84 +22,105 @@ class CNLiveLoginViewModel : NSObject {
21 static func requestVerCodeAction(phone: String, code: String, resultBlock: @escaping resultCodeBlock) { 22 static func requestVerCodeAction(phone: String, code: String, resultBlock: @escaping resultCodeBlock) {
22 23
23 if !phone.isNotBlank() { 24 if !phone.isNotBlank() {
24 - tip.showMessage(message: "请输入手机号") 25 + showMessage(message: "请输入手机号")
25 return 26 return
26 } 27 }
27 if phone.lengthOfBytes(using: .utf8) >= 20 { 28 if phone.lengthOfBytes(using: .utf8) >= 20 {
28 - tip.showMessage(message: "手机号格式不正确") 29 + showMessage(message: "手机号格式不正确")
29 return 30 return
30 } 31 }
31 if !phone.isPurnInt() { 32 if !phone.isPurnInt() {
32 - tip.showMessage(message: "手机号格式不正确") 33 + showMessage(message: "手机号格式不正确")
33 return 34 return
34 } 35 }
35 - tip.showLoading(message: "") 36 + showLoading(message: "")
36 let param = ["mobile":phone,"countryCode":code] 37 let param = ["mobile":phone,"countryCode":code]
37 CNLiveNetworking.setAllowRequestDefaultArgument(true) 38 CNLiveNetworking.setAllowRequestDefaultArgument(true)
38 CNLiveNetworking.setupShowDataResult(false) 39 CNLiveNetworking.setupShowDataResult(false)
39 CNLiveNetworking.requestNetwork(with: .POST, urlString: "/open/api2/user/sendVerifyCode", param: param, cacheType: .networkOnly) { task, result, error in 40 CNLiveNetworking.requestNetwork(with: .POST, urlString: "/open/api2/user/sendVerifyCode", param: param, cacheType: .networkOnly) { task, result, error in
40 - tip.hiddenLoading() 41 + hiddenLoading()
41 if (error == nil) { 42 if (error == nil) {
42 let resp = result as! NSDictionary 43 let resp = result as! NSDictionary
43 let errorCode = resp["errorCode"] 44 let errorCode = resp["errorCode"]
44 if (errorCode as! String == "0") { 45 if (errorCode as! String == "0") {
45 - tip.showMessage(message: "验证码已发送") 46 + showMessage(message: "验证码已发送")
46 resultBlock() 47 resultBlock()
47 } else { 48 } else {
48 - tip.showMessage(message: resp["errorMessage"] as! String) 49 + showMessage(message: resp["errorMessage"] as! String)
49 } 50 }
50 } else{ 51 } else{
51 - tip.showMessage(message: "获取验证码失败") 52 + showMessage(message: "获取验证码失败")
52 } 53 }
53 } 54 }
54 } 55 }
55 56
56 static func requestLoginAction(userName: String, countryCode: String, verCode: String, resultBlock: @escaping resultLoginBlock) { 57 static func requestLoginAction(userName: String, countryCode: String, verCode: String, resultBlock: @escaping resultLoginBlock) {
57 if !userName.isNotBlank() { 58 if !userName.isNotBlank() {
58 - tip.showMessage(message: "请输入手机号") 59 + showMessage(message: "请输入手机号")
59 return 60 return
60 } 61 }
61 if userName.lengthOfBytes(using: .utf8) >= 20 { 62 if userName.lengthOfBytes(using: .utf8) >= 20 {
62 - tip.showMessage(message: "手机号格式不正确") 63 + showMessage(message: "手机号格式不正确")
63 return 64 return
64 } 65 }
65 if !userName.isPurnInt() { 66 if !userName.isPurnInt() {
66 - tip.showMessage(message: "手机号格式不正确") 67 + showMessage(message: "手机号格式不正确")
67 return 68 return
68 } 69 }
69 if !verCode.isNotBlank() { 70 if !verCode.isNotBlank() {
70 - tip.showMessage(message: "请输入验证码") 71 + showMessage(message: "请输入验证码")
71 return 72 return
72 } 73 }
73 if verCode.lengthOfBytes(using: .utf8) >= 20 { 74 if verCode.lengthOfBytes(using: .utf8) >= 20 {
74 - tip.showMessage(message: "验证码格式不正确") 75 + showMessage(message: "验证码格式不正确")
75 return 76 return
76 } 77 }
77 if !verCode.isPurnInt() { 78 if !verCode.isPurnInt() {
78 - tip.showMessage(message: "验证码格式不正确") 79 + showMessage(message: "验证码格式不正确")
79 return 80 return
80 } 81 }
81 82
82 - tip.showLoading(message: "") 83 + showLoading(message: "")
83 let param = ["userName":userName,"countryCode":countryCode,"verificationCode":verCode,"inviterId":""] 84 let param = ["userName":userName,"countryCode":countryCode,"verificationCode":verCode,"inviterId":""]
84 CNLiveNetworking.setAllowRequestDefaultArgument(true) 85 CNLiveNetworking.setAllowRequestDefaultArgument(true)
85 CNLiveNetworking.setupShowDataResult(false) 86 CNLiveNetworking.setupShowDataResult(false)
86 CNLiveNetworking.requestNetwork(with: .POST, urlString: "/open/api2/user/loginInMetaCode", param: param, cacheType: .networkOnly) { task, result, error in 87 CNLiveNetworking.requestNetwork(with: .POST, urlString: "/open/api2/user/loginInMetaCode", param: param, cacheType: .networkOnly) { task, result, error in
87 - tip.hiddenLoading() 88 + hiddenLoading()
88 if (error == nil) { 89 if (error == nil) {
89 let resp = result as! NSDictionary 90 let resp = result as! NSDictionary
90 let errorCode = resp["errorCode"] 91 let errorCode = resp["errorCode"]
91 if (errorCode as! String == "0") { 92 if (errorCode as! String == "0") {
92 - if let res = JSONDeserializer<CNLiveLoginModel>.deserializeFrom(dict: resp, designatedPath: "data") {  
93 - Defaults.userInfoKey = res 93 + if resp.allKeys.contains(where: { item in
  94 + return item as! String == "data"
  95 + }) {
  96 + let userInfoModel = JsonUtil.dictionaryToModel(resp["data"] as! [String : Any], UserInfoModel.self)
  97 + UserInfoManager.cacheUserInfo(userInfo: userInfoModel as! UserInfoModel)
  98 + UserDefaults.standard.set(true,forKey: "is_login")
94 resultBlock() 99 resultBlock()
95 } 100 }
96 } else { 101 } else {
97 - tip.showMessage(message: resp["errorMessage"] as! String) 102 + showMessage(message: resp["errorMessage"] as! String)
98 } 103 }
99 } else { 104 } else {
100 - tip.showMessage(message: "登陆失败") 105 + showMessage(message: "登陆失败")
101 } 106 }
102 } 107 }
  108 +// DispatchQueue.main.asyncAfter(deadline: .now()+0.5, execute: {
  109 +// hiddenLoading()
  110 +// let resp = CNLiveLoginViewModel.dict() as NSDictionary
  111 +// let errorCode = resp["errorCode"]
  112 +// if (errorCode as! String == "0") {
  113 +// if resp.allKeys.contains(where: { item in
  114 +// return item as! String == "data"
  115 +// }) {
  116 +// let userInfoModel = JsonUtil.dictionaryToModel(resp["data"] as! [String : Any], UserInfoModel.self)
  117 +// UserInfoManager.cacheUserInfo(userInfo: userInfoModel as! UserInfoModel)
  118 +// UserDefaults.standard.set(true,forKey: "is_login")
  119 +// resultBlock()
  120 +// }
  121 +// } else {
  122 +// showMessage(message: resp["errorMessage"] as! String)
  123 +// }
  124 +// })
103 } 125 }
104 } 126 }
metaCode/Classes/Main/MinePage/Controller/CNLiveInfoShowViewController.swift
@@ -7,13 +7,15 @@ @@ -7,13 +7,15 @@
7 7
8 import Foundation 8 import Foundation
9 import YYCategories 9 import YYCategories
  10 +import WebKit
10 11
11 enum ListShowInfoType { 12 enum ListShowInfoType {
12 case service 13 case service
13 case privacy 14 case privacy
  15 + case yinsi
14 } 16 }
15 17
16 -class CNLiveInfoShowViewController: CNLiveBaseViewController { 18 +class CNLiveInfoShowViewController: CNLiveBaseViewController, WKNavigationDelegate, WKUIDelegate {
17 19
18 var _show_type:ListShowInfoType! 20 var _show_type:ListShowInfoType!
19 init(show_type:ListShowInfoType) { 21 init(show_type:ListShowInfoType) {
@@ -29,42 +31,79 @@ class CNLiveInfoShowViewController: CNLiveBaseViewController { @@ -29,42 +31,79 @@ class CNLiveInfoShowViewController: CNLiveBaseViewController {
29 fatalError("init(coder:) has not been implemented") 31 fatalError("init(coder:) has not been implemented")
30 } 32 }
31 33
  34 + lazy var webView: WKWebView = {
  35 + let config = WKWebViewConfiguration()
  36 + let webView = WKWebView.init(frame: .zero, configuration: config)
  37 + webView.backgroundColor = .white
  38 + webView.allowsBackForwardNavigationGestures = true
  39 + webView.navigationDelegate = self
  40 + webView.uiDelegate = self
  41 + return webView
  42 + }()
  43 +
32 override func viewDidLoad() { 44 override func viewDidLoad() {
33 super.viewDidLoad() 45 super.viewDidLoad()
34 var attrString = "" 46 var attrString = ""
35 switch _show_type { 47 switch _show_type {
36 - case .service:  
37 - titleName = "APP用户服务协议"  
38 - attrString = "欢迎您使用元码,我们非常重视您的个人信息保护,并采取了有效措施保障您的信息安全,请您充分了解: \n为保障APP账号安全,元码APP需向您申请获取电话状态权限。 \n请您务必阅读APP《个人信息保护政策》,以充分了解我们如何处理您的个人信息。"  
39 - case .privacy:  
40 - titleName = "个人信息保护政策"  
41 - attrString = "欢迎您使用元码,我们非常重视您的个人信息保护,并采取了有效措施保障您的信息安全,请您充分了解: \n为保障APP账号安全,元码APP需向您申请获取电话状态权限 \n请您务必阅读APP《个人信息保护政策》,以充分了解我们如何处理您的个人信息。"  
42 - case .none:  
43 - break  
44 - } 48 + case .service:
  49 + titleName = "APP用户服务协议"
  50 + attrString = "https://wjjh5.cnlive.com/yuanmaYhxy.html"
  51 + case .privacy:
  52 + titleName = "个人信息保护政策"
  53 + attrString = "https://wjjh5.cnlive.com/yuanmaYszc.html"
  54 + case .yinsi:
  55 + titleName = "隐私协议"
  56 + attrString = "https://wjjh5.cnlive.com/yuanmaYszc.html"
  57 + case .none:
  58 + break
  59 + }
45 60
46 - let paraph = NSMutableParagraphStyle()  
47 - paraph.lineSpacing = 10  
48 - let attributes = [NSAttributedString.Key.font:Font_16_Fit,  
49 - NSAttributedString.Key.paragraphStyle: paraph]  
50 - let h = attrString.boundingRect(with: CGSize(width: KSreenWidth - 40, height: CGFloat(MAXFLOAT)), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size.height + 40  
51 - let textView = UITextView.init()  
52 - textView.attributedText = NSAttributedString(string: attrString, attributes: attributes)  
53 - textView.textColor = HexColor("#666666")  
54 - textView.layer.cornerRadius = 10  
55 - textView.layer.masksToBounds = true  
56 - textView.textAlignment = .left  
57 - textView.contentMode = .scaleAspectFill  
58 - textView.contentInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)  
59 - textView.sizeToFit()  
60 - view.addSubview(textView)  
61 - textView.snp.makeConstraints { make in  
62 - make.centerX.equalToSuperview()  
63 - make.top.equalToSuperview().offset(get_system_nav_height() + 10)  
64 - make.left.equalToSuperview().offset(10)  
65 - make.right.equalToSuperview().offset(-10)  
66 - make.height.equalTo(h) 61 + view.addSubview(webView)
  62 + webView.snp.makeConstraints { make in
  63 + make.top.equalToSuperview().offset(get_system_nav_height())
  64 + make.left.right.bottom.equalToSuperview()
67 } 65 }
  66 +
  67 + webView.load(URLRequest(url: URL(string: attrString)!, cachePolicy: .returnCacheDataElseLoad))
68 } 68 }
69 69
  70 +
  71 +// override func viewDidLoad() {
  72 +// super.viewDidLoad()
  73 +// var attrString = ""
  74 +// switch _show_type {
  75 +// case .service:
  76 +// titleName = "APP用户服务协议"
  77 +// attrString = "欢迎您使用元码,我们非常重视您的个人信息保护,并采取了有效措施保障您的信息安全,请您充分了解: \n为保障APP账号安全,元码APP需向您申请获取电话状态权限。 \n请您务必阅读APP《个人信息保护政策》,以充分了解我们如何处理您的个人信息。"
  78 +// case .privacy:
  79 +// titleName = "个人信息保护政策"
  80 +// attrString = "欢迎您使用元码,我们非常重视您的个人信息保护,并采取了有效措施保障您的信息安全,请您充分了解: \n为保障APP账号安全,元码APP需向您申请获取电话状态权限 \n请您务必阅读APP《个人信息保护政策》,以充分了解我们如何处理您的个人信息。"
  81 +// case .none:
  82 +// break
  83 +// }
  84 +//
  85 +// let paraph = NSMutableParagraphStyle()
  86 +// paraph.lineSpacing = 10
  87 +// let attributes = [NSAttributedString.Key.font:Font_16_Fit,
  88 +// NSAttributedString.Key.paragraphStyle: paraph]
  89 +// let h = attrString.boundingRect(with: CGSize(width: KSreenWidth - 40, height: CGFloat(MAXFLOAT)), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size.height + 40
  90 +// let textView = UITextView.init()
  91 +// textView.attributedText = NSAttributedString(string: attrString, attributes: attributes)
  92 +// textView.textColor = HexColor("#666666")
  93 +// textView.layer.cornerRadius = 10
  94 +// textView.layer.masksToBounds = true
  95 +// textView.textAlignment = .left
  96 +// textView.contentMode = .scaleAspectFill
  97 +// textView.contentInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
  98 +// textView.sizeToFit()
  99 +// view.addSubview(textView)
  100 +// textView.snp.makeConstraints { make in
  101 +// make.centerX.equalToSuperview()
  102 +// make.top.equalToSuperview().offset(get_system_nav_height() + 10)
  103 +// make.left.equalToSuperview().offset(10)
  104 +// make.right.equalToSuperview().offset(-10)
  105 +// make.height.equalTo(h)
  106 +// }
  107 +// }
  108 +
70 } 109 }
metaCode/Classes/Main/MinePage/Controller/CNLiveMineInfoViewController.swift
@@ -17,7 +17,8 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl @@ -17,7 +17,8 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl
17 imageView.backgroundColor = .clear 17 imageView.backgroundColor = .clear
18 imageView.contentMode = .scaleToFill 18 imageView.contentMode = .scaleToFill
19 imageView.image = UIImage(named: "mine_header_icon_defult_ava") 19 imageView.image = UIImage(named: "mine_header_icon_defult_ava")
20 - imageView.image = _image 20 + imageView.kf.indicatorType = .activity
  21 + imageView.kf.setImage(with: URL(string: UserInfoManager.shared.userInfo.bigFaceUrl), placeholder: UIImage(named: "mine_header_icon_defult_ava"))
21 return imageView 22 return imageView
22 }() 23 }()
23 24
@@ -57,12 +58,10 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl @@ -57,12 +58,10 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl
57 }() 58 }()
58 59
59 var _select_image: UIImage! 60 var _select_image: UIImage!
60 - var _image:UIImage!  
61 var reslut: ClickInfoResultBlock 61 var reslut: ClickInfoResultBlock
62 - init(image:UIImage, result: @escaping ClickInfoResultBlock) { 62 + init(result: @escaping ClickInfoResultBlock) {
63 self.reslut = result 63 self.reslut = result
64 super.init(nibName:nil, bundle:nil) 64 super.init(nibName:nil, bundle:nil)
65 - _image = image  
66 } 65 }
67 66
68 required init?(coder: NSCoder) { 67 required init?(coder: NSCoder) {
@@ -106,10 +105,12 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl @@ -106,10 +105,12 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl
106 make.width.equalTo((KSreenWidth - 60)*0.65) 105 make.width.equalTo((KSreenWidth - 60)*0.65)
107 } 106 }
108 sendBtn.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 1),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) 107 sendBtn.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 1),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5))
  108 +
109 } 109 }
110 110
111 override var preferredStatusBarStyle: UIStatusBarStyle { 111 override var preferredStatusBarStyle: UIStatusBarStyle {
112 - return .lightContent 112 +
  113 + return .lightContent
113 } 114 }
114 115
115 @objc func changeCancelAction() { 116 @objc func changeCancelAction() {
@@ -117,8 +118,11 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl @@ -117,8 +118,11 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl
117 } 118 }
118 119
119 @objc func changeSendAction() { 120 @objc func changeSendAction() {
120 - self.reslut(_select_image)  
121 - self.navigationController?.popViewController(animated: true) 121 + CNLiveMineViewModel.requestUploadIconAction(_select_image) { [self] in
  122 + //再这里进行图片上传
  123 + self.reslut(_select_image)
  124 + self.navigationController?.popViewController(animated: true)
  125 + }
122 } 126 }
123 127
124 @objc func changeAvatarAction() { 128 @objc func changeAvatarAction() {
metaCode/Classes/Main/MinePage/Controller/CNLiveMineNickViewController.swift
@@ -89,7 +89,7 @@ class CNLiveMineNickViewController: CNLiveBaseViewController, UITextFieldDelegat @@ -89,7 +89,7 @@ class CNLiveMineNickViewController: CNLiveBaseViewController, UITextFieldDelegat
89 CNLiveMineViewModel.requestUpdateUserInfoAction(type: .nickName, value: nickField.text ?? "", resultBlock: { [self] in 89 CNLiveMineViewModel.requestUpdateUserInfoAction(type: .nickName, value: nickField.text ?? "", resultBlock: { [self] in
90 let userInfo = UserInfoManager.shared.userInfo 90 let userInfo = UserInfoManager.shared.userInfo
91 userInfo.nickName = nickField.text ?? "" 91 userInfo.nickName = nickField.text ?? ""
92 - UserInfoManager.shared.cacheUserInfo(userInfo: userInfo) 92 + UserInfoManager.cacheUserInfo(userInfo: userInfo)
93 }) 93 })
94 } 94 }
95 95
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
@@ -39,11 +39,16 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, @@ -39,11 +39,16 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate,
39 let array01 : [Dictionary] = [["name":"添加身份","icon":"mine_list_icon_add_identity"]] 39 let array01 : [Dictionary] = [["name":"添加身份","icon":"mine_list_icon_add_identity"]]
40 dataArray.add(array01) 40 dataArray.add(array01)
41 let array02 : [Dictionary] = [["name":"帮助与反馈","icon":"mine_list_icon_help_feedback"], 41 let array02 : [Dictionary] = [["name":"帮助与反馈","icon":"mine_list_icon_help_feedback"],
42 - ["name":"更多设置","icon":"mine_list_icon_set_more"]] 42 + ["name":"更多设置","icon":"mine_list_icon_set_more"]]
43 dataArray.add(array02) 43 dataArray.add(array02)
44 return dataArray 44 return dataArray
45 }() 45 }()
46 46
  47 + lazy var headerView: MineHeaderView = {
  48 + let headerView = MineHeaderView.init(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: 80))
  49 + return headerView
  50 + }()
  51 +
47 override func viewDidLoad() { 52 override func viewDidLoad() {
48 super.viewDidLoad() 53 super.viewDidLoad()
49 view.backgroundColor = HexColor("#f9f9f9") 54 view.backgroundColor = HexColor("#f9f9f9")
@@ -61,6 +66,12 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, @@ -61,6 +66,12 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate,
61 } 66 }
62 } 67 }
63 68
  69 + override func viewWillAppear(_ animated: Bool) {
  70 + super.viewWillAppear(animated)
  71 + headerView.updateHeaderView()
  72 + tableView.reloadData()
  73 + }
  74 +
64 override var preferredStatusBarStyle: UIStatusBarStyle { 75 override var preferredStatusBarStyle: UIStatusBarStyle {
65 return .lightContent 76 return .lightContent
66 } 77 }
@@ -124,7 +135,6 @@ extension CNLiveMineViewController { @@ -124,7 +135,6 @@ extension CNLiveMineViewController {
124 135
125 func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { 136 func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
126 if section == 0 { 137 if section == 0 {
127 - let headerView = MineHeaderView.init(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: 80))  
128 return headerView 138 return headerView
129 } 139 }
130 return UIView.init() 140 return UIView.init()
metaCode/Classes/Main/MinePage/Controller/CNLiveTypeFeedBackViewController.swift
@@ -187,7 +187,8 @@ class CNLiveTypeFeedBackViewController : CNLiveBaseViewController, UITableViewDe @@ -187,7 +187,8 @@ class CNLiveTypeFeedBackViewController : CNLiveBaseViewController, UITableViewDe
187 @objc func logoutAction() -> Void { 187 @objc func logoutAction() -> Void {
188 AlertTool.systemActionSheet(title: nil, message: nil, actionTitles: ["退出登录"]) { index in 188 AlertTool.systemActionSheet(title: nil, message: nil, actionTitles: ["退出登录"]) { index in
189 if index == 1 { 189 if index == 1 {
190 - UserInfoManager.shared.clearUserInfo() 190 + UserDefaults.standard.set(false,forKey: "is_login")
  191 + UserInfoManager.clearUserInfo()
191 let window = UIApplication.shared.delegate?.window 192 let window = UIApplication.shared.delegate?.window
192 window??.rootViewController = CNLiveLoginViewController.init() 193 window??.rootViewController = CNLiveLoginViewController.init()
193 } 194 }
@@ -276,9 +277,9 @@ extension CNLiveTypeFeedBackViewController { @@ -276,9 +277,9 @@ extension CNLiveTypeFeedBackViewController {
276 if _show_type == .info { 277 if _show_type == .info {
277 if indexPath.section == 0 { 278 if indexPath.section == 0 {
278 let cell = tableView.cellForRow(at: indexPath) as! MineBodyTwoListViewCell 279 let cell = tableView.cellForRow(at: indexPath) as! MineBodyTwoListViewCell
279 - let vc = CNLiveMineInfoViewController.init(image: cell.avatarView.image!) { image in 280 + let vc = CNLiveMineInfoViewController.init(result: { image in
280 cell.avatarView.image = image 281 cell.avatarView.image = image
281 - } 282 + })
282 self.navigationController?.pushViewController(vc, animated: true) 283 self.navigationController?.pushViewController(vc, animated: true)
283 } 284 }
284 if indexPath.section == 1 { 285 if indexPath.section == 1 {
@@ -286,13 +287,11 @@ extension CNLiveTypeFeedBackViewController { @@ -286,13 +287,11 @@ extension CNLiveTypeFeedBackViewController {
286 self.navigationController?.pushViewController(mineInfoVC, animated: true) 287 self.navigationController?.pushViewController(mineInfoVC, animated: true)
287 } 288 }
288 if indexPath.section == 2 { 289 if indexPath.section == 2 {
289 - let cell = tableView.cellForRow(at: indexPath) as! MineBodyTwoListViewCell  
290 MineInfoAlertView.showSelectView(showType: .gender) { [self] text in 290 MineInfoAlertView.showSelectView(showType: .gender) { [self] text in
291 updateWithDataSource() 291 updateWithDataSource()
292 } 292 }
293 } 293 }
294 if indexPath.section == 3 { 294 if indexPath.section == 3 {
295 - let cell = tableView.cellForRow(at: indexPath) as! MineBodyTwoListViewCell  
296 MineInfoAlertView.showSelectView(showType: .birthday) { [self] text in 295 MineInfoAlertView.showSelectView(showType: .birthday) { [self] text in
297 updateWithDataSource() 296 updateWithDataSource()
298 } 297 }
metaCode/Classes/Main/MinePage/View/CNLiveMineHeaderView.swift
@@ -62,7 +62,10 @@ class MineHeaderView : UIView { @@ -62,7 +62,10 @@ class MineHeaderView : UIView {
62 make.right.equalToSuperview().offset(-15) 62 make.right.equalToSuperview().offset(-15)
63 make.size.equalTo(30) 63 make.size.equalTo(30)
64 } 64 }
65 - 65 + updateHeaderView()
  66 + }
  67 +
  68 + public func updateHeaderView() {
66 iconView.kf.indicatorType = .activity 69 iconView.kf.indicatorType = .activity
67 iconView.kf.setImage(with: URL(string: UserInfoManager.shared.userInfo.bigFaceUrl), placeholder: UIImage(named: "mine_header_icon_defult_ava")) 70 iconView.kf.setImage(with: URL(string: UserInfoManager.shared.userInfo.bigFaceUrl), placeholder: UIImage(named: "mine_header_icon_defult_ava"))
68 nameLabel.text = UserInfoManager.shared.userInfo.nickName 71 nameLabel.text = UserInfoManager.shared.userInfo.nickName
metaCode/Classes/Main/MinePage/View/CNLiveMineInfoAlertView.swift
@@ -171,9 +171,11 @@ class MineInfoAlertView: UIView { @@ -171,9 +171,11 @@ class MineInfoAlertView: UIView {
171 171
172 wBtn.isSelected = UserInfoManager.shared.userInfo.gender == "男" 172 wBtn.isSelected = UserInfoManager.shared.userInfo.gender == "男"
173 mBtn.isSelected = UserInfoManager.shared.userInfo.gender == "女" 173 mBtn.isSelected = UserInfoManager.shared.userInfo.gender == "女"
174 - mView.isHidden = UserInfoManager.shared.userInfo.gender == "男"  
175 - wView.isHidden = UserInfoManager.shared.userInfo.gender == "女"  
176 - 174 + if UserInfoManager.shared.userInfo.gender != "未知" {
  175 + mView.isHidden = UserInfoManager.shared.userInfo.gender == "男"
  176 + wView.isHidden = UserInfoManager.shared.userInfo.gender == "女"
  177 + }
  178 +
177 setConstraints() 179 setConstraints()
178 } 180 }
179 181
@@ -311,17 +313,12 @@ class MineInfoAlertView: UIView { @@ -311,17 +313,12 @@ class MineInfoAlertView: UIView {
311 CNLiveMineViewModel.requestUpdateUserInfoAction(type: type!, value: value) { [self] in 313 CNLiveMineViewModel.requestUpdateUserInfoAction(type: type!, value: value) { [self] in
312 let userInfo = UserInfoManager.shared.userInfo 314 let userInfo = UserInfoManager.shared.userInfo
313 if type == .gender { 315 if type == .gender {
314 - if (value == "m") {  
315 - userInfo.gender = "男"  
316 - }  
317 - if (value == "f") {  
318 - userInfo.gender = "女"  
319 - } 316 + userInfo.gender = (value == "m" ? "男" : "女")
320 } 317 }
321 if type == .birthday { 318 if type == .birthday {
322 userInfo.birthday = value 319 userInfo.birthday = value
323 } 320 }
324 - UserInfoManager.shared.cacheUserInfo(userInfo: userInfo) 321 + UserInfoManager.cacheUserInfo(userInfo: userInfo)
325 result!(value) 322 result!(value)
326 } 323 }
327 } 324 }
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
@@ -15,13 +15,11 @@ enum CNLiveMineRequestType { @@ -15,13 +15,11 @@ enum CNLiveMineRequestType {
15 case location 15 case location
16 case birthday 16 case birthday
17 } 17 }
18 -// 修改用户信息成功 18 +// 成功
19 typealias resultSuccessBlock = () -> Void 19 typealias resultSuccessBlock = () -> Void
20 20
21 class CNLiveMineViewModel: NSObject { 21 class CNLiveMineViewModel: NSObject {
22 22
23 -  
24 -  
25 /// 提交更新用户单项数据 23 /// 提交更新用户单项数据
26 /// - Parameters: 24 /// - Parameters:
27 /// - type: nickName-昵称,gender-性别,email-邮箱, location-联系方式,birthday-生日yyyy-MM-dd 25 /// - type: nickName-昵称,gender-性别,email-邮箱, location-联系方式,birthday-生日yyyy-MM-dd
@@ -52,23 +50,109 @@ class CNLiveMineViewModel: NSObject { @@ -52,23 +50,109 @@ class CNLiveMineViewModel: NSObject {
52 } 50 }
53 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid") 51 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid")
54 param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token") 52 param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token")
55 - tip.showLoading(message: "") 53 + showLoading(message: "")
56 CNLiveNetworking.setAllowRequestDefaultArgument(true) 54 CNLiveNetworking.setAllowRequestDefaultArgument(true)
57 CNLiveNetworking.setupShowDataResult(false) 55 CNLiveNetworking.setupShowDataResult(false)
58 CNLiveNetworking.requestNetwork(with: .POST, urlString: "/open/api2/user/updateUserById", param: param as! [String : Any], cacheType: .networkOnly) { task, result, error in 56 CNLiveNetworking.requestNetwork(with: .POST, urlString: "/open/api2/user/updateUserById", param: param as! [String : Any], cacheType: .networkOnly) { task, result, error in
59 - tip.hiddenLoading() 57 + hiddenLoading()
60 if (error == nil) { 58 if (error == nil) {
61 let resp = result as! NSDictionary 59 let resp = result as! NSDictionary
62 let errorCode = resp["errorCode"] 60 let errorCode = resp["errorCode"]
63 if (errorCode as! String == "0") { 61 if (errorCode as! String == "0") {
64 - tip.showMessage(message: "更改成功") 62 + showMessage(message: "更改成功")
65 resultBlock() 63 resultBlock()
66 } else { 64 } else {
67 - tip.showMessage(message: resp["errorMessage"] as! String) 65 + showMessage(message: resp["errorMessage"] as! String)
68 } 66 }
69 } else { 67 } else {
70 - tip.showMessage(message: "修改信息失败") 68 + showMessage(message: "修改信息失败")
  69 + }
  70 + }
  71 + }
  72 +
  73 +
  74 + /// 上传并修改头像
  75 + /// - Parameters:
  76 + /// - image: 头像
  77 + /// - resultBlock: 返回
  78 + static func requestUploadIconAction(_ image: UIImage,resultBlock: @escaping resultSuccessBlock) {
  79 +
  80 + CNLiveMineViewModel.requestAccessTokenAction() {
  81 + let param = NSMutableDictionary.init()
  82 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid")
  83 + param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token")
  84 + param.setValue(UserInfoManager.shared.userInfo.access_token, forKey: "access_token")
  85 + showLoading(message: "修改头像中...")
  86 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  87 + CNLiveNetworking.setupShowDataResult(false)
  88 + CNLiveNetworking.uploadNetwork(withURLString: "/open/api2/user/updateUserFaceById", param: param as? [AnyHashable : Any]) { formData in
  89 + let imageData = image.jpegData(compressionQuality: 1.0)
  90 + formData?.appendPart(withFileData: imageData! as Data, name: "face", fileName: ".jpg", mimeType: "image/jpg")
  91 + } progressBlock: { progress in
  92 + print("已上传==>\(progress!.fractionCompleted*100)")
  93 + } completionBlock: { task, result, error in
  94 + hiddenLoading()
  95 + if (error == nil) {
  96 + let resp = result as! NSDictionary
  97 + let errorCode = resp["errorCode"]
  98 + if (errorCode as! String == "0") {
  99 + showMessage(message: "头像更改成功")
  100 + let data = resp["data"] as! Dictionary<String, Any>
  101 + let userInfo = UserInfoManager.shared.userInfo
  102 + userInfo.faceUrl = data["faceUrl"] as! String
  103 + userInfo.bigFaceUrl = data["bigFaceUrl"] as! String
  104 + UserInfoManager.cacheUserInfo(userInfo: userInfo)
  105 + resultBlock()
  106 + } else {
  107 + showMessage(message: resp["errorMessage"] as! String)
  108 + }
  109 + } else {
  110 + showMessage(message: "头像更改成功")
  111 + }
71 } 112 }
72 } 113 }
73 } 114 }
  115 +
  116 + /// 获取access_token
  117 + /// - Parameter resultBlock: 结果返回
  118 + static func requestAccessTokenAction(resultBlock: @escaping resultSuccessBlock) {
  119 + //当前时间大于最大允许时间则表明当前access_token已经过期需要重新请求
  120 + if CNLiveMineViewModel.timeStamp > NSNumber(string: UserInfoManager.shared.userInfo.expires_in)?.intValue ?? 0 {
  121 + let param = NSMutableDictionary.init()
  122 + param.setValue("802_li40qhp922", forKey: "appId")
  123 + param.setValue("3cc9f12db322a3d3656012ef929604cf6d6847471535f9", forKey: "secret")
  124 + showLoading(message: "")
  125 + CNLiveNetworking.setAllowRequestDefaultArgument(false)
  126 + CNLiveNetworking.setupShowDataResult(false)
  127 + CNLiveNetworking.requestNetwork(with: .POST, urlString: "/open/api2/token", param: (param as! [AnyHashable : Any]), cacheType: .networkOnly) { task, result, error in
  128 + hiddenLoading()
  129 + if (error == nil) {
  130 + let resp = result as! NSDictionary
  131 + let errorCode = "\(resp["errorCode"] ?? 0)"
  132 + if (errorCode == "0") {
  133 + let data = resp["data"] as! Dictionary<String, Any>
  134 + let userInfo = UserInfoManager.shared.userInfo
  135 + userInfo.access_token = data["access_token"] as! String
  136 + let expires_in = data["expires_in"] as! NSNumber
  137 + userInfo.expires_in = "\(expires_in.intValue+CNLiveMineViewModel.timeStamp)"
  138 + UserInfoManager.cacheUserInfo(userInfo: userInfo)
  139 + resultBlock()
  140 + } else {
  141 + showMessage(message: resp["errorMessage"] as! String)
  142 + }
  143 + } else {
  144 + showMessage(message: "修改头像失败")
  145 + }
  146 + }
  147 + } else {
  148 + resultBlock()
  149 + }
  150 + }
  151 +
  152 + /// 获取十位时间戳
  153 + static var timeStamp: Int {
  154 + let timeInterval: TimeInterval = NSDate().timeIntervalSince1970
  155 + let timeStamp = Int(timeInterval)
  156 + return timeStamp
  157 + }
74 } 158 }
metaCode/Classes/Other/AppDelegate.swift
@@ -8,7 +8,6 @@ @@ -8,7 +8,6 @@
8 import UIKit 8 import UIKit
9 import CNLiveRequestBastKit 9 import CNLiveRequestBastKit
10 import IQKeyboardManagerSwift 10 import IQKeyboardManagerSwift
11 -import SwiftyUserDefaults  
12 11
13 @main 12 @main
14 class AppDelegate: UIResponder, UIApplicationDelegate { 13 class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -21,8 +20,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { @@ -21,8 +20,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
21 20
22 window = UIWindow.init(frame: UIScreen.main.bounds) 21 window = UIWindow.init(frame: UIScreen.main.bounds)
23 window?.backgroundColor = KVCBackgroupColor 22 window?.backgroundColor = KVCBackgroupColor
24 - window?.rootViewController = UserInfoManager.shared.is_login ? CNLiveBaseTabBarViewController.init() : CNLiveLoginViewController.init()  
25 -// window?.rootViewController = CNLiveBaseTabBarViewController.init() 23 + let is_login = UserDefaults.standard.bool(forKey: "is_login")
  24 + window?.rootViewController = is_login ? CNLiveBaseTabBarViewController.init() : CNLiveLoginViewController.init()
26 window?.makeKeyAndVisible() 25 window?.makeKeyAndVisible()
27 26
28 27