diff options
Diffstat (limited to 'vnext')
-rw-r--r-- | vnext/src/components/Message.js | 4 | ||||
-rw-r--r-- | vnext/src/components/MessageInput.js | 5 | ||||
-rw-r--r-- | vnext/src/components/Post.js | 6 |
3 files changed, 9 insertions, 6 deletions
diff --git a/vnext/src/components/Message.js b/vnext/src/components/Message.js index e9d3eebd..585ae1ac 100644 --- a/vnext/src/components/Message.js +++ b/vnext/src/components/Message.js @@ -51,13 +51,13 @@ export default function Message(props) { <span> Recommend</span> </a> ) : visitor.uid > 0 ? ( - <a href="/post?body=!+%23{{ msg.mid }}" className="a-like msg-button"> + <Link to={{pathname: "/post", search: `?body=!+%23${msg.mid}`}} className="a-like msg-button"> <span className="msg-button-icon"> <Icon name="ei-heart" size="s" /> {msg.likes > 0 && (` ${msg.likes}`)} </span> <span> Recommend</span> - </a> + </Link> ) : ( <a href="/login" className="a-login msg-button"> <span className="msg-button-icon"> diff --git a/vnext/src/components/MessageInput.js b/vnext/src/components/MessageInput.js index 5ef654a8..5d603a4b 100644 --- a/vnext/src/components/MessageInput.js +++ b/vnext/src/components/MessageInput.js @@ -16,7 +16,7 @@ export default class MessageInput extends React.Component { mid: this.props.data.mid, rid: this.props.data.rid || 0, to: this.props.data.to || {}, - body: '', + body: this.props.text || '', attach: '' } } @@ -131,5 +131,6 @@ const textInputStyle = { MessageInput.propTypes = { data: MessageType.isRequired, onSend: PropTypes.func.isRequired, - rows: PropTypes.string + rows: PropTypes.string, + text: PropTypes.string };
\ No newline at end of file diff --git a/vnext/src/components/Post.js b/vnext/src/components/Post.js index fd577603..7bde7432 100644 --- a/vnext/src/components/Post.js +++ b/vnext/src/components/Post.js @@ -1,4 +1,5 @@ import React from 'react'; +import * as qs from 'query-string'; import MessageInput from './MessageInput'; @@ -7,9 +8,10 @@ import { post } from '../api'; export default class Post extends React.Component { constructor(props) { super(props) + let params = qs.parse(window.location.search); this.state = { attach: '', - body: '' + body: params.body || '' } this.fileinput = React.createRef(); console.log(props) @@ -39,7 +41,7 @@ export default class Post extends React.Component { render() { return ( <article> - <MessageInput rows="7" data={{ mid: 0, timestamp: "0" }} onSend={this.postMessage}> + <MessageInput rows="7" text={this.state.body} data={{ mid: 0, timestamp: "0" }} onSend={this.postMessage}> *weather It's very cold today! </MessageInput> </article> |