JLChen
2021-05-18 a869383e163a18cdedcf587383c1eca043129754
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
78
79
80
81
82
83
//
//  Copyright © 2018年 Zhejiang Dahua Technology Co.,Ltd. All rights reserved.
//    设备重置引导页面
 
import UIKit
 
class DHResetDeviceViewController: DHAddBaseViewController, DHCommonErrorViewDelegate {
    
    /// 重置引导图
    public var imageUrl: String?
    
    /// 默认图片
    public var placeholderImage: String = "adddevice_icon_commondevice"
    
    /// 重置内容
    public var resetContent: String? = "add_device_operation_by_instructions".lc_T
    
    private var errorView: DHCommonErrorView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Do any additional setup after loading the view.
        setupErrorView()
        setupCustomContents()
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    private func setupErrorView() {
        errorView = DHCommonErrorView.xibInstance()
        errorView.delegate = self
        
        // 【*】调整图片显示模式,以免风络图片过大,造成显示异常
        //errorView.imageView.contentMode = .scaleAspectFit
        view.addSubview(errorView)
        
        errorView.snp.makeConstraints { make in
            make.edges.equalTo(self.view)
        }
        
        if dh_screenHeight < 667 {
            errorView.updateTopImageViewConstraint(top: 40, width: 240, height: 240)
            errorView.updateContentLabelConstraint(top: 10)
        } else {
            errorView.updateTopImageViewConstraint(top: 70, width: 240, height: 240)
            errorView.updateContentLabelConstraint(top: 20)
        }
    }
    
    private func setupCustomContents() {
        errorView.confrimButton.isHidden = true
        errorView.imageView.lc_setImage(withUrl: imageUrl, placeholderImage: placeholderImage, toDisk: true)
        errorView.contentLabel.dh_setAttributedText(text: resetContent, font: UIFont.dhFont_t2())
    }
    
    // MARK: - DHAddBaseVCProtocol
    override func rightActionType() -> [DHAddBaseRightAction] {
        return [.restart]
    }
}
 
extension DHResetDeviceViewController {
    // MARK: - DHCommonErrorViewDelegate
    func errorViewOnConfirm(errorView: DHCommonErrorView) {
        
    }
    
    func errorViewOnFAQ(errorView: DHCommonErrorView) {
        basePushToFAQ()
    }
    
    func errorViewOnQuit(errorView: DHCommonErrorView) {
        
    }
    
    func errorViewOnBackRoot(errorView: DHCommonErrorView) {
 
    }
}