//
//  QRCodeSwiftViewController.swift
//  MobilePortal
//
//  Created by xiejiangbo on 2019/6/28.
//  Copyright © 2019 yin chen. All rights reserved.
//

import UIKit

class QRCodeSwiftViewController: BaseViewController,QRCodeSwiftViewDelegate {
    
    var bool = false
    var isHomePushType:IsHomePushType = .YesIsHomePushType
    
    lazy var qRCodeSwiftView: QRCodeSwiftView = {
        //let h = UIApplication.shared.statusBarFrame.size.height+(self.navigationController?.navigationBar.frame.size.height)!
        let qRCodeSwiftView = QRCodeSwiftView.init(frame: CGRect(x:0, y: 0, width:SCREEN_WHIDTH() , height:SCREEN_HEIGHT() ))
        qRCodeSwiftView.delegate = self
        return qRCodeSwiftView
    }()
    override func viewWillAppear(_ animated: Bool) {
        self.appViewsSstatistics(title: "扫码追溯", scope: AppClickType.OftenAppType.rawValue)
        if bool == true {
            dropOutVC()
        }
        
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        initTitleBar()
        self.title = "扫一扫"
        self.view.addSubview(qRCodeSwiftView)
        // Do any additional setup after loading the view.
    }
    
    func getQRCodeSwiftViewValue(_ value: String!) {
        bool = true
        actionGotoWeb(webViewUrl: AccountInfo.sharedInstance().getQRCodeVCUrl(traceBackCode: value), isHomePushType: .NOIsHomePushType, isShowTitleType: .YesShowTitleType, appid: "", isEncryptionType: .NoEncryptionType)
    }
    func dropOutVC() {
        self.arrowResponse()
    }
    override func gotoMessageVC(){
        self.actionGotoMessageWeb(messageId: AccountInfo.sharedInstance().messageId!, isHomePushType: .NOIsHomePushType)
    }
    /// 应用访问量
    func appViewsSstatistics(title:String,scope:String){
        let model = ClickRateModel()
        model.name = title
        model.belong = "门户"
        model.scope = scope
        model.type = "1"
        self.getClickRateHttpCmd(infoModel: model)
    }
}
