Commit 5595dd5f649fd44ed2c3b4c8627c51881d5dbd97
1 parent
167851243c
Exists in
master
jar包上传
Showing 2 changed files with 69 additions and 8 deletions
parent/center.manager/privateLib/ueditor-1.0.jar
View file @
5595dd5
parent/center.manager/src/main/webapp/WEB-INF/views/articles/articles_edit.html
View file @
5595dd5
| ... | ... | @@ -8,8 +8,13 @@ |
| 8 | 8 | |
| 9 | 9 | <script type="text/javascript" charset="utf-8" src="${ctx}/static/js/plugins/ueditor/ueditor.config.js"></script> |
| 10 | 10 | <script type="text/javascript" charset="utf-8" src="${ctx}/static/js/plugins/ueditor/ueditor.all.min.js"></script> |
| 11 | -<script type="text/javascript" charset="utf-8"src="${ctx}/static/js/plugins/ueditor/lang/zh-cn/zh-cn.js"></script> | |
| 11 | +<script type="text/javascript" charset="utf-8" src="${ctx}/static/js/plugins/ueditor/lang/zh-cn/zh-cn.js"></script> | |
| 12 | +<script type="text/javascript" charset="utf-8" src="${ctx}/static/js/plugins/plupload/moxie.js"></script> | |
| 13 | +<script type="text/javascript" charset="utf-8" src="${ctx}/static/js/plugins/plupload/plupload.dev.js"></script> | |
| 14 | +<script type="text/javascript" charset="utf-8" src="${ctx}/static/js/plugins/plupload/i18n/zh_CN.js"></script> | |
| 15 | +<script type="text/javascript" charset="utf-8" src="${ctx}/static/js/qiniu.min.js"></script> | |
| 12 | 16 | |
| 17 | + | |
| 13 | 18 | <div class="ibox float-e-margins"> |
| 14 | 19 | <div class="ibox-content"> |
| 15 | 20 | <div class="col-sm-12"> |
| ... | ... | @@ -66,8 +71,8 @@ |
| 66 | 71 | </label> |
| 67 | 72 | </div> |
| 68 | 73 | <div class="col-sm-12 no-padder"> |
| 69 | - <div ng-file-select="onFileSelect($files)" data-multiple="false" | |
| 70 | - title="点击上传" onclick="this.value = null" | |
| 74 | + <div data-multiple="false" | |
| 75 | + title="点击上传" id="pickfiles" | |
| 71 | 76 | class="btn btn-primary btn-upload m-b-sm"> |
| 72 | 77 | <i class="fa fa-cloud-upload text"></i> 点击上传图片 |
| 73 | 78 | </div> |
| ... | ... | @@ -124,10 +129,6 @@ |
| 124 | 129 | </div> |
| 125 | 130 | </div> |
| 126 | 131 | #end #extends("/common/base_list.html") |
| 127 | -<script type="text/javascript" src="${ctx}/static/js/plugins/plupload/moxie.js"></script> | |
| 128 | -<script type="text/javascript" src="${ctx}/static/js/plugins/plupload/plupload.dev.js"></script> | |
| 129 | -<script type="text/javascript" src="${ctx}/static/js/plugins/plupload/i18n/zh_CN.js"></script> | |
| 130 | -<script type="text/javascript" src="${ctx}/static/qiniu.min.js"></script> | |
| 131 | 132 | |
| 132 | 133 | <script type="text/javascript"> |
| 133 | 134 | $('#multChe').on('ifClicked', function(event) { |
| 134 | 135 | |
| 135 | 136 | |
| 136 | 137 | |
| ... | ... | @@ -146,14 +147,74 @@ |
| 146 | 147 | $("#specialCon").addClass("fa-check"); |
| 147 | 148 | } |
| 148 | 149 | } |
| 150 | + | |
| 151 | + function initUpload(){ | |
| 152 | + | |
| 153 | + var uploader = qiniu.uploader({ | |
| 154 | + runtimes: 'html5,flash,html4', //上传模式,依次退化 | |
| 155 | + browse_button: 'pickfiles', //上传选择的点选按钮,**必需** | |
| 156 | + uptoken_url: '/token', //Ajax请求upToken的Url,**强烈建议设置**(服务端提供) | |
| 157 | + // uptoken : '<Your upload token>', //若未指定uptoken_url,则必须指定 uptoken ,uptoken由其他程序生成 | |
| 158 | + // unique_names: true, // 默认 false,key为文件名。若开启该选项,SDK为自动生成上传成功后的key(文件名)。 | |
| 159 | + // save_key: true, // 默认 false。若在服务端生成uptoken的上传策略中指定了 `sava_key`,则开启,SDK会忽略对key的处理 | |
| 160 | + domain: 'http://qiniu-plupload.qiniudn.com/', //bucket 域名,下载资源时用到,**必需** | |
| 161 | + get_new_uptoken: false, //设置上传文件的时候是否每次都重新获取新的token | |
| 162 | + container: 'container', //上传区域DOM ID,默认是browser_button的父元素, | |
| 163 | + max_file_size: '100mb', //最大文件体积限制 | |
| 164 | + flash_swf_url: 'js/plupload/Moxie.swf', //引入flash,相对路径 | |
| 165 | + max_retries: 3, //上传失败最大重试次数 | |
| 166 | + dragdrop: true, //开启可拖曳上传 | |
| 167 | + drop_element: 'container', //拖曳上传区域元素的ID,拖曳文件或文件夹后可触发上传 | |
| 168 | + chunk_size: '4mb', //分块上传时,每片的体积 | |
| 169 | + auto_start: true, //选择文件后自动上传,若关闭需要自己绑定事件触发上传 | |
| 170 | + init: { | |
| 171 | + 'FilesAdded': function(up, files) { | |
| 172 | + plupload.each(files, function(file) { | |
| 173 | + // 文件添加进队列后,处理相关的事情 | |
| 174 | + }); | |
| 175 | + }, | |
| 176 | + 'BeforeUpload': function(up, file) { | |
| 177 | + // 每个文件上传前,处理相关的事情 | |
| 178 | + }, | |
| 179 | + 'UploadProgress': function(up, file) { | |
| 180 | + // 每个文件上传时,处理相关的事情 | |
| 181 | + }, | |
| 182 | + 'FileUploaded': function(up, file, info) { | |
| 183 | + // 每个文件上传成功后,处理相关的事情 | |
| 184 | + // 其中 info 是文件上传成功后,服务端返回的json,形式如 | |
| 185 | + // { | |
| 186 | + // "hash": "Fh8xVqod2MQ1mocfI4S4KpRL6D98", | |
| 187 | + // "key": "gogopher.jpg" | |
| 188 | + // } | |
| 189 | + // 参考http://developer.qiniu.com/docs/v6/api/overview/up/response/simple-response.html | |
| 149 | 190 | |
| 191 | + // var domain = up.getOption('domain'); | |
| 192 | + // var res = parseJSON(info); | |
| 193 | + // var sourceLink = domain + res.key; 获取上传成功后的文件的Url | |
| 194 | + }, | |
| 195 | + 'Error': function(up, err, errTip) { | |
| 196 | + //上传出错时,处理相关的事情 | |
| 197 | + }, | |
| 198 | + 'UploadComplete': function() { | |
| 199 | + //队列文件处理完毕后,处理相关的事情 | |
| 200 | + }, | |
| 201 | + 'Key': function(up, file) { | |
| 202 | + var key = ""; | |
| 203 | + return key | |
| 204 | + } | |
| 205 | + } | |
| 206 | + }); | |
| 207 | + | |
| 208 | + } | |
| 209 | + | |
| 150 | 210 | $(function() { |
| 211 | + //初始化图片上传插件 | |
| 212 | + initUpload(); | |
| 151 | 213 | //初始化 |
| 152 | 214 | var ue = UE.getEditor('editor', { |
| 153 | 215 | initialFrameHeight : 200, |
| 154 | 216 | initialFrameWidth : "100%" |
| 155 | 217 | }); |
| 156 | - | |
| 157 | 218 | $.getJSON("${ctx}/contentCategories/list", function(data) { |
| 158 | 219 | if (data.success) { |
| 159 | 220 | var columnList = "<option value=''>请选择</option>"; |