@@ -7,50 +7,57 @@ import { Avatar, Input } from 'antd';
77const { TextArea } = Input ;
88
99class Comment extends Component {
10- constructor ( props ) {
11- super ( props ) ;
12- this . state = {
13- isLoading : false ,
14- content : '' ,
15- } ;
16- }
10+ constructor ( props ) {
11+ super ( props ) ;
12+ this . state = {
13+ isLoading : false ,
14+ content : '' ,
15+ } ;
16+ }
1717
18- componentWillMount ( ) { }
18+ componentWillMount ( ) { }
1919
20- render ( ) {
21- let userInfo = {
22- name : '' ,
23- } ;
24- if ( window . sessionStorage . userInfo ) {
25- userInfo = JSON . parse ( window . sessionStorage . userInfo ) ;
26- }
27- return (
28- < div className = "comment" >
29- < a className = "avatar" href = "" >
30- < Avatar className = "auth-logo" size = { 50 } icon = "user" />
31- </ a >
32- < h3 > { userInfo . name } </ h3 >
33- < TextArea
34- className = "textarea"
35- name = "content"
36- value = { this . props . content }
37- onChange = { this . props . handleChange }
38- placeholder = "文明社会,理性评论..."
39- rows = { 4 }
40- />
41- < div className = "new-comment write-function-block" >
42- { this . props . isSubmitLoading ? (
43- < a className = "btn btn-send" > 发送中...</ a >
44- ) : (
45- < a onClick = { this . props . handleAddComment } className = "btn btn-send" > 发送</ a >
46- ) }
47- < a className = "cancel" >
48- 取消
49- </ a >
50- </ div >
51- </ div >
52- ) ;
53- }
20+ render ( ) {
21+ let userInfo = {
22+ id : '' ,
23+ name : '' ,
24+ avatar : '' ,
25+ } ;
26+ if ( window . sessionStorage . userInfo ) {
27+ userInfo = JSON . parse ( window . sessionStorage . userInfo ) ;
28+ }
29+ return (
30+ < div className = "comment" >
31+ < a className = "avatar" href = "" >
32+ < Avatar
33+ className = "auth-logo"
34+ size = { 50 }
35+ icon = "user"
36+ src = { userInfo . avatar }
37+ />
38+ </ a >
39+ < h3 > { userInfo . name } </ h3 >
40+ < TextArea
41+ className = "textarea"
42+ name = "content"
43+ value = { this . props . content }
44+ onChange = { this . props . handleChange }
45+ placeholder = "文明社会,理性评论..."
46+ rows = { 4 }
47+ />
48+ < div className = "new-comment write-function-block" >
49+ { this . props . isSubmitLoading ? (
50+ < a className = "btn btn-send" > 发送中...</ a >
51+ ) : (
52+ < a onClick = { this . props . handleAddComment } className = "btn btn-send" >
53+ 发送
54+ </ a >
55+ ) }
56+ < a className = "cancel" > 取消</ a >
57+ </ div >
58+ </ div >
59+ ) ;
60+ }
5461}
5562
5663export default Comment ;
0 commit comments