Skip to content

Commit

Permalink
🦄 fix article auto save and big images loading
Browse files Browse the repository at this point in the history
  • Loading branch information
hellokaton committed Mar 5, 2017
1 parent 8ba0baf commit ce67b18
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/tale/Application.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package com.tale;

import com.blade.Blade;
import com.tale.init.TaleLoader;

import java.io.File;

import static com.blade.Blade.$;

public class Application {

public static void main(String[] args) throws Exception {
TaleLoader.init();
TaleLoader.loadPlugin(Blade.$().bConfig(), new File("/Users/biezhi/workspace/projects/java/plugin_upyun/target/plguin_upyun.jar"));
$().start(Application.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public RestResponse modifyArticle(@QueryParam Integer cid, @QueryParam String ti
contents.setCategories(categories);
try {
contentsService.updateArticle(contents);
return RestResponse.ok(cid);
} catch (Exception e) {
String msg = "文章编辑失败";
if (e instanceof TipException) {
Expand All @@ -208,7 +209,6 @@ public RestResponse modifyArticle(@QueryParam Integer cid, @QueryParam String ti
}
return RestResponse.fail(msg);
}
return RestResponse.ok();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ public RestResponse upload(Request request) {
}
});
if(errorFiles.size() > 0){
return RestResponse.fail();
RestResponse restResponse = new RestResponse();
restResponse.setSuccess(false);
restResponse.setPayload(errorFiles);
return restResponse;
}
return RestResponse.ok(urls);
} catch (Exception e) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/static/admin/js/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $(document).ready(function () {
onImageUpload: function(files) {
var data=new FormData();
data.append('image_up',files[0]);
//调用上传图片
tale.showLoading();
$.ajax({
url: '/admin/attach/upload', //上传图片请求的路径
method: 'POST', //方法
Expand All @@ -22,6 +22,7 @@ $(document).ready(function () {
dataType:'json',
contentType: false, //<code class="javascript comments"> 告诉jQuery,在request head里不要设置Content-Type
success: function(result) {
tale.hideLoading();
if(result && result.success){
var url = $('#attach_url').val() + result.payload[0].fkey;
console.log('url =>' + url);
Expand Down

0 comments on commit ce67b18

Please sign in to comment.