No Description
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_product.htm 8.2KB

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