Commit 17e3abe3 by wangshuo

解决TODO遗留问题

parent 17f16952
...@@ -64,6 +64,10 @@ class MyTreasure extends Component { ...@@ -64,6 +64,10 @@ class MyTreasure extends Component {
isEmpty: false, isEmpty: false,
teams, teams,
}); });
}else{
this.setState({
isEmpty: true,
});
} }
} }
}); });
......
...@@ -39,12 +39,13 @@ class LiveRoom extends Component { ...@@ -39,12 +39,13 @@ class LiveRoom extends Component {
// 预约直播 // 预约直播
subscribe = (id) => { subscribe = (id) => {
// 检查是否已登录 // 检查是否已登录
this.checkLogin(); const {hasError, data = {}} = this.props.user;
if(hasError) {
this.props.history.push('/passport/login');
}else{
http.get(`${API['base-api']}/sys/createLiveQrcode/${id}`).then(res => { http.get(`${API['base-api']}/sys/createLiveQrcode/${id}`).then(res => {
let { errno, data, msg } = res.data; let { errno, data, msg } = res.data;
console.log(res);
if (errno === 200) { if (errno === 200) {
// TODO 显示二维码地址 并且传递给二维码的图片/地址
QRCode.toDataURL(data.url, (err, url) => { QRCode.toDataURL(data.url, (err, url) => {
this.setState({ this.setState({
showMark: true, showMark: true,
...@@ -56,22 +57,31 @@ class LiveRoom extends Component { ...@@ -56,22 +57,31 @@ class LiveRoom extends Component {
} }
}); });
} }
}
// 已预约 给提示 // 已预约 给提示
tip = () => { tip = () => {
Toast.info('你已预约该直播'); Toast.info('你已预约该直播');
} }
// 去直播间 // 去直播间
toLivingRoom = (id) => { toLivingRoom = (id) => {
this.checkLogin(); const {hasError, data = {}} = this.props.user;
if(hasError) {
this.props.history.push('/passport/login');
}else{
window.location.href = `${window.location.protocol}//www.julyedu.com/live/m_room/${id}` window.location.href = `${window.location.protocol}//www.julyedu.com/live/m_room/${id}`
} }
}
// 查看回放 // 查看回放
checkVideo = (url) => { checkVideo = (url) => {
this.checkLogin(); const {hasError, data = {}} = this.props.user;
// TODO 这里需要课程ID 如何获取? if(hasError) {
this.props.history.push('/passport/login');
}else{
const vCourseId = url.split('/')[0]; const vCourseId = url.split('/')[0];
history.push(`/play/video?id=${vCourseId}`) history.push(`/play/video?id=${vCourseId}`)
} }
}
// 关闭弹框 // 关闭弹框
closePopup = () => { closePopup = () => {
this.setState({ this.setState({
...@@ -80,15 +90,8 @@ class LiveRoom extends Component { ...@@ -80,15 +90,8 @@ class LiveRoom extends Component {
// 关闭弹框的时候再次查询接口 查询预约状态 // 关闭弹框的时候再次查询接口 查询预约状态
this.getLiveInfo(); this.getLiveInfo();
} }
// 检查是否登录
checkLogin = () => {
const {hasError, data = {}} = this.props.user;
if(hasError) { // 未登录
return;
}
}
// TODO APP内需要保存图片 是否还是这样做 需要确认 // APP内需要保存图片 是否还是这样做 需要确认
saveImage = () => { saveImage = () => {
let version = getParam('version') let version = getParam('version')
version = typeof version === 'string' ? version.replace('.', '').replace('.', '').slice(0, 3) : '' version = typeof version === 'string' ? version.replace('.', '').replace('.', '').slice(0, 3) : ''
......
...@@ -10,7 +10,7 @@ class TeamInfo extends Component { ...@@ -10,7 +10,7 @@ class TeamInfo extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
is_my_team: true, // 是否有自己的队伍 is_my_team: false, // 是否有自己的队伍
prize_info: [], prize_info: [],
info: { info: {
removable: 0, removable: 0,
...@@ -18,6 +18,7 @@ class TeamInfo extends Component { ...@@ -18,6 +18,7 @@ class TeamInfo extends Component {
}, },
member: [], member: [],
removable_data: [], removable_data: [],
my_team: {},
} }
} }
...@@ -30,13 +31,14 @@ class TeamInfo extends Component { ...@@ -30,13 +31,14 @@ class TeamInfo extends Component {
http.get(`${API.home}/sys/treasure/teamInfo`).then(res => { http.get(`${API.home}/sys/treasure/teamInfo`).then(res => {
const { code, data, msg } = res.data; const { code, data, msg } = res.data;
if (code === 200) { if (code === 200) {
const { prize_info, is_my_team, info, member, removable_data } = data; const { prize_info, is_my_team, info, member, removable_data, my_team } = data;
this.setState({ this.setState({
prize_info, prize_info,
is_my_team, is_my_team,
info, info,
member: this.fillTeam(member), member: this.fillTeam(member),
removable_data removable_data,
my_team
}) })
} else { } else {
Toast.info(msg); Toast.info(msg);
...@@ -51,10 +53,12 @@ class TeamInfo extends Component { ...@@ -51,10 +53,12 @@ class TeamInfo extends Component {
} else { } else {
let search = ''; let search = '';
if(close) { if(close) {
const {removable_data} = this.state; const {removable_data, info: {removable}} = this.state;
if(removable > 0) {
let current = removable_data[0]; let current = removable_data[0];
search = `?team_num=${current.team_num}&owner_uid=${current.captain_uid}`; search = `?team_num=${current.team_num}&owner_uid=${current.captain_uid}`;
} }
}
this.props.history.push(`/year/yearTreasure${search}`); this.props.history.push(`/year/yearTreasure${search}`);
} }
...@@ -65,8 +69,22 @@ class TeamInfo extends Component { ...@@ -65,8 +69,22 @@ class TeamInfo extends Component {
if(this.props.user.hasError) { if(this.props.user.hasError) {
this.props.history.push('/passport/login'); this.props.history.push('/passport/login');
} else { } else {
// TODO 跳转到邀请落地页需要什么参数 const {is_my_team, my_team: {treasure_code}} = this.state;
this.props.history.push('/activity/newyear-2019/landing') if(is_my_team) { // 有自己的队伍
// 直接跳转
this.props.history.push('/activity/newyear-2019/landing?origin=1&treasure_code=' + treasure_code);
}else{ // 没自己的队伍
// 请求创建队伍的接口
http.get(`${API.home}/sys/treasure/createMyTeam`).then(res => {
const { code, data, msg } = res.data;
if (code === 200) {
const { treasure_code } = data;
this.props.history.push('/activity/newyear-2019/landing?origin=1&treasure_code=' + treasure_code);
} else {
Toast.info(msg);
}
});
}
} }
} }
......
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