From 9e77b0f9014653255eb51e81b8a8ba719443839d Mon Sep 17 00:00:00 2001
From: 杨锴 <841720330@qq.com>
Date: 星期一, 11 十一月 2024 23:52:14 +0800
Subject: [PATCH] fix bug

---
 XQMuse/Root/Other/WebVC.swift |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/XQMuse/Root/Other/WebVC.swift b/XQMuse/Root/Other/WebVC.swift
index 7f8bd81..b59d4e1 100644
--- a/XQMuse/Root/Other/WebVC.swift
+++ b/XQMuse/Root/Other/WebVC.swift
@@ -16,6 +16,7 @@
 				private(set) var url:String?
 				private(set) var htmlText:String?
 				private(set) var baseUrl:URL?
+    private var showHelp = false
 				private var progressView = UIProgressView()
 				private let jsCode = """
 								var meta = document.createElement('meta');"
@@ -27,9 +28,10 @@
 				public var tintColor = UIColor.blue
     private var subVC:Bool = false
 
-				public convenience init(url:String) {
+    public convenience init(url:String,showHelp:Bool = false) {
 								self.init()
 								self.url = url
+        self.showHelp = showHelp
 				}
 
     public convenience init(type:AgreementType,subVC:Bool = false){
@@ -45,6 +47,17 @@
 
 				public override func viewDidLoad() {
 								super.viewDidLoad()
+
+
+        if showHelp{
+            let btn = UIButton(type: .custom)
+            btn.setTitle("我的助力", for: .normal)
+            btn.setTitleColor(UIColor(hexString: "#353535"), for: .normal)
+            btn.titleLabel?.font = .systemFont(ofSize: 15)
+            btn.addTarget(self, action: #selector(myHelpAction), for: .touchUpInside)
+            navigationItem.rightBarButtonItem = UIBarButtonItem(customView: btn)
+        }
+
 
 								let config = WKWebViewConfiguration()
 								let userScript = WKUserScript(source: jsCode, injectionTime: .atDocumentStart, forMainFrameOnly: true)
@@ -106,6 +119,12 @@
 								}
 				}
 
+    @objc func myHelpAction(){
+        let vc = WebVC(url: ShareUrl + "/ranking/recommend?userId=\(UserViewModel.getAvatarInfo().id)")
+        vc.title = "我的助力"
+        push(vc: vc)
+    }
+
 				deinit {
 								webView?.removeObserver(self, forKeyPath: "estimatedProgress")
 				}

--
Gitblit v1.7.1