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