Pārlūkot izejas kodu

IPU标准版:UI类插件分类整理

liufl5 3 gadi atpakaļ
vecāks
revīzija
b6e65d07d6

+ 54 - 47
IPUMobileFunc/IPUMobileFunc/IPUMobileUIPlugin.h

@ -21,15 +21,33 @@
21 21
22 22
@interface IPUMobileUIPlugin : IPUPlugin
23 23
24
/**新webview中打开页面*/
25
- (void)openNewPage:(NSArray *)param;
24
#pragma mark - page类插件
25
//打开页面,传入pageAction参数,调用后端数据接口,供外部接口(JS)调用
26
- (void)openPage:(NSArray *)param;
27
//供内部接口(OC)调用
28
- (void)openPage:(NSString *)pageAction
29
            data:(NSString *)dataParam
30
      isCurrView:(NSNumber *)isCurr;
31
//根据模板获取解析后的html字符串(调用数据接口)
32
- (void)getPage:(NSArray *)param;
33
//当前视图加载页面,传入pageAction参数,调用后端数据接口
34
- (void)loadPage:(NSArray *)param;
26 35
27
/**关闭新webview中打开的页面*/
28
-(void)closeCurrentPage:(NSArray *)param;
36
#pragma mark - template类插件
37
//打开页面,传入pageAction参数,不调用后端数据接口,供外部接口(JS)调用
38
- (void)openTemplate:(NSArray *)param;
39
//供内部接口(OC)调用
40
- (void)openTemplate:(NSString *)pageAction
41
            withData:(IPUDataMap *)data
42
              isCurr:(NSNumber *)isCurr;
43
//根据模板获取解析后的html字符串(不调用数据接口)
44
- (void)getTemplate:(NSArray *)param;
45
//当前视图加载页面,传入pageAction参数,不调用后端数据接口
46
- (void)loadTemplate:(NSArray *)param;
29 47
30
//打开对话框,供外部接口(JS)调用
48
#pragma mark - dialog类插件
49
//打开对话框窗口,在对话框中加载页面,供外部接口(JS)调用
31 50
- (void)openDialog:(NSArray *)param;
32
33 51
/*
34 52
 * 打开对话框,供内部接口(OC)调用
35 53
 * pageAction 页面名称、pagePram 参数、wRati 宽度比率(相对于整个屏幕)、hRatio 高度比率(相对于整个屏幕)
@ -38,11 +56,12 @@
38 56
            params:(IPUDataMap *)pageParam
39 57
            wRatio:(NSString *)wRatio
40 58
            hRatio:(NSString *)hRatio;
41
59
//关闭对话框,回传数据
42 60
- (void)closeDialog:(NSArray *)param;
43 61
62
#pragma mark - URL类插件
44 63
/*
45
 URL扩展
64
 打开字体图标库样式的URL应用
46 65
 param[0]:NSString--url,不能为空
47 66
 param[1]:NSString--title,可以为空
48 67
 param[2]:NSArray--(分享、复制链接、搜索),可以为空
@ -52,55 +71,43 @@
52 71
 param[6]:BOOL--isShowFloatButton,hideTopBar为true时悬浮按钮默认显示,当hideTopBar为false时悬浮按钮默认隐藏; 若传值,true:显示;false:隐藏(iOS未使用该参数)
53 72
 */
54 73
- (void)openUrl:(NSArray *)param;
55
74
//关闭字体图标库样式的URL应用
56 75
- (void)closeUrl:(NSArray *)param;
76
//打开浏览器
77
- (void)openBrowser:(NSArray *)param;
57 78
58
- (void)openTemplate:(NSArray *)param;
59
60
- (void)openTemplate:(NSString *)pageAction
61
            withData:(IPUDataMap *)data
62
              isCurr:(NSNumber *)isCurr;
63
64
- (void)openPage:(NSArray *)param;
65
66
- (void)openPage:(NSString *)pageAction
67
            data:(NSString *)dataParam
68
      isCurrView:(NSNumber *)isCurr;
79
#pragma mark - window类插件
80
//根据模板打开一个新窗口展示页面
81
- (void)openWindow:(NSArray *)param;
82
//关闭打开的窗口
83
- (void)closeWindow:(NSArray *)param;
69 84
70
- (void)loadPage:(NSArray *)param;
85
#pragma mark - 侧滑菜单类插件
86
//打开侧滑菜单
87
- (void)openSlidingMenu:(NSArray *)param;
88
//关闭侧滑菜单
89
- (void)closeSlidingMenu:(NSArray *)param;
71 90
72
- (void)getTemplate:(NSArray *)param;
91
#pragma mark - 返回类插件
92
//回退上一级视图
93
- (void)back:(NSArray *)param;
94
//回退上一级视图,并支持回调
95
- (void)backWithCallback:(NSArray *)param;
73 96
74
- (void)loadTemplate:(NSArray *)param;
97
#pragma mark - 加载对话框插件
98
//弹出一个“正在加载”的对话框,以便告知用户,程序正在执行一个耗时的任务
99
- (void)loadingStart:(NSArray *)param;
100
//关闭“正在加载”对话框。
101
- (void)loadingStop:(NSArray *)param;
75 102
103
#pragma mark - 工具类插件
104
//调用原生的时间选择器供用户选择,返回用户选择的时间。
76 105
- (void)date:(NSArray *)param;
77
106
//信息提示框
78 107
- (void)tip:(NSArray *)param;
79
108
//alert弹出框
80 109
- (void)alert:(NSArray *)param;
81 110
82
- (void)loadingStart:(NSArray *)param;
83 111
84
- (void)loadingStop:(NSArray *)param;
85
86
- (void)back:(NSArray *)param;
87
88
/**
89
 返回指定页面,并且执行回调
90
 
91
 @param param <#param description#>
92
 */
93
- (void)backWithCallback:(NSArray *)param;
94
95
- (void)openWindow:(NSArray *)param;
96
97
- (void)closeWindow:(NSArray *)param;
98
99
- (void)openSlidingMenu:(NSArray *)param;
100
- (void)closeSlidingMenu:(NSArray *)param;
101
102
- (void)getPage:(NSArray *)param;
103
104
- (void)openBrowser:(NSArray *)param;
105 112
106 113
@end

+ 421 - 551
IPUMobileFunc/IPUMobileFunc/IPUMobileUIPlugin.m

