From 4ce67cb6d23a85d2dfbba04d4831ac541995b19e Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 27 Feb 2019 21:36:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BF=87=E6=8E=A5=E5=8F=A3=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=BD=93=E5=89=8D=E8=BF=9B=E5=BA=A6=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/scripts/scrollContent.js | 14 ++++++++++++-- assets/scripts/utils/webapi.js | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/assets/scripts/scrollContent.js b/assets/scripts/scrollContent.js index fd925c1..87e4085 100644 --- a/assets/scripts/scrollContent.js +++ b/assets/scripts/scrollContent.js @@ -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); diff --git a/assets/scripts/utils/webapi.js b/assets/scripts/utils/webapi.js index 093ceac..f11e2d3 100644 --- a/assets/scripts/utils/webapi.js +++ b/assets/scripts/utils/webapi.js @@ -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); } }