提交 0ff58e30 编写于 作者: YYYTDMS's avatar YYYTDMS

330_调整4.0

上级 39f10702
......@@ -26,10 +26,21 @@ class Achievement extends Component {
modalIndex: 0,
size: 0,
achievements: [],
hasFresh:false,
}
this.getAchievements = this.getAchievements.bind(this);
}
componentDidUpdate(){
if(this.props.show&&!this.state.hasFresh){
this.getAchievements();
this.setState({hasFresh:true})
}
if(!this.props.show&&this.state.hasFresh){
this.setState({hasFresh:false})
}
}
async componentDidMount() {
await this.getAchievements();
}
......@@ -45,6 +56,7 @@ class Achievement extends Component {
.then(function (res) {
tmp = res.data.data;
//console.log(tmp)
})
.catch(function (error) {
console.log(error)
......@@ -106,7 +118,7 @@ class Achievement extends Component {
transparent={true}
visible={this.state.modalVisible}
onRequestClose={() => {
alert("Modal has been closed.");
// alert("Modal has been closed.");
this.setState({modalVisible: false});
}}>
......
......@@ -37,12 +37,22 @@ class Analysis extends Component {
user_id: '',
records: [],
start_date: '',
hasFresh:false,
}
this.getStudyRecords = this.getStudyRecords.bind(this);
this.getAnalysis=this.getAnalysis.bind(this);
}
componentDidUpdate(){
if(this.props.show&&!this.state.hasFresh){
this.getAnalysis();
this.setState({hasFresh:true})
}
if(!this.props.show&&this.state.hasFresh){
this.setState({hasFresh:false})
}
}
componentDidMount() {
this.getAnalysis();
......
......@@ -24,11 +24,20 @@ class Outline extends Component {
days:[],
size: 0,
records: [],
hasFresh:false,
}
this.getstudyRecords=this.getstudyRecords.bind(this);
}
componentDidUpdate(){
if(this.props.show&&!this.state.hasFresh){
this.getstudyRecords();
this.setState({hasFresh:true})
}
if(!this.props.show&&this.state.hasFresh){
this.setState({hasFresh:false})
}
}
async componentDidMount() {
await this.getstudyRecords();
......
......@@ -56,6 +56,7 @@ class Rank extends Component {
tmp.ranks.map((item,index) => {
tmp.ranks[index].display = true;
tmp.ranks[index].study_duration=tmp.ranks[index].study_duration.toFixed(2);
})
await this.setState({
......
......@@ -31,6 +31,7 @@ class Person extends Component {
level: 1,
exp: 0,
dan_name: '青铜',
hasFresh:false,
};
}
......@@ -216,6 +217,16 @@ class Person extends Component {
});
};
componentDidUpdate(){
if(this.props.show&&!this.state.hasFresh){
this.getInfo()
this.setState({hasFresh:true})
}
if(!this.props.show&&this.state.hasFresh){
this.setState({hasFresh:false})
}
}
render() {
const {
image_url,
......@@ -236,6 +247,7 @@ class Person extends Component {
王者: require('../../images/King.png'),
};
const {user_sno} = this.props.user;
return (
<View style={{
position: 'relative',
......
......@@ -324,12 +324,12 @@ class RangePKStudy extends Component {
} = this.state;
return (
<View style={styles.container} {...this.panResponder.panHandlers}>
<View style={styles.container}>
<MyTitle
title={'当前的排名为 第' + ranking + ''}
containerStyle={styles.containerTitle}
/>
<View style={styles.containerMain}>
<View style={styles.containerMain} {...this.panResponder.panHandlers}>
<MyStatistics
text={{
first: {
......@@ -376,7 +376,7 @@ class RangePKStudy extends Component {
}}
/>
</View>
<View style={styles.containerTimer}>
<View style={styles.containerTimer} {...this.panResponder.panHandlers}>
<Text style={styles.text}>{'<--'}左滑打开排行榜</Text>
<Text style={styles.textTimer}>{parseTime(timeInTheMatch)}</Text>
</View>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册