show admin list & you are admin
This commit is contained in:
@@ -1473,6 +1473,10 @@ class SubFlow extends PureComponent {
|
||||
});
|
||||
localStorage['_LATEST_POST_ID'] = '' + max_id;
|
||||
}
|
||||
|
||||
if (page === 1) {
|
||||
window.IS_ADMIN = json.is_admin;
|
||||
window.IS_CANDIDATE = json.is_candidate;
|
||||
window.TITLE = json.custom_title;
|
||||
window.AUTO_BLCOK = json.auto_block_rank;
|
||||
if (
|
||||
@@ -1482,6 +1486,8 @@ class SubFlow extends PureComponent {
|
||||
window.TITLE_SECRET = json.title_secret;
|
||||
localStorage['TITLE_SECRET'] = json.title_secret;
|
||||
}
|
||||
}
|
||||
|
||||
json.data.forEach((x) => {
|
||||
if (x.comments) {
|
||||
let comment_json = {
|
||||
|
||||
@@ -16,3 +16,11 @@
|
||||
vertical-align: top;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.admin-card {
|
||||
display: inline-block;
|
||||
background: #3332;
|
||||
margin-left: 7px;
|
||||
padding: 1px 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ export class MessageViewer extends PureComponent {
|
||||
msg: json.data,
|
||||
start_time: json.start_time,
|
||||
salt: json.salt,
|
||||
admin_list: json.admin_list,
|
||||
candidate_list: json.candidate_list,
|
||||
tmp_token: json.tmp_token,
|
||||
});
|
||||
})
|
||||
@@ -107,6 +109,24 @@ export class MessageViewer extends PureComponent {
|
||||
使用
|
||||
</button>
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
当前管理员:
|
||||
{this.state.admin_list.map((admin) => (
|
||||
<span className="admin-card" key={admin}>
|
||||
{admin}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
当前候选管理员:
|
||||
{this.state.candidate_list.map((admin) => (
|
||||
<span className="admin-card" key={admin}>
|
||||
{admin}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
{this.state.msg.map((msg) => (
|
||||
<div className="box" key={msg.type + msg.timestamp}>
|
||||
<div className="box-header">
|
||||
|
||||
@@ -155,3 +155,9 @@
|
||||
.update-title-btn {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.role-card {
|
||||
padding: 5px;
|
||||
background: #d33a;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
@@ -141,6 +141,7 @@ export class LoginForm extends Component {
|
||||
this.state = {
|
||||
custom_title: window.TITLE || '',
|
||||
auto_block_rank: window.AUTO_BLCOK || 2,
|
||||
is_admin: window.IS_ADMIN,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -166,6 +167,9 @@ export class LoginForm extends Component {
|
||||
window.TITLE_SECRET = j.data;
|
||||
localStorage['TITLE_SECRET'] = j.data;
|
||||
alert('专属头衔设置成功');
|
||||
window.IS_ADMIN = false;
|
||||
window.IS_CANDIDATE = false;
|
||||
this.setState({ is_admin: false });
|
||||
})
|
||||
.catch((err) => alert('设置头衔出错了:\n' + err));
|
||||
}
|
||||
@@ -243,6 +247,10 @@ export class LoginForm extends Component {
|
||||
Token仅用于开发bot,切勿告知他人。若怀疑被盗号请刷新Token(刷新功能即将上线)。
|
||||
</p>
|
||||
<p>
|
||||
{this.state.is_admin && (
|
||||
<span className="role-card">你是管理员</span>
|
||||
)}
|
||||
<br />
|
||||
专属头衔:
|
||||
<input
|
||||
value={this.state.custom_title}
|
||||
@@ -343,6 +351,7 @@ export class ReplyForm extends Component {
|
||||
this.global_keypress_handler_bound =
|
||||
this.global_keypress_handler.bind(this);
|
||||
this.color_picker = new ColorPicker();
|
||||
this.forced_use_title = window.IS_ADMIN || window.IS_CANDIDATE;
|
||||
}
|
||||
|
||||
global_keypress_handler(e) {
|
||||
@@ -492,7 +501,8 @@ export class ReplyForm extends Component {
|
||||
<input
|
||||
type="checkbox"
|
||||
onChange={this.on_use_title_change_bound}
|
||||
checked={this.state.use_title}
|
||||
checked={this.forced_use_title || this.state.use_title}
|
||||
disabled={this.forced_use_title}
|
||||
/>{' '}
|
||||
使用头衔
|
||||
</label>
|
||||
@@ -527,6 +537,7 @@ export class PostForm extends Component {
|
||||
this.on_cw_change_bound = this.on_cw_change.bind(this);
|
||||
this.on_poll_option_change_bound = this.on_poll_option_change.bind(this);
|
||||
this.color_picker = new ColorPicker();
|
||||
this.forced_use_title = window.IS_ADMIN || window.IS_CANDIDATE;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -784,7 +795,8 @@ export class PostForm extends Component {
|
||||
<input
|
||||
type="checkbox"
|
||||
onChange={this.on_use_title_change_bound}
|
||||
checked={this.state.use_title}
|
||||
checked={this.forced_use_title || this.state.use_title}
|
||||
disabled={this.forced_use_title}
|
||||
/>{' '}
|
||||
使用头衔
|
||||
</label>
|
||||
|
||||
Reference in New Issue
Block a user