杨锴
2025-04-16 09a372bc45fde16fd42257ab6f78b8deeecf720b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
//  VIPAgreementVC.swift
//  XQMuse
//
//  Created by 无故事王国 on 2024/11/8.
//
 
import UIKit
import WebKit
 
class VIPAgreementVC: BaseVC {
 
    @IBOutlet weak var label_title: UILabel!
    @IBOutlet weak var webView: WKWebView!
    @IBOutlet weak var view_container: UIView!
    @IBOutlet weak var btn_reject: UIButton!
    @IBOutlet weak var btn_agreement: UIButton!
 
    private var textTitle = ""
    private var content:String = ""
    private var clouse:(()->Void)?
 
    init(title:String,content:String,clouse:@escaping ()->Void) {
        super.init(nibName: nil, bundle: nil)
        self.textTitle = title
        self.content = content
        self.clouse = clouse
    }
    
     required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
 
        view.alpha = 0
        view.backgroundColor = .black.withAlphaComponent(0.7)
        label_title.text = textTitle
 
        btn_reject.jq_borderColor = UIColor(hexString: "#8AAE65")
        btn_reject.jq_borderWidth = 1
 
        view_container.jq_cornerRadius = 10
        btn_reject.jq_cornerRadius = 22
        btn_agreement.jq_cornerRadius = 22
 
        webView.loadHTMLString(content.jq_wrapHtml(edge: UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 5)), baseURL: nil)
 
        UIView.animate(withDuration: 0.5) {
            self.view.alpha = 1.0
        }
    }
 
 
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        btn_agreement.localGradientColor(cornerRadius: 22)
    }
 
    @IBAction func rejectAction(_ sender: UIButton) {
        UIView.animate(withDuration: 0.5) {
            self.view.alpha = 0
        } completion: { _ in
            self.dismiss(animated: true)
        }
    }
 
    @IBAction func agreementAction(_ sender: UIButton) {
        UIView.animate(withDuration: 0.5) {
            self.view.alpha = 0
        } completion: { _ in
            self.dismiss(animated: true)
            self.clouse?()
        }
    }
}