resource-manager.html 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>素材管理</title>
  7. <link rel="stylesheet" href="../../css/resource-manager/tool-bar.css">
  8. <link rel="stylesheet" href="../../css/resource-manager/disk.css">
  9. <link rel="stylesheet" href="../../css/resource-manager/right-click-menu.css">
  10. <link rel="stylesheet" href="../../css/resource-manager/hint-view.css">
  11. <link rel="stylesheet" href="../../css/resource-manager/confirm-view.css">
  12. </head>
  13. <body>
  14. <div class="disk-container" id="diskContainer">
  15. <!-- 头部区域 -->
  16. <div class="header">
  17. <div class="breadcrumb" id="breadcrumb">
  18. <span class="breadcrumb-item active" data-path="">全部文件</span>
  19. </div>
  20. <div class="header-right">
  21. <div class="search-box">
  22. <svg class="search-icon" width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
  23. <path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
  24. </svg>
  25. <input type="text" id="searchInput" placeholder="搜索文件或文件夹...">
  26. <button class="search-clear" id="searchClear" style="display: none;" title="清空搜索">
  27. <svg width="14" height="14" viewBox="0 0 14 14" fill="currentColor">
  28. <path d="M7 0C3.13 0 0 3.13 0 7s3.13 7 7 7 7-3.13 7-7S10.87 0 7 0zm3.5 9.21L9.21 10.5 7 8.29 4.79 10.5 3.5 9.21 5.71 7 3.5 4.79 4.79 3.5 7 5.71 9.21 3.5 10.5 4.79 8.29 7 10.5 9.21z"/>
  29. </svg>
  30. </button>
  31. </div>
  32. </div>
  33. </div>
  34. <!-- 选中操作栏 -->
  35. <div class="selection-bar" id="selectionBar">
  36. <div class="selection-actions">
  37. <button class="btn-action btn-danger" id="btnDelete">
  38. <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
  39. <path d="M5 2V1h6v1h4v2H1V2h4zm1 3h4v9H6V5zm-3 0h2v9H3V5zm8 0h2v9h-2V5z"/>
  40. </svg>
  41. 删除
  42. </button>
  43. </div>
  44. <span class="selection-count" id="selectionCount">已选中 0 项</span>
  45. </div>
  46. <!-- 文件列表区域 -->
  47. <div class="file-list-container" id="dropZone">
  48. <div class="drop-hint" id="dropHint">
  49. <svg width="64" height="64" viewBox="0 0 64 64" fill="currentColor">
  50. <path d="M32 8L16 24h10v16h12V24h10L32 8z"/>
  51. <path d="M8 48h48v8H8z"/>
  52. </svg>
  53. <p>拖拽文件或文件夹到此处上传</p>
  54. </div>
  55. <div class="file-list" id="fileList">
  56. <!-- 文件项将动态生成 -->
  57. </div>
  58. <div class="empty-state" id="emptyState">
  59. <svg width="120" height="120" viewBox="0 0 120 120" fill="#ddd">
  60. <path d="M30 20h40l20 20v60H30V20z"/>
  61. <path d="M70 20v20h20"/>
  62. </svg>
  63. <p>此文件夹为空</p>
  64. <p class="hint">拖拽文件或文件夹到此处上传</p>
  65. </div>
  66. <div class="loading" id="loading">
  67. <div class="spinner"></div>
  68. <p>加载中...</p>
  69. </div>
  70. </div>
  71. <!-- 上传进度 -->
  72. <div class="upload-progress" id="uploadProgress">
  73. <div class="upload-progress-header">
  74. <span class="upload-progress-title">上传文件</span>
  75. <button class="upload-progress-close" id="uploadProgressClose">
  76. <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
  77. <path d="M4 4l8 8M12 4l-8 8" stroke="currentColor" stroke-width="2"/>
  78. </svg>
  79. </button>
  80. </div>
  81. <div class="upload-progress-list" id="uploadProgressList"></div>
  82. </div>
  83. <template id="uploadProgressTemplate">
  84. <div class="upload-progress-item">
  85. <div class="upload-progress-icon">
  86. <svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
  87. <path d="M10 2L5 7h3v6h4V7h3L10 2z"/>
  88. <path d="M3 16h14v2H3z"/>
  89. </svg>
  90. </div>
  91. <div class="upload-progress-info">
  92. <div class="upload-progress-name"></div>
  93. <div class="upload-progress-status">上传中...</div>
  94. <div class="upload-progress-bar">
  95. <div class="upload-progress-bar-fill" style="width: 0%"></div>
  96. </div>
  97. </div>
  98. </div>
  99. </template>
  100. </div>
  101. <!-- 右键菜单(放在 body 直接下面) -->
  102. <div class="context-menu" id="contextMenu">
  103. <button class="context-menu-item" data-action="new">
  104. <span>新建分类</span>
  105. </button>
  106. <button class="context-menu-item" data-action="upload">
  107. <span>上传素材</span>
  108. </button>
  109. <button class="context-menu-item" data-action="back">
  110. <span>返回上级</span>
  111. </button>
  112. <div class="context-menu-divider"></div>
  113. <button class="context-menu-item" data-action="rename">
  114. <span>重命名</span>
  115. </button>
  116. <button class="context-menu-item danger" data-action="delete">
  117. <span>删除</span>
  118. </button>
  119. <div class="context-menu-divider"></div>
  120. <button class="context-menu-item" data-action="refresh">
  121. <span>刷新</span>
  122. </button>
  123. </div>
  124. <!-- 文件输入通过 JS 动态创建 -->
  125. <!-- 框选区域 -->
  126. <div class="selection-box" id="selectionBox"></div>
  127. <!-- 提示消息组件 -->
  128. <div class="hint-view" id="hintView">
  129. <div class="hint-content">
  130. <svg class="hint-icon" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
  131. <path d="M10 0C4.48 0 0 4.48 0 10s4.48 10 10 10 10-4.48 10-10S15.52 0 10 0zm-1 15l-5-5 1.41-1.41L9 12.17l7.59-7.59L18 6l-9 9z"/>
  132. </svg>
  133. <span class="hint-message" id="hintMessage"></span>
  134. </div>
  135. </div>
  136. <!-- 全局确认对话框 -->
  137. <div class="global-confirm-overlay" id="globalConfirmOverlay">
  138. <div class="global-confirm-dialog">
  139. <div class="confirm-content">
  140. <div class="confirm-message" id="confirmMessage"></div>
  141. </div>
  142. <div class="confirm-actions">
  143. <button class="confirm-btn confirm-cancel" id="confirmCancelBtn">取消</button>
  144. <button class="confirm-btn confirm-ok" id="confirmOkBtn">确认</button>
  145. </div>
  146. </div>
  147. </div>
  148. <!-- 全局输入对话框 -->
  149. <div class="global-confirm-overlay" id="globalPromptOverlay">
  150. <div class="global-confirm-dialog">
  151. <div class="confirm-content">
  152. <div class="confirm-message" id="promptMessage"></div>
  153. <input type="text" class="prompt-input" id="promptInput" placeholder="">
  154. </div>
  155. <div class="confirm-actions">
  156. <button class="confirm-btn confirm-cancel" id="promptCancelBtn">取消</button>
  157. <button class="confirm-btn confirm-ok" id="promptOkBtn">确认</button>
  158. </div>
  159. </div>
  160. </div>
  161. <script src="../../js/resource-manager/path.js"></script>
  162. <script src="../../js/resource-manager/multiple-selection.js"></script>
  163. <script src="../../js/resource-manager/shortcut-keys.js"></script>
  164. <script src="../../js/resource-manager/search-bar.js"></script>
  165. <script src="../../js/resource-manager/right-click-menu.js"></script>
  166. <script src="../../js/resource-manager/resource-manager.js"></script>
  167. <script>
  168. // 初始化素材管理器
  169. (function() {
  170. let apiBaseUrl = 'http://localhost:3000';
  171. // 尝试从父窗口获取 API 地址(file:// 协议下会失败,使用默认值)
  172. try {
  173. if (window.parent && window.parent.getApiBaseUrl) {
  174. apiBaseUrl = window.parent.getApiBaseUrl();
  175. }
  176. } catch (e) {
  177. console.log('[ResourceManager] 使用默认 API 地址:', apiBaseUrl);
  178. }
  179. if (!window.resourceManager) {
  180. window.resourceManager = new ResourceManager({
  181. apiBaseUrl: apiBaseUrl
  182. });
  183. }
  184. })();
  185. </script>
  186. </body>
  187. </html>