younger_times
2023-07-14 b932f704f6c04adc7d7b4104a06cbc09c8d49cb5
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
//
//  WelfareFreeVC.swift
//  WanPai
//
//  Created by 无故事王国 on 2023/6/20.
//
 
import UIKit
import WebKit
import JQTools
 
class WelfareFreeVC: BaseVC {
 
    var storeWalfareModel:StoreWalfareModel?
    @IBOutlet weak var webView: WKWebView!
    @IBOutlet weak var btn_call: UIButton!
 
    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
        }
    }
 
    @IBAction func callPhoneAction(_ sender: UIButton) {
        if let phone = storeWalfareModel?.phone{
            UIApplication.shared.open(URL(string: "tel://\(phone)")!, options: [:], completionHandler: nil)
        }
    }
 
}