result_all.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <!DOCTYPE html>
  2. <html lang="en" style="width: 100%">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>抽奖结果</title>
  8. <style type="text/css">
  9. *{
  10. margin: 0;
  11. padding: 0;
  12. }
  13. </style>
  14. <script src="js/jquery.min.js"></script>
  15. <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
  16. <script type="text/javascript">
  17. $(function(){
  18. $.post("./prize/luckDrawListBack", {}, function(resp) {
  19. if (resp.code == 'error') {
  20. console.log(resp.code);
  21. }else{
  22. for(let index in resp.data){
  23. var sequence = parseInt(index) + 1;
  24. $("table").append(
  25. "<tr><td>" +
  26. sequence +
  27. "</td><td>" +
  28. resp.data[index].nickName +
  29. "</td><td>" +
  30. resp.data[index].prize +
  31. "</td><td>" +
  32. resp.data[index].userName +
  33. "</td><td>" +
  34. resp.data[index].phone +
  35. "</td><td>" +
  36. formatTime(resp.data[index].indate, 'Y-M-D h:m:s') +
  37. "</td></tr>"
  38. );
  39. }
  40. }
  41. });
  42. })
  43. function formatNumber (n) {
  44. n = n.toString()
  45. return n[1] ? n : '0' + n;
  46. }
  47. function formatTime (number, format) {
  48. let time = new Date(number)
  49. let newArr = []
  50. let formatArr = ['Y', 'M', 'D', 'h', 'm', 's']
  51. newArr.push(time.getFullYear())
  52. newArr.push(formatNumber(time.getMonth() + 1))
  53. newArr.push(formatNumber(time.getDate()))
  54. newArr.push(formatNumber(time.getHours()))
  55. newArr.push(formatNumber(time.getMinutes()))
  56. newArr.push(formatNumber(time.getSeconds()))
  57. for (let i in newArr) {
  58. format = format.replace(formatArr[i], newArr[i])
  59. }
  60. return format;
  61. }
  62. </script>
  63. </head>
  64. <body style="width: 100%">
  65. <table class="table table-condensed">
  66. <tr>
  67. <th>#</th>
  68. <th>昵称</th>
  69. <th>奖品</th>
  70. <th>姓名</th>
  71. <th>电话</th>
  72. <th>时间</th>
  73. </tr>
  74. </table>
  75. </body>
  76. </html>