萤石云 iOSSDK,移植跨平台相关工程
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
//
//  HDLEZTempDetailView.m
//  EZSDK
//
//  Created by 陈启扬 on 2023/3/14.
//
 
#import "HDLEZTempDetailView.h"
#import "HDLEZNormalCellView.h"
#import "HDLEZScrollView.h"
@interface HDLEZTempDetailView ()
@property (nonatomic, strong)HDLEZScrollView *scrollV;//滚动view
 
@property (nonatomic, strong)UIView *passwordV;//密码view
@property (nonatomic, strong)UILabel *passwordL;//密码lable
@property (nonatomic, strong)UILabel *describeL;//描述lable
 
 
@property (nonatomic, strong)HDLEZNormalCellView *userV;//使用人view
@property (nonatomic, strong)HDLEZNormalCellView *validV;//有效期view
@property (nonatomic, strong)HDLEZNormalCellView *validTimeV;//生效时间view
@property (nonatomic, strong)HDLEZNormalCellView *expireTimeV;//失效时间view
@property (nonatomic, strong)HDLEZNormalCellView *useCountV;//使用次数view
 
@property (nonatomic, strong)HDLEZButton *deleteBtn;//删除按钮
 
@end
 
@implementation HDLEZTempDetailView
 
-(instancetype)init{
    self = [super init];
    if (self) {
        [self initUI];
    }
    
    return  self;
}
 
-(void)initUI{
    //滚动view
    _scrollV=[[HDLEZScrollView alloc] init];
    if (@available(iOS 11.0, *)) {
        _scrollV.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }
    [self addSubview:_scrollV];
    [_scrollV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self);
        make.right.left.bottom.equalTo(self);
    }];
    _scrollV.contentSize=CGSizeMake(HDLEZ_APP_SCREEN_WIDTH, 665);
 
    //密码view
    _passwordV=[[UIView alloc] init];
    [_scrollV addSubview:_passwordV];
    [_passwordV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_scrollV);
        make.left.right.equalTo(self);
        make.height.mas_equalTo(180);
    }];
    
    //密码背景imageV
    UIImageView *passBackImgV=[[UIImageView alloc] init];
    [_passwordV addSubview:passBackImgV];
    [passBackImgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(_passwordV);
        make.height.mas_equalTo(165);
        make.width.mas_equalTo(258);
    }];
    passBackImgV.image=[UIImage imageNamed:@"hdl_ez_temp_pass_word"];
    
    //密码lable
    _passwordL=[[UILabel alloc] init];
    [_passwordV addSubview:_passwordL];
    [_passwordL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(passBackImgV).offset(50);
        make.left.equalTo(passBackImgV).offset(44);
        make.right.equalTo(passBackImgV).offset(-44);
        make.height.mas_equalTo(37);
    }];
    _passwordL.textAlignment=NSTextAlignmentCenter;
    _passwordL.textColor=HDLEZ_COLOR_TEXT_WHITE;
    _passwordL.font=HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_26);
    
    //描述lable
    _describeL=[[UILabel alloc] init];
    [_passwordV addSubview:_describeL];
    [_describeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_passwordL.mas_bottom);
        make.left.right.equalTo(_passwordL);
        make.height.mas_equalTo(15);
    }];
    _describeL.textAlignment=NSTextAlignmentCenter;
    _describeL.adjustsFontSizeToFitWidth=YES;
    _describeL.textColor=HDLEZ_COLOR_TEXT_WHITE;
    _describeL.font=HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_10);
    _describeL.text=HDLEZLocallizedString(@"device_temp_long_tap_copy");
    
    //使用人
    _userV=[[HDLEZNormalCellView alloc] init];
    [_scrollV addSubview:_userV];
    [_userV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_passwordV.mas_bottom);
        make.left.right.equalTo(self);
        make.height.mas_equalTo(50);
    }];
    _userV.title= HDLEZLocallizedString(@"device_temp_user");
    _userV.titleL.font=HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_16);
    [_userV.lineV setHidden:YES];
    [_userV hideNextImg];
 
    //有效期
    _validV=[[HDLEZNormalCellView alloc] init];
    [_scrollV addSubview:_validV];
    [_validV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_userV.mas_bottom).offset(8);
        make.left.right.equalTo(self);
        make.height.mas_equalTo(50);
    }];
    _validV.title= HDLEZLocallizedString(@"device_temp_valid_date");
    _validV.titleL.textColor=HDLEZ_COLOR_TEXT_LIGHT_BLUE;
    _validV.titleL.font=HDLEZ_Get_FontBoldWithSize(HDLEZ_FontSize_16);
    [_validV hideNextImg];
    
    //生效时间
    _validTimeV=[[HDLEZNormalCellView alloc] init];
    [_scrollV addSubview:_validTimeV];
    [_validTimeV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_validV.mas_bottom);
        make.left.right.equalTo(self);
        make.height.mas_equalTo(50);
    }];
    _validTimeV.title=HDLEZLocallizedString(@"device_temp_valid_begin");
    [_validTimeV hideNextImg];
    
    //失效时间
    _expireTimeV=[[HDLEZNormalCellView alloc] init];
    [_scrollV addSubview:_expireTimeV];
    [_expireTimeV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_validTimeV.mas_bottom);
        make.left.right.equalTo(self);
        make.height.mas_equalTo(50);
    }];
    _expireTimeV.title=HDLEZLocallizedString(@"device_temp_valid_end");
    [_expireTimeV.lineV setHidden:YES];
    [_expireTimeV hideNextImg];
 
    //使用次数
    _useCountV=[[HDLEZNormalCellView alloc] init];
    [_scrollV addSubview:_useCountV];
    [_useCountV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_expireTimeV.mas_bottom).offset(8);
        make.left.right.equalTo(self);
        make.height.mas_equalTo(50);
    }];
    _useCountV.title=HDLEZLocallizedString(@"device_temp_use_times");
    [_useCountV.lineV setHidden:YES];
    [_useCountV hideNextImg];
 
    //删除按钮
    _deleteBtn=[[HDLEZButton alloc] init];
    [_scrollV addSubview:_deleteBtn];
    [_deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_useCountV.mas_bottom).offset(50);
        make.left.equalTo(self).offset(80);
        make.right.equalTo(self).offset(-80);
        make.height.mas_equalTo(42);
    }];
    _deleteBtn.layer.cornerRadius=21;
    _deleteBtn.layer.borderWidth=1;
    _deleteBtn.layer.borderColor=HDLEZ_COLOR_BACKGROUND_LINE_RED.CGColor;
    [_deleteBtn setTitleColor:HDLEZ_COLOR_BACKGROUND_LINE_RED forState:UIControlStateNormal];
    _deleteBtn.titleLabel.font=HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_16);
    [_deleteBtn setTitle:HDLEZLocallizedString(@"delete") forState:UIControlStateNormal];
    [_deleteBtn addTarget:self action:@selector(delete) forControlEvents:UIControlEventTouchUpInside];
    
    //添加点击事件
    UILongPressGestureRecognizer *longTap=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longTapTemp)];
    [passBackImgV addGestureRecognizer:longTap];
    _passwordV.userInteractionEnabled=YES;
    passBackImgV.userInteractionEnabled=YES;
    
    
}
 
