Commit aaa008be by wangshuo

组队信息增加需求

parent 16d88d53
...@@ -5,6 +5,7 @@ import { Toast } from 'antd-mobile'; ...@@ -5,6 +5,7 @@ import { Toast } from 'antd-mobile';
import {withRouter} from 'react-router-dom'; import {withRouter} from 'react-router-dom';
import {compose} from "redux" import {compose} from "redux"
import { connect } from "react-redux"; import { connect } from "react-redux";
import jsCookie from 'js-cookie'
class TeamInfo extends Component { class TeamInfo extends Component {
constructor(props) { constructor(props) {
...@@ -36,7 +37,7 @@ class TeamInfo extends Component { ...@@ -36,7 +37,7 @@ class TeamInfo extends Component {
prize_info, prize_info,
is_my_team, is_my_team,
info, info,
member: this.fillTeam(member), member: this.fillTeam(member, is_my_team),
removable_data, removable_data,
my_team my_team
}) })
...@@ -117,8 +118,22 @@ class TeamInfo extends Component { ...@@ -117,8 +118,22 @@ class TeamInfo extends Component {
} }
// 队伍成员信息必须满五个 不满的需要填充 // 队伍成员信息必须满五个 不满的需要填充
fillTeam = (list) => { fillTeam = (list, is_my_team) => {
let len = list.length; let len = list.length;
// 没有创建队伍 并且没有加入他人队伍
if(len === 0 && !is_my_team) {
list.push({
head_img: jsCookie.get('avatar_file'),
user_name: jsCookie.get('user_name'),
})
for(let i=0;i<4;i++) {
list.push({
head_img: '',
user_name: '',
nobody: true,
})
}
}else{
for(let i=0;i<5-len;i++) { for(let i=0;i<5-len;i++) {
list.push({ list.push({
head_img: '', head_img: '',
...@@ -126,6 +141,8 @@ class TeamInfo extends Component { ...@@ -126,6 +141,8 @@ class TeamInfo extends Component {
nobody: true, nobody: true,
}) })
} }
}
return list; return list;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment