result_all.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. $("table").append(
  24. "<tr><td>" +
  25. index +
  26. "</td><td>" +
  27. resp.data[index].nickName +
  28. "</td><td>" +
  29. resp.data[index].prize +
  30. "</td><td>" +
  31. resp.data[index].userName +
  32. "</td><td>" +
  33. resp.data[index].phone +
  34. "</td><td>" +
  35. formatTime(resp.data[index].indate, 'Y-M-D h:m:s') +
  36. "</td></tr>"
  37. );
  38. }
  39. }
  40. });
  41. })
  42. function formatNumber (n) {
  43. n = n.toString()
  44. return n[1] ? n : '0' + n;
  45. }
  46. function formatTime (number, format) {
  47. let time = new Date(number)
  48. let newArr = []
  49. let formatArr = ['Y', 'M', 'D', 'h', 'm', 's']
  50. newArr.push(time.getFullYear())
  51. newArr.push(formatNumber(time.getMonth() + 1))
  52. newArr.push(formatNumber(time.getDate()))
  53. newArr.push(formatNumber(time.getHours()))
  54. newArr.push(formatNumber(time.getMinutes()))
  55. newArr.push(formatNumber(time.getSeconds()))
  56. for (let i in newArr) {
  57. format = format.replace(formatArr[i], newArr[i])
  58. }
  59. return format;
  60. }
  61. </script>
  62. </head>
  63. <body style="width: 100%">
  64. <table class="table table-condensed">
  65. <tr>
  66. <th>#</th>
  67. <th>昵称</th>
  68. <th>奖品</th>
  69. <th>姓名</th>
  70. <th>电话</th>
  71. <th>时间</th>
  72. </tr>
  73. </table>
  74. </body>
  75. </html>