forked from Gitlink/forgeplus-react
动态也数据显示、样式修改
This commit is contained in:
parent
c0afc7a052
commit
c386bcf5e7
|
@ -10,6 +10,10 @@ import ActivityItem from './ActivityItem';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
const LIMIT = 15;
|
const LIMIT = 15;
|
||||||
const ARRAY = [
|
const ARRAY = [
|
||||||
|
{
|
||||||
|
id:"",
|
||||||
|
name:'全部'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id:1,
|
id:1,
|
||||||
name:'1天'
|
name:'1天'
|
||||||
|
@ -32,7 +36,7 @@ class Activity extends Component{
|
||||||
constructor(props){
|
constructor(props){
|
||||||
super(props);
|
super(props);
|
||||||
this.state={
|
this.state={
|
||||||
time:'30',
|
time:undefined,
|
||||||
type:undefined,
|
type:undefined,
|
||||||
state:undefined,
|
state:undefined,
|
||||||
page:1,
|
page:1,
|
||||||
|
@ -65,6 +69,7 @@ class Activity extends Component{
|
||||||
project_trends:result.data.project_trends,
|
project_trends:result.data.project_trends,
|
||||||
isSpin:false
|
isSpin:false
|
||||||
})
|
})
|
||||||
|
window.scrollTo(0,0);
|
||||||
}
|
}
|
||||||
}).catch(error=>{
|
}).catch(error=>{
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -74,19 +79,19 @@ class Activity extends Component{
|
||||||
// 切换周期
|
// 切换周期
|
||||||
changeTime=(e)=>{
|
changeTime=(e)=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
time:e.key,
|
time:e.key ==="item_0"?undefined:e.key,
|
||||||
isSpin:true
|
isSpin:true
|
||||||
})
|
})
|
||||||
const { type,status,page } = this.state;
|
const { type,status,page } = this.state;
|
||||||
this.getInfo(e.key,type,status,page);
|
this.getInfo(e.key ==="item_0"?undefined:e.key,type,status,page);
|
||||||
}
|
}
|
||||||
//筛选
|
//筛选
|
||||||
changeTrends=(type,status)=>{
|
changeTrends=(type,status)=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
type,status
|
type,status,page:1
|
||||||
})
|
})
|
||||||
const {time,page}=this.state;
|
const {time}=this.state;
|
||||||
this.getInfo(time,type,status,page);
|
this.getInfo(time,type,status,1);
|
||||||
}
|
}
|
||||||
// 分页
|
// 分页
|
||||||
ChangePage=(page)=>{
|
ChangePage=(page)=>{
|
||||||
|
@ -109,11 +114,11 @@ class Activity extends Component{
|
||||||
)
|
)
|
||||||
render(){
|
render(){
|
||||||
const { time , data , page , project_trends , isSpin } = this.state;
|
const { time , data , page , project_trends , isSpin } = this.state;
|
||||||
|
let name = time ? ARRAY.filter(item=>item.id === parseInt(time)) :[{name:"全部"}];
|
||||||
let name = time && ARRAY.filter(item=>item.id === parseInt(time)) ;
|
const first_per = data && (parseInt(data.pr_count)/parseInt(data.pr_count+data.new_pr_count)*100).toFixed(2)+'%';
|
||||||
const second_per = (parseInt(data && data.close_issues_count)/parseInt(data && data.issues_count)*100)+'%';
|
const second_per =data && (parseInt(data.new_pr_count)/parseInt(data.pr_count+data.new_pr_count)*100).toFixed(2)+'%';
|
||||||
const third_per = (parseInt(data && data.close_issues_count)/parseInt(data && data.issues_count)*100)+'%';
|
const third_per =data && (parseInt(data.close_issues_count)/parseInt(data.issues_count)*100).toFixed(2)+'%';
|
||||||
const fourth_per = (parseInt(data && data.open_issues_count)/parseInt(data && data.issues_count)*100)+'%';
|
const fourth_per =data && (parseInt(data.open_issues_count)/parseInt(data.issues_count)*100).toFixed(2)+'%';
|
||||||
return(
|
return(
|
||||||
<div className="main">
|
<div className="main">
|
||||||
|
|
||||||
|
@ -122,7 +127,7 @@ class Activity extends Component{
|
||||||
<div className="orderInfo">
|
<div className="orderInfo">
|
||||||
<div>
|
<div>
|
||||||
<div className="percentLine prPercent">
|
<div className="percentLine prPercent">
|
||||||
<p className="percent_purple" style={{width:'100%'}}></p>
|
<p className="percent_purple" style={{width:first_per}}></p>
|
||||||
<p className="percent_green resetStyle" style={{width:`${second_per}`}}></p>
|
<p className="percent_green resetStyle" style={{width:`${second_per}`}}></p>
|
||||||
</div>
|
</div>
|
||||||
<span>{data && data.pr_all_count}合并请求</span>
|
<span>{data && data.pr_all_count}合并请求</span>
|
||||||
|
@ -132,7 +137,7 @@ class Activity extends Component{
|
||||||
<p className="percent_red" style={{width:`${third_per}`}}></p>
|
<p className="percent_red" style={{width:`${third_per}`}}></p>
|
||||||
<p className="percent_green" style={{width:`${fourth_per}`}}></p>
|
<p className="percent_green" style={{width:`${fourth_per}`}}></p>
|
||||||
</div>
|
</div>
|
||||||
<span>{data && data.issues_count}任务</span>
|
<span>{data && data.issues_count}易修</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ul className="percentBox">
|
<ul className="percentBox">
|
||||||
|
@ -146,11 +151,11 @@ class Activity extends Component{
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span className="red">{data && data.close_issues_count}</span>
|
<span className="red">{data && data.close_issues_count}</span>
|
||||||
<span className="change" onClick={()=>this.changeTrends("Issue","close")}>已关闭的任务</span>
|
<span className="change" onClick={()=>this.changeTrends("Issue","close")}>已关闭的易修</span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span className="green">{data && data.open_issues_count}</span>
|
<span className="green">{data && data.open_issues_count}</span>
|
||||||
<span className="change" onClick={()=>this.changeTrends("Issue","create")}>未处理的任务</span>
|
<span className="change" onClick={()=>this.changeTrends("Issue","create")}>未处理的易修</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue