1. 修正登录页 UI 布局和文案
2. 调整首页 tab 关注逻辑
This commit is contained in:
@@ -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>
|
@@ -19,21 +19,21 @@ var window: UIWindow?
|
|||||||
self.window = UIWindow.init(frame: UIScreen.main.bounds)
|
self.window = UIWindow.init(frame: UIScreen.main.bounds)
|
||||||
self.window?.backgroundColor = UIColor.white
|
self.window?.backgroundColor = UIColor.white
|
||||||
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
|
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
|
||||||
loadNIMSDK()
|
|
||||||
loginStateListener()
|
|
||||||
|
|
||||||
|
loadNIMSDK()
|
||||||
|
loginStateListener()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private func loginStateListener() {
|
private func loginStateListener() {
|
||||||
AuthViewModel.authVM.appClientConfig()
|
AuthViewModel.authVM.appClientConfig()
|
||||||
///检车是否已经登录
|
|
||||||
AuthViewModel.authVM.checkUserIsLogin()
|
AuthViewModel.authVM.checkUserIsLogin()
|
||||||
AuthViewModel.authVM.loginSuccess.subscribe(onNext: { result in
|
AuthViewModel.authVM.loginSuccess.subscribe(onNext: { [weak self] result in
|
||||||
print("是否登录成功\(result)")
|
guard let strongSelf = self else { return }
|
||||||
|
|
||||||
if result == true {
|
if result == true {
|
||||||
///如果登录成功显示tabbar
|
///如果登录成功显示tabbar
|
||||||
self.window?.rootViewController = BaseTabBarViewController()
|
strongSelf.window?.rootViewController = BaseTabBarViewController()
|
||||||
let uid = AuthManager.userUid
|
let uid = AuthManager.userUid
|
||||||
if uid > 0 {
|
if uid > 0 {
|
||||||
UserViewModel.userVM.getUserInfo(uid: uid)
|
UserViewModel.userVM.getUserInfo(uid: uid)
|
||||||
@@ -41,29 +41,31 @@ var window: UIWindow?
|
|||||||
if NIMSDK.shared().loginManager.isLogined() == false {
|
if NIMSDK.shared().loginManager.isLogined() == false {
|
||||||
if let uid = LoginTokenConfig.config.getAccountInfo()?.uid, let token = LoginTokenConfig.config.getAccountInfo()?.netEaseToken {
|
if let uid = LoginTokenConfig.config.getAccountInfo()?.uid, let token = LoginTokenConfig.config.getAccountInfo()?.netEaseToken {
|
||||||
NIMSDK.shared().loginManager.login("\(uid)", token: token) { error in
|
NIMSDK.shared().loginManager.login("\(uid)", token: token) { error in
|
||||||
print("aaa")
|
print("login error: \(String(describing: error))")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
///去登录
|
strongSelf.showLoginPage()
|
||||||
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
///去登录
|
strongSelf.showLoginPage()
|
||||||
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
|
|
||||||
}
|
}
|
||||||
}).disposed(by: rx.disposeBag)
|
}).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 {
|
if result.nick?.count ?? 0 <= 0 || result.avatar?.count ?? 0 <= 0 {
|
||||||
let fillVC = AuthFillDataVC()
|
let fillVC = AuthFillDataVC()
|
||||||
fillVC.modalPresentationStyle = .fullScreen
|
fillVC.modalPresentationStyle = .fullScreen
|
||||||
self.window?.rootViewController = fillVC
|
strongSelf.window?.rootViewController = fillVC
|
||||||
}
|
}
|
||||||
}).disposed(by: rx.disposeBag)
|
}).disposed(by: rx.disposeBag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func showLoginPage() {
|
||||||
|
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
|
||||||
|
}
|
||||||
|
|
||||||
private func loadNIMSDK() {
|
private func loadNIMSDK() {
|
||||||
let opt = NIMSDKOption(appKey: AppKeys.nimAppid)
|
let opt = NIMSDKOption(appKey: AppKeys.nimAppid)
|
||||||
opt.apnsCername = "yinmeng_anps"
|
opt.apnsCername = "yinmeng_anps"
|
||||||
|
@@ -7,15 +7,15 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
enum AppKeys {
|
enum AppKeys {
|
||||||
#if DEBUG
|
//#if DEBUG
|
||||||
static let nimAppid = "5d5a833a2d0ff1304a5d8bed53d2af5b"
|
// static let nimAppid = "5d5a833a2d0ff1304a5d8bed53d2af5b"
|
||||||
static let api = "http://beta.api.ymlive.fun/"
|
// static let api = "http://beta.api.ymlive.fun/"
|
||||||
static let agoraKey = "5b4d929b6c4e4af190550c4a2ec5cd4c"
|
// static let agoraKey = "5b4d929b6c4e4af190550c4a2ec5cd4c"
|
||||||
static let H5_URL = "http://beta.api.ymlive.fun"
|
// static let H5_URL = "http://beta.api.ymlive.fun"
|
||||||
#else
|
//#else
|
||||||
static let nimAppid = "5e76ec47632d86c30ce18eabfa332b6a"
|
static let nimAppid = "5e76ec47632d86c30ce18eabfa332b6a"
|
||||||
static let api = "https://api.ymlive.fun/"
|
static let api = "https://api.ymlive.fun/"
|
||||||
static let agoraKey = "5b4d929b6c4e4af190550c4a2ec5cd4c"
|
static let agoraKey = "5b4d929b6c4e4af190550c4a2ec5cd4c"
|
||||||
static let H5_URL = "https://h5.ymlive.fun"
|
static let H5_URL = "https://h5.ymlive.fun"
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
@@ -135,7 +135,7 @@ class AuthLaunchVC: BaseViewController, HiddenNavigationBarProtocol {
|
|||||||
private lazy var phoneLoginBtn: UIButton = {
|
private lazy var phoneLoginBtn: UIButton = {
|
||||||
let button = UIButton(type: .custom)
|
let button = UIButton(type: .custom)
|
||||||
button.setBackgroundImage(UIImage.gradient([ThemeColor(hexStr: "#FF60FD"), ThemeColor(hexStr: "#8974FF"), ThemeColor(hexStr: "#69EBFF")], radius: 0), for: .normal)
|
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.setTitleColor(UIColor.white, for: .normal)
|
||||||
button.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .medium)
|
button.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .medium)
|
||||||
button.layer.masksToBounds = true
|
button.layer.masksToBounds = true
|
||||||
|
@@ -113,6 +113,7 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
|
|||||||
phonetextFiled.snp.makeConstraints { make in
|
phonetextFiled.snp.makeConstraints { make in
|
||||||
make.top.bottom.equalTo(phoneNumView)
|
make.top.bottom.equalTo(phoneNumView)
|
||||||
make.left.equalTo(phoneNumView).offset(82)
|
make.left.equalTo(phoneNumView).offset(82)
|
||||||
|
make.right.equalTo(phoneNumView)
|
||||||
}
|
}
|
||||||
|
|
||||||
codeView.snp.makeConstraints { make in
|
codeView.snp.makeConstraints { make in
|
||||||
@@ -123,7 +124,7 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
|
|||||||
codetextFiled.snp.makeConstraints { make in
|
codetextFiled.snp.makeConstraints { make in
|
||||||
make.left.equalTo(codeView).offset(20)
|
make.left.equalTo(codeView).offset(20)
|
||||||
make.top.bottom.equalTo(codeView)
|
make.top.bottom.equalTo(codeView)
|
||||||
|
make.right.equalTo(codeView)
|
||||||
}
|
}
|
||||||
|
|
||||||
sepView.snp.makeConstraints { make in
|
sepView.snp.makeConstraints { make in
|
||||||
@@ -150,7 +151,7 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
|
|||||||
|
|
||||||
idTextFiled.snp.makeConstraints { make in
|
idTextFiled.snp.makeConstraints { make in
|
||||||
make.left.equalTo(idView).offset(20)
|
make.left.equalTo(idView).offset(20)
|
||||||
make.top.bottom.equalTo(idView)
|
make.top.bottom.right.equalTo(idView)
|
||||||
}
|
}
|
||||||
|
|
||||||
pwdView.snp.makeConstraints { make in
|
pwdView.snp.makeConstraints { make in
|
||||||
@@ -161,7 +162,7 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
|
|||||||
|
|
||||||
pwdTextFiled.snp.makeConstraints { make in
|
pwdTextFiled.snp.makeConstraints { make in
|
||||||
make.left.equalTo(pwdView).offset(20)
|
make.left.equalTo(pwdView).offset(20)
|
||||||
make.top.bottom.equalTo(pwdView)
|
make.top.bottom.right.equalTo(pwdView)
|
||||||
}
|
}
|
||||||
|
|
||||||
forgetBtn.snp.makeConstraints { make in
|
forgetBtn.snp.makeConstraints { make in
|
||||||
@@ -175,8 +176,6 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
|
|||||||
make.height.equalTo(52)
|
make.height.equalTo(52)
|
||||||
make.top.equalTo(phoneView.snp.bottom).offset(44)
|
make.top.equalTo(phoneView.snp.bottom).offset(44)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -20,28 +20,34 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
requestData()
|
requestData()
|
||||||
requsetFansListData()
|
requestFansListData()
|
||||||
}
|
}
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
setUILayout()
|
setUILayout()
|
||||||
requestData()
|
requestData()
|
||||||
requsetFansListData()
|
requestFansListData()
|
||||||
|
displayGuide()
|
||||||
|
|
||||||
userInfoBtn.addTarget(self, action: #selector(userInfoBtnAction), for: .touchUpInside)
|
userInfoBtn.addTarget(self, action: #selector(userInfoBtnAction), for: .touchUpInside)
|
||||||
|
}
|
||||||
|
|
||||||
|
func displayGuide() {
|
||||||
if (UserDefaults.standard.value(forKey:"kIsShowGuide") != nil){return}
|
if (UserDefaults.standard.value(forKey:"kIsShowGuide") != nil){return}
|
||||||
UserDefaults.standard.setValue("yes", forKey: "kIsShowGuide")
|
UserDefaults.standard.setValue("yes", forKey: "kIsShowGuide")
|
||||||
let guideVeiw = HomeVoiceGuideView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight))
|
let guideVeiw = HomeVoiceGuideView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight))
|
||||||
keyWindow.addSubview(guideVeiw)
|
keyWindow.addSubview(guideVeiw)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func userInfoBtnAction(){
|
@objc func userInfoBtnAction(){
|
||||||
let userInfoView:HomeVoiceUserInfoView = HomeVoiceUserInfoView.init(frame: .zero)
|
let userInfoView:HomeVoiceUserInfoView = HomeVoiceUserInfoView.init(frame: .zero)
|
||||||
userInfoView.clickBtnBlock = {[weak self] (type,uid) in
|
userInfoView.clickBtnBlock = {[weak self] (type,uid) in
|
||||||
guard let weakSelf = self else {
|
guard let self = self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if type == 3{
|
if type == 3{
|
||||||
let vc = UserPayViewController()
|
let vc = UserPayViewController()
|
||||||
weakSelf.navigationController?.pushViewController(vc, animated: true)
|
self.navigationController?.pushViewController(vc, animated: true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,10 +59,12 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
func requsetFansListData(){
|
func requestFansListData(){
|
||||||
let uid = "\(AuthManager.userUid)"
|
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) {
|
if let list = Deserialized<HomeVoiceModel>.toArray(with: data) {
|
||||||
self.followView.modelList = list
|
self.followView.modelList = list
|
||||||
}
|
}
|
||||||
@@ -65,9 +73,9 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func setUILayout(){
|
func setUILayout(){
|
||||||
|
|
||||||
view.addSubview(backgroundView)
|
view.addSubview(backgroundView)
|
||||||
view.addSubview(scrollView)
|
view.addSubview(scrollView)
|
||||||
|
|
||||||
scrollView.addSubview(topLogoIcon)
|
scrollView.addSubview(topLogoIcon)
|
||||||
scrollView.addSubview(searchView)
|
scrollView.addSubview(searchView)
|
||||||
scrollView.addSubview(chooseItemVeiw)
|
scrollView.addSubview(chooseItemVeiw)
|
||||||
@@ -76,11 +84,7 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
|
|
||||||
scrollView.addSubview(publishView)
|
scrollView.addSubview(publishView)
|
||||||
scrollView.addSubview(bgPlayMusicView)
|
scrollView.addSubview(bgPlayMusicView)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
backgroundView.snp.makeConstraints { make in
|
backgroundView.snp.makeConstraints { make in
|
||||||
make.edges.equalTo(self.view)
|
make.edges.equalTo(self.view)
|
||||||
}
|
}
|
||||||
@@ -131,6 +135,7 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
make.width.equalTo(ScreenWidth-28)
|
make.width.equalTo(ScreenWidth-28)
|
||||||
make.height.equalTo(144)
|
make.height.equalTo(144)
|
||||||
}
|
}
|
||||||
|
|
||||||
publishView.superview?.layoutIfNeeded()
|
publishView.superview?.layoutIfNeeded()
|
||||||
scrollView.contentSize = CGSize(width: ScreenWidth, height: publishView.frame.origin.y + publishView.frame.size.height)
|
scrollView.contentSize = CGSize(width: ScreenWidth, height: publishView.frame.origin.y + publishView.frame.size.height)
|
||||||
let margin:CGFloat = (ScreenWidth - 90 * 3 - 28)/4
|
let margin:CGFloat = (ScreenWidth - 90 * 3 - 28)/4
|
||||||
@@ -150,11 +155,7 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
|
|
||||||
let x = ScreenWidth - 28 - 44 - 3
|
let x = ScreenWidth - 28 - 44 - 3
|
||||||
followView.frame = CGRect(x:x , y: 3, width: 44, height: 418)
|
followView.frame = CGRect(x:x , y: 3, width: 44, height: 418)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
chooseTypeView.chooseTypeBlock = {[weak self] type in
|
chooseTypeView.chooseTypeBlock = {[weak self] type in
|
||||||
guard let weakSelf = self else {
|
guard let weakSelf = self else {
|
||||||
return
|
return
|
||||||
@@ -211,7 +212,7 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
navigationController?.present(searchVC, animated: true, completion: nil)
|
navigationController?.present(searchVC, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
@objc func clickLongTapAction(sender:UIPanGestureRecognizer){
|
@objc func clickLongTapAction(sender:UIPanGestureRecognizer){
|
||||||
let i = (sender.view?.tag ?? 100) - 100
|
_ = (sender.view?.tag ?? 100) - 100
|
||||||
if sender.state == .began{
|
if sender.state == .began{
|
||||||
location = sender.view?.center
|
location = sender.view?.center
|
||||||
}else if sender.state == .changed{
|
}else if sender.state == .changed{
|
||||||
@@ -223,7 +224,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
sender.view?.center = CGPoint(x: x, y: y)
|
sender.view?.center = CGPoint(x: x, y: y)
|
||||||
sender.setTranslation(.zero, in: self.view)
|
sender.setTranslation(.zero, in: self.view)
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
guard let centerPoint = sender.view?.center else{return}
|
guard let centerPoint = sender.view?.center else{return}
|
||||||
let point = CGPoint(x: centerPoint.x + 14, y: centerPoint.y+136)
|
let point = CGPoint(x: centerPoint.x + 14, y: centerPoint.y+136)
|
||||||
|
|
||||||
@@ -239,7 +239,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
if let location = self.location{
|
if let location = self.location{
|
||||||
sender.view?.center = location
|
sender.view?.center = location
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,31 +254,38 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
let chatVC = ChatVC.init(session: session)
|
let chatVC = ChatVC.init(session: session)
|
||||||
self?.navigationController?.pushViewController(chatVC, animated: true)
|
self?.navigationController?.pushViewController(chatVC, animated: true)
|
||||||
}
|
}
|
||||||
|
userInfoView.followActionBlock = { [weak self] (isFollow, value) in
|
||||||
|
guard let self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.requestFansListData()
|
||||||
|
}
|
||||||
userInfoView.type = 0
|
userInfoView.type = 0
|
||||||
userInfoView.model = view.model
|
userInfoView.model = view.model
|
||||||
self.view.addSubview(userInfoView)
|
self.view.addSubview(userInfoView)
|
||||||
userInfoView.snp.makeConstraints { make in
|
userInfoView.snp.makeConstraints { make in
|
||||||
make.edges.equalTo(self.view)
|
make.edges.equalTo(self.view)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func changeItemAction(){
|
@objc func changeItemAction(){
|
||||||
requestData()
|
requestData()
|
||||||
makeRotationAnim(view: changeItemView.leftIconView)
|
makeRotationAnim(view: changeItemView.leftIconView)
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeRotationAnim(view: UIView) {
|
func makeRotationAnim(view: UIView) {
|
||||||
// 1.创建动画
|
// 1.创建动画
|
||||||
let rotationAnim = CABasicAnimation(keyPath: "transform.rotation.z")
|
let rotationAnim = CABasicAnimation(keyPath: "transform.rotation.z")
|
||||||
// 2.设置动画属性
|
// 2.设置动画属性
|
||||||
rotationAnim.fromValue = 0 // 开始角度
|
rotationAnim.fromValue = 0 // 开始角度
|
||||||
rotationAnim.toValue = Double.pi * 2 // 结束角度
|
rotationAnim.toValue = Double.pi * 2 // 结束角度
|
||||||
rotationAnim.repeatCount = 2 // 重复次数
|
rotationAnim.repeatCount = 2 // 重复次数
|
||||||
rotationAnim.duration = 0.5
|
rotationAnim.duration = 0.5
|
||||||
rotationAnim.autoreverses = false // 动画完成后自动重新开始,默认为NO
|
rotationAnim.autoreverses = false // 动画完成后自动重新开始,默认为NO
|
||||||
rotationAnim.isRemovedOnCompletion = true //默认是true,切换到其他控制器再回来,动画效果会消失,需要设置成false,动画就不会停了
|
rotationAnim.isRemovedOnCompletion = true //默认是true,切换到其他控制器再回来,动画效果会消失,需要设置成false,动画就不会停了
|
||||||
view.layer.add(rotationAnim, forKey: nil) // 给需要旋转的view增加动画
|
view.layer.add(rotationAnim, forKey: nil) // 给需要旋转的view增加动画
|
||||||
|
}
|
||||||
}
|
|
||||||
func requestData(){
|
func requestData(){
|
||||||
RequestGet(path: "voiceShow/listRandom", parma: ["gender":gender]) { data in
|
RequestGet(path: "voiceShow/listRandom", parma: ["gender":gender]) { data in
|
||||||
guard let dic = data as? [String : Any]else {
|
guard let dic = data as? [String : Any]else {
|
||||||
@@ -296,7 +302,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
let view:HomeVoicePlayMusicItemView = self.itemViewList[i]
|
let view:HomeVoicePlayMusicItemView = self.itemViewList[i]
|
||||||
let model = list[i]
|
let model = list[i]
|
||||||
view.model = model
|
view.model = model
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,8 +313,8 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
@objc func chooseItemAction(){
|
@objc func chooseItemAction(){
|
||||||
chooseItemVeiw.isChoose = !chooseItemVeiw.isChoose
|
chooseItemVeiw.isChoose = !chooseItemVeiw.isChoose
|
||||||
chooseTypeView.isHidden = !chooseItemVeiw.isChoose
|
chooseTypeView.isHidden = !chooseItemVeiw.isChoose
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var gender = ""
|
var gender = ""
|
||||||
private lazy var backgroundView:UIImageView = {
|
private lazy var backgroundView:UIImageView = {
|
||||||
let _backgroundView = UIImageView()
|
let _backgroundView = UIImageView()
|
||||||
@@ -347,8 +352,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
|
|||||||
let _userInfoBtn = UIButton()
|
let _userInfoBtn = UIButton()
|
||||||
_userInfoBtn.setBackgroundImage(UIImage(named: "yin_home_voice_user_info_bg"), for: .normal)
|
_userInfoBtn.setBackgroundImage(UIImage(named: "yin_home_voice_user_info_bg"), for: .normal)
|
||||||
_userInfoBtn.setImage(UIImage(named: "yin_home_voice_user_info_icon"), for: .normal)
|
_userInfoBtn.setImage(UIImage(named: "yin_home_voice_user_info_icon"), for: .normal)
|
||||||
|
|
||||||
|
|
||||||
return _userInfoBtn
|
return _userInfoBtn
|
||||||
}()
|
}()
|
||||||
var chooseTypeView:HomeVoiceChooseTypeView = {
|
var chooseTypeView:HomeVoiceChooseTypeView = {
|
||||||
|
@@ -10,10 +10,12 @@ import Nuke
|
|||||||
|
|
||||||
|
|
||||||
typealias ClickBtnBlock = (_ type: Int ,_ uid:String)->Void
|
typealias ClickBtnBlock = (_ type: Int ,_ uid:String)->Void
|
||||||
|
typealias FollowBlockType = (_ isFollow: Bool, _ value: Int) -> Void
|
||||||
|
|
||||||
class HomeVoiceUserInfoView: UIView {
|
class HomeVoiceUserInfoView: UIView {
|
||||||
var clickBtnBlock:ClickBtnBlock?
|
var clickBtnBlock:ClickBtnBlock?
|
||||||
|
var followActionBlock: FollowBlockType?
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
setUILayout()
|
setUILayout()
|
||||||
@@ -151,7 +153,6 @@ class HomeVoiceUserInfoView: UIView {
|
|||||||
if let _clickBtnBlock = clickBtnBlock,let uid = self.model?.uid{
|
if let _clickBtnBlock = clickBtnBlock,let uid = self.model?.uid{
|
||||||
_clickBtnBlock(3,"\(uid)")
|
_clickBtnBlock(3,"\(uid)")
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.attentionBtn.isSelected = !self.attentionBtn.isSelected
|
self.attentionBtn.isSelected = !self.attentionBtn.isSelected
|
||||||
@@ -160,14 +161,20 @@ class HomeVoiceUserInfoView: UIView {
|
|||||||
guard let getUid = uid else{return}
|
guard let getUid = uid else{return}
|
||||||
let params = ["uid":"\(AuthManager.userUid)","ticket":AuthManager.ticket,"type":type,"likedUid":"\(getUid)"] as [String : Any]
|
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){
|
if(self.attentionBtn.isSelected){
|
||||||
HUDTool.show(with: "关注成功")
|
HUDTool.show(with: "关注成功")
|
||||||
}else{
|
}else{
|
||||||
HUDTool.show(with: "取消关注成功")
|
HUDTool.show(with: "取消关注成功")
|
||||||
}
|
}
|
||||||
} fail: { code, data in
|
} fail: { code, data in
|
||||||
|
self.attentionBtn.isSelected = !self.attentionBtn.isSelected
|
||||||
|
HUDTool.show(with: data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@objc func chatBtnAction(){
|
@objc func chatBtnAction(){
|
||||||
|
Reference in New Issue
Block a user