user_statistics.html 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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("./user/getUserOrderByCity", {}, function(resp) {
  19. if (resp.code == 'error') {
  20. console.log(resp.code);
  21. }else{
  22. for(let index in resp.data){
  23. var str = "<tr><td>" + (index + 1) + "</td><td>";
  24. if(resp.data[index].city == null || resp.data[index].city == ""){
  25. str += "未知</td><td>";
  26. }else{
  27. str += resp.data[index].city + "</td><td>";
  28. }
  29. str += resp.data[index].quantity + "</td></tr>"
  30. $("table").append(str);
  31. }
  32. }
  33. });
  34. })
  35. </script>
  36. </head>
  37. <body style="width: 100%">
  38. <table class="table table-condensed">
  39. <tr>
  40. <th>#</th>
  41. <th>地区</th>
  42. <th>人数</th>
  43. </tr>
  44. </table>
  45. </body>
  46. </html>