MediaPreview.razor 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. @using AI.Platform.Page.Pages.Media.Model
  2. @using System.Threading.Tasks
  3. @using System.Text.Json
  4. @if (IsVisible)
  5. {
  6. <div class="modal-overlay">
  7. <div class="modal-content filter_box">
  8. <div class="screen_box">
  9. @if(Media.Type == MediaType.VIDEO)
  10. {
  11. <video class="video_box" src="@(Utils.ToWebPath(Media.Path))" autoplay></video>
  12. } else
  13. {
  14. <div class="video_tip">视频区</div>
  15. }
  16. @if (Media.Type == MediaType.IMAGE)
  17. {
  18. <img class="image_box" src="@(Utils.ToWebPath(Media.Path))" />
  19. }
  20. else
  21. {
  22. <div class="image_tip">图片区</div>
  23. }
  24. <div class="nozzle_box">
  25. <img src="@(Utils.ToWebPath("wwwroot\\images\\backgroud\\nozzle.png"))" />
  26. </div>
  27. </div>
  28. <div class="filter_row" style="justify-content:end;margin-top:5%;">
  29. <Button Icon="plus" OnClick="onSure" Style="margin-right:2%">确定</Button>
  30. <Button Icon="reload" OnClick="Close" Style="margin-right:2%">取消</Button>
  31. </div>
  32. </div>
  33. </div>
  34. }
  35. <style>
  36. /* 遮罩层:全屏、半透明 */
  37. .modal-overlay {
  38. position: fixed;
  39. top: 0;
  40. left: 0;
  41. width: 100vw;
  42. height: 100vh;
  43. background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色遮罩 */
  44. display: flex;
  45. justify-content: center;
  46. align-items: center;
  47. z-index: 1000;
  48. }
  49. /* 弹窗内容:白色卡片,居中由父容器控制 */
  50. .modal-content {
  51. background: white;
  52. border-radius: 8px;
  53. width: 80%;
  54. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  55. /* 注意:不要设 height: 100vh,否则会拉满全屏 */
  56. }
  57. .filter_box {
  58. display: flex;
  59. flex-direction: column;
  60. align-items: center;
  61. background: #ffffff;
  62. padding: 2%;
  63. }
  64. .filter_row {
  65. display: flex;
  66. flex-direction: row;
  67. justify-content: space-between;
  68. align-items: center;
  69. width: 100%;
  70. margin-top: 2%;
  71. }
  72. .screen_box{
  73. width:30%;
  74. height:80vh;
  75. background: #2e2e2e;
  76. display:flex;
  77. flex-direction:column;
  78. align-items:center;
  79. }
  80. .video_box{
  81. width:90%;
  82. height:30%;
  83. display:flex;
  84. justify-content:center;
  85. align-items:center;
  86. margin-top:1%;
  87. }
  88. .video_tip{
  89. width: 90%;
  90. height: 30%;
  91. display: flex;
  92. justify-content: center;
  93. align-items: center;
  94. margin-top: 1%;
  95. border: solid 1px #FFFFFF;
  96. color: #FFFFFF;
  97. }
  98. .image_box{
  99. width: 90%;
  100. height: 30%;
  101. display: flex;
  102. justify-content: center;
  103. align-items: center;
  104. margin-top: 1%;
  105. }
  106. .image_tip {
  107. width: 90%;
  108. height: 30%;
  109. display: flex;
  110. justify-content: center;
  111. align-items: center;
  112. margin-top: 1%;
  113. border: solid 1px #FFFFFF;
  114. color: #FFFFFF;
  115. }
  116. .nozzle_box {
  117. width: 90%;
  118. height: 50%;
  119. display: flex;
  120. justify-content: center;
  121. align-items: center;
  122. margin-top: 1%;
  123. }
  124. .media-container img {
  125. width: 50%;
  126. height: 50%;
  127. }
  128. </style>