增加定时获取邀请用户信息的功能
This commit is contained in:
parent
4ce67cb6d2
commit
372b7a5c9e
@ -68,12 +68,15 @@ cc.Class({
|
|||||||
mobile: '',
|
mobile: '',
|
||||||
images: [],
|
images: [],
|
||||||
uid: '',
|
uid: '',
|
||||||
allshow: false
|
allshow: false,
|
||||||
|
infoSchedule: null,
|
||||||
|
shareUser: ''
|
||||||
},
|
},
|
||||||
|
|
||||||
// LIFE-CYCLE CALLBACKS:
|
// LIFE-CYCLE CALLBACKS:
|
||||||
|
|
||||||
onLoad () {
|
onLoad () {
|
||||||
|
this.shareUser = '5c7655c484dde4098f2196fa';
|
||||||
let self = this;
|
let self = this;
|
||||||
webapi.preLogin({})
|
webapi.preLogin({})
|
||||||
.then(rep => {
|
.then(rep => {
|
||||||
@ -128,6 +131,10 @@ cc.Class({
|
|||||||
// console.log('getScrollOffset: ' + offsetY);
|
// console.log('getScrollOffset: ' + offsetY);
|
||||||
});
|
});
|
||||||
this.longPressListener = onfire.on('longPressed', this.longPressed.bind(this));
|
this.longPressListener = onfire.on('longPressed', this.longPressed.bind(this));
|
||||||
|
if (this.logined && !this.allshow) {
|
||||||
|
this.scheduleUpdateInfo();
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
start () {
|
start () {
|
||||||
@ -209,7 +216,7 @@ cc.Class({
|
|||||||
},
|
},
|
||||||
userLogin(mobile, code) {
|
userLogin(mobile, code) {
|
||||||
let self = this;
|
let self = this;
|
||||||
webapi.login(mobile, code)
|
webapi.login(mobile, code, self.shareUser)
|
||||||
.then(rep => {
|
.then(rep => {
|
||||||
if (rep.errcode === 0 || rep.errcode === 102 || rep.errcode === 103) {
|
if (rep.errcode === 0 || rep.errcode === 102 || rep.errcode === 103) {
|
||||||
self.logined = true;
|
self.logined = true;
|
||||||
@ -227,7 +234,9 @@ cc.Class({
|
|||||||
if (rep.errcode === 0) {
|
if (rep.errcode === 0) {
|
||||||
self.showResultView();
|
self.showResultView();
|
||||||
}
|
}
|
||||||
|
if (this.logined && !this.allshow) {
|
||||||
|
this.scheduleUpdateInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch (err => {
|
.catch (err => {
|
||||||
@ -259,5 +268,23 @@ cc.Class({
|
|||||||
if (this.allshow) {
|
if (this.allshow) {
|
||||||
this.mainScrollContent.getComponent('scrollContent').updateTipTxt('隐藏角色已开启');
|
this.mainScrollContent.getComponent('scrollContent').updateTipTxt('隐藏角色已开启');
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
scheduleUpdateInfo() {
|
||||||
|
let self = this;
|
||||||
|
if (this.infoSchedule) {
|
||||||
|
this.unschedule(this.infoSchedule);
|
||||||
|
}
|
||||||
|
this.infoSchedule = this.schedule(function () {
|
||||||
|
webapi.updateInviteInfo()
|
||||||
|
.then(rep => {
|
||||||
|
if (rep.errcode === 0) {
|
||||||
|
let text = `${stringUtil.parseMobile(rep.mobile)}接受了你的邀请`;
|
||||||
|
self.mainScrollContent.getComponent('scrollContent').updateTipTxt(text);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
|
||||||
|
})
|
||||||
|
}, 60); //每5分钟更新一次
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -109,11 +109,6 @@ cc.Class({
|
|||||||
.catch(err => {
|
.catch(err => {
|
||||||
cc.log('error get activity info');
|
cc.log('error get activity info');
|
||||||
});
|
});
|
||||||
|
|
||||||
// this.scheduleOnce(function () {
|
|
||||||
// processBar.getComponent('progressBar').updateShow(35000);
|
|
||||||
// self.puzzle.getComponent('puzzle').updateValues([])
|
|
||||||
// }, 5);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var http = require('./http');
|
var http = require('./http');
|
||||||
|
|
||||||
const baseUrl = 'http://192.168.100.228:3000';
|
const baseUrl = 'http://192.168.100.229:3000';
|
||||||
export default {
|
export default {
|
||||||
sendSms: (mobile, captcha) => {
|
sendSms: (mobile, captcha) => {
|
||||||
let data = {mobile: mobile};
|
let data = {mobile: mobile};
|
||||||
@ -22,11 +22,12 @@ export default {
|
|||||||
let url = baseUrl + '/activity/api/user_info';
|
let url = baseUrl + '/activity/api/user_info';
|
||||||
return http.get(url);
|
return http.get(url);
|
||||||
},
|
},
|
||||||
login: (mobile, code) => {
|
login: (mobile, code, shareUser) => {
|
||||||
let data = {
|
let data = {
|
||||||
mobile: mobile,
|
mobile: mobile,
|
||||||
captcha: code
|
captcha: code
|
||||||
};
|
};
|
||||||
|
(!!shareUser) && (data['shareUser'] = shareUser);
|
||||||
let url = baseUrl + '/activity/api/join';
|
let url = baseUrl + '/activity/api/join';
|
||||||
return http.post(url, data);
|
return http.post(url, data);
|
||||||
},
|
},
|
||||||
@ -41,5 +42,9 @@ export default {
|
|||||||
getActivityInfo: () => {
|
getActivityInfo: () => {
|
||||||
let url = baseUrl + '/activity/api/activity_info';
|
let url = baseUrl + '/activity/api/activity_info';
|
||||||
return http.get(url);
|
return http.get(url);
|
||||||
|
},
|
||||||
|
updateInviteInfo: () => {
|
||||||
|
let url = baseUrl + '/activity/api/invite_info';
|
||||||
|
return http.get(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user