1. 修正登录页 UI 布局和文案

2. 调整首页 tab 关注逻辑
This commit is contained in:
eggmanQQQ
2024-07-17 12:19:18 +08:00
parent 7109bdbd11
commit 5e097ba6f9
7 changed files with 159 additions and 70 deletions

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E884E85A2B6900C500ADE6EE"
BuildableName = "yinmeng-ios.app"
BlueprintName = "yinmeng-ios"
ReferencedContainer = "container:yinmeng-ios.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E884E85A2B6900C500ADE6EE"
BuildableName = "yinmeng-ios.app"
BlueprintName = "yinmeng-ios"
ReferencedContainer = "container:yinmeng-ios.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E884E85A2B6900C500ADE6EE"
BuildableName = "yinmeng-ios.app"
BlueprintName = "yinmeng-ios"
ReferencedContainer = "container:yinmeng-ios.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -19,21 +19,21 @@ var window: UIWindow?
self.window = UIWindow.init(frame: UIScreen.main.bounds)
self.window?.backgroundColor = UIColor.white
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
loadNIMSDK()
loginStateListener()
loadNIMSDK()
loginStateListener()
return true
}
private func loginStateListener() {
AuthViewModel.authVM.appClientConfig()
///
AuthViewModel.authVM.checkUserIsLogin()
AuthViewModel.authVM.loginSuccess.subscribe(onNext: { result in
print("是否登录成功\(result)")
AuthViewModel.authVM.loginSuccess.subscribe(onNext: { [weak self] result in
guard let strongSelf = self else { return }
if result == true {
///tabbar
self.window?.rootViewController = BaseTabBarViewController()
strongSelf.window?.rootViewController = BaseTabBarViewController()
let uid = AuthManager.userUid
if uid > 0 {
UserViewModel.userVM.getUserInfo(uid: uid)
@@ -41,29 +41,31 @@ var window: UIWindow?
if NIMSDK.shared().loginManager.isLogined() == false {
if let uid = LoginTokenConfig.config.getAccountInfo()?.uid, let token = LoginTokenConfig.config.getAccountInfo()?.netEaseToken {
NIMSDK.shared().loginManager.login("\(uid)", token: token) { error in
print("aaa")
print("login error: \(String(describing: error))")
}
} else {
///
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
strongSelf.showLoginPage()
}
}
} else {
///
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
strongSelf.showLoginPage()
}
}).disposed(by: rx.disposeBag)
UserViewModel.userVM.selfInfo.subscribe(onNext: { result in
UserViewModel.userVM.selfInfo.subscribe(onNext: { [weak self] result in
guard let strongSelf = self else { return }
if result.nick?.count ?? 0 <= 0 || result.avatar?.count ?? 0 <= 0 {
let fillVC = AuthFillDataVC()
fillVC.modalPresentationStyle = .fullScreen
self.window?.rootViewController = fillVC
strongSelf.window?.rootViewController = fillVC
}
}).disposed(by: rx.disposeBag)
}
private func showLoginPage() {
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
}
private func loadNIMSDK() {
let opt = NIMSDKOption(appKey: AppKeys.nimAppid)
opt.apnsCername = "yinmeng_anps"

View File

@@ -7,15 +7,15 @@
import Foundation
enum AppKeys {
#if DEBUG
static let nimAppid = "5d5a833a2d0ff1304a5d8bed53d2af5b"
static let api = "http://beta.api.ymlive.fun/"
static let agoraKey = "5b4d929b6c4e4af190550c4a2ec5cd4c"
static let H5_URL = "http://beta.api.ymlive.fun"
#else
//#if DEBUG
// static let nimAppid = "5d5a833a2d0ff1304a5d8bed53d2af5b"
// static let api = "http://beta.api.ymlive.fun/"
// static let agoraKey = "5b4d929b6c4e4af190550c4a2ec5cd4c"
// static let H5_URL = "http://beta.api.ymlive.fun"
//#else
static let nimAppid = "5e76ec47632d86c30ce18eabfa332b6a"
static let api = "https://api.ymlive.fun/"
static let agoraKey = "5b4d929b6c4e4af190550c4a2ec5cd4c"
static let H5_URL = "https://h5.ymlive.fun"
#endif
//#endif
}

View File

@@ -135,7 +135,7 @@ class AuthLaunchVC: BaseViewController, HiddenNavigationBarProtocol {
private lazy var phoneLoginBtn: UIButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage.gradient([ThemeColor(hexStr: "#FF60FD"), ThemeColor(hexStr: "#8974FF"), ThemeColor(hexStr: "#69EBFF")], radius: 0), for: .normal)
button.setTitle("手机号登录", for: .normal)
button.setTitle("手机号或账号登录", for: .normal)
button.setTitleColor(UIColor.white, for: .normal)
button.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .medium)
button.layer.masksToBounds = true

View File

@@ -113,6 +113,7 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
phonetextFiled.snp.makeConstraints { make in
make.top.bottom.equalTo(phoneNumView)
make.left.equalTo(phoneNumView).offset(82)
make.right.equalTo(phoneNumView)
}
codeView.snp.makeConstraints { make in
@@ -123,7 +124,7 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
codetextFiled.snp.makeConstraints { make in
make.left.equalTo(codeView).offset(20)
make.top.bottom.equalTo(codeView)
make.right.equalTo(codeView)
}
sepView.snp.makeConstraints { make in
@@ -150,7 +151,7 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
idTextFiled.snp.makeConstraints { make in
make.left.equalTo(idView).offset(20)
make.top.bottom.equalTo(idView)
make.top.bottom.right.equalTo(idView)
}
pwdView.snp.makeConstraints { make in
@@ -161,7 +162,7 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
pwdTextFiled.snp.makeConstraints { make in
make.left.equalTo(pwdView).offset(20)
make.top.bottom.equalTo(pwdView)
make.top.bottom.right.equalTo(pwdView)
}
forgetBtn.snp.makeConstraints { make in
@@ -175,8 +176,6 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
make.height.equalTo(52)
make.top.equalTo(phoneView.snp.bottom).offset(44)
}
}

View File

@@ -20,28 +20,34 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
requestData()
requsetFansListData()
requestFansListData()
}
override func viewDidLoad() {
super.viewDidLoad()
setUILayout()
requestData()
requsetFansListData()
setUILayout()
requestData()
requestFansListData()
displayGuide()
userInfoBtn.addTarget(self, action: #selector(userInfoBtnAction), for: .touchUpInside)
}
func displayGuide() {
if (UserDefaults.standard.value(forKey:"kIsShowGuide") != nil){return}
UserDefaults.standard.setValue("yes", forKey: "kIsShowGuide")
let guideVeiw = HomeVoiceGuideView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight))
keyWindow.addSubview(guideVeiw)
}
@objc func userInfoBtnAction(){
let userInfoView:HomeVoiceUserInfoView = HomeVoiceUserInfoView.init(frame: .zero)
userInfoView.clickBtnBlock = {[weak self] (type,uid) in
guard let weakSelf = self else {
guard let self = self else {
return
}
if type == 3{
let vc = UserPayViewController()
weakSelf.navigationController?.pushViewController(vc, animated: true)
self.navigationController?.pushViewController(vc, animated: true)
return
}
}
@@ -53,10 +59,12 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
}
}
func requsetFansListData(){
func requestFansListData(){
let uid = "\(AuthManager.userUid)"
RequestGet(path: "fans/following", parma: ["uid":uid,"pageNo":"1","pageSize":"50"]) { data in
RequestGet(path: "fans/following", parma: ["uid":uid,"pageNo":"1","pageSize":"50"]) { [weak self] data in
guard let self else {
return
}
if let list = Deserialized<HomeVoiceModel>.toArray(with: data) {
self.followView.modelList = list
}
@@ -65,9 +73,9 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
}
}
func setUILayout(){
view.addSubview(backgroundView)
view.addSubview(scrollView)
scrollView.addSubview(topLogoIcon)
scrollView.addSubview(searchView)
scrollView.addSubview(chooseItemVeiw)
@@ -77,10 +85,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
scrollView.addSubview(publishView)
scrollView.addSubview(bgPlayMusicView)
backgroundView.snp.makeConstraints { make in
make.edges.equalTo(self.view)
}
@@ -131,6 +135,7 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
make.width.equalTo(ScreenWidth-28)
make.height.equalTo(144)
}
publishView.superview?.layoutIfNeeded()
scrollView.contentSize = CGSize(width: ScreenWidth, height: publishView.frame.origin.y + publishView.frame.size.height)
let margin:CGFloat = (ScreenWidth - 90 * 3 - 28)/4
@@ -151,10 +156,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
let x = ScreenWidth - 28 - 44 - 3
followView.frame = CGRect(x:x , y: 3, width: 44, height: 418)
chooseTypeView.chooseTypeBlock = {[weak self] type in
guard let weakSelf = self else {
return
@@ -211,7 +212,7 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
navigationController?.present(searchVC, animated: true, completion: nil)
}
@objc func clickLongTapAction(sender:UIPanGestureRecognizer){
let i = (sender.view?.tag ?? 100) - 100
_ = (sender.view?.tag ?? 100) - 100
if sender.state == .began{
location = sender.view?.center
}else if sender.state == .changed{
@@ -223,7 +224,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
sender.view?.center = CGPoint(x: x, y: y)
sender.setTranslation(.zero, in: self.view)
}else{
guard let centerPoint = sender.view?.center else{return}
let point = CGPoint(x: centerPoint.x + 14, y: centerPoint.y+136)
@@ -239,7 +239,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
if let location = self.location{
sender.view?.center = location
}
}
}
@@ -255,31 +254,38 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
let chatVC = ChatVC.init(session: session)
self?.navigationController?.pushViewController(chatVC, animated: true)
}
userInfoView.followActionBlock = { [weak self] (isFollow, value) in
guard let self else {
return
}
self.requestFansListData()
}
userInfoView.type = 0
userInfoView.model = view.model
self.view.addSubview(userInfoView)
userInfoView.snp.makeConstraints { make in
make.edges.equalTo(self.view)
}
}
@objc func changeItemAction(){
requestData()
makeRotationAnim(view: changeItemView.leftIconView)
}
func makeRotationAnim(view: UIView) {
// 1.
let rotationAnim = CABasicAnimation(keyPath: "transform.rotation.z")
// 2.
rotationAnim.fromValue = 0 //
rotationAnim.toValue = Double.pi * 2 //
rotationAnim.repeatCount = 2 //
rotationAnim.duration = 0.5
rotationAnim.autoreverses = false // ,NO
rotationAnim.isRemovedOnCompletion = true //truefalse
view.layer.add(rotationAnim, forKey: nil) // view
}
func makeRotationAnim(view: UIView) {
// 1.
let rotationAnim = CABasicAnimation(keyPath: "transform.rotation.z")
// 2.
rotationAnim.fromValue = 0 //
rotationAnim.toValue = Double.pi * 2 //
rotationAnim.repeatCount = 2 //
rotationAnim.duration = 0.5
rotationAnim.autoreverses = false // ,NO
rotationAnim.isRemovedOnCompletion = true //truefalse
view.layer.add(rotationAnim, forKey: nil) // view
}
func requestData(){
RequestGet(path: "voiceShow/listRandom", parma: ["gender":gender]) { data in
guard let dic = data as? [String : Any]else {
@@ -296,7 +302,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
let view:HomeVoicePlayMusicItemView = self.itemViewList[i]
let model = list[i]
view.model = model
}
}
}
@@ -308,8 +313,8 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
@objc func chooseItemAction(){
chooseItemVeiw.isChoose = !chooseItemVeiw.isChoose
chooseTypeView.isHidden = !chooseItemVeiw.isChoose
}
var gender = ""
private lazy var backgroundView:UIImageView = {
let _backgroundView = UIImageView()
@@ -347,8 +352,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
let _userInfoBtn = UIButton()
_userInfoBtn.setBackgroundImage(UIImage(named: "yin_home_voice_user_info_bg"), for: .normal)
_userInfoBtn.setImage(UIImage(named: "yin_home_voice_user_info_icon"), for: .normal)
return _userInfoBtn
}()
var chooseTypeView:HomeVoiceChooseTypeView = {

View File

@@ -10,10 +10,12 @@ import Nuke
typealias ClickBtnBlock = (_ type: Int ,_ uid:String)->Void
typealias FollowBlockType = (_ isFollow: Bool, _ value: Int) -> Void
class HomeVoiceUserInfoView: UIView {
var clickBtnBlock:ClickBtnBlock?
var followActionBlock: FollowBlockType?
override init(frame: CGRect) {
super.init(frame: frame)
setUILayout()
@@ -151,7 +153,6 @@ class HomeVoiceUserInfoView: UIView {
if let _clickBtnBlock = clickBtnBlock,let uid = self.model?.uid{
_clickBtnBlock(3,"\(uid)")
}
return
}
self.attentionBtn.isSelected = !self.attentionBtn.isSelected
@@ -160,14 +161,20 @@ class HomeVoiceUserInfoView: UIView {
guard let getUid = uid else{return}
let params = ["uid":"\(AuthManager.userUid)","ticket":AuthManager.ticket,"type":type,"likedUid":"\(getUid)"] as [String : Any]
RequestPost(path: "fans/like", parma: params) { data in
RequestPost(path: "fans/like", parma: params) { [weak self] data in
guard let self else { return }
if let _followAction = followActionBlock {
_followAction(self.attentionBtn.isSelected, 1)
}
if(self.attentionBtn.isSelected){
HUDTool.show(with: "关注成功")
}else{
HUDTool.show(with: "取消关注成功")
}
} fail: { code, data in
self.attentionBtn.isSelected = !self.attentionBtn.isSelected
HUDTool.show(with: data)
}
}
@objc func chatBtnAction(){