30
30
<h1 class =" generator-title" >挪车码生成器</h1 >
31
31
<div class =" input-group" >
32
32
<label for =" phoneNumber" >手机号码</label >
33
- <input type =" tel" id =" phoneNumber" placeholder =" 请输入手机号码" />
33
+ <input type =" tel" id =" phoneNumber" placeholder =" 请输入手机号码" value =" 18600000000" />
34
+ <div class =" privacy-notice" >
35
+ <i class =" fas fa-info-circle" ></i > 您的手机号码将被用于生成挪车码,扫码者可以通过此号码联系您。
36
+ </div >
34
37
</div >
35
38
<div class =" input-group" >
36
39
<label for =" title" >标题</label >
37
- <input type =" text" id =" title" placeholder =" 请输入标题" value =" 请输入标题 " />
40
+ <input type =" text" id =" title" placeholder =" 请输入标题" value =" 扫码挪车 " />
38
41
</div >
39
42
<div class =" input-group" >
40
43
<div class =" checkbox-container" >
41
44
<input type =" checkbox" id =" enableSubtitle" />
42
45
<label for =" enableSubtitle" >添加副标题</label >
43
46
</div >
44
- <input type =" text" id =" subtitle" placeholder =" 请输入副标题" disabled />
47
+ <input type =" text" id =" subtitle" placeholder =" 请输入副标题" value =" 扫码联系车主或拨打电话: 18600000000" disabled />
48
+ </div >
49
+
50
+ <div class =" privacy-consent" >
51
+ <div class =" checkbox-container" >
52
+ <input type =" checkbox" id =" privacyConsent" />
53
+ <label for =" privacyConsent" >我已了解并同意:我的手机号码将被收集并用于生成挪车码,扫码者可以通过此号码联系我。</label >
54
+ </div >
45
55
</div >
56
+
46
57
<div class =" button-group" >
47
58
<button class =" primary-button" onclick =" generateQrCode()" >
48
59
<i class =" fas fa-qrcode" ></i > 生成二维码
69
80
<div class =" card" >
70
81
<div class =" card-header" >
71
82
<i class =" fas fa-car" ></i >
72
- <h1 class =" title" >临时停车,请挪车 </h1 >
83
+ <h1 class =" title" >临时停靠,请多关照 </h1 >
73
84
</div >
74
85
<div class =" card-body" >
75
- <p class =" description" >您的爱车临时停放在这里,请您挪车 。</p >
86
+ <p class =" description" >如果我的车阻碍了您的车辆通行,点击下方按钮通知我,给您带来不便敬请谅解 。</p >
76
87
<a class =" phone-button" href =" tel:@_decodePhone" >
77
88
<i class =" fas fa-phone-alt" ></i > 联系车主
78
89
</a >
322
333
background-color : #f5f5f5 ;
323
334
color : #999 ;
324
335
}
336
+
337
+ /* 隐私提示样式 */
338
+ .privacy-notice {
339
+ font-size : 0.85rem ;
340
+ color : #666 ;
341
+ margin-top : 5px ;
342
+ text-align : left ;
343
+ display : flex ;
344
+ align-items : center ;
345
+ }
346
+
347
+ .privacy-notice i {
348
+ margin-right : 5px ;
349
+ color : #3385ff ;
350
+ }
351
+
352
+ .privacy-consent {
353
+ margin : 15px 0 ;
354
+ padding : 10px ;
355
+ background-color : #f8f9fa ;
356
+ border-radius : 8px ;
357
+ border-left : 3px solid #3385ff ;
358
+ }
359
+
360
+ .privacy-consent label {
361
+ font-size : 0.9rem ;
362
+ color : #555 ;
363
+ line-height : 1.4 ;
364
+ }
365
+
366
+ .privacy-error {
367
+ color : #dc3545 ;
368
+ font-size : 0.9rem ;
369
+ margin-top : 5px ;
370
+ display : none ;
371
+ }
325
372
</style >
326
373
327
374
<script >
328
375
async function generateQrCode () {
329
376
const title = document .getElementById (' title' ).value ;
330
377
const phoneNumber = document .getElementById (' phoneNumber' ).value ;
331
378
const enableSubtitle = document .getElementById (' enableSubtitle' ).checked ;
379
+ const privacyConsent = document .getElementById (' privacyConsent' ).checked ;
332
380
let subtitle = null ;
333
381
334
382
if (enableSubtitle) {
335
383
subtitle = document .getElementById (' subtitle' ).value .trim ();
336
384
if (! subtitle) {
337
- subtitle = ` 扫码联系车主 : ${ phoneNumber || " 16800000000 " } ` ;
385
+ subtitle = ` 扫码联系车主或拨打电话 : ${ phoneNumber || " 18600000000 " } ` ;
338
386
document .getElementById (' subtitle' ).value = subtitle;
339
387
}
340
388
}
344
392
return ;
345
393
}
346
394
395
+ if (! privacyConsent) {
396
+ alert (' 请确认您已了解并同意隐私声明' );
397
+ return ;
398
+ }
399
+
347
400
try {
348
401
const response = await fetch (' /api/Image/nuoche' , {
349
402
method: ' POST' ,
385
438
}
386
439
}
387
440
388
- // 副标题选择
441
+ // 添加小标题复选框的事件处理
389
442
document .addEventListener (' DOMContentLoaded' , function () {
390
443
const enableSubtitleCheckbox = document .getElementById (' enableSubtitle' );
391
444
const subtitleInput = document .getElementById (' subtitle' );
392
445
const phoneInput = document .getElementById (' phoneNumber' );
446
+ const privacyConsentCheckbox = document .getElementById (' privacyConsent' );
447
+ const privacyConsentSection = document .querySelector (' .privacy-consent' );
448
+
449
+ if (privacyConsentCheckbox && privacyConsentSection) {
450
+ privacyConsentCheckbox .addEventListener (' change' , function () {
451
+ if (this .checked ) {
452
+ privacyConsentSection .style .backgroundColor = ' #e8f4ff' ;
453
+ privacyConsentSection .style .borderLeftColor = ' #007bff' ;
454
+ } else {
455
+ privacyConsentSection .style .backgroundColor = ' #f8f9fa' ;
456
+ privacyConsentSection .style .borderLeftColor = ' #3385ff' ;
457
+ }
458
+ });
459
+ }
393
460
394
461
if (enableSubtitleCheckbox && subtitleInput) {
395
462
enableSubtitleCheckbox .addEventListener (' change' , function () {
396
463
subtitleInput .disabled = ! this .checked ;
397
464
if (this .checked ) {
398
465
if (! subtitleInput .value .trim ()) {
399
- const phoneNumber = phoneInput .value .trim () || " 16800000000 " ;
400
- subtitleInput .value = ` 扫码联系车主 : ${ phoneNumber} ` ;
466
+ const phoneNumber = phoneInput .value .trim () || " 18600000000 " ;
467
+ subtitleInput .value = ` 扫码联系车主或拨打电话 : ${ phoneNumber} ` ;
401
468
}
402
469
subtitleInput .focus ();
403
470
}
404
471
});
405
472
406
- // 手机号码变化时,更新副标题
473
+ // 当手机号码变化时,如果小标题已启用且使用的是默认格式,则更新小标题中的电话号码
407
474
phoneInput .addEventListener (' input' , function () {
408
- if (enableSubtitleCheckbox .checked && subtitleInput .value .startsWith (' 扫码联系车主 :' )) {
409
- const phoneNumber = this .value .trim () || " 16800000000 " ;
410
- subtitleInput .value = ` 扫码联系车主 : ${ phoneNumber} ` ;
475
+ if (enableSubtitleCheckbox .checked && subtitleInput .value .startsWith (' 扫码联系车主或拨打电话 :' )) {
476
+ const phoneNumber = this .value .trim () || " 18600000000 " ;
477
+ subtitleInput .value = ` 扫码联系车主或拨打电话 : ${ phoneNumber} ` ;
411
478
}
412
479
});
413
480
}
414
481
});
415
- </script >
482
+ </script >
0 commit comments