|
|
@ -1,5 +1,6 @@ |
|
|
|
import React, { PureComponent } from 'react'; |
|
|
|
import React, { PureComponent } from 'react'; |
|
|
|
import { Time } from './Common'; |
|
|
|
import { Time } from './Common'; |
|
|
|
|
|
|
|
import { get_json } from './infrastructure/functions'; |
|
|
|
|
|
|
|
|
|
|
|
export class MessageViewer extends PureComponent { |
|
|
|
export class MessageViewer extends PureComponent { |
|
|
|
constructor(props) { |
|
|
|
constructor(props) { |
|
|
@ -22,16 +23,16 @@ export class MessageViewer extends PureComponent { |
|
|
|
}, |
|
|
|
}, |
|
|
|
() => { |
|
|
|
() => { |
|
|
|
fetch( |
|
|
|
fetch( |
|
|
|
'/_api/v1/system_msg?user_token=' + |
|
|
|
'/_api/v1/systemlog?user_token=' + |
|
|
|
encodeURIComponent(this.props.token) |
|
|
|
encodeURIComponent(this.props.token) |
|
|
|
) |
|
|
|
) |
|
|
|
.then(get_json) |
|
|
|
.then(get_json) |
|
|
|
.then((json) => { |
|
|
|
.then((json) => { |
|
|
|
if (json.error) throw new Error(json.error); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
loading_status: 'done', |
|
|
|
loading_status: 'done', |
|
|
|
msg: json.result, |
|
|
|
msg: json.data, |
|
|
|
|
|
|
|
start_time: json.start_time, |
|
|
|
|
|
|
|
salt: json.salt |
|
|
|
}); |
|
|
|
}); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
.catch((err) => { |
|
|
@ -61,17 +62,32 @@ export class MessageViewer extends PureComponent { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
else if (this.state.loading_status === 'done') |
|
|
|
else if (this.state.loading_status === 'done') |
|
|
|
return this.state.msg.map((msg) => ( |
|
|
|
return ( |
|
|
|
|
|
|
|
<> |
|
|
|
|
|
|
|
<br/> |
|
|
|
|
|
|
|
<p> |
|
|
|
|
|
|
|
最近一次重置 <Time stamp={this.state.start_time} short={false} /> |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
<p> |
|
|
|
|
|
|
|
随机盐 <b>{this.state.salt}</b> |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
{this.state.msg.map((msg) => ( |
|
|
|
<div className="box" key={msg.timestamp}> |
|
|
|
<div className="box" key={msg.timestamp}> |
|
|
|
<div className="box-header"> |
|
|
|
<div className="box-header"> |
|
|
|
<Time stamp={msg.timestamp} short={false} /> |
|
|
|
<Time stamp={msg.timestamp} short={false} /> |
|
|
|
<b>{msg.title}</b> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<b>{msg.type}</b> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span className="box-header-name">{msg.user}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="box-content"> |
|
|
|
<div className="box-content"> |
|
|
|
<pre>{msg.content}</pre> |
|
|
|
<pre>{msg.detail}</pre> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)); |
|
|
|
))} |
|
|
|
|
|
|
|
</> |
|
|
|
|
|
|
|
) |
|
|
|
else return null; |
|
|
|
else return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|