@ -25,32 +25,207 @@
25 25
26 26
@implementation IPUMobileUIPlugin
27 27
28
- (void)openNewPage:(NSArray *)param {
28
#pragma mark - page类插件
29
//打开页面,传入pageAction参数,调用后端数据接口,供外部接口(JS)调用
30
- (void)openPage:(NSArray *)param {
31
    NSString *pageAction;
32
    if (param && param.count) {
33
        if (param[0] == [NSNull null]) {
34
            pageAction = nil;
35
        } else {
36
            pageAction = param[0];
37
        }
38
    }
39
    NSString *dataParam;
40
    if (param && param.count > 1) {
41
        if (param[1] == [NSNull null]) {
42
            dataParam = nil;
43
        } else {
44
            dataParam = param[1];
45
        }
46
    }
47
    
48
    [self openPage:pageAction
49
              data:dataParam
50
        isCurrView:NO];
51
}
52
//根据模板获取解析后的html字符串(调用数据接口)
53
- (void)getPage:(NSArray *)param {
54
    NSString *pageAction = param[0];
55
    NSObject *dataParam = param[1];
56
    NSString *dataAction = [IPUServerPage getData:pageAction];
57
    IPUDataMap *pageParam = nil;
58
    if (dataAction) {
59
        IPUMobileSecurity *security = nil;
60
        if ([IPUServerData isEncrypt:dataAction]) {
61
            security = [IPUMobileSecurity new];
62
        }
63
        
64
        //参数加密
65
        NSMutableDictionary *postDict = [[NSMutableDictionary alloc] init];
66
        postDict = [[[IPUNetworkUtil alloc] init] transPostData:dataAction
67
                                                         params:dataParam
68
                                                       security:security];
69
        //数据请求
70
        NSString *requestUrl = [[IPUMobileConfig getRequestHost] stringByAppendingFormat:@"%@%@", [IPUMobileConfig getRequestPath], [IPUMobileConfig getRequestServlet]];
71
        NSString *result = [IPUHttpTool postRequest:requestUrl data:[IPUHttpTool toQueryStringAndEncoding:postDict]];
72
        
73
        //返回结果解密
74
        if (security) {
75
            result = [security responseDecrypt:result];
76
        }
77
        
78
        pageParam = [[IPUDataMap alloc] initWithString:result];
79
    }
80
    NSString *pageHTML = [self getTemplateHtml:pageAction widthData:pageParam];
81
    [self callback:pageHTML];
82
}
83
84
//当前视图加载页面,传入pageAction参数,调用后端数据接口
85
- (void)loadPage:(NSArray *)param {
86
    if (!param.count) {
87
        [self error:@"参数缺失"];
88
        return;
89
    }
90
    
29 91
    NSString *pageAction = param[0];
92
    NSString *dataParam = nil;
93
    if (param.count > 1) {
94
        dataParam = [IPUCommonTool isNull:param[1]] ? nil : param[1];
95
        if (![dataParam isKindOfClass:[NSString class]]) {
96
            dataParam = [IPUJSONHelper toJSONString:dataParam];
97
        }
98
    }
99
        
100
    [self openPage:pageAction
101
              data:dataParam
102
        isCurrView:[NSNumber numberWithBool:YES]];
103
}
104
105
//供内部接口(OC)调用
106
- (void)openPage:(NSString *)pageAction
107
            data:(NSString *)dataParam
108
      isCurrView:(NSNumber *)isCurr {
109
    NSString *dataAction = [IPUServerPage getData:pageAction];
110
    IPUDataMap *pageParam = nil;
111
    if (dataAction) {
112
        IPUMobileSecurity *security = nil;
113
        if ([IPUServerData isEncrypt:dataAction]) {
114
            security = [IPUMobileSecurity new];
115
        }
116
        
117
        // 参数加密
118
        NSMutableDictionary *postDict = [[NSMutableDictionary alloc] init];
119
        postDict = [[[IPUNetworkUtil alloc] init] transPostData:dataAction
120
                                                         params:dataParam
121
                                                       security:security];
122
        // 数据请求
123
        NSString *requestUrl = [[IPUMobileConfig getRequestHost] stringByAppendingFormat:@"%@%@", [IPUMobileConfig getRequestPath], [IPUMobileConfig getRequestServlet]];
124
        NSString *result = [IPUHttpTool postRequest:requestUrl data:[IPUHttpTool toQueryStringAndEncoding:postDict]];
125
        
126
        // 返回结果解密
127
        if (security) {
128
            result = [security responseDecrypt:result];
129
        }
130
        
131
        pageParam = [[IPUDataMap alloc] initWithString:result];
132
    }
133
    [self openTemplate:pageAction
134
              withData:pageParam
135
                isCurr:isCurr];
136
}
137
138
#pragma mark - template类插件
139
//打开页面,传入pageAction参数,不调用后端数据接口,供外部接口(JS)调用
140
- (void)openTemplate:(NSArray *)param {
141
    NSString *pageAction;
142
    if (param && param.count) {
143
        pageAction = param[0];
144
    }
145
    IPUDataMap *pageParam = nil;
146
    if ([param count] > 1 &&
147
        ![IPUCommonTool isNull:param[1]] &&
148
        [IPUStringUtility isDataMap:param[1]]) {
149
        pageParam = [[IPUDataMap alloc] initWithString:param[1]];
150
    }
151
    BOOL isCurr = NO;
152
    if ([param count] > 2 &&
153
        param[2] != [NSNull null]) {
154
        isCurr = [@"true" isEqualToString:param[2]];
155
    }
156
    
157
    [self openTemplate:pageAction
158
              withData:pageParam
159
                isCurr:[NSNumber numberWithBool:isCurr]];
160
}
161
162
//根据模板获取解析后的html字符串(不调用数据接口)
163
- (void)getTemplate:(NSArray *)param {
164
    NSString *pageAction;
165
    if (param && param.count) {
166
        if (param[0] != [NSNull null]) {
167
            pageAction = param[0];
168
        }else{
169
            pageAction = nil;
170
        }
171
    }
30 172
    IPUDataMap *pageParam = nil;
31 173
    if ([param count] > 1) {
32 174
        pageParam = [[IPUDataMap alloc] initWithString:param[1]];
33 175
    }
34 176
    
35
    UIViewController *rootCtrl = [self getViewController];
36
    IPUWebViewController *webViewCtrl = [[IPUWebViewController alloc] init];
37
    webViewCtrl.pageAction = pageAction;
38
    webViewCtrl.pageData = pageParam;
39
    webViewCtrl.plugin = self;
40
    webViewCtrl.modalPresentationStyle = UIModalPresentationFullScreen;
41
    [rootCtrl presentViewController:webViewCtrl animated:YES completion:nil];
177
    NSString *html = [self getTemplateHtml:pageAction widthData:pageParam];
178
    [self callback:html];
42 179
}
43 180
44
- (void)closeCurrentPage:(NSArray *)param {
45
    IPUWebViewController *webViewCtrl = (IPUWebViewController *)[self getViewController];
181
//当前视图加载页面,传入pageAction参数,不调用后端数据接口
182
- (void)loadTemplate:(NSArray *)param {
183
    IPUDataMap *pageParam = nil;
184
    if ([param count] > 1 &&
185
        ![IPUCommonTool isNull:param[1]] &&
186
        [IPUStringUtility isDataMap:param[1]]) {
187
        pageParam = [[IPUDataMap alloc] initWithString:param[1]];
188
    }
46 189
    
47
    IPUPlugin *plugin = [webViewCtrl plugin];
48
    NSString *data = param.count ? param[0] : @"";
49
    [plugin callback:data];
190
    [self openTemplate:param[0]
191
              withData:pageParam
192
                isCurr:[NSNumber numberWithBool:YES]];
193
}
194
195
//供内部接口(OC)调用
196
- (void)openTemplate:(NSString *)pageAction
197
            withData:(IPUDataMap *)data
198
              isCurr:(NSNumber *)isCurr {
199
    NSString *templatePath = [IPUServerPage getTemplate:pageAction];
200
    IPUFlipperView *flipperView = [self.mobileDelegate getFlipperView];
201
    // 是否需要新开View
202
    if (isCurr.boolValue) {
203
        IPUCommonWebView tWebview = (IPUCommonWebView)[flipperView getCurrView];
204
        tWebview.pageAction = pageAction;
205
        [tWebview loadTemplate:templatePath data:data];
206
    } else {
207
        IPUCommonWebView tWebview = (IPUCommonWebView)[flipperView getNextView];
208
        if (!tWebview) {
209
            tWebview = [self.mobileDelegate createNewWebView];
210
            tWebview.delegate = self.mobileDelegate;
211
            [self.mobileDelegate setUIWebViewStyle:tWebview];
212
            [flipperView addView:tWebview];
213
        }
214
        tWebview.pageAction = pageAction;
215
        [tWebview loadTemplate:templatePath data:data];
216
        [flipperView showNextViewWidthAnimationType:IPUAnimationPushFromRight duration:0.25];
217
    }
218
}
219
220
- (NSString *)getTemplateHtml:(NSString *)pageAction widthData:(IPUDataMap *)data {
221
    IPUCommonWebView webView = [self.mobileDelegate getCurrentView];
50 222
    
51
    [webViewCtrl dismissViewControllerAnimated:YES completion:nil];
223
    NSString *templatePath = [IPUServerPage getTemplate:pageAction];
224
    return [webView getTemplate:templatePath data:data];
52 225
}
53 226
227
#pragma mark - dialog类插件
228
//打开对话框窗口,在对话框中加载页面,供外部接口(JS)调用
54 229
- (void)openDialog:(NSArray *)param {
55 230
    NSString *pageAction = param[0];
56 231
    IPUDataMap *pageParam = nil;
@ -77,9 +252,21 @@
77 252
              wRatio:wRatio
78 253
              hRatio:hRatio];
79 254
}
80
255
//关闭对话框,回传数据
256
- (void)closeDialog:(NSArray *)param {
257
    IPUDialogViewController *dialog = (IPUDialogViewController *)[self getViewController];
258
    [dialog dismissViewControllerAnimated:YES completion:nil];
259
    IPUPlugin *plugin = [dialog plugin];
260
    NSString *data = nil;
261
    if (param && param.count) {
262
        data = param[0];
263
    }
264
    if(![[NSNull null] isEqual:data]){
265
        [plugin callback:data];
266
    }
267
}
81 268
/**
82
 * 打开对话框
269
 * 打开对话框,供内部接口(OC)调用
83 270
 * @param : pageAction 页面名称
84 271
 * @param : pagePram   参数
85 272
 * @param : wRatio     宽度比率(相对于整个屏幕)
@ -114,31 +301,9 @@
114 301
                         completion:nil];
115 302
}
116 303
117
- (void)closeDialog:(NSArray *)param {
118
    IPUDialogViewController *dialog = (IPUDialogViewController *)[self getViewController];
119
    [dialog dismissViewControllerAnimated:YES completion:nil];
120
    IPUPlugin *plugin = [dialog plugin];
121
    NSString *data = nil;
122
    if (param && param.count) {
123
        data = param[0];
124
    }
125
    if(![[NSNull null] isEqual:data]){
126
        [plugin callback:data];
127
    }
128
}
129
130
- (void)openBrowser:(NSArray *)param {
131
    NSString *url;
132
    if (param && param.count) {
133
        url = param[0];
134
    }
135
    if (url) {
136
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
137
    }
138
}
139
304
#pragma mark - URL类插件
140 305
/*
141
 URL扩展
306
 打开字体图标库样式的URL应用
142 307
 param[0]:NSString--url,不能为空
143 308
 param[1]:NSString--title,可以为空
144 309
 param[2]:NSArray--(分享、复制链接、搜索),可以为空
@ -194,7 +359,7 @@
194 359
        
195 360
    }];
196 361
}
197
362
//关闭字体图标库样式的URL应用
198 363
- (void)closeUrl:(NSArray *)param {
199 364
    IPUTemplateNavigateController *vc = (IPUTemplateNavigateController *)[self getViewController];
200 365
    [vc dismissViewControllerAnimated:YES completion:^{
@ -209,326 +374,120 @@
209 374
        }
210 375
    }];
211 376
}
212
213
#pragma mark - end
214
/**
215
 * 解决调用者openTemplate("xx"),导致param[1]为空串,json转译时报错
216
 * modify by kevin
217
 */
218
- (void)openTemplate:(NSArray *)param {
219
    NSString *pageAction;
377
//打开浏览器
378
- (void)openBrowser:(NSArray *)param {
379
    NSString *url;
220 380
    if (param && param.count) {
221
        pageAction = param[0];
222
    }
223
    IPUDataMap *pageParam = nil;
224
    if ([param count] > 1 &&
225
        ![IPUCommonTool isNull:param[1]] &&
226
        [IPUStringUtility isDataMap:param[1]]) {
227
        pageParam = [[IPUDataMap alloc] initWithString:param[1]];
381
        url = param[0];
228 382
    }
229
    BOOL isCurr = NO;
230
    if ([param count] > 2 &&
231
        param[2] != [NSNull null]) {
232
        isCurr = [@"true" isEqualToString:param[2]];
383
    if (url) {
384
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
233 385
    }
234
    
235
    [self openTemplate:pageAction
236
              withData:pageParam
237
                isCurr:[NSNumber numberWithBool:isCurr]];
238 386
}
239 387
240
/**
241
 * 加载模板页面
242
 * add by kevin
243
 */
244
- (void)loadTemplate:(NSArray *)param {
388
#pragma mark - window类插件
389
//根据模板打开一个新窗口展示页面
390
- (void)openWindow:(NSArray *)param {
391
    NSString *pageAction = param[0];
245 392
    IPUDataMap *pageParam = nil;
246
    if ([param count] > 1 &&
247
        ![IPUCommonTool isNull:param[1]] &&
248
        [IPUStringUtility isDataMap:param[1]]) {
249
        pageParam = [[IPUDataMap alloc] initWithString:param[1]];
393
    if ([param count] > 1) {
394
        if (nil == param[1] || [@"" isEqual:param[1]]) {
395
            pageParam = [[IPUDataMap alloc] init];
396
        } else {
397
            pageParam = [[IPUDataMap alloc] initWithString:param[1]];
398
        }
250 399
    }
251 400
    
252
    [self openTemplate:param[0]
253
              withData:pageParam
254
                isCurr:[NSNumber numberWithBool:YES]];
255
}
256
257
- (void)openTemplate:(NSString *)pageAction
258
            withData:(IPUDataMap *)data
259
              isCurr:(NSNumber *)isCurr {
260
    NSString *templatePath = [IPUServerPage getTemplate:pageAction];
261
    IPUFlipperView *flipperView = [self.mobileDelegate getFlipperView];
262
    // 是否需要新开View
263
    if (isCurr.boolValue) {
264
        IPUCommonWebView tWebview = (IPUCommonWebView)[flipperView getCurrView];
265
        tWebview.pageAction = pageAction;
266
        [tWebview loadTemplate:templatePath data:data];
267
    } else {
268
        IPUCommonWebView tWebview = (IPUCommonWebView)[flipperView getNextView];
269
        if (!tWebview) {
270
            tWebview = [self.mobileDelegate createNewWebView];
271
            tWebview.delegate = self.mobileDelegate;
272
            [self.mobileDelegate setUIWebViewStyle:tWebview];
273
            [flipperView addView:tWebview];
274
        }
275
        tWebview.pageAction = pageAction;
276
        [tWebview loadTemplate:templatePath data:data];
277
        [flipperView showNextViewWidthAnimationType:IPUAnimationPushFromRight duration:0.25];
278
    }
279
}
280
281
- (void)getTemplate:(NSArray *)param {
282
    NSString *pageAction;
283
    if (param && param.count) {
284
        if (param[0] != [NSNull null]) {
285
            pageAction = param[0];
286
        }else{
287
            pageAction = nil;
288
        }
289
    }
290
    IPUDataMap *pageParam = nil;
291
    if ([param count] > 1) {
292
        pageParam = [[IPUDataMap alloc] initWithString:param[1]];
401
    UIViewController *rootCtrl = [self getViewController];
402
    if (rootCtrl.presentedViewController) {
403
        [rootCtrl.presentedViewController dismissViewControllerAnimated:NO completion:nil];
293 404
    }
294 405
    
295
    NSString *html = [self getTemplateHtml:pageAction widthData:pageParam];
296
    [self callback:html];
297
}
298
299
- (NSString *)getTemplateHtml:(NSString *)pageAction widthData:(IPUDataMap *)data {
300
    IPUCommonWebView webView = [self.mobileDelegate getCurrentView];
301
    
302
    NSString *templatePath = [IPUServerPage getTemplate:pageAction];
303
    return [webView getTemplate:templatePath data:data];
304
}
305
306
/**
307
 * 加载页面信息
308
 * add by kevin
309
 */
310
- (void)openPage:(NSArray *)param {
311
    NSString *pageAction;
312
    if (param && param.count) {
313
        if (param[0] == [NSNull null]) {
314
            pageAction = nil;
315
        } else {
316
            pageAction = param[0];
317
        }
318
    }
319
    NSString *dataParam;
320
    if (param && param.count > 1) {
321
        if (param[1] == [NSNull null]) {
322
            dataParam = nil;
323
        } else {
324
            dataParam = param[1];
325
        }
326
    }
406
    IPUWindowViewController *window = [[IPUWindowViewController alloc] init];
407
    window.modalPresentationStyle = UIModalPresentationFullScreen;
327 408
    
328
    [self openPage:pageAction
329
              data:dataParam
330
        isCurrView:NO];
331
}
332
333
/**
334
 * 加载页面信息
335
 * add by kevin
336
 */
337
- (void)loadPage:(NSArray *)param {
338
    if (!param.count) {
339
        [self error:@"参数缺失"];
340
        return;
341
    }
409
    window.pageAction = pageAction;
410
    window.pageData = pageParam;
411
    window.plugin = self;
342 412
    
343
    NSString *pageAction = param[0];
344
    NSString *dataParam = nil;
345
    if (param.count > 1) {
346
        dataParam = [IPUCommonTool isNull:param[1]] ? nil : param[1];
347
        if (![dataParam isKindOfClass:[NSString class]]) {
348
            dataParam = [IPUJSONHelper toJSONString:dataParam];
349
        }
350
    }
351
        
352
    [self openPage:pageAction
353
              data:dataParam
354
        isCurrView:[NSNumber numberWithBool:YES]];
413
    [rootCtrl presentViewController:window
414
                           animated:NO
415
                         completion:nil];
355 416
}
356
357
/**
358
 * 加载模板页面
359
 * add by kevin
360
 */
361
- (void)openPage:(NSString *)pageAction
362
            data:(NSString *)dataParam
363
      isCurrView:(NSNumber *)isCurr {
364
    NSString *dataAction = [IPUServerPage getData:pageAction];
365
    IPUDataMap *pageParam = nil;
366
    if (dataAction) {
367
        IPUMobileSecurity *security = nil;
368
        if ([IPUServerData isEncrypt:dataAction]) {
369
            security = [IPUMobileSecurity new];
370
        }
371
        
372
        // 参数加密
373
        NSMutableDictionary *postDict = [[NSMutableDictionary alloc] init];
374
        postDict = [[[IPUNetworkUtil alloc] init] transPostData:dataAction
375
                                                         params:dataParam
376
                                                       security:security];
377
        // 数据请求
378
        NSString *requestUrl = [[IPUMobileConfig getRequestHost] stringByAppendingFormat:@"%@%@", [IPUMobileConfig getRequestPath], [IPUMobileConfig getRequestServlet]];
379
        NSString *result = [IPUHttpTool postRequest:requestUrl data:[IPUHttpTool toQueryStringAndEncoding:postDict]];
380
        
381
        // 返回结果解密
382
        if (security) {
383
            result = [security responseDecrypt:result];
384
        }
385
        
386
        pageParam = [[IPUDataMap alloc] initWithString:result];
417
//关闭打开的窗口
418
- (void)closeWindow:(NSArray *)param {
419
    IPUWindowViewController *window = (IPUWindowViewController *)[self getViewController];
420
    [window closeWindow];
421
    IPUPlugin *plugin = [window plugin];
422
    NSString *data = nil;
423
    if (param.count) {
424
        data = param[0];
387 425
    }
388
    [self openTemplate:pageAction
389
              withData:pageParam
390
                isCurr:isCurr];
391
}
392
393
- (void)date:(NSArray *)param {
394
    IPUDatePickerStyle datePickerStyle = IPUDatePickerStyleShowYearMonthDay;
395
    NSString *format = param[1];
396
    NSString *time = param[0];
397
    
398
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
399
    
400
    if ([self isValidate:@"HH.*MM.*" withStr:[format uppercaseString]]) {
401
        datePickerStyle = IPUDatePickerStyleShowHourMinute;
402
        
403
        // 构造完成的初始化时间
404
        NSDate *now = [NSDate date];
405
        NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
406
        [dateFormatter1 setDateFormat:@"yyyy-MM-dd"];
407
        [dateFormatter1 setTimeZone:[NSTimeZone timeZoneWithName:@"Asia/Shanghai"]];
408
        NSString *nowString = [dateFormatter1 stringFromDate:now];
409
        time = [nowString stringByAppendingFormat:@" %@", time];
410
        
411
        NSString *format = @"yyyy-MM-dd HH:mm:ss";
412
        
413
        [dateFormatter setDateFormat:format];
414
        [dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"Asia/Shanghai"]];
415
    } else if ([self isValidate:@"YYYY.*MM.*DD" withStr:[format uppercaseString]]) {
416
        datePickerStyle = IPUDatePickerStyleShowYearMonthDay;
417
        
418
        [dateFormatter setDateFormat:format];
419
        [dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"Asia/Shanghai"]];
420
    } else if ([self isValidate:@"YYYY.*MM.*" withStr:[format uppercaseString]]) {
421
        datePickerStyle = IPUDatePickerStyleShowYearMonthDayHourMinute;
422
423
        [dateFormatter setDateFormat:format];
424
    } else if ([format isEqual:@"yyyy"] || [format isEqual:@"yyyy年"]) {
425
        datePickerStyle = IPUDatePickerStyleShowYear;
426
        
427
        [dateFormatter setDateFormat:format];
428
    } else if ([format isEqual:@"MM"] || [format isEqual:@"MM月"]) {
429
        datePickerStyle = IPUDatePickerStyleShowMonth;
430
    } else if ([format isEqual:@"dd HH:mm"]) {
431
        datePickerStyle = IPUDatePickerStyleShowDayHourMinute;
432
    } else if ([format isEqual:@"MM-dd HH:mm"]) {
433
        datePickerStyle = IPUDatePickerStyleShowMonthDayHourMinute;
434
    } else if ([format isEqual:@"yyyy-MM"]) {
435
        datePickerStyle = IPUDatePickerStyleShowYearMonth;
436
        
437
        [dateFormatter setDateFormat:format];
438
    } else if ([format isEqual:@"MM-dd"]) {
439
        datePickerStyle = IPUDatePickerStyleShowMonthDay;
426
    if (![[NSNull null] isEqual:data]) {
427
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
428
            [plugin callback:data];
429
        });
440 430
    }
441
    
442
    [dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"Asia/Shanghai"]];
443
    
444
    NSDate *date = [dateFormatter dateFromString:time];
445
    IPUDatePicker *datePicker = [[IPUDatePicker alloc] initWithDateStyle:datePickerStyle
446
                                                            scrollToDate:date
447
                                                           completeBlock:^(NSDate * _Nonnull selectedDate) {
448
        [self callback:[dateFormatter stringFromDate:selectedDate]];
449
    }];
450
    [datePicker show];
451
}
452
453
454
- (BOOL)isValidate:(NSString *)regex withStr:(NSString *)str {
455
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
456
    return [predicate evaluateWithObject:str];
457 431
}
458 432
459
- (void)alert:(NSArray *)param {
460
    NSString *type = nil, *title = [NSString stringWithFormat:@"%@", param[0]];
461
    if (param.count > 1) {
462
        type = [NSString stringWithFormat:@"%@", param[1]];
463
    }
464
    if ([@"1" isEqualToString:type]) {
465
        
466
    }
467
    UIAlertView *alert = [[UIAlertView alloc]initWithTitle:title
468
                                                   message:nil
469
                                                  delegate:nil
470
                                         cancelButtonTitle:@"OK"
471
                                         otherButtonTitles:nil, nil];
433
#pragma mark - 侧滑菜单类插件
434
//打开侧滑菜单
435
- (void)openSlidingMenu:(NSArray *)param{
436
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@""
437
                                                    message:@"iOS版暂不支持此功能"
438
                                                   delegate:nil
439
                                          cancelButtonTitle:@"OK"
440
                                          otherButtonTitles:nil, nil];
472 441
    [alert show];
473 442
}
474
475
/***
476
 * 提示信息栏  add by kevin
477
 */
478
- (void)tip:(NSArray *)args {
479
    NSString *message = [NSString stringWithFormat:@"%@", args[0]];
480
    NSString *durationStr = 0;
481
    if (![IPUCommonTool isNull:args[1]]) {
482
        durationStr = args[1];
483
    }
484
    [self tip:message withDuration:durationStr];
443
//关闭侧滑菜单
444
- (void)closeSlidingMenu:(NSArray *)param{
445
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@""
446
                                                    message:@"iOS版暂不支持此功能"
447
                                                   delegate:nil
448
                                          cancelButtonTitle:@"OK"
449
                                          otherButtonTitles:nil, nil];
450
    [alert show];
485 451
}
486 452
487
/***
488
 * 提示信息栏  add by kevin
489
 * @param(messsage)     提示信息
490
 * @param(durationStr)  视图显示时长标识
491
 */
492
- (void)tip:(NSString *)message withDuration:(NSString *)durationStr {
493
    double duration = [durationStr doubleValue] == 0 ? 2 : 5;
494
    
495
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
496
    UIView *showview =  [[UIView alloc] init];
497
    showview.backgroundColor = [UIColor blackColor];
498
    showview.frame = CGRectMake(1, 1, 1, 1);
499
    showview.alpha = 1.0f;
500
    showview.layer.cornerRadius = 5.0f;
501
    showview.layer.masksToBounds = YES;
502
    [window addSubview:showview];
453
#pragma mark - 返回类插件
454
//回退上一级视图
455
- (void)back:(NSArray *)param {
456
    IPUFlipperView *flipperView = (IPUFlipperView *)[self.mobileDelegate getFlipperView];
503 457
    
504
    UILabel *label = [[UILabel alloc] init];
505
    CGSize LabelSize = [message sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17]}];
506
    label.frame = CGRectMake(10, 5, LabelSize.width, LabelSize.height);
507
    label.text = message;
508
    label.numberOfLines = 0; // 自动换行
509
    label.textColor = [UIColor whiteColor];
510
    label.textAlignment = 1;
511
    label.backgroundColor = [UIColor clearColor];
512
    label.font = [UIFont boldSystemFontOfSize:15];
513
    [showview addSubview:label];
458
    // 目标视图的偏移量
459
    NSString *pageAction = param[0];
460
    NSUInteger count = [flipperView getViewOffset:pageAction];
461
    [flipperView backWithCount:count];
462
}
463
//回退上一级视图,并支持回调
464
- (void)backWithCallback:(NSArray *)param {
465
    if (!param || !param.count) {
466
        // 参数为空,返回上一页面
467
        [self back:param];
468
        return;
469
    }
470
    NSString *result = param[0];    // 回调数据
471
    IPUFlipperView *flipperView = (IPUFlipperView *)[self.mobileDelegate getFlipperView];
472
    UIView *formerView = nil;
473
    NSString *pageAction = param.count > 1 ? param[1] : nil;
474
    NSInteger offeset = [flipperView getViewOffert:pageAction view:&formerView];
514 475
    
515
    CGFloat outWith = LabelSize.width + 20,outHeight = LabelSize.height + 10;
516
    CGFloat x = (SCREEN_WIDTH - outWith)/2, y = (SCREEN_HEIGHT - LabelSize.height) * 0.9;
517
    showview.frame = CGRectMake(x, y, outWith, outHeight);
476
    if ([formerView isKindOfClass:[UIWebView class]] ||
477
        [formerView isKindOfClass:NSClassFromString(@"WKWebView")]) {   // 上一个视图注入js
478
        // 构造需要注入的js
479
        result = [NSString stringWithFormat:@"WadeMobile.backevent.backCall('%@');", [IPUStringUtility encodeForJs:result]];
480
        [formerView performSelector:@selector(stringByEvaluatingJavaScriptFromString:) withObject:result];
481
    } else {
482
        // ReactNative RCTRootView 预留
483
        // ...
484
    }
518 485
    
519
    [UIView animateWithDuration:duration
520
                     animations:^{
521
                         showview.alpha = 0;
522
                     }
523
                     completion:^(BOOL finished) {
524
                         [showview removeFromSuperview];
525
                     }];
526
}
527
528
/***
529
 * 加载框  modify by kevin
530
 * 处理在并发调用场景下的重复添加子视图的BUG
531
 */
486
    [flipperView backWithCount:offeset];
487
}
488
489
#pragma mark - 加载对话框插件
490
//弹出一个“正在加载”的对话框,以便告知用户,程序正在执行一个耗时的任务
532 491
- (void)loadingStart:(NSArray *)param {
533 492
    NSString *message = param.count > 0 ? param[0] : nil;
534 493
    NSString *title = param.count > 1 ? param[1] : nil;
@ -538,7 +497,13 @@
538 497
                 title:title
539 498
           isCanceable:cancelable];
540 499
}
541
500
//关闭“正在加载”对话框。
501
- (void)loadingStop:(NSArray *) param {
502
    int count = 0;
503
    while (![self loadingStop] && count++ > 3) {
504
        [NSThread sleepForTimeInterval:0.5];
505
    }
506
}
542 507
/***
543 508
 * 加载框  modify by kevin
544 509
 * 处理在并发调用场景下的重复添加子视图的BUG
@ -592,17 +557,11 @@
592 557
        titleLabel.text = title;
593 558
        titleLabel.font = font;
594 559
    }
595
    
596
    
597 560
    @synchronized (self) {
598
        
599
        
600
        
601 561
        // 如果已经打开loadingStart:关闭
602 562
        if (self->rootView) {
603 563
            [self loadingStop];
604 564
        }
605
        
606 565
        // 获取根部的VC
607 566
        CGFloat s_width = [UIScreen mainScreen].bounds.size.width;
608 567
        CGFloat s_height = [UIScreen mainScreen].bounds.size.height;
@ -694,18 +653,6 @@
694 653
        [vc.view addSubview:rootView];
695 654
    }
696 655
}
697
698
/***
699
 * 关闭加载框  modify by kevin
700
 * 处理在并发调用场景下的重复关闭子视图的BUG
701
 */
702
- (void)loadingStop:(NSArray *) param {
703
    int count = 0;
704
    while (![self loadingStop] && count++ > 3) {
705
        [NSThread sleepForTimeInterval:0.5];
706
    }
707
}
708
709 656
/***
710 657
 * 关闭加载框  modify by kevin
711 658
 * 处理在并发调用场景下的重复关闭子视图的BUG
@ -720,132 +667,138 @@
720 667
    return false;
721 668
}
722 669
723
- (void)back:(NSArray *)param {
724
    IPUFlipperView *flipperView = (IPUFlipperView *)[self.mobileDelegate getFlipperView];
725
    
726
    // 目标视图的偏移量
727
    NSString *pageAction = param[0];
728
    NSUInteger count = [flipperView getViewOffset:pageAction];
729
    [flipperView backWithCount:count];
730
}
731
732
- (void)backWithCallback:(NSArray *)param {
733
    if (!param || !param.count) {
734
        // 参数为空,返回上一页面
735
        [self back:param];
736
        return;
737
    }
738
    NSString *result = param[0];    // 回调数据
739
    IPUFlipperView *flipperView = (IPUFlipperView *)[self.mobileDelegate getFlipperView];
740
    UIView *formerView = nil;
741
    NSString *pageAction = param.count > 1 ? param[1] : nil;
742
    NSInteger offeset = [flipperView getViewOffert:pageAction view:&formerView];
670
#pragma mark - 工具类插件
671
//调用原生的时间选择器供用户选择,返回用户选择的时间。
672
- (void)date:(NSArray *)param {
673
    IPUDatePickerStyle datePickerStyle = IPUDatePickerStyleShowYearMonthDay;
674
    NSString *format = param[1];
675
    NSString *time = param[0];
743 676
    
744
    if ([formerView isKindOfClass:[UIWebView class]] ||
745
        [formerView isKindOfClass:NSClassFromString(@"WKWebView")]) {   // 上一个视图注入js
746
        // 构造需要注入的js
747
        result = [NSString stringWithFormat:@"WadeMobile.backevent.backCall('%@');", [IPUStringUtility encodeForJs:result]];
748
        [formerView performSelector:@selector(stringByEvaluatingJavaScriptFromString:) withObject:result];
749
    } else {
750
        // ReactNative RCTRootView 预留
751
        // ...
752
    }
677
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
753 678
    
754
    [flipperView backWithCount:offeset];
755
}
679
    if ([self isValidate:@"HH.*MM.*" withStr:[format uppercaseString]]) {
680
        datePickerStyle = IPUDatePickerStyleShowHourMinute;
681
        
682
        // 构造完成的初始化时间
683
        NSDate *now = [NSDate date];
684
        NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
685
        [dateFormatter1 setDateFormat:@"yyyy-MM-dd"];
686
        [dateFormatter1 setTimeZone:[NSTimeZone timeZoneWithName:@"Asia/Shanghai"]];
687
        NSString *nowString = [dateFormatter1 stringFromDate:now];
688
        time = [nowString stringByAppendingFormat:@" %@", time];
689
        
690
        NSString *format = @"yyyy-MM-dd HH:mm:ss";
691
        
692
        [dateFormatter setDateFormat:format];
693
        [dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"Asia/Shanghai"]];
694
    } else if ([self isValidate:@"YYYY.*MM.*DD" withStr:[format uppercaseString]]) {
695
        datePickerStyle = IPUDatePickerStyleShowYearMonthDay;
696
        
697
        [dateFormatter setDateFormat:format];
698
        [dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"Asia/Shanghai"]];
699
    } else if ([self isValidate:@"YYYY.*MM.*" withStr:[format uppercaseString]]) {
700
        datePickerStyle = IPUDatePickerStyleShowYearMonthDayHourMinute;
756 701
757
- (void)openWindow:(NSArray *)param {
758
    NSString *pageAction = param[0];
759
    IPUDataMap *pageParam = nil;
760
    if ([param count] > 1) {
761
        if (nil == param[1] || [@"" isEqual:param[1]]) {
762
            pageParam = [[IPUDataMap alloc] init];
763
        } else {
764
            pageParam = [[IPUDataMap alloc] initWithString:param[1]];
765
        }
766
    }
767
    
768
    UIViewController *rootCtrl = [self getViewController];
769
    if (rootCtrl.presentedViewController) {
770
        [rootCtrl.presentedViewController dismissViewControllerAnimated:NO completion:nil];
702
        [dateFormatter setDateFormat:format];
703
    } else if ([format isEqual:@"yyyy"] || [format isEqual:@"yyyy年"]) {
704
        datePickerStyle = IPUDatePickerStyleShowYear;
705
        
706
        [dateFormatter setDateFormat:format];
707
    } else if ([format isEqual:@"MM"] || [format isEqual:@"MM月"]) {
708
        datePickerStyle = IPUDatePickerStyleShowMonth;
709
    } else if ([format isEqual:@"dd HH:mm"]) {
710
        datePickerStyle = IPUDatePickerStyleShowDayHourMinute;
711
    } else if ([format isEqual:@"MM-dd HH:mm"]) {
712
        datePickerStyle = IPUDatePickerStyleShowMonthDayHourMinute;
713
    } else if ([format isEqual:@"yyyy-MM"]) {
714
        datePickerStyle = IPUDatePickerStyleShowYearMonth;
715
        
716
        [dateFormatter setDateFormat:format];
717
    } else if ([format isEqual:@"MM-dd"]) {
718
        datePickerStyle = IPUDatePickerStyleShowMonthDay;
771 719
    }
772 720
    
773
    IPUWindowViewController *window = [[IPUWindowViewController alloc] init];
774
    window.modalPresentationStyle = UIModalPresentationFullScreen;
775
    
776
    window.pageAction = pageAction;
777
    window.pageData = pageParam;
778
    window.plugin = self;
721
    [dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"Asia/Shanghai"]];
779 722
    
780
    [rootCtrl presentViewController:window
781
                           animated:NO
782
                         completion:nil];
723
    NSDate *date = [dateFormatter dateFromString:time];
724
    IPUDatePicker *datePicker = [[IPUDatePicker alloc] initWithDateStyle:datePickerStyle
725
                                                            scrollToDate:date
726
                                                           completeBlock:^(NSDate * _Nonnull selectedDate) {
727
        [self callback:[dateFormatter stringFromDate:selectedDate]];
728
    }];
729
    [datePicker show];
783 730
}
784
785
- (void)closeWindow:(NSArray *)param {
786
    IPUWindowViewController *window = (IPUWindowViewController *)[self getViewController];
787
    [window closeWindow];
788
    IPUPlugin *plugin = [window plugin];
789
    NSString *data = nil;
790
    if (param.count) {
791
        data = param[0];
731
//alert弹出框
732
- (void)alert:(NSArray *)param {
733
    NSString *type = nil, *title = [NSString stringWithFormat:@"%@", param[0]];
734
    if (param.count > 1) {
735
        type = [NSString stringWithFormat:@"%@", param[1]];
792 736
    }
793
    if (![[NSNull null] isEqual:data]) {
794
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
795
            [plugin callback:data];
796
        });
737
    if ([@"1" isEqualToString:type]) {
738
        
797 739
    }
798
}
799
800
- (void)openSlidingMenu:(NSArray *)param{
801
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@""
802
                                                    message:@"iOS版暂不支持此功能"
803
                                                   delegate:nil
804
                                          cancelButtonTitle:@"OK"
805
                                          otherButtonTitles:nil, nil];
806
    [alert show];
807
}
808
809
- (void)closeSlidingMenu:(NSArray *)param{
810
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@""
811
                                                    message:@"iOS版暂不支持此功能"
812
                                                   delegate:nil
813
                                          cancelButtonTitle:@"OK"
814
                                          otherButtonTitles:nil, nil];
740
    UIAlertView *alert = [[UIAlertView alloc]initWithTitle:title
741
                                                   message:nil
742
                                                  delegate:nil
743
                                         cancelButtonTitle:@"OK"
744
                                         otherButtonTitles:nil, nil];
815 745
    [alert show];
816 746
}
817
818
- (void)getPage:(NSArray *)param {
819
    NSString *pageAction = param[0];
820
    NSObject *dataParam = param[1];    
821
    NSString *dataAction = [IPUServerPage getData:pageAction];
822
    IPUDataMap *pageParam = nil;
823
    if (dataAction) {
824
        IPUMobileSecurity *security = nil;
825
        if ([IPUServerData isEncrypt:dataAction]) {
826
            security = [IPUMobileSecurity new];
827
        }
828
        
829
        //参数加密
830
        NSMutableDictionary *postDict = [[NSMutableDictionary alloc] init];
831
        postDict = [[[IPUNetworkUtil alloc] init] transPostData:dataAction
832
                                                         params:dataParam
833
                                                       security:security];
834
        //数据请求
835
        NSString *requestUrl = [[IPUMobileConfig getRequestHost] stringByAppendingFormat:@"%@%@", [IPUMobileConfig getRequestPath], [IPUMobileConfig getRequestServlet]];
836
        NSString *result = [IPUHttpTool postRequest:requestUrl data:[IPUHttpTool toQueryStringAndEncoding:postDict]];
837
        
838
        //返回结果解密
839
        if (security) {
840
            result = [security responseDecrypt:result];
841
        }
842
        
843
        pageParam = [[IPUDataMap alloc] initWithString:result];
747
//信息提示框
748
- (void)tip:(NSArray *)args {
749
    NSString *message = [NSString stringWithFormat:@"%@", args[0]];
750
    NSString *durationStr = 0;
751
    if (![IPUCommonTool isNull:args[1]]) {
752
        durationStr = args[1];
844 753
    }
845
    NSString *pageHTML = [self getTemplateHtml:pageAction widthData:pageParam];
846
    [self callback:pageHTML];
754
    [self tip:message withDuration:durationStr];
755
}
756
- (BOOL)isValidate:(NSString *)regex withStr:(NSString *)str {
757
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
758
    return [predicate evaluateWithObject:str];
759
}
760
/***
761
 * 提示信息栏  add by kevin
762
 * @param(messsage)     提示信息
763
 * @param(durationStr)  视图显示时长标识
764
 */
765
- (void)tip:(NSString *)message withDuration:(NSString *)durationStr {
766
    double duration = [durationStr doubleValue] == 0 ? 2 : 5;
767
    
768
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
769
    UIView *showview =  [[UIView alloc] init];
770
    showview.backgroundColor = [UIColor blackColor];
771
    showview.frame = CGRectMake(1, 1, 1, 1);
772
    showview.alpha = 1.0f;
773
    showview.layer.cornerRadius = 5.0f;
774
    showview.layer.masksToBounds = YES;
775
    [window addSubview:showview];
776
    
777
    UILabel *label = [[UILabel alloc] init];
778
    CGSize LabelSize = [message sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17]}];
