explorer.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <<<<<<< HEAD
  2. <style>
  3. .progress {
  4. width: 600px;
  5. height: 10px;
  6. border: 1px solid #ccc;
  7. border-radius: 10px;
  8. margin: 10px 0px;
  9. overflow: hidden;
  10. display: -webkit-inline-box;
  11. }
  12. /* 初始状态设置进度条宽度为0px */
  13. .progress>div {
  14. width: 0px;
  15. height: 100%;
  16. background-color: yellowgreen;
  17. transition: all .3s ease;
  18. }
  19. </style>
  20. <article class="cl pd-20">
  21. <div class="cl pd-5 bg-1 bk-gray">
  22. <span class="l">
  23. <a class="btn radius btn-default" href="{:url('index')}"><i
  24. class="Hui-iconfont Hui-iconfont-pages"></i>数据库模式</a>
  25. <a class="btn radius btn-secondary"><i class="Hui-iconfont Hui-iconfont-jifen"></i> 目录模式 </a>
  26. <a class="btn btn-primary radius" onclick="uploadFile();"><i
  27. class="Hui-iconfont Hui-iconfont-add"></i>上传附件</a>
  28. <input type="file" id="upload_file" hidden multiple onchange="fileChange()">
  29. <input type="hidden" id="activepath" name="activepath" value="{$activepath}">
  30. <div class="progress">
  31. <div></div>
  32. </div>
  33. </span>
  34. <span class="r">共有:
  35. <strong>{$counts}</strong> 个对象</span>
  36. </div>
  37. <div class="cl mt-20">
  38. <table class="table table-border table-bordered table-bg">
  39. <thead>
  40. <tr class="text-c">
  41. <th width="25%">
  42. <strong>文件名</strong>
  43. </th>
  44. <th width="16%">
  45. <strong>文件大小</strong>
  46. </th>
  47. <th width="22%">
  48. <strong>最后修改时间</strong>
  49. </th>
  50. <th width="34%">
  51. <strong>操作</strong>
  52. </th>
  53. </tr>
  54. </thead>
  55. <tbody>
  56. <tr class="text-c" bgcolor='#FFFFFF' height='26' onMouseMove="javascript:this.bgColor='#FCFDEE';"
  57. onMouseOut="javascript:this.bgColor='#FFFFFF';">
  58. <td>
  59. {notempty name="activepath"}<i class="Hui-iconfont Hui-iconfont-arrow1-top"></i>{/notempty}
  60. <a href="/sys/file_manager/explorer?activepath={$activeurl}">上级目录</a>
  61. </td>
  62. <td>当前目录:
  63. <span style="color:#f00;"> ./storage{$activepath} </span>  
  64. </td>
  65. <td></td>
  66. <td></td>
  67. </tr>
  68. {foreach $dirs as $dir}
  69. <tr class="text-c" style="height:26px; " onMouseMove="javascript:this.bgColor='#FCFDEE';"
  70. onMouseOut="javascript:this.bgColor='#FFFFFF';">
  71. <td style="text-align:left;">
  72. <img src=/static/images/icon/dir.png>
  73. <a href="/sys/file_manager/explorer?activepath={$activepath.'/'.$dir}">
  74. {$dir}
  75. </a>
  76. </td>
  77. <td></td>
  78. <td></td>
  79. <td>
  80. <a class="btn" onclick="del_dir(this, '{$activepath}/{$dir}')">删除</a>
  81. </td>
  82. </tr>
  83. {/foreach}
  84. {foreach $files as $file}
  85. <tr class="text-c" bgcolor='#FFFFFF' height='26' onMouseMove="javascript:this.bgColor='#FCFDEE';"
  86. onMouseOut="javascript:this.bgColor='#FFFFFF';">
  87. <td style="text-align:left;">
  88. <img src="/static/images/icon/{$file['extension']}.png">
  89. <a href="/storage{$activepath}/{$file['filename']}" target="_blank">
  90. {$file['filename']}
  91. </a>
  92. </td>
  93. <td align='center'> {$file['size']} </td>
  94. <td align='center'> {$file['time']|date="Y-m-d H:i:s"} </td>
  95. <td>
  96. <a href="/storage{$activepath.'/'.$file['filename']}" class="btn radius btn-primary"
  97. target="_blank">查看/下载</a>&nbsp;
  98. <a class="btn radius btn-danger"
  99. onclick="del_file(this,'{$activepath}/{$file.filename}')">删除</a>&nbsp;
  100. <!-- <a href='' class="btn" >移动</a> -->
  101. </td>
  102. </tr>
  103. {/foreach}
  104. </tbody>
  105. </table>
  106. </div>
  107. </article>
  108. <!--请在下方写此页面业务相关的脚本-->
  109. <script type="text/javascript">
  110. /*删除图片*/
  111. function del_dir(obj, dir) {
  112. layer.confirm('确认要删除吗?', function (index) {
  113. $.post('deldir', {
  114. 'dir': dir
  115. }, function (res) {
  116. if (res.code == 0) {
  117. $(obj).parents('tr').remove();
  118. topalert({
  119. type: 0,
  120. content: res.msg,
  121. speed: 1000
  122. });
  123. } else {
  124. topalert({
  125. type: 2,
  126. content: res.msg,
  127. speed: 2000
  128. });
  129. }
  130. layer.close(layer.index);
  131. }, 'json');
  132. });
  133. }
  134. /*删除图片*/
  135. function del_file(obj, filename) {
  136. layer.confirm('确认要删除吗?', function (index) {
  137. $.post('delfile', {
  138. 'filename': filename
  139. }, function (res) {
  140. if (res.code == 0) {
  141. $(obj).parents('tr').remove();
  142. topalert({
  143. type: 0,
  144. content: res.msg,
  145. speed: 1000
  146. });
  147. } else {
  148. topalert({
  149. type: 2,
  150. content: res.msg,
  151. speed: 2000
  152. });
  153. }
  154. layer.close(layer.index);
  155. }, 'json');
  156. });
  157. }
  158. //通过点击图片来触发文件上传按钮
  159. function uploadFile(params) {
  160. $("#upload_file").click();
  161. }
  162. // 自动上传处理
  163. function fileChange() {
  164. let uploadFile = $("#upload_file").get(0).files;
  165. // console.log(uploadFile);
  166. if (uploadFile == undefined || uploadFile == null) {
  167. layer.msg("请选择文件", { icon: 5, time: 1000 });
  168. return false;
  169. }
  170. if (uploadFile.length > 20) {
  171. layer.msg("最多20个文件", { icon: 5, time: 1000 });
  172. return false;
  173. }
  174. let formData = new FormData();
  175. formData.append('activepath', $('#activepath').val());
  176. for (let i = 0; i < uploadFile.length; i++) {
  177. formData.append('upload_file[]', uploadFile[i]);
  178. }
  179. $.ajax({
  180. url: '{:url("file_manager/uploadFile")}',
  181. type: 'post',
  182. dataType: 'json',
  183. data: formData,
  184. processData: false,
  185. contentType: false,
  186. xhr: function () {
  187. var xhr = new XMLHttpRequest();
  188. //使用XMLHttpRequest.upload监听上传过程,注册progress事件,打印回调函数中的event事件
  189. xhr.upload.addEventListener('progress', function (e) {
  190. // console.log(e);
  191. //loaded代表上传了多少
  192. //total代表总数为多少
  193. var progressRate = (e.loaded / e.total) * 100 + '%';
  194. //通过设置进度条的宽度达到效果
  195. $('.progress > div').css('width', progressRate);
  196. })
  197. return xhr;
  198. },
  199. success: function (res) {
  200. console.log(res);
  201. if (res.code == 0) {
  202. layer.msg(res.msg, {
  203. icon: 1,
  204. time: 1000
  205. });
  206. window.location.reload();
  207. } else {
  208. layer.msg(res.msg, {
  209. icon: 5,
  210. time: 1000
  211. });
  212. return false;
  213. }
  214. }
  215. });
  216. }
  217. </script>
  218. =======
  219. <style>
  220. .progress {
  221. width: 600px;
  222. height: 10px;
  223. border: 1px solid #ccc;
  224. border-radius: 10px;
  225. margin: 10px 0px;
  226. overflow: hidden;
  227. display: -webkit-inline-box;
  228. }
  229. /* 初始状态设置进度条宽度为0px */
  230. .progress>div {
  231. width: 0px;
  232. height: 100%;
  233. background-color: yellowgreen;
  234. transition: all .3s ease;
  235. }
  236. </style>
  237. <article class="cl pd-20">
  238. <div class="cl pd-5 bg-1 bk-gray">
  239. <span class="l">
  240. <a class="btn radius btn-default" href="{:url('index')}"><i
  241. class="Hui-iconfont Hui-iconfont-pages"></i>数据库模式</a>
  242. <a class="btn radius btn-secondary"><i class="Hui-iconfont Hui-iconfont-jifen"></i> 目录模式 </a>
  243. <a class="btn btn-primary radius" onclick="uploadFile();"><i
  244. class="Hui-iconfont Hui-iconfont-add"></i>上传附件</a>
  245. <input type="file" id="upload_file" hidden multiple onchange="fileChange()">
  246. <input type="hidden" id="activepath" name="activepath" value="{$activepath}">
  247. <div class="progress">
  248. <div></div>
  249. </div>
  250. </span>
  251. <span class="r">共有:
  252. <strong>{$counts}</strong> 个对象</span>
  253. </div>
  254. <div class="cl mt-20">
  255. <table class="table table-border table-bordered table-bg">
  256. <thead>
  257. <tr class="text-c">
  258. <th width="25%">
  259. <strong>文件名</strong>
  260. </th>
  261. <th width="16%">
  262. <strong>文件大小</strong>
  263. </th>
  264. <th width="22%">
  265. <strong>最后修改时间</strong>
  266. </th>
  267. <th width="34%">
  268. <strong>操作</strong>
  269. </th>
  270. </tr>
  271. </thead>
  272. <tbody>
  273. <tr class="text-c" bgcolor='#FFFFFF' height='26' onMouseMove="javascript:this.bgColor='#FCFDEE';"
  274. onMouseOut="javascript:this.bgColor='#FFFFFF';">
  275. <td>
  276. {notempty name="activepath"}<i class="Hui-iconfont Hui-iconfont-arrow1-top"></i>{/notempty}
  277. <a href="/sys/file_manager/explorer?activepath={$activeurl}">上级目录</a>
  278. </td>
  279. <td>当前目录:
  280. <span style="color:#f00;"> ./storage{$activepath} </span>  
  281. </td>
  282. <td></td>
  283. <td></td>
  284. </tr>
  285. {foreach $dirs as $dir}
  286. <tr class="text-c" style="height:26px; " onMouseMove="javascript:this.bgColor='#FCFDEE';"
  287. onMouseOut="javascript:this.bgColor='#FFFFFF';">
  288. <td style="text-align:left;">
  289. <img src="/static/images/icon/dir.png">
  290. <a href="/sys/file_manager/explorer?activepath={$activepath.'/'.$dir}">
  291. {$dir}
  292. </a>
  293. </td>
  294. <td></td>
  295. <td></td>
  296. <td>
  297. <a class="btn" onclick="del_dir(this, '{$activepath}/{$dir}')">删除</a>
  298. </td>
  299. </tr>
  300. {/foreach}
  301. {foreach $files as $file}
  302. <tr class="text-c" bgcolor='#FFFFFF' height='26' onMouseMove="javascript:this.bgColor='#FCFDEE';"
  303. onMouseOut="javascript:this.bgColor='#FFFFFF';">
  304. <td style="text-align:left;">
  305. <img src="/static/images/icon/{$file['extension']}.png">
  306. <a href="/storage{$activepath}/{$file['filename']}" target="_blank">
  307. {$file['filename']}
  308. </a>
  309. </td>
  310. <td align='center'> {$file['size']} </td>
  311. <td align='center'> {$file['time']|date="Y-m-d H:i:s"} </td>
  312. <td>
  313. <a href="/storage{$activepath.'/'.$file['filename']}" class="btn radius btn-primary"
  314. target="_blank">查看/下载</a>&nbsp;
  315. <a class="btn radius btn-danger"
  316. onclick="del_file(this,'{$activepath}/{$file.filename}')">删除</a>&nbsp;
  317. <!-- <a href='' class="btn" >移动</a> -->
  318. </td>
  319. </tr>
  320. {/foreach}
  321. </tbody>
  322. </table>
  323. </div>
  324. </article>
  325. <!--请在下方写此页面业务相关的脚本-->
  326. <script type="text/javascript">
  327. /*删除图片*/
  328. function del_dir(obj, dir) {
  329. layer.confirm('确认要删除吗?', function (index) {
  330. $.post('deldir', {
  331. 'dir': dir
  332. }, function (res) {
  333. if (res.code == 0) {
  334. $(obj).parents('tr').remove();
  335. topalert({
  336. type: 0,
  337. content: res.msg,
  338. speed: 1000
  339. });
  340. } else {
  341. topalert({
  342. type: 2,
  343. content: res.msg,
  344. speed: 2000
  345. });
  346. }
  347. layer.close(layer.index);
  348. }, 'json');
  349. });
  350. }
  351. /*删除图片*/
  352. function del_file(obj, filename) {
  353. layer.confirm('确认要删除吗?', function (index) {
  354. $.post('delfile', {
  355. 'filename': filename
  356. }, function (res) {
  357. if (res.code == 0) {
  358. $(obj).parents('tr').remove();
  359. topalert({
  360. type: 0,
  361. content: res.msg,
  362. speed: 1000
  363. });
  364. } else {
  365. topalert({
  366. type: 2,
  367. content: res.msg,
  368. speed: 2000
  369. });
  370. }
  371. layer.close(layer.index);
  372. }, 'json');
  373. });
  374. }
  375. //通过点击图片来触发文件上传按钮
  376. function uploadFile(params) {
  377. $("#upload_file").click();
  378. }
  379. // 自动上传处理
  380. function fileChange() {
  381. let uploadFile = $("#upload_file").get(0).files;
  382. // console.log(uploadFile);
  383. if (uploadFile == undefined || uploadFile == null) {
  384. layer.msg("请选择文件", { icon: 5, time: 1000 });
  385. return false;
  386. }
  387. if (uploadFile.length > 20) {
  388. layer.msg("最多20个文件", { icon: 5, time: 1000 });
  389. return false;
  390. }
  391. let formData = new FormData();
  392. formData.append('activepath', $('#activepath').val());
  393. for (let i = 0; i < uploadFile.length; i++) {
  394. formData.append('upload_file[]', uploadFile[i]);
  395. }
  396. $.ajax({
  397. url: '{:url("file_manager/uploadFile")}',
  398. type: 'post',
  399. dataType: 'json',
  400. data: formData,
  401. processData: false,
  402. contentType: false,
  403. xhr: function () {
  404. var xhr = new XMLHttpRequest();
  405. //使用XMLHttpRequest.upload监听上传过程,注册progress事件,打印回调函数中的event事件
  406. xhr.upload.addEventListener('progress', function (e) {
  407. // console.log(e);
  408. //loaded代表上传了多少
  409. //total代表总数为多少
  410. var progressRate = (e.loaded / e.total) * 100 + '%';
  411. //通过设置进度条的宽度达到效果
  412. $('.progress > div').css('width', progressRate);
  413. })
  414. return xhr;
  415. },
  416. success: function (res) {
  417. console.log(res);
  418. if (res.code == 0) {
  419. layer.msg(res.msg, {
  420. icon: 1,
  421. time: 1000
  422. });
  423. window.location.reload();
  424. } else {
  425. layer.msg(res.msg, {
  426. icon: 5,
  427. time: 1000
  428. });
  429. return false;
  430. }
  431. }
  432. });
  433. }
  434. </script>
  435. >>>>>>> 78b76253c8ce5873016cf837373af5e30ac80c86
  436. <!--请在上方写此页面业务相关的脚本-->