book.blade.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. @php
  2. $w = "width: ". (isset($width) ? $width : 2) ."rem";
  3. $w2 = "width: calc(100% - " . (isset($width) ? $width : 2) ."rem)";
  4. $h = "height: ". ((isset($width) ? $width : 2) / 3 * 4) ."rem";
  5. $link = isset($link) ? $link : ''
  6. @endphp
  7. @if (isset($multi))
  8. @empty($prevent)
  9. @if($link === '')
  10. <a href="/detail?bid={{ book_hash_encode($book['bid']) }}">
  11. @else
  12. <a href="/{{$link}}?id={{ book_hash_encode($book['bid']) }}">
  13. @endif
  14. @endempty
  15. <dl class="x-book x-book--multi {{$class or ''}}">
  16. <dt class="x-book__coverbox" style="{{$w.';'.$h}}">
  17. @if ($book->cover)
  18. <img src="{{ $book->cover }}" class="x-book__cover" style="{{$w.';'.$h}}">
  19. @else
  20. <img src="https://yueduyun.oss-cn-hangzhou.aliyuncs.com/book/cover/loading.png" class="x-book__cover" style="{{$w.';'.$h}}">
  21. @endif
  22. </dt>
  23. <dd class="x-book__text--multi" style="{{$w2.';'.$h}}">
  24. {{ $slot }}
  25. </dd>
  26. </dl>
  27. @empty($prevent)
  28. </a>
  29. @endempty
  30. @else
  31. @empty($prevent)
  32. @if($link === '')
  33. <a href="/detail?bid={{ book_hash_encode($book['bid'])}}">
  34. @else
  35. <a href="/{{$link}}?id={{$book[0]['book_id']}}">
  36. @endif
  37. @endempty
  38. <dl class="x-book {{$class or ''}}" style="{{$w}}">
  39. <dt class="x-book__coverbox">
  40. @if ($book['cover'])
  41. <img src="{{ $book['cover'] }}" class="x-book__cover" style="{{$w.';'.$h}}">
  42. @else
  43. <img src="https://yueduyun.oss-cn-hangzhou.aliyuncs.com/book/cover/loading.png" class="x-book__cover" style="{{$w.';'.$h}}">
  44. @endif
  45. @isset($shadow)
  46. {{ $shadow }}
  47. @endisset
  48. </dt>
  49. <dd class="x-book__text--normal">{{ $book['book_name'] }}</dd>
  50. </dl>
  51. @empty($prevent)
  52. </a>
  53. @endempty
  54. @endif