779
    label.frame = CGRectMake(10, 5, LabelSize.width, LabelSize.height);
780
    label.text = message;
781
    label.numberOfLines = 0; // 自动换行
782
    label.textColor = [UIColor whiteColor];
783
    label.textAlignment = 1;
784
    label.backgroundColor = [UIColor clearColor];
785
    label.font = [UIFont boldSystemFontOfSize:15];
786
    [showview addSubview:label];
787
    
788
    CGFloat outWith = LabelSize.width + 20,outHeight = LabelSize.height + 10;
789
    CGFloat x = (SCREEN_WIDTH - outWith)/2, y = (SCREEN_HEIGHT - LabelSize.height) * 0.9;
790
    showview.frame = CGRectMake(x, y, outWith, outHeight);
791
    
792
    [UIView animateWithDuration:duration
793
                     animations:^{
794
                         showview.alpha = 0;
795
                     }
796
                     completion:^(BOOL finished) {
797
                         [showview removeFromSuperview];
798
                     }];
847 799
}
848 800
801
#pragma mark - other method
849 802
- (void)clearBackStack:(NSArray *)param {
850 803
    [[self.mobileDelegate getFlipperView] clearBackStack];
851 804
}
@ -863,90 +816,7 @@
863 816
        [self error:@"参数缺失"];
