From 485fda8ca1b1309e7ccfbf87014e91a50f6df726 Mon Sep 17 00:00:00 2001
From: 杨锴 <841720330@qq.com>
Date: 星期四, 21 十一月 2024 10:43:14 +0800
Subject: [PATCH] fix bug

---
 XQMuse/Root/Home/HomeVC.swift               |    4 ++++
 XQMuse/Root/Me/MeVC.swift                   |   14 +++++++++++++-
 XQMuse/Root/Home/VC/BackgroundVoiceVC.swift |   13 ++++++++++---
 XQMuse/Root/Course/CourseVC.swift           |    7 +++++++
 XQMuse/Root/Pavilion/PavilionVC.swift       |    7 +++++++
 5 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/XQMuse/Root/Course/CourseVC.swift b/XQMuse/Root/Course/CourseVC.swift
index b4fd429..a4c32a3 100644
--- a/XQMuse/Root/Course/CourseVC.swift
+++ b/XQMuse/Root/Course/CourseVC.swift
@@ -50,6 +50,13 @@
 								return pageVC
 				}()
 
+    override func viewDidAppear(_ animated: Bool) {
+        super.viewDidAppear(animated)
+        if let meVC = (navigationController?.tabBarController?.viewControllers?.last as? BaseNav)?.viewControllers.first as? MeVC{
+            meVC.needLaunch = true
+        }
+    }
+
     override func viewDidLoad() {
         super.viewDidLoad()
 
diff --git a/XQMuse/Root/Home/HomeVC.swift b/XQMuse/Root/Home/HomeVC.swift
index 31dccd1..b2a84b3 100644
--- a/XQMuse/Root/Home/HomeVC.swift
+++ b/XQMuse/Root/Home/HomeVC.swift
@@ -79,6 +79,10 @@
         if AudioPlayer.getSharedInstance().scenePlayer?.timeControlStatus == .paused && UserDefaultSettingViewModel.getSetting()?.bgm != nil{
             AudioPlayer.getSharedInstance().playSceneAt(UserDefaultSettingViewModel.getSetting()!.bgm!.audioFile)
         }
+
+        if let meVC = (navigationController?.tabBarController?.viewControllers?.last as? BaseNav)?.viewControllers.first as? MeVC{
+            meVC.needLaunch = true
+        }
     }
 
     override func viewDidLoad() {
diff --git a/XQMuse/Root/Home/VC/BackgroundVoiceVC.swift b/XQMuse/Root/Home/VC/BackgroundVoiceVC.swift
index dd77681..1fb06c8 100644
--- a/XQMuse/Root/Home/VC/BackgroundVoiceVC.swift
+++ b/XQMuse/Root/Home/VC/BackgroundVoiceVC.swift
@@ -136,9 +136,16 @@
 
             needPopRoot = true
 												NotificationCenter.default.post(name: SetBGMSuccess_Noti, object: items[index.row])
-//            DispatchQueue.main.asyncAfter(delay: 0.6) {
-//                self.navigationController?.popViewController()
-//            }
+
+            if !(UserViewModel.getLoginInfo()?.accessToken.isEmpty ?? true){
+                DispatchQueue.main.asyncAfter(delay: 0.6) {
+                    NotificationCenter.default.post(name: PlantGuideQuit_Noti, object: self.items[index.row])
+                }
+            }else{
+                DispatchQueue.main.asyncAfter(delay: 0.6) {
+                    self.navigationController?.popViewController()
+                }
+            }
 								}
 				}
 
diff --git a/XQMuse/Root/Me/MeVC.swift b/XQMuse/Root/Me/MeVC.swift
index da43448..b89cd64 100644
--- a/XQMuse/Root/Me/MeVC.swift
+++ b/XQMuse/Root/Me/MeVC.swift
@@ -35,7 +35,9 @@
 				@IBOutlet weak var label_phone: UILabel!
 				@IBOutlet weak var label_vipInfo: UILabel!
 				@IBOutlet weak var label_totalDay: UILabel!
-				
+
+    var needLaunch:Bool = true
+
 				override func viewDidLoad() {
         super.viewDidLoad()
 
@@ -47,6 +49,16 @@
 								queryNotice()
     }
 
+    override func viewDidAppear(_ animated: Bool) {
+        super.viewDidAppear(animated)
+        if (UserViewModel.getLoginInfo()?.accessToken.isEmpty ?? true) && needLaunch{
+            let loginNav = LoginNav(rootViewController: LoginVC())
+            loginNav.modalPresentationStyle = .fullScreen
+            JQ_currentViewController().present(loginNav, animated: true)
+            needLaunch = false
+        }
+    }
+
 				override func setUI() {
 								super.setUI()
 								view.backgroundColor = UIColor(hexString: "#fafafa")
diff --git a/XQMuse/Root/Pavilion/PavilionVC.swift b/XQMuse/Root/Pavilion/PavilionVC.swift
index da71fc1..e5ce0fa 100644
--- a/XQMuse/Root/Pavilion/PavilionVC.swift
+++ b/XQMuse/Root/Pavilion/PavilionVC.swift
@@ -26,6 +26,13 @@
 				private var viewModel = PavilionViewModel()
 				private var locationTool = JQ_LocationTool.instance()
 
+    override func viewDidAppear(_ animated: Bool) {
+        super.viewDidAppear(animated)
+        if let meVC = (navigationController?.tabBarController?.viewControllers?.last as? BaseNav)?.viewControllers.first as? MeVC{
+            meVC.needLaunch = true
+        }
+    }
+
 				override func viewDidLoad() {
 								super.viewDidLoad()
 

--
Gitblit v1.7.1