数据state
This commit is contained in:
parent
8ace7da3a7
commit
b30f2169e4
|
@ -40,6 +40,11 @@ class Activity extends Component{
|
|||
type:undefined,
|
||||
state:undefined,
|
||||
page:1,
|
||||
pr_count:undefined,
|
||||
new_pr_count:undefined,
|
||||
close_issues_count:undefined,
|
||||
open_issues_count:undefined,
|
||||
pr_all_count:undefined,issues_count:undefined,
|
||||
|
||||
data:undefined,
|
||||
project_trends:undefined,
|
||||
|
@ -67,7 +72,13 @@ class Activity extends Component{
|
|||
this.setState({
|
||||
data:result.data,
|
||||
project_trends:result.data.project_trends,
|
||||
isSpin:false
|
||||
isSpin:false,
|
||||
pr_count:result.data.pr_count,
|
||||
new_pr_count:result.data.new_pr_count,
|
||||
close_issues_count:result.data.close_issues_count,
|
||||
open_issues_count:result.data.open_issues_count,
|
||||
pr_all_count:result.data.pr_all_count,
|
||||
issues_count:result.data.issues_count,
|
||||
})
|
||||
window.scrollTo(0,0);
|
||||
}
|
||||
|
@ -113,12 +124,14 @@ class Activity extends Component{
|
|||
</Menu>
|
||||
)
|
||||
render(){
|
||||
const { time , data , page , project_trends , isSpin } = this.state;
|
||||
const { time , data , page , project_trends , isSpin , pr_count , new_pr_count , close_issues_count , open_issues_count , pr_all_count ,issues_count } = this.state;
|
||||
let name = time ? ARRAY.filter(item=>item.id === parseInt(time)) :[{name:"全部"}];
|
||||
const first_per = data && (parseInt(data.pr_count)/parseInt(data.pr_all_count)*100).toFixed(2)+'%';
|
||||
const second_per =data && (parseInt(data.new_pr_count)/parseInt(data.pr_all_count)*100).toFixed(2)+'%';
|
||||
const third_per =data && (parseInt(data.close_issues_count)/parseInt(data.issues_count)*100).toFixed(2)+'%';
|
||||
const fourth_per =data && (parseInt(data.open_issues_count)/parseInt(data.issues_count)*100).toFixed(2)+'%';
|
||||
|
||||
const first_per = pr_all_count > 0 ? `${parseFloat(pr_count/pr_all_count).toFixed(2)*100}%` :"50%";
|
||||
const second_per =pr_all_count > 0 ? `${parseFloat(new_pr_count/pr_all_count).toFixed(2)*100}%` :"50%";
|
||||
const third_per =issues_count > 0 ?`${parseFloat(close_issues_count/issues_count).toFixed(2)*100}%` :"50%";
|
||||
const fourth_per =issues_count > 0 ?`${parseFloat(open_issues_count/issues_count).toFixed(2)*100}%` :"50%";
|
||||
|
||||
return(
|
||||
<div className="main">
|
||||
|
||||
|
|
Loading…
Reference in New Issue