Commit 17e3abe3 by wangshuo

解决TODO遗留问题

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