-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathartical.json
749 lines (749 loc) · 370 KB
/
artical.json
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
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
[
{
"model": "articals.articletype",
"pk": 11,
"fields": {
"name": "BMC",
"parent": null,
"add_time": "2020-04-22T15:00:55Z",
"modified_time": "2020-04-22T07:02:04.247Z"
}
},
{
"model": "articals.articletype",
"pk": 12,
"fields": {
"name": "BIOS",
"parent": null,
"add_time": "2020-04-22T15:02:16Z",
"modified_time": "2020-04-22T07:02:18.913Z"
}
},
{
"model": "articals.articletype",
"pk": 13,
"fields": {
"name": "\u7f51\u7edc",
"parent": 1,
"add_time": "2020-04-22T15:02:24Z",
"modified_time": "2020-04-22T07:02:37.100Z"
}
},
{
"model": "articals.articletype",
"pk": 14,
"fields": {
"name": "DNS",
"parent": 1,
"add_time": "2020-04-22T15:02:40Z",
"modified_time": "2020-04-22T07:02:47.996Z"
}
},
{
"model": "articals.articletype",
"pk": 15,
"fields": {
"name": "CMM",
"parent": null,
"add_time": "2020-04-22T15:02:49Z",
"modified_time": "2020-04-22T07:02:57.893Z"
}
},
{
"model": "articals.articletype",
"pk": 16,
"fields": {
"name": "Web",
"parent": 1,
"add_time": "2020-04-22T15:03:01Z",
"modified_time": "2020-04-22T07:04:15.242Z"
}
},
{
"model": "articals.articletype",
"pk": 17,
"fields": {
"name": "Backbone",
"parent": 11,
"add_time": "2020-04-22T15:03:25Z",
"modified_time": "2020-04-22T07:05:30.296Z"
}
},
{
"model": "articals.articletype",
"pk": 18,
"fields": {
"name": "\u540e\u7aef",
"parent": 6,
"add_time": "2020-04-22T15:03:47Z",
"modified_time": "2020-04-22T07:04:42.588Z"
}
},
{
"model": "articals.articletype",
"pk": 19,
"fields": {
"name": "HTML",
"parent": 10,
"add_time": "2020-04-22T15:04:46Z",
"modified_time": "2020-04-22T07:05:41.284Z"
}
},
{
"model": "articals.articletype",
"pk": 110,
"fields": {
"name": "\u524d\u7aef",
"parent": 6,
"add_time": "2020-04-22T15:04:57Z",
"modified_time": "2020-04-22T07:05:05.628Z"
}
},
{
"model": "articals.articletype",
"pk": 111,
"fields": {
"name": "Javascript",
"parent": 10,
"add_time": "2020-04-22T15:05:12Z",
"modified_time": "2020-04-22T07:05:22.740Z"
}
},
{
"model": "articals.articletype",
"pk": 112,
"fields": {
"name": "CSS",
"parent": 10,
"add_time": "2020-04-22T15:05:43Z",
"modified_time": "2020-04-22T07:05:52.836Z"
}
},
{
"model": "articals.articletype",
"pk": 113,
"fields": {
"name": "IP \u8bbe\u7f6e",
"parent": 3,
"add_time": "2020-04-22T15:06:00Z",
"modified_time": "2020-04-22T07:06:12.899Z"
}
},
{
"model": "articals.articletype",
"pk": 114,
"fields": {
"name": "\u8282\u70b9\u7ba1\u7406",
"parent": 5,
"add_time": "2020-04-22T15:16:27Z",
"modified_time": "2020-04-22T07:16:37.285Z"
}
},
{
"model": "articals.articletype",
"pk": 115,
"fields": {
"name": "\u7cfb\u7edf\u7ba1\u7406",
"parent": 5,
"add_time": "2020-04-22T15:16:38Z",
"modified_time": "2020-04-22T07:16:48.217Z"
}
},
{
"model": "articals.articletype",
"pk": 116,
"fields": {
"name": "python",
"parent": null,
"add_time": "2020-04-23T13:47:18Z",
"modified_time": "2020-04-23T05:47:26.261Z"
}
},
{
"model": "articals.articletype",
"pk": 117,
"fields": {
"name": "\u6587\u4ef6\u64cd\u4f5c",
"parent": 16,
"add_time": "2020-04-23T13:47:37Z",
"modified_time": "2020-04-23T05:47:52.892Z"
}
},
{
"model": "articals.articale",
"pk": 13,
"fields": {
"note": 1,
"title": "\u56fd\u7f51\u9700\u6c42",
"text_content": "# 1. \u6587\u4ef6\u5b89\u5168\u6027\u68c0\u67e5\n| \u529f\u80fd | \u4f18\u5148\u7ea7 | \u6587\u4ef6\u6269\u5c55\u540d | \u6587\u4ef6\u6700\u5927\u5b57\u8282\u6570 | \u68c0\u67e5\u65b9\u6cd5 | \u5907\u6ce8 |\n| ---------------------------- | ------ | ---------- | -------------- | ------------------------------------------------------------ | ---- |\n| \u4e0a\u4f20SSL\u8bc1\u4e66 | \u9ad8 | pem | 8K | \u4f7f\u7528SSL\u81ea\u8eab\u7684\u9a8c\u8bc1\u65b9\u5f0f | |\n| \u6062\u590d\u914d\u7f6e | \u9ad8 | bak | 16K | \u6587\u4ef6\u5185\u5bb9\u68c0\u67e5\uff0c\u53ea\u80fd\u4f7f\u7528\u901a\u8fc7\u5907\u4efd\u914d\u7f6e\u4ea7\u751f\u7684bak\u6587\u4ef6 | |\n| BMC\u56fa\u4ef6\u66f4\u65b0 | \u9ad8 | ima | 32M | | |\n| BIOS\u56fa\u4ef6\u66f4\u65b0 | \u9ad8 | bin | 32M | | |\n| \u7f16\u8f91\u7528\u6237\u65f6\u4e0a\u4f20SSH\u5bc6\u94a5 | \u9ad8 | pub | 8K | \u5bf9\u6587\u4ef6\u4e2d\u5185\u5bb9\u8fdb\u884c\u68c0\u67e5\uff0c\u53d1\u73b0\u4e0d\u7b26\u5408\u9879\u65f6\u8fd4\u56de\u9519\u8bef\u503c | |\n| \u4f7f\u7528LDAP\u4e0b\u7684StartTSL\u52a0\u5bc6\u7c7b\u578b | \u4f4e | | | | |\n| `CPLD\u56fa\u4ef6\u66f4\u65b0` | \u4f4e | jed\u3001pof | 4M | | |\n| PSU\u56fa\u4ef6\u66f4\u65b0 | \u4f4e | hex | 256K | \u6587\u4ef6\u4e2d\u7684\u6bcf\u4e00\u884c\u5185\u5bb9\u90fd\u4ee5:\u5f00\u59cb | |\n| \u80cc\u677f\u56fa\u4ef6\u66f4\u65b0 | \u4f4e | bin | 960K | \u9488\u5bf9\u6587\u4ef6\u4e2d\u7684\u6570\u636e\u6309\u7167dword\u5927\u5c0f\u8ba1\u7b97Checksum\uff0c\u5f97\u5230\u7684Checksum\u5e94\u8be5\u4e3a0 | |\n| DNS\u914d\u7f6e | \u4f4e | | | | |\n| | | | | | |\n\n\u9488\u5bf9\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd\uff0c\u9700\u8981\u524d\u7aef\u7edf\u4e00\u5b9e\u73b0\uff1a\n\n\u5728\u5e2e\u52a9\u4fe1\u606f\u4e2d\u63cf\u8ff0\u5982\u4e0b\u4fe1\u606f\uff1a\n\n\u6587\u4ef6\u7684\u6269\u5c55\u540d\u7c7b\u578b\uff0c\u4f8b\u5982\u4e0a\u4f20SSL\u9875\u9762\n\n\u6587\u4ef6\u7684\u6700\u5927\u5b57\u8282\u6570\uff0c\u4f8b\u5982\u4e0a\u4f20SSL\u9875\u9762\n\n\u5bf9\u5728\u6587\u672c\u6846\u8f93\u5165\u7684\u6587\u4ef6\u540d\u8fdb\u884c\u68c0\u67e5\uff0c\u4f8b\u5982\u4e0a\u4f20SSL\u9875\u9762\u548c\u4e0a\u4f20SSH\u9875\u9762\n\n\u540e\u7aef\u4e5f\u9700\u8981\u6dfb\u52a0\u5bf9\u6587\u4ef6\u6269\u5c55\u540d\u3001\u6587\u4ef6\u5927\u5c0f\u7684\u68c0\u67e5\u3002\n\n\n\n\n\n# 2. \u56fd\u7f51\u9700\u6c42\uff1a\u7cfb\u7edf\u542f\u7528\u4e86\u4e0d\u5b89\u5168\u7684HTTP\u8bf7\u6c42\u65b9\u6cd5\uff0c\u8981\u6c42\u5173\u95ed\u9664\u4e86POST\u548cGET\u4e4b\u5916\u7684\u6240\u6709\u65b9\u6cd5\u3002\n\n| Web\u9875\u9762 | \u6587\u4ef6 | \u8c03\u7528\u51fd\u6570 | rest\u8c03\u7528\u65b9\u6cd5 | \u63a5\u53e3 | BMC\u5f00\u53d1\u72b6\u6001 |\n| -------------------------------------- | ------------------------------------ | ---------------------------------------- | ------------ | --------------------------------------------------------- | -------------------------------------------------------- |\n| \u4f20\u611f\u5668\u4fe1\u606f | settings_sensor_threshold.c | SetSensorThreshold | PUT | /settings/sensor-threshold | OK |\n| \u5b58\u50a8\u7cfb\u7edf | settings_raid_management.c | SetPhysicalRemovalCmd | PUT | /settings/raid_management/physical_removal_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | SetPhysicalManageHotSpare | PUT | /settings/raid_management/physical_hotspare_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | getRAIDLevelStripSize | PUT | /settings/raid_management/raid_levels | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | getRAIDLevelPDCount | PUT | /settings/raid_management/raid_pd_count | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | SetPhysicalManageDedicateHotSpare | PUT | /settings/raid_management/physical_dedicated_hotspare_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | SetPhysicalManageStartStopLocate | PUT | /settings/raid_management/physical_start_stop_locate_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | SetLogicalManageStartStopLocate | PUT | /settings/raid_management/logical_start_stop_locate_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | SetLogicalConsistencyCheck | PUT | /settings/raid_management/logical_consistency_check_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | SetLogicalDriveInitializationStartCancel | PUT | /settings/raid_management/logical_initialize_check_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | GettLogicalDeviceProgress | PUT | /settings/raid_management/logical_device_progress_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | ClearRAIDEventLogs | DELETE | /settings/raid_management/raid_event_log | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | DeleteVirtualDrive | DELETE | /settings/raid_management/delete_virtual_drive | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| \u63a7\u5236\u53f0\u91cd\u5b9a\u5411 | settings_kvm_mousemode.c | setMouseMode | PUT | /settings/mouse | OK |\n| \u7535\u6e90\u4e0e\u80fd\u8017 | server_configure/me_power_policy.c | setmePolicy | PUT | /s_me_policy/([[:digit:]]+) | OK |\n| | server_configure/power_hot_standby.c | setPowerModeConfig | PUT | /server_configuration/set_power_status | OK |\n| \u65e5\u671f&\u65f6\u95f4 | settings_ntp_configuration.c | putNtpCfg | PUT | /settings/date-time | OK |\n| \u5916\u90e8\u7528\u6237\u670d\u52a1 | settings_ldap.c | setLdap | PUT | /settings/ldap-settings | OK |\n| | settings_ldap_users.c | deleteLDAPUsers | DELETE | /settings/ldap-users/([[:digit:]]+) | /settings/ldap-users-del |\n| | settings_ldap_users.c | modifyLDAPUsers | PUT | /settings/ldap-users/([[:digit:]]+) | |\n| | settings_active_directory.c | setActDir | PUT | /settings/active-directory-settings | OK |\n| | settings_active_directory_users.c | modifyActDirUsers | PUT | /settings/active-directory-users/([[:digit:]]+) | |\n| | settings_active_directory_users.c | deleteActDirUsers | DELETE | /settings/active-directory-users/([[:digit:]]+) | /settings/active-directory-users-del/ |\n| | settings_radius.c | setRadiusConfig | PUT | /settings/radius/general | OK |\n| \u544a\u8b66\u8bbe\u7f6e | settings_remote_alert.c | setSNMPTrap | PUT | /settings/remote_alert/snmptrap | OK |\n| | settings_remote_alert.c | setSyslog | PUT | /settings/remote_alert/log | OK |\n| | settings_remote_alert.c | setSmtpconfig | PUT | /settings/remote_alert/smtp | OK |\n| \u5a92\u4f53\u91cd\u5b9a\u5411 | settings_media_redirection.c | setVmediaConfig | PUT | /settings/media/instance | OK |\n| | settings_media_redirection.c | setMediaconfig | PUT | /settings/media/general | OK |\n| | settings_media_redirection.c | setRemoteSession | PUT | /settings/media/remotesession | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_media_redirection.c | deleteImage | DELETE | /settings/media/local/image | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_media_redirection.c | deleteRMediaCfg | DELETE | /settings/media/remote/configuration | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| \u7f51\u7edc\u8bbe\u7f6e | settings_dns.c | putDnsCfg | PUT | /settings/dns | OK |\n| | settings_dns.c | putDnsGenCfg | PUT | /settings/dns/general | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_dns.c | putDnsHostCfg | PUT | /settings/dns/host | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_dns.c | putDnsTSIGCfg | PUT | /settings/dns/tsig | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_dns.c | putDnsDomainCfg | PUT | /settings/dns/domain | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_dns.c | putDnsServerCfg | PUT | /settings/dns/server | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_dns.c | restartDNS | PUT | /settings/dns/restart | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_net_bond_configuration.c | setNetBondConfig | PUT | /settings/network-bond | OK |\n| | settings_network.c | setNetwork | PUT | /settings/network | OK |\n| | settings_ncsi_mode.c | setNCSIMode | PUT | /settings/ncsi/mode | OK |\n| \u670d\u52a1 | settings_services.c | setServices | PUT | /settings/services/([[:digit:]]+) | OK |\n| | settings_services.c | deleteSession | DELETE | /settings/service-sessions/([[:digit:]]+) | OK |\n| | settings_services.c | setRedfish | PUT | /settings/service/redfish | OK |\n| \u7528\u6237/\u7528\u6237\u7ec4 | settings_users.c | modifyUser | PUT | /settings/users/([[:digit:]]+) | OK |\n| | settings_users.c | setpasswordexpiry | PUT | /settings/setpasswordexpiry | OK |\n| | settings_users.c | updateGroupOfUser | PUT | /settings/update_user_belong_group | OK |\n| | settings_user_groups.c | modifyUserGroup | PUT | /settings/save_user_groups | OK |\n| | settings_users.c | deleteUser | DELETE | /settings/users/([[:digit:]]+) | OK\uff08\u63a5\u53e3\u53d8\u66f4\u4e3a/settings/delusers/([[:digit:]]+) \uff09 |\n| | settings_user_groups.c | deleteUserGroup | DELETE | /settings/del_user_groups | OK |\n| \u5b89\u5168\u8bbe\u7f6e | settings_ssl_upload_information.c | updateSslUploadInfo | PUT | /settings/ssl/certificate-info | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| \u65e5\u5fd7\u67e5\u8be2 | event_log.c | clearSEL | DELETE | /logs/event | OK |\n| | audit_log.c | clearAuditLog | DELETE | /logs/audit | OK\uff08\u63a5\u53e3\u53d8\u66f4\u4e3a/logs/cleanaudit\uff09 |\n| \u65e5\u5fd7\u8bbe\u7f6e | settings_log.c | setSettingsLogPolicy | PUT | /settings/log-policy | OK |\n| \u6545\u969c\u622a\u5c4f | server_configure/capture_screen.c | manualCaptureScreen | PUT | /settings/ManualScreen | OK |\n| | server_configure/capture_screen.c | viewOSCrashShot | PUT | /settings/viewOSCrash | OK |\n| \u670d\u52a1\u5668\u9ed1\u5323\u5b50 | maintenance_dump_blackinfo.c | dumpBMCBlackInfo | PUT | /maintenance/dump_bmc_blackinfo | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| \u7cfb\u7edf\u7ba1\u7406\u5458 | maintenance_system_admin.c | setSystemAdminConfig | PUT | /maintenance/system_admin | OK |\n| \u5907\u4efd/\u6062\u590d\u914d\u7f6e | maintenance_backup_configuration.c | setBackupConfig | PUT | /maintenance/backup_config | OK |\n| | maintenance_restore_configuration.c | setRestoreConfig | PUT | /maintenance/restore_defaults | OK |\n| \u56fa\u4ef6\u66f4\u65b0 | maintenance_fwupdate.c | putFlashMode | PUT | /maintenance/flash | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_fwupdate.c | putRedfishFlashMode | PUT | /maintenance/redfish | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_fwupdate.c | startFlash | PUT | /maintenance/firmware/upgrade | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_SASBPfwupdate.c | startSASBPFlash | PUT | /maintenance/SASBPupgrade | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_BIOSfwupdate.c | putBIOSFlashMode | PUT | /maintenance/BIOSflash | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_BIOSfwupdate.c | startBIOSFlash | PUT | /maintenance/BIOSupgrade | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_PSUfwupdate.c | startPSUFlash | PUT | /maintenance/PSUupgrade | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_CPLDfwupdate.c | startCPLDFlash | PUT | /maintenance/CPLDupgrade | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_preserve_configuration.c | setPreserveConfig | PUT | /maintenance/preserve | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_fwimage_location.c | setFWImageLocation | PUT | /maintenance/fwimage_location | OK |\n| | rest_default.c | logout_handler | DELETE | /session | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | rest_default.c | default_put_handler | PUT | | |\n| | rest_default.c | default_delete_handler | DELETE | | |\n| | | | | | |\n| \u6ce8\uff1a\u7ea2\u8272\u6807\u8bc6\u8868\u793a\u5df2\u7ecf\u4fee\u6539\u5b8c\u6210\u7684\u529f\u80fd\u63a5\u53e3 | | | | | |\n| | | | | | |\n| | | | | | |\n| | | | | | |\n| | | | | | |\n| \u672a\u4f7f\u7528\uff08\u518d\u6b21\u68c0\u67e5\u786e\u8ba4\uff09 | settings_video_triggers.c | setVideo | PUT | /settings/video/triggers | |\n| | settings_video_triggers.c | setPreEventRec | PUT | /settings/video/pre-event | |\n| | settings_video_remote_storage.c | setVideoRemoteStorage | PUT | /settings/video/remote-storage | |\n| | video_log.c | downloadVideo | PUT | /logs/video-log | |\n| | maintenance_hpm_fwupdate.c | putHPMUpdateMode | PUT | /maintenance/hpm/updatemode | |\n| | maintenance_hpm_fwupdate.c | putHPMExitUpdateMode | PUT | /maintenance/hpm/exitupdatemode | |\n| | maintenance_hpm_fwupdate.c | setHPMPrepareComponents | PUT | /maintenance/hpm/preparecomponents | |\n| | maintenance_hpm_fwupdate.c | putHPMStartFlashMode | PUT | /maintenance/hpm/flash | |\n| | maintenance_hpm_fwupdate.c | HPMVerifyImage | PUT | /maintenance/hpm/verifyimage | |\n| | maintenance_hpm_fwupdate.c | putActivateHPMComponents | PUT | /maintenance/hpm/activatecomponents | |\n| | sol_settings_video_remote_storage.c | setSolVideoRemoteStorage | PUT | /settings/video/sol-remote-storage | |\n| | sol_settings_video_triggers.c | solTriggerSetVideo | PUT | /settings/video/sol-triggers | |\n| | settings_firewall_ip_rule.c | setFirewallIPRule | PUT | /settings/firewall-ip-rules | |\n| | settings_firewall_port_rule.c | setFirewallPortRule | PUT | /settings/firewall-port-rules | |\n| | settings_pef_event_filter.c | modifyEventFilters | PUT | /settings/pef/event_filters/([[:digit:]]+) | |\n| | settings_pef_lan_destination.c | modifyLanDestinations | PUT | /settings/pef/lan_destinations/([[:digit:]]+) | |\n| | settings_pef_alert_policy.c | modifyAlertPolicies | PUT | /settings/pef/alert_policies/([[:digit:]]+) | |\n| | system_inventory.c | setSysInvInfo | PUT | /system_inventory/component_status_update | |\n| | automation_engine_tasks.c | updateTask | PUT | /tasks/([[:digit:]]+) | |\n| | automation_engine_tasks.c | runTask | PUT | /ae/run | |\n| | automation_engine_scripts.c | updateScript | PUT | /scripts/([[:digit:]]+) | |\n| | automation_engine_scripts.c | runScript | PUT | /ae_test | |\n| | maintenance_bmc_recovery.c | setBMCRecovery | PUT | /maintenance/bmc_recovery | |\n| | settings_smtp.c | setSmtp | PUT | /settings/smtp/([[:digit:]]+) | fail |\n| | settings_pam_order.c | setPamOrder | PUT | /settings/pam-order | |\n| | settings_firewall_port_rule.c | deleteFirewallPortRule | DELETE | /settings/firewall-port-rules/([[:digit:]]+) | |\n| | settings_firewall_ip_rule.c | deleteFirewallIPRule | DELETE | /settings/firewall-ip-rules/([[:digit:]]+) | |\n| | settings_firewall_configuration.c | deleteSettingsFirewall | DELETE | /settings/firewall/([[:digit:]]+) | |\n| | settings_pef_lan_destination.c | deleteLanDestinations | DELETE | /settings/pef/lan_destinations/([[:digit:]]+) | |\n| | settings_pef_alert_policy.c | deleteAlertPolicies | DELETE | /settings/pef/alert_policies/([[:digit:]]+) | |\n| | settings_pef_event_filter.c | deleteEventFilters | DELETE | /settings/pef/event_filters/([[:digit:]]+) | |\n| | automation_engine_tasks.c | deleteTask | DELETE | /tasks/([[:digit:]]+) | |\n| | automation_engine_scripts.c | deleteScript | DELETE | /scripts/([[:digit:]]+) | |\n| | video_log.c | deleteVideo | DELETE | /logs/video-log/delete | |\n| | sol_settings_video_remote_storage.c | delSolRecordedVideo | DELETE | /settings/sol-recorded-video | |\n| | settings_web_server_instances.c | setWebServerInstances | PUT | /settings/web_server_instances | |\n| | settings_log.c | setSettingsLog | PUT | /settings/log | |\n| | settings_snmp.c | setSNMPTrap | PUT | /settings/snmptrap | |\n| | settings_net_link_configuration.c | setNetLinkConfig | PUT | /settings/network-link | |\n| | settings_ncsi_interfaces.c | setNCSIInterfaces | PUT | /settings/ncsi-interfaces | |\n| | settings_ncsi_packages.c | setNCSIPackages | PUT | /settings/packages | |\n| | settings_ncsi_channel.c | setNCSIChannels | PUT | /settings/channels | |\n| | maintenance_fwimage_location.c | setRemoteImageInfo | PUT | /maintenance/fwimage/remote/info | |\n| | maintenance_nm_fwupdate.c | nmPutFwUpdate | PUT | /maintenance/nm_firmware_update | |\n| | maintenance_fwupdate.c | setDualImageCfg | PUT | /maintenance/dual_image_config | |\n| | maintenance_fwupdate.c | setFlashImageCfg | PUT | /maintenance/flash_image_config | |\n| | maintenance_fwupdate.c | dwldFWImage | PUT | /maintenance/firmware/dwldfwimg | |\n| | settings_raid_management.c | SetPhyDriveOnlineOffline | PUT | /settings/raid_management/physical_onlineoffline_cmd | |\n| | | | | | |\n\n\n\n# 3. \u8868\u5355\u8f93\u5165\u957f\u5ea6\u9650\u5236\uff08\u65b0\uff09\n\n[matis](http://10.0.100.36/view.php?id=35981)\n\nSVN: 63022 63194 63055\n\n| \u529f\u80fd\u6a21\u5757 | \u754c\u9762 | \u8868\u5355\u540d\u79f0 | \u5e2e\u52a9\u6216\u4ee3\u7801\u957f\u5ea6\u9650\u5236(L:\u957f\u5ea6) | \u9a8c\u8bc1\u524d\u7aef(L:\u957f\u5ea6) | \u5907\u6ce8 | \u89e3\u51b3\u529e\u6cd5 | \u9a8c\u8bc1 |\n| -------- | --------------------------------------- | ---------------------------- | ----------------------------- | ------------------------------- | ------------------------------------------------------------ | ------------------------------ | ---- |\n| \u767b\u5f55 | \u767b\u5f55 | \u7528\u6237\u540d | | \u65e0\u9650\u5236 | | | Pass |\n| | | \u5bc6\u7801 | | L<=20 | \u65e0\u9650\u5236 | | Fail |\n| \u7cfb\u7edf\u4fe1\u606f | \u4f20\u611f\u5668\u9608\u503c | \u9ad8\u4e0d\u53ef\u6062\u590d | | L<=10 | | | Pass |\n| | | \u9ad8\u4e34\u754c | | L<=10 | | | Pass |\n| | | \u9ad8\u975e\u4e34\u754c | | L<=10 | | | Pass |\n| | | \u4f4e\u975e\u4e34\u754c | | L<=10 | | | Pass |\n| | | \u4f4e\u4e34\u754c | | L<=10 | | | Pass |\n| | | \u4f4e\u4e0d\u53ef\u6062\u590d | | L<=10 | | | Pass |\n| | \u5b58\u50a8\u7cfb\u7edf-\u521b\u5efa\u865a\u62df\u8bbe\u5907 | \u903b\u8f91\u540d\u79f0 | L<=15 | L<=15 | | | Pass |\n| | | \u5bb9\u91cf (GB) | | \u65e0\u9650\u5236 | \u586b\u5199\u8fc7\u5927\u540e\u53f0\u65e0\u9519\u8bef\u8fd4\u56de\uff0c\u65e0\u6cd5\u521b\u5efa\u6210\u529f | | Pass |\n| | | \u5bbd\u5ea6\u6df1\u5ea6 | L<=3 | L<=3 | | | Pass |\n| | | \u6bcf\u4e2a\u9635\u5217\u5bbd\u5ea6\u5177\u6709\u7684\u786c\u76d8\u8bbe\u5907 | L<=2 | L<=2 | | | Pass |\n| \u8fdc\u7a0b\u63a7\u5236 | \u670d\u52a1\u5668\u5b9a\u4f4d | \u95ea\u70c1\u65f6\u95f4 | | L<=4 | | | Pass |\n| | \u7535\u6e90\u4e0e\u80fd\u8017-ME\u529f\u8017\u5c01\u9876 | \u5168\u5e73\u53f0\u529f\u8017\u9650\u5236-\u7b56\u7565\u6700\u5927\u503c | | L<=4 | | | Pass |\n| | | CPU\u529f\u8017\u9650\u5236-\u7b56\u7565\u6700\u5927\u503c | | L<=3 | | | Pass |\n| | | \u5185\u5b58\u529f\u8017\u9650\u5236-\u7b56\u7565\u6700\u5927\u503c | | L<=3 | \u65e0\u6b64\u529f\u80fd | | N/A |\n| | \u7535\u6e90\u4e0e\u80fd\u8017-\u7cfb\u7edf\u6389\u7535\u6062\u590d\u7b56\u7565 | \u9519\u5cf0\u4e0a\u7535\u65f6\u95f4 | | L<=3 | | | Pass |\n| | \u6563\u70ed\u7b56\u7565 | \u8bbe\u7f6e\u5f53\u524d\u6a21\u5f0f\u6700\u4f4e\u8f6c\u901f\u767e\u5206\u6bd4 | | L<=3 | | | Pass |\n| | | \u8bbe\u7f6e\u624b\u52a8\u8f6c\u901f\u767e\u5206\u6bd4 | | L<=3 | | | Pass |\n| BMC\u8bbe\u7f6e | \u65e5\u671f&\u65f6\u95f4 | \u4e3b NTP \u670d\u52a1\u5668 | | \u65e0\u9650\u5236 | | | Pass |\n| | | \u6b21 NTP \u670d\u52a1\u5668 | | \u65e0\u9650\u5236 | | | Pass |\n| | \u5916\u90e8\u7528\u6237\u670d\u52a1-\u4e00\u822c LDAP \u8bbe\u7f6e | \u670d\u52a1\u5668\u5730\u5740 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | \u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f | | Pass |\n| | | \u7aef\u53e3 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | | Bind DN | 4 - 64\u4f4d | 4 - 64\u4f4d | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | | \u5bc6\u7801 | L<=20 | L<=20 | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | | \u641c\u7d22\u5e93 | 4 - 64\u4f4d | 4 - 64\u4f4d | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | \u5916\u90e8\u7528\u6237\u670d\u52a1-LDAP\u89d2\u8272\u7ec4 | \u7fa4\u7ec4\u540d\u79f0 | L<=64 | L<=64 | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | | \u7fa4\u57df | L<=64 | L<=64 | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | \u5916\u90e8\u7528\u6237\u670d\u52a1-\u4e00\u822c Active Directory \u8bbe\u7f6e | \u7528\u6237\u540d | L<=64 | \u5b9e\u9645\u53ef\u4ee5\u586b\u519965\u4e2a\u5b57\u7b26 | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | | \u5bc6\u7801 | 6 - 127\u4f4d | 6 - 127\u4f4d | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | | \u7528\u6237\u57df\u540d | | \u65e0\u9650\u5236 | | | Pass |\n| | | \u7f51\u57df\u63a7\u5236\u5668\u670d\u52a1\u5668\u5730\u5740 1\u30012\u30013 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | | | |\n| | \u5916\u90e8\u7528\u6237\u670d\u52a1-\u4e00\u822c RADIUS \u8bbe\u7f6e | \u670d\u52a1\u5668\u5730\u5740 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f\u53ca\u57df\u540d | IPv4/IPv6 \u5730\u5740\u683c\u5f0f\u6216\u57df\u540dL<=72\u4f4d | \u586b\u5199\u8fc7\u957f\uff0c\u540e\u53f0\u62a5500\u9519\u8bef:www.w01234567890123insvr.org | \u957f\u5ea6\u9650\u5236256 | ok |\n| | | \u7aef\u53e3 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | | | |\n| | | \u5bc6\u94a5 | 4 - 32\u4f4d | 4 - 32\u4f4d | | | |\n| | \u5916\u90e8\u7528\u6237\u670d\u52a1-\u9ad8\u7ea7 RADIUS \u8bbe\u7f6e | \u7ba1\u7406\u5458 | L<=127 | L<=127 | | | |\n| | | \u64cd\u4f5c\u5458 | L<=127 | L<=127 | | | |\n| | | \u7528\u6237 | L<=127 | L<=127 | | | |\n| | | OEM \u6240\u6709\u6743 | L<=127 | L<=127 | | | |\n| | | \u65e0\u6cd5\u5b58\u53d6 | L<=127 | L<=127 | | | |\n| | \u544a\u8b66\u8bbe\u7f6e-SNMP Trap \u8bbe\u7f6e | \u56e2\u4f53\u540d | | \u65e0\u9650\u5236 | | | |\n| | | SNMP \u5730\u5740 | | IPv4 \u5730\u5740\u683c\u5f0f | | | |\n| | \u544a\u8b66\u8bbe\u7f6e-SMTP \u8bbe\u7f6e | \u670d\u52a1\u5668\u540d\u79f0 | L<=25 | L<=25 | | | |\n| | | \u670d\u52a1\u5668 IP | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | IPv4 \u5730\u5740\u683c\u5f0f | | \u5e2e\u52a9\u4fe1\u606f\u6539\u4e3aIPv4 \u5730\u5740\u683c\u5f0f | ok |\n| | | \u53d1\u4ef6\u4eba\u90ae\u7bb1\u5730\u5740 | L<=64 | L<=64 | | | |\n| | | \u53d1\u4ef6\u4eba\u90ae\u7bb1\u5bc6\u7801 | 4 - 64\u4f4d | 4 - 64\u4f4d | | | |\n| | | \u90ae\u4ef6\u4e3b\u9898 | | \u65e0\u9650\u5236 | \u586b\u5199\u8fc7\u957f\uff0c\u540e\u53f0\u62a5500\u9519\u8bef | | |\n| | | \u6536\u4ef6\u4eba\u90ae\u7bb1\u4fe1\u606f-\u90ae\u7bb1 | | \u65e0\u9650\u5236 | | | |\n| | | \u6536\u4ef6\u4eba\u90ae\u7bb1\u4fe1\u606f-\u63cf\u8ff0 | | \u65e0\u9650\u5236 | | | |\n| | \u544a\u8b66\u8bbe\u7f6e-Syslog \u8bbe\u7f6e | \u8fdc\u7a0b\u65e5\u5fd7\u670d\u52a1\u5668 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f\u53ca\u57df\u540d | \u65e0\u9650\u5236 | \u586b\u5199\u8fc7\u957f\uff0c\u540e\u53f0\u62a5500\u9519\u8bef | IPv4/IPv6 \u5730\u5740\u683c\u5f0f\u53ca\u57df\u540d | ok |\n| | | \u8fdc\u7a0b\u670d\u52a1\u5668\u7aef\u53e3 | | \u65e0\u9650\u5236 | | \u503c\u8303\u56f4\uff081 - 65535\uff09 | ok |\n| | \u5a92\u4f53\u91cd\u5b9a\u5411-\u529f\u80fd\u8bbe\u7f6e | CD/DVD \u955c\u50cf\u7684\u670d\u52a1\u5668\u5730\u5740 | \u670d\u52a1\u5668 IP \u6216 Host \u540d\u79f0 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | | placeholder\u4fe1\u606f\u6539\u4e3a\u670d\u52a1\u5668 IP | ok |\n| | | \u7f51\u57df\u540d\u79f0 | | \u65e0\u9650\u5236 | | | |\n| | | \u7528\u6237 | | \u65e0\u9650\u5236 | | \u957f\u5ea6\u9650\u5236256 | ok |\n| | | \u5bc6\u7801 | | \u65e0\u9650\u5236 | | \u957f\u5ea6\u9650\u523632 | ok |\n| | | \u8f6f\u76d8\u955c\u50cf\u7684\u670d\u52a1\u5668\u5730\u5740 | \u670d\u52a1\u5668 IP \u6216 Host \u540d\u79f0 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | | placeholder\u4fe1\u606f\u6539\u4e3a\u670d\u52a1\u5668 IP | ok |\n| | | \u670d\u52a1\u5668\u4e2d\u7684\u8def\u5f84 | | \u65e0\u9650\u5236 | | | |\n| | | \u7f51\u57df\u540d\u79f0 | | \u65e0\u9650\u5236 | | | |\n| | | \u7528\u6237 | | \u65e0\u9650\u5236 | | \u957f\u5ea6\u9650\u5236256 | ok |\n| | | \u5bc6\u7801 | | \u65e0\u9650\u5236 | | \u957f\u5ea6\u9650\u523632 | ok |\n| | | \u786c\u76d8\u955c\u50cf\u7684\u670d\u52a1\u5668\u5730\u5740 | \u670d\u52a1\u5668 IP \u6216 Host \u540d\u79f0 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | | placeholder\u4fe1\u606f\u6539\u4e3a\u670d\u52a1\u5668 IP | ok |\n| | | \u670d\u52a1\u5668\u4e2d\u7684\u8def\u5f84 | | \u65e0\u9650\u5236 | | | |\n| | | \u7f51\u57df\u540d\u79f0 | | \u65e0\u9650\u5236 | | | |\n| | | \u7528\u6237 | | \u65e0\u9650\u5236 | | \u957f\u5ea6\u9650\u5236256 | ok |\n| | | \u5bc6\u7801 | | \u65e0\u9650\u5236 | | \u957f\u5ea6\u9650\u523632 | ok |\n| | \u7f51\u7edc\u8bbe\u7f6e-\u7f51\u7edc IP \u8bbe\u7f6e | IPv4 \u5730\u5740 | IPv4 \u5730\u5740\u683c\u5f0f | IPv4 \u5730\u5740\u683c\u5f0f | | | |\n| | | IPv4 \u9ed8\u8ba4\u7f51\u5173 | IPv4 \u5730\u5740\u683c\u5f0f | IPv4 \u5730\u5740\u683c\u5f0f | | | |\n| | | IPv6 \u5730\u5740 | IPv6 \u5730\u5740\u683c\u5f0f | IPv6 \u5730\u5740\u683c\u5f0f | | | |\n| | | \u5b50\u7f51\u63a9\u7801\u524d\u7f00\u957f\u5ea6 | IPv6 \u5730\u5740\u683c\u5f0f | IPv6 \u5730\u5740\u683c\u5f0f | | | |\n| | | VLAN ID | \u503c\u8303\u56f4\uff081 - 4094\uff09 | \u503c\u8303\u56f4\uff081 - 4094\uff09 | | | |\n| | | VLAN \u4f18\u5148\u6743 | \u503c\u8303\u56f4\uff081 - 7\uff09 | \u503c\u8303\u56f4\uff081 - 7\uff09 | | | |\n| | \u7f51\u7edc\u8bbe\u7f6e-DNS \u914d\u7f6e | \u4e3b\u673a\u540d\u79f0 | | L<=64 | | | |\n| | | DNS \u670d\u52a1\u5668 1\u30012\u30013 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | | | |\n| | \u670d\u52a1-\u914d\u7f6e\u670d\u52a1 | \u4e0d\u5b89\u5168\u7aef\u53e3 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | | | |\n| | | \u5b89\u5168\u7aef\u53e3 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | | | |\n| | | \u8d85\u65f6 | \u503c\u8303\u56f4\uff08300-1800 or 60-1800\uff09 | \u503c\u8303\u56f4\uff08300-1800 or 60-1800\uff09 | | | |\n| | \u7528\u6237/\u7528\u6237\u7ec4-\u7f16\u8f91\u7528\u6237 | \u7528\u6237\u540d | 1-16\u4f4d | \u65e0\u9650\u5236 | | | |\n| | | \u5bc6\u7801 | \uff088-16\u4f4d or 8-20\u4f4d\uff09 | \uff088-16\u4f4d or 8-20\u4f4d\uff09 | | | |\n| | | \u786e\u8ba4\u5bc6\u7801 | \uff088-16\u4f4d or 8-20\u4f4d\uff09 | \uff088-16\u4f4d or 8-20\u4f4d\uff09 | | | |\n| | \u5b89\u5168\u8bbe\u7f6e-SNMP V1/V2 \u8bbe\u7f6e | \u8bfb\u5199\u56e2\u4f53\u540d | | \u65e0\u9650\u5236 | | | |\n| | | \u53ea\u8bfb\u56e2\u4f53\u540d | | \u65e0\u9650\u5236 | | | |\n| | \u5b89\u5168\u8bbe\u7f6e-\u751f\u6210SSL\u8bc1\u4e66 | \u901a\u7528\u540d\u79f0(CN) | L<=64 | L<=64 | | | |\n| | | \u7ec4\u7ec7 (O) | L<=64 | L<=64 | | | |\n| | | \u7ec4\u7ec7\u5355\u4f4d (OU) | L<=64 | L<=64 | | | |\n| | | \u57ce\u5e02\u6216\u5730\u70b9 (L) | L<=64 | L<=128 | | | |\n| | | \u5dde\u6216\u7701 (ST) | L<=128 | L<=128 | | | |\n| | | \u56fd\u5bb6 (C) | L<=2 | L<=2 | | | |\n| | | \u7535\u5b50\u90ae\u4ef6\u5730\u5740 | \u65e0\u9650\u5236 | \u65e0\u9650\u5236 | | | |\n| | | \u6709\u6548\u81ea | \u503c\u8303\u56f4\uff081 - 3650\uff09 | \u503c\u8303\u56f4\uff081 - 3650\uff09 | | | |\n| | \u5b89\u5168\u8bbe\u7f6e-\u7528\u6237\u5bc6\u7801\u9501\u5b9a\u8bbe\u7f6e | \u5bc6\u7801\u9608\u503c | \u503c\u8303\u56f4\uff080 - 255\uff09 | \u503c\u8303\u56f4\uff080 - 255\uff09 | | | |\n| | | \u7528\u6237\u9501\u5b9a\u65f6\u95f4(\u79d2) | \u503c\u8303\u56f4\uff080 - 65535\uff09 | \u503c\u8303\u56f4\uff080 - 65535\uff09 | | | |\n| \u7cfb\u7edf\u7ef4\u62a4 | \u7cfb\u7edf\u7ba1\u7406\u5458 | \u5bc6\u7801 | \uff088-64\u4f4d\uff09 | \uff088-64\u4f4d\uff09 | | | |\n| | | \u786e\u8ba4\u5bc6\u7801 | \uff088-64\u4f4d\uff09 | \uff088-64\u4f4d\uff09 | | | |\n| | \u56fa\u4ef6\u66f4\u65b0-\u56fa\u4ef6\u955c\u50cf\u4f4d\u7f6e | TFTP \u670d\u52a1\u5668\u5730\u5740 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | \u65e0\u9650\u5236 | | \u4ee3\u7801\u4fee\u6539\u9650\u5236IPv4/IPv6 \u5730\u5740\u683c\u5f0f | ok |\n| | | TFTP \u955c\u50cf\u540d\u79f0 | | \u65e0\u9650\u5236 | | | |\n| | | TFTP \u91cd\u8bd5\u6b21\u6570 | \u503c\u8303\u56f4\uff080 - 255\uff09 | \u503c\u8303\u56f4\uff080 - 255\uff09 | | | |\n\n# 4. \u3010ID1015371\u3011\u56fd\u7f51\u9700\u6c42\uff1a\u9875\u9762\u4e2d\u9700\u8981\u5bf9\u4f20\u8f93\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u7b49\u654f\u611f\u4fe1\u606f\u8fdb\u884c\u52a0\u5bc6\u540e\u4f20\u8f93\uff0c\u5bf9\u7cfb\u7edf\u5185\u6240\u6709\u6d89\u53ca\u5230\u5bc6\u7801\u4f20\u8f93\u5730\u65b9\u505a\u52a0\u5bc6\u5904\u7406\u3002\u4e0d\u8981\u4f7f\u7528MD5\u7b49\u6613\u88ab\u7834\u89e3\u7684\u52a0\u5bc6\u65b9\u5f0f\u548c\u4e0d\u8981\u4f7f\u7528Base64\u7f16\u7801\u3001URL\u7f16\u7801\u7b49\u65b9\u5f0f\u89e3\u51b3\u6b64\u7c7b\u95ee\u9898\u3002\n\n\n\n\uff081\uff09\u521b\u5efa\u7528\u6237\u65f6\uff0c\u76ee\u524d\u4ec5\u52a0\u5bc6\u4e86\u7528\u6237\u5bc6\u7801\uff0c\u8fd8\u6ca1\u6709\u52a0\u5bc6\u7528\u6237\u540d\uff1b\n\n\uff082\uff09\u56e0\u4e3a\u7528\u6237\u5f52\u5c5e\u5728\u76f8\u5e94\u7684\u7528\u6237\u7ec4\u4e2d\u3002\u5728\u83b7\u53d6\u7528\u6237\u7ec4\u4e2d\u7684\u7528\u6237\u4fe1\u606f\u65f6\uff0c\u4e5f\u6ca1\u6709\u52a0\u5bc6\u7528\u6237\u540d\uff1b\n\n\uff083\uff09\u9488\u5bf9\u7cfb\u7edf\u7ba1\u7406\u5458\uff0c\u83b7\u53d6/\u8bbe\u7f6e\u4fe1\u606f\u65f6\uff0c\u7528\u6237\u540d\u90fd\u662f\u660e\u6587\u4f20\u9012\uff1b\u5728\u4fee\u6539\u5bc6\u7801\u65f6\uff0c\u5bc6\u7801\u4e5f\u662f\u91c7\u7528\u660e\u6587\u4f20\u9012\u3002\n\n\u989d\u5916\u6dfb\u52a0\u5982\u4e0b\u529f\u80fd\uff1a\n\n\uff084\uff09Audit LOG\u4fe1\u606f\u4e2d\u4e5f\u5305\u542b\u91c7\u7528\u660e\u6587\u8868\u793a\u7684\u7528\u6237\u540d\uff1b\n\n\uff085\uff09\u5916\u90e8\u7528\u6237\u754c\u9762\u5305\u542b\u4e86\u91c7\u7528\u660e\u6587\u8868\u793a\u7684\u7528\u6237\u540d\u7b49\u4fe1\u606f\uff1b\n\n\uff086\uff09\u83b7\u53d6SNMPv3\u7528\u6237\u4fe1\u606f\u65f6\uff0c\u8fd4\u56de\u4e86\u91c7\u7528\u660e\u6587\u8868\u793a\u7684\u7528\u6237\u540d\uff1b\n\n\uff087\uff09\u8bbe\u7f6eSMTP\u4fe1\u606f\u65f6\uff0c\u4f1a\u4f20\u9012\u660e\u6587\u7684\u7528\u6237email\u5bc6\u7801\uff1b\n\n\uff088\uff09\u8bbe\u7f6e\u5bc6\u7801\u6709\u6548\u671f\u548c\u83b7\u53d6\u5bc6\u7801\u6709\u6548\u671f\u4e5f\u4f7f\u7528\u4e86\u660e\u6587\u7528\u6237\u540d\uff1b\n\n\uff089\uff09\u4f7f\u7528cifs\u65b9\u5f0f\u6302\u8f7d\u8fdc\u7a0b\u5a92\u4f53\u65f6\u4f7f\u7528\u4e86\u660e\u6587\u8868\u793a\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff1b\n\n\u6d4b\u8bd5\u53d1\u73b0\u6709\u4e9b\u64cd\u4f5c\u8bb0\u5f55Audit\u65e5\u5fd7\u65f6\u4f7f\u7528\u4e86\u660e\u6587\u7528\u6237\u540d\uff0c\u9700\u8981\u4fee\u6b63\u3002\n\n\n\n# 5 \u907f\u514d\u4f1a\u8bdd\u91cd\u653e\u653b\u51fb\n\n\u57fa\u7840\u4ee3\u7801\u672a\u5b9e\u73b0",
"original": true,
"orginal_link": null,
"public": false,
"browse_num": 20,
"user": 1,
"add_time": "2020-04-10T09:17:50Z",
"modified_time": "2020-04-23T07:47:06.969Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 14,
"fields": {
"note": 1,
"title": "lodash v4.17.15",
"text_content": "# lodash v4.17.15\r\n\r\nThe [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules.\r\n\r\n## Installation\r\n\r\nUsing npm:\r\n\r\n```shell\r\n$ npm i -g npm\r\n$ npm i --save lodash\r\n```\r\n\r\nIn Node.js:\r\n\r\n```js\r\n// Load the full build.\r\nvar _ = require('lodash');\r\n// Load the core build.\r\nvar _ = require('lodash/core');\r\n// Load the FP build for immutable auto-curried iteratee-first data-last methods.\r\nvar fp = require('lodash/fp');\r\n\r\n// Load method categories.\r\nvar array = require('lodash/array');\r\nvar object = require('lodash/fp/object');\r\n\r\n// Cherry-pick methods for smaller browserify/rollup/webpack bundles.\r\nvar at = require('lodash/at');\r\nvar curryN = require('lodash/fp/curryN');\r\n```\r\n\r\nSee the [package source](https://github.com/lodash/lodash/tree/4.17.15-npm) for more details.\r\n\r\n**Note:**<br>\r\nInstall [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL.\r\n\r\n## Support\r\n\r\nTested in Chrome 74-75, Firefox 66-67, IE 11, Edge 18, Safari 11-12, & Node.js 8-12.<br>\r\nAutomated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available.",
"original": true,
"orginal_link": "http://127.0.0.1:9200/admin/articals/articale/",
"public": true,
"browse_num": 38,
"user": 1,
"add_time": "2020-04-10T11:01:53Z",
"modified_time": "2020-04-22T12:38:12.452Z",
"types": [
10,
11
]
}
},
{
"model": "articals.articale",
"pk": 15,
"fields": {
"note": 1,
"title": "\u56fd\u7f51\u5b89\u5168\u68c0\u67e5",
"text_content": "# 1. \u6587\u4ef6\u5b89\u5168\u6027\u68c0\u67e5\n\n\n\n\n\n| \u529f\u80fd | \u4f18\u5148\u7ea7 | \u6587\u4ef6\u6269\u5c55\u540d | \u6587\u4ef6\u6700\u5927\u5b57\u8282\u6570 | \u68c0\u67e5\u65b9\u6cd5 | \u5907\u6ce8 |\n| ---------------------------- | ------ | ---------- | -------------- | ------------------------------------------------------------ | ---- |\n| \u4e0a\u4f20SSL\u8bc1\u4e66 | \u9ad8 | pem | 8K | \u4f7f\u7528SSL\u81ea\u8eab\u7684\u9a8c\u8bc1\u65b9\u5f0f | |\n| \u6062\u590d\u914d\u7f6e | \u9ad8 | bak | 16K | \u6587\u4ef6\u5185\u5bb9\u68c0\u67e5\uff0c\u53ea\u80fd\u4f7f\u7528\u901a\u8fc7\u5907\u4efd\u914d\u7f6e\u4ea7\u751f\u7684bak\u6587\u4ef6 | |\n| BMC\u56fa\u4ef6\u66f4\u65b0 | \u9ad8 | ima | 32M | | |\n| BIOS\u56fa\u4ef6\u66f4\u65b0 | \u9ad8 | bin | 32M | | |\n| \u7f16\u8f91\u7528\u6237\u65f6\u4e0a\u4f20SSH\u5bc6\u94a5 | \u9ad8 | pub | 8K | \u5bf9\u6587\u4ef6\u4e2d\u5185\u5bb9\u8fdb\u884c\u68c0\u67e5\uff0c\u53d1\u73b0\u4e0d\u7b26\u5408\u9879\u65f6\u8fd4\u56de\u9519\u8bef\u503c | |\n| \u4f7f\u7528LDAP\u4e0b\u7684StartTSL\u52a0\u5bc6\u7c7b\u578b | \u4f4e | | | | |\n| `CPLD\u56fa\u4ef6\u66f4\u65b0` | \u4f4e | jed\u3001pof | 4M | | |\n| PSU\u56fa\u4ef6\u66f4\u65b0 | \u4f4e | hex | 256K | \u6587\u4ef6\u4e2d\u7684\u6bcf\u4e00\u884c\u5185\u5bb9\u90fd\u4ee5:\u5f00\u59cb | |\n| \u80cc\u677f\u56fa\u4ef6\u66f4\u65b0 | \u4f4e | bin | 960K | \u9488\u5bf9\u6587\u4ef6\u4e2d\u7684\u6570\u636e\u6309\u7167dword\u5927\u5c0f\u8ba1\u7b97Checksum\uff0c\u5f97\u5230\u7684Checksum\u5e94\u8be5\u4e3a0 | |\n| DNS\u914d\u7f6e | \u4f4e | | | | |\n| | | | | | |\n\n\u9488\u5bf9\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd\uff0c\u9700\u8981\u524d\u7aef\u7edf\u4e00\u5b9e\u73b0\uff1a\n\n\u5728\u5e2e\u52a9\u4fe1\u606f\u4e2d\u63cf\u8ff0\u5982\u4e0b\u4fe1\u606f\uff1a\n\n\u6587\u4ef6\u7684\u6269\u5c55\u540d\u7c7b\u578b\uff0c\u4f8b\u5982\u4e0a\u4f20SSL\u9875\u9762\n\n\u6587\u4ef6\u7684\u6700\u5927\u5b57\u8282\u6570\uff0c\u4f8b\u5982\u4e0a\u4f20SSL\u9875\u9762\n\n\u5bf9\u5728\u6587\u672c\u6846\u8f93\u5165\u7684\u6587\u4ef6\u540d\u8fdb\u884c\u68c0\u67e5\uff0c\u4f8b\u5982\u4e0a\u4f20SSL\u9875\u9762\u548c\u4e0a\u4f20SSH\u9875\u9762\n\n\u540e\u7aef\u4e5f\u9700\u8981\u6dfb\u52a0\u5bf9\u6587\u4ef6\u6269\u5c55\u540d\u3001\u6587\u4ef6\u5927\u5c0f\u7684\u68c0\u67e5\u3002\n\n\n\n\n\n# 2. \u56fd\u7f51\u9700\u6c42\uff1a\u7cfb\u7edf\u542f\u7528\u4e86\u4e0d\u5b89\u5168\u7684HTTP\u8bf7\u6c42\u65b9\u6cd5\uff0c\u8981\u6c42\u5173\u95ed\u9664\u4e86POST\u548cGET\u4e4b\u5916\u7684\u6240\u6709\u65b9\u6cd5\u3002\n\n| Web\u9875\u9762 | \u6587\u4ef6 | \u8c03\u7528\u51fd\u6570 | rest\u8c03\u7528\u65b9\u6cd5 | \u63a5\u53e3 | BMC\u5f00\u53d1\u72b6\u6001 |\n| -------------------------------------- | ------------------------------------ | ---------------------------------------- | ------------ | --------------------------------------------------------- | -------------------------------------------------------- |\n| \u4f20\u611f\u5668\u4fe1\u606f | settings_sensor_threshold.c | SetSensorThreshold | PUT | /settings/sensor-threshold | OK |\n| \u5b58\u50a8\u7cfb\u7edf | settings_raid_management.c | SetPhysicalRemovalCmd | PUT | /settings/raid_management/physical_removal_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | SetPhysicalManageHotSpare | PUT | /settings/raid_management/physical_hotspare_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | getRAIDLevelStripSize | PUT | /settings/raid_management/raid_levels | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | getRAIDLevelPDCount | PUT | /settings/raid_management/raid_pd_count | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | SetPhysicalManageDedicateHotSpare | PUT | /settings/raid_management/physical_dedicated_hotspare_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | SetPhysicalManageStartStopLocate | PUT | /settings/raid_management/physical_start_stop_locate_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | SetLogicalManageStartStopLocate | PUT | /settings/raid_management/logical_start_stop_locate_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | SetLogicalConsistencyCheck | PUT | /settings/raid_management/logical_consistency_check_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | SetLogicalDriveInitializationStartCancel | PUT | /settings/raid_management/logical_initialize_check_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | GettLogicalDeviceProgress | PUT | /settings/raid_management/logical_device_progress_cmd | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | ClearRAIDEventLogs | DELETE | /settings/raid_management/raid_event_log | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_raid_management.c | DeleteVirtualDrive | DELETE | /settings/raid_management/delete_virtual_drive | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| \u63a7\u5236\u53f0\u91cd\u5b9a\u5411 | settings_kvm_mousemode.c | setMouseMode | PUT | /settings/mouse | OK |\n| \u7535\u6e90\u4e0e\u80fd\u8017 | server_configure/me_power_policy.c | setmePolicy | PUT | /s_me_policy/([[:digit:]]+) | OK |\n| | server_configure/power_hot_standby.c | setPowerModeConfig | PUT | /server_configuration/set_power_status | OK |\n| \u65e5\u671f&\u65f6\u95f4 | settings_ntp_configuration.c | putNtpCfg | PUT | /settings/date-time | OK |\n| \u5916\u90e8\u7528\u6237\u670d\u52a1 | settings_ldap.c | setLdap | PUT | /settings/ldap-settings | OK |\n| | settings_ldap_users.c | deleteLDAPUsers | DELETE | /settings/ldap-users/([[:digit:]]+) | /settings/ldap-users-del |\n| | settings_ldap_users.c | modifyLDAPUsers | PUT | /settings/ldap-users/([[:digit:]]+) | |\n| | settings_active_directory.c | setActDir | PUT | /settings/active-directory-settings | OK |\n| | settings_active_directory_users.c | modifyActDirUsers | PUT | /settings/active-directory-users/([[:digit:]]+) | |\n| | settings_active_directory_users.c | deleteActDirUsers | DELETE | /settings/active-directory-users/([[:digit:]]+) | /settings/active-directory-users-del/ |\n| | settings_radius.c | setRadiusConfig | PUT | /settings/radius/general | OK |\n| \u544a\u8b66\u8bbe\u7f6e | settings_remote_alert.c | setSNMPTrap | PUT | /settings/remote_alert/snmptrap | OK |\n| | settings_remote_alert.c | setSyslog | PUT | /settings/remote_alert/log | OK |\n| | settings_remote_alert.c | setSmtpconfig | PUT | /settings/remote_alert/smtp | OK |\n| \u5a92\u4f53\u91cd\u5b9a\u5411 | settings_media_redirection.c | setVmediaConfig | PUT | /settings/media/instance | OK |\n| | settings_media_redirection.c | setMediaconfig | PUT | /settings/media/general | OK |\n| | settings_media_redirection.c | setRemoteSession | PUT | /settings/media/remotesession | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_media_redirection.c | deleteImage | DELETE | /settings/media/local/image | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_media_redirection.c | deleteRMediaCfg | DELETE | /settings/media/remote/configuration | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| \u7f51\u7edc\u8bbe\u7f6e | settings_dns.c | putDnsCfg | PUT | /settings/dns | OK |\n| | settings_dns.c | putDnsGenCfg | PUT | /settings/dns/general | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_dns.c | putDnsHostCfg | PUT | /settings/dns/host | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_dns.c | putDnsTSIGCfg | PUT | /settings/dns/tsig | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_dns.c | putDnsDomainCfg | PUT | /settings/dns/domain | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_dns.c | putDnsServerCfg | PUT | /settings/dns/server | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_dns.c | restartDNS | PUT | /settings/dns/restart | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| | settings_net_bond_configuration.c | setNetBondConfig | PUT | /settings/network-bond | OK |\n| | settings_network.c | setNetwork | PUT | /settings/network | OK |\n| | settings_ncsi_mode.c | setNCSIMode | PUT | /settings/ncsi/mode | OK |\n| \u670d\u52a1 | settings_services.c | setServices | PUT | /settings/services/([[:digit:]]+) | OK |\n| | settings_services.c | deleteSession | DELETE | /settings/service-sessions/([[:digit:]]+) | OK |\n| | settings_services.c | setRedfish | PUT | /settings/service/redfish | OK |\n| \u7528\u6237/\u7528\u6237\u7ec4 | settings_users.c | modifyUser | PUT | /settings/users/([[:digit:]]+) | OK |\n| | settings_users.c | setpasswordexpiry | PUT | /settings/setpasswordexpiry | OK |\n| | settings_users.c | updateGroupOfUser | PUT | /settings/update_user_belong_group | OK |\n| | settings_user_groups.c | modifyUserGroup | PUT | /settings/save_user_groups | OK |\n| | settings_users.c | deleteUser | DELETE | /settings/users/([[:digit:]]+) | OK\uff08\u63a5\u53e3\u53d8\u66f4\u4e3a/settings/delusers/([[:digit:]]+) \uff09 |\n| | settings_user_groups.c | deleteUserGroup | DELETE | /settings/del_user_groups | OK |\n| \u5b89\u5168\u8bbe\u7f6e | settings_ssl_upload_information.c | updateSslUploadInfo | PUT | /settings/ssl/certificate-info | \u4e0d\u5177\u5907\u6761\u4ef6\u9a8c\u8bc1\uff0c\u8bf7SIT\u534f\u52a9\u9a8c\u8bc1 |\n| \u65e5\u5fd7\u67e5\u8be2 | event_log.c | clearSEL | DELETE | /logs/event | OK |\n| | audit_log.c | clearAuditLog | DELETE | /logs/audit | OK\uff08\u63a5\u53e3\u53d8\u66f4\u4e3a/logs/cleanaudit\uff09 |\n| \u65e5\u5fd7\u8bbe\u7f6e | settings_log.c | setSettingsLogPolicy | PUT | /settings/log-policy | OK |\n| \u6545\u969c\u622a\u5c4f | server_configure/capture_screen.c | manualCaptureScreen | PUT | /settings/ManualScreen | OK |\n| | server_configure/capture_screen.c | viewOSCrashShot | PUT | /settings/viewOSCrash | OK |\n| \u670d\u52a1\u5668\u9ed1\u5323\u5b50 | maintenance_dump_blackinfo.c | dumpBMCBlackInfo | PUT | /maintenance/dump_bmc_blackinfo | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| \u7cfb\u7edf\u7ba1\u7406\u5458 | maintenance_system_admin.c | setSystemAdminConfig | PUT | /maintenance/system_admin | OK |\n| \u5907\u4efd/\u6062\u590d\u914d\u7f6e | maintenance_backup_configuration.c | setBackupConfig | PUT | /maintenance/backup_config | OK |\n| | maintenance_restore_configuration.c | setRestoreConfig | PUT | /maintenance/restore_defaults | OK |\n| \u56fa\u4ef6\u66f4\u65b0 | maintenance_fwupdate.c | putFlashMode | PUT | /maintenance/flash | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_fwupdate.c | putRedfishFlashMode | PUT | /maintenance/redfish | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_fwupdate.c | startFlash | PUT | /maintenance/firmware/upgrade | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_SASBPfwupdate.c | startSASBPFlash | PUT | /maintenance/SASBPupgrade | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_BIOSfwupdate.c | putBIOSFlashMode | PUT | /maintenance/BIOSflash | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_BIOSfwupdate.c | startBIOSFlash | PUT | /maintenance/BIOSupgrade | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_PSUfwupdate.c | startPSUFlash | PUT | /maintenance/PSUupgrade | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_CPLDfwupdate.c | startCPLDFlash | PUT | /maintenance/CPLDupgrade | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_preserve_configuration.c | setPreserveConfig | PUT | /maintenance/preserve | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | maintenance_fwimage_location.c | setFWImageLocation | PUT | /maintenance/fwimage_location | OK |\n| | rest_default.c | logout_handler | DELETE | /session | \u4fdd\u7559\u539f\u6709\u63a5\u53e3\uff0c\u4ee5\u4fbf\u652f\u6301\u5f53\u524d\u81ea\u52a8\u5316\u811a\u672c\uff1b\u5728\u5b9a\u5236\u5316\u9879\u76ee\u4e2d\u4fee\u6539 |\n| | rest_default.c | default_put_handler | PUT | | |\n| | rest_default.c | default_delete_handler | DELETE | | |\n| | | | | | |\n| \u6ce8\uff1a\u7ea2\u8272\u6807\u8bc6\u8868\u793a\u5df2\u7ecf\u4fee\u6539\u5b8c\u6210\u7684\u529f\u80fd\u63a5\u53e3 | | | | | |\n| | | | | | |\n| | | | | | |\n| | | | | | |\n| | | | | | |\n| \u672a\u4f7f\u7528\uff08\u518d\u6b21\u68c0\u67e5\u786e\u8ba4\uff09 | settings_video_triggers.c | setVideo | PUT | /settings/video/triggers | |\n| | settings_video_triggers.c | setPreEventRec | PUT | /settings/video/pre-event | |\n| | settings_video_remote_storage.c | setVideoRemoteStorage | PUT | /settings/video/remote-storage | |\n| | video_log.c | downloadVideo | PUT | /logs/video-log | |\n| | maintenance_hpm_fwupdate.c | putHPMUpdateMode | PUT | /maintenance/hpm/updatemode | |\n| | maintenance_hpm_fwupdate.c | putHPMExitUpdateMode | PUT | /maintenance/hpm/exitupdatemode | |\n| | maintenance_hpm_fwupdate.c | setHPMPrepareComponents | PUT | /maintenance/hpm/preparecomponents | |\n| | maintenance_hpm_fwupdate.c | putHPMStartFlashMode | PUT | /maintenance/hpm/flash | |\n| | maintenance_hpm_fwupdate.c | HPMVerifyImage | PUT | /maintenance/hpm/verifyimage | |\n| | maintenance_hpm_fwupdate.c | putActivateHPMComponents | PUT | /maintenance/hpm/activatecomponents | |\n| | sol_settings_video_remote_storage.c | setSolVideoRemoteStorage | PUT | /settings/video/sol-remote-storage | |\n| | sol_settings_video_triggers.c | solTriggerSetVideo | PUT | /settings/video/sol-triggers | |\n| | settings_firewall_ip_rule.c | setFirewallIPRule | PUT | /settings/firewall-ip-rules | |\n| | settings_firewall_port_rule.c | setFirewallPortRule | PUT | /settings/firewall-port-rules | |\n| | settings_pef_event_filter.c | modifyEventFilters | PUT | /settings/pef/event_filters/([[:digit:]]+) | |\n| | settings_pef_lan_destination.c | modifyLanDestinations | PUT | /settings/pef/lan_destinations/([[:digit:]]+) | |\n| | settings_pef_alert_policy.c | modifyAlertPolicies | PUT | /settings/pef/alert_policies/([[:digit:]]+) | |\n| | system_inventory.c | setSysInvInfo | PUT | /system_inventory/component_status_update | |\n| | automation_engine_tasks.c | updateTask | PUT | /tasks/([[:digit:]]+) | |\n| | automation_engine_tasks.c | runTask | PUT | /ae/run | |\n| | automation_engine_scripts.c | updateScript | PUT | /scripts/([[:digit:]]+) | |\n| | automation_engine_scripts.c | runScript | PUT | /ae_test | |\n| | maintenance_bmc_recovery.c | setBMCRecovery | PUT | /maintenance/bmc_recovery | |\n| | settings_smtp.c | setSmtp | PUT | /settings/smtp/([[:digit:]]+) | fail |\n| | settings_pam_order.c | setPamOrder | PUT | /settings/pam-order | |\n| | settings_firewall_port_rule.c | deleteFirewallPortRule | DELETE | /settings/firewall-port-rules/([[:digit:]]+) | |\n| | settings_firewall_ip_rule.c | deleteFirewallIPRule | DELETE | /settings/firewall-ip-rules/([[:digit:]]+) | |\n| | settings_firewall_configuration.c | deleteSettingsFirewall | DELETE | /settings/firewall/([[:digit:]]+) | |\n| | settings_pef_lan_destination.c | deleteLanDestinations | DELETE | /settings/pef/lan_destinations/([[:digit:]]+) | |\n| | settings_pef_alert_policy.c | deleteAlertPolicies | DELETE | /settings/pef/alert_policies/([[:digit:]]+) | |\n| | settings_pef_event_filter.c | deleteEventFilters | DELETE | /settings/pef/event_filters/([[:digit:]]+) | |\n| | automation_engine_tasks.c | deleteTask | DELETE | /tasks/([[:digit:]]+) | |\n| | automation_engine_scripts.c | deleteScript | DELETE | /scripts/([[:digit:]]+) | |\n| | video_log.c | deleteVideo | DELETE | /logs/video-log/delete | |\n| | sol_settings_video_remote_storage.c | delSolRecordedVideo | DELETE | /settings/sol-recorded-video | |\n| | settings_web_server_instances.c | setWebServerInstances | PUT | /settings/web_server_instances | |\n| | settings_log.c | setSettingsLog | PUT | /settings/log | |\n| | settings_snmp.c | setSNMPTrap | PUT | /settings/snmptrap | |\n| | settings_net_link_configuration.c | setNetLinkConfig | PUT | /settings/network-link | |\n| | settings_ncsi_interfaces.c | setNCSIInterfaces | PUT | /settings/ncsi-interfaces | |\n| | settings_ncsi_packages.c | setNCSIPackages | PUT | /settings/packages | |\n| | settings_ncsi_channel.c | setNCSIChannels | PUT | /settings/channels | |\n| | maintenance_fwimage_location.c | setRemoteImageInfo | PUT | /maintenance/fwimage/remote/info | |\n| | maintenance_nm_fwupdate.c | nmPutFwUpdate | PUT | /maintenance/nm_firmware_update | |\n| | maintenance_fwupdate.c | setDualImageCfg | PUT | /maintenance/dual_image_config | |\n| | maintenance_fwupdate.c | setFlashImageCfg | PUT | /maintenance/flash_image_config | |\n| | maintenance_fwupdate.c | dwldFWImage | PUT | /maintenance/firmware/dwldfwimg | |\n| | settings_raid_management.c | SetPhyDriveOnlineOffline | PUT | /settings/raid_management/physical_onlineoffline_cmd | |\n| | | | | | |\n\n\n\n# 3. \u8868\u5355\u8f93\u5165\u957f\u5ea6\u9650\u5236\uff08\u65b0\uff09\n\n[matis](http://10.0.100.36/view.php?id=35981)\n\nSVN: 63022 63194 63055\n\n| \u529f\u80fd\u6a21\u5757 | \u754c\u9762 | \u8868\u5355\u540d\u79f0 | \u5e2e\u52a9\u6216\u4ee3\u7801\u957f\u5ea6\u9650\u5236(L:\u957f\u5ea6) | \u9a8c\u8bc1\u524d\u7aef(L:\u957f\u5ea6) | \u5907\u6ce8 | \u89e3\u51b3\u529e\u6cd5 | \u9a8c\u8bc1 |\n| -------- | --------------------------------------- | ---------------------------- | ----------------------------- | ------------------------------- | ------------------------------------------------------------ | ------------------------------ | ---- |\n| \u767b\u5f55 | \u767b\u5f55 | \u7528\u6237\u540d | | \u65e0\u9650\u5236 | | | Pass |\n| | | \u5bc6\u7801 | | L<=20 | \u65e0\u9650\u5236 | | Fail |\n| \u7cfb\u7edf\u4fe1\u606f | \u4f20\u611f\u5668\u9608\u503c | \u9ad8\u4e0d\u53ef\u6062\u590d | | L<=10 | | | Pass |\n| | | \u9ad8\u4e34\u754c | | L<=10 | | | Pass |\n| | | \u9ad8\u975e\u4e34\u754c | | L<=10 | | | Pass |\n| | | \u4f4e\u975e\u4e34\u754c | | L<=10 | | | Pass |\n| | | \u4f4e\u4e34\u754c | | L<=10 | | | Pass |\n| | | \u4f4e\u4e0d\u53ef\u6062\u590d | | L<=10 | | | Pass |\n| | \u5b58\u50a8\u7cfb\u7edf-\u521b\u5efa\u865a\u62df\u8bbe\u5907 | \u903b\u8f91\u540d\u79f0 | L<=15 | L<=15 | | | Pass |\n| | | \u5bb9\u91cf (GB) | | \u65e0\u9650\u5236 | \u586b\u5199\u8fc7\u5927\u540e\u53f0\u65e0\u9519\u8bef\u8fd4\u56de\uff0c\u65e0\u6cd5\u521b\u5efa\u6210\u529f | | Pass |\n| | | \u5bbd\u5ea6\u6df1\u5ea6 | L<=3 | L<=3 | | | Pass |\n| | | \u6bcf\u4e2a\u9635\u5217\u5bbd\u5ea6\u5177\u6709\u7684\u786c\u76d8\u8bbe\u5907 | L<=2 | L<=2 | | | Pass |\n| \u8fdc\u7a0b\u63a7\u5236 | \u670d\u52a1\u5668\u5b9a\u4f4d | \u95ea\u70c1\u65f6\u95f4 | | L<=4 | | | Pass |\n| | \u7535\u6e90\u4e0e\u80fd\u8017-ME\u529f\u8017\u5c01\u9876 | \u5168\u5e73\u53f0\u529f\u8017\u9650\u5236-\u7b56\u7565\u6700\u5927\u503c | | L<=4 | | | Pass |\n| | | CPU\u529f\u8017\u9650\u5236-\u7b56\u7565\u6700\u5927\u503c | | L<=3 | | | Pass |\n| | | \u5185\u5b58\u529f\u8017\u9650\u5236-\u7b56\u7565\u6700\u5927\u503c | | L<=3 | \u65e0\u6b64\u529f\u80fd | | N/A |\n| | \u7535\u6e90\u4e0e\u80fd\u8017-\u7cfb\u7edf\u6389\u7535\u6062\u590d\u7b56\u7565 | \u9519\u5cf0\u4e0a\u7535\u65f6\u95f4 | | L<=3 | | | Pass |\n| | \u6563\u70ed\u7b56\u7565 | \u8bbe\u7f6e\u5f53\u524d\u6a21\u5f0f\u6700\u4f4e\u8f6c\u901f\u767e\u5206\u6bd4 | | L<=3 | | | Pass |\n| | | \u8bbe\u7f6e\u624b\u52a8\u8f6c\u901f\u767e\u5206\u6bd4 | | L<=3 | | | Pass |\n| BMC\u8bbe\u7f6e | \u65e5\u671f&\u65f6\u95f4 | \u4e3b NTP \u670d\u52a1\u5668 | | \u65e0\u9650\u5236 | | | Pass |\n| | | \u6b21 NTP \u670d\u52a1\u5668 | | \u65e0\u9650\u5236 | | | Pass |\n| | \u5916\u90e8\u7528\u6237\u670d\u52a1-\u4e00\u822c LDAP \u8bbe\u7f6e | \u670d\u52a1\u5668\u5730\u5740 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | \u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f | | Pass |\n| | | \u7aef\u53e3 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | | Bind DN | 4 - 64\u4f4d | 4 - 64\u4f4d | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | | \u5bc6\u7801 | L<=20 | L<=20 | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | | \u641c\u7d22\u5e93 | 4 - 64\u4f4d | 4 - 64\u4f4d | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | \u5916\u90e8\u7528\u6237\u670d\u52a1-LDAP\u89d2\u8272\u7ec4 | \u7fa4\u7ec4\u540d\u79f0 | L<=64 | L<=64 | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | | \u7fa4\u57df | L<=64 | L<=64 | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | \u5916\u90e8\u7528\u6237\u670d\u52a1-\u4e00\u822c Active Directory \u8bbe\u7f6e | \u7528\u6237\u540d | L<=64 | \u5b9e\u9645\u53ef\u4ee5\u586b\u519965\u4e2a\u5b57\u7b26 | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | | \u5bc6\u7801 | 6 - 127\u4f4d | 6 - 127\u4f4d | \u524d\u7aef\u672a\u505a\u9650\u5236\uff0c\u4fdd\u5b58\u63d0\u793a\u53c2\u8003\u5e2e\u52a9\u4fe1\u606f\uff0c\u662f\u5426\u5c06\u957f\u5ea6\u7684\u5747\u5728\u524d\u7aef\u9650\u5236 | | Fail |\n| | | \u7528\u6237\u57df\u540d | | \u65e0\u9650\u5236 | | | Pass |\n| | | \u7f51\u57df\u63a7\u5236\u5668\u670d\u52a1\u5668\u5730\u5740 1\u30012\u30013 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | | | |\n| | \u5916\u90e8\u7528\u6237\u670d\u52a1-\u4e00\u822c RADIUS \u8bbe\u7f6e | \u670d\u52a1\u5668\u5730\u5740 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f\u53ca\u57df\u540d | IPv4/IPv6 \u5730\u5740\u683c\u5f0f\u6216\u57df\u540dL<=72\u4f4d | \u586b\u5199\u8fc7\u957f\uff0c\u540e\u53f0\u62a5500\u9519\u8bef:www.w01234567890123insvr.org | \u957f\u5ea6\u9650\u5236256 | ok |\n| | | \u7aef\u53e3 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | | | |\n| | | \u5bc6\u94a5 | 4 - 32\u4f4d | 4 - 32\u4f4d | | | |\n| | \u5916\u90e8\u7528\u6237\u670d\u52a1-\u9ad8\u7ea7 RADIUS \u8bbe\u7f6e | \u7ba1\u7406\u5458 | L<=127 | L<=127 | | | |\n| | | \u64cd\u4f5c\u5458 | L<=127 | L<=127 | | | |\n| | | \u7528\u6237 | L<=127 | L<=127 | | | |\n| | | OEM \u6240\u6709\u6743 | L<=127 | L<=127 | | | |\n| | | \u65e0\u6cd5\u5b58\u53d6 | L<=127 | L<=127 | | | |\n| | \u544a\u8b66\u8bbe\u7f6e-SNMP Trap \u8bbe\u7f6e | \u56e2\u4f53\u540d | | \u65e0\u9650\u5236 | | | |\n| | | SNMP \u5730\u5740 | | IPv4 \u5730\u5740\u683c\u5f0f | | | |\n| | \u544a\u8b66\u8bbe\u7f6e-SMTP \u8bbe\u7f6e | \u670d\u52a1\u5668\u540d\u79f0 | L<=25 | L<=25 | | | |\n| | | \u670d\u52a1\u5668 IP | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | IPv4 \u5730\u5740\u683c\u5f0f | | \u5e2e\u52a9\u4fe1\u606f\u6539\u4e3aIPv4 \u5730\u5740\u683c\u5f0f | ok |\n| | | \u53d1\u4ef6\u4eba\u90ae\u7bb1\u5730\u5740 | L<=64 | L<=64 | | | |\n| | | \u53d1\u4ef6\u4eba\u90ae\u7bb1\u5bc6\u7801 | 4 - 64\u4f4d | 4 - 64\u4f4d | | | |\n| | | \u90ae\u4ef6\u4e3b\u9898 | | \u65e0\u9650\u5236 | \u586b\u5199\u8fc7\u957f\uff0c\u540e\u53f0\u62a5500\u9519\u8bef | | |\n| | | \u6536\u4ef6\u4eba\u90ae\u7bb1\u4fe1\u606f-\u90ae\u7bb1 | | \u65e0\u9650\u5236 | | | |\n| | | \u6536\u4ef6\u4eba\u90ae\u7bb1\u4fe1\u606f-\u63cf\u8ff0 | | \u65e0\u9650\u5236 | | | |\n| | \u544a\u8b66\u8bbe\u7f6e-Syslog \u8bbe\u7f6e | \u8fdc\u7a0b\u65e5\u5fd7\u670d\u52a1\u5668 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f\u53ca\u57df\u540d | \u65e0\u9650\u5236 | \u586b\u5199\u8fc7\u957f\uff0c\u540e\u53f0\u62a5500\u9519\u8bef | IPv4/IPv6 \u5730\u5740\u683c\u5f0f\u53ca\u57df\u540d | ok |\n| | | \u8fdc\u7a0b\u670d\u52a1\u5668\u7aef\u53e3 | | \u65e0\u9650\u5236 | | \u503c\u8303\u56f4\uff081 - 65535\uff09 | ok |\n| | \u5a92\u4f53\u91cd\u5b9a\u5411-\u529f\u80fd\u8bbe\u7f6e | CD/DVD \u955c\u50cf\u7684\u670d\u52a1\u5668\u5730\u5740 | \u670d\u52a1\u5668 IP \u6216 Host \u540d\u79f0 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | | placeholder\u4fe1\u606f\u6539\u4e3a\u670d\u52a1\u5668 IP | ok |\n| | | \u7f51\u57df\u540d\u79f0 | | \u65e0\u9650\u5236 | | | |\n| | | \u7528\u6237 | | \u65e0\u9650\u5236 | | \u957f\u5ea6\u9650\u5236256 | ok |\n| | | \u5bc6\u7801 | | \u65e0\u9650\u5236 | | \u957f\u5ea6\u9650\u523632 | ok |\n| | | \u8f6f\u76d8\u955c\u50cf\u7684\u670d\u52a1\u5668\u5730\u5740 | \u670d\u52a1\u5668 IP \u6216 Host \u540d\u79f0 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | | placeholder\u4fe1\u606f\u6539\u4e3a\u670d\u52a1\u5668 IP | ok |\n| | | \u670d\u52a1\u5668\u4e2d\u7684\u8def\u5f84 | | \u65e0\u9650\u5236 | | | |\n| | | \u7f51\u57df\u540d\u79f0 | | \u65e0\u9650\u5236 | | | |\n| | | \u7528\u6237 | | \u65e0\u9650\u5236 | | \u957f\u5ea6\u9650\u5236256 | ok |\n| | | \u5bc6\u7801 | | \u65e0\u9650\u5236 | | \u957f\u5ea6\u9650\u523632 | ok |\n| | | \u786c\u76d8\u955c\u50cf\u7684\u670d\u52a1\u5668\u5730\u5740 | \u670d\u52a1\u5668 IP \u6216 Host \u540d\u79f0 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | | placeholder\u4fe1\u606f\u6539\u4e3a\u670d\u52a1\u5668 IP | ok |\n| | | \u670d\u52a1\u5668\u4e2d\u7684\u8def\u5f84 | | \u65e0\u9650\u5236 | | | |\n| | | \u7f51\u57df\u540d\u79f0 | | \u65e0\u9650\u5236 | | | |\n| | | \u7528\u6237 | | \u65e0\u9650\u5236 | | \u957f\u5ea6\u9650\u5236256 | ok |\n| | | \u5bc6\u7801 | | \u65e0\u9650\u5236 | | \u957f\u5ea6\u9650\u523632 | ok |\n| | \u7f51\u7edc\u8bbe\u7f6e-\u7f51\u7edc IP \u8bbe\u7f6e | IPv4 \u5730\u5740 | IPv4 \u5730\u5740\u683c\u5f0f | IPv4 \u5730\u5740\u683c\u5f0f | | | |\n| | | IPv4 \u9ed8\u8ba4\u7f51\u5173 | IPv4 \u5730\u5740\u683c\u5f0f | IPv4 \u5730\u5740\u683c\u5f0f | | | |\n| | | IPv6 \u5730\u5740 | IPv6 \u5730\u5740\u683c\u5f0f | IPv6 \u5730\u5740\u683c\u5f0f | | | |\n| | | \u5b50\u7f51\u63a9\u7801\u524d\u7f00\u957f\u5ea6 | IPv6 \u5730\u5740\u683c\u5f0f | IPv6 \u5730\u5740\u683c\u5f0f | | | |\n| | | VLAN ID | \u503c\u8303\u56f4\uff081 - 4094\uff09 | \u503c\u8303\u56f4\uff081 - 4094\uff09 | | | |\n| | | VLAN \u4f18\u5148\u6743 | \u503c\u8303\u56f4\uff081 - 7\uff09 | \u503c\u8303\u56f4\uff081 - 7\uff09 | | | |\n| | \u7f51\u7edc\u8bbe\u7f6e-DNS \u914d\u7f6e | \u4e3b\u673a\u540d\u79f0 | | L<=64 | | | |\n| | | DNS \u670d\u52a1\u5668 1\u30012\u30013 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | | | |\n| | \u670d\u52a1-\u914d\u7f6e\u670d\u52a1 | \u4e0d\u5b89\u5168\u7aef\u53e3 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | | | |\n| | | \u5b89\u5168\u7aef\u53e3 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | \u503c\u8303\u56f4\uff081 - 65535\uff09 | | | |\n| | | \u8d85\u65f6 | \u503c\u8303\u56f4\uff08300-1800 or 60-1800\uff09 | \u503c\u8303\u56f4\uff08300-1800 or 60-1800\uff09 | | | |\n| | \u7528\u6237/\u7528\u6237\u7ec4-\u7f16\u8f91\u7528\u6237 | \u7528\u6237\u540d | 1-16\u4f4d | \u65e0\u9650\u5236 | | | |\n| | | \u5bc6\u7801 | \uff088-16\u4f4d or 8-20\u4f4d\uff09 | \uff088-16\u4f4d or 8-20\u4f4d\uff09 | | | |\n| | | \u786e\u8ba4\u5bc6\u7801 | \uff088-16\u4f4d or 8-20\u4f4d\uff09 | \uff088-16\u4f4d or 8-20\u4f4d\uff09 | | | |\n| | \u5b89\u5168\u8bbe\u7f6e-SNMP V1/V2 \u8bbe\u7f6e | \u8bfb\u5199\u56e2\u4f53\u540d | | \u65e0\u9650\u5236 | | | |\n| | | \u53ea\u8bfb\u56e2\u4f53\u540d | | \u65e0\u9650\u5236 | | | |\n| | \u5b89\u5168\u8bbe\u7f6e-\u751f\u6210SSL\u8bc1\u4e66 | \u901a\u7528\u540d\u79f0(CN) | L<=64 | L<=64 | | | |\n| | | \u7ec4\u7ec7 (O) | L<=64 | L<=64 | | | |\n| | | \u7ec4\u7ec7\u5355\u4f4d (OU) | L<=64 | L<=64 | | | |\n| | | \u57ce\u5e02\u6216\u5730\u70b9 (L) | L<=64 | L<=128 | | | |\n| | | \u5dde\u6216\u7701 (ST) | L<=128 | L<=128 | | | |\n| | | \u56fd\u5bb6 (C) | L<=2 | L<=2 | | | |\n| | | \u7535\u5b50\u90ae\u4ef6\u5730\u5740 | \u65e0\u9650\u5236 | \u65e0\u9650\u5236 | | | |\n| | | \u6709\u6548\u81ea | \u503c\u8303\u56f4\uff081 - 3650\uff09 | \u503c\u8303\u56f4\uff081 - 3650\uff09 | | | |\n| | \u5b89\u5168\u8bbe\u7f6e-\u7528\u6237\u5bc6\u7801\u9501\u5b9a\u8bbe\u7f6e | \u5bc6\u7801\u9608\u503c | \u503c\u8303\u56f4\uff080 - 255\uff09 | \u503c\u8303\u56f4\uff080 - 255\uff09 | | | |\n| | | \u7528\u6237\u9501\u5b9a\u65f6\u95f4(\u79d2) | \u503c\u8303\u56f4\uff080 - 65535\uff09 | \u503c\u8303\u56f4\uff080 - 65535\uff09 | | | |\n| \u7cfb\u7edf\u7ef4\u62a4 | \u7cfb\u7edf\u7ba1\u7406\u5458 | \u5bc6\u7801 | \uff088-64\u4f4d\uff09 | \uff088-64\u4f4d\uff09 | | | |\n| | | \u786e\u8ba4\u5bc6\u7801 | \uff088-64\u4f4d\uff09 | \uff088-64\u4f4d\uff09 | | | |\n| | \u56fa\u4ef6\u66f4\u65b0-\u56fa\u4ef6\u955c\u50cf\u4f4d\u7f6e | TFTP \u670d\u52a1\u5668\u5730\u5740 | IPv4/IPv6 \u5730\u5740\u683c\u5f0f | \u65e0\u9650\u5236 | | \u4ee3\u7801\u4fee\u6539\u9650\u5236IPv4/IPv6 \u5730\u5740\u683c\u5f0f | ok |\n| | | TFTP \u955c\u50cf\u540d\u79f0 | | \u65e0\u9650\u5236 | | | |\n| | | TFTP \u91cd\u8bd5\u6b21\u6570 | \u503c\u8303\u56f4\uff080 - 255\uff09 | \u503c\u8303\u56f4\uff080 - 255\uff09 | | | |\n\n# 4. \u3010ID1015371\u3011\u56fd\u7f51\u9700\u6c42\uff1a\u9875\u9762\u4e2d\u9700\u8981\u5bf9\u4f20\u8f93\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u7b49\u654f\u611f\u4fe1\u606f\u8fdb\u884c\u52a0\u5bc6\u540e\u4f20\u8f93\uff0c\u5bf9\u7cfb\u7edf\u5185\u6240\u6709\u6d89\u53ca\u5230\u5bc6\u7801\u4f20\u8f93\u5730\u65b9\u505a\u52a0\u5bc6\u5904\u7406\u3002\u4e0d\u8981\u4f7f\u7528MD5\u7b49\u6613\u88ab\u7834\u89e3\u7684\u52a0\u5bc6\u65b9\u5f0f\u548c\u4e0d\u8981\u4f7f\u7528Base64\u7f16\u7801\u3001URL\u7f16\u7801\u7b49\u65b9\u5f0f\u89e3\u51b3\u6b64\u7c7b\u95ee\u9898\u3002\n\n\n\n\uff081\uff09\u521b\u5efa\u7528\u6237\u65f6\uff0c\u76ee\u524d\u4ec5\u52a0\u5bc6\u4e86\u7528\u6237\u5bc6\u7801\uff0c\u8fd8\u6ca1\u6709\u52a0\u5bc6\u7528\u6237\u540d\uff1b\n\n\uff082\uff09\u56e0\u4e3a\u7528\u6237\u5f52\u5c5e\u5728\u76f8\u5e94\u7684\u7528\u6237\u7ec4\u4e2d\u3002\u5728\u83b7\u53d6\u7528\u6237\u7ec4\u4e2d\u7684\u7528\u6237\u4fe1\u606f\u65f6\uff0c\u4e5f\u6ca1\u6709\u52a0\u5bc6\u7528\u6237\u540d\uff1b\n\n\uff083\uff09\u9488\u5bf9\u7cfb\u7edf\u7ba1\u7406\u5458\uff0c\u83b7\u53d6/\u8bbe\u7f6e\u4fe1\u606f\u65f6\uff0c\u7528\u6237\u540d\u90fd\u662f\u660e\u6587\u4f20\u9012\uff1b\u5728\u4fee\u6539\u5bc6\u7801\u65f6\uff0c\u5bc6\u7801\u4e5f\u662f\u91c7\u7528\u660e\u6587\u4f20\u9012\u3002\n\n\u989d\u5916\u6dfb\u52a0\u5982\u4e0b\u529f\u80fd\uff1a\n\n\uff084\uff09Audit LOG\u4fe1\u606f\u4e2d\u4e5f\u5305\u542b\u91c7\u7528\u660e\u6587\u8868\u793a\u7684\u7528\u6237\u540d\uff1b\n\n\uff085\uff09\u5916\u90e8\u7528\u6237\u754c\u9762\u5305\u542b\u4e86\u91c7\u7528\u660e\u6587\u8868\u793a\u7684\u7528\u6237\u540d\u7b49\u4fe1\u606f\uff1b\n\n\uff086\uff09\u83b7\u53d6SNMPv3\u7528\u6237\u4fe1\u606f\u65f6\uff0c\u8fd4\u56de\u4e86\u91c7\u7528\u660e\u6587\u8868\u793a\u7684\u7528\u6237\u540d\uff1b\n\n\uff087\uff09\u8bbe\u7f6eSMTP\u4fe1\u606f\u65f6\uff0c\u4f1a\u4f20\u9012\u660e\u6587\u7684\u7528\u6237email\u5bc6\u7801\uff1b\n\n\uff088\uff09\u8bbe\u7f6e\u5bc6\u7801\u6709\u6548\u671f\u548c\u83b7\u53d6\u5bc6\u7801\u6709\u6548\u671f\u4e5f\u4f7f\u7528\u4e86\u660e\u6587\u7528\u6237\u540d\uff1b\n\n\uff089\uff09\u4f7f\u7528cifs\u65b9\u5f0f\u6302\u8f7d\u8fdc\u7a0b\u5a92\u4f53\u65f6\u4f7f\u7528\u4e86\u660e\u6587\u8868\u793a\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff1b\n\n\u6d4b\u8bd5\u53d1\u73b0\u6709\u4e9b\u64cd\u4f5c\u8bb0\u5f55Audit\u65e5\u5fd7\u65f6\u4f7f\u7528\u4e86\u660e\u6587\u7528\u6237\u540d\uff0c\u9700\u8981\u4fee\u6b63\u3002\n\n\n\n# 5 \u907f\u514d\u4f1a\u8bdd\u91cd\u653e\u653b\u51fb\n\n\u57fa\u7840\u4ee3\u7801\u672a\u5b9e\u73b0",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 9,
"user": 1,
"add_time": "2020-04-10T11:45:53.940Z",
"modified_time": "2020-04-23T06:41:17.962Z",
"types": [
1,
6,
8,
10
]
}
},
{
"model": "articals.articale",
"pk": 17,
"fields": {
"note": 1,
"title": "BMC Web \u6846\u67b6\u4ecb\u7ecd",
"text_content": "[TOC]\r\n\r\n# BMC Web \u6846\u67b6\u4ecb\u7ecd\r\n## 1. \u8ba4\u8bc6 Web\r\n\r\n### 1-1 [Web\u7684\u6982\u5ff5](https://baike.baidu.com/item/web/150564?fr=aladdin)\r\n\r\n *Web*\uff08World Wide Web\uff09\u5373\u5168\u7403\u5e7f\u57df\u7f51\uff0c\u4e5f\u79f0\u4e3a\u4e07\u7ef4\u7f51\uff0c\u5b83\u662f\u4e00\u79cd\u57fa\u4e8e\u8d85\u6587\u672c\u548cHTTP\u7684\u3001\u5168\u7403\u6027\u7684\u3001\u52a8\u6001\u4ea4\u4e92\u7684\u3001\u8de8\u5e73\u53f0\u7684\u5206\u5e03\u5f0f\u56fe\u5f62\u4fe1\u606f\u7cfb\u7edf\u3002Web\u7684\u4e00\u4e2a\u4e3b\u8981\u7684\u6982\u5ff5\u5c31\u662f`\u8d85\u6587\u672c\u94fe\u63a5`\u3002\u5b83\u4f7f\u5f97\u6587\u672c\u4e0d\u518d\u50cf\u4e00\u672c\u4e66\u4e00\u6837\u662f\u56fa\u5b9a\u7684\u7ebf\u6027\u7684\uff0c\u800c\u662f\u53ef\u4ee5\u4ece\u4e00\u4e2a\u4f4d\u7f6e\u8df3\u5230\u53e6\u5916\u7684\u4f4d\u7f6e\u5e76\u4ece\u4e2d\u83b7\u53d6\u66f4\u591a\u7684\u4fe1\u606f\uff0c\u8fd8\u53ef\u4ee5\u8f6c\u5230\u522b\u7684\u4e3b\u9898\u4e0a\u3002\u60f3\u8981\u4e86\u89e3\u67d0\u4e00\u4e2a\u4e3b\u9898\u7684\u5185\u5bb9\u53ea\u8981\u5728\u8fd9\u4e2a\u4e3b\u9898\u4e0a\u70b9\u4e00\u4e0b\uff0c\u5c31\u53ef\u4ee5\u8df3\u8f6c\u5230\u5305\u542b\u8fd9\u4e00\u4e3b\u9898\u7684\u6587\u6863\u4e0a\u3002\u6b63\u662f\u8fd9\u79cd\u591a\u8fde\u63a5\u6027\u628a\u5b83\u79f0\u4e3aWeb\u3002\r\n\r\n### 1-2 \u8868\u73b0\u5f62\u5f0f\r\n\r\n1. \u8d85\u6587\u672c\uff08Hyper text\uff09\r\n\r\n **\u201c**[\u8d85\u6587\u672c](https://baike.baidu.com/item/\u8d85\u6587\u672c/2832422)**\u201d**\u5c31\u662f\u6307\u9875\u9762\u5185\u53ef\u4ee5\u5305\u542b\u56fe\u7247\u3001[\u94fe\u63a5](https://baike.baidu.com/item/\u94fe\u63a5/2665501)\uff0c\u751a\u81f3\u97f3\u4e50\u3001[\u7a0b\u5e8f](https://baike.baidu.com/item/\u7a0b\u5e8f/71525)\u7b49\u975e\u6587\u5b57\u5143\u7d20\u3002\r\n\r\n \u6211\u4eec\u65e5\u5e38\u6d4f\u89c8\u7684\u7f51\u9875\u4e0a\u7684\u94fe\u7ed3\u90fd\u5c5e\u4e8e\u8d85\u6587\u672c,\u6bd4\u5982\u7f51\u7ad9\u7684\u7f51\u9875\u4e0a\u53ef\u4ee5\u540c\u65f6\u5305\u542b\u89c6\u9891\u3001\u56fe\u7247\u3001\u94fe\u63a5\u7b49\u5185\u5bb9\u3002\r\n\r\n \u8d85\u6587\u672c\u94fe\u63a5\u4e00\u79cd\u5168\u5c40\u6027\u7684\u4fe1\u606f\u7ed3\u6784\uff0c\u5b83\u5c06\u6587\u6863\u4e2d\u7684\u4e0d\u540c\u90e8\u5206\u901a\u8fc7[\u5173\u952e\u5b57](https://baike.baidu.com/item/\u5173\u952e\u5b57)\u5efa\u7acb[\u94fe\u63a5](https://baike.baidu.com/item/\u94fe\u63a5)\uff0c\u4f7f\u4fe1\u606f\u5f97\u4ee5\u7528\u4ea4\u4e92\u65b9\u5f0f\u641c\u7d22\u3002\r\n\r\n `\u5e38\u89c1\u7684\u8d85\u6587\u672c\u6709\u4e24\u79cd, 1.Html 2.\u5bcc\u6587\u672c`\r\n\r\n2. \u8d85\u5a92\u4f53\uff08hypermedia\uff09\r\n\r\n \u8d85\u5a92\u4f53\u662f\u8d85\u7ea7\u5a92\u4f53\u7684\u7b80\u79f0\u3002\u662f[\u8d85\u6587\u672c](https://baike.baidu.com/item/\u8d85\u6587\u672c)\uff08hypertext\uff09\u548c[\u591a\u5a92\u4f53]([https://baike.baidu.com/item/%E5%A4%9A%E5%AA%92%E4%BD%93/140486](https://baike.baidu.com/item/\u591a\u5a92\u4f53/140486))\u5728\u4fe1\u606f\u6d4f\u89c8\u73af\u5883\u4e0b\u7684\u7ed3\u5408\u3002\u7528\u6237\u4e0d\u4ec5\u80fd\u4ece\u4e00\u4e2a\u6587\u672c\u8df3\u5230\u53e6\u4e00\u4e2a\u6587\u672c\uff0c\u800c\u4e14\u53ef\u4ee5\u6fc0\u6d3b\u4e00\u6bb5\u58f0\u97f3\uff0c\u663e\u793a\u4e00\u4e2a\u56fe\u5f62\uff0c\u751a\u81f3\u53ef\u4ee5\u64ad\u653e\u4e00\u6bb5\u52a8\u753b\u3002\r\n\r\n [Internet](https://baike.baidu.com/item/Internet)\u91c7\u7528\u8d85\u6587\u672c\u548c\u8d85\u5a92\u4f53\u7684\u4fe1\u606f\u7ec4\u7ec7\u65b9\u5f0f\uff0c\u5c06\u4fe1\u606f\u7684\u94fe\u63a5\u6269\u5c55\u5230\u6574\u4e2aInternet\u4e0a\u3002\r\n\r\n \r\n\r\n3. [\u8d85\u6587\u672c\u4f20\u8f93\u534f\u8bae](https://baike.baidu.com/item/\u8d85\u6587\u672c\u4f20\u8f93\u534f\u8bae)\uff08HTTP\uff0cHyperText Transfer Protocol)\r\n\r\n HTTP \u662f\u4e92\u8054\u7f51\u4e0a\u5e94\u7528\u6700\u4e3a\u5e7f\u6cdb\u7684\u4e00\u79cd\u7f51\u7edc\u534f\u8bae\uff0c\u7528\u6765\u4f20\u8f93\u7f51\u7edc\u6570\u636e\uff0c\u662fWeb\u7684\u57fa\u7840\u3002\r\n\r\n### 1-3 Web \u57fa\u7840\u6280\u672f\u7b80\u4ecb\r\n\r\n| \u6280\u672f\u540d | \u4ecb\u7ecd | \u4f5c\u7528 |\r\n| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------ |\r\n| [HTML\uff08\u8d85\u6587\u672c\u6807\u8bb0\u8bed\u8a00\uff09](https://developer.mozilla.org/zh-CN/docs/Learn/HTML/Introduction_to_HTML) | HTML \u4e0d\u662f\u4e00\u79cd[\u7f16\u7a0b\u8bed\u8a00](https://baike.baidu.com/item/\u7f16\u7a0b\u8bed\u8a00/9845131)\uff0c\u800c\u662f\u4e00\u79cd[\u6807\u8bb0\u8bed\u8a00](https://baike.baidu.com/item/\u6807\u8bb0\u8bed\u8a00/5964436) (markup language)\uff0c\u662f[\u7f51\u9875\u5236\u4f5c](https://baike.baidu.com/item/\u7f51\u9875\u5236\u4f5c/1399)\u6240\u5fc5\u5907\u7684 | \u5b9a\u4e49\u4e86\u7f51\u9875\u7684\u7ed3\u6784\u3002 |\r\n| [CSS\uff08\u5c42\u53e0\u6837\u5f0f\u8868\uff09](https://developer.mozilla.org/zh-CN/docs/Web/CSS) | CSS \u662f\u4e00\u79cd [\u6837\u5f0f\u8868](https://developer.mozilla.org/zh-CN/docs/DOM/stylesheet) \u8bed\u8a00\uff0c\u7528\u6765\u63cf\u8ff0 [HTML](https://developer.mozilla.org/zh-CN/docs/HTML) \u6216 [XML](https://developer.mozilla.org/zh-CN/docs/XML_\u4ecb\u7ecd)\u6587\u6863\u7684\u5448\u73b0\u3002\u7528\u6765\u544a\u8bc9\u6d4f\u89c8\u5668\u5982\u4f55\u6e32\u67d3\u6587\u6863\u4e0a\u7684\u5143\u7d20\u3002 | \u63cf\u8ff0\u4e86\u7f51\u9875\u7684\u5e03\u5c40 |\r\n| [JavaScript](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript) | JavaScript \u662f Web \u7684\u7f16\u7a0b\u8bed\u8a00\u3002\u6240\u6709\u73b0\u4ee3\u7684 HTML \u9875\u9762\u90fd\u4f7f\u7528 JavaScript\u3002 | \u63a7\u5236\u7f51\u9875\u7684\u884c\u4e3a |\r\n| [Http \u534f\u8bae](https://developer.mozilla.org/zh-CN/docs/Web/HTTP) | HTTP\u662f\u4e00\u79cd\u80fd\u591f\u83b7\u53d6\u5982 HTML \u8fd9\u6837\u7684\u7f51\u7edc\u8d44\u6e90\u7684\u901a\u8baf\u534f\u8bae\u3002\u5b83\u662f\u5728 Web \u4e0a\u8fdb\u884c\u6570\u636e\u4ea4\u6362\u7684\u57fa\u7840\uff0c\u662f\u4e00\u79cd client-server \u534f\u8bae\uff0c\u8bf7\u6c42\u901a\u5e38\u662f\u7531\u50cf\u6d4f\u89c8\u5668\u8fd9\u6837\u7684\u63a5\u53d7\u65b9\u53d1\u8d77\u7684\u3002 | \u8d1f\u8d23web\u524d\u540e\u7aef\u6570\u636e\u901a\u4fe1 |\r\n| [Web\u670d\u52a1\u5668]([https://baike.baidu.com/item/web%20server?fromtitle=WEB%E6%9C%8D%E5%8A%A1%E5%99%A8&fromid=8390210](https://baike.baidu.com/item/web server?fromtitle=WEB\u670d\u52a1\u5668&fromid=8390210)) | Web\u670d\u52a1\u5668\u53ef\u4ee5\u89e3\u6790(handles)[HTTP\u534f\u8bae](https://baike.baidu.com/item/HTTP\u534f\u8bae)\uff0c\u5e76\u5728\u63a5\u6536\u5230\u4e00\u4e2a[HTTP\u8bf7\u6c42](https://baike.baidu.com/item/HTTP\u8bf7\u6c42)(request)\uff0c\u4f1a\u8fd4\u56de\u4e00\u4e2aHTTP\u54cd\u5e94(response)\uff0c\u4f8b\u5982\u9001\u56de\u4e00\u4e2aHTML\u9875\u9762\u3002\u4e3a\u4e86\u5904\u7406\u4e00\u4e2a\u8bf7\u6c42Web\u670d\u52a1\u5668\u53ef\u4ee5\u54cd\u5e94\u4e00\u4e2a[\u9759\u6001\u9875\u9762](https://baike.baidu.com/item/\u9759\u6001\u9875\u9762)\u6216\u8005\u628a\u52a8\u6001\u54cd\u5e94(dynamic response)\u7684\u4ea7\u751f\u59d4\u6258\u7ed9\u4e00\u4e9b\u5176\u5b83\u7684\u7a0b\u5e8f\u4f8b\u5982CGI\u811a\u672c,\u5e76\u5728\u540e\u53f0\u7a0b\u5e8f\u5904\u7406\u5b8c\u6bd5\u540e\uff0c\u5c06\u540e\u53f0\u7a0b\u5e8f\u54cd\u5e94\u8f6c\u53d1\u7ed9\u8bf7\u6c42\u7aef<br> BMC \u4f7f\u7528\u7684web\u670d\u52a1\u5668\u8f6f\u4ef6\u4e3a [lightpd](https://www.lighttpd.net/) | \u63a5\u53d7\u5ba2\u6237\u7aef\u8bf7\u6c42\u3001\u5efa\u7acb\u8fde\u63a5\u3001\u8f6c\u53d1\u54cd\u5e94\u7684\u7a0b\u5e8f |\r\n| \u540e\u53f0\u7a0b\u5e8f | Web \u670d\u52a1\u5668\u63a5\u53d7\u5230\u8bf7\u6c42\u540e\uff0c\u89e3\u6790\u8bf7\u6c42\u7684url \u53c2\u6570\uff0c\u5e76\u628a\u8be5 url \u4e0e\u540e\u53f0\u6ce8\u518c\u7684\u51fd\u6570\u8fdb\u884c\u5339\u914d\uff0c\u5982\u679c\u53d1\u73b0\u4e0e\u4e4b\u5339\u914d\u7684\u7a0b\u5e8f\uff0c\u5219\u8c03\u7528\u8be5\u7a0b\u5e8f\uff0c\u8be5\u7a0b\u5e8f\u5c31\u662f\u8bf7\u6c42\u6d88\u606f\u5bf9\u5e94\u7684\u540e\u7aef\u529f\u80fd\u5177\u4f53\u5b9e\u73b0\uff0c\u7b49\u5f85\u7a0b\u5e8f\u6267\u884c\u5b8c\u6bd5\u540e\u518d\u5c06\u7ed3\u679c\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef.<br>\u540e\u53f0\u7a0b\u5e8f\u53ef\u4ee5\u4f7f\u7528\u5f88\u591a\u8bed\u8a00\u7f16\u5199\uff0c\u6bd4\u5982\u4e3b\u6d41\u7684 Java\u3001PHP\u3001C++\u3001ruby\u3001python\u7b49\uff0c\u4f46\u662f\u5f00\u53d1\u9700\u8981\u5c0a\u5b88\u670d\u52a1\u5668\u7f51\u5173\u63a5\u53e3\u534f\u8bae\uff0cBMC \u7684\u540e\u7aef\u5904\u7406\u7a0b\u5e8f\u662f\u6309\u7167[Fastcgi](https://blog.csdn.net/zhang197093/article/details/78914509)\u534f\u8bae\u4f7f\u7528C\u8bed\u8a00\u5f00\u53d1\u7684 | web\u670d\u52a1\u7aef\u7684\u529f\u80fd\u5b9e\u73b0\u4e3b\u4f53,\u8d1f\u8d23\u5177\u4f53\u529f\u80fd\u7684\u5b9e\u73b0 |\r\n\r\n\r\n\r\n## 2. \u8ba4\u8bc6\u7f51\u7ad9\r\n\r\n### [2-1 \u7f51\u7ad9\uff08WebSite\uff09]([https://wikipedia.tw.wjbk.site/wiki/%E7%BD%91%E7%AB%99](https://wikipedia.tw.wjbk.site/wiki/\u7f51\u7ad9))\r\n\r\n\u200b\t\u7f51\u7ad9(Website)\u662f\u6307\u80fd\u6839\u636e\u7528\u6237\u4ee3\u7406\u7a0b\u5e8f\u7684\u8bf7\u6c42\u4fe1\u606f\uff0c\u8fd4\u56de\u5bf9\u5e94\u9875\u9762\u548c\u8d44\u6e90\u7684\u5e94\u7b54\u670d\u52a1\u5668\uff0c\u6bd4\u5982\u8f93\u5165\u67d0\u4e2aurl\u5730\u5740\u53ef\u4ee5\u8fd4\u56de\u5bf9\u5e94\u5185\u5bb9\u7684\u9875\u9762\uff0c\u6216\u8005\u53d1\u9001\u67d0\u4e2a api \u8bf7\u6c42\u53ef\u4ee5\u83b7\u53d6\u5bf9\u5e94\u7684\u6570\u636e\u4fe1\u606f\u3002\r\n\r\nBMC Web\u4e3b\u8981\u9762\u5411\u670d\u52a1\u5668\u4e3b\u673a\uff0c\u7528\u4f5c\u76d1\u63a7\u3001\u8bbe\u7f6e\u3001\u83b7\u53d6\u670d\u52a1\u5668\u72b6\u6001\u3002\r\n\r\n### 2-2 \u6d4f\u89c8\u5668\u8bbf\u95ee\u7f51\u7ad9\u6d41\u7a0b\u5206\u6790\r\n\r\n- 1. \u6253\u5f00\u6d4f\u89c8\u5668\u8f93\u5165URL \u5730\u5740\uff0c\u6309\u4e0b\u56de\u8f66\u786e\u8ba4\r\n\r\n ```\r\n \u8f93\u5165 url: https://baike.baidu.com/item/javascript/321142\r\n ```\r\n\r\n- 2. \u6d4f\u89c8\u5668\u5411DNS\u670d\u52a1\u5668\u8bf7\u6c42\u89e3\u6790\u8be5URL\u4e2d\u7684\u57df\u540d\u6240\u5bf9\u5e94\u7684IP\u5730\u5740\u3002\r\n\r\n ```\r\n url: https://baike.baidu.com/item/javascript/321142 ==\u300b Remote Address: 180.97.104.102:443\r\n ```\r\n\r\n- 3. DNS\u670d\u52a1\u5668\u89e3\u6790\u51faip\u5730\u5740\u540e\uff0c\u6839\u636eIP\u5730\u5740\u548c\u9ed8\u8ba4\u7aef\u53e3\uff0c\u548c\u670d\u52a1\u5668\u5efa\u7acbTCP\u8fde\u63a5\u3002\r\n\r\n- 4. \u6d4f\u89c8\u5668\u53d1\u51fa\u8bfb\u53d6\u6587\u4ef6\uff08URL\u57df\u540d\u540e\u9762\u7684\u90e8\u5206\u5bf9\u5e94\u7684\u6587\u4ef6\uff09\u7684HTTP\u8bf7\u6c42\uff0c\u8be5\u8bf7\u6c42\u62a5\u6587\u4f5c\u4e3aTCP\u4e09\u6b21\u63e1\u624b\u7684\u7b2c\u4e09\u4e2a\u62a5\u6587\u4f20\u9001\u7ed9\u670d\u52a1\u5668\u3002\r\n\r\n- 5. \u670d\u52a1\u5668\u5bf9\u6d4f\u89c8\u5668\u8bf7\u6c42\u4f5c\u51fa\u54cd\u5e94\uff0c\u5e76\u628a\u5bf9\u5e94\u7684html\u6587\u672c`\u6216\u8005\u4e3aAPI\u6570\u636e`\u53d1\u9001\u7ed9\u6d4f\u89c8\u5668\u3002\r\n \u91ca\u653eTCP\u94fe\u63a5\u3002\r\n\r\n ```html\r\n <!DOCTYPE html>\r\n <!--STATUS OK-->\r\n <html>\r\n <head>\r\n <meta charset=\"UTF-8\">\r\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\" />\r\n <meta name=\"referrer\" content=\"always\" />\r\n <meta name=\"description\" content=\"JavaScript\u4e00\u79cd\u76f4\u8bd1\u5f0f\u811a\u672c\u8bed\u8a00\uff0c\u662f\u4e00\u79cd\u52a8\u6001\u7c7b\u578b\u3001\u5f31\u7c7b\u578b\u3001\u57fa\u4e8e\u539f\u578b\u7684\u8bed\u8a00\uff0c\u5185\u7f6e\u652f\u6301\u7c7b\u578b\u3002\u5b83\u7684\u89e3\u91ca\u5668\u88ab\u79f0\u4e3aJavaScript\u5f15\u64ce\uff0c\u4e3a\u6d4f\u89c8\u5668\u7684\u4e00\u90e8\u5206\uff0c\u5e7f\u6cdb\u7528\u4e8e\u5ba2\u6237\u7aef\u7684\u811a\u672c\u8bed\u8a00\uff0c\u6700\u65e9\u662f\u5728HTML\uff08\u6807\u51c6\u901a\u7528\u6807\u8bb0\u8bed\u8a00\u4e0b\u7684\u4e00\u4e2a\u5e94\u7528\uff09\u7f51\u9875\u4e0a\u4f7f\u7528\uff0c\u7528\u6765\u7ed9HTML\u7f51\u9875\u589e\u52a0\u52a8\u6001\u529f\u80fd\u3002\u57281995\u5e74\u65f6\uff0c\u7531\"/>\r\n ...\r\n \r\n ```\r\n\r\n- \u6d4f\u89c8\u5668\u5ba2\u6237\u7aef\u5c06\u8fd4\u56de\u7684html\u6587\u672c\u5185\u5bb9\u6216\u8005api\u6570\u636e\u8fdb\u884c\u89e3\u6790\uff0c\u5982\u679chtml\u5185\u5bb9\u5305\u542b\u9759\u6001\u8d44\u6e90\uff0c\u5219\u4f1a\u7ee7\u7eed\u5411\u670d\u52a1\u5668\u53d1\u9001\u9759\u6001\u8d44\u6e90\uff08\u53ef\u4ee5\u662fCSS\u6837\u5f0f\u6587\u4ef6\u3001JS\u811a\u672c\u6587\u4ef6\u3001\u97f3\u9891\u3001\u56fe\u7247\u7b49\u591a\u5a92\u4f53\u6587\u4ef6\uff09\u8bf7\u6c42\uff0c\u7136\u540e\u52a0\u8f7d\u9759\u6001\u8d44\u6e90\u8fdb\u884c\u6e32\u67d3\u663e\u793a\u3002\r\n\r\n![1568022994419](images/1568022994419.png)\r\n\r\n\r\n\r\n\u8be6\u7ec6\u6d41\u7a0b\u89c1\u4e0b\u56fe\r\n\r\n![](images/\u6d4f\u89c8\u5668\u8bbf\u95ee.png)\r\n\r\n\u6d4f\u89c8\u5668\u8bbf\u95ee\u7f51\u7ad9\u7684`\u672c\u8d28`\u5c31\u662f\u901a\u8fc7\u4e0d\u540c\u7684 URL\u5730\u5740\u83b7\u53d6\u7f51\u7ad9\u5bf9\u5e94\u7684Html \u6587\u6863\r\n\r\n**\u95ee\u9898:**\uff08\u53ef\u9009\uff09\r\n\r\n\u6839\u636e\u4e0a\u9762\u4ecb\u7ecd\u548c\u7f51\u7ad9\u8bbf\u95ee\u6d41\u7a0b\u56fe\u8bd5\u7740\u601d\u8003\u4e0b\u9762\u95ee\u9898:\r\n\r\n1. \u4e86\u89e3 BMC Web \u540e\u7aef\u662f\u5982\u4f55\u76d1\u542c\u5904\u7406 HTTP \u8bf7\u6c42\u7684\r\n\r\n2. BMC \u670d\u52a1\u5668\u6240\u652f\u6301\u7684 HTTP \u65b9\u6cd5\u6709\u54ea\u4e9b? \u5982\u4f55\u5224\u65ad\u662f\u5426\u652f\u6301 HTTP \u67d0\u4e2a\u65b9\u6cd5\uff08\u65b9\u6cd5\u6bd4\u8f83\u591a\uff0c\u6700\u597d\u4ece\u6e90\u4ee3\u7801\u5b9e\u73b0\u89d2\u5ea6\u8bf4\u660e\uff09\r\n\r\n3. \u7b80\u5355\u4e86\u89e3\u4e0b\u540e\u7aef\u670d\u52a1\u5668\u8f6f\u4ef6\u7684\u914d\u7f6e\u9879\u6709\u54ea\u4e9b\uff1f Web \u8d44\u6e90\u662f\u600e\u6837\u88ab\u5f15\u7528\u548c\u627e\u5230\u7684. \r\n\r\n4. \u67e5\u627e BMC \u670d\u52a1\u5668\u6240\u652f\u6301 MIME \u7c7b\u578b\u6709\u54ea\u4e9b\uff1f\u5047\u8bbeBMC \u6709\u4e00\u4e2a\u65b0\u529f\u80fd\u9700\u8981\u4e0b\u8f7d\u6587\u4ef6\uff0c\u4f46\u8be5\u6587\u4ef6\u7c7b\u578b\u670d\u52a1\u5668\u8f6f\u4ef6\u4e0d\u652f\u6301\u5904\u7406\uff0c\u53ef\u4ee5\u600e\u4e48\u505a\uff1f\r\n\r\n5. \u8003\u8651\u4e0b\u4e3a\u4e86\u63d0\u9ad8 Web \u8bbf\u95ee\u54cd\u5e94\u901f\u5ea6\u53ef\u4ee5\u6709\u54ea\u4e9b\u4f18\u5316\u63aa\u65bd\r\n\r\n \r\n\r\n### 2-3 \u7f51\u7ad9\u529f\u80fd\u5f00\u53d1\u7684\u804c\u8d23\u5206\u7c7b\r\n\r\n\u7f51\u7ad9\u53ef\u4ee5\u6309\u7167\u5f00\u53d1\u7a0b\u7b80\u5355\u7684\u5206\u6210\u4e24\u4e2a\u90e8\u5206\uff1a\r\n\r\n\u200b\t1.web \u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09`\u540e\u9762\u5c06\u53ea\u4ecb\u7ecd BMC web\u524d\u7aef\u5f00\u53d1\u76f8\u5173\u5185\u5bb9`\r\n\r\n\u200b\t\u987e\u540d\u601d\u4e49\u662f\u6765\u505aWeb\u7684\u524d\u7aef\u7684\u3002\u8fd9\u91cc\u6240\u8bf4\u7684\u524d\u7aef\u6cdb\u6307Web\u524d\u7aef\uff0c\u4e5f\u5c31\u662f\u5728Web\u5e94\u7528\u4e2d\u7528\u6237\u53ef\u4ee5\u770b\u5f97\u89c1\u78b0\u5f97\u7740\u7684\u4e1c\u897f\u3002\r\n\r\n**\u4e3b\u8981\u804c\u8d23\uff1aWeb\u9875\u9762\u7684\u7ed3\u6784\u3001Web\u7684\u5916\u89c2\u89c6\u89c9\u8868\u73b0\u3001Web\u5c42\u9762\u4e0e\u540e\u7aef\u63a5\u53e3\u7684\u4ea4\u4e92\u5b9e\u73b0\u3002**\r\n\r\n2. web \u540e\u7aef (\u670d\u52a1\u7aef = Web\u670d\u52a1\u5668 + \u540e\u53f0\u5904\u7406\u7a0b\u5e8f + \u670d\u52a1\u5668\u8d44\u6e90)\r\n\r\n\u200b \u4e3b\u6d41Web\u540e\u7aef\u66f4\u591a\u7684\u662f\u4e0e\u6570\u636e\u5e93\u8fdb\u884c\u4ea4\u4e92\u4ee5\u5904\u7406\u76f8\u5e94\u7684\u4e1a\u52a1\u903b\u8f91\uff0c\r\n\r\n\u200b\tBMC \u540e\u7aef\u4e3b\u8981\u4efb\u52a1\u5728\u4e8e\u5b9e\u73b0Rest Api\u63a5\u53e3\u3002\r\n\r\n**\u4e3b\u8981\u804c\u8d23\uff1a\u9700\u8981\u8003\u8651\u7684\u662f\u5982\u4f55\u5b9e\u73b0\u529f\u80fd\u3001\u6570\u636e\u7684\u5b58\u53d6\u3001\u5e73\u53f0\u7684\u7a33\u5b9a\u6027\u4e0e\u6027\u80fd\u7b49\u3002**\r\n\r\n### 2-4 \u7f51\u7ad9\u5f00\u53d1\u7684\u4e3b\u6d41\u65b9\u5f0f\u4ecb\u7ecd\r\n\r\n\u200b \u5927\u5bb6\u5f00\u53d1\u7684Web\u5e94\u7528`\u672c\u8d28`\u4e0a\u5c31\u662f\u53ef\u4ee5\u63d0\u4f9b\u4fe1\u606f\u6216\u8005\u529f\u80fd\u7684Web\u8d44\u6e90\uff0c\u6210\u4e3aWeb\u8fd9\u4e2a\u5168\u7403\u8d85\u5927\u89c4\u6a21\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\u7684\u4e00\u90e8\u5206\u3002\r\n\r\n \u901a\u8fc7\u4e4b\u524d\u6240\u8bb2\u7684\u6d4f\u89c8\u5668\u8bbf\u95ee\u7f51\u7ad9\u539f\u7406\u6211\u4eec\u77e5\u9053,Web\u7684\u4fe1\u606f\u4ea4\u6d41\u65b9\u5f0f\u5c31\u662f\u6d4f\u89c8\u5668\u53d1\u8d77Http\u8bf7\u6c42\u540e\uff0c\u670d\u52a1\u7aef\u8fd4\u56de\u5bf9\u5e94\u7684\u7f51\u9875\u5185\u5bb9\u4f5c\u4e3a\u54cd\u5e94\uff0c\u6d4f\u89c8\u5668\u5728\u63a5\u53d7\u7f51\u9875\u540e\u6e32\u67d3\u7f51\u9875\u5185\u5bb9\uff0c\u5728\u7f51\u9875\u663e\u793a\u9875\u9762\u5185\u5bb9\uff0c\u5e76\u5728\u9875\u9762\u4e0b\u53ef\u4ee5\u901a\u8fc7\u8d85\u94fe\u63a5\u6216\u8005js\u4ee3\u7801\u4e0eweb\u8fdb\u884c\u5185\u5bb9\u4ea4\u4e92\u3002\r\n\r\n \u524d\u7aef\u7684web\u5f00\u53d1\u5176\u5b9e\u5c31\u662f\u4ec5\u4ec5\u56f4\u7ed5\u8fd9\u4e2a\u6d41\u7a0b\u6765\u8bbe\u8ba1\u9875\u9762\u5185\u5bb9\u6e32\u67d3\u548c\u4ea4\u4e92\u7684\u65b9\u5f0f\uff0c\u5728\u6b64\u6839\u636e web \u9875\u9762\u7684\u6570\u91cf \u548c \u6e32\u67d3\u5185\u5bb9\u65b9\u6cd5\u5206\u7c7b\uff0c`\u5c06 web \u5e94\u7528\u5f00\u53d1\u65b9\u5f0f\u5206\u4e3a\u4ee5\u4e0b\u4e24\u79cd `:\r\n\r\n**1.\u5728\u670d\u52a1\u5668\u4e0a\u6267\u884c\u5927\u90e8\u5206\u5e94\u7528\u7a0b\u5e8f\u903b\u8f91\uff0c\u7136\u540e\u5c06\u7a0b\u5e8f\u6267\u884c\u7ed3\u679c\u6e32\u67d3\u5230\u9875\u9762\u4f5c\u4e3a\u54cd\u5e94\u5185\u5bb9\u90e8\u5206 \u7684`\u4f20\u7edf Web \u5e94\u7528\u7a0b\u5e8f`\u3002**\r\n\r\n\u518d\u901a\u4fd7\u70b9\u8bf4\u5c31\u662f\u5728\u6b64web \u5e94\u7528\u4e0b\uff0c\u6bcf\u5f53\u8df3\u8f6c\u5230\u7ad9\u70b9\u4e0b\u7684\u4e00\u4e2a\u65b0 URL \u8def\u7531\u65f6\uff0c\u6d4f\u89c8\u5668\u90fd\u4f1a\u5237\u65b0\u9875\u9762\uff0c\u91cd\u65b0\u5411web \u670d\u52a1\u7aef\u8bf7\u6c42\u65b0\u7684\u9875\u9762\u6587\u6863\u3002\u6bcf\u4e2aURL \u90fd\u5bf9\u5e94\u4e0d\u540c\u9875\u9762\u3002\r\n\r\n![\u591a\u9875\u9762\u5e94\u7528\u7ed3\u6784](images/page.jpg)\r\n\r\n \r\n\r\n**2.\u5728 Web \u6d4f\u89c8\u5668\u4e2d\u6267\u884c\u5927\u90e8\u5206\u7528\u6237\u754c\u9762\u903b\u8f91\u7684`\u5355\u9875\u5e94\u7528\u7a0b\u5e8f (SPA)`\uff0c\u4e3b\u8981\u4f7f\u7528 `Web API` \u4e0e Web \u670d\u52a1\u5668\u901a\u4fe1\uff0c\u53ea\u6709\u4e00\u5f20Web\u9875\u9762\u7684\u5e94\u7528\uff0c\u662f\u4e00\u79cd\u4eceWeb\u670d\u52a1\u5668\u52a0\u8f7d\u7684\u5bcc\u5ba2\u6237\u7aef\uff0c\u5355\u9875\u9762\u8df3\u8f6c\u4ec5\u5237\u65b0\u5c40\u90e8\u8d44\u6e90 \uff0c\u516c\u5171\u8d44\u6e90(js\u3001css\u7b49)\u4ec5\u9700\u52a0\u8f7d\u4e00\u6b21\uff0c\u5e38\u7528\u4e8ePC\u7aef\u5b98\u7f51\u3001\u8d2d\u7269\u7b49\u7f51\u7ad9**\r\n\r\n![\u5355\u9875\u9762\u5e94\u7528\u7ed3\u6784](images/spa_page.jpg)\r\n\r\n\u6bd4\u55bb\u4e0b\uff1a\r\n\r\n**1. \u4f20\u7edfweb \u5c31\u50cf\u4e00\u90e8\u7eb8\u8d28\u7684\u4e66\uff0c\u4f60\u60f3\u8981\u770b\u65b0\u5185\u5bb9\uff0c\u5fc5\u987b\u624b\u52a8\u7ffb\u5230\u4e0b\u4e00\u9875\uff0c\u624d\u80fd\u770b\u5230\u65b0\u5185\u5bb9\uff0c\u4e0d\u540c\u9875\u627f\u8f7d\u4e0d\u540c\u4fe1\u606f\u5185\u5bb9**\r\n**2. SPA \u5c31\u50cf\u4f60\u7528\u624b\u673a\u770b\u7535\u5b50\u4e66\uff0c\u60f3\u770b\u65b0\u5185\u5bb9\u76f4\u63a5\u6ed1\u52a8\u4e00\u4e0b\u5c4f\u5e55\u5c31\u6709\u65b0\u5185\u5bb9\u66f4\u65b0\u4e86\uff0c\u81ea\u59cb\u81f3\u7ec8\u90fd\u662f\u4e00\u4e2a\u5c4f\u5e55\u4f5c\u4e3a\u4fe1\u606f\u8f7d\u4f53**\r\n\r\n\r\n\r\n### 2-5 \u4e3b\u6d41\u5f00\u53d1\u65b9\u5f0f\u5206\u6790\r\n\r\n`\u4f55\u65f6\u5e94\u4f7f\u7528\u4f20\u7edf Web \u5e94\u7528\u7a0b\u5e8f\uff1a`\r\n\r\n```\r\n 1. \u5e94\u7528\u7a0b\u5e8f\u7684\u5ba2\u6237\u7aef\u8981\u6c42\u7b80\u5355\uff0c\u751a\u81f3\u53ea\u8981\u6c42\u53ea\u8bfb\uff0c\u6ca1\u6709\u590d\u6742\u7684\u6216\u9891\u7e41\u7684\u4ea4\u4e92\u64cd\u4f5c\u3002\r\n 2. \u5e94\u7528\u7a0b\u5e8f\u9700\u5728\u4e0d\u652f\u6301 JavaScript \u7684\u6d4f\u89c8\u5668\u4e2d\u5de5\u4f5c\uff0c\u4ee5\u4fbf\u975e\u6d4f\u89c8\u5668\u5ba2\u6237\u7aef\u89e3\u6790\u3002\r\n 3. \u56e2\u961f\u4e0d\u719f\u6089 JavaScript \u6216 TypeScript \u7b49\u5f00\u53d1\u6280\u672f\uff0c\u4e0d\u9700\u8981\u524d\u7aef\u8fdb\u884c\u590d\u6742\u7684\u903b\u8f91\u5904\u7406\u3002\r\n 4. \u6ce8\u91cd SEO \u6392\u540d\uff0c\u9700\u8981\u5bf9\u641c\u7d22\u5f15\u64ce\u53cb\u597d\u3002\r\n```\r\n\r\n`\u4f55\u65f6\u5e94\u4f7f\u7528 SPA\uff1a`\r\n\r\n```\r\n1. \u5e94\u7528\u7a0b\u5e8f\u5fc5\u987b\u516c\u5f00\u5177\u6709\u8bb8\u591a\u529f\u80fd\u7684\u4e30\u5bcc\u7684\u7528\u6237\u754c\u9762\u3002\t\r\n \u539f\u56e0: \u56e0\u4e3a\u5355\u9875\u9762\u7684\u7ed3\u6784\u5b9e\u73b0\u8d77\u6765\u6d41\u7a0b\u6bd4\u8f83\u590d\u6742\uff0c\u5bf9\u4e8e\u7b80\u5355\u7684 web \u9875\u9762\u6839\u672c\u6beb\u65e0\u5fc5\u8981\uff0c\u4e3b\u8981\u96be\u70b9\u6709\u5982\u4e0b\u90e8\u5206:\r\n a.\u8d44\u6e90\u6587\u4ef6\u5904\u7406\uff1a \u9700\u5b9e\u73b0\u4ee3\u7801\u6587\u4ef6\u81ea\u52a8\u5316\u8bed\u6cd5\u68c0\u67e5\u3001\u6d4b\u8bd5\u3001\u538b\u7f29\u3001\u6df7\u80b4\uff0c\u8d44\u6e90\u6587\u4ef6\u5408\u5e76\uff0c\u5e76\u4fdd\u8bc1\u8fd9\u4e9b\u8d44\u6e90\u6587\u4ef6\u683c\u5f0f\u4e3a\u670d\u52a1\u5668\u8f6f\u4ef6\uff08LightTpd\uff09\u8bbe\u7f6e\u7684\u6587\u4ef6\u538b\u7f29\u683c\u5f0f\uff08BMC \u9700\u538b\u7f29\u4e3aGzip\uff09,\u6700\u540e\u5728\u751f\u4ea7\u73af\u5883\u4e0b\u80fd\u5b9e\u73b0\u6d4f\u89c8\u5668\u7aef\u53ea\u8bf7\u6c42\u4e00\u4e2aHtml\u6587\u4ef6\u5373\u53ef\u6b63\u5e38\u52a0\u8f7d\u6574\u4e2aweb,\u5e76\u80fd\u5b9e\u73b0\u5185\u5bb9\u4ea4\u4e92\u66f4\u65b0\u3002\r\n b.\u4ee3\u7801\u7ec4\u7ec7\u6846\u67b6: \u9700\u8981\u5b9e\u73b0\u8def\u7531\u4e8b\u4ef6\u76d1\u542c\u3001\u6a21\u5757\u5b9a\u4e49\u4e0e\u52a0\u8f7d\u7ba1\u7406\u3001API\u8ba4\u8bc1\u3001\u4f1a\u8bdd\u7ef4\u62a4\u3001\u6570\u636e\u6a21\u578b\u3001\u89c6\u56fe\u5207\u6362\u3001\u6a21\u677f\u52a0\u8f7d\u7b49\u65b9\u9762\uff0c\u5e76\u4e14\u8981\u4fdd\u8bc1\u529f\u80fd\u6a21\u5757\u4e0d\u4f1a\u76f8\u4e92\u5f71\u54cd\uff0c\u4e0d\u80fd\u9020\u6210\u8fd0\u884c\u65f6\u5185\u5b58\u6cc4\u6f0f\u5bfc\u81f4\u6d4f\u89c8\u5668\u5047\u6b7b\u6216\u5d29\u6e83\u7b49\u3002\r\n c.\u63d2\u4ef6\u4f9d\u8d56\uff1a\u9700\u8981\u89e3\u51b3\u65b0\u5f15\u5165\u7684\u5e93\u548c\u63d2\u4ef6\u7684\u5e95\u5c42\u4f9d\u8d56\u5173\u7cfb\uff0c\u4fdd\u8bc1\u5404\u63d2\u4ef6\u7248\u672c\u65e0\u51b2\u4e14\u4e0d\u4f1a\u5f15\u5165\u65b0\u95ee\u9898\uff0c\u5e76\u4e14\u80fd\u517c\u5bb9\u4e3b\u6d41\u6d4f\u89c8\u5668\u3002BMC WEB\u8981\u6c42\u652f\u6301IE11+\u3001Edge\u3001firefox\u3001Google Chome\r\n \td.\u5355\u5143\u6d4b\u8bd5:\u9700\u8981\u6743\u8861\u5f00\u53d1\u56e2\u961f\u6280\u672f\u6c34\u5e73\u548c\u9879\u76ee\u590d\u6742\u5ea6. BMC AMI\u57fa\u7840\u4ee3\u7801\u662f\u6709\u5355\u5143\u6d4b\u8bd5\u6846\u67b6\u7684\uff0c\u4f46\u6211\u4eec\u4e00\u822c\u6ca1\u4eba\u4f1a\u53bb\u5199\u5355\u5143\u6d4b\u8bd5\u3002\r\n \t\r\n2. \u56e2\u961f\u719f\u6089 JavaScript \u6216 TypeScript \u5f00\u53d1\u3002\r\n\t\u539f\u56e0: \u8fd9\u6837\u53ef\u4ee5\u628a\u66f4\u591a\u7684\u4e1a\u52a1\u903b\u8f91\u4ea4\u7ed9\u524d\u7aef\u8d1f\u8d23\u5904\u7406\uff0c\u51cf\u5c11\u540e\u7aef\u5f00\u53d1\u96be\u5ea6\uff0c\u4f7f\u5176\u66f4\u4e13\u6ce8\u4e8e\u63a5\u53e3\uff0c\u5e76\u4e14\u5927\u91cf\u7684\u4e1a\u52a1\u903b\u8f91\u4ea4\u7ed9\u524d\u7aef\uff0c\u53ef\u4ee5\u4f7f\u6d4f\u89c8\u5668\u5ba2\u6237\u7aef\u6709\u6548\u7684\u5206\u62c5\u4e1a\u52a1\u5904\u7406\u903b\u8f91\uff0c\u80fd\u6709\u6548\u51cf\u5c11\u670d\u52a1\u5668\u7aef\u8fd0\u884c\u65f6\u538b\u529b\u3002\u8fd9\u4e00\u70b9\u5bf9 BMC Web\u8fd9\u79cd\u8d44\u6e90\u6781\u5176\u6709\u9650\u7684\u73af\u5883\u76f8\u5f53\u91cd\u8981\u3002\r\n\r\n3. \u5e94\u7528\u7a0b\u5e8f\u5df2\u4e3a\u5176\u4ed6\uff08\u5185\u90e8\u6216\u516c\u5171\uff09\u5ba2\u6237\u7aef\u516c\u5f00 API\u3002\r\n\t\u539f\u56e0: Web API \u4e0d\u5e94\u8be5\u4ec5\u4ec5\u53ea\u8d1f\u8d23\u54cd\u5e94\u6d4f\u89c8\u5668\u7aef\u8bf7\u6c42\uff0c\u8fd8\u9700\u8981\u4e3a\u5f00\u53d1\u3001\u6d4b\u8bd5\u3001\u811a\u672c\u7b49\u81ea\u52a8\u5316\u5de5\u5177\u63d0\u4f9b\u8bf7\u6c42\u7684\u54cd\u5e94\u7ed3\u679c\uff0c\u4f20\u7edf web \u4e00\u822c\u63a5\u83b7\u53d6\u8bf7\u6c42\uff0c\u5728\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u6570\u636e\u540e\u76f4\u63a5\u6e32\u67d3\u5230\u5bf9\u5e94hml\u6587\u6863\u518d\u8fd4\u56de\u7ed9\u6d4f\u89c8\u5668\u7aef\u7684\uff0c\u8fd9\u6837\u5fc5\u7136\u65e0\u6cd5\u6ee1\u8db3\u5176\u4ed6\u975e\u6d4f\u89c8\u5668\u5ba2\u6237\u7aef\u89e3\u6790\u6570\u636e\u7684\u9700\u6c42\r\n\t\r\n4. web\u9875\u9762\u5185\u5bb9\u9700\u8981\u9891\u7e41\u4e0e\u540e\u7aef\u8fdb\u884c\u4ea4\u4e92\u540c\u6b65\r\n\t\u539f\u56e0\uff1a\u5355\u9875\u9762\u5e94\u7528\u7684\u6700\u91cd\u8981\u7684\u4f18\u52bf\u4e4b\u4e00\u5728\u4e8e, web api \u63a5\u53e3\u4f20\u8f93\u6570\u636e\u76f8\u6bd4\u4f20\u8f93 Html\u6587\u6863\uff0c\u53ef\u4ee5\u907f\u514d\u5927\u91cf\u8bf8\u5982html\u6807\u7b7e\u3001\u516c\u5171\u9759\u6001\u8d44\u6e90\u6587\u4ef6\u4f20\u8f93\u7b49\u975e\u5fc5\u8981\u7684\u5197\u4f59\u4fe1\u606f\uff0c\u53ef\u4ee5\u7528\u66f4\u5c11\u7684\u6570\u636e\u91cf\u627f\u8f7d\u66f4\u5927\u7684\u4fe1\u606f\u91cf\uff0c\u5f53\u5355\u4f4d\u65f6\u95f4\u5185 web \u9875\u9762\u5185\u5bb9\u4e0e\u540e\u7aef\u4ea4\u4e92\u8d8a\u591a\u65f6\uff0c\u8be5\u4f18\u52bf\u5c31\u8d8a\u660e\u663e\uff0c\u5982\u679c\u9875\u9762\u65e0\u52a8\u6001\u4ea4\u4e92\u9700\u6c42\uff0c\u5219\u65e0\u5fc5\u8981\u4f7f\u7528\u5355\u9875\u9762\u65b9\u5f0f\u5f00\u53d1\uff0c\u5f92\u589e\u5f00\u53d1\u96be\u5ea6\u3002\r\n\r\n```\r\n\r\n\u5177\u4f53\u5bf9\u6bd4\u5206\u6790\uff1a\r\n\r\n| | \u5355\u9875\u9762\u5e94\u7528\uff08SinglePage Web Application\uff0cSPA\uff09 | \u591a\u9875\u9762\u5e94\u7528\uff08MultiPage Application\uff0cMPA\uff09 |\r\n| :---------------: | ------------------------------------------------------------ | ------------------------------------------------------------ |\r\n| \u7ec4\u6210 | \u4e00\u4e2a\u5916\u58f3\u9875\u9762\u548c\u591a\u4e2a\u9875\u9762\u7247\u6bb5\u7ec4\u6210 | \u591a\u4e2a\u5b8c\u6574\u9875\u9762\u6784\u6210 |\r\n| \u8d44\u6e90\u5171\u7528(css,js) | \u5171\u7528\uff0c\u53ea\u9700\u5728\u5916\u58f3\u90e8\u5206\u52a0\u8f7d | \u4e0d\u5171\u7528\uff0c\u6bcf\u4e2a\u9875\u9762\u90fd\u9700\u8981\u52a0\u8f7d |\r\n| \u5237\u65b0\u65b9\u5f0f | \u9875\u9762\u5c40\u90e8\u5237\u65b0\u6216\u66f4\u6539 | \u6574\u9875\u5237\u65b0 |\r\n| url \u6a21\u5f0f | hash\u6a21\u5f0f\uff1a<br>a.com/#/pageone <br> a.com/#/pagetwo<br>`\u4e5f\u53ef\u4ee5\u914d\u7f6e\u6210history\u6a21\u5f0f\uff0c\u9700\u8981\u670d\u52a1\u7aef\u914d\u5408` | history\u6a21\u5f0f\uff1a<br>a.com/pageone.html <br>a.com/pagetwo.html |\r\n| \u7528\u6237\u4f53\u9a8c | \u9875\u9762\u7247\u6bb5\u95f4\u7684\u5207\u6362\u5feb\uff0c\u7528\u6237\u4f53\u9a8c\u826f\u597d | \u9875\u9762\u5207\u6362\u52a0\u8f7d\u7f13\u6162\uff0c\u6d41\u7545\u5ea6\u4e0d\u591f\uff0c\u7528\u6237\u4f53\u9a8c\u6bd4\u8f83\u5dee |\r\n| \u8f6c\u573a\u52a8\u753b | \u5bb9\u6613\u5b9e\u73b0 | \u65e0\u6cd5\u5b9e\u73b0 |\r\n| \u6570\u636e\u4f20\u9012 | \u5bb9\u6613 | \u4f9d\u8d56 url\u4f20\u53c2\u3001\u6216\u8005cookie \u3001localStorage\u7b49 |\r\n| \u641c\u7d22\u5f15\u64ce\u4f18\u5316(SEO) | \u9700\u8981\u5355\u72ec\u65b9\u6848\u3001\u5b9e\u73b0\u8f83\u4e3a\u56f0\u96be\u3001\u4e0d\u5229\u4e8eSEO\u68c0\u7d22 \u53ef\u5229\u7528\u670d\u52a1\u5668\u7aef\u6e32\u67d3(SSR)\u4f18\u5316 | \u5b9e\u73b0\u65b9\u6cd5\u7b80\u6613 |\r\n| \u8bd5\u7528\u8303\u56f4 | \u9ad8\u8981\u6c42\u7684\u4f53\u9a8c\u5ea6\u3001\u8ffd\u6c42\u754c\u9762\u6d41\u7545\u7684\u5e94\u7528 | \u9002\u7528\u4e8e\u8ffd\u6c42\u9ad8\u5ea6\u652f\u6301\u641c\u7d22\u5f15\u64ce\u7684\u5e94\u7528 |\r\n| \u5f00\u53d1\u6210\u672c | \u8f83\u9ad8\uff0c\u5e38\u9700\u501f\u52a9\u4e13\u4e1a\u7684\u6846\u67b6 | \u8f83\u4f4e \uff0c\u4f46\u9875\u9762\u91cd\u590d\u4ee3\u7801\u591a |\r\n| \u7ef4\u62a4\u6210\u672c | \u76f8\u5bf9\u5bb9\u6613 | \u76f8\u5bf9\u590d\u6742 |\r\n\r\n### 2-6 BMC Web \u7684\u5f00\u53d1\u65b9\u5f0f\r\n\r\nBMC Web \u867d\u7136\u9762\u5bf9\u4f7f\u7528\u7528\u6237\u6570\u91cf\u4e0d\u591a\uff0cweb \u670d\u52a1\u5668\u8d1f\u8f7d\u538b\u529b\u8981\u6c42\u4e5f\u4e0d\u5927\uff0c\u4f46\u662f\u6709\u5982\u4e0b\u51e0\u4e2a\u4e3b\u8981\u7279\u70b9\uff1a\r\n\r\n1. \u529f\u80fd\u7e41\u6742\uff0c\u4ece\u4e00\u7ea7\u529f\u80fd\u5206\u7c7b\u5411\u4e0b\u7ec6\u5206\uff0c\u6700\u591a\u53ef\u4ee5\u5148\u5411\u4e0b\u5206\u5230\u4e94\u7ea7\uff0c\u7528\u6237\u754c\u9762\u5f88\u4e30\u5bcc\u3002\r\n2. \u529f\u80fd\u6301\u7eed\u8fed\u4ee3\u66f4\u65b0\uff0c\u524d\u540e\u7aef\u9700\u8981\u9891\u7e41\u66f4\u6539\u3002\r\n3. \u5404\u4e2a\u529f\u80fd\u5f7c\u6b64\u72ec\u7acb\u3002\r\n4. \u57fa\u4e8e\u5d4c\u5165\u5f0f\u7cfb\u7edf\uff0c\u670d\u52a1\u7aef\u8d44\u6e90\u6781\u5176\u6709\u9650\u3002\r\n\r\n\u4e0a\u8ff0\u7279\u70b9\u4e5f\u6210\u4e3a\u4e86 BMC Web \u4ece\u5f88\u4e45\u524d\u7684\u4f20\u7edf Web \u5e94\u7528\u8fc7\u6e21\u5230\u73b0\u5728\u9009\u62e9 SPA \u5355\u9875\u9762\u5f00\u53d1\u65b9\u5f0f\u7684\u91cd\u8981\u51b3\u5b9a\u56e0\u7d20\r\n\r\n## 3. BMC SPA\u4ecb\u7ecd\r\n\r\n\u200b\t\t\u5355\u9875Web\u5e94\u7528\u548c\u524d\u7aef\u5de5\u7a0b\u5e08\u4eec\u606f\u606f\u76f8\u5173\uff0c\u56e0\u4e3a\u4e3b\u8981\u7684\u53d8\u9769\u53d1\u751f\u5728\u6d4f\u89c8\u5668\u7aef\uff0c\u7528\u5230\u7684\u6280\u672f\u5176\u5b9e\u8fd8\u662fHTML+CSS+JavaScript\uff0c\u6240\u6709\u7684\u6d4f\u89c8\u5668\u90fd\u539f\u751f\u652f\u6301\uff0c \u5355\u9875Web\u5e94\u7528\uff0c\u6d4f\u89c8\u5668\u4e00\u5f00\u59cb\u4f1a\u52a0\u8f7d\u5fc5\u9700\u7684HTML\u3001CSS\u548cJavaScript\uff0c\u4e4b\u540e\u6240\u6709\u7684\u64cd\u4f5c\u90fd\u5728\u8fd9\u5f20\u9875\u9762\u4e0a\u5b8c\u6210\uff0c\u8fd9\u4e00\u5207\u90fd\u7531JavaScript\u6765\u63a7\u5236\u3002\u56e0\u6b64\uff0c\u5355\u9875Web\u5e94\u7528\u4f1a\u5305\u542b\u5927\u91cf\u7684 JavaScript \u4ee3\u7801\uff0c\u590d\u6742\u5ea6\u53ef\u60f3\u800c\u77e5\uff0c\u6a21\u5757\u5316\u5f00\u53d1\u548c\u8bbe\u8ba1\u7684\u91cd\u8981\u6027\u4e0d\u8a00\u800c\u55bb.\u4e0b\u9762\u6309\u4ee5\u4e0b\u51e0\u4e2a\u90e8\u5206\u6765\u5206\u522b\u4ecb\u7ecd BMC Web\r\n\r\n### 3-1 \u4ee3\u7801\u7ec4\u7ec7\u67b6\u6784 \r\n\r\n\u200b\t SPA \u7684\u590d\u6742\u5ea6\uff0c\u51b3\u5b9a\u4e86\u5b83\u7684\u7ec4\u7ec7\u67b6\u6784\u7edd\u4e0d\u4ec5\u4ec5\u53ea\u5305\u542b\u4ee3\u7801\u4e1a\u52a1\u903b\u8f91\u90e8\u5206\uff0c\u8fd8\u9700\u8981\u4e00\u4e9b\u989d\u5916\u7684\u6b65\u9aa4\u5904\u7406\uff0cBMC \u524d\u7aef\u67b6\u6784\u6982\u62ec\u5982\u4e0b:\r\n\r\n**requireJS ** (\u63d0\u4f9bAMD\u6a21\u5757\u5f02\u6b65\u52a0\u8f7d\u65b9\u6cd5\u5b9e\u73b0) + **Backbone.js** (\u4e3aWeb\u5e94\u7528\u63d0\u4f9b MVC \u67b6\u6784\u7ec4\u7ec7\u6a21\u5f0f) + **\u7b2c\u4e09\u65b9\u63d2\u4ef6**(\u6269\u5c55\u7b2c\u4e09\u65b9\u529f\u80fd) + **\u4e1a\u52a1\u903b\u8f91\u4ee3\u7801**\uff08\u6211\u4eec\u81ea\u5df1\u7684\u4ee3\u7801\uff09 + **GruntJS**(\u4ee3\u7801\u81ea\u52a8\u5316\u4efb\u52a1\u6784\u5efa\u5de5\u5177)\r\n\r\n`\u6ce8\u610f\u6846\u67b6\u548c\u67b6\u6784\u7684\u533a\u522b\uff0cBMC web \u6784\u5efa\u4e25\u683c\u6765\u8bf4\u662f\u4e0d\u5b58\u5728\u6846\u67b6\u7684,\u4e00\u4e9b\u7a0d\u5fae\u719f\u6089BMC Web\u7684\u5de5\u7a0b\u5e08\u53ef\u80fd\u4f1a\u628a Backbone\u5f53\u4f5c\u6211\u4eec\u7684\u6846\u67b6\uff0c\u8fd9\u662f\u56e0\u4e3a\u4ed6\u4eec\u4ec5\u4ec5\u628a\u6ce8\u610f\u529b\u96c6\u4e2d\u5728\u4e1a\u52a1\u903b\u8f91\u4ee3\u7801\u4e0a\u9762,\u6240\u6709\u529f\u80fd\u4eff\u4f5b\u90fd\u8981\u6309\u7167Backbone\u7684\u5b9a\u4e49\u6a21\u5f0f\u6765\u5b9e\u73b0\u3002\u5176\u5b9eBackbone\u4ec5\u4ec5\u53ea\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684MVC JavaScript\u5e93\uff0c\u4e3a\u4e86\u7ec4\u7ec7\u6211\u4eec\u7684\u4e1a\u52a1\u903b\u8f91\u4ee3\u7801\uff0c\u8fd8\u9700\u8981\u5f15\u5165\u5f88\u591a\u6269\u5c55\u63d2\u4ef6\uff0c\u7528\u6765\u5b9e\u73b0\u8bf8\u5982\u89c6\u56fe\u7ba1\u7406\u3001\u6570\u636e\u9a8c\u8bc1\u3001\u9875\u9762\u5e03\u5c40\u3001css\u7ec4\u4ef6\u3001\u8bed\u8a00\u56fd\u9645\u5316\u7b49\u529f\u80fd`\r\n\r\n### [3-1-1.requireJS](https://requirejs.org/)\r\n\r\n#### \u4f5c\u7528\r\n\r\nRequireJS\u662f\u4f7f\u7528\u5f02\u6b65\u52a0\u8f7d\u6a21\u5f0f\u7684js\u6587\u4ef6\u6a21\u5757\u52a0\u8f7d\u5668\uff0c\u5b83\u7684\u6a21\u5757\u8bed\u6cd5\u5141\u8bb8\u5b83\u5c3d\u5feb\u5730\u52a0\u8f7d\u591a\u4e2a\u6a21\u5757\uff0c\u867d\u7136\u52a0\u8f7d\u7684\u987a\u5e8f\u4e0d\u5b9a\uff0c\u4f46\u4f9d\u8d56\u7684\u987a\u5e8f\u6700\u7ec8\u662f\u6b63\u786e\u7684\u3002\u540c\u65f6\u56e0\u4e3a\u65e0\u9700\u521b\u5efa\u5168\u5c40\u53d8\u91cf\uff0c\u751a\u81f3\u53ef\u4ee5\u505a\u5230\u5728\u540c\u4e00\u4e2a\u9875\u9762\u4e0a\u540c\u65f6\u52a0\u8f7d\u540c\u4e00\u6a21\u5757\u7684\u4e0d\u540c\u7248\u672c\u3002\r\n\r\n### `\u4f7f\u7528\u7684\u4e3b\u8981\u539f\u56e0`:\r\n\r\n1. \u901a\u8fc7\u6a21\u5757\u7684\u65b9\u5f0f\u5f15\u7528\u63d2\u4ef6\uff0c\u826f\u597d\u5730\u5b9a\u4e49\u4e86\u4e00\u4e2a\u4f5c\u7528\u57df\u6765\u907f\u514d\u5168\u5c40\u540d\u79f0\u7a7a\u95f4\u6c61\u67d3\r\n\r\n \u6bd4\u5982\u73b0\u5728 BackboneJS \u4f9d\u8d56jquery 1.2\u7248\u672c\uff0c\u73b0\u5728\u6709\u4e2a\u65b0\u7684\u6a21\u5757 module1 \u9700\u8981\u4f9d\u8d56jquery 3.6\u7248\u672c,\u6211\u4eec\u4f7f\u7528 RequireJS \u53ef\u4ee5\u5b9a\u4e49\u4e24\u4e2ajquery \u7248\u672c\u540d\u79f0 jquery1_2 \u3001jquery3_6,\u5728\u4e0d\u540c\u6a21\u5757\u5185\u5206\u522b\u5355\u72ec\u5f15\u7528\u4e0d\u540c\u7248\u672c\uff0c\u4e0e\u4f20\u7edf\u7684script\u6807\u7b7e\u4e00\u4e2a\u4e2a\u5f15\u7528js\u6587\u4ef6\u65b9\u5f0f\u76f8\u6bd4\uff0c\u907f\u514d\u4e86\u6c61\u67d3\u5168\u5c40\u540d\u79f0\u7a7a\u95f4jQuery,\u4f7f\u6211\u4eec\u7684\u6a21\u5757\u6b63\u5e38\u6267\u884c\r\n\r\n2. \u53ef\u4ee5\u65b9\u4fbf\u7684\u89e3\u51b3\u5f15\u7528\u6a21\u5757\u95f4\u7684\u4f9d\u8d56\u5173\u7cfb\u3002\u5e76\u4e14\u53ef\u4ee5\u5b9e\u73b0\u9875\u9762\u6a21\u5757\u6309\u9700\u52a0\u8f7d\uff0c\u53ea\u5728\u5f15\u7528\u65f6\u624d\u4f1a\u88ab\u8c03\u7528\uff0c\u8ba9Web\u9875\u9762\u54cd\u5e94\u66f4\u5feb\uff0c\u4f20\u7edfweb\u7684\u901a\u8fc7\u5185\u5d4c\u6587\u4ef6\u94fe\u63a5\u65b9\u5f0f\u52a0\u8f7d\u6587\u4ef6\uff0c\u4f1a\u8ba9\u963b\u585e\u7f51\u9875\u7684\u6e32\u67d3\uff0c\u5bfc\u81f4\u9875\u9762\u7a7a\u767d\u3002\r\n\r\n`\u9700\u8981\u6ce8\u610f\u7684\u662frequirejs\u7684\u6a21\u5757\u9700\u8981\u6a21\u5757\u7684\u5b9a\u4e49\u7b26\u5408 AMD(Asynchronous Module Definition) \u89c4\u8303,\u5982\u679c\u4e0d\u662f\u7b26\u5408AMD\u89c4\u8303\u7f16\u5199\u7684\u6a21\u5757\uff0c\u9700\u8981\u901a\u8fc7requireJS shim(\u57ab\u7247)\u51fd\u6570\u6765\u8fdb\u884c\u5f15\u5165`\r\n\r\n\r\n\r\n### \u7b80\u5355\u4f7f\u7528\u793a\u4f8b\uff1a\r\n\r\n\u6309\u7167\u5982\u4e0b\u6587\u4ef6\u7ed3\u6784\u548c\u5185\u5bb9\u5efa\u7acb\u6587\u4ef6\uff1a\r\n\r\n- www/\r\n - js\r\n - Lib_1.js\r\n - module1.js\r\n - libs \r\n - require.js\r\n - jquery.js\r\n - underscore.js\r\n - backbone.js\r\n- main.js\r\n - index.html\r\n\r\n#### index.html \r\n\r\n```html\r\n<!DOCTYPE html>\r\n<html>\r\n <head>\r\n <title>My Sample Project</title>\r\n <!-- data-main attribute tells require.js to load\r\n scripts/main.js after require.js loads. -->\r\n <script data-main=\"main\" src=\"lib/require.js\"></script>\r\n </head>\r\n <body>\r\n <h1>My Sample Project</h1>\r\n </body>\r\n</html>\r\n```\r\n\r\n#### main.js\r\n\r\n```js\r\nrequire.config({\r\n paths:{\r\n \"jQuery\": \"libs/jquery\",\r\n \"underscore\":'libs/underscore',\r\n \"backbone\":\"libs/backbone\",\r\n \t\"module1\":\"js/module1\"\r\n ...\r\n ... (\u63d2\u4ef6\u8def\u5f84\u5b9a\u4e49)\r\n },\r\n shim: {\r\n \"backbone\": {\r\n // \u5b9a\u4e49backbone\u7684\u4f9d\u8d56\u63d2\u4ef6\r\n deps: [\"jquery\", \"underscore\"],\r\n\r\n //\u4f7f\u7528 Backbone \u4f5c\u4e3a\u5168\u5c40\u8bbf\u95ee\u63a5\u53e3\r\n exports: \"Backbone\"\r\n },\r\n }\r\n\r\n})\r\nrequire(['module1','jQuery','underscore'\uff0c'backbone'], function (module1, $, _,Backbone ){\r\n module1.module_fun1();\r\n});\r\n\r\n```\r\n\r\n#### module1.js `(\u9700\u8981\u6309\u7167AMD\u89c4\u8303\u7f16\u5199\u6a21\u5757\u4ee3\u7801)`\r\n\r\n```js\r\ndefine(['jQuery'], function($){\r\n function module_fun1(){\r\n $('body').append(\"hello world!\");\r\n }\r\n\r\n})\r\n```\r\n\r\nAMD \u89c4\u8303\u6a21\u5757\u5b9a\u4e49\u65b9\u5f0f\u548c\u80cc\u666f\uff0c\u5177\u4f53\u53ef\u53c2\u8003\u8be5[\u6587\u7ae0](http://www.ruanyifeng.com/blog/2012/10/asynchronous_module_definition.html)\uff0c\u4e0d\u591a\u505a\u7ec6\u8ff0\u3002\r\n\r\n### [3-1-2.**Backbone.js** ](https://backbonejs.org/)\r\n\r\nBackbone \u4f9d\u8d56\u4e8eunderscore`(\u4e00\u4e2a\u7c7b\u5e93\uff0c\u63d0\u4f9b\u4e8660\u591a\u4e2a\u51fd\u6570\u5904\u7406\u6570\u7ec4\u64cd\u4f5c\u3001\u51fd\u6570\u7ed1\u5b9a\uff0c\u4ee5\u53cajavascript\u6a21\u677f\u673a\u5236)`\u3002\u5e38\u88ab\u7528\u6765\u5f00\u53d1\u5355\u9875\u7684\u4e92\u8054\u7f51\u5e94\u7528\u7a0b\u5e8f _*( [SPA<sup> 3 </sup>](https://baike.baidu.com/item/SPA/17536313) )*_\uff0c\u4ee5\u53ca`\u7528\u6765\u7ef4\u62a4\u7f51\u7edc\u5e94\u7528\u7a0b\u5e8f\u7684\u5404\u79cd\u90e8\u5206\u7684\u540c\u6b65(\u6bd4\u5982\u4fee\u6539\u7cfb\u7edf\u65f6\u95f4,\u4fee\u6539\u7528\u6237\u4fe1\u606f)`\u3002\r\n\r\n\u5176\u4e3a\u590d\u6742 Javascript \u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u6a21\u578b(models)\u3001\u96c6\u5408(collections)\u3001\u89c6\u56fe(views)\u7684\u7ed3\u6784 \u8fd9\u4e09\u4e2a\u90e8\u5206\u4e3a\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u7f16\u5199\u63d0\u4f9b\u4e86\u4ee3\u7801\u7ec4\u7ec7\u7684\u6700\u5c0f\u5355\u5143\u3002\u5176\u4e2d:\r\n\r\n- \u6a21\u578b *\uff08Medel\uff09* \u7528\u4e8e\u7ed1\u5b9a\u952e\u503c\u6570\u636e\u548c\u81ea\u5b9a\u4e49\u4e8b\u4ef6\uff1b\r\n\r\n- \u96c6\u5408 *\uff08Collection\uff09* \u9644\u6709\u53ef\u679a\u4e3e\u51fd\u6570\u7684\u4e30\u5bcc API\uff0c\u4e3aModel\u7684\u904d\u5386\u3001\u67e5\u8be2\u3001\u66f4\u6539\u63d0\u4f9b\u4e86\u5f88\u591a\u65b9\u4fbf\u7684\u65b9\u6cd5\uff1b \r\n\r\n- \u89c6\u56fe *\uff08View\uff09* \u53ef\u4ee5\u58f0\u660e\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\uff0c\u5e76\u901a\u8fc7 RESTful JSON \u63a5\u53e3\u8fde\u63a5\u5230\u5e94\u7528\u7a0b\u5e8f\uff1b\r\n\r\n- \u8def\u7531 *\uff08Router\uff09* \u8d1f\u8d23\u8bb0\u5f55\u7f51\u9875\u5386\u53f2\u8bb0\u5f55\u548c\u9875\u9762\u4e4b\u95f4\u7684\u5207\u6362\u8df3\u8f6c\uff1b\r\n\r\n \r\n\r\n\r\n#### Backbone.Model\uff08\u6a21\u578b\uff09\r\n\r\n**Models\uff08\u6a21\u578b\uff09**\u662f\u4efb\u4f55Javascript\u5e94\u7528\u7684\u6838\u5fc3\uff0c\u5305\u62ec\u6570\u636e\u4ea4\u4e92\u53ca\u4e0e\u5176\u76f8\u5173\u7684\u5927\u91cf\u903b\u8f91\uff1a \u8f6c\u6362\u3001\u9a8c\u8bc1\u3001\u8ba1\u7b97\u5c5e\u6027\u548c\u8bbf\u95ee\u63a7\u5236\u3002\u4f60\u53ef\u4ee5\u7528\u7279\u5b9a\u7684\u65b9\u6cd5\u6269\u5c55 **Backbone.Model**\uff0c**Model** \u4e5f\u63d0\u4f9b\u4e86\u4e00\u7ec4\u57fa\u672c\u7684\u7ba1\u7406\u53d8\u5316\u7684\u529f\u80fd\u3002\r\n\r\n\u4e0b\u9762\u7684\u793a\u4f8b\u6f14\u793a\u4e86\u5982\u4f55\u5b9a\u4e49\u4e00\u4e2a\u6a21\u578b\uff0c\u5305\u62ec\u81ea\u5b9a\u4e49\u65b9\u6cd5\u3001\u8bbe\u7f6e\u5c5e\u6027\u3001\u4ee5\u53ca\u89e6\u53d1\u8be5\u5c5e\u6027\u53d8\u5316\u7684\u4e8b\u4ef6\u3002\r\n\r\n\r\n\r\n```javascript\r\n//\u6a21\u578b\u5b9a\u4e49\r\nvar User = Backbone.Model.extend({\r\n\r\n defaults: {\r\n firstName: \"Lambert\",\r\n lastName: \"Lee\",\r\n },\r\n\r\n getFullName: function () {\r\n fullName = this.get(\"firstName\") + ' ' + this.get(\"lastName\");\r\n return fullName\r\n }\r\n});\r\n\r\nvar Admin = new User;\r\n\r\nconsole.log( Admin.getFullName()); // 1. \u8fd4\u56de:Lambert Lee\r\n\r\nAdmin.on('change:firstName change:lastName', function () {\r\n console.log(\"Change the fullName to \" + this.getFullName())\r\n});\r\n\r\nAdmin.set({ firstName: 'Suma' }); //2. \u5c06\u4f1a\u89e6\u53d1getFullName()\u51fd\u6570 \u8fd4\u56de:Suma Lee\r\n\r\nAdmin.set({ lastName: '\u4e2d\u79d1\u53ef\u63a7' }); //2. \u5c06\u4f1a\u89e6\u53d1getFullName()\u51fd\u6570 \u8fd4\u56de:Suma \u4e2d\u79d1\u53ef\u63a7\r\n\r\n```\r\n\r\nout:\r\n\r\n```\r\nLambert Lee\r\nChange the fullName to Suma Lee\r\nChange the fullName to Suma \u4e2d\u79d1\u53ef\u63a7\r\n```\r\n\r\n\r\n\r\n#### Backbone.Collection\uff08\u96c6\u5408\uff09\r\n\r\n\u96c6\u5408\u662f\u6a21\u578b\u7684\u6709\u5e8f\u7ec4\u5408\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u96c6\u5408\u4e0a\u7ed1\u5b9a `\"change\"` \u4e8b\u4ef6\uff0c\u4ece\u800c\u5f53\u96c6\u5408\u4e2d\u7684\u6a21\u578b\u53d1\u751f\u53d8\u5316\u65f6`fetch`\uff08\u83b7\u5f97\uff09\u901a\u77e5\uff0c\u96c6\u5408\u4e5f\u53ef\u4ee5\u76d1\u542c `\"add\"` \u548c `\"remove\"` \u4e8b\u4ef6\uff0c \u4ece\u670d\u52a1\u5668\u66f4\u65b0\uff0c\u5e76\u80fd\u4f7f\u7528 [Underscore.js](https://www.html.cn/doc/backbone/#Collection-Underscore-Methods) \u63d0\u4f9b\u7684\u65b9\u6cd5\u3002\r\n\r\n\u96c6\u5408\u4e2d\u7684\u6a21\u578b\u89e6\u53d1\u7684\u4efb\u4f55\u4e8b\u4ef6\u90fd\u53ef\u4ee5\u5728\u96c6\u5408\u8eab\u4e0a\u76f4\u63a5\u89e6\u53d1\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u76d1\u542c\u96c6\u5408\u4e2d\u6a21\u578b\u7684\u53d8\u5316\uff0c\u4e0b\u9762\u4ee3\u7801\u793a\u4f8b\u5c55\u793a\u96c6\u5408\u7684\u5b9a\u4e49\u4e0e\u4e8b\u4ef6\u76d1\u542c\u65b9\u6cd5\uff1a\r\n\r\n```js\r\n//\u5b9a\u4e49\r\nvar UserCollection = Backbone.Collection.extend({\r\n model: UserModel\r\n});\r\n \r\nuserList = new UserCollection([\r\n {firstName: \"Gilda\",lastName: \"Brook\",},\r\n {firstName: \"Duran\",lastName: \"Green \",},\r\n {firstName: \"Dye\",lastName: \"Sharp \",},\r\n {firstName: \"Earl\",lastName: \"Cotton \",}\r\n]);\r\nuserList.bind(\"add\", renderUserList,this); \r\nfuction renderUserList(model){\r\n console.log(\"add new user, firstName is \"+ model.get('firstName'));\r\n}\r\n\r\nvar newUser = new UserModel({\r\n firstName:\"Lambert\",\r\n lastName:\"Lee\"\r\n});\r\nuserList.add(newUser);\r\n```\r\n\r\nout:\r\n\r\n```js\r\nadd new user, firstName is Lambert\r\n```\r\n\r\n\r\n\r\n#### Backbone.view\uff08\u89c6\u56fe\uff09\r\n\r\nBackbone \u5bf9Model\u548cCollection\u4e2d\u7684\u6570\u636e\u8fdb\u884c\u5c55\u793a\uff0c\u628a\u6570\u636e\u6e32\u67d3\u5230\u9875\u9762\u4e0a\r\n\r\n\u4ee3\u7801\u793a\u4f8b:\r\n\r\n```js\r\nvar userItemView = Backbone.View.extend({\r\n el:$(\"#model_template\"),\r\n template: _.template(userItemTemplate),\r\n\r\n initialize: function() {\r\n \r\n this.model = new UserModel;\r\n this.model.bind('change', this.updateUserItemView,this);\r\n\r\n this.render();\r\n\r\n },\r\n\r\n render: function() {\r\n console.log(this.model.get(\"firstName\")+this.model.get(\"lastName\"))\r\n },\r\n });\r\n\r\nvar userinfoView = new userItemView();\r\n```\r\n\r\n\r\n\r\nout:\r\n\r\n```js\r\nLambert Lee\r\n```\r\n\r\n\r\n\r\n#### Backbone.Router\uff08\u524d\u7aef\u8def\u7531\uff09\r\n\r\n\u4e0a\u9762\u7684\u89c6\u56fe\u5c06\u4f1a\u63d0\u53d6\u6a21\u578b\u3001\u96c6\u5408\u4e2d\u7684\u6570\u636e\u8fdb\u884c\u5c55\u793a\uff0c\u628a\u6570\u636e\u6e32\u67d3\u5230\u9875\u9762\u4e0a\uff0c\u57fa\u672c\u90fd\u5c5e\u4e8e\u9759\u6001\u6e32\u67d3\u90e8\u5206\u3002\u524d\u7aef\u9875\u9762\u4e4b\u6240\u4ee5\u53ef\u4ee5\u7075\u6d3b\u7684\u52a8\u6001\u5207\u6362\u5c55\u793a\u5185\u5bb9\uff0c\u5c31\u662f\u901a\u8fc7 Router \u8fdb\u884c\u63a7\u5236\u8c03\u7528\u6e32\u67d3\u51fd\u6570\uff0c\u5b9e\u73b0\u52a8\u6001\u66f4\u65b0\u9875\u9762\u5185\u5bb9\u6548\u679c\u3002\u6240\u4ee5\u8bf4\u524d\u7aef\u8def\u7531\u57fa\u672c\u5c31\u5b9a\u4e49\u4e86Web\u663e\u793a\u5185\u5bb9\u7684\u7ed3\u6784\u3002\u8ba4\u8bc6 SPA \u7684\u5185\u5bb9\u548c\u7ec4\u7ec7\u7ed3\u6784\uff0c\u53ef\u4ee5\u4ece\u524d\u7aef\u8def\u7531\u5165\u624b\uff0c\u5b83\u5c31\u50cf\u4e00\u672c\u4e66\u7684\u7d22\u5f15\u76ee\u5f55\u3002\r\n\r\n**\u4ee3\u7801\u793a\u4f8b**\r\n\r\n```js\r\nvar AppRouter = Backbone.Router.extend({\r\n\r\n routes: {\r\n \"user/:id\" : \"showUserModelInfo\",\r\n \"users\": \"showUserCollectionInfo\",\r\n \"router\":\"showRouterDemo\",\r\n \"\":\"showUserModelInfo\",\r\n },\r\n showUserModelInfo: function(id) {\r\n // alert(id);\r\n $(\"#Model\").css(\"display\",\"block\");\r\n $(\"#Collection\").css(\"display\",\"none\");\r\n\r\n },\r\n showUserCollectionInfo: function() {\r\n $(\"#Model\").css(\"display\",\"none\");\r\n $(\"#Collection\").css(\"display\",\"block\");\r\n },\r\n\r\n showRouterDemo:function(){\r\n console.log(\"showRouterDemo\");\r\n },\r\n});\r\n\r\nvar app_router = new AppRouter;\r\nBackbone.history.start();\r\n\r\n```\r\n\r\nout:\r\n\r\n```\r\n\u70b9\u51fb\u94fe\u63a5 <a href=\"#/user/:id\">user Detail Info</a> \r\n\u5c06\u4f1a\u8f93\u51fa \u8def\u7531\u4f20\u5165\u7684id\u503c\r\n\r\n\u70b9\u51fb\u94fe\u63a5 <a href=\"#/users>userList Info</a>\r\n\u5c06\u4f1a\u8f93\u51fa \u201cusers\u201d\t\t\r\n```\r\n\r\n\u901a\u8fc7Backbone\uff0c\u4f60\u53ef\u4ee5\u628a\u4f60\u7684\u6570\u636e\u5f53\u4f5cModel\u548cCollection\uff0c\u901a\u8fc7 Model \u3001Collection\u4f60\u53ef\u4ee5\u521b\u5efa\u6570\u636e\uff0c\u8fdb\u884c\u6570\u636e\u9a8c\u8bc1\uff0c\u9500\u6bc1\u6216\u8005\u4fdd\u5b58\u5230\u670d\u52a1\u5668\u4e0a\u3002\u5f53\u754c\u9762\u4e0a\u7684\u64cd\u4f5c\u5f15\u8d77model\u4e2d\u5c5e\u6027\u7684\u53d8\u5316\u65f6\uff0cmodel\u4f1a\u89e6\u53d1change\u7684\u4e8b\u4ef6\u3002\u90a3\u4e9b\u7528\u6765\u663e\u793amodel\u72b6\u6001\u7684views\u4f1a\u63a5\u53d7\u5230model\u89e6\u53d1change\u7684\u6d88\u606f\uff0c\u8fdb\u800c\u53d1\u51fa\u5bf9\u5e94\u7684\u54cd\u5e94\uff0c\u5e76\u4e14\u91cd\u65b0\u6e32\u67d3\u65b0\u7684\u6570\u636e\u5230\u754c\u9762\u3002\u5728\u4e00\u4e2a\u5b8c\u6574\u7684Backbone\u5e94\u7528\u4e2d\uff0c\u4f60\u4e0d\u9700\u8981\u5199\u90a3\u4e9b\u80f6\u6c34\u4ee3\u7801\u6765\u4eceDOM\u4e2d\u901a\u8fc7\u7279\u6b8a\u7684id\u6765\u83b7\u53d6\u8282\u70b9\uff0c\u6216\u8005\u624b\u5de5\u7684\u66f4\u65b0HTML\u9875\u9762\uff0c\u56e0\u4e3a\u5728model\u53d1\u751f\u53d8\u5316\u65f6\uff0cviews\u4f1a\u5f88\u7b80\u5355\u7684\u8fdb\u884c\u81ea\u6211\u66f4\u65b0\u3002`\u8be6\u7ec6\u4e86\u89e3\u8bf7\u81ea\u884c\u53c2\u8003\u5b98\u65b9\u6587\u6863\u3002`\r\n\r\n### 3-1-2-3 \u5f02\u6b65\u901a\u4fe1\u539f\u7406\r\n\r\n\u4e0a\u9762\u4ecb\u7ecd\u4e86Backbone \u7684\u524d\u7aef\u9875\u9762\u6e32\u67d3\u90e8\u5206\u5982\u4f55\u7ec4\u7ec7\u5206\u5de5\uff0c\u73b0\u5728\u4ecb\u7ecd\u4e0b \u524d\u7aef\u4e0e\u540e\u7aef\u5982\u4f55\u8fdb\u884c\u52a8\u6001\u6570\u636e\u4ea4\u4e92\uff0c\u4ee5\u83b7\u5f97\u6700\u65b0\u7684\u670d\u52a1\u7aef\u4fe1\u606f\u548c\u63d0\u4ea4\u5ba2\u6237\u7aef\u6570\u636e\u5230\u670d\u52a1\u7aef\u5b58\u50a8\u3002\r\n\r\n\u200b\tBMC Web\u4e0e\u540e\u7aef\u901a\u4fe1\u6709\u4e24\u79cd\u65b9\u5f0f\uff1a\r\n\r\n1. [Ajax \u8f6e\u8be2](https://developer.mozilla.org/zh-CN/docs/Web/Guide/AJAX)\r\n\r\n AJAX\u4e0d\u662fJavaScript\u7684\u89c4\u8303\uff0c\u5b83\u662fAsynchronous JavaScript and XML\u7684\u7f29\u5199\uff0c\u610f\u601d\u5c31\u662f\u7528JavaScript\u6267\u884c\u5f02\u6b65\u7f51\u7edc\u8bf7\u6c42\u3002\r\n\r\n \u5982\u679c\u4ed4\u7ec6\u89c2\u5bdf\u4e00\u4e2aForm\u7684\u63d0\u4ea4\uff0c\u4f60\u5c31\u4f1a\u53d1\u73b0\uff0c\u4e00\u65e6\u7528\u6237\u70b9\u51fb\u201cSubmit\u201d\u6309\u94ae\uff0c\u8868\u5355\u5f00\u59cb\u63d0\u4ea4\uff0c\u6d4f\u89c8\u5668\u5c31\u4f1a\u5237\u65b0\u9875\u9762\uff0c\u7136\u540e\u5728\u65b0\u9875\u9762\u91cc\u544a\u8bc9\u4f60\u64cd\u4f5c\u662f\u6210\u529f\u4e86\u8fd8\u662f\u5931\u8d25\u4e86\u3002\u5982\u679c\u4e0d\u5e78\u7531\u4e8e\u7f51\u7edc\u592a\u6162\u6216\u8005\u5176\u4ed6\u539f\u56e0\uff0c\u5c31\u4f1a\u5f97\u5230\u4e00\u4e2a404\u9875\u9762\u3002\u8fd9\u5c31\u662f**Web\u7684\u8fd0\u4f5c\u539f\u7406\uff1a\u4e00\u6b21HTTP\u8bf7\u6c42\u5bf9\u5e94\u4e00\u4e2a\u9875\u9762`(\u8fd9\u662f\u5f88\u4e45\u524d\u7684\u6982\u5ff5\u4e86\uff0c\u6309\u73b0\u5728\u7684\u7528\u9014\uff0c\u4e00\u6b21HTTP\u8bf7\u6c42\u5bf9\u5e94\u4e00\u4e2a\u8d44\u6e90\u66f4\u6b63\u786e)\u3002`**\r\n\r\n \u5982\u679c\u8981\u8ba9\u7528\u6237\u7559\u5728\u5f53\u524d\u9875\u9762\u4e2d\uff0c\u540c\u65f6\u53d1\u51fa\u65b0\u7684HTTP\u8bf7\u6c42\uff0c\u5c31\u5fc5\u987b\u7528 JavaScript \u53d1\u9001\u8fd9\u4e2a\u65b0\u8bf7\u6c42\uff0c\u63a5\u6536\u5230\u6570\u636e\u540e\uff0c\u518d\u7528JavaScript\u66f4\u65b0\u9875\u9762\uff0c\u8fd9\u6837\u4e00\u6765\uff0c\u7528\u6237\u5c31\u611f\u89c9\u81ea\u5df1\u4ecd\u7136\u505c\u7559\u5728\u5f53\u524d\u9875\u9762\uff0c\u4f46\u662f\u6570\u636e\u5374\u53ef\u4ee5\u4e0d\u65ad\u5730\u66f4\u65b0\u3002\r\n\r\n [`XMLHttpRequest` API ](https://developer.mozilla.org/zh-CN/docs/Web/API/XMLHttpRequest) \u662fAjax\u7684\u6838\u5fc3\u3002\u5177\u4f53\u4f7f\u7528\u65b9\u6cd5\u8bf7\u53c2\u8003 [jquery ajax](https://www.w3school.com.cn/jquery/ajax_ajax.asp) \u4f7f\u7528\u65b9\u6cd5\uff0c\u548c [Backbone Model Collection\u5173\u4e8e\u6570\u636e\u540c\u6b65](https://www.html.cn/doc/backbone/#Model-sync) \u7684\u4ecb\u7ecd\uff0c\u7bc7\u5e45\u6240\u9650\uff0c\u4e0d\u505a\u8be6\u89e3\u3002\r\n\r\n `\u9700\u8981\u6ce8\u610f\u7684\u662f Ajax \u672c\u8d28\u4e0a\u8fd8\u662f\u53d1\u9001Http\u8bf7\u6c42\uff0c\u800cHttp\u534f\u8bae\u662f \u8bf7\u6c42-\u5e94\u7b54 \u6a21\u5f0f\uff0c\u4e5f\u5c31\u662f\u8bf4\u53ea\u80fd\u7531\u5ba2\u6237\u7aef\u4e3b\u52a8\u53d1\u8d77\uff0c\u65e0\u6cd5\u5b9e\u65f6\u4e0e\u670d\u52a1\u5668\u72b6\u6001\u540c\u6b65\uff0c\u56e0\u6b64\u4e3a\u4e86\u66f4\u65b0 Web \u9875\u9762\u663e\u793a\u5185\u5bb9\uff0c\u6211\u4eec\u5e38\u5e38\u4f1a\u4f7f\u7528\u8f6e\u8be2\u7684\u65b9\u6cd5\u53bb\u8bf7\u6c42\u6700\u65b0\u7684\u670d\u52a1\u5668\u72b6\u6001\uff0c\u8fd9\u6837\u5f53\u670d\u52a1\u5668\u6ca1\u6709\u66f4\u65b0\u65f6\uff0c\u5c31\u4f1a\u9020\u6210\u4e0d\u5fc5\u8981\u7684\u8d44\u6e90\u6d6a\u8d39,\u4f46\u5176\u6548\u7387\u548c\u4f7f\u7528\u4f53\u9a8c\u5df2\u7ecf\u6bd4\u4f20\u7edf\u7684\u591a\u9875\u9762\u5e94\u7528\u524d\u8fdb\u4e00\u5927\u6b65\u4e86`\r\n\r\n2. [Websocket\u534f\u8bae](https://zh.wikipedia.org/wiki/WebSocket)\r\n\r\n WebSocket \u662f\u4e00\u79cd\u5728\u5ba2\u6237\u7aef\u4e0e [\u670d\u52a1\u5668](https://developer.mozilla.org/en-US/docs/Glossary/Server) \u4e4b\u95f4\u4fdd\u6301 [TCP](https://developer.mozilla.org/en-US/docs/Glossary/TCP) \u957f\u8fde\u63a5\u7684 [\u7f51\u7edc\u534f\u8bae](https://developer.mozilla.org/en-US/docs/Glossary/protocol) \uff0c\u8fd9\u6837\u5b83\u4eec\u5c31\u53ef\u4ee5\u968f\u65f6\u8fdb\u884c\u4fe1\u606f\u4ea4\u6362\u3002\r\n\r\n \u867d\u7136\u4efb\u4f55\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u5668\u4e0a\u7684\u5e94\u7528\u90fd\u53ef\u4ee5\u4f7f\u7528WebSocket\uff0c\u4f46\u539f\u5219\u4e0a\u8fd8\u662f\u6307 [\u6d4f\u89c8\u5668](https://developer.mozilla.org/en-US/docs/Glossary/Browser) \u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u4f7f\u7528\u3002\u901a\u8fc7WebSocket\uff0c\u670d\u52a1\u5668\u53ef\u4ee5\u76f4\u63a5\u5411\u5ba2\u6237\u7aef\u53d1\u9001\u6570\u636e\uff0c\u800c\u65e0\u987b\u5ba2\u6237\u7aef\u5468\u671f\u6027\u7684\u8bf7\u6c42\u670d\u52a1\u5668\uff0c\u4ee5\u52a8\u6001\u66f4\u65b0\u6570\u636e\u5185\u5bb9\u3002\r\n\r\n BMC \u7684 H5KVM \u5c31\u662f\u57fa\u4e8eWebsocket\u534f\u8bae\u8fdb\u884c\u901a\u4fe1\u7684\uff0c\u6bd4\u5982\u8fdc\u7a0b\u67e5\u770b\u4e3b\u673a\uff0c\u5c4f\u5e55\u72b6\u6001\u540c\u6b65\u65f6\u95f4\u57fa\u672c\u53ea\u5b58\u5728\u7f51\u7edc\u5ef6\u65f6\u65f6\u5dee\u3002 \r\n\r\n **\u53ef\u63a7BMC Web\u5f00\u53d1\u529f\u80fd\u4e2d\uff0c\u6211\u4eec Web API \u5927\u591a\u90fd\u53ea\u7528\u5230 Ajax \u901a\u4fe1\u65b9\u6cd5\uff0c\u540e\u7aef\u8d1f\u8d23\u7f16\u5199\u5b9e\u73b0\u7684\u8d44\u6e90\u63a5\u53e3\u8bf7\u6c42\u65b9\u6cd5\uff0c\u5e76\u5b9a\u4e49\u8fd4\u56de\u8d44\u6e90\u7684\u4fe1\u606f\u683c\u5f0f\uff0c\u524d\u7aef\u9700\u8981\u6839\u636e\u7ea6\u5b9a\u7684\u63a5\u53e3\uff0c\u4f7f\u7528\u5bf9\u5e94\u7684\u8bf7\u6c42\u65b9\u6cd5\u5e76\u63d0\u4f9b\u8bf7\u6c42\u53c2\u6570\uff0c\u83b7\u53d6\u8d44\u6e90\u5e76\u6e32\u67d3\u5230\u6d4f\u89c8\u5668\u7a97\u53e3\u3002\u4e0b\u9762\u91cd\u70b9\u4ecb\u7ecd\u6211\u4eec\u7684API \u5b9a\u4e49\u89c4\u8303\uff0c\u4ee5\u65b9\u4fbf\u524d\u540e\u7aef\u4eba\u5458\u51cf\u5c11\u6c9f\u901a\u6210\u672c **\r\n\r\n### 3-1-2-4 Restful Api\r\n\r\n#### 3-1-2-4-1 \u6982\u5ff5\r\n\r\n\u200b\t**\u8868\u73b0\u5c42\u72b6\u6001\u8f6c\u6362**\uff08[\u82f1\u8bed](https://zh.wikipedia.org/wiki/\u82f1\u8bed)\uff1a**Representational State Transfer**\uff0c[\u7f29\u5199](https://zh.wikipedia.org/wiki/\u7e2e\u5beb)\uff1a**REST**\uff09\u662f[Roy Thomas Fielding](https://zh.wikipedia.org/w/index.php?title=Roy_Thomas_Fielding&action=edit&redlink=1)\u535a\u58eb\u4e8e2000\u5e74\u5728\u4ed6\u7684\u535a\u58eb\u8bba\u6587[[1\\]](https://zh.wikipedia.org/wiki/\u8868\u73b0\u5c42\u72b6\u6001\u8f6c\u6362#cite_note-Fielding-Ch5-1)\u4e2d\u63d0\u51fa\u6765\u7684\u4e00\u79cd[\u4e07\u7ef4\u7f51](https://zh.wikipedia.org/wiki/\u4e07\u7ef4\u7f51)[\u8f6f\u4ef6\u67b6\u6784](https://zh.wikipedia.org/wiki/\u8f6f\u4ef6\u67b6\u6784)\u98ce\u683c\uff0c\u76ee\u7684\u662f\u4fbf\u4e8e\u4e0d\u540c\u8f6f\u4ef6/\u7a0b\u5e8f\u5728\u7f51\u7edc\uff08\u4f8b\u5982\u4e92\u8054\u7f51\uff09\u4e2d\u4e92\u76f8\u4f20\u9012\u4fe1\u606f\u3002\r\n\r\n\u8868\u73b0\u5c42\u72b6\u6001\u8f6c\u6362\u662f\u6839\u57fa\u4e8e[\u8d85\u6587\u672c\u4f20\u8f93\u534f\u8bae(HTTP)](https://zh.wikipedia.org/wiki/\u8d85\u6587\u672c\u4f20\u8f93\u534f\u8bae)\u4e4b\u4e0a\u800c\u786e\u5b9a\u7684\u4e00\u7ec4**\u7ea6\u675f**\u548c**\u5c5e\u6027**\uff0c\u662f\u4e00\u79cd\u8bbe\u8ba1\u63d0\u4f9b\u4e07\u7ef4\u7f51\u7edc\u670d\u52a1\u7684[\u8f6f\u4ef6\u6784\u5efa\u98ce\u683c](https://zh.wikipedia.org/wiki/\u8edf\u4ef6\u67b6\u69cb)\u3002\u7b26\u5408\u6216\u517c\u5bb9\u4e8e\u8fd9\u79cd\u67b6\u6784\u98ce\u683c(\u7b80\u79f0\u4e3a REST \u6216 RESTful)\u7684\u7f51\u7edc\u670d\u52a1\uff0c\u5141\u8bb8\u5ba2\u6237\u7aef\u53d1\u51fa\u4ee5[URI (\u7edf\u4e00\u8d44\u6e90\u6807\u8bc6\u7b26)](https://zh.wikipedia.org/wiki/\u7edf\u4e00\u8d44\u6e90\u6807\u5fd7\u7b26)\u8bbf\u95ee\u548c\u64cd\u4f5c\u7f51\u7edc\u8d44\u6e90\u7684\u8bf7\u6c42\uff0c\u800c\u4e0e\u9884\u5148\u5b9a\u4e49\u597d\u7684\u65e0\u72b6\u6001\u64cd\u4f5c\u96c6\u4e00\u81f4\u5316\u3002\u56e0\u6b64\u8868\u73b0\u5c42\u72b6\u6001\u8f6c\u6362\u63d0\u4f9b\u4e86\u5728\u4e92\u8054\u7f51\u7edc\u7684\u8ba1\u7b97\u7cfb\u7edf\u4e4b\u95f4\uff0c\u5f7c\u6b64\u8d44\u6e90\u53ef\u4ea4\u4e92\u4f7f\u7528\u7684\u534f\u4f5c\u6027\u8d28(interoperability)\u3002\r\n\r\n\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0cREST\u662f**\u8bbe\u8ba1\u98ce\u683c\u7ea6\u5b9a**\u800c\u4e0d\u662f**\u6807\u51c6**\u3002REST\u901a\u5e38\u57fa\u4e8e\u4f7f\u7528[HTTP](https://zh.wikipedia.org/wiki/HTTP)\uff0c[URI](https://zh.wikipedia.org/wiki/URI)\uff0c\u548c[XML](https://zh.wikipedia.org/wiki/XML)\u4ee5\u53ca[HTML](https://zh.wikipedia.org/wiki/HTML)\u8fd9\u4e9b\u73b0\u6709\u7684\u5e7f\u6cdb\u6d41\u884c\u7684\u534f\u8bae\u548c\u6807\u51c6\u3002\r\n\r\n\r\n\r\n#### 3-1-2-4-2 \u8d44\u6e90\u8868\u73b0\u5f62\u5f0f\r\n\r\n1. \u8d44\u6e90\u662f\u7531URI\u6765\u6307\u5b9a\u3002\r\n\r\n2. \u5bf9\u8d44\u6e90\u7684\u64cd\u4f5c\u5305\u62ec\u83b7\u53d6\u3001\u521b\u5efa\u3001\u4fee\u6539\u548c\u5220\u9664\u8d44\u6e90\uff0c\u8fd9\u4e9b\u64cd\u4f5c\u6b63\u597d\u5bf9\u5e94HTTP\u534f\u8bae\u63d0\u4f9b\u7684GET\u3001POST\u3001PUT\u548cDELETE\u65b9\u6cd5\u3002\uff08**\u76ee\u524dBMC \u57fa\u7840\u4ee3\u7801\u4e2d\u5df2\u7ecf\u5220\u9664\u6389PUT\u65b9\u6cd5\uff0c\u6539\u4e3a\u4f7f\u7528POST**\uff0c`\u539f\u56e0\u662f\u4e3a\u4e86\u6ee1\u8db3\u56fd\u7f51\u5ba2\u5236\u5316\u9879\u76ee\u5b89\u5168\u626b\u63cf\u6d4b\u8bd5\uff0c\u5176\u5b9e\u5b8c\u5168\u6ca1\u6709\u5fc5\u8981`\uff09\r\n\r\n3. \u901a\u8fc7\u64cd\u4f5c\u8d44\u6e90\u7684\u8868\u73b0\u5f62\u5f0f\u6765\u64cd\u4f5c\u8d44\u6e90\u3002\uff08 \u52a8\u8bcd + \u5bbe\u8bed \u5f62\u5f0f\uff09\r\n\r\n \u52a8\u8bcd\uff1a \u5e38\u7528\u7684HTTP\u52a8\u8bcd\u6709\u4e0b\u9762\u4e94\u4e2a\uff08\u62ec\u53f7\u91cc\u662f\u5bf9\u5e94\u7684SQL\u547d\u4ee4\uff09\u3002\r\n\r\n> - GET\uff08SELECT\uff09\uff1a\u4ece\u670d\u52a1\u5668\u53d6\u51fa\u8d44\u6e90\uff08\u4e00\u9879\u6216\u591a\u9879\uff09\u3002\r\n>\r\n> - POST\uff08CREATE\uff09\uff1a\u5728\u670d\u52a1\u5668\u65b0\u5efa\u4e00\u4e2a\u8d44\u6e90\u3002\r\n>\r\n> - PUT\uff08UPDATE\uff09\uff1a\u5728\u670d\u52a1\u5668\u66f4\u65b0\u8d44\u6e90\uff08\u5ba2\u6237\u7aef\u63d0\u4f9b\u6539\u53d8\u540e\u7684\u5b8c\u6574\u8d44\u6e90\uff09\u3002\r\n>\r\n> - PATCH\uff08UPDATE\uff09\uff1a\u5728\u670d\u52a1\u5668\u66f4\u65b0\u8d44\u6e90\uff08\u5ba2\u6237\u7aef\u63d0\u4f9b\u6539\u53d8\u7684\u5c5e\u6027\uff09\u3002\r\n>\r\n> - DELETE\uff08DELETE\uff09\uff1a\u4ece\u670d\u52a1\u5668\u5220\u9664\u8d44\u6e90\u3002\r\n>\r\n> \r\n\r\n \u8fd8\u6709\u4e24\u4e2a\u4e0d\u5e38\u7528\u7684HTTP\u52a8\u8bcd\u3002\r\n\r\n > - HEAD\uff1a\u83b7\u53d6\u8d44\u6e90\u7684\u5143\u6570\u636e\u3002\r\n > - OPTIONS\uff1a\u83b7\u53d6\u4fe1\u606f\uff0c\u5173\u4e8e\u8d44\u6e90\u7684\u54ea\u4e9b\u5c5e\u6027\u662f\u5ba2\u6237\u7aef\u53ef\u4ee5\u6539\u53d8\u7684\u3002\r\n\r\n \u4e0b\u9762\u662f\u4e00\u4e9b\u4f8b\u5b50\u3002\r\n\r\n| \u52a8\u4f5c | Http Method | URI | \u53c2\u6570 | \u5bf9\u5e94\u7684Backbone\u65b9\u6cd5 |\r\n| --------- | ----------- | ------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |\r\n| \u5220\u9664\u7528\u62371 | Delete | https://10.0.22.63/api/users/1 | Null | destroy |\r\n| \u6dfb\u52a0\u7528\u62371 | POST | https://10.0.22.63/api/users/1 | {<br/> id:1<br/> name: \"lambert\",<br/> groups: \u201cBMC\u201d,<br/>privilege:\"Admin\" <br/> } | **save**\uff08\u5982\u679c\u6a21\u578b\u7b2c\u4e00\u6b21\u521b\u5efa\uff0c\u5219\u5728\u670d\u52a1\u5668\u7aef\u5c06\u4f1a\u91c7\u7528`create`\u65b9\u6cd5\u5373 HTTP POST\uff09 |\r\n| \u4fee\u6539\u7528\u62371 | PUT | https://10.0.22.63/api/users/1 | {groups:\"BIOS\"} | **save**\uff08\u5982\u679c\u6a21\u578b\u5728\u670d\u52a1\u5668\u7aef\u5df2\u5b58\u5728\uff0c\u5219\u5728\u670d\u52a1\u5668\u7aef\u5c06\u4f1a\u91c7\u7528`update`\u65b9\u6cd5\u5373 HTTP PUT\uff09 |\r\n| \u67e5\u8be2\u7528\u62371 | GET | https://10.0.22.63/api/users/1 | Null | **fetch** |\r\n\r\n- \u8d44\u6e90\u7684\u8868\u73b0\u5f62\u5f0f\u5219\u662fXML\u6216\u8005HTML\uff0c\u53d6\u51b3\u4e8e\u8bfb\u8005\u662f\u673a\u5668\u8fd8\u662f\u4eba\uff0c\u662f\u6d88\u8d39web\u670d\u52a1\u7684\u5ba2\u6237\u8f6f\u4ef6\u8fd8\u662fweb\u6d4f\u89c8\u5668\u3002\u5f53\u7136\u4e5f\u53ef\u4ee5\u662f\u4efb\u4f55\u5176\u4ed6\u7684\u683c\u5f0f\uff0c\u4f8b\u5982JSON\u3002**BMC Web\u4e0b\u76ee\u524d\u7edf\u4e00\u4f7f\u7528 JSON**\r\n\r\n \r\n\r\nRestful \u98ce\u683cAPI\u8fd8\u5305\u542b**\u8fc7\u6ee4\u4fe1\u606f\uff08Filtering\uff09**\u548c **\u72b6\u6001\u7801\uff08Status Codes\uff09**\u4e24\u4e2a\u90e8\u5206\r\n\r\n\r\n\r\n#### 3-1-2-4-3\u8fc7\u6ee4\u4fe1\u606f\uff08Filtering\uff09\r\n\r\n\u5982\u679c\u8bb0\u5f55\u6570\u91cf\u5f88\u591a\uff0c\u670d\u52a1\u5668\u4e0d\u53ef\u80fd\u90fd\u5c06\u5b83\u4eec\u8fd4\u56de\u7ed9\u7528\u6237\u3002API\u5e94\u8be5\u63d0\u4f9b\u53c2\u6570\uff0c\u8fc7\u6ee4\u8fd4\u56de\u7ed3\u679c\u3002\r\n\r\n\u4e0b\u9762\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u53c2\u6570\u3002\r\n\r\n> - ?limit=10\uff1a\u6307\u5b9a\u8fd4\u56de\u8bb0\u5f55\u7684\u6570\u91cf\r\n> - ?offset=10\uff1a\u6307\u5b9a\u8fd4\u56de\u8bb0\u5f55\u7684\u5f00\u59cb\u4f4d\u7f6e\u3002\r\n> - ?page=2&per_page=100\uff1a\u6307\u5b9a\u7b2c\u51e0\u9875\uff0c\u4ee5\u53ca\u6bcf\u9875\u7684\u8bb0\u5f55\u6570\u3002\r\n> - ?sortby=name&order=asc\uff1a\u6307\u5b9a\u8fd4\u56de\u7ed3\u679c\u6309\u7167\u54ea\u4e2a\u5c5e\u6027\u6392\u5e8f\uff0c\u4ee5\u53ca\u6392\u5e8f\u987a\u5e8f\u3002\r\n> - ?animal_type_id=1\uff1a\u6307\u5b9a\u7b5b\u9009\u6761\u4ef6\r\n\r\n\u53c2\u6570\u7684\u8bbe\u8ba1\u5141\u8bb8\u5b58\u5728\u5197\u4f59\uff0c\u5373\u5141\u8bb8API\u8def\u5f84\u548cURL\u53c2\u6570\u5076\u5c14\u6709\u91cd\u590d\u3002\u6bd4\u5982\uff0cGET /zoo/ID/animals \u4e0e GET /animals?zoo_id=ID \u7684\u542b\u4e49\u662f\u76f8\u540c\u7684\u3002\r\n\r\n#### 3-1-2-4-4 \u72b6\u6001\u7801\uff08Status Codes\uff09\r\n\r\n\u670d\u52a1\u5668\u5411\u7528\u6237\u8fd4\u56de\u7684\u72b6\u6001\u7801\u548c\u63d0\u793a\u4fe1\u606f\uff0c\u5e38\u89c1\u7684\u6709\u4ee5\u4e0b\u4e00\u4e9b\uff08\u65b9\u62ec\u53f7\u4e2d\u662f\u8be5\u72b6\u6001\u7801\u5bf9\u5e94\u7684HTTP\u52a8\u8bcd\uff09\u3002\r\n\r\n> - 200 OK - [GET]\uff1a\u670d\u52a1\u5668\u6210\u529f\u8fd4\u56de\u7528\u6237\u8bf7\u6c42\u7684\u6570\u636e\uff0c\u8be5\u64cd\u4f5c\u662f\u5e42\u7b49\u7684\uff08Idempotent\uff09\u3002\r\n> - 201 CREATED - [POST/PUT/PATCH]\uff1a\u7528\u6237\u65b0\u5efa\u6216\u4fee\u6539\u6570\u636e\u6210\u529f\u3002\r\n> - 202 Accepted - [*]\uff1a\u8868\u793a\u4e00\u4e2a\u8bf7\u6c42\u5df2\u7ecf\u8fdb\u5165\u540e\u53f0\u6392\u961f\uff08\u5f02\u6b65\u4efb\u52a1\uff09\r\n> - 204 NO CONTENT - [DELETE]\uff1a\u7528\u6237\u5220\u9664\u6570\u636e\u6210\u529f\u3002\r\n> - 400 INVALID REQUEST - [POST/PUT/PATCH]\uff1a\u7528\u6237\u53d1\u51fa\u7684\u8bf7\u6c42\u6709\u9519\u8bef\uff0c\u670d\u52a1\u5668\u6ca1\u6709\u8fdb\u884c\u65b0\u5efa\u6216\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u8be5\u64cd\u4f5c\u662f\u5e42\u7b49\u7684\u3002\r\n> - 401 Unauthorized - [*]\uff1a\u8868\u793a\u7528\u6237\u6ca1\u6709\u6743\u9650\uff08\u4ee4\u724c\u3001\u7528\u6237\u540d\u3001\u5bc6\u7801\u9519\u8bef\uff09\u3002\r\n> - 403 Forbidden - [*] \u8868\u793a\u7528\u6237\u5f97\u5230\u6388\u6743\uff08\u4e0e401\u9519\u8bef\u76f8\u5bf9\uff09\uff0c\u4f46\u662f\u8bbf\u95ee\u662f\u88ab\u7981\u6b62\u7684\u3002\r\n> - 404 NOT FOUND - [*]\uff1a\u7528\u6237\u53d1\u51fa\u7684\u8bf7\u6c42\u9488\u5bf9\u7684\u662f\u4e0d\u5b58\u5728\u7684\u8bb0\u5f55\uff0c\u670d\u52a1\u5668\u6ca1\u6709\u8fdb\u884c\u64cd\u4f5c\uff0c\u8be5\u64cd\u4f5c\u662f\u5e42\u7b49\u7684\u3002\r\n> - 406 Not Acceptable - [GET]\uff1a\u7528\u6237\u8bf7\u6c42\u7684\u683c\u5f0f\u4e0d\u53ef\u5f97\uff08\u6bd4\u5982\u7528\u6237\u8bf7\u6c42JSON\u683c\u5f0f\uff0c\u4f46\u662f\u53ea\u6709XML\u683c\u5f0f\uff09\u3002\r\n> - 410 Gone -[GET]\uff1a\u7528\u6237\u8bf7\u6c42\u7684\u8d44\u6e90\u88ab\u6c38\u4e45\u5220\u9664\uff0c\u4e14\u4e0d\u4f1a\u518d\u5f97\u5230\u7684\u3002\r\n> - 422 Unprocesable entity - [POST/PUT/PATCH] \u5f53\u521b\u5efa\u4e00\u4e2a\u5bf9\u8c61\u65f6\uff0c\u53d1\u751f\u4e00\u4e2a\u9a8c\u8bc1\u9519\u8bef\u3002\r\n> - 500 INTERNAL SERVER ERROR - [*]\uff1a\u670d\u52a1\u5668\u53d1\u751f\u9519\u8bef\uff0c\u7528\u6237\u5c06\u65e0\u6cd5\u5224\u65ad\u53d1\u51fa\u7684\u8bf7\u6c42\u662f\u5426\u6210\u529f\u3002\r\n\r\n\u72b6\u6001\u7801\u7684\u5b8c\u5168\u5217\u8868\u53c2\u89c1[\u8fd9\u91cc](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)\u3002\r\n\r\n\u66f4\u8be6\u7ec6\u5185\u5bb9\u8bf7\u53ef\u53c2\u8003\r\n\r\n1. [RESTful API \u8bbe\u8ba1\u6307\u5357](http://www.ruanyifeng.com/blog/2014/05/restful_api.html)\r\n2. [RESTful API \u6700\u4f73\u5b9e\u8df5](http://www.ruanyifeng.com/blog/2018/10/restful-api-best-practices.html)\r\n\r\n### 3-1-3.\u7b2c\u4e09\u65b9\u63d2\u4ef6\r\n\r\n\u5b9e\u73b0 Web \u6a21\u5757\u529f\u80fd\u7684\u7b2c\u4e09\u65b9\u529f\u80fd\u5e93\u548c\u6a21\u5757\u4f9d\u8d56\u5e93\uff0c\u6bd4\u8f83\u91cd\u8981\u7684\u6709\uff1a\r\n\r\n1. **underScore** (Backbone \u4f9d\u8d56\u5e93\u4e4b\u4e00\u3001\u63d0\u4f9b\u5e95\u5c42\u7684\u57fa\u672c\u529f\u80fd\u51fd\u6570\u548c\u7f16\u8bd1html\u6a21\u677f\u7684\u65b9\u6cd5)\r\n2. **jQuery** (Backbone \u4f9d\u8d56\u5e93\u4e4b\u4e00\u3001\u63d0\u4f9b\u5e95\u5c42\u7684\u57fa\u672c[ajax\u5bf9\u8c61\uff08\u4e0e\u670d\u52a1\u7aef\u901a\u4fe1\u7684\u63a5\u53e3\uff09](https://www.runoob.com/ajax/ajax-tutorial.html)\u548c DOM \u64cd\u4f5c\u51fd\u6570)\r\n3. **backbone.layoutmanager** (\u9875\u9762\u89c6\u56fe\u7ba1\u7406)\r\n4. **backbone-validation-amd** (Model \u6570\u636e\u9a8c\u8bc1)\r\n5. **text** (\u53ef\u4ee5\u7528\u6765\u52a0\u8f7d\u5982.html\u3001.css\u7b49\u6587\u672c\u6587\u4ef6\uff0c\u901a\u8fc7\u8be5\u63d2\u4ef6\u6765\u5b9e\u73b0\u5b8c\u6574\u7ec4\u4ef6`\u7ed3\u6784+\u903b\u8f91+\u6837\u5f0f` \u7684\u7ec4\u4ef6\u5316\u5f00\u53d1)\r\n6. **i18n** (\u5b9e\u73b0 i18n \u56fd\u9645\u5316, \u5373 WEB \u524d\u7aef\u9875\u9762\u652f\u6301\u591a\u8bed\u8a00\u5207\u6362)\r\n7. BootStrap\uff08CSS \u6846\u67b6\uff09\r\n8. AdminLTE(\u9875\u9762\u5e03\u5c40\u6a21\u677f)\r\n\r\n### [3-1-4.GruntJS](https://www.gruntjs.net/)\r\n\r\n`\u4e3a\u4f55\u8981\u7528\u6784\u5efa\u5de5\u5177\uff1f`\r\n\u4e00\u53e5\u8bdd\uff1a\u81ea\u52a8\u5316\u3002\u5bf9\u4e8e\u9700\u8981\u53cd\u590d\u91cd\u590d\u7684\u4efb\u52a1\uff0c\u4f8b\u5982 \u4ee3\u7801\u6a21\u5757\u6587\u4ef6\u5408\u5e76\u3001\u4ee3\u7801\u8bed\u6cd5\u68c0\u67e5\u3001\u6587\u4ef6\u538b\u7f29\u3001\u6587\u4ef6\u9884\u5904\u7406\u3001\u7b49\uff0c\u81ea\u52a8\u5316\u5de5\u5177\u53ef\u4ee5\u51cf\u8f7b\u4f60\u7684\u52b3\u52a8\uff0c\u7b80\u5316\u4f60\u7684\u5de5\u4f5c\u3002\u5f53\u4f60\u5728 Gruntfile \u6587\u4ef6\u6b63\u786e\u914d\u7f6e\u597d\u4e86\u4efb\u52a1\uff0c\u4efb\u52a1\u8fd0\u884c\u5668\u5c31\u4f1a\u81ea\u52a8\u5e2e\u4f60\u6216\u4f60\u7684\u5c0f\u7ec4\u5b8c\u6210\u5927\u90e8\u5206\u65e0\u804a\u7684\u5de5\u4f5c\r\n`\u4e3a\u4f55\u4f7f\u7528Grunt?`\r\nGrunt \u62e5\u6709\u6570\u91cf\u5e9e\u5927\u7684\u63d2\u4ef6\u53ef\u4f9b\u9009\u62e9\uff0c\u53ef\u4ee5\u5229\u7528 Grunt \u81ea\u52a8\u5b8c\u6210\u4efb\u4f55\u4e8b\uff0c\u5e76\u4e14\u82b1\u8d39\u6700\u5c11\u7684\u4ee3\u4ef7\u3002\r\nBMC WEB \u6240\u7528\u5230\u7684\u4e3b\u8981\u63d2\u4ef6\u6709\r\n\r\n```\r\ngrunt-contrib-jshint -- js\u4ee3\u7801\u8bed\u6cd5\u68c0\u67e5\r\ngrunt-contrib-cssmin -- css\u6837\u5f0f\u6587\u4ef6\u538b\u7f29\r\ngrunt-contrib-less -- less\u6587\u4ef6\u9884\u5904\u7406\u7f16\u8bd1\r\n\r\ngrunt-contrib-copy -- \u6587\u4ef6\u6216\u6587\u4ef6\u5939\u590d\u5236\u79fb\u52a8\r\ngrunt-contrib-clean -- \u6587\u4ef6\u6216\u6587\u4ef6\u5939\u5220\u9664\r\ngrunt-contrib-compress -- \u6587\u4ef6\u538b\u7f29\r\ngrunt-processhtml -- html\u6587\u4ef6\u9884\u5904\u7406\r\n```\r\n\r\nBMC Web\u4e0b Grunt\u4efb\u52a1\u4e3b\u8981\u6709\uff1a\r\n\r\n1. \u4ee3\u7801\u8bed\u6cd5\u68c0\u67e5\r\n2. \u7f16\u8bd1less\u6837\u5f0f\u9884\u5904\u7406\u6587\u4ef6\uff0c\u5408\u5e76\u6240\u6709CSS\u6837\u5f0f\u6587\u4ef6\u5230source.min.css\r\n3. r.js\u5408\u5e76\u538b\u7f29\u6240\u6709js\u6a21\u5757\u6587\u4ef6\uff0c\u751f\u6210source.min.js\r\n4. \u9884\u5904\u7406html\u6587\u4ef6\uff0c\u6839\u636e\u6a21\u677f\u5d4c\u5165source.min.js\u4e0esource.min.css\r\n5. \u590d\u5236\u3001\u79fb\u52a8\u9759\u6001\u8d44\u6e90\u6587\u4ef6\u5230\u8f93\u51fa\u76ee\u5f55\r\n6. \u5bf9\u6240\u6709\u8d44\u6e90\u8fdb\u884cgzip\u538b\u7f29\uff0c\u4f7f\u5176\u7b26\u5408\u670d\u52a1\u5668\u7aef\u914d\u7f6e\u8981\u6c42\r\n\r\n\u7ecf\u8fc7Grunt JS\u811a\u672c\u914d\u7f6e\u540e\uff0c\u6211\u4eec\u53ea\u9700\u8981\u628a\u7cbe\u529b\u653e\u5728\u4fee\u6539\u4e1a\u52a1\u903b\u8f91\u4ee3\u7801\u4e0a\uff0c\u6ca1\u5fc5\u8981\u6bcf\u6b21\u90fd\u8fdb\u884c\u8fd9\u4e9b\u7e41\u7410\u64cd\u4f5c\uff0c\u7f16\u8bd1\u5de5\u5177\u5c06\u4f1a\u81ea\u52a8\u5e2e\u6211\u4eec\u6267\u884c\u3002\r\n\r\n\r\n\r\n\r\n\r\n## 4.BMC WebUI \u76f8\u5173\u7684\u5305\r\n\r\n\r\n\r\n1. webui_html5-2.398.0-src\uff08\u4e3b\u8981\u4e1a\u52a1\u903b\u8f91\u5b9e\u73b0\u4ee3\u7801\uff09\r\n2. webui_onlinehelp-2.0.0.0.0-src(\u57fa\u7840\u4ee3\u7801\u65b0\u589e\u7684\u5e2e\u52a9\u6587\u6863\u4ee3\u7801\u5305)\r\n3. webui_scaffold-1.206.0-src\uff08AMI\u539f\u751f\u7684\u6a21\u677f\u4ee3\u7801\uff0c\u4f1a\u81ea\u52a8\u7f16\u8bd1\u4ea7\u751f\u76f8\u5e94\u6a21\u5757\u6587\u4ef6\uff0c\u6700\u7ec8\u4e0ewebui_html5-2.398.0-src\u5408\u5e76\uff09\r\n4. H5Viewer_html5-1.49.0-src \uff08H5 KVM \u4ee3\u7801\u4e3b\u6587\u4ef6\uff0c\u5305\u542b\u4e86H5 KVM \u7684\u57fa\u672c\u6240\u6709\u6838\u5fc3\u4ee3\u7801\uff09\r\n5. H5Viewer_common-2.172.0-src\uff08H5 KVM \u4ee3\u7801,\u4e3b\u8981\u91cd\u65b0\u5b9a\u4e49\u4e86 H5KVM \u7684 View\u89c6\u56fe\uff0c\u4e0eH5Viewer_html5-1.49.0-src \u91cc\u9762\u7684\u89c6\u56fe\u540c\u540d\uff0c\u5b9e\u9645\u751f\u6210H5 KVM \u9875\u9762\u65f6\uff0c\u4f1a\u8986\u76d6\u6389H5Viewer_html5-1.49.0-src\u6587\u4ef6\uff09\r\n\r\n\r\n\r\n\r\n\r\n## 5.\u4f5c\u4e1a\uff1a\r\n\r\n#### \u8be6\u7ec6\u7684\u53bb\u4e86\u89e3 Restful Json \u63a5\u53e3\u89c4\u8303\u548c\u8bbe\u8ba1\u65b9\u6cd5\uff0c\u81ea\u5df1\u8bbe\u8ba1\u4e94\u4e2a\u63a5\u53e3\uff0c\u5199\u4e00\u4e2a API \u6587\u6863\uff0c\u90ae\u4ef6\u53d1\u7ed9\u6211\uff08\u53ef\u7528\u4ee3\u7801\u5b9e\u73b0\uff0c\u4f7f\u7528postman\u540c\u6b65\u6d4b\u8bd5\u9a8c\u8bc1\uff09\uff1a\r\n\r\n\u5185\u5bb9\u5305\u62ec\uff1a\r\n\r\n1. \u4f5c\u7528\u63cf\u8ff0\r\n\r\n2. \u53c2\u6570\u63cf\u8ff0\r\n\r\n3. \u63a5\u53e3\u540d\uff08URI\uff09\r\n\r\n4. \u8bf7\u6c42\u65b9\u6cd5\u3001\u8bf7\u6c42\u53c2\u6570\r\n\r\n5. \u54cd\u5e94\u53c2\u6570\u4ee5\u53ca\u54cd\u5e94\u72b6\u6001\u7801\r\n\r\n \u8865\u5145\uff1a \u9700\u8981\u5305\u542b\u5f02\u5e38\u7ed3\u679c\u5904\u7406\u65b9\u6cd5\uff0c\u6bd4\u5982\u8bf7\u6c42\u8d44\u6e90\u4e0d\u5b58\u5728\uff0c\u8bf7\u6c42\u6743\u9650\u4e0d\u591f\u3001\u6216\u8005\u5176\u5b83\u539f\u56e0\u5bfc\u81f4\u540e\u7aef\u64cd\u4f5c\u5931\u8d25\u7b49\uff0c\u53ef\u4ee5\u81ea\u5df1\u53c2\u8003HTTP \u72b6\u6001\u7801\u81ea\u884c\u8865\u5145\u5176\u5b83\u5f02\u5e38\u72b6\u6001\u8868\u793a\u65b9\u6cd5\u3002",
"original": true,
"orginal_link": null,
"public": true,
"browse_num": 17,
"user": 49,
"add_time": "2020-04-11T10:25:45Z",
"modified_time": "2020-04-22T11:56:06.567Z",
"types": [
1,
6,
10,
11
]
}
},
{
"model": "articals.articale",
"pk": 110,
"fields": {
"note": 3,
"title": "Flex \u5e03\u5c40\u6559\u7a0b\uff1a\u5b9e\u4f8b\u7bc7",
"text_content": "# Flex \u5e03\u5c40\u6559\u7a0b\uff1a\u5b9e\u4f8b\u7bc7\n\u4f5c\u8005\uff1a [\u962e\u4e00\u5cf0](http://www.ruanyifeng.com/)\n\n\u65e5\u671f\uff1a [2015\u5e747\u670814\u65e5](http://www.ruanyifeng.com/blog/2015/07/)\n\n[\u4e0a\u4e00\u7bc7\u6587\u7ae0](http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html)\u4ecb\u7ecd\u4e86Flex\u5e03\u5c40\u7684\u8bed\u6cd5\uff0c\u4eca\u5929\u4ecb\u7ecd\u5e38\u89c1\u5e03\u5c40\u7684Flex\u5199\u6cd5\u3002\n\n\u4f60\u4f1a\u770b\u5230\uff0c\u4e0d\u7ba1\u662f\u4ec0\u4e48\u5e03\u5c40\uff0cFlex\u5f80\u5f80\u90fd\u53ef\u4ee5\u51e0\u884c\u547d\u4ee4\u641e\u5b9a\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071327.png)\n\n\u6211\u53ea\u5217\u51fa\u4ee3\u7801\uff0c\u8be6\u7ec6\u7684\u8bed\u6cd5\u89e3\u91ca\u8bf7\u67e5\u9605[\u300aFlex\u5e03\u5c40\u6559\u7a0b\uff1a\u8bed\u6cd5\u7bc7\u300b](http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html)\u3002\u6211\u7684\u4e3b\u8981\u53c2\u8003\u8d44\u6599\u662f[Landon Schropp](http://davidwalsh.name/flexbox-dice)\u7684\u6587\u7ae0\u548c[Solved by Flexbox](http://philipwalton.github.io/solved-by-flexbox/)\u3002\n\n## \u4e00\u3001\u9ab0\u5b50\u7684\u5e03\u5c40\n\n\u9ab0\u5b50\u7684\u4e00\u9762\uff0c\u6700\u591a\u53ef\u4ee5\u653e\u7f6e9\u4e2a\u70b9\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071328.png)\n\n\u4e0b\u9762\uff0c\u5c31\u6765\u770b\u770bFlex\u5982\u4f55\u5b9e\u73b0\uff0c\u4ece1\u4e2a\u70b9\u52309\u4e2a\u70b9\u7684\u5e03\u5c40\u3002\u4f60\u53ef\u4ee5\u5230[codepen](http://codepen.io/LandonSchropp/pen/KpzzGo)\u67e5\u770bDemo\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071329.png)\n\n\u5982\u679c\u4e0d\u52a0\u8bf4\u660e\uff0c\u672c\u8282\u7684HTML\u6a21\u677f\u4e00\u5f8b\u5982\u4e0b\u3002\n\n> ```markup\n> <div class=\"box\">\n> <span class=\"item\"></span>\n> </div>\n> ```\n\n\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0cdiv\u5143\u7d20\uff08\u4ee3\u8868\u9ab0\u5b50\u7684\u4e00\u4e2a\u9762\uff09\u662fFlex\u5bb9\u5668\uff0cspan\u5143\u7d20\uff08\u4ee3\u8868\u4e00\u4e2a\u70b9\uff09\u662fFlex\u9879\u76ee\u3002\u5982\u679c\u6709\u591a\u4e2a\u9879\u76ee\uff0c\u5c31\u8981\u6dfb\u52a0\u591a\u4e2aspan\u5143\u7d20\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002\n\n### 1.1 \u5355\u9879\u76ee\n\n\u9996\u5148\uff0c\u53ea\u6709\u5de6\u4e0a\u89d21\u4e2a\u70b9\u7684\u60c5\u51b5\u3002Flex\u5e03\u5c40\u9ed8\u8ba4\u5c31\u662f\u9996\u884c\u5de6\u5bf9\u9f50\uff0c\u6240\u4ee5\u4e00\u884c\u4ee3\u7801\u5c31\u591f\u4e86\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071301.png)\n\n> ```css\n> .box {\n> display: flex;\n> }\n> ```\n\n\u8bbe\u7f6e\u9879\u76ee\u7684\u5bf9\u9f50\u65b9\u5f0f\uff0c\u5c31\u80fd\u5b9e\u73b0\u5c45\u4e2d\u5bf9\u9f50\u548c\u53f3\u5bf9\u9f50\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071302.png)\n\n> ```css\n> .box {\n> display: flex;\n> justify-content: center;\n> }\n> ```\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071303.png)\n\n> ```css\n> .box {\n> display: flex;\n> justify-content: flex-end;\n> }\n> ```\n\n\u8bbe\u7f6e\u4ea4\u53c9\u8f74\u5bf9\u9f50\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5782\u76f4\u79fb\u52a8\u4e3b\u8f74\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071304.png)\n\n> ```css\n> .box {\n> display: flex;\n> align-items: center;\n> }\n> ```\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071305.png)\n\n> ```css\n> .box {\n> display: flex;\n> justify-content: center;\n> align-items: center;\n> }\n> ```\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071306.png)\n\n> ```css\n> .box {\n> display: flex;\n> justify-content: center;\n> align-items: flex-end;\n> }\n> ```\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071307.png)\n\n> ```css\n> .box {\n> display: flex;\n> justify-content: flex-end;\n> align-items: flex-end;\n> }\n> ```\n\n### 1.2 \u53cc\u9879\u76ee\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071308.png)\n\n> ```css\n> .box {\n> display: flex;\n> justify-content: space-between;\n> }\n> ```\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071309.png)\n\n> ```css\n> .box {\n> display: flex;\n> flex-direction: column;\n> justify-content: space-between;\n> }\n> ```\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071310.png)\n\n> ```css\n> .box {\n> display: flex;\n> flex-direction: column;\n> justify-content: space-between;\n> align-items: center;\n> }\n> ```\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071311.png)\n\n> ```css\n> .box {\n> display: flex;\n> flex-direction: column;\n> justify-content: space-between;\n> align-items: flex-end;\n> }\n> ```\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071312.png)\n\n> ```css\n> .box {\n> display: flex;\n> }\n> \n> .item:nth-child(2) {\n> align-self: center;\n> }\n> ```\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071313.png)\n\n> ```css\n> .box {\n> display: flex;\n> justify-content: space-between;\n> }\n> \n> .item:nth-child(2) {\n> align-self: flex-end;\n> }\n> ```\n\n### 1.3 \u4e09\u9879\u76ee\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071314.png)\n\n> ```css\n> .box {\n> display: flex;\n> }\n> \n> .item:nth-child(2) {\n> align-self: center;\n> }\n> \n> .item:nth-child(3) {\n> align-self: flex-end;\n> }\n> ```\n\n### 1.4 \u56db\u9879\u76ee\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071315.png)\n\n> ```css\n> .box {\n> display: flex;\n> flex-wrap: wrap;\n> justify-content: flex-end;\n> align-content: space-between;\n> }\n> ```\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071316.png)\n\nHTML\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```markup\n> <div class=\"box\">\n> <div class=\"column\">\n> <span class=\"item\"></span>\n> <span class=\"item\"></span>\n> </div>\n> <div class=\"column\">\n> <span class=\"item\"></span>\n> <span class=\"item\"></span>\n> </div>\n> </div>\n> ```\n\nCSS\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```css\n> .box {\n> display: flex;\n> flex-wrap: wrap;\n> align-content: space-between;\n> }\n> \n> .column {\n> flex-basis: 100%;\n> display: flex;\n> justify-content: space-between;\n> }\n> ```\n\n### 1.5 \u516d\u9879\u76ee\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071317.png)\n\n> ```css\n> .box {\n> display: flex;\n> flex-wrap: wrap;\n> align-content: space-between;\n> }\n> ```\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071318.png)\n\n> ```css\n> .box {\n> display: flex;\n> flex-direction: column;\n> flex-wrap: wrap;\n> align-content: space-between;\n> }\n> ```\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071319.png)\n\nHTML\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```markup\n> <div class=\"box\">\n> <div class=\"row\">\n> <span class=\"item\"></span>\n> <span class=\"item\"></span>\n> <span class=\"item\"></span>\n> </div>\n> <div class=\"row\">\n> <span class=\"item\"></span>\n> </div>\n> <div class=\"row\">\n> <span class=\"item\"></span>\n> <span class=\"item\"></span>\n> </div>\n> </div>\n> ```\n\nCSS\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```css\n> .box {\n> display: flex;\n> flex-wrap: wrap;\n> }\n> \n> .row{\n> flex-basis: 100%;\n> display:flex;\n> }\n> \n> .row:nth-child(2){\n> justify-content: center;\n> }\n> \n> .row:nth-child(3){\n> justify-content: space-between;\n> }\n> ```\n\n### 1.6 \u4e5d\u9879\u76ee\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071320.png)\n\n> ```css\n> .box {\n> display: flex;\n> flex-wrap: wrap;\n> }\n> ```\n\n## \u4e8c\u3001\u7f51\u683c\u5e03\u5c40\n\n### 2.1 \u57fa\u672c\u7f51\u683c\u5e03\u5c40\n\n\u6700\u7b80\u5355\u7684\u7f51\u683c\u5e03\u5c40\uff0c\u5c31\u662f\u5e73\u5747\u5206\u5e03\u3002\u5728\u5bb9\u5668\u91cc\u9762\u5e73\u5747\u5206\u914d\u7a7a\u95f4\uff0c\u8ddf\u4e0a\u9762\u7684\u9ab0\u5b50\u5e03\u5c40\u5f88\u50cf\uff0c\u4f46\u662f\u9700\u8981\u8bbe\u7f6e\u9879\u76ee\u7684\u81ea\u52a8\u7f29\u653e\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071321.png)\n\nHTML\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```markup\n> <div class=\"Grid\">\n> <div class=\"Grid-cell\">...</div>\n> <div class=\"Grid-cell\">...</div>\n> <div class=\"Grid-cell\">...</div>\n> </div>\n> ```\n\nCSS\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```css\n> .Grid {\n> display: flex;\n> }\n> \n> .Grid-cell {\n> flex: 1;\n> }\n> ```\n\n### 2.2 \u767e\u5206\u6bd4\u5e03\u5c40\n\n\u67d0\u4e2a\u7f51\u683c\u7684\u5bbd\u5ea6\u4e3a\u56fa\u5b9a\u7684\u767e\u5206\u6bd4\uff0c\u5176\u4f59\u7f51\u683c\u5e73\u5747\u5206\u914d\u5269\u4f59\u7684\u7a7a\u95f4\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071322.png)\n\nHTML\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```markup\n> <div class=\"Grid\">\n> <div class=\"Grid-cell u-1of4\">...</div>\n> <div class=\"Grid-cell\">...</div>\n> <div class=\"Grid-cell u-1of3\">...</div>\n> </div>\n> ```\n\n> ```css\n> .Grid {\n> display: flex;\n> }\n> \n> .Grid-cell {\n> flex: 1;\n> }\n> \n> .Grid-cell.u-full {\n> flex: 0 0 100%;\n> }\n> \n> .Grid-cell.u-1of2 {\n> flex: 0 0 50%;\n> }\n> \n> .Grid-cell.u-1of3 {\n> flex: 0 0 33.3333%;\n> }\n> \n> .Grid-cell.u-1of4 {\n> flex: 0 0 25%;\n> }\n> ```\n\n## \u4e09\u3001\u5723\u676f\u5e03\u5c40\n\n[\u5723\u676f\u5e03\u5c40](https://en.wikipedia.org/wiki/Holy_Grail_(web_design))\uff08Holy Grail Layout\uff09\u6307\u7684\u662f\u4e00\u79cd\u6700\u5e38\u89c1\u7684\u7f51\u7ad9\u5e03\u5c40\u3002\u9875\u9762\u4ece\u4e0a\u5230\u4e0b\uff0c\u5206\u6210\u4e09\u4e2a\u90e8\u5206\uff1a\u5934\u90e8\uff08header\uff09\uff0c\u8eaf\u5e72\uff08body\uff09\uff0c\u5c3e\u90e8\uff08footer\uff09\u3002\u5176\u4e2d\u8eaf\u5e72\u53c8\u6c34\u5e73\u5206\u6210\u4e09\u680f\uff0c\u4ece\u5de6\u5230\u53f3\u4e3a\uff1a\u5bfc\u822a\u3001\u4e3b\u680f\u3001\u526f\u680f\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071323.png)\n\nHTML\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```markup\n> <body class=\"HolyGrail\">\n> <header>...</header>\n> <div class=\"HolyGrail-body\">\n> <main class=\"HolyGrail-content\">...</main>\n> <nav class=\"HolyGrail-nav\">...</nav>\n> <aside class=\"HolyGrail-ads\">...</aside>\n> </div>\n> <footer>...</footer>\n> </body>\n> ```\n\nCSS\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```css\n> .HolyGrail {\n> display: flex;\n> min-height: 100vh;\n> flex-direction: column;\n> }\n> \n> header,\n> footer {\n> flex: 1;\n> }\n> \n> .HolyGrail-body {\n> display: flex;\n> flex: 1;\n> }\n> \n> .HolyGrail-content {\n> flex: 1;\n> }\n> \n> .HolyGrail-nav, .HolyGrail-ads {\n> /* \u4e24\u4e2a\u8fb9\u680f\u7684\u5bbd\u5ea6\u8bbe\u4e3a12em */\n> flex: 0 0 12em;\n> }\n> \n> .HolyGrail-nav {\n> /* \u5bfc\u822a\u653e\u5230\u6700\u5de6\u8fb9 */\n> order: -1;\n> }\n> ```\n\n\u5982\u679c\u662f\u5c0f\u5c4f\u5e55\uff0c\u8eaf\u5e72\u7684\u4e09\u680f\u81ea\u52a8\u53d8\u4e3a\u5782\u76f4\u53e0\u52a0\u3002\n\n> ```css\n> @media (max-width: 768px) {\n> .HolyGrail-body {\n> flex-direction: column;\n> flex: 1;\n> }\n> .HolyGrail-nav,\n> .HolyGrail-ads,\n> .HolyGrail-content {\n> flex: auto;\n> }\n> }\n> ```\n\n## \u56db\u3001\u8f93\u5165\u6846\u7684\u5e03\u5c40\n\n\u6211\u4eec\u5e38\u5e38\u9700\u8981\u5728\u8f93\u5165\u6846\u7684\u524d\u65b9\u6dfb\u52a0\u63d0\u793a\uff0c\u540e\u65b9\u6dfb\u52a0\u6309\u94ae\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071324.png)\n\nHTML\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```markup\n> <div class=\"InputAddOn\">\n> <span class=\"InputAddOn-item\">...</span>\n> <input class=\"InputAddOn-field\">\n> <button class=\"InputAddOn-item\">...</button>\n> </div>\n> ```\n\nCSS\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```css\n> .InputAddOn {\n> display: flex;\n> }\n> \n> .InputAddOn-field {\n> flex: 1;\n> }\n> ```\n\n## \u4e94\u3001\u60ac\u6302\u5f0f\u5e03\u5c40\n\n\u6709\u65f6\uff0c\u4e3b\u680f\u7684\u5de6\u4fa7\u6216\u53f3\u4fa7\uff0c\u9700\u8981\u6dfb\u52a0\u4e00\u4e2a\u56fe\u7247\u680f\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071325.png)\n\nHTML\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```markup\n> <div class=\"Media\">\n> <img class=\"Media-figure\" src=\"\" alt=\"\">\n> <p class=\"Media-body\">...</p>\n> </div>\n> ```\n\nCSS\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```css\n> .Media {\n> display: flex;\n> align-items: flex-start;\n> }\n> \n> .Media-figure {\n> margin-right: 1em;\n> }\n> \n> .Media-body {\n> flex: 1;\n> }\n> ```\n\n### \u516d\u3001\u56fa\u5b9a\u7684\u5e95\u680f\n\n\u6709\u65f6\uff0c\u9875\u9762\u5185\u5bb9\u592a\u5c11\uff0c\u65e0\u6cd5\u5360\u6ee1\u4e00\u5c4f\u7684\u9ad8\u5ea6\uff0c\u5e95\u680f\u5c31\u4f1a\u62ac\u9ad8\u5230\u9875\u9762\u7684\u4e2d\u95f4\u3002\u8fd9\u65f6\u53ef\u4ee5\u91c7\u7528Flex\u5e03\u5c40\uff0c\u8ba9\u5e95\u680f\u603b\u662f\u51fa\u73b0\u5728\u9875\u9762\u7684\u5e95\u90e8\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071326.png)\n\nHTML\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```markup\n> <body class=\"Site\">\n> <header>...</header>\n> <main class=\"Site-content\">...</main>\n> <footer>...</footer>\n> </body>\n> ```\n\nCSS\u4ee3\u7801\u5982\u4e0b\u3002\n\n> ```css\n> .Site {\n> display: flex;\n> min-height: 100vh;\n> flex-direction: column;\n> }\n> \n> .Site-content {\n> flex: 1;\n> }\n> ```\n\n### \u4e03\uff0c\u6d41\u5f0f\u5e03\u5c40\n\n\u6bcf\u884c\u7684\u9879\u76ee\u6570\u56fa\u5b9a\uff0c\u4f1a\u81ea\u52a8\u5206\u884c\u3002\n\n![img](http://www.ruanyifeng.com/blogimg/asset/2015/bg2015071330.png)\n\nCSS\u7684\u5199\u6cd5\u3002\n\n> ```css\n> .parent {\n> width: 200px;\n> height: 150px;\n> background-color: black;\n> display: flex;\n> flex-flow: row wrap;\n> align-content: flex-start;\n> }\n> \n> .child {\n> box-sizing: border-box;\n> background-color: white;\n> flex: 0 0 25%;\n> height: 50px;\n> border: 1px solid red;\n> }\n> ```\n\n\uff08\u5b8c\uff09\n\n### \u6587\u6863\u4fe1\u606f![1557028168350.png](http://127.0.0.1:9200/media/uploads/image/2020-4-23/a5f1191043384e739cf9272f462fe536/1557028168350.png)",
"original": false,
"orginal_link": "http://www.ruanyifeng.com/blog/2015/07/flex-examples.html",
"public": true,
"browse_num": 66,
"user": 1,
"add_time": "2020-04-13T13:23:26.218Z",
"modified_time": "2020-04-26T02:27:39.456Z",
"types": [
1,
2,
3,
13
]
}
},
{
"model": "articals.articale",
"pk": 112,
"fields": {
"note": 3,
"title": "Django\u5916\u952e\uff08ForeignKey\uff09\u64cd\u4f5c\u4ee5\u53carelated_name\u7684\u4f5c\u7528",
"text_content": "Django\u5916\u952e\uff08ForeignKey\uff09\u64cd\u4f5c\u4ee5\u53carelated_name\u7684\u4f5c\u7528\r\n\r\n \u4e4b\u524d\u5df2\u7ecf\u5199\u8fc7\u4e00\u7bc7\u5173\u4e8eDjango\u5916\u952e\u7684\u6587\u7ae0\uff0c\u4f46\u662f\u5f53\u65f6\u5e76\u6ca1\u6709\u4ecb\u7ecd\u5982\u4f55\u6839\u636e\u5916\u952e\u5bf9\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u4e5f\u5c31\u662f\u5982\u4f55\u901a\u8fc7\u4e3b\u8868\u67e5\u8be2\u5b50\u8868\u6216\u8005\u901a\u8fc7\u5b50\u8868\u67e5\u8be2\u4e3b\u8868\u7684\u4fe1\u606f\r\n\r\n \u9996\u5148\u6211\u5b9a\u4e49\u4e86\u4e24\u4e2a\u6a21\u578b\uff0c\u4e00\u4e2a\u662f\u8001\u5e08\u6a21\u578b\uff0c\u4e00\u4e2a\u662f\u5b66\u751f\u6a21\u578b\uff0c\u4e00\u4e2a\u8001\u5e08\u5bf9\u5e94\u591a\u4e2a\u5b66\u751f\uff0c\u8fd9\u4e2a\u7b97\u662f\u4e00\u4e2a\u4e00\u5bf9\u591a\u7684\u7c7b\u578b\uff08\u5982\u4e0b\u56fe\u6240\u793a\uff09\r\n\r\n\u200b ![img](https://img-blog.csdn.net/20171230220311431?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHB1X3lseV9iag==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\r\n\r\n \u90a3\u4e48\u5982\u679c\u6211\u4eec\u8981\u60f3\u67e5\u8be2\u4e00\u4e2a\u8001\u5e08\u5bf9\u5e94\u7684\u5b66\u751f\u6709\u54ea\u4e9b\uff0c\u8be5\u5982\u4f55\u64cd\u4f5c\u5462\uff1f\r\n \r\n \u9996\u5148\u6211\u4eec\u5148\u67e5\u8be2\u5230\u8001\u5e08\u7684\u4fe1\u606f\uff0c\u5728\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528python shell \u8fdb\u884c\u6f14\u793a \uff0c\u8f93\u5165\u547d\u4ee4python manage.py shell \u8fdb\u5165python shell\u64cd\u4f5c\u754c\u9762\uff1a\r\n \r\n \u7b2c\u4e00\u6b65\u9700\u8981\u505a\u7684\u81ea\u7136\u8fd8\u662f\u9700\u8981\u5c06\u6211\u4eec\u7684\u6a21\u578b\u5bfc\u5165\u8fdb\u6765\uff0c\u5e76\u83b7\u53d6\u8001\u5e08\u7684\u76f8\u5173\u4fe1\u606f\r\n\r\n\r\n\u200b ![img](https://img-blog.csdn.net/20171230221115309?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHB1X3lseV9iag==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\r\n\r\n \u8fd4\u56de\u4e00\u4e2ateacher\u5bf9\u8c61\uff0c\u63a5\u4e0b\u6765\u5c31\u662f\u67e5\u8be2teacher\u76f8\u5173\u8054\u7684\u5b66\u751f\u5bf9\u8c61\uff0c\u5728\u8fd9\u91cc\u6709\u4e00\u4e2a\u9700\u8981\u6ce8\u610f\u7684\u70b9\uff0cdjango\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u6bcf\u4e00\u4e2a\u4e3b\u8868\u7684\u5bf9\u8c61\u90fd\u6709\u4e00\u4e2a\u662f\u5916\u952e\u7684\u5c5e\u6027\uff0c\u53ef\u4ee5\u901a\u8fc7\u5b83\u67e5\u8be2\u5230\u6240\u6709\u5173\u4e8e\u5b50\u8868\u7684\u4fe1\u606f\uff0c\u8fd9\u4e2a\u5c5e\u6027\u7684\u540d\u5b57\u5c31\u662f\u5b50\u8868\u7684\u540d\u79f0\u5c0f\u5199\u52a0\u4e0a_set\uff0c\u5177\u4f53\u5230\u8fd9\u4e2a\u5c31\u662fstudent_set\uff0c\u9ed8\u8ba4\u8fd4\u56de\u7684\u662fQuerySet,\u64cd\u4f5c\u5982\u4e0b\uff1a\r\n\r\n\r\n\u200b ![img](https://img-blog.csdn.net/20171230221551150?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHB1X3lseV9iag==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\r\n\r\n \u5728\u8fd9\u91cc\u4e5f\u4f1a\u7275\u6d89\u5230\u53e6\u5916\u4e00\u4e2a\u77e5\u8bc6\u70b9related_name\u7684\u4f7f\u7528\uff0c\u5728models.py\u4f7f\u7528Foreign\u5b9a\u4e49\u5916\u952e\u7684\u65f6\u5019\u4e5f\u53ef\u4ee5\u4f20\u5165\u4e00\u4e2a\u53c2\u6570related_name\uff0c\u64cd\u4f5c\u5982\u4e0b\uff1a\r\n\r\n![img](https://img-blog.csdn.net/20171230221745515?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHB1X3lseV9iag==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\r\n\r\n \u6267\u884cpython manage.py makemigrations \u548c python manage.py migrate \r\n\r\n ![img](https://img-blog.csdn.net/20171230222143986?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHB1X3lseV9iag==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)\r\n\r\n \u4ece\u4e0a\u56fe\u53ef\u4ee5\u770b\u5230\u548c\u4e4b\u524d\u7684_set\u64cd\u4f5c\u7684\u6548\u679c\u662f\u4e00\u6837\u7684\uff0c\u8fd9\u4e24\u4e2a\u65b9\u6cd5\u662f\u76f8\u540c\u7684\uff0c\u6240\u4ee5\u5982\u679c\u89c9\u5f97\u6bd4\u8f83\u9ebb\u70e6\u7684\u8bdd\uff0c\u53ef\u4ee5\u5728\u5b9a\u4e49\u4e3b\u8868\u7684\u5916\u952e\u7684\u65f6\u5019\uff0c\u76f4\u63a5\u5c31\u7ed9\u5916\u952e\u5b9a\u4e49\u597d\u540d\u79f0\u4f7f\u7528related_name\r\n \r\n \u4e0a\u9762\u7684\u67e5\u8be2\u4e3b\u8981\u662f\u901a\u8fc7\u4e3b\u8868\u67e5\u8be2\u5b50\u8868\u7684\u4fe1\u606f\r\n \r\n \u4e0b\u9762\u8bf4\u4e00\u4e0b\u5982\u4f55\u901a\u8fc7\u5b50\u8868\u67e5\u8be2\u4e3b\u8868\u7684\u76f8\u5173\u4fe1\u606f\uff0c\u4e5f\u5c31\u662f\u67e5\u8be2\u4e00\u4e2a\u5b66\u751f\u6240\u5bf9\u5e94\u7684\u8001\u5e08\u7684\u4fe1\u606f\r\n \r\n \u9996\u5148\u9700\u8981\u5148\u83b7\u53d6\u4e00\u4e2a\u5b50\u8868\u7684\u5bf9\u8c61\uff0c\u90a3\u4e48\u5c31\u53ef\u4ee5\u901a\u8fc7\u5b9a\u4e49\u5916\u952e\u65f6\u5019\u7684\u90a3\u4e2a\u5916\u952e\u7684\u5b57\u6bb5\u540d\u83b7\u53d6\u5173\u4e8e\u4e3b\u8868\u7684\u4fe1\u606f\u4e86\r\n \r\n \u6bd4\u5982\u6211\u5f97\u5230\u4e86\u4e00\u4e2astudent\u5bf9\u8c61\uff0c\u7136\u540e\u6211\u60f3\u8981\u5f97\u5230\u8fd9\u4e2astudent\u5bf9\u8c61\u5bf9\u5e94\u7684\u4e3b\u8868teache\u4e2d\u7684\u4fe1\u606f\u7684\u8bdd\uff0c\u5c31\u4f7f\u7528 student.teacher \u83b7\u53d6\uff0c\u5176\u4e2d\u8fd9\u4e2ateacher\u5c31\u662f\u5728\u5b50\u8868\u4e2d\u5b9a\u4e49\u7684\u5916\u952e\u5b57\u6bb5\uff0c\u5982\u4e0b\uff1a\r\n\r\n \r\n\r\n![img](https://img-blog.csdn.net/20171230222817566?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHB1X3lseV9iag==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)",
"original": false,
"orginal_link": "https://blog.csdn.net/hpu_yly_bj/article/details/78939748",
"public": true,
"browse_num": 38,
"user": 1,
"add_time": "2020-04-14T09:44:30Z",
"modified_time": "2020-04-14T05:37:06.716Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 113,
"fields": {
"note": 3,
"title": "django\u4e2d\u7684Q\u548cF\u65b9\u6cd5",
"text_content": "# [django\u4e2d\u7684Q\u548cF\u65b9\u6cd5](https://www.cnblogs.com/ttyypjt/p/11232353.html)\n\n## \u4e00\u3001Q\u65b9\u6cd5\n\n### 1.\u5bf9\u5173\u952e\u5b57\u53c2\u6570\u8fdb\u884c\u5c01\u88c5\uff1a\n\n```\nfrom django.db.models import Q\nfrom app01.models import Userinfo\n \nuserinfo = Userinfo.objects.filter(Q(question__startswith='\u738b'))\n```\n\n### 2.&\uff0c| \u64cd\u4f5c\u7b26\n\n\u5f53\u4e00\u4e2a\u64cd\u4f5c\u7b26\u4f5c\u7528\u4e8e\u4e24\u4e2aQ\u5bf9\u8c61\u65f6\uff0c\u4f1a\u4ea7\u751f\u4e00\u4e2a\u65b0\u7684Q\u5bf9\u8c61\uff1a\n\n```\nfrom django.db.models import Q\nfrom app01.models import Userinfo\n \nuserinfo = Userinfo.objects.filter(Q(question__startswith='\u738b') | Q(question__startswith='\u516d'))\n```\n\n### 3.Q\u5bf9\u8c61\u53ef\u4ee5\u7528~\u64cd\u4f5c\u7b26\u8868\u793a\u5426\u5b9a\n\n```\nfrom django.db.models import Q\nfrom app01.models import Userinfo\n \nuserinfo = Userinfo.objects.filter(Q(question__startswith='\u738b') | ~Q(born_data__year=2005))\n```\n\n### 4.\u4e0e\u5173\u952e\u5b57\u53c2\u6570\u67e5\u8be2\u4e00\u8d77\u4f7f\u7528\n\n\u4e00\u5b9a\u8981\u628aQ\u5bf9\u8c61\u653e\u5728\u5173\u952e\u5b57\u53c2\u6570\u67e5\u8be2\u7684\u524d\u9762\n\n```\nOrder.objects.get(\n Q(create_time=date(2018, 10, 3)) | Q(create_time=date(2019, 3, 6))\n desc__startswith='wang',\n)\n```\n\n\u4f8b\uff1a\n\n```\nBook.objects.get(\nQ(username__startswith='t'),\nQ(pub_date=date(2005, 5, 2)) | Q(pub_date=date(2005, 5, 6))\n)\n\u7b49\u4ef7\u4e8e\nSELECT * from book WHERE username LIKE 't%'\nAND (pub_date = '2005-05-02' OR pub_date = '2005-05-06')\n```\n\n\n\n## \u4e8c\u3001F\u65b9\u6cd5\n\nF()\u7684\u4f5c\u7528\u662f\uff1a\u5728\u66f4\u65b0\u6570\u636e\u65f6\u5148\u4ece\u6570\u636e\u5e93\u91cc\u5c06\u539f\u6570\u636e\u53d6\u51fa\u540e\u65b9\u5728\u5185\u5b58\u91cc\uff0c\u7136\u540e\u4fee\u6539\u76f8\u5e94\u7684\u5b57\u6bb5\u7684\u503c\uff0c\u6700\u540e\u63d0\u4ea4\u3002\n\n```\nbook = Book.objects.get(publish='\u7535\u5b50\u5de5\u4e1a\u51fa\u7248\u793e')\nbook.price += 1\nbook.save()\n```\n\n\u8f6c\u5316\u4e3asql\u8bed\u53e5\u4e3a\n\n```\nUPDATE `book` SET ..., `price` = `orice` + 1 WHERE `book`.`publish` = '\u7535\u5b50\u5de5\u4e1a\u51fa\u7248\u793e'\n```\n\n\u4f7f\u7528F()\u51fd\u6570\uff1a\n\n```\nfrom django.db.models import F\nfrom app01.models import Book\n \nbook = Book.objects.get(price='128')\nbook.price = F('price') - 1\nbook.save()\n```\n\n\n\n\u4e0a\u8ff0\u65b9\u6cd5\u66f4\u65b0\u8fc7\u6570\u636e\u4e4b\u540e\u9700\u8981\u91cd\u65b0\u52a0\u8f7d\u6570\u636e\u6765\u4f7f\u6570\u636e\u5e93\u4e2d\u7684\u503c\u4e0e\u7a0b\u5e8f\u4e2d\u7684\u503c\u5bf9\u5e94\n\n```\nbook= Book.objects.get(pk=book.pk) \n \n# \u6216\u8005\u4f7f\u7528\u66f4\u52a0\u7b80\u5355\u7684\u65b9\u6cd5\uff1a\n \nbook.refresh_from_db()\n```",
"original": false,
"orginal_link": "https://www.cnblogs.com/ttyypjt/p/11232353.html",
"public": true,
"browse_num": 25,
"user": 1,
"add_time": "2020-04-14T13:24:19.126Z",
"modified_time": "2020-04-22T12:39:53.379Z",
"types": [
8
]
}
},
{
"model": "articals.articale",
"pk": 114,
"fields": {
"note": 3,
"title": "javascript\u8bbe\u8ba1\u6a21\u5f0f",
"text_content": "## javascript\u8bbe\u8ba1\u6a21\u5f0f\n\nmax [web\u6280\u672f\u5f00\u53d1](javascript:void(0);) *3\u670819\u65e5*\n\n## \u5355\u4f8b\u6a21\u5f0f\n\n> \u5355\u4f8b\u6a21\u5f0f\u4fdd\u8bc1\u7c7b\u53ea\u6709\u4e00\u4e2a\u5b9e\u4f8b\uff0c\u5e76\u63d0\u4f9b\u4e00\u4e2a\u8bbf\u95ee\u5b83\u7684\u5168\u5c40\u8bbf\u95ee\u70b9\n\njs \u4e2d\u5b9e\u73b0\n\n```\n function getSingle(fn){ let result\n return function (){ return result || (result=fn.apply(this,arguments)) }\n }\n```\n\n## \u7b56\u7565\u6a21\u5f0f\n\n> \u89e3\u51b3\u4e00\u4e2a\u95ee\u9898\u7684\u591a\u4e2a\u65b9\u6cd5\uff0c\u5c06\u6bcf\u79cd\u65b9\u6cd5\u72ec\u7acb\u5c01\u88c5\u8d77\u6765\uff0c\u76f8\u4e92\u53ef\u4ee5\u66ff\u6362\n\n**\u4e00\u4e2a\u57fa\u4e8e\u7b56\u7565\u6a21\u5f0f\u7684\u7a0b\u5e8f\u81f3\u5c11\u7531\u4e24\u90e8\u5206\u7ec4\u6210\uff0c\u4e00\u4e2a\u662f\u4e00\u7ec4\u7b56\u7565\u7c7b\uff0c\u7b56\u7565\u7c7b\u5c01\u88c5\u4e86\u5177\u4f53\u7684\u7b97\u6cd5\uff0c\u5e76\u8d1f\u8d23\u5177\u4f53\u7684\u8ba1\u7b97\u8fc7\u7a0b\uff0c\u4e00\u4e2a\u662f\u73af\u5883\u7c7b\uff0c\u73af\u5883\u7c7b\u63a5\u53d7\u5ba2\u6237\u7684\u8bf7\u6c42\uff0c\u968f\u540e\u628a\u8bf7\u6c42\u59d4\u6258\u7ed9\u67d0\u4e2a\u7b56\u7565\u7c7b**\n\n\u7b56\u7565\u6a21\u5f0f\u7684\u4e00\u4e2a\u4f7f\u7528\u573a\u666f\uff1a\u8868\u5355\u9a8c\u8bc1\uff0c\u5c06\u4e0d\u540c\u9a8c\u8bc1\u89c4\u5219\u5c01\u88c5\u6210\u4e00\u7ec4\u7b56\u7565\uff0c\u907f\u514d\u4e86\u591a\u91cd\u6761\u4ef6\u5224\u65ad\u8bed\u53e5\n\n\u4e00\u53e5\u7ecf\u5178\u7684\u8bdd: *\u5728\u51fd\u6570\u4f5c\u4e3a\u4e00\u7b49\u5bf9\u8c61\u7684\u8bed\u8a00\u4e2d\uff0c\u7b56\u7565\u6a21\u5f0f\u662f\u9690\u6027\u7684\uff0c\u7b56\u7565\u5c31\u662f\u503c\u4e3a\u51fd\u6570\u7684\u53d8\u91cf*\n\n\u4f8b\u5b50:\n\n```\n const S = (salary)=>{ return salary * 4 } const A = (salary)=>{ return salary * 3 } const B = (salary)=>{ return salary * 2 }\n const calculate = (fun,salary)=>{ return fun(salary) } calculate(S,1000)\n```\n\n## \u4ee3\u7406\u6a21\u5f0f\n\n> \u4ee3\u7406\u6a21\u5f0f\u4e3a\u4e00\u4e2a\u5bf9\u8c61\u63d0\u4f9b\u4e00\u4e2a\u4ee3\u7528\u54c1\u6216\u5360\u4f4d\u7b26\uff0c\u4ee5\u4fbf\u63a7\u5236\u5bf9\u5b83\u7684\u8bbf\u95ee\n\n\u4e0d\u76f4\u63a5\u548c\u672c\u4f53\u8fdb\u884c\u4ea4\u4e92\uff0c\u800c\u662f\u5728\u4e2d\u95f4\u52a0\u5165\u4e00\u5c42\u4ee3\u7406\uff0c\u4ee3\u7406\u6765\u5904\u7406\u4e00\u4e9b\u4e0d\u9700\u8981\u672c\u4f53\u505a\u7684\u64cd\u4f5c\n\n```\nvar myImage=function(){ var imgNode=document.createElement('img') document.body.appendChild(imgNode) return { setImg(src){ imgNode.src=src } }}\nvar proxyImg=function(){ var img =new Image() img.onload=function(){ myImage.setSrc(this.src) } return { setImg(src){ myImage.setSrc(\u2018loading.png\u2019) img.src=src } }}\n```\n\n\u4ee3\u7406\u7684\u610f\u4e49\n\n\u5bf9\u5355\u4e00\u804c\u8d23\u539f\u5219\u7684\u4e00\u79cd\u8868\u73b0\uff0c\u5355\u4e00\u804c\u8d23\u539f\u5219\u6307\u7684\u662f\uff0c\u4e00\u4e2a\u51fd\u6570\u6216\u7c7b\u5e94\u8be5\u53ea\u8d1f\u8d23\u4e00\u4ef6\u4e8b\uff0c\u5982\u4f55\u4e00\u4e2a\u51fd\u6570\u804c\u8d23\u592a\u591a\uff0c\u7b49\u4e8e\u628a\u8fd9\u4e9b\u804c\u8d23\u8026\u5408\u5728\u4e86\u4e00\u8d77\uff0c\u5f53\u4e00\u90e8\u5206\u9700\u8981\u6539\u52a8\u65f6\uff0c\u5f88\u6709\u53ef\u80fd\u5c31\u5f71\u54cd\u5230\u4e86\u51fd\u6570\u7684\u5176\u4ed6\u90e8\u5206\n\n## \u89c2\u5bdf\u8005\u548c\u53d1\u5e03\u8ba2\u9605\u6a21\u5f0f\n\n\u89c2\u5bdf\u8005\u548c\u53d1\u5e03\u3001\u8ba2\u9605\u6a21\u5f0f\u4f7f\u7a0b\u5e8f\u7684\u4e24\u90e8\u5206\u4e0d\u5fc5\u7d27\u5bc6\u8026\u5408\u5728\u4e00\u8d77\uff0c\u800c\u662f\u901a\u8fc7\u901a\u77e5\u7684\u65b9\u5f0f\u6765\u901a\u4fe1\n\n- \u89c2\u5bdf\u8005\u6a21\u5f0f\n\n> \u4e00\u4e2a\u5bf9\u8c61\u7ef4\u6301\u4e00\u7cfb\u5217\u4f9d\u8d56\u4e8e\u5b83\u7684\u5bf9\u8c61\uff0c\u5f53\u5bf9\u8c61\u72b6\u6001\u53d1\u751f\u6539\u53d8\u65f6\u4e3b\u52a8\u901a\u77e5\u8fd9\u4e9b\u4f9d\u8d56\u5bf9\u8c61\n\n\u8fd9\u91cc\u6ce8\u610f\u662f\u5bf9\u8c61\u76f4\u63a5\u7ba1\u7406\u7740\u4f9d\u8d56\u5217\u8868\uff0c\u8fd9\u70b9\u4e5f\u662f\u89c2\u5bdf\u8005\u6a21\u5f0f\u548c\u53d1\u5e03\u3001\u8ba2\u9605\u6a21\u5f0f\u7684\u4e3b\u8981\u533a\u522b\n\n```\nclass Subject{ constructor(){ this.observers=[] } add(observer){ this.observers.push(observer) } notify(data){ for(let observer of this.observers){ observer.update(data) } } }\n class Observer{ update(){\n } }\n```\n\n\u89c2\u5bdf\u8005\u6a21\u5f0f\u7684\u7f3a\u70b9\u662f\u5bf9\u8c61\u5fc5\u987b\u81ea\u5df1\u7ef4\u62a4\u4e00\u4e2a\u89c2\u5bdf\u8005\u5217\u8868\uff0c\u5f53\u5bf9\u8c61\u72b6\u6001\u6709\u66f4\u65b0\u65f6\uff0c\u76f4\u63a5\u8c03\u7528\u5176\u4ed6\u5bf9\u8c61\u7684\u65b9\u6cd5\uff0c\u6240\u4ee5\uff0c\u5728\u4f7f\u7528\u4e2d\uff0c\u6211\u4eec\u4e00\u822c\u91c7\u7528\u4e00\u79cd\u53d8\u5f62\u65b9\u5f0f\uff0c\u5373\u53d1\u5e03\u8ba2\u9605\u6a21\u5f0f\n\n- \u53d1\u5e03\u8ba2\u9605\u6a21\u5f0f\n\n\u8be5\u6a21\u5f0f\u5728\u4e3b\u9898\u548c\u89c2\u5bdf\u8005\u4e4b\u95f4\u52a0\u5165\u4e00\u5c42\u7ba1\u9053\uff0c\u4f7f\u5f97\u4e3b\u9898\u548c\u89c2\u5bdf\u8005\u4e0d\u76f4\u63a5\u4ea4\u4e92\uff0c\u53d1\u5e03\u8005\u5c06\u5185\u5bb9\u53d1\u5e03\u5230\u7ba1\u9053\uff0c\u8ba2\u9605\u8005\u8ba2\u9605\u7ba1\u9053\u91cc\u7684\u5185\u5bb9\uff0c\u76ee\u7684\u662f\u907f\u514d\u8ba2\u9605\u8005\u548c\u53d1\u5e03\u8005\u4e4b\u95f4\u4ea7\u751f\u4f9d\u8d56\u5173\u7cfb\n\n```\n class Pubsub{\n constuctor(){ this.pubsub={} this.subId=-1 }\n publish(topic,data){ if(!this.pubsub[topic]) return const subs=this.pubsub[topic] const len=subs.length while(len--){ subs[len].update(topic,data) } }\n /** * topic {string} * update {function} */ subscribe(topic,update){ !this.pubsub[topic] && (this.pubsub[topic]=[]) this.subId++ this.pubsub[topic].push({ token:this.subId, update }) }\n unsubscribe(token){ for(let topic in this.pubsub){ if(this.pubsub.hasOwnProperty(topic)){ const current=this.pubsub[topic] for(let i=0,j=current.length;i<j;i++){ if(current[i].token==token){ current.splice(i,1) return token } } } } return this }\n }\n```\n\n\u53d1\u5e03\u8ba2\u9605\u6a21\u5f0f\u662f\u5728\u6846\u67b6\u8bbe\u8ba1\u4e2d\u7ecf\u5e38\u4f7f\u7528\u7684\u4e00\u79cd\u8bbe\u8ba1\u6a21\u5f0f\uff0cangularjs \u4e2d\u7684\u81ea\u5b9a\u4e49\u4e8b\u4ef6\uff0cRxjs, \u72b6\u6001\u7ba1\u7406\u7684 redux \u7b49\u90fd\u80fd\u770b\u5230\u5b83\u7684\u8eab\u5f71\n\n## \u547d\u4ee4\u6a21\u5f0f\n\n> \u547d\u4ee4\u6a21\u5f0f\u7684\u547d\u4ee4\u6307\u7684\u662f\u4e00\u4e2a\u6267\u884c\u67d0\u4e9b\u7279\u5b9a\u4e8b\u60c5\u7684\u6307\u4ee4\n\n\u547d\u4ee4\u6a21\u5f0f\u6700\u5e38\u89c1\u7684\u4f7f\u7528\u573a\u666f\u662f\uff1a\u6709\u65f6\u5019\u9700\u8981\u5411\u67d0\u4e9b\u5bf9\u8c61\u53d1\u9001\u8bf7\u6c42\uff0c\u4f46\u662f\u4e0d\u77e5\u9053\u8bf7\u6c42\u7684\u63a5\u53d7\u8005\u662f\u8c01\uff0c\u4e5f\u4e0d\u77e5\u9053\u88ab\u8bf7\u6c42\u7684\u64cd\u4f5c\u662f\u4ec0\u4e48\u3002\u6b64\u65f6\u5e0c\u671b\u7528\u4e00\u79cd\u677e\u8026\u5408\u7684\u65b9\u5f0f\u6765\u8bbe\u8ba1\u7a0b\u5e8f\uff0c\u662f\u4f7f\u5f97\u8bf7\u6c42\u53d1\u9001\u8005\u548c\u63a5\u53d7\u8005\u6d88\u9664\u5f7c\u6b64\u4e4b\u95f4\u7684\u8026\u5408\u5173\u7cfb\n\n**\u547d\u4ee4\u6a21\u5f0f\u7684\u7531\u6765\uff0c\u5176\u5b9e\u662f\u56de\u8c03\u51fd\u6570\u7684\u4e00\u4e2a\u9762\u5411\u5bf9\u8c61\u7684\u66ff\u4ee3\u54c1**\n\n\u4e00\u53e5\u8bdd\u6765\u8bf4\uff0c\u547d\u4ee4\u6a21\u5f0f\u5c31\u662f\u7528\u4e00\u4e2a\u51fd\u6570\u6765\u5305\u88f9\u4e00\u4e2a\u5177\u4f53\u7684\u5b9e\u73b0\uff0c\u8fd9\u4e2a\u51fd\u6570\u7edf\u4e00\u5b9a\u4e49\u4e86\u4e00\u4e2a execute \u65b9\u6cd5\u6765\u8c03\u7528\u5177\u4f53\u7684\u5b9e\u73b0\u65b9\u6cd5\uff0c\u800c\u8bf7\u6c42\u8005\u53ea\u8981\u548c\u8fd9\u4e2a\u547d\u4ee4\u51fd\u6570\u4ea4\u6d41\u5c31\u884c\n\n## \u4eab\u5143\u6a21\u5f0f\n\n> \u4eab\u5143\u6a21\u5f0f\u987e\u540d\u601d\u4e49\uff0c\u5171\u4eab\u4e00\u4e9b\u5355\u5143\uff0c\u7528\u4e8e\u4f18\u5316\u91cd\u590d\u3001\u7f13\u6162\u53ca\u6570\u636e\u5171\u4eab\u6548\u7387\u8f83\u4f4e\u7684\u4ee3\u7801\n\n\u5e94\u7528\uff1a\u4e00\u662f\u7528\u4e8e\u6570\u636e\u5c42\uff0c\u5904\u7406\u5185\u5b58\u4e2d\u4fdd\u5b58\u7684\u5927\u91cf\u76f8\u4f3c\u5bf9\u8c61\u7684\u5171\u4eab\u6570\u636e\uff0c\u4e8c\u662f\u7528\u4e8e DOM \u5c42\uff0c\u4e8b\u4ef6\u4ee3\u7406\n\n*\u5728\u4eab\u5143\u6a21\u5f0f\u4e2d\uff0c\u6709\u4e2a\u6709\u5173\u4e24\u4e2a\u72b6\u6001\u7684\u6982\u5ff5 - \u5185\u90e8\u548c\u5916\u90e8*\n\n\u5185\u90e8\u72b6\u6001\u5b58\u50a8\u4e8e\u5bf9\u8c61\u5185\u90e8\uff0c\u53ef\u4ee5\u88ab\u4e00\u4e9b\u5bf9\u8c61\u5171\u4eab\uff0c\u72ec\u7acb\u4e8e\u5177\u4f53\u7684\u573a\u666f\uff0c\u901a\u5e38\u4e0d\u4f1a\u53d8\n\n\u5916\u90e8\u72b6\u6001\u6839\u636e\u573a\u666f\u800c\u53d8\u5316\n\n**\u5265\u79bb\u4e86\u5916\u90e8\u72b6\u6001\u7684\u5bf9\u8c61\u6210\u4e3a\u5171\u4eab\u5bf9\u8c61\uff0c\u5916\u90e8\u72b6\u6001\u5728\u5fc5\u8981\u65f6\u88ab\u4f20\u5165\u5171\u4eab\u5bf9\u8c61\u6765\u7ec4\u6210\u4e00\u4e2a\u5b8c\u6574\u7684\u5bf9\u8c61**\n\n\u4f7f\u7528\u4eab\u5143\u6a21\u5f0f\u7684\u51e0\u4e2a\u6b65\u9aa4\uff1a\n\n\u4ee5\u4e66\u4e2d\u6587\u4ef6\u4e0a\u4f20\u7684\u4f8b\u5b50\u63cf\u8ff0\n\n1. \u5265\u79bb\u5916\u90e8\u72b6\u6001\n\n```\n class Upload{\n constructor(type){ this.uploadType=type }\n delFile(id){ uploadManager.setExternalState(id,this) //\u8fd9\u91cc\u5c31\u662f\u7ec4\u88c5\u5916\u90e8\u72b6\u6001\u6765\u4f7f\u5171\u4eab\u5bf9\u8c61\u53d8\u6210\u4e00\u4e2a\u5177\u4f53\u7684\u5bf9\u8c61 if(this.fileSize<3000){ //\u76f4\u63a5\u5220\u9664 return } //\u5f39\u7a97\u8be2\u95ee\u786e\u8ba4\u5220\u9664\uff1f }\n }\n```\n\n 2.\u4f7f\u7528\u5de5\u5382\u8fdb\u884c\u5bf9\u8c61\u5b9e\u4f8b\u5316\n\n```\n var UploadFactory=(function(){ const flyWeightObjs={} return { create(uploadType){ if(flyWeightObjs[uploadType]){ return flyWeightObjs[uploadType] } return flyWeightObjs[uploadType]=new Upload(uoloadType) } } })()\n```\n\n 3.\u4f7f\u7528\u7ba1\u7406\u5668\u5c01\u88c5\u5916\u90e8\u72b6\u6001\n\n```\nvar uploadManager=(function(){ var uploadDatabase={} return { add(id,uploadType,fileSize,fileName){ var flyWeightObj=UploadFactory.create(uploadType) //\u90a3\u4e2a\u88ab\u5171\u4eab\u7684\u5bf9\u8c61 //\u521b\u5efa\u7ed3\u70b9... //\u5220\u9664\u64cd\u4f5c dom.onclick=function(){ flyWeightObj.delFile(id) //\u8fd9\u4e2a\u5171\u4eab\u5728\u6b65\u9aa41\u4e2d\u4f1a\u88ab\u7ec4\u5408\uff0c\u53ef\u4ee5\u770b\u5230\uff0c\u53ea\u6709\u5728\u5220\u9664\u64cd\u4f5c\u7684\u65f6\u5019\uff0c\u6211\u4eec\u624d\u9700\u8981\u90a3\u4e9b\u5916\u90e8\u72b6\u6001 } uploadDatabase[id]={ fileName, fileSize, dom } return flyWeightObj }\uff0c setExternalState(id,flyWeight){ var externalState=uploadDatabase[id] Object.assign(flyWeight,externalState) } }})()\n```\n\n## \u8d23\u4efb\u94fe\u6a21\u5f0f\n\n> \u5c06\u4e00\u4e2a\u8bf7\u6c42\u7528\u6765\u4f20\u9012\u7ed9\u591a\u4e2a\u51fd\u6570\uff0c\u82e5\u8bf7\u6c42\u7b26\u5408\u5f53\u524d\u51fd\u6570\u8981\u6c42\uff0c\u5219\u5f53\u524d\u51fd\u6570\u5904\u7406\uff0c\u5426\u5219\uff0c\u4f20\u7ed9\u4e0b\u4e00\u4e2a\n\n**\u5f88\u597d\u5f88\u5f3a\u5927**\n\n\u8d23\u4efb\u94fe\u6a21\u5f0f\u53ef\u4ee5\u5f88\u597d\u7684\u907f\u514d\u5927\u91cf\u7684 if,else if,else\n\n```\nif (Function.prototype.chainAfter) { throw new Error('the chainAfter method already exist')} else { Function.prototype.chainAfter = function (fn) { return (...args) => { const ret = this.apply(this, [...args, () => { return fn && fn.apply(this, args) }]) if (ret === 'NEXT') { return fn && fn.apply(this, args) } return ret } }}\n/** * example * class Test{ * * test(...args){ * alert('test') * return 'NEXT' * } * * test1(...args){ * * setTimeout(()=>{ * alert('test1') * args.pop()() * }) * } * * test2(...args){ * alert('test2') * } * * $onInit(){ * const chain = this.test.bind(this) * .chainAfter(this.test1.bind(this)) * .chainAfter(this.test2.bind(this)) * chain(1,2,3) * } * } * */\n```\n\n## \u88c5\u9970\u8005\u6a21\u5f0f\n\n> \u5728\u4e0d\u6539\u53d8\u539f\u6709\u51fd\u6570\u6216\u5bf9\u8c61\u529f\u80fd\u7684\u57fa\u7840\u4e0a\uff0c\u7ed9\u5b83\u4eec\u65b0\u52a0\u529f\u80fd\n\n\u7528 AOP \u88c5\u9970\u51fd\u6570\n\n```\nif (Function.prototype.before) { throw new Error('the before method already exist')} else { Function.prototype.before = function (beforefn) { return () => { if (beforefn.apply(this, arguments)) { this.apply(this, arguments) } } }}\nif (Function.prototype.after) { throw new Error('the after method already exist')} else { Function.prototype.after = function (afterfn) { return () => { this.apply(this, arguments) afterfn.apply(this, arguments) } }}\n```\n\n## \u72b6\u6001\u6a21\u5f0f\n\n> \u5141\u8bb8\u4e00\u4e2a\u5bf9\u8c61\u5728\u5176\u5185\u90e8\u72b6\u6001\u6539\u53d8\u65f6\u6539\u53d8\u5b83\u7684\u884c\u4e3a\uff0c\u5bf9\u8c61\u770b\u8d77\u6765\u4f3c\u4e4e\u4fee\u6539\u4e86\u5b83\u7684\u7c7b\n\n\u8981\u70b9\uff1a\u5c06\u72b6\u6001\u5c01\u88c5\u6210\u72ec\u7acb\u7684\u51fd\u6570\uff0c\u5e76\u5c06\u8bf7\u6c42\u59d4\u6258\u7ed9 `\u5f53\u524d\u7684\u72b6\u6001\u5bf9\u8c61`\uff0c\u5f53\u5bf9\u8c61\u7684\u5185\u90e8\u72b6\u6001\u6539\u53d8\u65f6\uff0c\u4f1a\u5e26\u6765\u4e0d\u540c\u7684\u884c\u4e3a\u53d8\u5316\n\n\u7535\u706f\u7684\u4f8b\u5b50\uff1a\n\n\u4e00\u4e2a\u6309\u94ae\u63a7\u5236\u7535\u706f\u7684\u5f00\u5173\uff0c\u6309\u4e00\u4e0b\u662f\u5f00\uff0c\u518d\u6309\u4e00\u4e0b\u662f\u5173\n\n\u521d\u59cb\u5b9e\u73b0\uff1a\n\n```\nclass Light{ constructor(){ this.state='off', this.button=null } init(){ //\u521b\u5efa\u6309\u94ae\u7ed3\u70b9 .....\n this.button.onClick=()=>{ this.btnPressed() } } btnPressed(){ if(this.state=='off'){ this.state='on }else { this.state='off' } }}\n```\n\n\u8fd9\u6bb5\u4ee3\u7801\u7684\u7f3a\u70b9\u5c31\u662f\u4e0d\u6613\u6269\u5c55\uff0c\u5f53\u8981\u52a0\u5165\u4e00\u79cd\u95ea\u52a8\u7684\u72b6\u6001\u65f6\uff0c\u5c31\u8981\u4fee\u6539 btnPressed \u4e2d\u7684\u4ee3\u7801\n\n\u4f7f\u7528\u72b6\u6001\u6a21\u5f0f\u6539\u5199\n\n```\nclass Light{ constructor(){ this.state=FSM.off, this.button=null } init(){ //\u521b\u5efa\u6309\u94ae\u7ed3\u70b9 .....\n this.button.onClick=()=>{ this.state.btnPressed.call(this) } }}\nconst FSM={ on:{ btnPressed(){ //\u5904\u7406 this.state=FMS.on } }, off:{ btnPressed(){ //\u5904\u7406 this.state=FMS.off } }}\n```",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 5,
"user": 1,
"add_time": "2020-04-16T15:19:05.848Z",
"modified_time": "2020-04-21T07:58:23.221Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 115,
"fields": {
"note": 3,
"title": "javascript\u8bbe\u8ba1\u6a21\u5f0f",
"text_content": "## javascript\u8bbe\u8ba1\u6a21\u5f0f\n\nmax [web\u6280\u672f\u5f00\u53d1](javascript:void(0);) *3\u670819\u65e5*\n\n## \u5355\u4f8b\u6a21\u5f0f\n\n> \u5355\u4f8b\u6a21\u5f0f\u4fdd\u8bc1\u7c7b\u53ea\u6709\u4e00\u4e2a\u5b9e\u4f8b\uff0c\u5e76\u63d0\u4f9b\u4e00\u4e2a\u8bbf\u95ee\u5b83\u7684\u5168\u5c40\u8bbf\u95ee\u70b9\n\njs \u4e2d\u5b9e\u73b0\n\n```javascript\n function getSingle(fn){ \n let result\n return function (){ \n \treturn result || (result=fn.apply(this,arguments))\n }\n }\n```\n\n## \u7b56\u7565\u6a21\u5f0f\n\n> \u89e3\u51b3\u4e00\u4e2a\u95ee\u9898\u7684\u591a\u4e2a\u65b9\u6cd5\uff0c\u5c06\u6bcf\u79cd\u65b9\u6cd5\u72ec\u7acb\u5c01\u88c5\u8d77\u6765\uff0c\u76f8\u4e92\u53ef\u4ee5\u66ff\u6362\n\n**\u4e00\u4e2a\u57fa\u4e8e\u7b56\u7565\u6a21\u5f0f\u7684\u7a0b\u5e8f\u81f3\u5c11\u7531\u4e24\u90e8\u5206\u7ec4\u6210\uff0c\u4e00\u4e2a\u662f\u4e00\u7ec4\u7b56\u7565\u7c7b\uff0c\u7b56\u7565\u7c7b\u5c01\u88c5\u4e86\u5177\u4f53\u7684\u7b97\u6cd5\uff0c\u5e76\u8d1f\u8d23\u5177\u4f53\u7684\u8ba1\u7b97\u8fc7\u7a0b\uff0c\u4e00\u4e2a\u662f\u73af\u5883\u7c7b\uff0c\u73af\u5883\u7c7b\u63a5\u53d7\u5ba2\u6237\u7684\u8bf7\u6c42\uff0c\u968f\u540e\u628a\u8bf7\u6c42\u59d4\u6258\u7ed9\u67d0\u4e2a\u7b56\u7565\u7c7b**\n\n\u7b56\u7565\u6a21\u5f0f\u7684\u4e00\u4e2a\u4f7f\u7528\u573a\u666f\uff1a\u8868\u5355\u9a8c\u8bc1\uff0c\u5c06\u4e0d\u540c\u9a8c\u8bc1\u89c4\u5219\u5c01\u88c5\u6210\u4e00\u7ec4\u7b56\u7565\uff0c\u907f\u514d\u4e86\u591a\u91cd\u6761\u4ef6\u5224\u65ad\u8bed\u53e5\n\n\u4e00\u53e5\u7ecf\u5178\u7684\u8bdd: *\u5728\u51fd\u6570\u4f5c\u4e3a\u4e00\u7b49\u5bf9\u8c61\u7684\u8bed\u8a00\u4e2d\uff0c\u7b56\u7565\u6a21\u5f0f\u662f\u9690\u6027\u7684\uff0c\u7b56\u7565\u5c31\u662f\u503c\u4e3a\u51fd\u6570\u7684\u53d8\u91cf*\n\n\u4f8b\u5b50:\n\n```javascript\n const S = (salary)=>{\n \treturn salary * 4 \n \t} \n const A = (salary)=>{\n \treturn salary * 3 \n } \n const B = (salary)=>{\n \treturn salary * 2 \n \t}\n const calculate = (fun,salary)=>{\n \treturn fun(salary) \n \t} \n calculate(S,1000)\n```\n\n## \u4ee3\u7406\u6a21\u5f0f\n\n> \u4ee3\u7406\u6a21\u5f0f\u4e3a\u4e00\u4e2a\u5bf9\u8c61\u63d0\u4f9b\u4e00\u4e2a\u4ee3\u7528\u54c1\u6216\u5360\u4f4d\u7b26\uff0c\u4ee5\u4fbf\u63a7\u5236\u5bf9\u5b83\u7684\u8bbf\u95ee\n\n\u4e0d\u76f4\u63a5\u548c\u672c\u4f53\u8fdb\u884c\u4ea4\u4e92\uff0c\u800c\u662f\u5728\u4e2d\u95f4\u52a0\u5165\u4e00\u5c42\u4ee3\u7406\uff0c\u4ee3\u7406\u6765\u5904\u7406\u4e00\u4e9b\u4e0d\u9700\u8981\u672c\u4f53\u505a\u7684\u64cd\u4f5c\n\n```javascript\nvar myImage=function(){\n var imgNode=document.createElement('img')\n document.body.appendChild(imgNode) \n return {\n setImg(src){\n imgNode.src=src\n } \n }}\nvar proxyImg=function(){\n var img =new Image()\n img.onload=function(){\n myImage.setSrc(this.src) \n }\n return {\n setImg(src){\n myImage.setSrc(\u2018loading.png\u2019)\n img.src=src\n } \n }}\n```\n\n\u4ee3\u7406\u7684\u610f\u4e49\n\n\u5bf9\u5355\u4e00\u804c\u8d23\u539f\u5219\u7684\u4e00\u79cd\u8868\u73b0\uff0c\u5355\u4e00\u804c\u8d23\u539f\u5219\u6307\u7684\u662f\uff0c\u4e00\u4e2a\u51fd\u6570\u6216\u7c7b\u5e94\u8be5\u53ea\u8d1f\u8d23\u4e00\u4ef6\u4e8b\uff0c\u5982\u4f55\u4e00\u4e2a\u51fd\u6570\u804c\u8d23\u592a\u591a\uff0c\u7b49\u4e8e\u628a\u8fd9\u4e9b\u804c\u8d23\u8026\u5408\u5728\u4e86\u4e00\u8d77\uff0c\u5f53\u4e00\u90e8\u5206\u9700\u8981\u6539\u52a8\u65f6\uff0c\u5f88\u6709\u53ef\u80fd\u5c31\u5f71\u54cd\u5230\u4e86\u51fd\u6570\u7684\u5176\u4ed6\u90e8\u5206\n\n## \u89c2\u5bdf\u8005\u548c\u53d1\u5e03\u8ba2\u9605\u6a21\u5f0f\n\n\u89c2\u5bdf\u8005\u548c\u53d1\u5e03\u3001\u8ba2\u9605\u6a21\u5f0f\u4f7f\u7a0b\u5e8f\u7684\u4e24\u90e8\u5206\u4e0d\u5fc5\u7d27\u5bc6\u8026\u5408\u5728\u4e00\u8d77\uff0c\u800c\u662f\u901a\u8fc7\u901a\u77e5\u7684\u65b9\u5f0f\u6765\u901a\u4fe1\n\n- \u89c2\u5bdf\u8005\u6a21\u5f0f\n\n> \u4e00\u4e2a\u5bf9\u8c61\u7ef4\u6301\u4e00\u7cfb\u5217\u4f9d\u8d56\u4e8e\u5b83\u7684\u5bf9\u8c61\uff0c\u5f53\u5bf9\u8c61\u72b6\u6001\u53d1\u751f\u6539\u53d8\u65f6\u4e3b\u52a8\u901a\u77e5\u8fd9\u4e9b\u4f9d\u8d56\u5bf9\u8c61\n\n\u8fd9\u91cc\u6ce8\u610f\u662f\u5bf9\u8c61\u76f4\u63a5\u7ba1\u7406\u7740\u4f9d\u8d56\u5217\u8868\uff0c\u8fd9\u70b9\u4e5f\u662f\u89c2\u5bdf\u8005\u6a21\u5f0f\u548c\u53d1\u5e03\u3001\u8ba2\u9605\u6a21\u5f0f\u7684\u4e3b\u8981\u533a\u522b\n\n```javascript\nclass Subject{\n constructor(){\n this.observers=[]\n }\n add(observer){\n this.observers.push(observer)\n }\n notify(data){\n for(let observer of this.observers){\n observer.update(data)\n }\n }\n}\nclass Observer{\n update(){\n }\n}\n```\n\n\u89c2\u5bdf\u8005\u6a21\u5f0f\u7684\u7f3a\u70b9\u662f\u5bf9\u8c61\u5fc5\u987b\u81ea\u5df1\u7ef4\u62a4\u4e00\u4e2a\u89c2\u5bdf\u8005\u5217\u8868\uff0c\u5f53\u5bf9\u8c61\u72b6\u6001\u6709\u66f4\u65b0\u65f6\uff0c\u76f4\u63a5\u8c03\u7528\u5176\u4ed6\u5bf9\u8c61\u7684\u65b9\u6cd5\uff0c\u6240\u4ee5\uff0c\u5728\u4f7f\u7528\u4e2d\uff0c\u6211\u4eec\u4e00\u822c\u91c7\u7528\u4e00\u79cd\u53d8\u5f62\u65b9\u5f0f\uff0c\u5373\u53d1\u5e03\u8ba2\u9605\u6a21\u5f0f\n\n- \u53d1\u5e03\u8ba2\u9605\u6a21\u5f0f\n\n\u8be5\u6a21\u5f0f\u5728\u4e3b\u9898\u548c\u89c2\u5bdf\u8005\u4e4b\u95f4\u52a0\u5165\u4e00\u5c42\u7ba1\u9053\uff0c\u4f7f\u5f97\u4e3b\u9898\u548c\u89c2\u5bdf\u8005\u4e0d\u76f4\u63a5\u4ea4\u4e92\uff0c\u53d1\u5e03\u8005\u5c06\u5185\u5bb9\u53d1\u5e03\u5230\u7ba1\u9053\uff0c\u8ba2\u9605\u8005\u8ba2\u9605\u7ba1\u9053\u91cc\u7684\u5185\u5bb9\uff0c\u76ee\u7684\u662f\u907f\u514d\u8ba2\u9605\u8005\u548c\u53d1\u5e03\u8005\u4e4b\u95f4\u4ea7\u751f\u4f9d\u8d56\u5173\u7cfb\n\n```javascript\n class Pubsub{\n\n\n\n constuctor(){\n\n this.pubsub={}\n\n this.subId=-1\n\n }\n\n\n\n publish(topic,data){\n\n if(!this.pubsub[topic]) return\n\n const subs=this.pubsub[topic]\n\n const len=subs.length\n\n while(len--){\n\n subs[len].update(topic,data)\n\n }\n\n }\n\n\n\n /**\n\n * topic {string}\n\n * update {function}\n\n */\n\n subscribe(topic,update){\n\n !this.pubsub[topic] && (this.pubsub[topic]=[])\n\n this.subId++\n\n this.pubsub[topic].push({\n\n token:this.subId,\n\n update\n\n })\n\n }\n\n\n\n unsubscribe(token){\n\n for(let topic in this.pubsub){\n\n if(this.pubsub.hasOwnProperty(topic)){\n\n const current=this.pubsub[topic]\n\n for(let i=0,j=current.length;i<j;i++){\n\n if(current[i].token==token){\n\n current.splice(i,1)\n\n return token\n\n }\n\n }\n\n }\n\n }\n\n return this\n\n }\n\n\n\n }\n```\n\n\u53d1\u5e03\u8ba2\u9605\u6a21\u5f0f\u662f\u5728\u6846\u67b6\u8bbe\u8ba1\u4e2d\u7ecf\u5e38\u4f7f\u7528\u7684\u4e00\u79cd\u8bbe\u8ba1\u6a21\u5f0f\uff0cangularjs \u4e2d\u7684\u81ea\u5b9a\u4e49\u4e8b\u4ef6\uff0cRxjs, \u72b6\u6001\u7ba1\u7406\u7684 redux \u7b49\u90fd\u80fd\u770b\u5230\u5b83\u7684\u8eab\u5f71\n\n## \u547d\u4ee4\u6a21\u5f0f\n\n> \u547d\u4ee4\u6a21\u5f0f\u7684\u547d\u4ee4\u6307\u7684\u662f\u4e00\u4e2a\u6267\u884c\u67d0\u4e9b\u7279\u5b9a\u4e8b\u60c5\u7684\u6307\u4ee4\n\n\u547d\u4ee4\u6a21\u5f0f\u6700\u5e38\u89c1\u7684\u4f7f\u7528\u573a\u666f\u662f\uff1a\u6709\u65f6\u5019\u9700\u8981\u5411\u67d0\u4e9b\u5bf9\u8c61\u53d1\u9001\u8bf7\u6c42\uff0c\u4f46\u662f\u4e0d\u77e5\u9053\u8bf7\u6c42\u7684\u63a5\u53d7\u8005\u662f\u8c01\uff0c\u4e5f\u4e0d\u77e5\u9053\u88ab\u8bf7\u6c42\u7684\u64cd\u4f5c\u662f\u4ec0\u4e48\u3002\u6b64\u65f6\u5e0c\u671b\u7528\u4e00\u79cd\u677e\u8026\u5408\u7684\u65b9\u5f0f\u6765\u8bbe\u8ba1\u7a0b\u5e8f\uff0c\u662f\u4f7f\u5f97\u8bf7\u6c42\u53d1\u9001\u8005\u548c\u63a5\u53d7\u8005\u6d88\u9664\u5f7c\u6b64\u4e4b\u95f4\u7684\u8026\u5408\u5173\u7cfb\n\n**\u547d\u4ee4\u6a21\u5f0f\u7684\u7531\u6765\uff0c\u5176\u5b9e\u662f\u56de\u8c03\u51fd\u6570\u7684\u4e00\u4e2a\u9762\u5411\u5bf9\u8c61\u7684\u66ff\u4ee3\u54c1**\n\n\u4e00\u53e5\u8bdd\u6765\u8bf4\uff0c\u547d\u4ee4\u6a21\u5f0f\u5c31\u662f\u7528\u4e00\u4e2a\u51fd\u6570\u6765\u5305\u88f9\u4e00\u4e2a\u5177\u4f53\u7684\u5b9e\u73b0\uff0c\u8fd9\u4e2a\u51fd\u6570\u7edf\u4e00\u5b9a\u4e49\u4e86\u4e00\u4e2a execute \u65b9\u6cd5\u6765\u8c03\u7528\u5177\u4f53\u7684\u5b9e\u73b0\u65b9\u6cd5\uff0c\u800c\u8bf7\u6c42\u8005\u53ea\u8981\u548c\u8fd9\u4e2a\u547d\u4ee4\u51fd\u6570\u4ea4\u6d41\u5c31\u884c\n\n## \u4eab\u5143\u6a21\u5f0f\n\n> \u4eab\u5143\u6a21\u5f0f\u987e\u540d\u601d\u4e49\uff0c\u5171\u4eab\u4e00\u4e9b\u5355\u5143\uff0c\u7528\u4e8e\u4f18\u5316\u91cd\u590d\u3001\u7f13\u6162\u53ca\u6570\u636e\u5171\u4eab\u6548\u7387\u8f83\u4f4e\u7684\u4ee3\u7801\n\n\u5e94\u7528\uff1a\u4e00\u662f\u7528\u4e8e\u6570\u636e\u5c42\uff0c\u5904\u7406\u5185\u5b58\u4e2d\u4fdd\u5b58\u7684\u5927\u91cf\u76f8\u4f3c\u5bf9\u8c61\u7684\u5171\u4eab\u6570\u636e\uff0c\u4e8c\u662f\u7528\u4e8e DOM \u5c42\uff0c\u4e8b\u4ef6\u4ee3\u7406\n\n*\u5728\u4eab\u5143\u6a21\u5f0f\u4e2d\uff0c\u6709\u4e2a\u6709\u5173\u4e24\u4e2a\u72b6\u6001\u7684\u6982\u5ff5 - \u5185\u90e8\u548c\u5916\u90e8*\n\n\u5185\u90e8\u72b6\u6001\u5b58\u50a8\u4e8e\u5bf9\u8c61\u5185\u90e8\uff0c\u53ef\u4ee5\u88ab\u4e00\u4e9b\u5bf9\u8c61\u5171\u4eab\uff0c\u72ec\u7acb\u4e8e\u5177\u4f53\u7684\u573a\u666f\uff0c\u901a\u5e38\u4e0d\u4f1a\u53d8\n\n\u5916\u90e8\u72b6\u6001\u6839\u636e\u573a\u666f\u800c\u53d8\u5316\n\n**\u5265\u79bb\u4e86\u5916\u90e8\u72b6\u6001\u7684\u5bf9\u8c61\u6210\u4e3a\u5171\u4eab\u5bf9\u8c61\uff0c\u5916\u90e8\u72b6\u6001\u5728\u5fc5\u8981\u65f6\u88ab\u4f20\u5165\u5171\u4eab\u5bf9\u8c61\u6765\u7ec4\u6210\u4e00\u4e2a\u5b8c\u6574\u7684\u5bf9\u8c61**\n\n\u4f7f\u7528\u4eab\u5143\u6a21\u5f0f\u7684\u51e0\u4e2a\u6b65\u9aa4\uff1a\n\n\u4ee5\u4e66\u4e2d\u6587\u4ef6\u4e0a\u4f20\u7684\u4f8b\u5b50\u63cf\u8ff0\n\n1. \u5265\u79bb\u5916\u90e8\u72b6\u6001\n\n```javascript\nclass Upload{\n\n\n\n constructor(type){\n\n this.uploadType=type\n\n }\n\n\n\n delFile(id){\n\n uploadManager.setExternalState(id,this) //\u8fd9\u91cc\u5c31\u662f\u7ec4\u88c5\u5916\u90e8\u72b6\u6001\u6765\u4f7f\u5171\u4eab\u5bf9\u8c61\u53d8\u6210\u4e00\u4e2a\u5177\u4f53\u7684\u5bf9\u8c61\n\n if(this.fileSize<3000){\n\n //\u76f4\u63a5\u5220\u9664\n\n return\n\n }\n\n //\u5f39\u7a97\u8be2\u95ee\u786e\u8ba4\u5220\u9664\uff1f\n\n }\n\n\n\n }\n```\n\n 2.\u4f7f\u7528\u5de5\u5382\u8fdb\u884c\u5bf9\u8c61\u5b9e\u4f8b\u5316\n\n```javascript\n var UploadFactory=(function(){\n\n const flyWeightObjs={}\n\n return {\n\n create(uploadType){\n\n if(flyWeightObjs[uploadType]){\n\n return flyWeightObjs[uploadType]\n\n }\n\n return flyWeightObjs[uploadType]=new Upload(uoloadType)\n\n }\n\n }\n\n })()\n```\n\n 3.\u4f7f\u7528\u7ba1\u7406\u5668\u5c01\u88c5\u5916\u90e8\u72b6\u6001\n\n```javascript\nvar uploadManager=(function(){\n\n var uploadDatabase={}\n\n return {\n\n add(id,uploadType,fileSize,fileName){\n\n var flyWeightObj=UploadFactory.create(uploadType) //\u90a3\u4e2a\u88ab\u5171\u4eab\u7684\u5bf9\u8c61\n\n //\u521b\u5efa\u7ed3\u70b9...\n\n //\u5220\u9664\u64cd\u4f5c\n\n dom.onclick=function(){\n\n flyWeightObj.delFile(id) //\u8fd9\u4e2a\u5171\u4eab\u5728\u6b65\u9aa41\u4e2d\u4f1a\u88ab\u7ec4\u5408\uff0c\u53ef\u4ee5\u770b\u5230\uff0c\u53ea\u6709\u5728\u5220\u9664\u64cd\u4f5c\u7684\u65f6\u5019\uff0c\u6211\u4eec\u624d\u9700\u8981\u90a3\u4e9b\u5916\u90e8\u72b6\u6001\n\n }\n\n uploadDatabase[id]={\n\n fileName,\n\n fileSize,\n\n dom\n\n }\n\n return flyWeightObj\n\n }\uff0c\n\n setExternalState(id,flyWeight){\n\n var externalState=uploadDatabase[id]\n\n Object.assign(flyWeight,externalState)\n\n }\n\n }\n\n})()\n```\n\n## \u8d23\u4efb\u94fe\u6a21\u5f0f\n\n> \u5c06\u4e00\u4e2a\u8bf7\u6c42\u7528\u6765\u4f20\u9012\u7ed9\u591a\u4e2a\u51fd\u6570\uff0c\u82e5\u8bf7\u6c42\u7b26\u5408\u5f53\u524d\u51fd\u6570\u8981\u6c42\uff0c\u5219\u5f53\u524d\u51fd\u6570\u5904\u7406\uff0c\u5426\u5219\uff0c\u4f20\u7ed9\u4e0b\u4e00\u4e2a\n\n**\u5f88\u597d\u5f88\u5f3a\u5927**\n\n\u8d23\u4efb\u94fe\u6a21\u5f0f\u53ef\u4ee5\u5f88\u597d\u7684\u907f\u514d\u5927\u91cf\u7684 if,else if,else\n\n```javascript\nif (Function.prototype.chainAfter) {\n\n throw new Error('the chainAfter method already exist')\n\n} else {\n\n Function.prototype.chainAfter = function (fn) {\n\n return (...args) => {\n\n const ret = this.apply(this, [...args, () => {\n\n return fn && fn.apply(this, args)\n\n }])\n\n if (ret === 'NEXT') {\n\n return fn && fn.apply(this, args)\n\n }\n\n return ret\n\n }\n\n }\n\n}\n\n\n\n/**\n\n * example\n\n * class Test{\n\n * \n\n * test(...args){\n\n * alert('test')\n\n * return 'NEXT'\n\n * }\n\n *\n\n * test1(...args){\n\n *\n\n * setTimeout(()=>{\n\n * alert('test1')\n\n * args.pop()()\n\n * }) \n\n * }\n\n *\n\n * test2(...args){\n\n * alert('test2')\n\n * }\n\n *\n\n * $onInit(){\n\n * const chain = this.test.bind(this)\n\n * .chainAfter(this.test1.bind(this))\n\n * .chainAfter(this.test2.bind(this))\n\n * chain(1,2,3)\n\n * }\n\n * }\n\n *\n\n */\n```\n\n## \u88c5\u9970\u8005\u6a21\u5f0f\n\n> \u5728\u4e0d\u6539\u53d8\u539f\u6709\u51fd\u6570\u6216\u5bf9\u8c61\u529f\u80fd\u7684\u57fa\u7840\u4e0a\uff0c\u7ed9\u5b83\u4eec\u65b0\u52a0\u529f\u80fd\n\n\u7528 AOP \u88c5\u9970\u51fd\u6570\n\n```javascript\nif (Function.prototype.before) {\n\n throw new Error('the before method already exist')\n\n} else {\n\n Function.prototype.before = function (beforefn) {\n\n return () => {\n\n if (beforefn.apply(this, arguments)) {\n\n this.apply(this, arguments)\n\n }\n\n }\n\n }\n\n}\n\n\n\nif (Function.prototype.after) {\n\n throw new Error('the after method already exist')\n\n} else {\n\n Function.prototype.after = function (afterfn) {\n\n return () => {\n\n this.apply(this, arguments)\n\n afterfn.apply(this, arguments)\n\n }\n\n }\n\n}\n```\n\n## \u72b6\u6001\u6a21\u5f0f\n\n> \u5141\u8bb8\u4e00\u4e2a\u5bf9\u8c61\u5728\u5176\u5185\u90e8\u72b6\u6001\u6539\u53d8\u65f6\u6539\u53d8\u5b83\u7684\u884c\u4e3a\uff0c\u5bf9\u8c61\u770b\u8d77\u6765\u4f3c\u4e4e\u4fee\u6539\u4e86\u5b83\u7684\u7c7b\n\n\u8981\u70b9\uff1a\u5c06\u72b6\u6001\u5c01\u88c5\u6210\u72ec\u7acb\u7684\u51fd\u6570\uff0c\u5e76\u5c06\u8bf7\u6c42\u59d4\u6258\u7ed9 `\u5f53\u524d\u7684\u72b6\u6001\u5bf9\u8c61`\uff0c\u5f53\u5bf9\u8c61\u7684\u5185\u90e8\u72b6\u6001\u6539\u53d8\u65f6\uff0c\u4f1a\u5e26\u6765\u4e0d\u540c\u7684\u884c\u4e3a\u53d8\u5316\n\n\u7535\u706f\u7684\u4f8b\u5b50\uff1a\n\n\u4e00\u4e2a\u6309\u94ae\u63a7\u5236\u7535\u706f\u7684\u5f00\u5173\uff0c\u6309\u4e00\u4e0b\u662f\u5f00\uff0c\u518d\u6309\u4e00\u4e0b\u662f\u5173\n\n\u521d\u59cb\u5b9e\u73b0\uff1a\n\n```javascript\nclass Light{\n\n constructor(){\n\n this.state='off',\n\n this.button=null\n\n }\n\n init(){\n\n //\u521b\u5efa\u6309\u94ae\u7ed3\u70b9\n\n .....\n\n\n\n this.button.onClick=()=>{\n\n this.btnPressed()\n\n }\n\n }\n\n btnPressed(){\n\n if(this.state=='off'){\n\n this.state='on\n\n }else {\n\n this.state='off'\n\n }\n\n }\n\n}\n```\n\n\u8fd9\u6bb5\u4ee3\u7801\u7684\u7f3a\u70b9\u5c31\u662f\u4e0d\u6613\u6269\u5c55\uff0c\u5f53\u8981\u52a0\u5165\u4e00\u79cd\u95ea\u52a8\u7684\u72b6\u6001\u65f6\uff0c\u5c31\u8981\u4fee\u6539 btnPressed \u4e2d\u7684\u4ee3\u7801\n\n\u4f7f\u7528\u72b6\u6001\u6a21\u5f0f\u6539\u5199\n\n```javascript\nclass Light{\n\n constructor(){\n\n this.state=FSM.off,\n\n this.button=null\n\n }\n\n init(){\n\n //\u521b\u5efa\u6309\u94ae\u7ed3\u70b9\n\n .....\n\n\n\n this.button.onClick=()=>{\n\n this.state.btnPressed.call(this)\n\n }\n\n }\n\n}\n\n\n\nconst FSM={\n\n on:{\n\n btnPressed(){\n\n //\u5904\u7406\n\n this.state=FMS.on\n\n }\n\n },\n\n off:{\n\n btnPressed(){\n\n //\u5904\u7406\n\n this.state=FMS.off\n\n }\n\n }\n\n}\n```",
"original": false,
"orginal_link": "https://mp.weixin.qq.com/s?src=11×tamp=1587021301&ver=2281&signature=H5t6hSR2fF6cutAppRngVd0HXX19dzVfnjoBuER-KGgjjJzufymo*e7w4h3qvBZyMYzehn0ityLKB**55qZYsl0Vu2ToSplRkxRxx7dymHat57P7gaeiWGVAwYJlUXKH&new=1",
"public": true,
"browse_num": 22,
"user": 1,
"add_time": "2020-04-16T15:35:39.117Z",
"modified_time": "2020-04-21T10:17:20.787Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 116,
"fields": {
"note": 3,
"title": "JavaScript\u8bcd\u6cd5\u4f5c\u7528\u57df\uff08\u4f60\u4e0d\u77e5\u9053\u7684JavaScript\uff09",
"text_content": "JavaScript\u8bcd\u6cd5\u4f5c\u7528\u57df\uff08\u4f60\u4e0d\u77e5\u9053\u7684JavaScript\uff09\n\u539f\u521b\u594b\u98db \u6700\u540e\u53d1\u5e03\u4e8e2015-06-04 21:20:08 \u9605\u8bfb\u6570 5463 \u6536\u85cf\n\u5c55\u5f00\nJavaScript\u5e76\u4e0d\u662f\u4f20\u7edf\u7684\u5757\u7ea7\u4f5c\u7528\u57df\uff0c\u800c\u662f\u51fd\u6570\u4f5c\u7528\u57df\uff01\n\u4e00\u3001\u4f5c\u7528\u57df\n\n1. JavaScript\u5f15\u64ce\u5728\u4ee3\u7801\u6267\u884c\u524d\u4f1a\u5bf9\u5176\u8fdb\u884c\u7f16\u8bd1\uff0c\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u50cfvar a = 2 \u8fd9\u6837\u7684\u58f0\u660e\u4f1a\u88ab\u5206\u89e3\u6210\u4e24\u4e2a\u72ec\u7acb\u7684\u6b65\u9aa4\uff1a\n \u7b2c\u4e00\u6b65\uff08\u7f16\u8bd1\u9636\u6bb5\uff09\uff1avar a \u5728\u5176\u4f5c\u7528\u57df\u4e2d\u58f0\u660e\u65b0\u53d8\u91cf\u3002\u8fd9\u4f1a\u5728\u6700\u5f00\u59cb\u7684\u9636\u6bb5\uff0c\u4e5f\u5c31\u662f\u4ee3\u7801\u6267\u884c\u524d\u8fdb\u884c\u3002\n \u7b2c\u4e8c\u6b65\uff08\u8fd0\u884c\u9636\u6bb5\uff09\uff1aa = 2 \u4f1a\u67e5\u8be2\u53d8\u91cfa\uff08LHS\u67e5\u8be2\uff09\u5e76\u5bf9\u5176\u8fdb\u884c\u8d4b\u503c\u3002\n2. LHS & RHS\uff08\u5f53\u524d\u4f5c\u7528\u57df->\u4e0a\u7ea7\u4f5c\u7528\u57df->...->\u5168\u5c40\u4f5c\u7528\u57df\uff09\n LHS(\u5de6\u4fa7)\uff1a\u8bd5\u56fe\u627e\u5230\u53d8\u91cf\u7684\u5bb9\u5668\u672c\u8eab\n RHS(\u53f3\u4fa7)\uff1a\u67e5\u627e\u67d0\u4e2a\u53d8\u91cf\u7684\u503c\n \u793a\u4f8b\uff1a\n function foo(a){\n var b = a;\n return a + b;\n }\n var c = foo(2);\n // LHS(3\u5904)\uff1ac\uff1ba(\u9690\u5f0f\u53d8\u91cf\u5206\u914d)\uff1bb;\n // RHS(4\u5904)\uff1afoo(2)\uff1b=a\uff1ba\uff1bb\uff1b\n3. \u5f02\u5e38\n function foo(a){\n console.log(a + b);\n b = a;\n }\n foo(2);\n \uff081\uff09\u5728ES5\u201c\u4e25\u683c\u6a21\u5f0f\u201d\u4e0b\uff0cLHS\u629b\u51faReferenceError\uff1b\u201c\u975e\u4e25\u683c\u6a21\u5f0f\u201d\u4e0b\uff0cLHS\u4f1a\u81ea\u52a8\u9690\u5f0f\u7684\u521b\u5efa\u4e00\u4e2a\u5168\u5c40\u53d8\u91cf\u3002\n \uff082\uff09RHS\u67e5\u8be2\u5728\u6240\u6709\u5d4c\u5957\u7684\u4f5c\u7528\u57df\u4e2d\u904d\u5bfb\u4e0d\u5230\u6240\u9700\u904d\u5386\u4f1a\u629b\u51faReferenceError\u3002\n \uff083\uff09RHS\u67e5\u8be2\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u4f46\u4f60\u5c1d\u8bd5\u5bf9\u5176\u4e0d\u5408\u7406\u7684\u64cd\u4f5c\uff08\u5f15\u7528null\u6216undefined\u7c7b\u578b\u4e2d\u7684\u5c5e\u6027\uff09\uff0c\u4f1a\u629b\u51faTypeError\u3002\n \u4e00\u53e5\u8bdd\u6982\u62ec\u4e4b\uff1aReferenceError\u540c\u4f5c\u7528\u57df\u5224\u522b\u5931\u8d25\u76f8\u5173\uff1b\u800cTypeError\u5219\u4ee3\u8868\u4f5c\u7528\u57df\u5224\u522b\u6210\u529f\u4e86\uff0c\u4f46\u662f\u5bf9\u7ed3\u679c\u7684\u64cd\u4f5c\u662f\u975e\u6cd5\u6216\u4e0d\u5408\u7406\u7684\u3002\n PS\uff1a\u4ece\u539f\u7406\u4e0a\u9610\u8ff0\u4e86\u535a\u5ba2\u4e2d\u300aJavaScript\u51fd\u6570\u53ca\u5176prototype\u300b\u51fd\u6570\u6267\u884c\u8986\u76d6\u7b49\u95ee\u9898\uff01\uff01\uff01\n \u4e8c\u3001\u8bcd\u6cd5\u4f5c\u7528\u57df\n \u8bcd\u6cd5\u4f5c\u7528\u57df\u610f\u5473\u7740\u4f5c\u7528\u57df\u662f\u7531\u4e66\u5199\u4ee3\u7801\u65f6\u51fd\u6570\u58f0\u660e\u7684\u4f4d\u7f6e\u6765\u51b3\u5b9a\u7684\u3002JavaScript\u4e2d\u6709\u4e24\u4e2a\u673a\u5236\u53ef\u4ee5\u201c\u6b3a\u9a97\u201d\u8bcd\u6cd5\u4f5c\u7528\u57df\uff1aeval(...)\u548cwith\u3002\n4. eval\n eval\u51fd\u6570\u53ef\u4ee5\u63a5\u53d7\u4e00\u4e2a\u5b57\u7b26\u4e32\u53c2\u6570\uff0c\u5e76\u5c06\u5176\u4e2d\u7684\u5185\u5bb9\u89c6\u4e3a\u597d\u50cf\u5728\u4e66\u5199\u65f6\u5b58\u5728\u4e8e\u7a0b\u5e8f\u4e2d\u8fd9\u4e2a\u4f4d\u7f6e\u7684\u4ee3\u7801\uff08\u5728\u5f53\u524d\u4f4d\u7f6e\uff0c\u53ef\u751f\u6210\u4ee3\u7801\uff0c\u5e76\u8fd0\u884c\uff09\u3002\n eval\u53ef\u4ee5\u5bf9\u4e00\u6bb5\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u58f0\u660e\u7684\u201c\u4ee3\u7801\u201d\u5b57\u7b26\u4e32\u8fdb\u884c\u6f14\u7b97\uff0c\u5e76\u501f\u6b64\u4fee\u6539\u5df2\u7ecf\u5b58\u5728\u7684\u8bcd\u6cd5\u4f5c\u7528\u57df\uff08\u8fd0\u884c\u9636\u6bb5\uff09\u3002\n function foo(str,a){\n eval(str);\n console.log(a, b);\t\t\t//1 , 3\n console.log(a, window.b);\t//1 , 2\n }\n var b = 2;\n foo(\"var b = 3;\", 1);\n \u89e3\u91ca\uff1a\u4e0a\u8ff0\u5168\u5c40\u53d8\u91cfb\u88ab\u8986\u76d6\u4e86\uff0c\u7531\u4e8eb\u662f\u5168\u5c40\u7684\uff0c\u53ef\u4ee5window.b\u83b7\u53d6\u5230\uff1b\u4f46\u975e\u5168\u5c40\u7684\u53d8\u91cf\u5982\u679c\u88ab\u8986\u76d6\uff0c\u5c31\u65e0\u6cd5\u8bbf\u95ee\u5230\u4e86\uff01\n \u4e25\u683c\u6a21\u5f0f\u4e0b\uff1a\n function foo(str,a){\n \"use strict\";\n eval(str);\n console.log(a, b);\t\t\t//1 , 2\n console.log(a, window.b);\t//1 , 2\n }\n var b = 2;\n foo(\"var b = 3;\", 1);\n5. with\n with\u901a\u5e38\u88ab\u5f53\u4f5c\u91cd\u590d\u5f15\u7528\u4e00\u4e2a\u5bf9\u8c61\u4e2d\u7684\u591a\u4e2a\u5c5e\u6027\u7684\u5feb\u6377\u65b9\u5f0f\uff0c\u53ef\u4ee5\u4e0d\u9700\u8981\u91cd\u590d\u5f15\u7528\u5bf9\u8c61\u672c\u8eab\u3002\n with\u5c06\u5bf9\u8c61\u7684\u5c5e\u6027\u5f53\u4f5c\u4f5c\u7528\u57df\u4e2d\u7684\u6807\u8bc6\u7b26\u6765\u5904\u7406\uff0c\u4ece\u800c\u521b\u5efa\u4e86\u4e00\u4e2a\u65b0\u7684\u8bcd\u6cd5\u4f5c\u7528\u57df\uff08\u8fd0\u884c\u9636\u6bb5\uff09\u3002\n function foo(obj){\n with(obj){\n \ta = 2;\n }\n }\n var o1 = { a : 3 };\n var o2 = { b : 3 };\n\nfoo(o1);\nconsole.log( o1.a );\t// 2\n\nfoo(o2);\nconsole.log( o2.a );\t// undefined\nconsole.log( a );\t\t// 2\uff0c\u8868\u660ea\u6cc4\u6f0f\u5230\u5168\u5c40\u4f5c\u7528\u57df\u4e0a\u4e86\uff01\n\u8fd9\u4e24\u4e2a\u673a\u5236\u7684\u526f\u4f5c\u7528\u662f\u5f15\u64ce\u65e0\u6cd5\u5728\u7f16\u8bd1\u65f6\u5bf9\u4f5c\u7528\u57df\u67e5\u627e\u8fdb\u884c\u4f18\u5316\uff0c\u5bfc\u81f4\u4ee3\u7801\u8fd0\u884c\u901f\u5ea6\u53d8\u6162\uff0c\u5efa\u8bae\u4e0d\u8981\u4f7f\u7528\u5b83\u4eec\uff01\nPS\uff1a\u4ece\u539f\u7406\u4e0a\u9610\u8ff0\u4e86\u535a\u5ba2\u300a JavaScript\u8bed\u8a00\u7cbe\u7cb9\u3010\u7cdf\u7c95\u3001\u6bd2\u7624\u3011\u300b\u4e2dwith\u4e0d\u80fd\u4f7f\u7528\u7684\u539f\u56e0\uff01\uff01\uff01 \n\u4e09\u3001\u51fd\u6570\u4f5c\u7528\u57df\u548c\u5757\u4f5c\u7528\u57df\n\n1. \u533f\u540d\u548c\u5177\u540d\n /* \u533f\u540d\uff08\u5f15\u7528\u81ea\u8eab\u53ea\u80fd\u7528\u8fc7\u671f\u7684arguments.callee\u5f15\u7528\uff09 */\n setTimeout(function(){\n console.log(\"i wait 1 second!\")\n },1000);\n /* \u5177\u540d\uff08\u53ef\u8bfb\u6027\u597d\uff09 */\n setTimeout(function timeoutHandler(){\n console.log(\"i wait 1 seco nd!\")\n },1000);\n2. \u7acb\u5373\u6267\u884c\u51fd\u6570\u8868\u8fbe\u5f0f\n /* IIFE\u6a21\u5f0f */\n var a = 2;\n (function IIFE(global){\n var a = 3;\n console.log(a);\t\t\t//3\n console.log(global.a);\t//2\n })(window);\n /* UMD\u6a21\u5f0f */\n var b = 2;\n (function UMD(def){\n def(window);\n })(function tmpF(global){\n var b = 3;\n console.log(b);\t\t\t//3\n console.log(global.b);\t//2\n });\n3. \u5757\u4f5c\u7528\u57df\n try/catch\u4f1a\u521b\u5efa\u4e00\u4e2a\u5757\u4f5c\u7528\u57df\n try{\n undefined();\n }catch(err){\n console.log(err);\t//\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\n }\n console.log(err);\t//ReferenceError: err is not defined\n\n/* \u57511 */\nfor(var i=0;i<10;i++){}\nconsole.log(i);\t\t//10\n/* \u57512 */\n{\n\tconsole.log(bar);\t//undefined \u4e0d\u4f1a\u62a5\u9519\uff01\uff01\n\tvar bar = 2;\n}\nES6\u4e2d\u5f15\u5165\u65b0\u7684let\u5173\u952e\u5b57\uff01\uff01\n/* \u586b\u57511 */\nfor(let i=0;i<10;i++){}\nconsole.log(i);\t\t//SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode\n/* \u586b\u57512 */\n{\n\tconsole.log(bar);\t//SyntaxError \u62a5\u9519\uff01\uff01\n\tlet bar = 2;\n}\n\n\u63a8\u8350\u4e24\u4e2a\u5c06ES6\u4ee3\u7801\u8f6c\u5316\u6210\u517c\u5bb9ES6\u4e4b\u524d\u7684\u73af\u5883\uff08\u5927\u90e8\u5206\u662fES5\uff0c\u4f46\u4e0d\u5168\u662f\uff09\u5de5\u5177\uff1aTraceur\u548clet-er",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 13,
"user": 1,
"add_time": "2020-04-16T17:23:07.812Z",
"modified_time": "2020-04-21T10:22:20.490Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 117,
"fields": {
"note": 3,
"title": "\u7b56\u7565\u6a21\u5f0f",
"text_content": "# \u7b56\u7565\u6a21\u5f0f\n\n\u628a\u4e0d\u53d8\u7684\u90e8\u5206\u548c\u53d8\u5316\u7684\u90e8\u5206\u9694\u5f00\u662f\u6bcf\u4e2a\u8bbe\u8ba1\u6a21\u5f0f\u7684\u4e3b\u9898\u3002\n\n> \u6761\u6761\u5927\u8def\u901a\u7f57\u9a6c\u3002\u6211\u4eec\u7ecf\u5e38\u4f1a\u9047\u5230\u89e3\u51b3\u4e00\u4ef6\u4e8b\u60c5\u6709\u591a\u79cd\u65b9\u6848\uff0c\u6bd4\u5982\u538b\u7f29\u6587\u4ef6\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528zip\u7b97\u6cd5\u3001\u4e5f\u53ef\u4ee5\u4f7f\u7528gzip\u7b97\u6cd5\u3002\u5176\u7075\u6d3b\u591a\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u91c7\u7528\u7b56\u7565\u6a21\u5f0f\u89e3\u51b3\u3002\n\n### \u4e00\u3001\u5b9a\u4e49\n\n\u5b9a\u4e49\u4e00\u7cfb\u5217\u7684\u7b97\u6cd5\uff0c\u628a\u5b83\u4eec\u4e00\u4e2a\u4e2a\u5c01\u88c5\u8d77\u6765\uff0c\u5e76\u4e14\u4f7f\u5b83\u4eec\u53ef\u4ee5\u76f8\u4e92\u66ff\u6362\u3002\n\u57fa\u4e8e\u7b56\u7565\u7c7b\u6a21\u5f0f\u7684\u7a0b\u5e8f\u81f3\u5c11\u7531\u4e24\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u4e2a\u90e8\u5206\u662f\u4e00\u7ec4\u7b56\u7565\u7c7b\uff0c\u7b56\u7565\u7c7b\u5c01\u88c5\u4e86\u5177\u4f53\u7684\u7b97\u6cd5\uff0c\u5e76\u8d1f\u8d23\u5177\u4f53\u7684\u8ba1\u7b97\u8fc7\u7a0b\u3002\u7b2c\u4e8c\u4e2a\u90e8\u5206\u662f\u73af\u5883\u7c7bContext\uff0cContext\u63a5\u6536\u5ba2\u6237\u7684\u8bf7\u6c42\uff0c\u968f\u540e\u628a\u8bf7\u6c42\u59d4\u6258\u7ed9\u67d0\u4e00\u4e2a\u7b56\u7565\u7c7b\u3002\n\n### \u4e8c\u3001\u793a\u4f8b\n\n> \u8ba1\u7b97\u5956\u91d1\u3002\u7ee9\u6548\u4e3aS\u7684\u53d1\u653e4\u500d\u5de5\u8d44\uff0c\u7ee9\u6548\u4e3aA\u7684\u53d1\u653e3\u500d\u5de5\u8d44\uff0c\u7ee9\u6548\u4e3aB\u7684\u53d1\u653e2\u500d\u5de5\u8d44\u3002\n\n```javascript\nvar strategies = {\n \"S\": function(salary) {\n return salary * 4;\n },\n \"A\": function(salary) {\n return salary * 3;\n },\n \"B\": function(salary) {\n return salary * 2;\n }\n};\n\n// \u63a5\u6536\u8bf7\u6c42\nvar calculateBonus = function(level, salary) {\n return strategies[level](salary);\n};\n\n// \u6d4b\u8bd5\nconsole.log(calculateBonus(\"S\", 20000));\nconsole.log(calculateBonus(\"A\", 20000));\nconsole.log(calculateBonus(\"B\", 20000));\n```\n\n### \u4e09\u3001\u5ef6\u4f38\uff1a\u8868\u5355\u9a8c\u8bc1\n\n```javascript\n/* \u6821\u9a8c\u7b56\u7565\u5bf9\u8c61 */\nvar validateStrategies = {\n isEmpty: function (val, errorMsg) {\n if (!val) {\n return errorMsg;\n }\n },\n isURL: function (val, errorMsg) {\n if (!new RegExp(\"^(http:\\\\/\\\\/|https:\\\\/\\\\/)?([\\\\w\\\\-]+\\\\.)+[\\\\w\\\\-]+(\\\\/[\\\\w\\\\-\\\\.\\\\/?\\\\@\\\\%\\\\!\\\\&=\\\\+\\\\~\\\\:\\\\#\\\\;\\\\,]*)?$\").test(val)) {\n return errorMsg;\n }\n },\n isEmail: function (val, errorMsg) {\n if (!new RegExp('\\\\w+((-\\\\w+)|(\\\\.\\\\w+))*\\\\@[A-Za-z0-9]+((\\\\.|-)[A-Za-z0-9]+)*\\\\.[A-Za-z0-9]+').test(val)) {\n return errorMsg;\n }\n },\n isMaxLength: function (val, length, errorMsg) {\n if (val.length > length) {\n return errorMsg;\n }\n },\n isMinLength: function (val, length, errorMsg) {\n if (val.length < length) {\n return errorMsg;\n }\n }\n};\n\n/* validator\u7c7b */\nvar validator = function () {\n // \u7f13\u5b58\u9a8c\u8bc1\u7b56\u7565\n this.cache = [];\n};\n\n/**\n * \u6dfb\u52a0\u8981\u9a8c\u8bc1\u7684\u7b56\u7565\n * @param dom \u8981\u9a8c\u8bc1\u7684dom\u5143\u7d20\n * @param rules \u9a8c\u8bc1\u89c4\u5219\n */\nvalidator.prototype.add = function (dom, rules) {\n var self = this;\n for (var i = 0, rule; rule = rules[i++];) {\n (function (rule) {\n var strategyAry = rule.strategy.split(\":\"); // [\"isMaxLength\", \"10\"]\n var errorMsg = rule.errorMsg; // \"\u5185\u5bb9\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc710\"\n self.cache.push(function () {\n var strategy = strategyAry.shift(); // \"isMaxLength\"\n strategyAry.unshift(dom.value); // [\"1@qq\", \"10\"]\n strategyAry.push(errorMsg); // [\"1@qq\", \"10\", \"\u5185\u5bb9\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc710\"]\n return validateStrategies[strategy].apply(dom, strategyAry);\n });\n })(rule);\n }\n};\n\n/* \u5f00\u59cb\u6821\u9a8c */\nvalidator.prototype.start = function () {\n for (var i = 0, validateFunc; validateFunc = this.cache[i++];) {\n var errorMsg = validateFunc();\n if (errorMsg) {\n return errorMsg;\n }\n }\n};\n\n// \u6d4b\u8bd5\n\n<label for=\"email\">\u90ae\u7bb1\uff1a</label><input type=\"text\" name=\"email\" value=\"1@qq\">\n\nvar validatorInstance = new validator();\nvalidatorInstance.add(\n document.getElementsByName(\"email\")[0], \n [{\n strategy: \"isEmpty\",\n errorMsg: \"\u5185\u5bb9\u4e0d\u80fd\u4e3a\u7a7a\"\n },{\n strategy: \"isMaxLength:10\",\n errorMsg: \"\u5185\u5bb9\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc710\"\n },{\n strategy: \"isEmail\",\n errorMsg: \"email\u683c\u5f0f\u4e0d\u5bf9\"\n }]);\nerrorMsg = validatorInstance.start();\n```",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 14,
"user": 1,
"add_time": "2020-04-16T19:07:12.187Z",
"modified_time": "2020-04-21T07:58:15.952Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 118,
"fields": {
"note": 3,
"title": "markdown-it-vue",
"text_content": "# markdown-it-vue\n\n## GitHub Table of Contents\n\n[toc]\n\nNote: Only `h2` and `h3` are shown in toc.\n\n## alter\n\nMarkup is similar to fenced code blocks. Valid container types are `success`, `info`, `warning` and `error`.\n\n::: success\nYou have got it.\n:::\n\n::: info\nYou have new mail.\n:::\n\n::: warning\nYou have new mail.\n:::\n\n::: error\nStaying up all night is bad for health.\n:::\n\n## mermaid charts\n\n### Flowchart\n\n[Flowchart Syntax](http://knsv.github.io/mermaid/#flowcharts-basic-syntax)\n\n```mermaid\ngraph TD;\n A-->B;\n A-->C;\n B-->D;\n C-->D;\n```\n\n```\nsequenceDiagram\n participant Alice\n participant Bob\n Alice->John: Hello John, how are you?\n loop Healthcheck\n John->John: Fight against hypochondria\n end\n Note right of John: Rational thoughts <br/>prevail...\n John-->Alice: Great!\n John->Bob: How about you?\n Bob-->John: Jolly good!\n```\n\n## Definition list\n\nTerm 1\n ~ Definition 1\n\nTerm 2\n ~ Definition 2a\n ~ Definition 2b\n\n[Definition List Syntax](http://pandoc.org/README.html#definition-lists)\n\n\n## AsciiMath\n\nInline AsciiMath: `@(1/2[1-(1/2)^n])/(1-(1/2))=s_n@`\n\n```AsciiMath\noint_Cx^3 dx+4y^2 dy\n\n2=(((3-x)xx2)/(3-x))\n\nsum_(m=1)^oosum_(n=1)^oo(m^2 n)/(3^m(m3^n+n3^m)\n```\n\n```ASCIIMath\nphi_n(kappa) = 1/(4pi^2 kappa^2)\n int_0^oo (sin(kappa R))/(kappa R)\n del/(del R)\n[R^2 (del D_n (R))/(del R)] del R\n```\n\n[AsciiMath Documentation](http://asciimath.org/)\n\n## Subscript: H~2~O\n\nYou can also use inline math: `$H_2O$`\n\n\n## Superscript: 29^th^\n\nYou can also use inline math: `$29^{th}$`\n\n\n## Emoji: :panda_face: :sparkles: :camel: :boom: :pig:\n\n[Emoji Cheat Sheet](http://www.emoji-cheat-sheet.com/)\n\n## Fontawesome: :fa-cab: :fa-flag: :fa-bicycle: :fa-leaf: :fa-heart:\n\n[All the Font Awesome icons](http://fontawesome.io/icons/)\n\n## Echarts\n\n[Documentation for Echarts](http://echarts.baidu.com)\n\nThe width and height is the size for chart container.\n\n```echarts\n{\n \"width\": 500,\n \"height\": 400,\n \"series\": [\n {\n \"name\": \"\u8bbf\u95ee\u6765\u6e90\",\n \"type\": \"pie\",\n \"radius\": \"55%\",\n \"data\": [\n {\n \"value\": 235,\n \"name\": \"\u89c6\u9891\u5e7f\u544a\"\n },\n {\n \"value\": 274,\n \"name\": \"\u8054\u76df\u5e7f\u544a\"\n },\n {\n \"value\": 310,\n \"name\": \"\u90ae\u4ef6\u8425\u9500\"\n },\n {\n \"value\": 335,\n \"name\": \"\u76f4\u63a5\u8bbf\u95ee\"\n },\n {\n \"value\": 400,\n \"name\": \"\u641c\u7d22\u5f15\u64ce\"\n }\n ]\n }\n ]\n}\n```\n\n## code\n\n```bash\nnpm install markdown-it-vue\n```\n\n## table\n\n| First Header | Second Header |\n| ------------- | ------------- |\n| Content Cell | Content Cell |\n| Content Cell | Content Cell |\n\n## flowchart.js\n\n```flowchart.js\nst=>start: Start|past:>http://www.google.com[blank]\ne=>end: End:>http://www.google.com\nop1=>operation: My Operation|past\nop2=>operation: Stuff|current\nsub1=>subroutine: My Subroutine|invalid\ncond=>condition: Yes\nor No?|approved:>http://www.google.com\nc2=>condition: Good idea|rejected\nio=>inputoutput: catch something...|request\npara=>parallel: parallel tasks\n\nst->op1(right)->cond\ncond(yes, right)->c2\ncond(no)->para\nc2(true)->io->e\nc2(false)->e\n\npara(path1, bottom)->sub1(left)->op1\npara(path2, right)->op2->e\n\nst@>op1({\"stroke\":\"Red\"})@>cond({\"stroke\":\"Red\",\"stroke-width\":6,\"arrow-end\":\"classic-wide-long\"})@>c2({\"stroke\":\"Red\"})@>op2({\"stroke\":\"Red\"})@>e({\"stroke\":\"Red\"})\n```",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 4,
"user": 1,
"add_time": "2020-04-16T19:26:37.914Z",
"modified_time": "2020-04-21T07:58:12.047Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 119,
"fields": {
"note": 1,
"title": "\u5982\u4f55\u5728Django REST Framework 3\u4e2d\u91cd\u5199ModelViewSet\u7684get_queryset\uff1f",
"text_content": "## \u5982\u4f55\u5728Django REST Framework 3\u4e2d\u91cd\u5199ModelViewSet\u7684get_queryset\uff1f\n\n\n\n\u6211\u66fe\u7ecf\u5728Django Rest Framework\uff08DRF\uff092\u4e2d\u9075\u5faa\u8fd9\u79cd\u6a21\u5f0f\uff1a\n\n```javascript\nclass Foo(models.Model):\n user = models.ForeignKey(User)\n\nclass FooSerializer(serializers.HyperlinkedModelSerializer):\n class Meta:\n model = Foo\n fields = ('url')\n\nclass FooViewset(viewsets.ModelViewSet):\n def get_queryset(self):\n return Foo.objects.filter(user=self.request.user)\n serializer = FooSerializer\n model = Foo # <-- the way a ModelViewSet is told what the object is in DRF 2\n\n[ in urls.py]\nfrom rest_framework import routers\nrouter = routers.DefaultRouter()\nrouter.register('Foo', views.FooViewSet)\n```\n\n\u5728DRF 3\u4e2d\uff0c\u6211\u73b0\u5728\u5f97\u5230\uff1a\n\n```javascript\nAssertionError at /\n`base_name` argument not specified, and could not automatically \n determine the name from the viewset, as it does not have a \n`.queryset` attribute.\n```\n\n\u5982\u4f55`get_queryset`\u91cd\u5199\u4e00\u4e2a\u5b9e\u4f8b`rest_framework.viewsets.ModelViewSet`",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 14,
"user": 1,
"add_time": "2020-04-17T20:46:20.763Z",
"modified_time": "2020-04-21T10:21:34.359Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 123,
"fields": {
"note": 3,
"title": "HTTP\u4e00\u4e9b\u5e38\u89c1\u7684\u72b6\u6001\u7801\u548c\u63d0\u793a\u4fe1\u606f",
"text_content": "# [HTTP\u4e00\u4e9b\u5e38\u89c1\u7684\u72b6\u6001\u7801\u548c\u63d0\u793a\u4fe1\u606f](https://www.cnblogs.com/chwx/p/9304700.html)\n\n> - 200 OK - [GET]\uff1a\u670d\u52a1\u5668\u6210\u529f\u8fd4\u56de\u7528\u6237\u8bf7\u6c42\u7684\u6570\u636e\n> - 201 CREATED - [POST/PUT/PATCH]\uff1a\u7528\u6237\u65b0\u5efa\u6216\u4fee\u6539\u6570\u636e\u6210\u529f\u3002\n> - 202 Accepted - [*]\uff1a\u8868\u793a\u4e00\u4e2a\u8bf7\u6c42\u5df2\u7ecf\u8fdb\u5165\u540e\u53f0\u6392\u961f\uff08\u5f02\u6b65\u4efb\u52a1\uff09\n> - 204 NO CONTENT - [DELETE]\uff1a\u7528\u6237\u5220\u9664\u6570\u636e\u6210\u529f\u3002\n> - 400 INVALID REQUEST - [POST/PUT/PATCH]\uff1a\u7528\u6237\u53d1\u51fa\u7684\u8bf7\u6c42\u6709\u9519\u8bef\uff0c\u670d\u52a1\u5668\u6ca1\u6709\u8fdb\u884c\u65b0\u5efa\u6216\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\n> - 401 Unauthorized - [*]\uff1a\u8868\u793a\u7528\u6237\u6ca1\u6709\u6743\u9650\uff08\u4ee4\u724c\u3001\u7528\u6237\u540d\u3001\u5bc6\u7801\u9519\u8bef\uff09\u3002\n> - 403 Forbidden - [*] \u8868\u793a\u7528\u6237\u5f97\u5230\u6388\u6743\uff08\u4e0e401\u9519\u8bef\u76f8\u5bf9\uff09\uff0c\u4f46\u662f\u8bbf\u95ee\u662f\u88ab\u7981\u6b62\u7684\u3002\n> - 404 NOT FOUND - [*]\uff1a\u7528\u6237\u53d1\u51fa\u7684\u8bf7\u6c42\u9488\u5bf9\u7684\u662f\u4e0d\u5b58\u5728\u7684\u8bb0\u5f55\uff0c\u670d\u52a1\u5668\u6ca1\u6709\u8fdb\u884c\u64cd\u4f5c\uff0c\u8be5\u64cd\u4f5c\u662f\u5e42\u7b49\u7684\u3002\n> - 406 Not Acceptable - [GET]\uff1a\u7528\u6237\u8bf7\u6c42\u7684\u683c\u5f0f\u4e0d\u53ef\u5f97\uff08\u6bd4\u5982\u7528\u6237\u8bf7\u6c42JSON\u683c\u5f0f\uff0c\u4f46\u662f\u53ea\u6709XML\u683c\u5f0f\uff09\u3002\n> - 410 Gone -[GET]\uff1a\u7528\u6237\u8bf7\u6c42\u7684\u8d44\u6e90\u88ab\u6c38\u4e45\u5220\u9664\uff0c\u4e14\u4e0d\u4f1a\u518d\u5f97\u5230\u7684\u3002\n> - 422 Unprocesable entity - [POST/PUT/PATCH] \u5f53\u521b\u5efa\u4e00\u4e2a\u5bf9\u8c61\u65f6\uff0c\u53d1\u751f\u4e00\u4e2a\u9a8c\u8bc1\u9519\u8bef\u3002\n> - 500 INTERNAL SERVER ERROR - [*]\uff1a\u670d\u52a1\u5668\u53d1\u751f\u9519\u8bef\uff0c\u7528\u6237\u5c06\u65e0\u6cd5\u5224\u65ad\u53d1\u51fa\u7684\u8bf7\u6c42\u662f\u5426\u6210\u529f\u3002\n\n\u72b6\u6001\u7801\u7684\u5b8c\u5168\u5217\u8868\u53c2\u89c1[\u8fd9\u91cc](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)\u6216[\u8fd9\u91cc](https://zh.wikipedia.org/wiki/HTTP\u72b6\u6001\u7801)\u3002",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 6,
"user": 1,
"add_time": "2020-04-20T15:24:43.349Z",
"modified_time": "2020-04-21T10:21:12.113Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 129,
"fields": {
"note": 2,
"title": "\u5982\u4f55\u5728Django REST Framework 3\u4e2d\u91cd\u5199ModelViewSet\u7684get_queryset\uff1f",
"text_content": "## \u5982\u4f55\u5728Django REST Framework 3\u4e2d\u91cd\u5199ModelViewSet\u7684get_queryset\uff1f\n\n\n\n\u6211\u66fe\u7ecf\u5728Django Rest Framework\uff08DRF\uff092\u4e2d\u9075\u5faa\u8fd9\u79cd\u6a21\u5f0f\uff1a\n\n```javascript\nclass Foo(models.Model):\n user = models.ForeignKey(User)\n\nclass FooSerializer(serializers.HyperlinkedModelSerializer):\n class Meta:\n model = Foo\n fields = ('url')\n\nclass FooViewset(viewsets.ModelViewSet):\n def get_queryset(self):\n return Foo.objects.filter(user=self.request.user)\n serializer = FooSerializer\n model = Foo # <-- the way a ModelViewSet is told what the object is in DRF 2\n\n[ in urls.py]\nfrom rest_framework import routers\nrouter = routers.DefaultRouter()\nrouter.register('Foo', views.FooViewSet)\n```\n\n\u5728DRF 3\u4e2d\uff0c\u6211\u73b0\u5728\u5f97\u5230\uff1a\n\n```javascript\nAssertionError at /\n`base_name` argument not specified, and could not automatically \n determine the name from the viewset, as it does not have a \n`.queryset` attribute.\n```\n\n\u5982\u4f55`get_queryset`\u91cd\u5199\u4e00\u4e2a\u5b9e\u4f8b`rest_framework.viewsets.ModelViewSet`",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 6,
"user": 1,
"add_time": "2020-04-21T16:47:10.572Z",
"modified_time": "2020-04-22T11:53:26.104Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 133,
"fields": {
"note": 3,
"title": "mavonEditor \u5b98\u7f51\u624b\u518c",
"text_content": "[toc]\n# mavonEditor\n\n### [English Documents](https://github.com/hinesboy/mavonEditor/blob/HEAD/README-EN.md)\n\n[Demo for jsfiddle](https://jsfiddle.net/CHENXCHEN/qf7gLw3a/3/)\n\n## example (\u56fe\u7247\u5c55\u793a)\n\n### PC\n\n![PC](https://raw.githubusercontent.com/hinesboy/mavonEditor/HEAD/img/cn/cn-common.png)\n\n![PC](https://raw.githubusercontent.com/hinesboy/mavonEditor/HEAD/img/cn/cn-image.gif)\n\n> [\u67e5\u770b\u66f4\u591a\u56fe\u7247\u70b9\u51fb\u8fd9\u91cc...](https://github.com/hinesboy/mavonEditor/blob/HEAD/doc/cn/images.md)\n\n### Install mavon-editor (\u5b89\u88c5)\n\n```\n$ npm install mavon-editor --save\n```\n\n### Use (\u5982\u4f55\u5f15\u5165)\n\n`index.js`:\n\n```\n // \u5168\u5c40\u6ce8\u518c\n // import with ES6\n import Vue from 'vue'\n import mavonEditor from 'mavon-editor'\n import 'mavon-editor/dist/css/index.css'\n // use\n Vue.use(mavonEditor)\n new Vue({\n 'el': '#main',\n data() {\n return { value: '' }\n }\n })\nindex.html\n<div id=\"main\">\n <mavon-editor v-model=\"value\"/>\n</div>\n```\n\n### \u5982\u4f55\u5728nuxt.js \u4e2d\u4f7f\u7528\n\n> \u9996\u5148\u5728\u5de5\u7a0b\u76ee\u5f55plugins \u4e0b\u65b0\u5efa vue-mavon-editor.js\n\n```\nimport Vue from 'vue';\nimport mavonEditor from 'mavon-editor';\nimport 'mavon-editor/dist/css/index.css';\n \nVue.use(mavonEditor);\n```\n\n> \u7136\u540e\u5728nuxt.config.js \u4e2d\u6dfb\u52a0plugins\u914d\u7f6e\n\n```\n plugins: [\n ...\n { src: '@/plugins/vue-mavon-editor', ssr: false }\n ],\n```\n\n> \u6700\u540e\u4e00\u6b65\u5728\u9875\u9762\u6216\u8005\u7ec4\u4ef6\u4e2d\u5f15\u5165\n\n```\n<template>\n <div class=\"mavonEditor\">\n <no-ssr>\n <mavon-editor :toolbars=\"markdownOption\" v-model=\"handbook\"/>\n </no-ssr>\n </div>\n</template>\n<script>\nexport default {\n data() {\n return {\n markdownOption: {\n bold: true, // \u7c97\u4f53\n ... // \u66f4\u591a\u914d\u7f6e\n },\n handbook: \"#### how to use mavonEditor in nuxt.js\"\n };\n }\n};\n</script>\n \n<style scoped>\n.mavonEditor {\n width: 100%;\n height: 100%;\n}\n</style>\n \n```\n\n> [\u66f4\u591a\u5f15\u5165\u65b9\u5f0f\u70b9\u51fb\u8fd9\u91cc...](https://github.com/hinesboy/mavonEditor/blob/HEAD/doc/cn/use.md)\n\n> [\u5982\u4f55\u83b7\u53d6\u5e76\u8bbe\u7f6emarkdown-it\u5bf9\u8c61...](https://github.com/hinesboy/mavonEditor/blob/HEAD/doc/cn/markdown.md)\n\n## API \u6587\u6863\n\n### props\n\n| name \u540d\u79f0 | type \u7c7b\u578b | default \u9ed8\u8ba4\u503c | describe \u63cf\u8ff0 |\n| :----------------- | :-------: | :-----------------------------: | :----------------------------------------------------------- |\n| value | String | | \u521d\u59cb\u503c |\n| language | String | zh-CN | \u8bed\u8a00\u9009\u62e9\uff0c\u6682\u652f\u6301 zh-CN: \u7b80\u4f53\u4e2d\u6587, zh-TW: \u6b63\u4f53\u4e2d\u6587 \uff0c en: \u82f1\u6587 \uff0c fr: \u6cd5\u8bed\uff0c pt-BR: \u8461\u8404\u7259\u8bed\uff0c ru: \u4fc4\u8bed\uff0c de: \u5fb7\u8bed\uff0c ja: \u65e5\u8bed |\n| fontSize | String | 14px | \u7f16\u8f91\u533a\u57df\u6587\u5b57\u5927\u5c0f |\n| scrollStyle | Boolean | true | \u5f00\u542f\u6eda\u52a8\u6761\u6837\u5f0f(\u6682\u65f6\u4ec5\u652f\u6301chrome) |\n| boxShadow | Boolean | true | \u5f00\u542f\u8fb9\u6846\u9634\u5f71 |\n| boxShadowStyle | String | 0 2px 12px 0 rgba(0, 0, 0, 0.1) | \u8fb9\u6846\u9634\u5f71\u6837\u5f0f |\n| transition | Boolean | true | \u662f\u5426\u5f00\u542f\u8fc7\u6e21\u52a8\u753b |\n| toolbarsBackground | String | #ffffff | \u5de5\u5177\u680f\u80cc\u666f\u989c\u8272 |\n| previewBackground | String | #fbfbfb | \u9884\u89c8\u6846\u80cc\u666f\u989c\u8272 |\n| subfield | Boolean | true | true\uff1a \u53cc\u680f(\u7f16\u8f91\u9884\u89c8\u540c\u5c4f)\uff0c false\uff1a \u5355\u680f(\u7f16\u8f91\u9884\u89c8\u5206\u5c4f) |\n| defaultOpen | String | | edit\uff1a \u9ed8\u8ba4\u5c55\u793a\u7f16\u8f91\u533a\u57df \uff0c preview\uff1a \u9ed8\u8ba4\u5c55\u793a\u9884\u89c8\u533a\u57df , \u5176\u4ed6 = edit |\n| placeholder | String | \u5f00\u59cb\u7f16\u8f91... | \u8f93\u5165\u6846\u4e3a\u7a7a\u65f6\u9ed8\u8ba4\u63d0\u793a\u6587\u672c |\n| editable | Boolean | true | \u662f\u5426\u5141\u8bb8\u7f16\u8f91 |\n| codeStyle | String | code-github | markdown\u6837\u5f0f\uff1a \u9ed8\u8ba4github, [\u53ef\u9009\u914d\u8272\u65b9\u6848](https://github.com/hinesboy/mavonEditor/blob/HEAD/src/lib/core/hljs/lang.hljs.css.js) |\n| toolbarsFlag | Boolean | true | \u5de5\u5177\u680f\u662f\u5426\u663e\u793a |\n| navigation | Boolean | false | \u9ed8\u8ba4\u5c55\u793a\u76ee\u5f55 |\n| shortCut | Boolean | true | \u662f\u5426\u542f\u7528\u5feb\u6377\u952e |\n| autofocus | Boolean | true | \u81ea\u52a8\u805a\u7126\u5230\u6587\u672c\u6846 |\n| ishljs | Boolean | true | \u4ee3\u7801\u9ad8\u4eae |\n| imageFilter | function | null | \u56fe\u7247\u8fc7\u6ee4\u51fd\u6570\uff0c\u53c2\u6570\u4e3a\u4e00\u4e2a`File Object`\uff0c\u8981\u6c42\u8fd4\u56de\u4e00\u4e2a`Boolean`, `true`\u8868\u793a\u6587\u4ef6\u5408\u6cd5\uff0c`false`\u8868\u793a\u6587\u4ef6\u4e0d\u5408\u6cd5 |\n| imageClick | function | null | \u56fe\u7247\u70b9\u51fb\u4e8b\u4ef6\uff0c\u9ed8\u8ba4\u4e3a\u9884\u89c8\uff0c\u53ef\u8986\u76d6 |\n| tabSize | Number | \\t | tab\u8f6c\u5316\u4e3a\u51e0\u4e2a\u7a7a\u683c\uff0c\u9ed8\u8ba4\u4e3a\\t |\n| xssOptions | Object | null | xss\u89c4\u5219\u914d\u7f6e\uff0c\u53c2\u8003 ![https://github.com/leizongmin/js-xss](https://github.com/leizongmin/js-xss) |\n| toolbars | Object | \u5982\u4e0b\u4f8b | \u5de5\u5177\u680f |\n\n```\n /*\n \u9ed8\u8ba4\u5de5\u5177\u680f\u6309\u94ae\u5168\u90e8\u5f00\u542f, \u4f20\u5165\u81ea\u5b9a\u4e49\u5bf9\u8c61\n \u4f8b\u5982: {\n bold: true, // \u7c97\u4f53\n italic: true,// \u659c\u4f53\n header: true,// \u6807\u9898\n }\n \u6b64\u65f6, \u4ec5\u4ec5\u663e\u793a\u6b64\u4e09\u4e2a\u529f\u80fd\u952e\n */\ntoolbars: {\n bold: true, // \u7c97\u4f53\n italic: true, // \u659c\u4f53\n header: true, // \u6807\u9898\n underline: true, // \u4e0b\u5212\u7ebf\n strikethrough: true, // \u4e2d\u5212\u7ebf\n mark: true, // \u6807\u8bb0\n superscript: true, // \u4e0a\u89d2\u6807\n subscript: true, // \u4e0b\u89d2\u6807\n quote: true, // \u5f15\u7528\n ol: true, // \u6709\u5e8f\u5217\u8868\n ul: true, // \u65e0\u5e8f\u5217\u8868\n link: true, // \u94fe\u63a5\n imagelink: true, // \u56fe\u7247\u94fe\u63a5\n code: true, // code\n table: true, // \u8868\u683c\n fullscreen: true, // \u5168\u5c4f\u7f16\u8f91\n readmodel: true, // \u6c89\u6d78\u5f0f\u9605\u8bfb\n htmlcode: true, // \u5c55\u793ahtml\u6e90\u7801\n help: true, // \u5e2e\u52a9\n /* 1.3.5 */\n undo: true, // \u4e0a\u4e00\u6b65\n redo: true, // \u4e0b\u4e00\u6b65\n trash: true, // \u6e05\u7a7a\n save: true, // \u4fdd\u5b58\uff08\u89e6\u53d1events\u4e2d\u7684save\u4e8b\u4ef6\uff09\n /* 1.4.2 */\n navigation: true, // \u5bfc\u822a\u76ee\u5f55\n /* 2.1.8 */\n alignleft: true, // \u5de6\u5bf9\u9f50\n aligncenter: true, // \u5c45\u4e2d\n alignright: true, // \u53f3\u5bf9\u9f50\n /* 2.2.1 */\n subfield: true, // \u5355\u53cc\u680f\u6a21\u5f0f\n preview: true, // \u9884\u89c8\n }\n```\n\n### events \u4e8b\u4ef6\u7ed1\u5b9a\n\n| name \u65b9\u6cd5\u540d | params \u53c2\u6570 | describe \u63cf\u8ff0 |\n| :--------------- | :-----------------------------: | :----------------------------------------------------------- |\n| change | String: value , String: render | \u7f16\u8f91\u533a\u53d1\u751f\u53d8\u5316\u7684\u56de\u8c03\u4e8b\u4ef6(render: value \u7ecf\u8fc7markdown\u89e3\u6790\u540e\u7684\u7ed3\u679c) |\n| save | String: value , String: render | ctrl + s \u7684\u56de\u8c03\u4e8b\u4ef6(\u4fdd\u5b58\u6309\u952e,\u540c\u6837\u89e6\u53d1\u8be5\u56de\u8c03) |\n| fullScreen | Boolean: status , String: value | \u5207\u6362\u5168\u5c4f\u7f16\u8f91\u7684\u56de\u8c03\u4e8b\u4ef6(boolean: \u5168\u5c4f\u5f00\u542f\u72b6\u6001) |\n| readModel | Boolean: status , String: value | \u5207\u6362\u6c89\u6d78\u5f0f\u9605\u8bfb\u7684\u56de\u8c03\u4e8b\u4ef6(boolean: \u9605\u8bfb\u5f00\u542f\u72b6\u6001) |\n| htmlCode | Boolean: status , String: value | \u67e5\u770bhtml\u6e90\u7801\u7684\u56de\u8c03\u4e8b\u4ef6(boolean: \u6e90\u7801\u5f00\u542f\u72b6\u6001) |\n| subfieldToggle | Boolean: status , String: value | \u5207\u6362\u5355\u53cc\u680f\u7f16\u8f91\u7684\u56de\u8c03\u4e8b\u4ef6(boolean: \u53cc\u680f\u5f00\u542f\u72b6\u6001) |\n| previewToggle | Boolean: status , String: value | \u5207\u6362\u9884\u89c8\u7f16\u8f91\u7684\u56de\u8c03\u4e8b\u4ef6(boolean: \u9884\u89c8\u5f00\u542f\u72b6\u6001) |\n| helpToggle | Boolean: status , String: value | \u67e5\u770b\u5e2e\u52a9\u7684\u56de\u8c03\u4e8b\u4ef6(boolean: \u5e2e\u52a9\u5f00\u542f\u72b6\u6001) |\n| navigationToggle | Boolean: status , String: value | \u5207\u6362\u5bfc\u822a\u76ee\u5f55\u7684\u56de\u8c03\u4e8b\u4ef6(boolean: \u5bfc\u822a\u5f00\u542f\u72b6\u6001) |\n| imgAdd | String: filename, File: imgfile | \u56fe\u7247\u6587\u4ef6\u6dfb\u52a0\u56de\u8c03\u4e8b\u4ef6(filename: \u5199\u5728md\u4e2d\u7684\u6587\u4ef6\u540d, File: File Object) |\n| imgDel | String: filename | \u56fe\u7247\u6587\u4ef6\u5220\u9664\u56de\u8c03\u4e8b\u4ef6(filename: \u5199\u5728md\u4e2d\u7684\u6587\u4ef6\u540d) |\n\n#### \u4ee3\u7801\u9ad8\u4eae\n\n> \u5982\u4e0d\u9700\u8981hightlight\u4ee3\u7801\u9ad8\u4eae\u663e\u793a\uff0c\u4f60\u5e94\u8be5\u8bbe\u7f6eishljs\u4e3afalse\n\n\u5f00\u542f\u4ee3\u7801\u9ad8\u4eaeprops\n\n```\n // ishljs\u9ed8\u8ba4\u4e3atrue\n <mavon-editor :ishljs = \"true\"></mavon-editor>\n```\n\n\u4e3a\u4f18\u5316\u63d2\u4ef6\u4f53\u79ef\uff0c\u4ece**v2.4.2**\u8d77\u4ee5\u4e0b\u6587\u4ef6\u5c06\u9ed8\u8ba4\u4f7f\u7528`cdnjs`\u5916\u94fe:\n\n- `highlight.js`\n- `github-markdown-css`\n- `katex`(**v2.4.7**)\n\n\u4ee3\u7801\u9ad8\u4eae`highlight.js`\u4e2d\u7684\u8bed\u8a00\u89e3\u6790\u6587\u4ef6\u548c\u4ee3\u7801\u9ad8\u4eae\u6837\u5f0f\u5c06\u5728\u4f7f\u7528\u65f6\u6309\u9700\u52a0\u8f7d. `github-markdown-css`\u548c`katex`\u4ec5\u4f1a\u5728`mounted`\u65f6\u52a0\u8f7d\n\n**Notice**: [\u53ef\u9009\u914d\u8272\u65b9\u6848](https://github.com/hinesboy/mavonEditor/blob/HEAD/src/lib/core/hljs/lang.hljs.css.js) \u548c [\u652f\u6301\u7684\u8bed\u8a00](https://github.com/hinesboy/mavonEditor/blob/HEAD/src/lib/core/hljs/lang.hljs.js) \u662f\u4ece [highlight.js/9.12.0](https://github.com/isagalaev/highlight.js/tree/master/src) \u5bfc\u51fa\u7684\n\n> [\u4e0d\u4f7f\u7528cdn\uff0c\u672c\u5730\u6309\u9700\u52a0\u8f7d\u70b9\u51fb\u8fd9\u91cc...](https://github.com/hinesboy/mavonEditor/blob/HEAD/doc/cn/no-cnd.md)\n\n#### \u56fe\u7247\u4e0a\u4f20\n\n```\n<template>\n <mavon-editor ref=md @imgAdd=\"$imgAdd\" @imgDel=\"$imgDel\"></mavon-editor>\n</template>\nexports default {\n methods: {\n // \u7ed1\u5b9a@imgAdd event\n $imgAdd(pos, $file){\n // \u7b2c\u4e00\u6b65.\u5c06\u56fe\u7247\u4e0a\u4f20\u5230\u670d\u52a1\u5668.\n var formdata = new FormData();\n formdata.append('image', $file);\n axios({\n url: 'server url',\n method: 'post',\n data: formdata,\n headers: { 'Content-Type': 'multipart/form-data' },\n }).then((url) => {\n // \u7b2c\u4e8c\u6b65.\u5c06\u8fd4\u56de\u7684url\u66ff\u6362\u5230\u6587\u672c\u539f\u4f4d\u7f6e![...](0) -> ![...](url)\n /**\n * $vm \u6307\u4e3amavonEditor\u5b9e\u4f8b\uff0c\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u4e24\u79cd\u65b9\u5f0f\u83b7\u53d6\n * 1. \u901a\u8fc7\u5f15\u5165\u5bf9\u8c61\u83b7\u53d6: `import {mavonEditor} from ...` \u7b49\u65b9\u5f0f\u5f15\u5165\u540e\uff0c`$vm`\u4e3a`mavonEditor`\n * 2. \u901a\u8fc7$refs\u83b7\u53d6: html\u58f0\u660eref : `<mavon-editor ref=md ></mavon-editor>\uff0c`$vm`\u4e3a `this.$refs.md`\n */\n $vm.$img2Url(pos, url);\n })\n }\n }\n}\n```\n\n> [\u56fe\u7247\u4e0a\u4f20\u8be6\u60c5\u70b9\u51fb\u8fd9\u91cc...](https://github.com/hinesboy/mavonEditor/blob/HEAD/doc/cn/upload-images.md)\n\n### \u6ce8\n\n- **\u9ed8\u8ba4\u5927\u5c0f\u6837\u5f0f\u4e3a min-height: 300px , min-width: 300px \u53ef\u81ea\u884c\u8986\u76d6**\n- **\u57fa\u7840z-index: 1500**\n- **\u4ec5\u7528\u4f5c\u5c55\u793a\u53ef\u4ee5\u8bbe\u7f6eprops: toolbarsFlag: false , subfield: false, defaultOpen: \"preview\"**\n\n### \u5feb\u6377\u952e\n\n| key | keycode | \u529f\u80fd |\n| :---------------- | :------------: | :-----------------------------------------------------: |\n| F8 | 119 | \u5f00\u542f/\u5173\u95ed\u5bfc\u822a |\n| F9 | 120 | \u9884\u89c8/\u7f16\u8f91\u5207\u6362 |\n| F10 | 121 | \u5f00\u542f/\u5173\u95ed\u5168\u5c4f |\n| F11 | 122 | \u5f00\u542f/\u5173\u95ed\u9605\u8bfb\u6a21\u5f0f |\n| F12 | 123 | \u5355\u680f/\u53cc\u680f\u5207\u6362 |\n| TAB | 9 | \u7f29\u8fdb |\n| CTRL + S | 17 + 83 | \u89e6\u53d1\u4fdd\u5b58 |\n| CTRL + D | 17 + 68 | \u5220\u9664\u9009\u4e2d\u884c |\n| CTRL + Z | 17 + 90 | \u4e0a\u4e00\u6b65 |\n| CTRL + Y | 17 + 89 | \u4e0b\u4e00\u6b65 |\n| CTRL + BreakSpace | 17 + 8 | \u6e05\u7a7a\u7f16\u8f91 |\n| CTRL + B | 17 + 66 | **\u52a0\u7c97** |\n| CTRL + I | 17 + 73 | *\u659c\u4f53* |\n| CTRL + H | 17 + 72 | # \u6807\u9898 |\n| CTRL + 1 | 17 + 97 or 49 | # \u6807\u9898 |\n| CTRL + 2 | 17 + 98 or 50 | ## \u6807\u9898 |\n| CTRL + 3 | 17 + 99 or 51 | ### \u6807\u9898 |\n| CTRL + 4 | 17 + 100 or 52 | #### \u6807\u9898 |\n| CTRL + 5 | 17 + 101 or 53 | ##### \u6807\u9898 |\n| CTRL + 6 | 17 + 102 or 54 | ###### \u6807\u9898 |\n| CTRL + U | 17 + 85 | ++\u4e0b\u5212\u7ebf++ |\n| CTRL + M | 17 + 77 | ==\u6807\u8bb0== |\n| CTRL + Q | 17 + 81 | > \u5f15\u7528 |\n| CTRL + O | 17 + 79 | 1. \u6709\u5e8f\u5217\u8868 |\n| CTRL + L | 17 + 76 | [\u94fe\u63a5](https://www.npmjs.com/package/mavon-editor) |\n| CTRL + ALT + S | 17 + 18 + 83 | ^\u4e0a\u89d2\u6807^ |\n| CTRL + ALT + U | 17 + 18 + 85 | - \u65e0\u5e8f\u5217\u8868 |\n| CTRL + ALT + C | 17 + 18 + 67 | ``` \u4ee3\u7801\u5757 |\n| CTRL + ALT + L | 17 + 18 + 76 | ![\u56fe\u7247\u94fe\u63a5](https://www.npmjs.com/package/mavon-editor) |\n| CTRL + ALT + T | 17 + 18 + 84 | \u8868\u683c |\n| CTRL + SHIFT + S | 17 + 16 + 83 | ~\u4e0b\u89d2\u6807~ |\n| CTRL + SHIFT + D | 17 + 16 + 68 | \u4e2d\u5212\u7ebf |\n| CTRL + SHIFT + C | 17 + 16 + 67 | \u5c45\u4e2d |\n| CTRL + SHIFT + L | 17 + 16 + 76 | \u5c45\u5de6 |\n| CTRL + SHIFT + R | 17 + 16 + 82 | \u5c45\u53f3 |\n| SHIFT + TAB | 16 + 9 | \u53d6\u6d88\u7f29\u8fdb |\n\n## Dependencies (\u4f9d\u8d56)\n\n- [markdown-it](https://github.com/markdown-it/markdown-it)\n- [auto-textarea](https://github.com/hinesboy/auto-textarea)\n\n## Markdown \u8bed\u6cd5\u62d3\u5c55\n\n- [emoji](https://github.com/markdown-it/markdown-it-emoji)\n- [subscript](https://github.com/markdown-it/markdown-it-sub)\n- [superscript](https://github.com/markdown-it/markdown-it-sup)\n- [container](https://github.com/markdown-it/markdown-it-container)\n- [definition list](https://github.com/markdown-it/markdown-it-deflist)\n- [abbreviation](https://github.com/markdown-it/markdown-it-abbr)\n- [footnote](https://github.com/markdown-it/markdown-it-footnote)\n- [insert](https://github.com/markdown-it/markdown-it-ins)\n- [mark](https://github.com/markdown-it/markdown-it-mark)\n- [todo list](https://github.com/revin/markdown-it-task-lists)\n- [highlight](https://github.com/isagalaev/highlight.js)\n- [katex](https://github.com/Khan/KaTeX)\n- [images preview](https://github.com/CHENXCHEN/markdown-it-images-preview)\n- [toc](https://github.com/tylerlong/markdown-it-toc)\n- \u53ef\u901a\u8fc7[\u83b7\u53d6markdown-it\u5bf9\u8c61](https://github.com/hinesboy/mavonEditor/blob/HEAD/doc/cn/markdown.md)\u5f15\u5165[\u5176\u4ed6\u8bed\u6cd5\u63d2\u4ef6](https://www.npmjs.com/search?q=keywords:markdown-it-plugin)",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 24,
"user": 1,
"add_time": "2020-04-21T17:10:57.559Z",
"modified_time": "2020-04-22T11:59:56.637Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 135,
"fields": {
"note": 3,
"title": "js\u56fe\u7247\u524d\u7aef\u9884\u89c8\u4e4b filereader \u548c window.URL.createObjectURL",
"text_content": "# [js\u56fe\u7247\u524d\u7aef\u9884\u89c8\u4e4b filereader \u548c window.URL.createObjectURL](https://www.cnblogs.com/saysmy/p/5626337.html)\n\n[![\u590d\u5236\u4ee3\u7801](https://common.cnblogs.com/images/copycode.gif)](javascript:void(0);)\n\n```\n 1 //preview img \uff1a filereader\u65b9\u5f0f\n 2 document.getElementById('imgFile').onchange = function(e){ \n 5 var ele = document.getElementById('imgFile').files[0];\n 6 \n 8 var fr = new FileReader();\n 9 fr.onload = function(ele){\n10 \n11 var pvImg = new Image();\n12 pvImg.src = ele.target.result;\n13 pvImg.setAttribute('id','previewImg');\n14 \n15 $('.preview_wrap').html('').append(pvImg);18 }\n20 fr.readAsDataURL(ele);\n21 }\n```\n\n[![\u590d\u5236\u4ee3\u7801](https://common.cnblogs.com/images/copycode.gif)](javascript:void(0);)\n\n \n\n[![\u590d\u5236\u4ee3\u7801](https://common.cnblogs.com/images/copycode.gif)](javascript:void(0);)\n\n```\n 1 //preview img \uff1a URL.createObjectURL \u65b9\u5f0f\n 2 document.getElementById('imgFile').onchange = function(e){\n 5 var ele = document.getElementById('imgFile').files[0];\n 6 \n 7 var createObjectURL = function(blob){\n 8 return window[window.webkitURL ? 'webkitURL' : 'URL']['createObjectURL'](blob);\n 9 };\n10 var newimgdata = createObjectURL(ele);\n11 \n12 var pvImg = new Image();\n13 pvImg.src = newimgdata;\n14 pvImg.setAttribute('id','previewImg');\n15 \n16 $('.preview_wrap').html('').append(pvImg);\n21 }\n```\n\n[![\u590d\u5236\u4ee3\u7801](https://common.cnblogs.com/images/copycode.gif)](javascript:void(0);)\n\n\u4ee5\u4e0a\u5148\u8d34\u51fa\u7528filereader \u548c URL.createObjectURL \u4e24\u79cd\u9884\u89c8\u65b9\u5f0f\u3002\n\n\u6309\u7167\u524d\u8f88\u4eec\u7684\u8bf4\u6cd5\uff0ccreatObjectURL\u53ef\u4ee5\u6709\u66f4\u597d\u7684\u6027\u80fd\uff0c\u6216\u8bb8\u662f\u6d4f\u89c8\u5668\u81ea\u5e26\u63a5\u53e3\u7684\u539f\u56e0, \u53ef\u4ee5\u5904\u7406\u7684\u66f4\u5feb\u3002 \n\n\u6700\u8fd1\u505a\u4e86\u4e00\u4e2a\u9700\u8981\u4e0a\u4f20\u56fe\u7247\u9884\u89c8\u7684\u9879\u76ee\uff0c\u7528\u7684\u6700\u7b80\u5355\u7684input file\u4e0a\u4f20\uff0c\u6700\u5f00\u59cb\u60f3\u5230\u7684\u5c31\u662f\u7528filereader\u5b9e\u73b0\u524d\u7aef\u9884\u89c8\uff0c\u5f88\u7b80\u5355\uff0c\u89c1\u524d\u9762\u7684\u7b2c\u4e00\u6bb5\u4ee3\u7801\uff0c\u5728\u81ea\u5df1\u624b\u673a\u4e0a\u6d4b\u8bd5\uff0c\u6ca1\u95ee\u9898\u3002\u4f46\u5728\u67d0\u4e9b\u5947\u8469\u624b\u673a\u4e0a\uff0c\u6bd4\u5982oppo \u5b89\u53534.3\u5728\u6211\u4eecapp\u7684webview\u5185\u901a\u8fc7\u6253\u5f00\u76f8\u518c\u4e0a\u4f20\u53d1\u73b0\u65e0\u6cd5\u9884\u89c8\u56fe\u7247\uff01\u4f46\u5728\u8be5\u624b\u673a\u7684\u5fae\u4fe1\uff0c\u6d4f\u89c8\u5668\u5185\u4e0a\u4f20\u5747\u53ef\u4ee5\uff01\n\n\u770b\u4e86\u4e0b\u4ee3\u7801\uff0c\u5982\u4e0b\u56fe\uff0c\u662f\u56e0\u4e3abase64\u7f16\u7801\u5185\u7f3a\u5c11\u4e86\u56fe\u7247\u683c\u5f0f\uff0c\u624b\u52a8\u52a0\u4e0aimage/jpg\u56fe\u7247\u7acb\u5373\u663e\u793a\uff0c\u521a\u5f00\u59cb\u4ee5\u4e3a\u662freadAsDataURL\u7684\u95ee\u9898\uff0c\u6ca1\u6709\u7f16\u7801\u6210\u529f\uff0c\u627e\u4e86\u4e00\u665a\u4e0a\u539f\u56e0\uff0c\u65e0\u89e3\uff01\u4e0d\u77e5\u54ea\u6839\u7b4b\u642d\u9519\u7a81\u7136\u60f3\u5230\u6253\u5370\u51fainput file\u7684type\u770b\u770b\uff0c\u53d1\u73b0type\u4e3a\u7a7a\uff0c\u800cfile\u7684\u5176\u4ed6\u5c5e\u6027\u5747\u6b63\u5e38\u3002\n\n![img](https://images2015.cnblogs.com/blog/979473/201606/979473-20160629121628952-1325884107.png)\n\n\u7ee7\u7eed\u767e\u5ea6\uff08google\u6700\u8fd1\u516c\u53f8\u7ffb\u5899\u4e0d\u7a33\u5b9a\uff0c\u6ca1\u6cd5\u7528\uff09\uff0c\u7ed3\u679c\u770b\u5230\u6709\u4eba\u9047\u5230\u7c7b\u4f3c\u5947\u602a\u95ee\u9898\uff0c\u4f46\u662f\u6ca1\u6709\u89e3\u51b3\u3002\n\n\u65e0\u610f\u95f4\u5374\u53d1\u73b0\u56fe\u7247\u9884\u89c8\u9664\u4e86filereader\u8fd8\u53ef\u4ee5\u7528url.createObjectURL\u3002\u665a\u4e0a11\u70b926\uff0c\u5148\u8d76\u6700\u540e\u4e00\u73ed\u5730\u94c1\u3002\n\n=====================\n\n\u7b2c\u4e8c\u5929\u4e00\u65e9\uff0c\u628a\u534a\u591c\u7684\u7075\u611f\u5b9e\u9a8c\u4e86\u4e0b\uff0c\u6839\u636e\u5224\u65adinput file\u7684\u56fe\u7247\u7c7b\u578b\uff0c\u5982\u679c\u4e0d\u5b58\u5728\u5c31\u7ed9\u6587\u4ef6\u624b\u52a8\u8d4b\u503c\u7c7b\u578b\u3002\uff08\u89c1\u4e0b\u65b9\u8c03\u8bd5\u7528\u4ee3\u7801\uff0c\u6709\u70b9\u4e71\uff09\n\n![img](https://images2015.cnblogs.com/blog/979473/201606/979473-20160629183622234-73610000.png)\n\n\u7ed3\u679c\u53d1\u73b0file\u7684type\u5e76\u4e0d\u662f\u4f60\u76f4\u63a5\u8d4b\u503c\u5c31\u53ef\u4ee5\u6539\u53d8\u7684\uff0c\u6ca1\u6709\u7528\uff01\n\n \n\n\u4e8e\u662f\u5f00\u59cb\u5b9e\u8df5URL.createObjectURL (\u89c1\u6700\u4e0a\u9762\u7684\u7b2c\u4e8c\u90e8\u5206\u4ee3\u7801)\n\n\u795e\u5947\uff01\u53d1\u73b0\u9884\u89c8\u6b63\u5e38\uff01\n\n \n\n\u67e5\u770b\u4ee3\u7801\u53d1\u73b0\uff0ccreateObjectURL\u5f97\u5230\u7684\u662f\u4e00\u4e2ahttp\u683c\u5f0f\u7684\u6587\u4ef6\uff0c\u5373\u4f7finput file\u7684\u6587\u4ef6\u7c7b\u578b\u4e0d\u5b58\u5728\u4e5f\u4e0d\u4f1a\u7f16\u7801\u5931\u8d25\u3002\n\n![img](https://images2015.cnblogs.com/blog/979473/201606/979473-20160629183920312-692198134.png)\n\n \n\n \n\n \n\n ps:\n\n\u5bf9\u4e8e\u5728\u5b89\u5353\u5185\u70b9\u51fb\u4e0a\u4f20\u65e0\u53cd\u5e94\u7684\u95ee\u9898\u662f\u5b89\u5353\u4e3a\u4e86\u5b89\u5168\u8d77\u89c1\u5c4f\u853d\u4e86\u4e0a\u4f20\uff0c\u89c1\uff1ahttp://www.tuicool.com/articles/buu6ji",
"original": false,
"orginal_link": "(https://www.cnblogs.com/saysmy/p/5626337.html",
"public": false,
"browse_num": 17,
"user": 1,
"add_time": "2020-04-22T14:02:39.473Z",
"modified_time": "2020-04-23T05:27:17.368Z",
"types": [
2,
9,
10,
11,
12,
14,
15
]
}
},
{
"model": "articals.articale",
"pk": 140,
"fields": {
"note": 3,
"title": "URL.createObjectURL",
"text_content": "**\u4e00.URL.createObjectURL** \n\nURL.createObjectURL()\u65b9\u6cd5\u4f1a\u6839\u636e\u4f20\u5165\u7684\u53c2\u6570\u521b\u5efa\u4e00\u4e2a\u6307\u5411\u8be5\u53c2\u6570\u5bf9\u8c61\u7684URL. \u8fd9\u4e2aURL\u7684\u751f\u547d\u4ec5\u5b58\u5728\u4e8e\u5b83\u88ab\u521b\u5efa\u7684\u8fd9\u4e2a\u6587\u6863\u91cc. \u65b0\u7684\u5bf9\u8c61URL\u6307\u5411\u6267\u884c\u7684File\u5bf9\u8c61\u6216\u8005\u662fBlob\u5bf9\u8c61.\n\n \n\n\u8bed\u6cd5: \n\n```javascript\nobjectURL = URL.createObjectURL(blob || file);\n```\n\n \n\n \n\n\u53c2\u6570:\n\nFile\u5bf9\u8c61\u6216\u8005Blob\u5bf9\u8c61\n\n\u8fd9\u91cc\u5927\u6982\u8bf4\u4e0bFile\u5bf9\u8c61\u548cBlob\u5bf9\u8c61:\n\nFile\u5bf9\u8c61,\u5c31\u662f\u4e00\u4e2a\u6587\u4ef6,\u6bd4\u5982\u6211\u7528input type=\"file\"\u6807\u7b7e\u6765\u4e0a\u4f20\u6587\u4ef6,\u90a3\u4e48\u91cc\u9762\u7684\u6bcf\u4e2a\u6587\u4ef6\u90fd\u662f\u4e00\u4e2aFile\u5bf9\u8c61.\n\nBlob\u5bf9\u8c61,\u5c31\u662f\u4e8c\u8fdb\u5236\u6570\u636e,\u6bd4\u5982\u901a\u8fc7new Blob()\u521b\u5efa\u7684\u5bf9\u8c61\u5c31\u662fBlob\u5bf9\u8c61.\u53c8\u6bd4\u5982,\u5728XMLHttpRequest\u91cc,\u5982\u679c\u6307\u5b9aresponseType\u4e3ablob,\u90a3\u4e48\u5f97\u5230\u7684\u8fd4\u56de\u503c\u4e5f\u662f\u4e00\u4e2ablob\u5bf9\u8c61.\n\n \n\n\u6ce8\u610f\u70b9:\n\n\u6bcf\u6b21\u8c03\u7528createObjectURL\u7684\u65f6\u5019,\u4e00\u4e2a\u65b0\u7684URL\u5bf9\u8c61\u5c31\u88ab\u521b\u5efa\u4e86.\u5373\u4f7f\u4f60\u5df2\u7ecf\u4e3a\u540c\u4e00\u4e2a\u6587\u4ef6\u521b\u5efa\u8fc7\u4e00\u4e2aURL. \u5982\u679c\u4f60\u4e0d\u518d\u9700\u8981\u8fd9\u4e2a\u5bf9\u8c61,\u8981\u91ca\u653e\u5b83,\u9700\u8981\u4f7f\u7528URL.revokeObjectURL()\u65b9\u6cd5. \u5f53\u9875\u9762\u88ab\u5173\u95ed,\u6d4f\u89c8\u5668\u4f1a\u81ea\u52a8\u91ca\u653e\u5b83,\u4f46\u662f\u4e3a\u4e86\u6700\u4f73\u6027\u80fd\u548c\u5185\u5b58\u4f7f\u7528,\u5f53\u786e\u4fdd\u4e0d\u518d\u7528\u5f97\u5230\u5b83\u7684\u65f6\u5019,\u5c31\u5e94\u8be5\u91ca\u653e\u5b83.\n\n \n\n**\u4e8c.URL.revokeObjectURL**\n\nURL.revokeObjectURL()\u65b9\u6cd5\u4f1a\u91ca\u653e\u4e00\u4e2a\u901a\u8fc7URL.createObjectURL()\u521b\u5efa\u7684\u5bf9\u8c61URL. \u5f53\u4f60\u8981\u5df2\u7ecf\u7528\u8fc7\u4e86\u8fd9\u4e2a\u5bf9\u8c61URL,\u7136\u540e\u8981\u8ba9\u6d4f\u89c8\u5668\u77e5\u9053\u8fd9\u4e2aURL\u5df2\u7ecf\u4e0d\u518d\u9700\u8981\u6307\u5411\u5bf9\u5e94\u7684\u6587\u4ef6\u7684\u65f6\u5019,\u5c31\u9700\u8981\u8c03\u7528\u8fd9\u4e2a\u65b9\u6cd5.\n\n\u5177\u4f53\u7684\u610f\u601d\u5c31\u662f\u8bf4,\u4e00\u4e2a\u5bf9\u8c61URL,\u4f7f\u7528\u8fd9\u4e2aurl\u662f\u53ef\u4ee5\u8bbf\u95ee\u5230\u6307\u5b9a\u7684\u6587\u4ef6\u7684,\u4f46\u662f\u6211\u53ef\u80fd\u53ea\u9700\u8981\u8bbf\u95ee\u4e00\u6b21,\u4e00\u65e6\u5df2\u7ecf\u8bbf\u95ee\u5230\u4e86,\u8fd9\u4e2a\u5bf9\u8c61URL\u5c31\u4e0d\u518d\u9700\u8981\u4e86,\u5c31\u88ab\u91ca\u653e\u6389,\u88ab\u91ca\u653e\u6389\u4ee5\u540e,\u8fd9\u4e2a\u5bf9\u8c61URL\u5c31\u4e0d\u518d\u6307\u5411\u6307\u5b9a\u7684\u6587\u4ef6\u4e86.\n\n\u6bd4\u5982\u4e00\u5f20\u56fe\u7247,\u6211\u521b\u5efa\u4e86\u4e00\u4e2a\u5bf9\u8c61URL,\u7136\u540e\u901a\u8fc7\u8fd9\u4e2a\u5bf9\u8c61URL,\u6211\u9875\u9762\u91cc\u52a0\u8f7d\u4e86\u8fd9\u5f20\u56fe.\u65e2\u7136\u5df2\u7ecf\u88ab\u52a0\u8f7d,\u5e76\u4e14\u4e0d\u9700\u8981\u518d\u6b21\u52a0\u8f7d\u8fd9\u5f20\u56fe,\u90a3\u6211\u5c31\u628a\u8fd9\u4e2a\u5bf9\u8c61URL\u91ca\u653e,\u7136\u540e\u8fd9\u4e2aURL\u5c31\u4e0d\u518d\u6307\u5411\u8fd9\u5f20\u56fe\u4e86.\n\n \n\n\u8bed\u6cd5:\n\n```javascript\nwindow.URL.revokeObjectURL(objectURL);\n```\n\n \n\n\u53c2\u6570:\n\nobjectURL \u662f\u4e00\u4e2a\u901a\u8fc7URL.createObjectURL()\u65b9\u6cd5\u521b\u5efa\u7684\u5bf9\u8c61URL.\n\n \n\n\u8fd9\u4e24\u4e2a\u65b9\u6cd5\u4e0d\u652f\u6301\u4f4e\u7248\u672c\u6d4f\u89c8\u5668.\n\n \n\n\u6700\u540e,\u7ed9\u4e2a\u7efc\u5408\u6817\u5b50:\n\n\u901a\u8fc7ajax\u83b7\u53d6\u4e00\u5f20\u56fe\u7247,\u663e\u793a\u5728\u9875\u9762\u91cc.\n\nhtml: \n\n```html\n<body>\n <button id=\"getPic\">\u83b7\u53d6\u56fe\u7247\u7684Blob\u6570\u636e</button>\n</body>\n```\n\n \n\njs\n\n```javascript\n//\u83b7\u53d6\u56fe\u7247Blob\u6570\u636e\n document.getElementById('getPic').onclick = function(e){\n $.ajax({\n type:'GET',\n url:'img.png',\n resDataType:'blob',\n imgType:'png',\n success:function(resText,resXML){\n var img = document.createElement('img');\n var objectUrl = window.URL.createObjectURL(resText);\n img.src = objectUrl;\n img.onload = function(){\n window.URL.revokeObjectURL(objectUrl);\n };\n document.body.appendChild(img);\n },\n fail:function(err){\n console.log(err)\n }\n });\n e.preventDefault();\n }\n```\n\n\n\n\u6307\u5b9a\u8fd4\u56de\u7684\u6570\u636e\u683c\u5f0f\u4e3ablob\u4e8c\u8fdb\u5236\u6570\u636e.\n\n\u901a\u8fc7\u8fd4\u56de\u7684\u56fe\u7247\u4e8c\u8fdb\u5236\u6570\u636e\u6765\u521b\u5efa\u4e00\u4e2a\u5bf9\u8c61URL.\n\n\u5f53\u56fe\u7247\u52a0\u8f7d\u5b8c\u6210\u540e\u91ca\u653e\u5bf9\u8c61URL.\n\n \n\najax.js:\n\n```javascript\nvar $={};\n$.ajax = function(options){\n //1.\u83b7\u53d6\u53c2\u6570\n var type = options.type.toUpperCase() || 'GET';\n var resDataType = options.resDataType || 'string';\n var reqDataType = options.reqDataType || 'string';\n var url = options.url;\n var data = options.data;\n var success = options.success;\n var fail = options.fail;\n var progress = options.progress;\n var imgType = options.imgType || 'jpg';\n\n //2.\u83b7\u53d6xhr\u5bf9\u8c61\n var xhr = $.getXhr();\n\n //3.\u5efa\u7acb\u8fde\u63a5\n xhr.open(type,url);\n /*\u6307\u5b9a\u8fd4\u56de\u6570\u636e\u7684\u683c\u5f0f\u9700\u8981\u5728\u53d1\u9001\u8bf7\u6c42\u4e4b\u524d*/\n if(resDataType==='blob'){\n xhr.responseType = 'blob';\n }\n\n//4.\u53d1\u9001\u8bf7\u6c42\n if(type==='GET'){\n xhr.send(null)\n }\n else if(type==='POST') {\n if(progress){\n xhr.upload.onprogress = progress;\n }\n if(reqDataType==='json'){\n xhr.setRequestHeader('Content-Type','application/json;charset=UTF-8');\n data = JSON.stringify(data); //\u53ea\u80fd\u53d1\u9001\u5b57\u7b26\u4e32\u683c\u5f0f\u7684json,\u4e0d\u80fd\u76f4\u63a5\u53d1\u9001json\n }\n if(reqDataType==='string'){\n xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');\n }\n xhr.send(data);\n }\n\n //5.\u63a5\u6536\u6570\u636e\n xhr.onreadystatechange = function(){\n if(this.readyState===4 && (this.status>=200 && this.status<300)){\n var res;\n if(resDataType==='json'){\n res = JSON.parse(this.responseText);\n success.call(this,res,this.responseXML)\n }\n if(resDataType==='blob'){\n res = new Blob([this.response],{type:'image/'+imgType});\n success.call(this,res)\n }\n\n }\n };\n};\n```\n\n\n\n\u6307\u5b9a\u54cd\u5e94\u7684\u683c\u5f0f\u662f\u4e8c\u8fdb\u5236\u6570\u636e.\n\n\u4f7f\u7528xhr.response\u6765\u83b7\u53d6\u54cd\u5e94\u7684\u4e8c\u8fdb\u5236\u6570\u636e,\u800c\u4e0d\u662fxhr.responseText. \u5f53\u5b9a\u4e49\u4e86xhr.responseType='blob'\u4ee5\u540e,xhr\u5c31\u6ca1\u6709responseText\u5c5e\u6027\u4e86.\n\n\u8fd9\u91cc\u867d\u7136\u4f7f\u7528new Blob(),\u4f46\u5176\u5b9e\u4e0d\u7528\u5b83,\u76f4\u63a5\u8fd4\u56dexhr.response,\u4e00\u6837\u662f\u6b63\u786e\u7684.",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 2,
"user": 1,
"add_time": "2020-04-23T11:26:24.782Z",
"modified_time": "2020-04-23T05:49:17.032Z",
"types": [
10,
11
]
}
},
{
"model": "articals.articale",
"pk": 141,
"fields": {
"note": 3,
"title": "js\u4e2dArrayBuffer\u64cd\u4f5c",
"text_content": "# js\u4e2dArrayBuffer\u64cd\u4f5c\n\n\u9996\u5148\u58f0\u660e\u4e00\u4e0b\uff0c\u672c\u4eba\u524d\u7aef\u83dc\u9e1f\u4e00\u679a\uff0c\u8fd9\u91cc\u53ea\u662f\u8bb0\u5f55\u4e00\u4e0b\u6211\u4e2a\u4eba\u6700\u8fd1\u4f7f\u7528js\u64cd\u4f5c\u4e8c\u8fdb\u5236\u6587\u4ef6\u7684\u4e00\u4e9b\u65b9\u6cd5\uff0c\u4ee5\u4fbf\u65e5\u540e\u7528\u7684\u65f6\u5019\u67e5\u8be2\uff0c\u5982\u679c\u6709\u5199\u7684\u4e0d\u5bf9\u7684\u5730\u65b9\uff0c\u8bf7\u5927\u795e\u6307\u51fa\u3002\n\n## \u6570\u636e\u83b7\u53d6\n\n\u524d\u7aef\u8bf7\u6c42\u4e8c\u8fdb\u5236\u6570\u636e\u7684\u65f6\u5019\u9700\u8981\u8bbe\u7f6e\u6570\u636e\u54cd\u5e94\u683c\u5f0f\uff1axhr.responseType = \"arraybuffer\"\uff1b\n\u5199\u6cd5\u5982\u4e0b\uff1a\n\n\n\n```javascript\nvar xhr = new XMLHttpRequest();\nxhr.open('GET', url, true);\nxhr.responseType = 'arraybuffer';\nxhr.onload = function(e) {\n buffer = xhr.response;\n console.log(buffer)\n};\nxhr.send();\n```\n\nresponseType\u53ef\u9009\u7684\u53c2\u6570\u6709\uff1a\"text\"\u3001\"arraybuffer\"\u3001\"blob\"\u6216\"document\"\uff1b\u5bf9\u5e94\u7684\u8fd4\u56de\u6570\u636e\u4e3aDOMString\u3001ArrayBuffer\u3001Blob\u3001Document\uff1b\u9ed8\u8ba4\u53c2\u6570\u4e3a\"text\"\u3002\n\n## \u6570\u636e\u89e3\u6790\n\n\u901a\u8fc7\u5bf9\u5e94\u6570\u636e\u7c7b\u578b\u7684\u8bf7\u6c42\uff0c\u53ef\u4ee5\u5f97\u5230\u4e8c\u8fdb\u5236\u6570\u636e\uff0c\u6570\u636e\u88ab\u5b58\u50a8\u5728\u901a\u8fc7ArrayBuffer\u8fd9\u4e2a\u6784\u9020\u51fd\u6570\u521b\u5efa\u4e00\u4e2a\u7f13\u51b2\u533a\u5185\uff0c\u53d6\u5f97\u6570\u636e\u540e\u9700\u8981\u4f7f\u7528\u76f8\u5bf9\u5e94\u7684[TypedArray](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)\u8fdb\u884c\u89e3\u6790\u3002\n\u7c7b\u578b\u5316\u6570\u7ec4\u6709\u4ee5\u4e0b\u51e0\u79cd\uff1a\n\n| \u540d\u79f0 | \u5360\u7528\u5b57\u8282 | \u63cf\u8ff0 |\n| :---------------: | :------: | :------------------------------------: |\n| Int8Array | 1 | 8\u4f4d\u4e8c\u8865\u7801\u6709\u7b26\u53f7\u6574\u6570 |\n| Uint8Array | 1 | 8\u4f4d\u65e0\u7b26\u53f7\u6574\u6570 |\n| Uint8ClampedArray | 1 | 8\u4f4d\u65e0\u7b26\u53f7\u6574\u578b\u56fa\u5b9a\u6570\u7ec4(\u6570\u503c\u57280~255\u4e4b\u95f4) |\n| Int16Array | 2 | 16\u4f4d\u4e8c\u8865\u7801\u6709\u7b26\u53f7\u6574\u6570 |\n| Uint16Array | 2 | 16\u4f4d\u65e0\u7b26\u53f7\u6574\u6570 |\n| Int32Array | 4 | 32 \u4f4d\u4e8c\u8865\u7801\u6709\u7b26\u53f7\u6574\u6570 |\n| Uint32Array | 4 | 32 \u4f4d\u65e0\u7b26\u53f7\u6574\u6570 |\n| Float32Array | 4 | 32 \u4f4d IEEE \u6d6e\u70b9\u6570 |\n| Float64Array | 8 | 64 \u4f4d IEEE \u6d6e\u70b9\u6570 |\n\nInt \u4e3a\u6574\u578b\uff0cUint \u4e3a\u65e0\u7b26\u53f7\u6570\uff0cFloat \u4e3a\u6d6e\u70b9\u578b\uff0c\u4e00\u4e2a\u5b57\u8282\u5360\u516b\u4f4d\uff0c\u89e3\u6790\u6570\u636e\u4ee5\"\u5b57\u8282\"\u4e3a\u57fa\u7840\u5355\u4f4d\uff0c\u65e0\u6cd5\u76f4\u63a5\u8bfb\u53d6\u4f4d\uff08\u4e0d\u77e5\u9053\u662f\u4e0d\u662f\u8fd9\u6837\uff0c\u53cd\u6b63\u6211\u662f\u6ca1\u627e\u5230\u65b9\u6cd5\uff09\u3002\u89e3\u6790\u6570\u636e\u7684\u65f6\u5019\u8981\u4e86\u89e3\u6570\u636e\u7684\u5b58\u50a8\u683c\u5f0f\u3002\n\n##### \u5355\u4e00\u7c7b\u578b\u6570\u636e\n\n\u5355\u4e00\u7c7b\u578b\u6570\u636e\u53ef\u7528\u5bf9\u5e94\u7684\u7c7b\u578b\u5316\u6570\u7ec4\u76f4\u63a5\u8fdb\u884c\u89e3\u6790\uff1a\n\n\n\n```php\nvar array = new Uint8Array(buffer);\nfor(var i = 0; i < array.length; ++i){\n console.log(array[i])\n}\n```\n\n##### \u6df7\u7f16\u7c7b\u578b\u6570\u636e\n\n\u6df7\u7f16\u7c7b\u578b\u6570\u636e\u89e3\u6790\u9700\u8981\u7528\u79fb\u4f4d\u7684\u65b9\u5f0f\u89e3\u6790\u5176\u4e2d\u5bf9\u5e94\u7c7b\u578b\u7684\u6570\u636e\uff1a\n\n\n\n```javascript\nvar array = new Uint8Array(buffer [, byteOffset [, length]])\nfor(var i = 0; i < array.length; ++i){\n console.log(array[i])\n}\n```\n\n\u521d\u59cb\u5316\u6570\u7ec4\u7684\u65f6\u5019\u7528\u7b2c\u4e8c\u4e2a\u548c\u7b2c\u4e09\u4e2a\u53c2\u6570\u622a\u53d6\u67d0\u6bb5\u6570\u636e\uff0c\u751f\u6210\u76f8\u5e94\u7c7b\u578b\u7684\u6570\u636e\uff0c\u5176\u4e2d\u7b2c\u4e8c\u4e2a\u53c2\u6570\u8868\u793a\u504f\u79fb\u7684\u5b57\u8282\u6570\uff0c\u7b2c\u4e09\u4e2a\u53c2\u6570\u8868\u793a\u6570\u7ec4\u957f\u5ea6\u3002\n\n## DataView\n\n[DataView](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/DataView)\u89c6\u56fe\u662f\u4e00\u4e2a\u53ef\u4ee5\u4ece\u5bf9\u8c61\u4e2d\u8bfb\u5199\u591a\u79cd\u6570\u503c\u7c7b\u578b\u7684\u5e95\u5c42\u63a5\u53e3\uff0c\u4f7f\u7528\u5b83\u65f6\uff0c\u4e0d\u7528\u8003\u8651\u4e0d\u540c\u5e73\u53f0\u7684[\u5b57\u8282\u5e8f](https://developer.mozilla.org/zh-CN/docs/Glossary/Endianness)\u95ee\u9898\u3002\n\n\n\n```jsx\nvar dataView = new DataView(buffer [, byteOffset [, byteLength]]);\n```\n\nDataView\u4e2d\u63d0\u4f9b\u4e86\u5404\u79cd\u7c7b\u578b\u6570\u636e\u7684get\u548cset\u65b9\u6cd5\uff0c\u901a\u8fc7\u8fd9\u4e9b\u65b9\u6cd5\u53ef\u4ee5\u66f4\u52a0\u76f4\u89c2\u7684\u64cd\u4f5cTypedArray\uff0c\u5173\u4e8e\u5176\u4e2d\u7684\u5404\u65b9\u6cd5\u7684\u8be6\u7ec6\u89e3\u91ca\uff0c\u8bf7\u53c2\u89c1[MDN web doc](https://developer.mozilla.org/zh-CN/)\u3002\nDataView\u7684get\u65b9\u6cd5\u4e2d\u9664\u4e86get\u4e00\u4e2a\u5b57\u8282\u7684\u6570\u636e\u5916\uff0c\u5747\u542b\u6709\u7b2c\u4e8c\u4e2a\u53ef\u9009\u53c2\u6570[littleEndian](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/DataView/getFloat64)\uff0c\u6307\u793a\u6570\u636e\u662f\u4ee5\u5c0f\u7aef\u8fd8\u662f\u5927\u7aef\u683c\u5f0f\u5b58\u50a8\u3002\u5982\u679c\u4e3afalse\u6216\u672a\u5b9a\u4e49\uff0c\u5219\u504f\u79fb\u4f4d\u662f\u6309\u7167\u5143\u7d20\u504f\u79fb\u7684\u3002\u8bbe\u7f6e\u4e3atrue\u65f6\uff0c\u5219\u504f\u79fb\u4f4d\u662f\u6309\u7167\u5b57\u8282\u6570\u504f\u79fb\u7684\uff08\u4e2a\u4eba\u89c1\u89e3\u3002\u53ef\u80fd\u6709\u8bef\uff09\u3002\n\n## \u5c0f\u7ed3\n\n\u672c\u7bc7\u6587\u7ae0\u4e3b\u8981\u5199\u7684\u662f\u524d\u7aef\u83b7\u53d6ArrayBuffer\u6570\u636e\u7684\u65b9\u6cd5\uff0c\u4ee5\u53ca\u62ff\u5230\u6570\u636e\u65f6\u5019\u8be5\u5982\u4f55\u89e3\u6790\uff0c\u5199\u7684\u65f6\u5019\u624d\u53d1\u73b0\u81ea\u5df1\u8fd8\u662f\u6709\u5f88\u591a\u6ca1\u641e\u61c2\u7684\u5730\u65b9\uff0c\u867d\u7136\u67e5\u4e86\u4e00\u4e9b\u8d44\u6599\uff0c\u4f46\u662f\u53ef\u80fd\u8fd8\u662f\u9519\u8bef\u7684\u5730\u65b9\uff0c\u5e0c\u671b\u53d1\u73b0\u7684\u8bfb\u8005\u53ef\u4ee5\u6307\u51fa\uff0c\u4e0d\u80dc\u611f\u6fc0\u3002",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 2,
"user": 1,
"add_time": "2020-04-23T13:28:09.719Z",
"modified_time": "2020-04-23T05:28:36.324Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 142,
"fields": {
"note": 4,
"title": "python \u83b7\u53d6\u6587\u4ef6\u7c7b\u578b",
"text_content": "```python\nimport chardet\nimport os\nimport sys\n# \u83b7\u53d6\u6587\u4ef6\u7f16\u7801\u7c7b\u578b\ndef get_encoding(file):\n # \u4e8c\u8fdb\u5236\u65b9\u5f0f\u8bfb\u53d6\uff0c\u83b7\u53d6\u5b57\u8282\u6570\u636e\uff0c\u68c0\u6d4b\u7c7b\u578b\n with open(file, 'rb') as f:\n data = f.read()\n return chardet.detect(data)['encoding']\n \n\nos.chdir(os.path.abspath(os.path.dirname(sys.argv[0])))\ndirs = os.listdir()\n# print(dirs)\n\n# file_name = 'ReleaseNote.txt'\nfile_name = 'hello.txt'\n\nencoding = get_encoding(file_name)\nprint(encoding)\n```",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 5,
"user": 1,
"add_time": "2020-04-23T13:46:57.991Z",
"modified_time": "2020-04-23T06:40:19.991Z",
"types": [
16,
17
]
}
},
{
"model": "articals.articale",
"pk": 143,
"fields": {
"note": 3,
"title": "\u4f7f\u7528mptt\u521b\u5efaJSON\u4ee5\u5728Python / Django\u4e2d\u53cd\u6620\u6811\u7ed3\u6784\u7684\u6700\u5feb\u65b9\u6cd5",
"text_content": "# \u4f7f\u7528mptt\u521b\u5efaJSON\u4ee5\u5728Python / Django\u4e2d\u53cd\u6620\u6811\u7ed3\u6784\u7684\u6700\u5feb\u65b9\u6cd5\n\n\u65f6\u95f4 2018-10-19\n\n\u6807\u7b7e [django](http://www.voidcn.com/tag/django) [json](http://www.voidcn.com/tag/json) [profiling](http://www.voidcn.com/tag/profiling) [python](http://www.voidcn.com/tag/python) [tree](http://www.voidcn.com/tag/tree) \u680f\u76ee [JavaScript](http://www.voidcn.com/column/javascript)\n\n*\u539f\u6587* [\u7ffb\u8bd1\u81ea\uff1ahttps://stackoverflow.com/questions/12556268/fastest-way-to-create-json-to-reflect-a-tree-structure-in-python-django-using](javascript:void())\n\n\n\n[Python](javascript:void())(Django)\u4e2d\u57fa\u4e8eDjango\u67e5\u8be2\u5668\u521b\u5efaJSON\u7684\u6700\u5feb\u65b9\u6cd5\u662f\u4ec0\u4e48\uff1f\u8bf7\u6ce8\u610f,\u5728\u5efa\u8bae\u7684 [here](javascript:void())\u6a21\u677f\u4e2d\u89e3\u6790\u5b83\u4e0d\u662f\u4e00\u4e2a\u9009\u9879.\n\n\n\n\u80cc\u666f\u662f\u6211\u521b\u5efa\u4e86\u4e00\u4e2a\u5faa\u73af\u904d\u5386\u6811\u4e2d\u6240\u6709\u8282\u70b9\u7684\u65b9\u6cd5,\u4f46\u662f\u5728\u8f6c\u6362\u7ea6300\u4e2a\u8282\u70b9\u65f6\u5df2\u7ecf\u975e\u5e38\u6162.\u6211\u60f3\u5230\u7684\u7b2c\u4e00\u4e2a(\u4e5f\u8bb8\u662f\u6700\u7cdf\u7cd5\u7684)\u60f3\u6cd5\u662f\u4ee5\u624b\u52a8\u65b9\u5f0f\u521b\u5efajson.\u8bf7\u53c2\u9605\u4e0b\u9762\u7684\u4ee3\u7801.\n\n\n\n```python\n#! Solution 1 !!#\ndef quoteStr(input):\n return \"\\\"\" + smart_str(smart_unicode(input)) + \"\\\"\"\n\ndef createJSONTreeDump(user, node, root=False, lastChild=False):\n q = \"\\\"\"\n\n #open tag for object\n json = str(\"\\n\" + indent + \"{\" +\n quoteStr(\"name\") + \": \" + quoteStr(node.name) + \",\\n\" +\n quoteStr(\"id\") + \": \" + quoteStr(node.pk) + \",\\n\" +\n )\n\n childrenTag = \"children\"\n children = node.get_children()\n if children.count() > 0 :\n #create children array opening tag\n json += str(indent + quoteStr(childrenTag) + \": [\")\n #for child in children:\n for idx, child in enumerate(children):\n if (idx + 1) == children.count():\n //recursive call\n json += createJSONTreeDump(user, child, False, True, layout)\n else:\n //recursive call\n json += createJSONTreeDump(user, child, False, False, layout)\n #add children closing tag\n json += \"]\\n\"\n\n #closing tag for object\n if lastChild == False:\n #more children following, add \",\"\n json += indent + \"},\\n\"\n else:\n #last child, do not add \",\"\n json += indent + \"}\\n\"\n return json\n```\n\n\u8981\u5448\u73b0\u7684\u6811\u7ed3\u6784\u662f\u4e0e[mptt](javascript:void())\u5efa\u7acb\u7684\u6811,\u5176\u4e2d\u8c03\u7528.get_children()\u8fd4\u56de\u8282\u70b9\u7684\u6240\u6709\u5b50\u8282\u70b9.\n\n\u8fd9\u4e2a\u6a21\u578b\u770b\u8d77\u6765\u548c\u8fd9\u4e2a\u7b80\u5355\u4e00\u6837,mptt\u7167\u987e\u4e86\u4e00\u5207.\n\n\n\n```python\nclass Node(MPTTModel, ExtraManager):\n \"\"\"\n Representation of a single node\n \"\"\" \n name = models.CharField(max_length=200)\n parent = TreeForeignKey('self', null=True, blank=True, related_name='%(app_label)s_%(class)s_children')\n```\n\n\u9884\u671f\u7684JSON [result](javascript:void())\u5728\u6a21\u677f\u4e2d\u521b\u5efa\u4e86\u8fd9\u6837\u7684\u65b9\u6cd5var root = {{jsonTree | safe}}\n\n\u7f16\u8f91\uff1a\n\u57fa\u4e8e[this](javascript:void())\u7b54\u6848,\u6211\u521b\u5efa\u4e86\u4ee5\u4e0b\u4ee3\u7801(\u7edd\u5bf9\u662f\u66f4\u597d\u7684\u4ee3\u7801),\u4f46\u611f\u89c9\u53ea\u662f\u7a0d\u5feb\u4e00\u4e9b.\n\n\u89e3\u51b3\u65b9\u68482\uff1a\n\n\n\n```python\ndef serializable_object(node):\n \"Recurse into tree to build a serializable object\"\n obj = {'name': node.name, 'id': node.pk, 'children': []}\n for child in node.get_children():\n obj['children'].append(serializable_object(child))\n return obj\n\nimport json\njsonTree = json.dumps(serializable_object(nodeInstance))\n```\n\n\u89e3\u51b3\u65b9\u68483\uff1a\n\n\n\n```python\ndef serializable_object_List_Comprehension(node):\n \"Recurse into tree to build a serializable object\"\n obj = {\n 'name': node.name,\n 'id': node.pk,\n 'children': [serializable_object(ch) for ch in node.get_children()]\n }\n return obj\n```\n\n\u89e3\u51b3\u65b9\u68484\uff1a\n\n\n\n```python\ndef recursive_node_to_dict(node):\n result = {\n 'name': node.name, 'id': node.pk\n }\n children = [recursive_node_to_dict(c) for c in node.get_children()],\n if children is not None:\n result['children'] = children\n return result\n\nfrom mptt.templatetags.mptt_tags import cache_tree_children\nroot_nodes = cache_tree_children(root.get_descendants())\ndicts = []\nfor n in root_nodes:\n dicts.append(recursive_node_to_dict(root_nodes[0]))\n jsonTree = json.dumps(dicts, indent=4)\n```\n\n\u89e3\u51b3\u65b9\u68485(\u4f7f\u7528select_related\u5230pre_fetch,\u800c\u4e0d\u786e\u5b9a\u662f\u5426\u6b63\u786e\u4f7f\u7528)\n\n\n\n```python\ndef serializable_object_select_related(node):\n \"Recurse into tree to build a serializable object, make use of select_related\"\n obj = {'name': node.get_wbs_code(), 'wbsCode': node.get_wbs_code(), 'id': node.pk, 'level': node.level, 'position': node.position, 'children': []}\n for child in node.get_children().select_related():\n obj['children'].append(serializable_object(child))\n return obj\n```\n\n\u89e3\u51b3\u65b9\u68486(\u6539\u8fdb\u7684\u89e3\u51b3\u65b9\u68484,\u4f7f\u7528\u5b50\u8282\u70b9\u7684\u7f13\u5b58)\uff1a\n\n\n\n```python\ndef recursive_node_to_dict(node):\n result = {\n 'name': node.name, ''id': node.pk,\n #notice the use of node._cached_children instead of node.get_children()\n 'children' : [recursive_node_to_dict(c) for c in node._cached_children]\n }\n```\n\n\u901a\u8fc7\u547c\u53eb\uff1a\n\n\n\n```python\nfrom mptt.templatetags.mptt_tags import cache_tree_children\nsubTrees = cache_tree_children(root.get_descendants(include_self=True))\nsubTreeDicts = []\nfor subTree in subTrees:\n subTree = recursive_node_to_dict(subTree)\n subTreeDicts.append(subTree)\njsonTree = json.dumps(subTreeDicts, indent=4)\n#optional clean up, remove the [ ] at the beginning and the end, its needed for D3.js\njsonTree = jsonTree[1:len(jsonTree)]\njsonTree = jsonTree[:len(jsonTree)-1]\n```\n\n\u4e0b\u9762\u60a8\u53ef\u4ee5\u770b\u5230\u4f7f\u7528\u7531Mmind\u5efa\u8bae\u7684cProfile\u521b\u5efa\u7684\u5206\u6790\u7ed3\u679c,\u8bbe\u7f6e\u4e00\u4e2aDjango\u89c6\u56fe\u6765\u542f\u52a8\u72ec\u7acb\u65b9\u6cd5profileJSON(),\u540e\u8005\u53c8\u8c03\u7528\u4e0d\u540c\u7684\u89e3\u51b3\u65b9\u6848\u6765\u521b\u5efaJSON\u8f93\u51fa.\n\n\n\n```python\ndef startProfileJSON(request):\n print \"startProfileJSON\"\n import cProfile\n cProfile.runctx('profileJSON()', globals=globals(), locals=locals())\n print \"endProfileJSON\"\n```\n\n\u7ed3\u679c\uff1a\n\n\u89e3\u51b3\u65b9\u68481\uff1a3350347\u51fd\u6570\u8c03\u7528(3130372\u539f\u59cb\u8c03\u7528)\u57284.969\u79d2([details](javascript:void()))\n\n\u89e3\u51b3\u65b9\u68482\uff1a\u57283.630\u79d2([details](javascript:void()))\u4e2d\u76842533705\u529f\u80fd\u8c03\u7528(2354516\u539f\u8bed\u8c03\u7528)\n\n\u89e3\u51b3\u65b9\u68483\uff1a\u57283.684\u79d2([details](javascript:void()))\u4e2d\u76842533621\u51fd\u6570\u8c03\u7528(2354441\u539f\u59cb\u8c03\u7528)\n\n\u89e3\u51b3\u65b9\u68484\uff1a2840725\u51fd\u6570\u8c03\u7528(2466028\u539f\u59cb\u8c03\u7528)\u57283.840\u79d2([details](javascript:void()))\n\n\u89e3\u51b3\u65b9\u68485\uff1a2536504\u51fd\u6570\u8c03\u7528(2357256\u539f\u59cb\u8c03\u7528)\u57283.779\u79d2([details](javascript:void()))\n\n\u89e3\u51b3\u65b9\u68486(\u6539\u8fdb\u7684\u89e3\u51b3\u65b9\u68484)\uff1a2593122\u51fd\u6570\u8c03\u7528(2299165\u539f\u8bed\u8c03\u7528)\u57283.663\u79d2([details](javascript:void()))\n\n\u8ba8\u8bba\uff1a\n\n\u89e3\u51b3\u65b9\u68481\uff1a\u81ea\u5df1\u7f16\u7801\u5b9e\u73b0.\u998a\u4e3b\u610f\n\n\u89e3\u51b3\u65b9\u68482 3\uff1a\u76ee\u524d\u6700\u5feb,\u4f46\u4ecd\u7136\u5f88\u6162\n\n\u89e3\u51b3\u65b9\u68484\uff1a\u770b\u8d77\u6765\u5f88\u6709\u5e0c\u671b\u7f13\u5b58\u5c0f\u5b69,\u4f46\u6267\u884c\u7c7b\u4f3c,\u5e76\u4e14\u5f53\u5b69\u5b50\u88ab\u653e\u5165double []\u65f6,\u76ee\u524d\u6b63\u5728\u751f\u6210\u65e0\u6548\u7684json\uff1a\n\n\n\n```\n\"children\": [[]] instead of \"children\": []\n```\n\n\u89e3\u51b3\u65b9\u68485\uff1a\u4f7f\u7528select_related\u6ca1\u6709\u4ec0\u4e48\u533a\u522b,\u53ef\u80fd\u4ee5\u9519\u8bef\u7684\u65b9\u5f0f\u4f7f\u7528,\u56e0\u4e3a\u4e00\u4e2a\u8282\u70b9\u603b\u662f\u6709\u4e00\u4e2aForeignKey\u5230\u5b83\u7684\u7236\u9879,\u800c\u4e14\u6211\u4eec\u6b63\u5728\u4ece\u6839\u5206\u89e3\u5230\u5b50\u8282\u70b9.\n\n\u66f4\u65b0\uff1a\u89e3\u51b3\u65b9\u68486\uff1a\u4f7f\u7528\u7f13\u5b58\u5b50\u8282\u70b9,\u770b\u8d77\u6765\u50cf\u6211\u6700\u5e72\u51c0\u7684\u89e3\u51b3\u65b9\u6848.\u4f46\u662f\u53ea\u505a\u4e86\u7c7b\u4f3c\u4e8e\u89e3\u51b3\u65b9\u68482 3.\u5bf9\u6211\u6765\u8bf4\u662f\u5947\u602a\u7684.\n\n\u6709\u66f4\u591a\u7684\u60f3\u6cd5\u6765\u6539\u8fdb\u6027\u80fd\uff1f\n\n\u6211\u6000\u7591\u5230\u76ee\u524d\u4e3a\u6b62\u6700\u5927\u7684\u653e\u7f13\u662f\u8fd9\u6837\u505a\u4f1a\u5bf9\u6bcf\u4e2a\u8282\u70b9\u505a\u4e00\u4e2a\u6570\u636e\u5e93\u67e5\u8be2.\u4e0e\u6570\u636e\u5e93\u7684\u6570\u767e\u6b21\u5f80\u8fd4\u76f8\u6bd4,json\u6e32\u67d3\u662f\u5fae\u4e0d\u8db3\u9053\u7684.\n\n\n\n\u60a8\u5e94\u8be5\u7f13\u5b58\u6bcf\u4e2a\u8282\u70b9\u4e0a\u7684\u5b50\u8282\u70b9,\u4ee5\u4fbf\u8fd9\u4e9b\u67e5\u8be2\u53ef\u4ee5\u4e00\u6b21\u5b8c\u6210.\ndjango-mptt\u6709\u4e00\u4e2a[cache_tree_children()](javascript:void())\u529f\u80fd,\u4f60\u53ef\u4ee5\u505a\u5230\u8fd9\u4e00\u70b9.\n\n\n\n```python\nimport json\nfrom mptt.templatetags.mptt_tags import cache_tree_children\n\ndef recursive_node_to_dict(node):\n result = {\n 'id': node.pk,\n 'name': node.name,\n }\n children = [recursive_node_to_dict(c) for c in node.get_children()]\n if children:\n result['children'] = children\n return result\n\nroot_nodes = cache_tree_children(Node.objects.all())\ndicts = []\nfor n in root_nodes:\n dicts.append(recursive_node_to_dict(n))\n\nprint json.dumps(dicts, indent=4)\n```\n\n\u81ea\u5b9a\u4e49json\u7f16\u7801\u867d\u7136\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u53ef\u80fd\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u8f7b\u5fae\u7684\u52a0\u901f,\u4f46\u6211\u975e\u5e38\u4e0d\u9f13\u52b1,\u56e0\u4e3a\u8fd9\u5c06\u662f\u5f88\u591a\u4ee3\u7801,\u8fd9\u662f\u5f88\u5bb9\u6613\u83b7\u5f97[very wrong](javascript:void()).",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 0,
"user": 1,
"add_time": "2020-04-23T14:32:35.309Z",
"modified_time": "2020-04-23T06:32:35.310Z",
"types": [
16
]
}
},
{
"model": "articals.articale",
"pk": 144,
"fields": {
"note": 1,
"title": "users",
"text_content": "define([\"jquery\", \"underscore\", \"backbone\", \"i18n!strings/nls/users\"],\n\nfunction($, _, Backbone, locale) {\n\n var model = Backbone.Model.extend({\n\n defaults: {},\n\n validation: {\n name: {\n required: true,\n //ks_lz_20180717 \u7528\u6237\u540d ++>>\n pattern: /^[a-zA-Z][a-zA-Z0-9\\-\\_\\@]*$/,\n //ks_lz_20180717 \u7528\u6237\u540d ++>>\n maxLength: 16,\n msg: locale.invalid_username_refer_help_content\n },\n password: {\n fn: function(value, attr, computedState) {\n \tvalue = $('#idpassword').val();\n\n //sugon_Song_tapd1002126_2019-01-21\n //create user\n if($('#idchangepassword').is(':hidden') && computedState.changepassword == 0 && computedState.password_size == 'bytes_16' && ((value.length>16) || (value.length<8))) {\n return true;\n }else if($('#idchangepassword').is(':hidden') && computedState.changepassword == 0 && computedState.password_size == 'bytes_20' && ((value.length>20) || (value.length<8))) {\n return true;\n }\n\n //passwordcplexif( (computedState.changepassword == 1 && !(value.length>=8) ) || (computedState.snmp == 1 && !(value.length>=8) ) ){\n \t//if( (computedState.changepassword == 1 && !(/^[\\S]{1,}$/.test(value) ) ) || (computedState.snmp == 1 && !(/^[\\S]{8,}$/.test(value) ) ) ){\n\n \t//fanysh_jd_user_require_0509: JD only need pasword size must large than 8 byte and shorter than choose size\n //edit user change password\n \tif($('#idchangepassword').is(':visible') && computedState.changepassword == 1 && computedState.password_size == 'bytes_16' && ((value.length>16) || (value.length<8)))\n \t{\n\t\t return true;\n\t\t }\n\t\t else if($('#idchangepassword').is(':visible') && computedState.changepassword == 1 && computedState.password_size == 'bytes_20' && ((value.length>20) || (value.length<8)))\n\t\t {\n\t\t return true;\n\t\t }\n\n \t/*\n \t//\u5f00\u542fsnmp\u6743\u9650\u65f6 \u4e0d\u9a8c\u8bc1\u5bc6\u7801\u957f\u5ea6 By Chengbq 2018-07-27\n \tif( computedState.passwordcplex != 1 ){\n \t\tif(computedState.snmp == 1){\n \t\t\tif(value.length<8)\n \t\t\t\treturn true;\n \t\t\telse\n \t\t\t\treturn false;\n \t\t}\n \t\telse return false;\n \t}*/\n \tif(!value){\n return true;\n }else{\n if ($('#idpassword').attr('disabled') != 'disabled' && !!value && checkInvalidLetter(value) == true)\n {\n alert(locale.password_invaild_chars);\n return true; //returning true means password is illegal\n }\n\n if( computedState.passwordcplex == 1 && !!value && checkPassword(value)<3 ){\n alert(locale.password_no_enough_types);\n return true;\n } else {\n return false;\n }\n }\n },\n msg: locale.password_field_must_be_8_characters_atleast\n },\n confirm_password: {\n //equalTo: 'password',\n fn: function(value, attr, computedState) {\n \tvalue = $('#idconfirm_password').val();\n\n if( $('#idconfirm_password').attr('disabled') != 'disabled' && $('#idpassword').val() != value){\n return true;\n } else {\n return false;\n }\n },\n msg: locale.passwords_do_not_match\n },\n belong_group: {\n fn: function(value, attr, computedState) {\n if(computedState.belong_group == \"\"){\n return true;\n } else {\n \treturn false;\n }\n },\n msg: locale.select_group\n },\n\t expiry_date: {\n fn: function(value, attr, computedState) {\n if(computedState.turnon_password_expiry == 1 && computedState.expiry_date == \"\"){\n return true;\n } else {\n \treturn false;\n }\n },\n msg: locale.setting_password_expiry_date\n },\n email_id: {\n fn: function(value, attr, computedState) {\n if(value != \"\" && (!(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i.test(value)))){\n return true;\n } else {\n return false;\n }\n },\n msg: locale.invalid_email_format_refer_help_content\n }\n }\n });\n\n return model;\n\n});\nfunction checkPassword(password){\n var checktime=0;\n if(password.length<8)\n return 0;\n if(password.match(/[a-z]+/)){\n checktime++;\n }\n\n if(password.match(/[0-9]+/)){\n checktime++;\n }\n\n if(password.match(/[A-Z]+/)){\n checktime++;\n }\n\n if(password.match(/[^a-zA-Z0-9]+/)){\n checktime++;\n }\n\n return checktime;\n}\n\nfunction checkInvalidLetter(inputStr){\n if(inputStr.length<1)\n return true;\n\n if(inputStr.match(/[^a-zA-Z0-9~!@#$%^&*\\(\\)_+`\\-=\\{\\}\\[\\]\\|\\\\,\\.<>\\/\\?;\\'\\:\\\"]+/)){\n return true; // Illegal\n }\n\n return false; // legal\n}",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 2,
"user": 1,
"add_time": "2020-04-24T13:35:10.175Z",
"modified_time": "2020-04-24T05:37:42.867Z",
"types": []
}
},
{
"model": "articals.articale",
"pk": 145,
"fields": {
"note": 2,
"title": "linux\u67e5\u770bsvn\u7528\u6237\u540d\u548c\u5bc6\u7801",
"text_content": "# linux\u67e5\u770bsvn\u7528\u6237\u540d\u548c\u5bc6\u7801\n\n\u5728linux\u4e2d\uff0c\u6709\u65f6\u5fd8\u8bb0\u81ea\u5df1\u7684svn\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u53ef\u4ee5\u8fd9\u6837\u67e5\u770b\u3002\n\n\tcd\u00a0cd ~/.subversion/auth/svn.simple\n\n\u5728\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u53ef\u4ee5\u770b\u5230\u7c7b\u4f3ca2dc58b7668dba51b692081cc32ac86e\u7684\u6587\u4ef6\n\nvim\u6253\u5f00\u8fd9\u6837\u7684\u6587\u4ef6\u5c31\u53ef\u4ee5\u770b\u5230\u7528\u6237\u540d\u548c\u5bc6\u7801\n\n\n\u8fd9\u6837\u53ef\u4ee5\u6307\u5b9a\u7528\u6237\u540d\u548c\u5bc6\u7801\u8fdb\u884c\u4e0b\u8f7d\n\n\tsvn co \u5730\u5740 --username xxx --password xxx",
"original": true,
"orginal_link": "",
"public": true,
"browse_num": 2,
"user": 1,
"add_time": "2020-04-26T10:32:23.751Z",
"modified_time": "2020-04-26T03:03:49.509Z",
"types": []
}
},
{
"model": "articals.imagemeta",
"pk": 157,
"fields": {
"image": "uploads/image/2020-4-20/25e5733329c84202b6d7e33ddd24a9f8/\u67f1\u72b6\u56fe-\u6807\u7b7e\u65cb\u8f6c.png",
"user": 1,
"add_time": "2020-04-20T15:05:27.145Z",
"modified_time": "2020-04-20T07:05:27.151Z"
}
},
{
"model": "articals.imagemeta",
"pk": 158,
"fields": {
"image": "uploads/image/2020-4-20/b88f652487d146dd85a4fecce80f7765/history.png",
"user": 1,
"add_time": "2020-04-20T15:06:10.728Z",
"modified_time": "2020-04-20T07:06:16.280Z"
}
},
{
"model": "articals.imagemeta",
"pk": 159,
"fields": {
"image": "uploads/image/2020-4-20/9dcf96fdc398438a968097d9e5c2257e/history_1.png",
"user": 1,
"add_time": "2020-04-20T15:07:38.898Z",
"modified_time": "2020-04-20T07:07:38.906Z"
}
},
{
"model": "articals.imagemeta",
"pk": 160,
"fields": {
"image": "uploads/image/2020-4-20/243b4b9c098744dbb427c3d48aa3ca4c/\u67f1\u72b6\u56fe-\u6807\u7b7e\u65cb\u8f6c.png",
"user": 1,
"add_time": "2020-04-20T15:08:12.937Z",
"modified_time": "2020-04-20T07:08:14.401Z"
}
},
{
"model": "articals.imagemeta",
"pk": 161,
"fields": {
"image": "uploads/image/2020-4-20/7114a3cac05540bba3297caf74048973/\u4e0b\u8f09.png",
"user": 1,
"add_time": "2020-04-20T15:10:22.672Z",
"modified_time": "2020-04-20T07:10:27.028Z"
}
},
{
"model": "articals.imagemeta",
"pk": 162,
"fields": {
"image": "uploads/image/2020-4-20/de3413cdc7de4917b62edf823e19b896/history_1.png",
"user": 1,
"add_time": "2020-04-20T15:10:42.338Z",
"modified_time": "2020-04-20T07:10:44.031Z"
}
},
{
"model": "articals.imagemeta",
"pk": 163,
"fields": {
"image": "uploads/image/2020-4-20/5c42704a3b844def8f9909d79e852b8f/\u67f1\u72b6\u56fe-\u6807\u7b7e\u65cb\u8f6c.png",
"user": 1,
"add_time": "2020-04-20T15:16:50.151Z",
"modified_time": "2020-04-20T07:16:50.158Z"
}
},
{
"model": "articals.imagemeta",
"pk": 164,
"fields": {
"image": "uploads/image/2020-4-20/ce50579c61b94885a688536303723b0b/history.png",
"user": 1,
"add_time": "2020-04-20T15:20:02.053Z",
"modified_time": "2020-04-20T07:20:02.057Z"
}
},
{
"model": "articals.imagemeta",
"pk": 165,
"fields": {
"image": "uploads/image/2020-4-20/42c6d261b976431e9229a34b8af44af8/history.png",
"user": 1,
"add_time": "2020-04-20T15:49:03.950Z",
"modified_time": "2020-04-20T07:49:03.953Z"
}
},
{
"model": "articals.imagemeta",
"pk": 166,
"fields": {
"image": "uploads/image/2020-4-21/b866d0836b464b249cce0360be7a0a4c/\u67f1\u72b6\u56fe-\u6807\u7b7e\u65cb\u8f6c.png",
"user": 1,
"add_time": "2020-04-21T14:47:19.157Z",
"modified_time": "2020-04-21T06:47:19.206Z"
}
},
{
"model": "articals.imagemeta",
"pk": 167,
"fields": {
"image": "uploads/image/2020-4-21/5c9807efc57d4f0bb94c55812ecd2554/\u4e0b\u8f09.png",
"user": 1,
"add_time": "2020-04-21T14:47:26.185Z",
"modified_time": "2020-04-21T06:47:26.220Z"
}
},
{
"model": "articals.imagemeta",
"pk": 1108,
"fields": {
"image": "uploads/image/2020-4-23/a5f1191043384e739cf9272f462fe536/1557028168350.png",
"user": 1,
"add_time": "2020-04-23T10:55:18.183Z",
"modified_time": "2020-04-23T02:55:18.193Z"
}
},
{
"model": "articals.imagemeta",
"pk": 1109,
"fields": {
"image": "uploads/image/2020-4-23/35334ac0a60948978c72d3fa6a861ff6/1553043054133.png",
"user": 1,
"add_time": "2020-04-23T10:55:50.466Z",
"modified_time": "2020-04-23T02:55:50.476Z"
}
},
{
"model": "articals.imagemeta",
"pk": 1110,
"fields": {
"image": "uploads/image/2020-4-26/3358d22cbc3145c183be72071174e356/1557023744365.png",
"user": 1,
"add_time": "2020-04-26T11:03:57.255Z",
"modified_time": "2020-04-26T03:03:57.275Z"
}
},
{
"model": "articals.imagemeta",
"pk": 1111,
"fields": {
"image": "uploads/image/2020-4-26/37a67d0c90b543278b0fc2c0510fc31d/1553043054133.png",
"user": 1,
"add_time": "2020-04-26T11:04:22.807Z",
"modified_time": "2020-04-26T03:04:22.809Z"
}
}
]