gallery-detail.blade.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  7. <title>相册</title>
  8. <link rel="shortcut icon" href="/static//static/images/favicon.ico" type="image/x-icon">
  9. <link rel="icon" href="/static//static/images/favicon.ico" type="image/x-icon">
  10. <link rel="stylesheet" href="/static/css/swiper-bundle.min.css">
  11. <link rel="stylesheet" href="/static/css/font-awesome.min.css">
  12. <link rel="stylesheet" href="/static/css/magnific-popup.min.css">
  13. <link rel="stylesheet" href="/static/css/animate.min.css">
  14. <link rel="stylesheet" href="/static/js/layui/css/layui.css">
  15. <link rel="stylesheet" href="/static/css/main.css?v=2025041601">
  16. </head>
  17. <style>
  18. .video-hover-container {
  19. position: relative;
  20. display: inline-block;
  21. }
  22. .video-hover-container img,
  23. .video-hover-container video {
  24. display: block;
  25. object-fit: cover;
  26. }
  27. .video-hover-container a {
  28. display: block;
  29. position: relative;
  30. }
  31. /* Spinner styles */
  32. .spinner {
  33. width: 40px;
  34. height: 40px;
  35. border: 4px solid #fff;
  36. border-top: 4px solid transparent;
  37. border-radius: 50%;
  38. animation: spin 1s linear infinite;
  39. }
  40. @keyframes spin {
  41. 0% { transform: rotate(0deg); }
  42. 100% { transform: rotate(360deg); }
  43. }
  44. </style>
  45. <body class="main-body">
  46. <div class="menu-overlay"></div>
  47. <main class="main">
  48. <section class="gallery">
  49. {{-- @include('__sidebar', ['foldersTree'=> $foldersTree,'active'=>true])--}}
  50. <div class="update-content">
  51. <div class="update-log" >
  52. <a href="/update-log" class="update-log-link">
  53. <div class="timestamp"><i class="fa fa-volume-up"></i> <span class="update-time">&nbsp;</span> <span class="user_name">&nbsp;</span> <span class="action">&nbsp;</span> <span class="model">&nbsp;</span> <span class="highlight log-content">&nbsp;</span></div>
  54. </a>
  55. {{-- <a href="javascript:void(0)" onclick="logout()" class="login-out-link">--}}
  56. {{-- 退出登录--}}
  57. {{-- </a>--}}
  58. <div class="clear"></div>
  59. </div>
  60. </div>
  61. <div class="content-page gallery-content gallery-wrap">
  62. <div class="content-inner">
  63. <div class="title-wrapper" style="margin-left: 0">
  64. <h2 class="title">{{$album['model']}}</h2>
  65. <div class="subtitle">
  66. <p></p>
  67. </div>
  68. </div>
  69. <div class="album-tab">
  70. @foreach($showTabs as $tab)
  71. <a href="#album-{{$tab['column']}}" @if($loop->first)class="is-active"@endif column={{$tab['column']}}>{{$tab['title']}}</a>
  72. @endforeach
  73. </div>
  74. <!-- Album Animals START -->
  75. <div class="gallery-album-line">
  76. <a href="javascript:history.back();" class="gallery-album-prev"><i class="fa fa-angle-double-left"></i> 返回 </a>
  77. <a href="javascript:void(0);" class="download-all">下载全部 <i class="fa fa-download"></i></a>
  78. </div>
  79. @foreach($showTabs as $tab)
  80. <div class="grid-album @if($loop->first)gallery-album is-active @endif" id="album-{{$tab['column']}}">
  81. @php
  82. $content = json_decode($album[$tab['column']], true);
  83. @endphp
  84. @if (empty($content))
  85. 数据为空
  86. @endif
  87. @if ($tab['column'] == 'video' || $tab['column'] == 'pdf')
  88. @if ($tab['column'] == 'video' && empty($content) == false)
  89. <?php
  90. //$content倒序
  91. array_walk($content, function(&$item, $index) {
  92. $item['__index'] = $index;
  93. });
  94. usort($content, function($a, $b) {
  95. // order > 0 的元素组内排序(倒序)
  96. if ($a['order'] > 0 && $b['order'] > 0) {
  97. return $b['order'] <=> $a['order'];
  98. }
  99. // order = 0 的元素组内排序(按原始索引倒序)
  100. elseif ($a['order'] == 0 && $b['order'] == 0) {
  101. return $b['__index'] <=> $a['__index']; // 注意这里用b比a
  102. }
  103. // 不同组间的排序(order>0的总是排在最前)
  104. else {
  105. return ($a['order'] > 0) ? -1 : 1;
  106. }
  107. });
  108. ?>
  109. <table class="album_table">
  110. <thead>
  111. <tr>
  112. <th>图片</th>
  113. <th>中文标题</th>
  114. <th>英文标题</th>
  115. <th>操作</th>
  116. </tr>
  117. </thead>
  118. <tbody>
  119. @foreach($content as $item)
  120. <tr>
  121. <td class="video-hover-container">
  122. <a href="javascript:void(0)" style="display: inline-block;">
  123. <img src="{{ossUrl($item['cover'])}}?x-oss-process=image/resize,w_260" class="void-img" data-index="{{$loop->index}}" data-preview="{{ossUrl($item['preview_url'])}}" data-poster="{{ossUrl($item['cover'])}}?x-oss-process=image/resize,w_260">
  124. </a>
  125. </td>
  126. <td>
  127. {{@$item['video_title']}}
  128. </td>
  129. <td>
  130. {{@$item['video_en_title']}}
  131. </td>
  132. <td>
  133. <button data-src="{{ossUrl($item['video_src'])}}" class="video-btn">播放</button>
  134. <a href="/download?url={{urlencode(ossUrl($item['video_src']))}}" download class="download-btn" target="_blank"><button>下载</button></a>
  135. </td>
  136. </tr>
  137. @endforeach
  138. </tbody>
  139. </table>
  140. <br/>
  141. @endif
  142. @if ($tab['column'] == 'pdf' && empty($content) == false)
  143. <table class="album_table">
  144. <thead>
  145. <tr>
  146. <th>PDF标题</th>
  147. <th>PDF标题(英文)</th>
  148. <th width="15%">操作</th>
  149. </tr>
  150. </thead>
  151. <tbody>
  152. @foreach($content as $item)
  153. <tr>
  154. <td>{{$item['pdf_title']}}</td>
  155. <td>{{@$item['pdf_title_en']}}</td>
  156. <td>
  157. <a href="/download?url={{urlencode(ossUrl($item['pdf_src']))}}" download class="download-btn" target="_blank"><button>下载</button></a>
  158. </td>
  159. </tr>
  160. @endforeach
  161. </tbody>
  162. </table>
  163. <br/>
  164. @endif
  165. @elseif ($tab['column'] == 'parameters' && empty($content) == false)
  166. <table class="album_table">
  167. <thead>
  168. <tr>
  169. <th>属性名</th>
  170. <th>属性值</th>
  171. </tr>
  172. </thead>
  173. <tbody>
  174. @foreach($content as $item)
  175. <tr>
  176. <td>{{$item['key']}}</td>
  177. <td>
  178. {{$item['value']}}
  179. </td>
  180. </tr>
  181. @endforeach
  182. </tbody>
  183. </table>
  184. @else
  185. <div class="grid-sizer"></div>
  186. @foreach($content as $item)
  187. <div class="grid-item album-item">
  188. <div class="album-thumb album-thumb-detail">
  189. <img data-src="{{ossUrl($item)}}" src="{{ossUrl($item)}}?x-oss-process=image/resize,w_380" loading="lazy" alt="1">
  190. <div class="album-mask">
  191. <!-- 下载图标 -->
  192. <a href="javascript:void(0)" data-src="{{ossUrl($item)}}" download class="download-icon">
  193. <i class="fa fa-cloud-download"></i>
  194. </a>
  195. </div>
  196. </div>
  197. </div>
  198. @endforeach
  199. @endif
  200. </div>
  201. @endforeach
  202. <!-- Album Animals END -->
  203. </div><!-- end container-inner -->
  204. </div>
  205. <!-- 视频遮罩层 -->
  206. <div id="overlay" class="overlay">
  207. <div class="video-container">
  208. <video id="videoPlayer" controls>
  209. Your browser does not support the video tag.
  210. </video>
  211. </div>
  212. </div>
  213. </section> <!-- end gallery -->
  214. </main>
  215. {{--<footer class="site-footer">--}}
  216. {{-- <div class="footer-copyright">--}}
  217. {{-- © 2025 <strong>mietub</strong>. All rights reserved.--}}
  218. {{-- </div>--}}
  219. {{--</footer>--}}
  220. <script src="/static/js/jquery-3.7.0.min.js"></script>
  221. <script src="/static/js/swiper-bundle.min.js"></script>
  222. <script src="/static/js/wow.min.js"></script>
  223. <script src="/static/js/masonry.pkgd.min.js"></script>
  224. <script src="/static/js/imagesloaded.pkgd.min.js"></script>
  225. <script src="/static/js/magnific-popup.min.js"></script>
  226. <script src="/static/js/blazy.min.js"></script>
  227. <script src="/static/js/parazoom.min.js"></script>
  228. <script src="/static/js/layui/layui.js"></script>
  229. <script src="/static/js/script.js"></script>
  230. <script>
  231. $(document).ready(function() {
  232. $('.grid-album:first').addClass('');
  233. });
  234. // 视频预览播放
  235. $(document).ready(function() {
  236. function isMobile() {
  237. return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
  238. }
  239. $('.video-hover-container').each(function() {
  240. var $container = $(this);
  241. var $img = $container.find('img');
  242. $img.data('original-src', $img.attr('src'));
  243. });
  244. // Object to track load status using data-index as key
  245. var loadIndexes = {};
  246. var loadingVar = {};
  247. $('.video-hover-container').on('mouseenter', function(e) {
  248. if (isMobile()) {
  249. return;
  250. }
  251. e.preventDefault(); // Prevent link default behavior during hover
  252. var $container = $(this);
  253. var $img = $container.find('img');
  254. var $link = $container.find('a');
  255. var videoUrl = $img.data('preview');
  256. var posterUrl = $img.data('poster');
  257. var index = $img.data('index'); // Get the data-index value
  258. // Initialize loadIndexes[index] if not set
  259. if (!loadIndexes.hasOwnProperty(index)) {
  260. loadIndexes[index] = 0;
  261. }
  262. // Create loading overlay
  263. loadingVar[index] = $('<div>', {
  264. class: 'loading-overlay',
  265. css: {
  266. position: 'absolute',
  267. top: 0,
  268. left: 0,
  269. width: '100%',
  270. height: '100%',
  271. background: 'rgba(0,0,0,0.5)',
  272. display: 'flex',
  273. alignItems: 'center',
  274. justifyContent: 'center',
  275. zIndex: 10
  276. }
  277. }).append('<div class="spinner"></div>');
  278. // Create video element
  279. var $video = $('<video>', {
  280. src: videoUrl,
  281. poster: posterUrl,
  282. autoplay: true,
  283. muted: true,
  284. loop: true,
  285. css: {
  286. width: $img.width(),
  287. height: $img.height(),
  288. display: 'none' // Initially hidden until loaded
  289. }
  290. });
  291. if (loadIndexes[index] === 0 && videoUrl != "") {
  292. loadIndexes[index] = 1;
  293. $container.css('position', 'relative');
  294. $link.append(loadingVar[index]);
  295. }
  296. // When video can play
  297. $video.on('canplay', function() {
  298. if (loadIndexes[index] === 1) {
  299. loadIndexes[index] = 2;
  300. loadingVar[index].remove();
  301. $img.hide();
  302. $video.show();
  303. $link.append($video);
  304. }
  305. });
  306. // Maintain link functionality
  307. $link.on('click', function(e) {
  308. if ($video.is(':visible')) {
  309. e.preventDefault(); // Prevent click when video is showing
  310. }
  311. });
  312. });
  313. $('.video-hover-container').on('mouseleave', function() {
  314. var $container = $(this);
  315. var $img = $container.find('img');
  316. var index = $img.data('index'); // Get the data-index value
  317. if (loadIndexes[index] === 2 || loadIndexes[index] === 1) {
  318. loadIndexes[index] = 0;
  319. var $video = $container.find('video');
  320. var $loading = $container.find('.loading-overlay');
  321. $video.remove();
  322. $loading.remove();
  323. $img.show();
  324. }
  325. });
  326. });
  327. </script>
  328. </body>
  329. </html>