@@ -21,13 +21,13 @@ var CommentBox = React.createClass({
21
21
success : function ( res ) {
22
22
if ( res && res . Status == "Success" ) {
23
23
var comments = res . Result ;
24
- if ( ! comments || comments . length == 0 ) {
24
+ /* if(!comments||comments.length==0){
25
25
comments=[];
26
26
var first=RSVP.createComment();
27
27
first.author.name='景区';
28
28
first.text='欢迎留下您的足迹!';
29
29
comments.push(first);
30
- }
30
+ }*/
31
31
this . setState ( { data : comments , hasmore :res . Result . length >= RSVP . config . pagesize } ) ;
32
32
}
33
33
} . bind ( this ) ,
@@ -46,8 +46,8 @@ var CommentBox = React.createClass({
46
46
data :{ params :JSON . stringify ( params ) } ,
47
47
success : function ( res ) {
48
48
if ( res && res . Status == "Success" ) {
49
- // var newData=this.state.data.concat(res.Result);//正序,最后位置插入
50
- var newData = res . Result . concat ( this . state . data ) ; //逆序,最前位置插入
49
+ var newData = this . state . data . concat ( res . Result ) ; //正序,最后位置插入
50
+ // var newData=res.Result.concat(this.state.data);//逆序,最前位置插入
51
51
this . setState ( { data : newData , hasmore :res . Result . length >= RSVP . config . pagesize } ) ;
52
52
RSVP . config . page = params . page ;
53
53
}
@@ -63,8 +63,8 @@ var CommentBox = React.createClass({
63
63
if ( pId && pId != 0 ) {
64
64
var parentComment = RSVP . getCommentById ( comments , pId ) ;
65
65
comment . parentId = parentComment . id ;
66
- var ppid = parentComment . parentId ;
67
- comment . syncId = ( ppid && ppid != 0 && ppid != "0" ) ?ppid :parentComment . id ;
66
+ var psid = parentComment . syncId ;
67
+ comment . syncId = ( psid && psid != 0 && psid != "0" ) ?psid :parentComment . id ;
68
68
comment . toOpenid = parentComment . author . openid ;
69
69
comment . toAppid = parentComment . author . appid ;
70
70
comment . toWho = parentComment . author . name ;
@@ -100,7 +100,7 @@ var CommentBox = React.createClass({
100
100
//var newComments = comments.concat([comment]);
101
101
this . setState ( { data : comments } ) ;
102
102
103
- console . log ( "insert to local comments Success" ) ;
103
+ // console.log("insert to local comments Success");
104
104
$ . ajax ( {
105
105
url : this . props . inserturl ,
106
106
dataType : 'json' ,
@@ -109,9 +109,9 @@ var CommentBox = React.createClass({
109
109
success : function ( res ) { //console.log("insert Success");
110
110
if ( res && res . Status == "Success" ) { //console.log("res&&res.Status==Success");
111
111
//this.setState({data: data});
112
- var comment = res . Result [ 0 ] ; console . log ( res ) ; //console.log(comment);
113
- if ( comment && res . tempid ) { console . log ( "comment && res.tempid" ) ;
114
- var old = RSVP . getCommentById ( comments , res . tempid ) ; console . log ( 'old=' ) ; //console.log(old);console.log('==old end');
112
+ var comment = res . Result [ 0 ] ; // console.log(res);//console.log(comment);
113
+ if ( comment && res . tempid ) { // console.log("comment && res.tempid");
114
+ var old = RSVP . getCommentById ( comments , res . tempid ) ; // console.log('old=');//console.log(old);console.log('==old end');
115
115
old . id = comment . id ;
116
116
old . author = comment . author ;
117
117
old . text = comment . text ;
@@ -161,13 +161,15 @@ var CommentBox = React.createClass({
161
161
child . props . onCommentSubmit = this . handleCommentSubmit ;
162
162
child . props . getCommentById = this . getCommentById ;
163
163
} , this ) ;
164
+ var welcome = this . state . data . length == 0 ?< span > 欢迎留下您的足迹!</ span > :null ;
164
165
var loadMoreBtn = this . state . hasmore ?< div className = "LoadMoreBtn" onClick = { this . loadMore } > 加载更多</ div > :null ;
165
166
return (
166
167
< div className = "commentBox" >
167
168
< div className = "BoxHeader" >
168
169
< b > 驴友评论</ b > < Link to = '/post' className = "writeComment" > 写评论< i className = "icon-writeComment" > </ i > </ Link >
169
170
</ div >
170
171
< CommentList data = { this . state . data } sortBy = "oldest" showTag = { RSVP . config . showCommentTag } />
172
+ { welcome }
171
173
{ loadMoreBtn }
172
174
< CommentBar />
173
175
{ /*
0 commit comments