通过接口更新当前进度条

This commit is contained in:
zhl 2019-02-27 21:36:50 +08:00
parent b380c70725
commit 4ce67cb6d2
2 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,5 @@
let onfire = require('./utils/onfire');
let webapi = require('./utils/webapi');
cc.Class({
extends: cc.Component,
@ -86,7 +87,7 @@ cc.Class({
var processBar = cc.instantiate(this.processBarPrefab);
// processBar.getComponent('progressBar').currentVal = 50000;
this.part1.addChild(processBar);
processBar.getComponent('progressBar').updateShow(50000);
processBar.getComponent('progressBar').updateShow(1024);
this.puzzle = cc.instantiate(this.puzzlePrefab);
this.part2.addChild(this.puzzle);
this.tipLabel = cc.instantiate(this.tipPrefab);
@ -98,7 +99,16 @@ cc.Class({
this.part5.addChild(bottomSwiper);
this.logoutBtn.on('click', function () {
self.top.userLogout();
})
});
webapi.getActivityInfo()
.then(rep => {
if (rep.errcode === 0) {
processBar.getComponent('progressBar').updateShow(rep.count);
}
})
.catch(err => {
cc.log('error get activity info');
});
// this.scheduleOnce(function () {
// processBar.getComponent('progressBar').updateShow(35000);

View File

@ -37,5 +37,9 @@ export default {
getShareUrl: () => {
let url = baseUrl + '/activity/api/getShareUrl';
return http.get(url);
},
getActivityInfo: () => {
let url = baseUrl + '/activity/api/activity_info';
return http.get(url);
}
}