暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

upload.htm 8.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <html lang="zh-cn">
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
  4. <title>文件管理</title>
  5. <link rel="stylesheet" type="text/css" href="__PUBLIC__/plugins/webuploader/webuploader.css?v={$version|default='1.2.9'}">
  6. <link rel="stylesheet" type="text/css" href="__PUBLIC__/plugins/webuploader/css/style.css?v={$version|default='1.2.9'}">
  7. <script type="text/javascript">
  8. var eyou_basefile = "{$Request.baseFile}";
  9. var module_name = "{$Think.const.MODULE_NAME}";
  10. var __root_dir__ = "__ROOT_DIR__";
  11. </script>
  12. </head>
  13. <body>
  14. <div class="upload-main">
  15. <div class="upload-main-left">
  16. <div class="upload-nav">
  17. <ul>
  18. <li><a class="upload-nav-active" href="javascript:void(0);" id="upload_tab">本地上传</a></li>
  19. <li> <a href="javascript:void(0);" onclick="picture_folder(this);" data-url="{:url('Uploadify/picture_folder',['num'=>$info['num'],'input'=>$info['input'],'path'=>$info['path'],'func'=>$info['func']])}">在线管理</a></li>
  20. </ul>
  21. </div>
  22. </div>
  23. <div class="upload-content">
  24. <div class="upload-box" style="padding: 20px;">
  25. <!-- <ul class="tabs">
  26. <li class="checked" id="upload_tab">本地上传</li>
  27. <a href="javascript:void(0);" onclick="picture_folder(this);" data-url="{:url('Uploadify/picture_folder',['num'=>$info['num'],'input'=>$info['input'],'path'=>$info['path'],'func'=>$info['func']])}"><li>在线管理</li></a>
  28. </ul> -->
  29. <div class="container">
  30. <div class="area upload-area area-checked" id="upload_area">
  31. <div id="uploader">
  32. <div class="statusBar" style="display:none;">
  33. <div class="progress">
  34. <span class="text">0%</span>
  35. <span class="percentage"></span>
  36. </div><div class="info"></div>
  37. <div class="btns">
  38. <div id="filePicker2"></div><div class="uploadBtn">开始上传</div>
  39. <div class="saveBtn">确定使用</div>
  40. </div>
  41. </div>
  42. <div class="queueList">
  43. <div id="dndArea" class="placeholder">
  44. <div id="filePicker"></div>
  45. <p>或将文件拖到这里,本次最多可选{$info.num|default=1}个</p>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="area manage-area" id="manage_area">
  51. <ul class="choose-btns">
  52. <li class="btn sure checked">确定</li>
  53. <li class="btn cancel">取消</li>
  54. </ul>
  55. <div class="file-list">
  56. <ul id="file_all_list">
  57. <!--<li class="checked">
  58. <div class="img">
  59. <img src="" />
  60. <span class="icon"></span>
  61. </div>
  62. <div class="desc"></div>
  63. </li>-->
  64. </ul>
  65. </div>
  66. </div>
  67. <div class="area search-area" id="search_area">
  68. <ul class="choose-btns">
  69. <li class="search">
  70. <div class="search-condition">
  71. <input class="key" type="text" />
  72. <input class="submit" type="button" hidefocus="true" value="搜索" />
  73. </div>
  74. </li>
  75. <li class="btn sure checked">确定</li>
  76. <li class="btn cancel">取消</li>
  77. </ul>
  78. <div class="file-list">
  79. <ul id="file_search_list">
  80. <!--<li>
  81. <div class="img">
  82. <img src="" />
  83. <span class="icon"></span>
  84. </div>
  85. <div class="desc"></div>
  86. </li>-->
  87. </ul>
  88. </div>
  89. </div>
  90. <div class="fileWarp" style="display:none;">
  91. <fieldset>
  92. <legend>列表</legend>
  93. <ul>
  94. </ul>
  95. </fieldset>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. {load href="__STATIC__/common/js/jquery.min.js" /}
  102. <script type="text/javascript" src="__PUBLIC__/plugins/webuploader/webuploader.min.js?v={$version|default='1.2.9'}"></script>
  103. <script type="text/javascript" src="__PUBLIC__/plugins/webuploader/upload.js?v={$version|default='1.2.9'}"></script>
  104. <script type="text/javascript" src="__PUBLIC__/plugins/layer-v3.1.0/layer.js?v={$version|default='1.2.9'}"></script>
  105. <script src="__SKIN__/js/global.js?v={$version}"></script>
  106. <script type="text/javascript">
  107. $(function(){
  108. var config = {
  109. "swf":"__PUBLIC__/plugins/webuploader/Uploader.swf",
  110. "server":"{$info.upload}",
  111. "filelistPah":"{$info.fileList}",
  112. "delPath":"{:url('Uploadify/delupload')}",
  113. "chunked":false,
  114. "chunkSize":524288,
  115. "fileNumLimit":{$info.num|default=1},
  116. "fileSizeLimit":209715200,
  117. "fileSingleSizeLimit":{$info.size},
  118. "fileVal":"file",
  119. "auto":true,
  120. "formData":{},
  121. "duplicate": true, // 允许上传重复文件
  122. // "accept": {
  123. // "title": 'Images',
  124. // "extensions": '{$info.type}',
  125. // "mimeTypes": 'image/*'
  126. // },
  127. "pick":{"id":"#filePicker","label":"点击选择图片","name":"file"},
  128. "thumb":{"width":110,"height":110,"quality":70,"allowMagnify":true,"crop":true,"preserveHeaders":false,"type":"image\/jpeg"},
  129. "compress": {
  130. "width": 380000,
  131. "height": 380000,
  132. "quality": 100,
  133. "allowMagnify": false,
  134. "crop": false,
  135. "preserveHeaders": true
  136. }
  137. };
  138. Manager.upload($.extend(config, {type : "Images"}));
  139. /*点击保存按钮时
  140. *判断允许上传数,检测是单一文件上传还是组文件上传
  141. *如果是单一文件,上传结束后将地址存入$input元素
  142. *如果是组文件上传,则创建input样式,添加到$input后面
  143. *隐藏父框架,清空列队,移除已上传文件样式*/
  144. $(".statusBar .saveBtn").click(function(){
  145. var callback = "{$info.func}";
  146. var num = {$info.num|default=1};
  147. var fileurl_tmp = [];
  148. if(callback != "undefined"){
  149. if(num > 1){
  150. var src = '';
  151. $("input[name^='fileurl_tmp']").each(function(index,dom){
  152. src = $('.WU_FILE_'+index).find("input[name^='fileurl_tmp']").val() || dom.value;
  153. fileurl_tmp[index] = src;
  154. });
  155. }else{
  156. fileurl_tmp = $("input[name^='fileurl_tmp']").val();
  157. }
  158. /*防止图片上传过程中用户点击确定,导致获取图片失败 by 小虎哥*/
  159. if (fileurl_tmp == undefined || fileurl_tmp.length == 0) {
  160. layer.msg('正在处理……', {icon: 6,time: 2000});
  161. return false;
  162. }
  163. /*--end*/
  164. eval('window.parent.'+callback+'(fileurl_tmp)');
  165. window.parent.layer.closeAll();
  166. //去判断是否需要删除本地的
  167. try{
  168. $.ajax({
  169. type:'POST',
  170. url:"{:url('Uploadify/del_local', ['_ajax'=>1])}",
  171. data:{action:"del", filename:fileurl_tmp},
  172. success:function(){}
  173. });
  174. }catch(e){}
  175. return;
  176. }
  177. if(num > 1){
  178. var fileurl_tmp = "";
  179. $("input[name^='fileurl_tmp']").each(function(){
  180. fileurl_tmp += '<li rel="'+ this.value +'"><input class="input-text" type="text" name="{$info.input}[]" value="'+ this.value +'" /><a href="javascript:void(0);" onclick="ClearPicArr(\''+ this.value +'\',\'\')">删除</a></li>';
  181. });
  182. $(window.parent.document).find("#{$info.input}").append(fileurl_tmp);
  183. }else{
  184. $(window.parent.document).find("#{$info.input}").val($("input[name^='fileurl_tmp']").val());
  185. }
  186. window.parent.layer.closeAll();
  187. });
  188. });
  189. function picture_folder(obj)
  190. {
  191. var url = $(obj).attr('data-url');
  192. layer_loading('正在跳转');
  193. window.location.href = url;
  194. }
  195. </script>
  196. </body>
  197. </html>