location_list.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>location_list</title>
  6. <script src="js/axios.min.js"></script>
  7. <script src="js/vue.min.js"></script>
  8. </head>
  9. <body>
  10. <table>
  11. <thead>
  12. <tr>
  13. <td>事件</td>
  14. <td>地点</td>
  15. <td>信息</td>
  16. </tr>
  17. </thead>
  18. <tbody id="tby">
  19. <tr v-for="(item,index) in list">
  20. <td>{{new Date(item.create_time).format("yyyy-MM-dd hh:mm:ss")}}</td>
  21. <td>{{item.location_xy}}--{{item.location_str}}</td>
  22. <td>{{item.msg}}</td>
  23. </tr>
  24. </tbody>
  25. </table>
  26. <script>
  27. Date.prototype.format = function (fmt) {
  28. var o = {
  29. "M+": this.getMonth() + 1, //月份
  30. "d+": this.getDate(), //日
  31. "h+": this.getHours(), //小时
  32. "m+": this.getMinutes(), //分
  33. "s+": this.getSeconds(), //秒
  34. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  35. "S": this.getMilliseconds() //毫秒
  36. };
  37. if (/(y+)/.test(fmt)) {
  38. fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  39. }
  40. for (var k in o) {
  41. if (new RegExp("(" + k + ")").test(fmt)) {
  42. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  43. }
  44. }
  45. return fmt;
  46. }
  47. new Vue({
  48. el: '#tby',
  49. data: {
  50. list: []
  51. },
  52. mounted: function () {
  53. let _this = this;
  54. axios.get("https://api.tianyunperfect.cn/web_history/location_history").then(res => {
  55. if (res.data.code === 1) {
  56. _this.list = res.data.data;
  57. }
  58. });
  59. },
  60. });
  61. function sendMsg() {
  62. }
  63. </script>
  64. </body>
  65. </html>