Merge pull request '动态页面数据显示、以及样式更改' (#172) from caishi/forgeplus-react:pre_develop_dev into pre_develop_dev

This commit is contained in:
jasder 2021-10-14 14:06:17 +08:00
commit c45a6ffe1a
1 changed files with 20 additions and 15 deletions

View File

@ -10,6 +10,10 @@ import ActivityItem from './ActivityItem';
import axios from 'axios';
const LIMIT = 15;
const ARRAY = [
{
id:"",
name:'全部'
},
{
id:1,
name:'1天'
@ -32,7 +36,7 @@ class Activity extends Component{
constructor(props){
super(props);
this.state={
time:'30',
time:undefined,
type:undefined,
state:undefined,
page:1,
@ -65,6 +69,7 @@ class Activity extends Component{
project_trends:result.data.project_trends,
isSpin:false
})
window.scrollTo(0,0);
}
}).catch(error=>{
console.log(error);
@ -74,19 +79,19 @@ class Activity extends Component{
// 切换周期
changeTime=(e)=>{
this.setState({
time:e.key,
time:e.key ==="item_0"?undefined:e.key,
isSpin:true
})
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)=>{
this.setState({
type,status
type,status,page:1
})
const {time,page}=this.state;
this.getInfo(time,type,status,page);
const {time}=this.state;
this.getInfo(time,type,status,1);
}
// 分页
ChangePage=(page)=>{
@ -109,11 +114,11 @@ class Activity extends Component{
)
render(){
const { time , data , page , project_trends , isSpin } = this.state;
let name = time && ARRAY.filter(item=>item.id === parseInt(time)) ;
const second_per = (parseInt(data && data.close_issues_count)/parseInt(data && data.issues_count)*100)+'%';
const third_per = (parseInt(data && data.close_issues_count)/parseInt(data && data.issues_count)*100)+'%';
const fourth_per = (parseInt(data && data.open_issues_count)/parseInt(data && data.issues_count)*100)+'%';
let name = time ? ARRAY.filter(item=>item.id === parseInt(time)) :[{name:"全部"}];
const first_per = data && (parseInt(data.pr_count)/parseInt(data.pr_count+data.new_pr_count)*100).toFixed(2)+'%';
const second_per =data && (parseInt(data.new_pr_count)/parseInt(data.pr_count+data.new_pr_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)+'%';
return(
<div className="main">
@ -122,7 +127,7 @@ class Activity extends Component{
<div className="orderInfo">
<div>
<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>
</div>
<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_green" style={{width:`${fourth_per}`}}></p>
</div>
<span>{data && data.issues_count}任务</span>
<span>{data && data.issues_count}易修</span>
</div>
</div>
<ul className="percentBox">
@ -146,11 +151,11 @@ class Activity extends Component{
</li>
<li>
<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>
<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>
</ul>
</div>