xmcp 7 years ago
parent
commit
2a42c0f2b7
  1. 11308
      package-lock.json
  2. 2
      src/Common.js
  3. 5
      src/Flows.css
  4. 14
      src/Flows.js
  5. 5
      src/Sidebar.css
  6. 6
      src/Sidebar.js
  7. 3
      src/Title.css
  8. 2
      src/Title.js
  9. 2
      src/UserAction.js

11308
package-lock.json generated

File diff suppressed because it is too large Load Diff

2
src/Common.js

@ -12,7 +12,7 @@ const chinese_format=buildFormatter(chineseStrings);
export const API_BASE=window.location.protocol==='https:' ? '/api_proxy' : 'http://www.pkuhelper.com/services/pkuhole';
const PID_RE=/(^|[^\d])([1-9]\d{4,5})(?!\d)/g;
const NICKNAME_RE=/(^|[^A-Za-z])((?:(?:Angry|Baby|Crazy|Diligent|Excited|Fat|Greedy|Hungry|Interesting|Japanese|Kind|Little|Magic|Naïve|Old|Powerful|Quiet|Rich|Superman|THU|Undefined|Valuable|Wifeless|Xiangbuchulai|Young|Zombie)\s)?(?:Alice|Bob|Carol|Dave|Eve|Francis|Grace|Hans|Isabella|Jason|Kate|Louis|Margaret|Nathan|Olivia|Paul|Queen|Richard|Susan|Thomas|Uma|Vivian|Winnie|Xander|Yasmine|Zach)|You Win|洞主)(?![A-Za-z])/gi;
const NICKNAME_RE=/(^|[^A-Za-z])((?:(?:Angry|Baby|Crazy|Diligent|Excited|Fat|Greedy|Hungry|Interesting|Japanese|Kind|Little|Magic|Naïve|Old|Powerful|Quiet|Rich|Superman|THU|Undefined|Valuable|Wifeless|Xiangbuchulai|Young|Zombie)\s)?(?:Alice|Bob|Carol|Dave|Eve|Francis|Grace|Hans|Isabella|Jason|Kate|Louis|Margaret|Nathan|Olivia|Paul|Queen|Richard|Susan|Thomas|Uma|Vivian|Winnie|Xander|Yasmine|Zach)|You Win(?: \d+)?|洞主)(?![A-Za-z])/gi;
function pad2(x) {
return x<10 ? '0'+x : ''+x;

5
src/Flows.css

@ -119,6 +119,7 @@
.flow-item-row p.img {
text-align: center;
margin-top: .5em;
}
.flow-item-row p.img img {
max-width: 100%;
@ -147,4 +148,8 @@
.box-content {
margin: .5em 0;
}
.box-id {
color: #666666;
}

14
src/Flows.js

@ -131,7 +131,7 @@ class FlowSidebar extends PureComponent {
this.syncState=props.sync_state||(()=>{});
}
load_replies() {
load_replies(update_count=true) {
this.setState({
loading_status: 'loading',
});
@ -139,6 +139,9 @@ class FlowSidebar extends PureComponent {
.then((json)=>{
this.setState((prev,props)=>({
replies: json.data,
info: update_count ? Object.assign({}, prev.info, {
reply: ''+json.data.length,
}) : prev.info,
attention: !!json.attention,
loading_status: 'done',
}), ()=>{
@ -249,7 +252,7 @@ class FlowSidebar extends PureComponent {
</div>
<FlowItem info={this.state.info} attention={this.state.attention} img_clickable={true}
color_picker={this.color_picker} show_pid={this.show_pid} replies={this.state.replies} />
{(this.props.deletion_detect && parseInt(this.state.info.reply)!==this.state.replies.length) &&
{(this.props.deletion_detect && parseInt(this.state.info.reply)>this.state.replies.length) &&
<div className="box box-tip flow-item box-danger">
{parseInt(this.state.info.reply)-this.state.replies.length} 条回复被删除
</div>
@ -283,11 +286,11 @@ class FlowItemRow extends PureComponent {
componentDidMount() {
if(parseInt(this.state.info.reply,10)) {
this.load_replies();
this.load_replies(null,/*update_count=*/false);
}
}
load_replies(callback) {
load_replies(callback,update_count=true) {
console.log('fetching reply',this.state.info.pid);
this.setState({
reply_status: 'loading',
@ -296,6 +299,9 @@ class FlowItemRow extends PureComponent {
.then((json)=>{
this.setState((prev,props)=>({
replies: json.data,
info: update_count ? Object.assign({}, prev.info, {
reply: ''+json.data.length,
}) : prev.info,
attention: !!json.attention,
reply_status: 'done',
}),callback);

5
src/Sidebar.css

@ -32,6 +32,11 @@
left: 700px;
}
.sidebar-title {
text-shadow: 0 0 3px white;
font-weight: bold;
}
@media screen and (max-width: 1200px) {
.sidebar {
width: 550px;

6
src/Sidebar.js

@ -6,9 +6,9 @@ export function Sidebar(props) {
<div className={props.content ? 'sidebar-on' : ''}>
<div className="sidebar-shadow" onClick={props.do_close} />
<div className="sidebar">
<p>
<a onClick={props.do_close}>×</a>
&nbsp;{props.title}
<p className="sidebar-title">
<a onClick={props.do_close}>&nbsp;×&nbsp;</a>
{props.title}
</p>
{props.content}
</div>

3
src/Title.css

@ -33,8 +33,9 @@
display: inline-block;
}
.control-bar input {
.control-search {
flex: auto;
color: black;
background-color: rgba(255,255,255,.5);
margin: 0 .5em;
}

2
src/Title.js

@ -118,7 +118,7 @@ class ControlBar extends PureComponent {
<span className="icon icon-attention" />
</a>
}
<input value={this.state.search_text} placeholder="搜索 或 #PID"
<input className="control-search" value={this.state.search_text} placeholder="搜索 或 #PID"
onChange={this.on_change_bound} onKeyPress={this.on_keypress_bound}
/>
<a className="control-btn" onClick={()=>{

2
src/UserAction.js

@ -44,7 +44,7 @@ export class LoginForm extends Component {
'&msg='+md5(param+ISOP_APPCODE),
{mode: 'no-cors'}
);
alert('短信验证码应该会发到您的手机上,请注意查收!');
alert('如果学号存在,短信验证码将会发到您的手机上,请注意查收!');
}
do_login(set_token) {

Loading…
Cancel
Save