wxr
2022-07-04 1f26d743028ceb7e37555e1e89cd078e90a5c242
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
#if __Android__
 
using System;
using HDL_ON.UI.CSS;
using Shared;
using HDL_ON.DAL.Server;
using System.Collections.Generic;
using Com.Hdl.Hdllinphonesdk.Utils;
using Com.Hdl.Hdllinphonesdk.Dialog;
 
namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
{
    public class VisitorQRCodePage : FrameLayout
    {
        FrameLayout bodyView;
        VerticalScrolViewLayout bodyScrolView;
        private EditText phoneNumberEditText;// 电话号码EditText
        private EditText pwdEditText;// 密码EditText
        private Button randomBtn;//随机密码Btn
        private FrameLayout codeLayout;
        private ImageView codeIV;// 二维码
        private Button codeSaveTipBtn;
        private Button codeTip;//二维码有效期提示
        private Button visitorVoucherBtn;
        private VisitorTempPassword tempPassword;
 
        Action backAction;// 后退按键,刷新UI
 
        public VisitorQRCodePage()
        {
            bodyView = this;
        }
 
        public VisitorQRCodePage(Action action,VisitorTempPassword pwd)
        {
            bodyView = this;
            this.tempPassword = pwd;
            backAction = action;
        }
 
        public override void RemoveFromParent()
        {
            this.tempPassword = null;
            backAction?.Invoke();
            base.RemoveFromParent();
        }
 
        public void LoadPage()
        {
#region 顶部导航栏
            if (tempPassword == null || tempPassword.id == null)
            {
                tempPassword = new VisitorTempPassword();
 
                Action click = () =>
                {
                    Action action = () =>
                    {
                        LoadPage();
                    };
                    VisitorHistoryPage page = new VisitorHistoryPage(action);
                    MainPage.BasePageView.AddChidren(page);
                    page.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
 
                bodyView.BackgroundColor = CSS_Color.BackgroundColor;
                new TopViewDiv(bodyView, Language.StringByID(StringId.VisitorInvitation))
                    .LoadTopView_SettingText(click, Language.StringByID(StringId.VisitorRecord));
            }
            else
            {
                bodyView.BackgroundColor = CSS_Color.BackgroundColor;
                new TopViewDiv(bodyView, Language.StringByID(StringId.VisitorInvitation)).LoadTopView();
            }
#endregion
 
            bodyScrolView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(64),
                VerticalScrollBarEnabled = false,
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            bodyView.AddChidren(bodyScrolView);
 
            // 提示文字
            bodyScrolView.AddChidren(new Button()
            {
                Text = Language.StringByID(StringId.VisitorTip),
                IsMoreLines = true,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextColor = CSS_Color.PromptingColor1,
                TextAlignment = TextAlignment.Center,
                Padding = new Padding(0, Application.GetRealWidth(20), 0, Application.GetRealWidth(20)),
                Height = Application.GetRealHeight(60),
            });
 
#region 手机号
            bodyScrolView.AddChidren(new Button()
            {
                Text = Language.StringByID(StringId.PhoneNumber),
                Y = Application.GetRealWidth(10),
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Height = Application.GetRealHeight(20),
                Padding = new Padding(0, Application.GetRealWidth(20), 0, Application.GetRealWidth(20)),
                TextAlignment = TextAlignment.CenterLeft,
            });
 
            phoneNumberEditText = new EditText()
            {
                Height = Application.GetRealHeight(45),
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(335),
                TextSize = CSS_FontSize.TextFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
 
                PlaceholderText = Language.StringByID(StringId.InputPhoneNumberOfTheVisitor),
                Text = tempPassword.phone,
                IsNumberKeyboardType = true,
                PlaceholderTextColor = CSS_Color.PromptingColor1,
            };
            bodyScrolView.AddChidren(phoneNumberEditText);
            //phoneNumberEditText.Foucs = true;
 
            // 分割线
            bodyScrolView.AddChidren(new Button()
            {
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(335),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
#endregion
 
#region 动态密码
            bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(10), });
            bodyScrolView.AddChidren(new Button()
            {
                Text = Language.StringByID(StringId.linshimima),
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Height = Application.GetRealHeight(20),
                Padding = new Padding(0, Application.GetRealWidth(20), 0, Application.GetRealWidth(20)),
                TextAlignment = TextAlignment.CenterLeft,
            });
 
            FrameLayout pwdLayout = new FrameLayout()
            {
                Height = Application.GetRealHeight(40),
            };
 
            // 密码输入框
            pwdEditText = new EditText()
            {
                X = Application.GetRealWidth(20),
                TextSize = CSS_FontSize.TextFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Width = Application.GetRealWidth(335),
                PlaceholderText = Language.StringByID(StringId.Input6_DigitsTemporaryPassword),
                IsNumberKeyboardType = true,
                PlaceholderTextColor = CSS_Color.PromptingColor1,
            };
            pwdLayout.AddChidren(pwdEditText);
 
            //随机密码Btn
            randomBtn = new Button()
            {
                X = Application.GetRealWidth(275),
                Width = Application.GetRealWidth(80),
                Text = Language.StringByID(StringId.RandomGeneration),
                TextAlignment = TextAlignment.CenterRight,
                TextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.TextFontSize,
            };
            pwdLayout.AddChidren(randomBtn);
            bodyScrolView.AddChidren(pwdLayout);
 
            // 分割线
            bodyScrolView.AddChidren(new Button()
            {
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(335),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
#endregion
 
#region 二维码生效时间
            FrameLayout startLayout = new FrameLayout()
            {
                Height = Application.GetRealHeight(40),
                Y = Application.GetRealWidth(10),
            };
 
            startLayout.AddChidren(new Button()
            {
                Text = Language.StringByID(StringId.EffectiveTime),
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(130),
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.CenterLeft,
                Enable = false,
            });
            Button startTimeText = new Button()
            {
                X = Application.GetRealWidth(159),
                Width = Application.GetRealWidth(150),
                TextAlignment = TextAlignment.CenterRight,
                TextSize = CSS_FontSize.TextFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            if (tempPassword.tempPwd == null || tempPassword.tempPwd == "")
            {
                startTimeText.Text = "";// System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
            else
            {
                startTimeText.Text = tempPassword.validBeginTime;
            }
 
            startLayout.AddChidren(startTimeText);
            startLayout.AddChidren(new Button()
            {
                X = Application.GetRealWidth(339),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
                Enable = false,
            });
            Button startTimeBtn = new Button();
            startLayout.AddChidren(startTimeBtn);
            // dialog回调
            Action<string> startTimeAction = (str) =>
            {
                startTimeText.Text = str + ":00";
            };
            startTimeBtn.MouseUpEventHandler += (sender, e) =>
            {
                try
                {
                    new LpTimeDialog(Application.Activity, new LpTimeDialogCallBak(startTimeAction)).Show();
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }
            };
            bodyScrolView.AddChidren(startLayout);
            // 分割线
            bodyScrolView.AddChidren(new Button()
            {
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(335),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
 
#endregion
 
#region 二维码失效时间
            FrameLayout endLayout = new FrameLayout()
            {
                Height = Application.GetRealHeight(40),
                Y = Application.GetRealWidth(10),
            };
 
            endLayout.AddChidren(new Button()
            {
                Text = Language.StringByID(StringId.FailureTime),
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(130),
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.CenterLeft,
                Enable = false,
            });
            Button endTimeText = new Button()
            {
                X = Application.GetRealWidth(159),
                Width = Application.GetRealWidth(150),
                TextAlignment = TextAlignment.CenterRight,
                TextSize = CSS_FontSize.TextFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Enable = false,
            };
            if (tempPassword.tempPwd == null || tempPassword.tempPwd == "")
            {
                endTimeText.Text = "";// System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
            else
            {
                endTimeText.Text = tempPassword.validEndTime;
            }
            endLayout.AddChidren(endTimeText);
            endLayout.AddChidren(new Button()
            {
                X = Application.GetRealWidth(339),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
                Enable = false,
            });
            Button endTimeBtn = new Button();
            endLayout.AddChidren(endTimeBtn);
            bodyScrolView.AddChidren(endLayout);
            // 分割线
            bodyScrolView.AddChidren(new Button()
            {
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(335),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
            // dialog回调
            Action<string> endTimeAction = (str) =>
            {
                endTimeText.Text = str + ":00";
            };
            endTimeBtn.MouseUpEventHandler += (sender, e) =>
            {
                try
                {
                    new LpTimeDialog(Application.Activity, new LpTimeDialogCallBak(endTimeAction)).Show();
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }
            };
#endregion
 
#region 二维码
            bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(33), });
            codeLayout = new FrameLayout()
            {
                X = Application.GetRealWidth(117),
                Width = Application.GetRealWidth(142),
                Height = Application.GetRealWidth(142),
            };
            bodyScrolView.AddChidren(codeLayout);
 
            // 二维码ImagView
            codeIV = new ImageView()
            {
                BackgroundColor = CSS_Color.BackgroundColor,
            };
            codeLayout.AddChidren(codeIV);
 
            bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(20), });
            codeSaveTipBtn = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealWidth(20),
                Text = Language.StringByID(StringId.LongPressQRCodeSave),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Visible = false,
            };
            bodyScrolView.AddChidren(codeSaveTipBtn);
#endregion
 
            bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(28), });
            visitorVoucherBtn = new Button()
            {
                X = Application.GetRealWidth(78),
                Width = Application.GetRealWidth(220),
                Height = Application.GetRealWidth(44),
                BackgroundColor = CSS_Color.MainColor,
                Radius = (uint)Application.GetRealWidth(44),
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.textWhiteColor,
            };
            bodyScrolView.AddChidren(visitorVoucherBtn);
 
            Action voucher_action = () =>
            {
                if (codeIV.ImageBytes == null)
                {
                    // 请求服务端,生成临时密码
                    tempPassword.homeId = Entity.DB_ResidenceData.Instance.CurrentRegion.id;
                    tempPassword.phone = phoneNumberEditText.Text;
                    tempPassword.tempPwd = pwdEditText.Text;
                    tempPassword.validBeginTime = startTimeText.Text;
                    tempPassword.validEndTime = endTimeText.Text;
                    tempPassword.useCount = 1000;
                    CreateVisitorPassword(tempPassword);
                }
                else
                {
                    // 删除访客临时密码
                    DelVisitorPassword(tempPassword);
                }
            };
            visitorVoucherBtn.MouseUpEventHandler += (sender, e) =>
            {
                if (startTimeText.Text.Trim() == "")
                {
                    var tip_dialog = new Tip()
                    {
                        Text = Language.StringByID(StringId.VisitorStartTime),
                        CloseTime = 2,
                        Direction = AMPopTipDirection.None
                    };
                    tip_dialog.Show(MainPage.BaseView);
                    return;
                }
 
                if (endTimeText.Text.Trim() == "")
                {
                    var tip_dialog = new Tip()
                    {
                        Text = Language.StringByID(StringId.VisitorEndTime),
                        CloseTime = 2,
                        Direction = AMPopTipDirection.None
                    };
                    tip_dialog.Show(MainPage.BaseView);
                    return;
                }
 
                if (phoneNumberEditText.Text.Trim() == "" || phoneNumberEditText.Text.Trim().Length != 11)
                {
                    var tip_dialog = new Tip()
                    {
                        Text = Language.StringByID(StringId.PhoneNumberErrorTip),
                        CloseTime = 2,
                        Direction = AMPopTipDirection.None
                    };
                    tip_dialog.Show(MainPage.BaseView);
                    phoneNumberEditText.Foucs = true;
                    return;
                }
 
                if (pwdEditText.Text.Trim() == "" || pwdEditText.Text.Trim().Length != 6)
                {
                    var tip_dialog = new Tip()
                    {
                        Text = Language.StringByID(StringId.Input6_DigitsTemporaryPassword),
                        CloseTime = 2,
                        Direction = AMPopTipDirection.None
                    };
                    tip_dialog.Show(MainPage.BaseView);
                    pwdEditText.Foucs = true;
                    return;
                }
 
                string tip = "";
                string message = "";
                if (codeIV.ImageBytes == null)
                {
                    tip = Language.StringByID(StringId.tip);
                    message = Language.StringByID(StringId.VisitorTipContent);
                }
                else
                {
                    tip = Language.StringByID(StringId.tip);
                    message = Language.StringByID(StringId.VisitorDelTipContent);
                }
                new LpTipDialog(Application.Activity, tip, message, new LpTipDialogCallBack(voucher_action)).Show();
            };
 
            //将二维码保存到本地相册
            codeIV.MouseLongEventHandler += (sender, e) =>
            {
#if __Android__
                bool bol = HDLImageUtils.SaveImageToGallery(Application.Activity,
                    Scan.BytesFromText(tempPassword.tempPwd, codeIV.Width, codeIV.Height));
 
                string msg = "";
                if (bol)
                {
                    msg = Language.StringByID(StringId.SavedSuccessfully);
                }
                else
                {
                    msg = Language.StringByID(StringId.saveFail);
                }
 
                var tip_dialog = new Tip()
                {
                    Text = msg,
                    CloseTime = 2,
                    Direction = AMPopTipDirection.None
                };
                tip_dialog.Show(MainPage.BaseView);
#endif
            };
 
            if (tempPassword != null && tempPassword.id != null && tempPassword.id != "")
            {
                pwdEditText.Text = tempPassword.tempPwd;
                pwdEditText.PlaceholderText = Language.StringByID(StringId.TemporaryPasswordInvalid);
                pwdEditText.Enable = false;
                phoneNumberEditText.Enable = false;
                randomBtn.Visible = false;
                startTimeBtn.Enable = false;
                endTimeBtn.Enable = false;
            }
            else
            {
                pwdEditText.FoucsChanged = (sender, e) =>
                {
                    if (!pwdEditText.Foucs)
                    {
                        // 6位密码验证
                        var tip_dialog = new Tip()
                        {
                            Text = Language.StringByID(StringId.Input6_DigitsTemporaryPassword),
                            CloseTime = 2,
                            Direction = AMPopTipDirection.None
                        };
                        tip_dialog.Show(MainPage.BaseView);
                    }
                };
 
                randomBtn.MouseUpEventHandler += (sender, e) =>
                {
                    string tPwd = getRandomPwd();
                    pwdEditText.Text = tPwd;
                };
 
                phoneNumberEditText.FoucsChanged = (sender, e) =>
                {
                    if (!phoneNumberEditText.Foucs)
                    {
                        //手机号码错误提示
                        if (!Utlis.CheckPhoneNumber(phoneNumberEditText.Text.Trim(), "86"))
                        {
                            var tip_dialog = new Tip()
                            {
                                Text = Language.StringByID(StringId.PhoneNumberErrorTip),
                                CloseTime = 2,
                                Direction = AMPopTipDirection.None
                            };
                            tip_dialog.Show(MainPage.BaseView);
                        }
                    }
                };
            }
 
            RefreshVisitorVoucherBtn();
        }
 
        /// <summary>
        /// 刷新VisitorVoucherBtn状态
        /// </summary>
        private void RefreshVisitorVoucherBtn()
        {
            if (tempPassword == null) return;
 
            if (tempPassword.tempPwd != null && tempPassword.tempPwd != "")
            {
                codeIV.ImageBytes = Scan.BytesFromText(tempPassword.tempPwd, codeIV.Width, codeIV.Height);
                //判断二维码是否失效
                DateTime endTime = DateTime.Parse(tempPassword.validEndTime);
                DateTime currentTime = DateTime.Now;
                if (currentTime > endTime || !tempPassword.status)
                {
                    // 二维码有效期提示
                    codeTip = new Button()
                    {
                        TextAlignment = TextAlignment.Center,
                        TextColor = CSS_Color.textWhiteColor,
                        BackgroundColor = CSS_Color.DialogTransparentColor1,
                        Text = Language.StringByID(StringId.QRcodeIsInvalid),
                    };
                    codeLayout.AddChidren(codeTip);
                    visitorVoucherBtn.Visible = false;
                }
                visitorVoucherBtn.Text = Language.StringByID(StringId.CancleVisitorCredentials);
            }
            else
            {
                visitorVoucherBtn.Visible = true;
                visitorVoucherBtn.Text = Language.StringByID(StringId.GenerateVisitorCredentials);
            }
        }
 
        /// <summary>
        /// 添加临时密码(访客凭证)
        /// </summary>
        /// <param name="homeId">住宅id</param>
        /// <param name="phone">访客手机号</param>
        /// <param name="tempPwd">临时密码</param>
        /// <param name="validBeginTime">开始时间</param>
        /// <param name="validEndTime">结束时间</param>
        /// <param name="useCount">使用次数,默认一个数值大一些的</param>
        /// <returns></returns>
        private bool CreateVisitorPassword(VisitorTempPassword pwd)
        {
            var result = false;
            Dictionary<string, object> dictionary = new Dictionary<string, object>();
            dictionary.Add("homeId", pwd.homeId);
            dictionary.Add("phone", pwd.phone);
            dictionary.Add("tempPwd", pwd.tempPwd);
            dictionary.Add("validBeginTime", pwd.validBeginTime);
            dictionary.Add("validEndTime", pwd.validEndTime);
            dictionary.Add("useCount", pwd.useCount);
 
            var requestJson = HttpUtil.GetSignRequestJson(dictionary);
            var pack = HttpUtil.RequestHttpsPost(NewAPI.API_POST_ADD_TEMP_PASSWORD, requestJson);
            if (pack != null)
            {
                if (pack.Code == StateCode.SUCCESS)
                {
                    pwd.id = pack.Data.ToString();
                    codeIV.ImageBytes = Scan.BytesFromText(pwdEditText.Text, codeIV.Width, codeIV.Height);
                    codeSaveTipBtn.Visible = true;
                    RefreshVisitorVoucherBtn();
                }
                else {
                    var tip_dialog = new Tip()
                    {
                        Text = pack.message,
                        CloseTime = 2,
                        Direction = AMPopTipDirection.None
                    };
                    tip_dialog.Show(MainPage.BaseView);
                }
            }
            return result;
        }
 
        /// <summary>
        /// 删除临时密码(访客凭证)
        /// </summary>
        /// <param name="home_id">住宅id</param>
        /// <param name="pwd_id">临时密码id</param>
        private bool DelVisitorPassword(VisitorTempPassword pwd)
        {
            Dictionary<string, object> dictionary = new Dictionary<string, object>();
            dictionary.Add("homeId", pwd.homeId);
            dictionary.Add("id", pwd.id);
            var result = false;
            var requestJson = HttpUtil.GetSignRequestJson(dictionary);
            var pack = HttpUtil.RequestHttpsPost(NewAPI.API_POST_DEL_TEMP_PASSWORD, requestJson);
            if (pack != null)
            {
                if (pack.Code == StateCode.SUCCESS)
                {
                    // 关闭当前界面
                    RemoveFromParent();
                }
            }
            RefreshVisitorVoucherBtn();
            return result;
        }
 
        /// <summary>
        /// 生成6位随机密码
        /// </summary>
        /// <returns></returns>
        private string getRandomPwd()
        {
            string pwd = "";
            for (int i = 0; i < 6; i++)
            {
                int math = new Random().Next(0, 9);
                pwd += math;
            }
            return pwd;
        }
    }
}
#else
using Shared;
 
namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
{
    public class VisitorQRCodePage : FrameLayout
    { }
}
#endif