result.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. var id = localStorage.getItem("userId");
  19. if(id != null){
  20. $.post("./prize/getluckDrawByUserId", {
  21. UserId: id
  22. }, function(resp) {
  23. if (resp.code == 'error') {
  24. console.log(resp.code);
  25. }else{
  26. if(resp.data.length != 0){
  27. for(let index in resp.data){
  28. $("table").append("<tr><td>" + resp.data[index].nickName + "</td><td>" + resp.data[index].prize + "</td></tr>");
  29. }
  30. }else{
  31. $("body").append("<p style='text-align: center'>没有中奖信息</p>");
  32. }
  33. }
  34. });
  35. }else{
  36. $("body").append("<p style='text-align: center'>没有中奖信息!</p>");
  37. }
  38. })
  39. </script>
  40. </head>
  41. <body style="width: 100%">
  42. <table class="table table-condensed">
  43. <tr>
  44. <th>昵称</th>
  45. <th>奖品</th>
  46. </tr>
  47. </table>
  48. </body>
  49. </html>