/*长按密码
 */
-(void)longTapTemp{
    if (self.longTapPassWordBlock) {
        self.longTapPassWordBlock(_passwordL.text);
    }
}
 
/*点击删除
 */
-(void)delete{
    if (self.deletePassWordBlock) {
        self.deletePassWordBlock(@"");
    }
}
 
/*时间转string
 @param date 时间
 */
-(NSString *)turnDate:(NSDate*)date{
    return [HDLEZConstants timeStrWithFormate:[NSString stringWithFormat:@"yyyy%@MM%@dd%@ HH:mm",HDLEZLocallizedString(@"device_temp_year"),HDLEZLocallizedString(@"device_temp_month"),HDLEZLocallizedString(@"device_temp_date")] data:date];
}
 
 
 
/*设置临时密码信息值
 */
-(void)setTemPdetailModel:(HDLEZTemInfoModel *)temPdetailModel{
    _temPdetailModel=temPdetailModel;
    
    //密码
    _passwordL.text=temPdetailModel.password;
    
    //使用人
    _userV.contentL.text=temPdetailModel.userName;
    
    //开始时间
    _validTimeV.contentL.text= [self turnDate:[NSDate dateWithTimeIntervalSince1970:[temPdetailModel.beginTime integerValue]]];
 
    //结束时间
    _expireTimeV.contentL.text= [self turnDate:[NSDate dateWithTimeIntervalSince1970:[temPdetailModel.endTime integerValue]]];
    
    //使用此时
    if ([temPdetailModel.limitCount isEqualToString:@"-1"]) {
        _useCountV.contentL.text=HDLEZLocallizedString(@"device_temp_unlimited_use_times");
    }else{
        _useCountV.contentL.text=[NSString stringWithFormat:@"%@%@%@,%@%@%@",HDLEZLocallizedString(@"device_temp_total"),temPdetailModel.limitCount,HDLEZLocallizedString(@"device_temp_times"),HDLEZLocallizedString(@"device_temp_left"),temPdetailModel.useCount,HDLEZLocallizedString(@"device_temp_times")];
    }
 
    
}
 
 
@end