JLChen
2021-10-08 f8457b624a75bf8e41489b74f66009eee6891b8b
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
//
//  Copyright © 2020 jm. All rights reserved.
//
 
import Foundation
 
// MARK: - protocol IDHTableViewCell
public protocol IDHTableViewCell {
    static func dh_cellID() -> String
}
 
public extension IDHTableViewCell {
    static func dh_cellID() -> String {
        return String(describing: Self.self)
    }
}
 
public enum DHDeviceCellType: String {
    case normal = "normal"     //左边有titile    右边有content  有arrow
    case switch_ = "switch"    //左边有titile    右边有switch
    case image = "image"      //左边有titile    右边有image    有arrow
    case copy = "copy"         //左右有titile  右边有content和复制按钮
    case mark = "mark"         //左边title,右边图片
    case check = "check"       //左边title, 右边对勾
    case dynamic = "dynamic"
}
 
public enum DHDeviceStateType: String {
    case normal = "normal"     //左边有titile    右边有content  有arrow
    case loading = "loading"    //左边有titile    右边有switch
    case loadFail = "loadFail"      //左边有titile    右边有image    有arrow
}
 
public enum DHDeviceCellState: String {
    case loading = "loading"
    case loadfail = "loadfail"
    case normal = "normal"
    case noAuth = "noAuth"      //无权限
    case disable = "disable"
}
 
// MARK: - protocol IDHDeviceDetailItem
public protocol IDHDeviceDetailItem: class {
    //索引
    var keyId: String {get set}
    var itemIndex: Int {get set}
    
    //常用属性
    var itemName: String {get set}           //左侧标题名称
    var contentStr: String {get set}         //右侧内容
    var cellType: DHDeviceCellType {get set} //cell类型
    var isSwitchOn: Bool {get set}            //cell类型为switch时的开关状态
    var imageItem: IDHImageItem {get set}    //cell类型为Image时的图片状态
    var state: DHDeviceStateType {get set}  //cell的状态  正常 加载中 加载失败
    var isContentDiable: Bool {get set}      //右侧内容是否置灰
    var isEnable: Bool {get set}             //cell是否可响应点击
    var imageName: String {get set}          //本地图片名称
    
    
    //不常用的属性
    var isShowArrow: Bool {get set}  //右箭头一直显示 默认false
    var desString: String {get set}  //cell下方的文字描述
    var showRedDot: Bool {get set}   //红点展示
}
 
//用于图片描述
public protocol IDHImageItem: class {
    var imageUrl: String {get set}
    var placeHolder: String {get set}
    var encryPtKey: String {get set}
    var deviceId: String {get set}
    var devicePwd: String {get set}
    var filePath: String {get set}
    var isUseFilePath: Bool {get set}  //false 表示使用imageUrl true 表示使用filePath
}