| | |
| | | // |
| | | |
| | | import UIKit |
| | | import Lantern |
| | | import RxSwift |
| | | |
| | | class AttachTCell: UITableViewCell { |
| | | |
| | | var recordModel:AttachmentRecordModel?{ |
| | | didSet{ |
| | | l1.text = recordModel?.name ?? "" |
| | | l2.text = recordModel?.type |
| | | } |
| | | } |
| | | |
| | | @IBOutlet weak var l1: UILabel! |
| | | @IBOutlet weak var l2: UILabel! |
| | | private var disposeBag:DisposeBag! |
| | | |
| | | override func awakeFromNib() { |
| | | super.awakeFromNib() |
| | | // Initialization code |
| | | selectionStyle = .none |
| | | disposeBag = DisposeBag() |
| | | } |
| | | |
| | | override func setSelected(_ selected: Bool, animated: Bool) { |
| | | super.setSelected(selected, animated: animated) |
| | | @IBAction func delAction(_ sender: UIButton) { |
| | | CommonAlertView.show(title: "Prompt!", content: "Are you sure delete the image?", bt1: "Cancel", bt2: "Delete") { [weak self] in |
| | | guard let weakSelf = self else { return } |
| | | Services.delAttachment(id: weakSelf.recordModel!.id).subscribe(onNext: { data in |
| | | NotificationCenter.default.post(name: RefresgDetailAttach_Noti, object: nil) |
| | | }) { error in |
| | | |
| | | // Configure the view for the selected state |
| | | }.disposed(by: weakSelf.disposeBag) |
| | | } |
| | | } |
| | | |
| | | |
| | | @IBAction func visitionAction(_ sender: UIButton) { |
| | | let lantern = Lantern() |
| | | lantern.numberOfItems = { |
| | | return 1 |
| | | } |
| | | lantern.pageIndicator = LanternDefaultPageIndicator() |
| | | lantern.pageIndex = 0 |
| | | lantern.reloadCellAtIndex = { context in |
| | | let lanternCell = context.cell as? LanternImageCell |
| | | lanternCell?.imageView.sd_setImage(with: URL(string: self.recordModel!.file)) |
| | | } |
| | | lantern.show() |
| | | } |
| | | } |