864 817
        return;
865 818
    }
866
    
867 819
    [[self.mobileDelegate getCurrentView] loadUrl:params[0]];
868 820
}
869 821
870 822
@end
871
872
/*
873
 {
874
  "DATA": [
875
         {
876
   "STATUS": "0",
877
   "MAIN_TYPE": "宽带资源",
878
   "SHOW_TYPE": "POLYGON",
879
   "COLOR": "#00e6ac",
880
   "BORDER_STYLE": "SOLID",
881
   "LAYER_NAME": "全覆盖",
882
   "LAYER_ID": 1,
883
   "ORDER_NO": 1,
884
   "IS_DEFAULT": "1"
885
  },
886
         {
887
   "STATUS": "0",
888
   "MAIN_TYPE": "宽带资源",
889
   "SHOW_TYPE": "POLYGON",
890
   "COLOR": "#ff0000",
891
   "BORDER_STYLE": "SOLID",
892
   "LAYER_NAME": "半覆盖",
893
   "LAYER_ID": 2,
894
   "ORDER_NO": 2,
895
   "IS_DEFAULT": "0"
896
  }, {
897
   "STATUS": "0",
898
   "MAIN_TYPE": "宽带资源",
899
   "SHOW_TYPE": "POLYGON",
900
   "COLOR": "#ffff00",
901
   "BORDER_STYLE": "SOLID",
902
   "LAYER_NAME": "双优小区",
903
   "LAYER_ID": 3,
904
   "ORDER_NO": 3,
905
   "IS_DEFAULT": "0"
906
  }, {
907
   "STATUS": "0",
908
   "MAIN_TYPE": "宽带资源",
909
   "SHOW_TYPE": "POLYGON",
910
   "COLOR": "#cc00ff",
911
   "BORDER_STYLE": "SOLID",
912
   "LAYER_NAME": "千兆小区",
913
   "LAYER_ID": 4,
914
   "ORDER_NO": 4,
915
   "IS_DEFAULT": "0"
916
  }, {
917
   "STATUS": "0",
918
   "MAIN_TYPE": "移网基站",
919
   "SHOW_TYPE": "MARKER",
920
   "COLOR": "#3366ff",
921
   "BORDER_STYLE": "DASHED",
922
   "LAYER_NAME": "5G",
923
   "LAYER_ID": 5,
924
   "ORDER_NO": 5,
925
   "IS_DEFAULT": "0"
926
  }, {
927
   "STATUS": "0",
928
   "MAIN_TYPE": "移网基站",
929
   "SHOW_TYPE": "MARKER",
930
   "COLOR": "#66ff66",
931
   "BORDER_STYLE": "DASHED",
932
   "LAYER_NAME": "4G",
933
   "LAYER_ID": 6,
934
   "ORDER_NO": 6,
935
   "IS_DEFAULT": "0"
936
  }, {
937
   "STATUS": "0",
938
   "MAIN_TYPE": "移网基站",
939
   "SHOW_TYPE": "MARKER",
940
   "COLOR": "#ffcc00",
941
   "BORDER_STYLE": "DASHED",
942
   "LAYER_NAME": "3G",
943
   "LAYER_ID": 7,
944
   "ORDER_NO": 7,
945
   "IS_DEFAULT": "0"
946
  }],
947
  "X_RESULTINFO": "OK"
948
 }
949
 
950
 https://unify.zj.chinaunicom.com/portalSpring/appInterface/queryResourcesPointList?LAYER_ID=1&YW_TYPE=1&LAT=29.11&LON=118.21
951
 https://unify.zj.chinaunicom.com/portalSpring/appInterface/queryResourcesMenu
952
 */