持久化存储是否允许搜索 等细节优化
This commit is contained in:
@@ -20,6 +20,7 @@ class App extends Component {
|
||||
super(props);
|
||||
load_config();
|
||||
load_attentions();
|
||||
window.AS_BACKUP = localStorage['DEFAULT_ALLOW_SEARCH'] ? true : false;
|
||||
listen_darkmode(
|
||||
{ default: undefined, light: false, dark: true }[
|
||||
window.config.color_scheme
|
||||
|
||||
19
src/Flows.js
19
src/Flows.js
@@ -572,7 +572,8 @@ class FlowSidebar extends PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
report(text = '') {
|
||||
report(event, text = '') {
|
||||
console.log(text);
|
||||
let reason = prompt(`举报 #${this.state.info.pid} 的理由:`, text);
|
||||
if (reason !== null) {
|
||||
API.report(this.state.info.pid, reason, this.props.token)
|
||||
@@ -842,7 +843,7 @@ class FlowSidebar extends PureComponent {
|
||||
do_block={() => {this.block(
|
||||
reply.name, 'comment', reply.cid, this.load_replies.bind(this)
|
||||
)}}
|
||||
do_report={() => {this.report(`评论区${reply.name},评论id ${reply.cid}`)}}
|
||||
do_report={(e) => {this.report(e, `评论区${reply.name},评论id ${reply.cid}`)}}
|
||||
/>
|
||||
</ClickHandler>
|
||||
</LazyLoad>
|
||||
@@ -1257,8 +1258,11 @@ export class Flow extends PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
submode: this.props.mode == 'list' ? (window.config.by_c ? 1 : 0) : 0,
|
||||
subflow_render_key: +new Date(),
|
||||
submode: this.props.mode == 'list' ? (
|
||||
window.LIST_SUBMOD_BACKUP !== undefined ? window.LIST_SUBMOD_BACKUP : (
|
||||
(window.config.by_c ? 1 : 0)
|
||||
)
|
||||
) : 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1273,9 +1277,10 @@ export class Flow extends PureComponent {
|
||||
}
|
||||
|
||||
set_submode(submode) {
|
||||
if (this.props.mode == 'list')
|
||||
window.LIST_SUBMOD_BACKUP = submode;
|
||||
this.setState({
|
||||
submode: submode,
|
||||
subflow_render_key: +new Date(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1297,10 +1302,10 @@ export class Flow extends PureComponent {
|
||||
</div>
|
||||
|
||||
<SubFlow
|
||||
key={this.state.subflow_render_key}
|
||||
key={submode}
|
||||
show_sidebar={this.props.show_sidebar}
|
||||
mode={this.props.mode}
|
||||
submode={this.state.submode}
|
||||
submode={submode}
|
||||
search_text={this.props.search_text}
|
||||
token={this.props.token}
|
||||
/>
|
||||
|
||||
@@ -121,7 +121,7 @@ class ControlBar extends PureComponent {
|
||||
onClick={this.do_refresh_bound}
|
||||
>
|
||||
<span className="icon icon-refresh" />
|
||||
<span className="control-btn-label">最新</span>
|
||||
<span className="control-btn-label">刷新</span>
|
||||
</a>
|
||||
{!!token && (
|
||||
<a
|
||||
|
||||
@@ -396,6 +396,7 @@ export class PostForm extends Component {
|
||||
const { cw, allow_search, has_poll, poll_options } = this.state;
|
||||
window.CW_BACKUP = cw;
|
||||
window.AS_BACKUP = allow_search;
|
||||
localStorage['DEFAULT_ALLOW_SEARCH'] = allow_search ? '1' : '';
|
||||
window.POLL_BACKUP = has_poll ? JSON.stringify(poll_options) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,10 +108,3 @@
|
||||
.icon-eye-blocked:before {
|
||||
content: "\e9d1";
|
||||
}
|
||||
.icon-trash:before {
|
||||
content: "\1f5d1";
|
||||
}
|
||||
|
||||
.icon-block:before {
|
||||
content: "\1F6C7";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user