From e7d57c9d7a2e87b9b1f1395fd9e75c22cb0fd638 Mon Sep 17 00:00:00 2001 From: hole-thu Date: Tue, 8 Sep 2020 11:22:17 +0800 Subject: [PATCH] =?UTF-8?q?15=E5=88=86=E9=92=9F=E8=87=AA=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E4=B8=B4=E6=97=B6=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common.js | 2 +- src/Flows.js | 2 +- src/Message.css | 19 +++++++++++++++++++ src/Message.js | 32 ++++++++++++++++++++++++++++++-- src/Title.js | 1 + 5 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 src/Message.css diff --git a/src/Common.js b/src/Common.js index 32de7d1..0db432d 100644 --- a/src/Common.js +++ b/src/Common.js @@ -142,7 +142,7 @@ export class HighlightedMarkdown extends Component { {node.alt} ); diff --git a/src/Flows.js b/src/Flows.js index 0b80a19..9e9dc95 100644 --- a/src/Flows.js +++ b/src/Flows.js @@ -420,7 +420,7 @@ class FlowSidebar extends PureComponent { this.setState({ loading_status: 'done', }); - alert('设置关注失败'); + alert('设置关注失败\n' + e); console.error(e); }); } diff --git a/src/Message.css b/src/Message.css new file mode 100644 index 0000000..4277fe9 --- /dev/null +++ b/src/Message.css @@ -0,0 +1,19 @@ +.input-prepend { + display: inline-block; + background-color: #c9cccf; + border: 1px solid #ced4da; + height: 28px; + padding: 3px; + vertical-align: top; +} + +.input-suf { + border-top-left-radius: 0; + border-bottom-left-radius: 0; + width: 90px; + height: 28px; + border: 1px solid #ced4da; + vertical-align: top; + padding: 3px; +} + diff --git a/src/Message.js b/src/Message.js index 0de7b29..0bfc985 100644 --- a/src/Message.js +++ b/src/Message.js @@ -2,6 +2,8 @@ import React, { PureComponent } from 'react'; import { Time } from './Common'; import { get_json } from './infrastructure/functions'; +import './Message.css'; + export class MessageViewer extends PureComponent { constructor(props) { super(props); @@ -9,6 +11,7 @@ export class MessageViewer extends PureComponent { loading_status: 'idle', msg: [], }; + this.input_suf_ref=React.createRef(); } componentDidMount() { @@ -32,7 +35,8 @@ export class MessageViewer extends PureComponent { loading_status: 'done', msg: json.data, start_time: json.start_time, - salt: json.salt + salt: json.salt, + tmp_token: json.tmp_token, }); }) .catch((err) => { @@ -46,6 +50,20 @@ export class MessageViewer extends PureComponent { ); } + do_set_token() { + if (this.state.loading_status==='loading') + return; + if (!this.input_suf_ref.current.value) { + alert("不建议后缀为空"); + return; + } + let tt = this.state.tmp_token + '_' + this.input_suf_ref.current.value; + console.log(tt); + localStorage['TOKEN'] = tt; + alert('已登录为临时用户,过期后需注销重新登陆'); + window.location.reload(); + } + render() { if (this.state.loading_status === 'loading') return

加载中……

; @@ -71,8 +89,18 @@ export class MessageViewer extends PureComponent {

随机盐 {this.state.salt}

+
+
+

15分钟临时token:

+
{this.state.tmp_token}_
+ + +
{this.state.msg.map((msg) => ( -
+