timeline.blade.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <style>
  2. .tpl-box {
  3. display: none;
  4. }
  5. .timeline-box .timeline {
  6. }
  7. .timeline-box .timeline > div > .timeline-item {
  8. box-shadow: 0 0 1px rgba(0, 0, 0, .125), 0 1px 3px rgba(0, 0, 0, .2);
  9. }
  10. .timeline-box ul {
  11. padding-left: 20px;
  12. }
  13. .timeline-box li {
  14. list-style-type: disc;
  15. }
  16. .timeline-box .time-label {
  17. margin-bottom: 15px;
  18. margin-right: 10px;
  19. position: relative;
  20. }
  21. </style>
  22. {{--<div class="ppp">
  23. <h3>这是alpine 示例</h3>
  24. <div x-data="{ posts: [{id:1,title:'1111',content:'2222',},{id:2,title:'3333',content:'4444'}] }" x-init="fetchPosts()">
  25. <template x-for="post in posts" :key="post.id">
  26. <div>
  27. <h2 x-text="post.title"></h2>
  28. <p x-text="post.content"></p>
  29. </div>
  30. </template>
  31. <script>
  32. function fetchPosts() {
  33. fetch('https://demo.saishiyun.net/api/dcatplus/packageUplogs')
  34. .then(response => response.json())
  35. .then(data => {
  36. console.log('这是packageUplogs');
  37. console.log(data);
  38. console.log('这是一个说明');
  39. posts = data.data;
  40. });
  41. }
  42. </script>
  43. </div>
  44. </div>--}}
  45. <div class="timeline-box" id="{{$id}}">
  46. <div class="box-loading sp sp-circle"></div>
  47. </div>
  48. <div class="tpl-box" id="timeline-box-tpl">
  49. <div class="timeline">
  50. <div v-for="(item, index) in items">
  51. <div class="time-label">
  52. <span class="bg-green">2024-07-10</span>
  53. </div>
  54. <div>
  55. <i class="fa fa-bullseye bg-green"></i>
  56. <div class="timeline-item">
  57. <span class="time"><i class="fas fa-clock"></i>09:12</span>
  58. <h3 class="timeline-header">这是一个标题</h3>
  59. <div class="timeline-body">
  60. 这是一个内容
  61. </div>
  62. </div>
  63. </div>
  64. <div>
  65. <div>
  66. <i class="fa fa-clock-o"></i>
  67. </div>
  68. </div>
  69. </div>
  70. {{--<div class="timeline-box" id="#{{$id}}">
  71. <div class="box-loading sp sp-circle"></div>
  72. <div class="timeline">
  73. <div v-if="load_status">
  74. <div v-for="(item, index) in items">
  75. <div v-if="item.time_label">
  76. <div class="time-label">
  77. <span class="bg-green"> @{{ item.time_label }}</span>
  78. </div>
  79. </div>
  80. <div>
  81. <i class="fa fa-bullseye bg-green"></i>
  82. <div class="timeline-item">
  83. <span class="time"><i class="fas fa-clock"></i>@{{ item.time }}</span>
  84. <h3 class="timeline-header">@{{ item.title }}</h3>
  85. <div class="timeline-body">
  86. <div v-html="item.content"></div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <div>
  92. <i class="fa fa-clock-o"></i>
  93. </div>
  94. </div>
  95. </div>
  96. </div>--}}
  97. <script>
  98. new Vue({
  99. el: `#{{$id}}`,
  100. data: {
  101. load_status:false,
  102. items: []
  103. },
  104. created:function(){
  105. let that = this;
  106. $.ajax({
  107. url: '{!! $ajax_url !!}',
  108. type: '{{$ajax_method}}', // 设置请求方法为POST
  109. headers:{!! $ajax_headers !!},
  110. data:{!! $ajax_data !!},
  111. }).then(function(resp) {
  112. console.log(resp);
  113. if (resp.code == 200) {
  114. that.items = resp.data;
  115. //that.load_status = true; // 设置load_status为true
  116. }
  117. });
  118. },
  119. mounted: function() {
  120. // 在Vue实例渲染完成后执行的操作
  121. $('#{{$id}}').html($('#timeline-box-tpl').html());
  122. //document.querySelector(`#${{{$id}}}`).querySelector('.box-loading').style.display = 'none'; // 隐藏box-loading
  123. }
  124. });
  125. </script>