Commit 209cfcb313e12be2b1f729a23ea95d9f6e2a5d2b
1 parent
5b6e476f
提交修改
Showing
5 changed files
with
91 additions
and
15 deletions
metaCode.xcodeproj/project.pbxproj
| ... | ... | @@ -28,6 +28,7 @@ |
| 28 | 28 | 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */; }; |
| 29 | 29 | 796398942A260C0100D045EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963988D2A260C0100D045EB /* AppDelegate.swift */; }; |
| 30 | 30 | 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */; }; |
| 31 | + 7978A8432A396632007C86B8 /* CNLiveMineViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7978A8422A396632007C86B8 /* CNLiveMineViewModel.swift */; }; | |
| 31 | 32 | 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44E72A30134400815935 /* CNLiveMineHeaderView.swift */; }; |
| 32 | 33 | 798A44EA2A30135D00815935 /* CNLiveMineBodyListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44E92A30135D00815935 /* CNLiveMineBodyListView.swift */; }; |
| 33 | 34 | 798A44EC2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44EB2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift */; }; |
| ... | ... | @@ -42,12 +43,12 @@ |
| 42 | 43 | 798A44FF2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44FE2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift */; }; |
| 43 | 44 | 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; |
| 44 | 45 | 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; |
| 45 | - 7C2703302A36CBE30061EC50 /* CNCertificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */; }; | |
| 46 | - 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2703322A36CC660061EC50 /* CNLiveGlobalBlock.swift */; }; | |
| 47 | 46 | 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */; }; |
| 48 | 47 | 79F4B1182A32C5FA00993C03 /* CNLiveBaseMoel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1172A32C5FA00993C03 /* CNLiveBaseMoel.swift */; }; |
| 49 | 48 | 79F4B11A2A32F21400993C03 /* CNLiveMineNickViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */; }; |
| 50 | 49 | 79F4B11C2A33036E00993C03 /* CNLiveMineInfoAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B11B2A33036E00993C03 /* CNLiveMineInfoAlertView.swift */; }; |
| 50 | + 7C2703302A36CBE30061EC50 /* CNCertificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */; }; | |
| 51 | + 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2703322A36CC660061EC50 /* CNLiveGlobalBlock.swift */; }; | |
| 51 | 52 | 7C4931292A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C4931282A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift */; }; |
| 52 | 53 | 7C49312D2A2DB9FA000E44B4 /* UITabBar+CNBadge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C49312C2A2DB9FA000E44B4 /* UITabBar+CNBadge.swift */; }; |
| 53 | 54 | 7C4931312A2F142F000E44B4 /* CNHomePageBackgroupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C4931302A2F142F000E44B4 /* CNHomePageBackgroupView.swift */; }; |
| ... | ... | @@ -117,6 +118,7 @@ |
| 117 | 118 | 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInfoShowViewController.swift; sourceTree = "<group>"; }; |
| 118 | 119 | 7963988D2A260C0100D045EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; |
| 119 | 120 | 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveBaseViewController.swift; sourceTree = "<group>"; }; |
| 121 | + 7978A8422A396632007C86B8 /* CNLiveMineViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineViewModel.swift; sourceTree = "<group>"; }; | |
| 120 | 122 | 798A44E72A30134400815935 /* CNLiveMineHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineHeaderView.swift; sourceTree = "<group>"; }; |
| 121 | 123 | 798A44E92A30135D00815935 /* CNLiveMineBodyListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineBodyListView.swift; sourceTree = "<group>"; }; |
| 122 | 124 | 798A44EB2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineAddInfoViewController.swift; sourceTree = "<group>"; }; |
| ... | ... | @@ -130,12 +132,12 @@ |
| 130 | 132 | 798A44FC2A309EBA00815935 /* CNLiveTypeFeedBackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveTypeFeedBackViewController.swift; sourceTree = "<group>"; }; |
| 131 | 133 | 798A44FE2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInputFeedBackViewController.swift; sourceTree = "<group>"; }; |
| 132 | 134 | 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; }; |
| 133 | - 7C27032F2A36CBE30061EC50 /* CNCertificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNCertificationView.swift; sourceTree = "<group>"; }; | |
| 134 | - 7C2703322A36CC660061EC50 /* CNLiveGlobalBlock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveGlobalBlock.swift; sourceTree = "<group>"; }; | |
| 135 | 135 | 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInfoViewController.swift; sourceTree = "<group>"; }; |
| 136 | 136 | 79F4B1172A32C5FA00993C03 /* CNLiveBaseMoel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveBaseMoel.swift; sourceTree = "<group>"; }; |
| 137 | 137 | 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineNickViewController.swift; sourceTree = "<group>"; }; |
| 138 | 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>"; }; | |
| 140 | + 7C2703322A36CC660061EC50 /* CNLiveGlobalBlock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveGlobalBlock.swift; sourceTree = "<group>"; }; | |
| 139 | 141 | 7C4931282A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveBaseTabBarViewController.swift; sourceTree = "<group>"; }; |
| 140 | 142 | 7C49312C2A2DB9FA000E44B4 /* UITabBar+CNBadge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITabBar+CNBadge.swift"; sourceTree = "<group>"; }; |
| 141 | 143 | 7C4931302A2F142F000E44B4 /* CNHomePageBackgroupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNHomePageBackgroupView.swift; sourceTree = "<group>"; }; |
| ... | ... | @@ -408,18 +410,11 @@ |
| 408 | 410 | 798A44E62A30130600815935 /* ViewModel */ = { |
| 409 | 411 | isa = PBXGroup; |
| 410 | 412 | children = ( |
| 413 | + 7978A8422A396632007C86B8 /* CNLiveMineViewModel.swift */, | |
| 411 | 414 | ); |
| 412 | 415 | path = ViewModel; |
| 413 | 416 | sourceTree = "<group>"; |
| 414 | 417 | }; |
| 415 | - 7C2703312A36CC430061EC50 /* GlobalBlock */ = { | |
| 416 | - isa = PBXGroup; | |
| 417 | - children = ( | |
| 418 | - 7C2703322A36CC660061EC50 /* CNLiveGlobalBlock.swift */, | |
| 419 | - ); | |
| 420 | - path = GlobalBlock; | |
| 421 | - sourceTree = "<group>"; | |
| 422 | - }; | |
| 423 | 418 | 798A44F32A3077ED00815935 /* CustomView */ = { |
| 424 | 419 | isa = PBXGroup; |
| 425 | 420 | children = ( |
| ... | ... | @@ -430,6 +425,14 @@ |
| 430 | 425 | path = CustomView; |
| 431 | 426 | sourceTree = "<group>"; |
| 432 | 427 | }; |
| 428 | + 7C2703312A36CC430061EC50 /* GlobalBlock */ = { | |
| 429 | + isa = PBXGroup; | |
| 430 | + children = ( | |
| 431 | + 7C2703322A36CC660061EC50 /* CNLiveGlobalBlock.swift */, | |
| 432 | + ); | |
| 433 | + path = GlobalBlock; | |
| 434 | + sourceTree = "<group>"; | |
| 435 | + }; | |
| 433 | 436 | 7CD675212A26F844008354C1 /* HomePage */ = { |
| 434 | 437 | isa = PBXGroup; |
| 435 | 438 | children = ( |
| ... | ... | @@ -817,6 +820,7 @@ |
| 817 | 820 | 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, |
| 818 | 821 | 790D01912A2DAC5E00C5978D /* CNLiveConfigFontMacro.swift in Sources */, |
| 819 | 822 | 790D01852A2D89E100C5978D /* UIColor+CNHexColor.swift in Sources */, |
| 823 | + 7978A8432A396632007C86B8 /* CNLiveMineViewModel.swift in Sources */, | |
| 820 | 824 | 798A44EE2A305AAC00815935 /* CNLiveBaseNavigationController.swift in Sources */, |
| 821 | 825 | 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, |
| 822 | 826 | 7C4931292A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift in Sources */, | ... | ... |
metaCode/Classes/Main/LoginPage/Controller/CNLiveLoginViewController.swift
| ... | ... | @@ -283,6 +283,7 @@ extension CNLiveLoginViewController { |
| 283 | 283 | } |
| 284 | 284 | view.endEditing(true) |
| 285 | 285 | CNLiveLoginViewModel.requestLoginAction(userName: phoneText.text ?? "", countryCode: country, verCode: veriText.text ?? "") { |
| 286 | + UserInfoManager.shared.clearUserInfo() | |
| 286 | 287 | let window = UIApplication.shared.delegate?.window |
| 287 | 288 | window??.rootViewController = CNLiveBaseTabBarViewController.init() |
| 288 | 289 | } | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveTypeFeedBackViewController.swift
| ... | ... | @@ -175,7 +175,9 @@ class CNLiveTypeFeedBackViewController : CNLiveBaseViewController, UITableViewDe |
| 175 | 175 | @objc func logoutAction() -> Void { |
| 176 | 176 | AlertTool.systemActionSheet(title: nil, message: nil, actionTitles: ["退出登录"]) { index in |
| 177 | 177 | if index == 1 { |
| 178 | - print("退出登录") | |
| 178 | + | |
| 179 | + let window = UIApplication.shared.delegate?.window | |
| 180 | + window??.rootViewController = CNLiveLoginViewController.init() | |
| 179 | 181 | } |
| 180 | 182 | } |
| 181 | 183 | } | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveMineViewModel.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by open on 2023/6/14. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import CNLiveRequestBastKit | |
| 10 | + | |
| 11 | +enum CNLiveMineRequestType { | |
| 12 | + case nickName | |
| 13 | + case gender | |
| 14 | + case email | |
| 15 | + case location | |
| 16 | + case birthday | |
| 17 | +} | |
| 18 | +// 修改用户信息成功 | |
| 19 | +typealias resultSuccessBlock = () -> Void | |
| 20 | + | |
| 21 | +class CNLiveMineViewModel: NSObject { | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + /// 提交更新用户单项数据 | |
| 26 | + /// - Parameters: | |
| 27 | + /// - type: nickName-昵称,gender-性别,email-邮箱, location-联系方式,birthday-生日yyyy-MM-dd | |
| 28 | + /// - value: 对应的信息,性别,m:男、f:女、n:未知 | |
| 29 | + static func requestUpdateUserInfoAction(type: CNLiveMineRequestType,value: String, resultBlock: @escaping resultSuccessBlock) { | |
| 30 | + | |
| 31 | + var param = NSMutableDictionary.init() | |
| 32 | + if type == .nickName { | |
| 33 | + param.setValue("nickName", forKey: "type") | |
| 34 | + param.setValue(value, forKey: "value") | |
| 35 | + } | |
| 36 | + if type == .gender { | |
| 37 | + param.setValue("gender", forKey: "type") | |
| 38 | + | |
| 39 | + param.setValue(value, forKey: "value") | |
| 40 | + } | |
| 41 | + if type == .email { | |
| 42 | + param.setValue("email", forKey: "type") | |
| 43 | + param.setValue(value, forKey: "value") | |
| 44 | + } | |
| 45 | + if type == .location { | |
| 46 | + param.setValue("location", forKey: "type") | |
| 47 | + param.setValue(value, forKey: "value") | |
| 48 | + } | |
| 49 | + if type == .birthday { | |
| 50 | + param.setValue("nickName", forKey: "type") | |
| 51 | + param.setValue(value, forKey: "value") | |
| 52 | + } | |
| 53 | + | |
| 54 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: "/open/api2/user/updateUserById", param: param as! [String : Any], cacheType: .networkOnly) { task, result, error in | |
| 55 | + if (error == nil) { | |
| 56 | + let resp = result as! NSDictionary | |
| 57 | + let errorCode = resp["errorCode"] | |
| 58 | + if (errorCode as! String == "0") { | |
| 59 | + tip.showMessage(message: "更改成功") | |
| 60 | + resultBlock() | |
| 61 | + } else { | |
| 62 | + tip.showMessage(message: resp["errorMessage"] as! String) | |
| 63 | + } | |
| 64 | + } else { | |
| 65 | + tip.showMessage(message: "修改信息失败") | |
| 66 | + } | |
| 67 | + } | |
| 68 | + } | |
| 69 | +} | ... | ... |
metaCode/Classes/Other/AppDelegate.swift
| ... | ... | @@ -21,8 +21,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { |
| 21 | 21 | |
| 22 | 22 | window = UIWindow.init(frame: UIScreen.main.bounds) |
| 23 | 23 | window?.backgroundColor = KVCBackgroupColor |
| 24 | -// window?.rootViewController = UserInfoManager.shared.is_login ? CNLiveBaseTabBarViewController.init() : CNLiveLoginViewController.init() | |
| 25 | - window?.rootViewController = CNLiveBaseTabBarViewController.init() | |
| 24 | + window?.rootViewController = UserInfoManager.shared.is_login ? CNLiveBaseTabBarViewController.init() : CNLiveLoginViewController.init() | |
| 25 | +// window?.rootViewController = CNLiveBaseTabBarViewController.init() | |
| 26 | 26 | window?.makeKeyAndVisible() |
| 27 | 27 | |
| 28 | 28 | ... | ... |