dispatch_jump.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. {php}
  2. if($wait<=0){
  3. //不显示倒计时
  4. $response = new think\response\Redirect($url);
  5. $response->code($code);
  6. throw new think\exception\HttpResponseException($response);
  7. }
  8. {/php}
  9. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  10. <html xmlns="http://www.w3.org/1999/xhtml">
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  13. <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
  14. <title>跳转提示</title>
  15. <style type="text/css">
  16. *{ padding: 0; margin: 0; }
  17. body{ background: #fff; font-family: "Microsoft Yahei","Helvetica Neue",Helvetica,Arial,sans-serif; color: #333; font-size: 16px; }
  18. .system-message{ padding: 24px 48px; }
  19. .system-message h1{ font-size: 100px; font-weight: normal; line-height: 120px; margin-bottom: 12px; }
  20. .system-message .jump{ padding-top: 10px; }
  21. .system-message .jump a{ color: #333; }
  22. .system-message .success,.system-message .error{ line-height: 1.8em; font-size: 36px; }
  23. .system-message .detail{ font-size: 12px; line-height: 20px; margin-top: 12px; display: none; }
  24. </style>
  25. </head>
  26. <body>
  27. <div class="system-message">
  28. <?php switch ($code) {?>
  29. <?php case 1:?>
  30. <h1>☺</h1>
  31. <p class="success"> <?php echo(strip_tags($msg));?></p>
  32. <?php break;?>
  33. <?php case 0:?>
  34. <h1>☹</h1>
  35. <p class="error"> <?php echo(strip_tags($msg));?></p>
  36. <?php break;?>
  37. <?php } ?>
  38. <p class="detail"></p>
  39. <p class="jump">
  40. 页面自动 <a id="href" href="<?php echo($url);?>">跳转</a> 等待时间: <b id="wait"><?php echo($wait);?></b>
  41. </p>
  42. </div>
  43. <script type="text/javascript">
  44. (function(){
  45. var wait = document.getElementById('wait'),
  46. href = document.getElementById('href').href;
  47. var interval = setInterval(function(){
  48. var time = --wait.innerHTML;
  49. if(time <= 0) {
  50. location.href = href;
  51. clearInterval(interval);
  52. };
  53. }, 1000);
  54. })();
  55. </script>
  56. </body>
  57. </html>