Robert
59 分钟以前 c547797c9267e2f3e3c24c7acb31502517f3b6e6
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
//
//  WelfareFreeVC.swift
//  WanPai
//
//  Created by 无故事王国 on 2023/6/20.
//
 
import UIKit
import WebKit
import JQTools
import QMUIKit
 
class WelfareFreeVC: BaseVC {
 
                var storeWalfareModel:StoreWalfareModel?
                @IBOutlet weak var webView: WKWebView!
                @IBOutlet weak var btn_call: QMUIButton!
 
                init(_ model:StoreWalfareModel) {
                                super.init(nibName: nil, bundle: nil)
                                self.storeWalfareModel = model
                }
 
                required init?(coder: NSCoder) {
                                fatalError("init(coder:) has not been implemented")
                }
 
                override func viewDidLoad() {
                                super.viewDidLoad()
                                title = "免费福利"
                                
                                if let m = storeWalfareModel{
                                                let html = "<img src='\(m.img)' width='\(JQ_ScreenW)' loading=eager/>"
                                                self.webView.loadHTMLString(html.jq_wrapHtml(), baseURL: nil)
                                                self.btn_call.isHidden = m.phone.isEmpty
                                }
                }
 
                override func setUI() {
                                btn_call.imagePosition = .left
                                btn_call.spacingBetweenImageAndTitle = 13
                }
 
                @IBAction func callPhoneAction(_ sender: UIButton) {
                                if let phone = storeWalfareModel?.phone{
                                                UIApplication.shared.open(URL(string: "tel://\(phone)")!, options: [:], completionHandler: nil)
                                }
                }
 
}