move response data from memory to local cache file

This commit is contained in:
OttoMao
2015-10-24 23:37:43 +08:00
parent 31daeebdd5
commit cfc817cb1f
13 changed files with 248 additions and 60 deletions

View File

@@ -12,11 +12,23 @@ function init(React){
id = self.props.data.id;
if(!id) return;
ws.reqBody(id,function(content){
if(content.id == self.props.data.id){
self.setState({
body : content
});
jQuery.get("/fetchBody?id=" + id ,function(resObj){
if(resObj && resObj.id){
if(resObj.type && resObj.type == "image" && resObj.ref){
self.setState({
body : {
img : resObj.ref,
id : resObj.id
}
});
}else if(resObj.content){
self.setState({
body : {
body : resObj.content,
id : resObj.id
}
});
}
}
});
},
@@ -55,9 +67,13 @@ function init(React){
);
if(this.props.data.statusCode){
if(this.state.body.id == this.props.data.id){
bodyContent = (React.createElement("pre", {className: "resBodyContent"}, this.state.body.body));
if(this.state.body.img){
var imgEl = { __html : '<img src="'+ this.state.body.img +'" />'};
bodyContent = (React.createElement("div", {dangerouslySetInnerHTML: imgEl}));
}else{
bodyContent = (React.createElement("pre", {className: "resBodyContent"}, this.state.body.body));
}
}else{
bodyContent = null;
this.loadBody();

View File

@@ -186,6 +186,11 @@ body, html {
word-wrap:break-word;
}
.resBody .resBodyContent img{
max-width: 500px;
max-height: 500px;
}
.subTitle{
padding-left: 6px;
border-left: 3px solid #1FA2D6;

View File

@@ -20342,11 +20342,23 @@
id = self.props.data.id;
if(!id) return;
ws.reqBody(id,function(content){
if(content.id == self.props.data.id){
self.setState({
body : content
});
jQuery.get("/fetchBody?id=" + id ,function(resObj){
if(resObj && resObj.id){
if(resObj.type && resObj.type == "image" && resObj.ref){
self.setState({
body : {
img : resObj.ref,
id : resObj.id
}
});
}else if(resObj.content){
self.setState({
body : {
body : resObj.content,
id : resObj.id
}
});
}
}
});
},
@@ -20385,9 +20397,13 @@
);
if(this.props.data.statusCode){
if(this.state.body.id == this.props.data.id){
bodyContent = (React.createElement("pre", {className: "resBodyContent"}, this.state.body.body));
if(this.state.body.img){
var imgEl = { __html : '<img src="'+ this.state.body.img +'" />'};
bodyContent = (React.createElement("div", {dangerouslySetInnerHTML: imgEl}));
}else{
bodyContent = (React.createElement("pre", {className: "resBodyContent"}, this.state.body.body));
}
}else{
bodyContent = null;
this.loadBody();

View File

@@ -12,11 +12,23 @@ function init(React){
id = self.props.data.id;
if(!id) return;
ws.reqBody(id,function(content){
if(content.id == self.props.data.id){
self.setState({
body : content
});
jQuery.get("/fetchBody?id=" + id ,function(resObj){
if(resObj && resObj.id){
if(resObj.type && resObj.type == "image" && resObj.ref){
self.setState({
body : {
img : resObj.ref,
id : resObj.id
}
});
}else if(resObj.content){
self.setState({
body : {
body : resObj.content,
id : resObj.id
}
});
}
}
});
},
@@ -55,9 +67,13 @@ function init(React){
);
if(this.props.data.statusCode){
if(this.state.body.id == this.props.data.id){
bodyContent = (<pre className="resBodyContent">{this.state.body.body}</pre>);
if(this.state.body.img){
var imgEl = { __html : '<img src="'+ this.state.body.img +'" />'};
bodyContent = (<div dangerouslySetInnerHTML={imgEl}></div>);
}else{
bodyContent = (<pre className="resBodyContent">{this.state.body.body}</pre>);
}
}else{
bodyContent = null;
this.loadBody();