Commit b83bc7b0 authored by Edwise's avatar Edwise 🍷

111

parent 02e54595
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
import resList from '../../resconfig/resList'; import resList from '../../resconfig/resList';
Component({ Component({
props: {}, props: {},
data: {}, data: {
resList: resList
},
methods: {}, methods: {},
onInit(props) { didMount(){
this.setData({
resList: resList
});
} }
}); });
\ No newline at end of file
...@@ -23,20 +23,20 @@ Component({ ...@@ -23,20 +23,20 @@ Component({
*/ */
async getActivityBaseInfoById() { async getActivityBaseInfoById() {
my.showLoading(); my.showLoading();
const { // const {
success, // success,
data // data
} = await API.getActivityBaseInfoById().catch(r => { // } = await API.getActivityBaseInfoById().catch(r => {
my.hideLoading(); // my.hideLoading();
commonToast(r && r.message) // commonToast(r && r.message)
}) || {}; // }) || {};
if (success) { // if (success) {
my.hideLoading(); my.hideLoading();
this.setData({ this.setData({
rule: data.rule rule: app.activityInfo.rule
}) })
} // }
}, },
}, },
didMount(){ didMount(){
......
...@@ -38,6 +38,6 @@ ...@@ -38,6 +38,6 @@
<rule-modal a:if="{{modalStatus==1}}" onCloseModal="closeModal"></rule-modal> <rule-modal a:if="{{modalStatus==1}}" onCloseModal="closeModal"></rule-modal>
</view> </view>
<view class="popcontainer_down" a:if="{{modalStatus}}"> <view class="popcontainer_down" a:if="{{modalStatus==2}}">
<invitelist-modal a:if="{{modalStatus==2}}" onCloseModal="closeModal"></invitelist-modal> <invitelist-modal a:if="{{modalStatus==2}}" onCloseModal="closeModal"></invitelist-modal>
</view> </view>
'use strict'; 'use strict';
import resList from '../../resconfig/resList'; import resList from '../../resconfig/resList';
import API from '../../api'; import API from '../../api';
import * as FYGE from "fyge-tbmini"; import * as FYGE from "fyge-tbmini";
import * as SvgaParser from "svga-parser"; import * as SvgaParser from "svga-parser";
...@@ -26,13 +26,13 @@ Page({ ...@@ -26,13 +26,13 @@ Page({
/**弹窗状态 */ /**弹窗状态 */
modalStatus: 0, modalStatus: 0,
/**当前温暖值 */ /**当前温暖值 */
curWarms:'', curWarms: '',
/**当前排名 */ /**当前排名 */
curRank:'', curRank: '',
/**当前游戏阶段 */ /**当前游戏阶段 */
curGameStep:1, curGameStep: 1,
/**活动结束后排行榜奖励信息 */ /**活动结束后排行榜奖励信息 */
rankPrize:{} rankPrize: {}
}, },
onLoad(props) { onLoad(props) {
...@@ -54,71 +54,72 @@ Page({ ...@@ -54,71 +54,72 @@ Page({
async createMain() { async createMain() {
console.log(123) console.log(123)
var canvas = await new Promise((r) => { var canvas = await new Promise((r) => {
my.createCanvas({ my.createCanvas({
id: 'canvas', id: 'canvas',
success: (ccc) => { success: (ccc) => {
const dpr = my.getSystemInfoSync().pixelRatio const dpr = my.getSystemInfoSync().pixelRatio
const windowWidth = my.getSystemInfoSync().windowWidth; const windowWidth = my.getSystemInfoSync().windowWidth;
const windowHeight = my.getSystemInfoSync().windowHeight; const windowHeight = my.getSystemInfoSync().windowHeight;
ccc.width = windowWidth * dpr + dpr;//重新修改会有误差 ccc.width = windowWidth * dpr + dpr; //重新修改会有误差
ccc.height = windowHeight * dpr + dpr; ccc.height = windowHeight * dpr + dpr;
r(ccc); r(ccc);
} }
}) })
}) })
console.log(111) console.log(111)
FYGE.initedByCanvas(canvas) FYGE.initedByCanvas(canvas)
var sysInfo = my.getSystemInfoSync() var sysInfo = my.getSystemInfoSync()
//建舞台 //建舞台
var stage = new FYGE.Stage( var stage = new FYGE.Stage(
canvas, canvas,
750,//设计宽度,按设计搞给的就行 750, //设计宽度,按设计搞给的就行
1624,//设计高度 1624, //设计高度
sysInfo && sysInfo.windowWidth || document.body.clientWidth, sysInfo && sysInfo.windowWidth || document.body.clientWidth,
sysInfo && sysInfo.windowHeight || document.body.clientHeight, sysInfo && sysInfo.windowHeight || document.body.clientHeight,
FYGE.RENDERER_TYPE.CANVAS FYGE.RENDERER_TYPE.CANVAS
); );
//stage初始化 //stage初始化
stage.addEventListener(FYGE.Event.INIT_STAGE, () => { stage.addEventListener(FYGE.Event.INIT_STAGE, () => {
SvgaParser.loadSvga( SvgaParser.loadSvga(
fireSrc, fireSrc,
(v) => { (v) => {
console.log("svga"+v); console.log("svga" + v);
var mv =stage.addChild(new FYGE.MovieClip(v)); var mv = stage.addChild(new FYGE.MovieClip(v));
mv.x = 275; mv.x = 275;
mv.y = 785; mv.y = 785;
console.log("svgmv",mv) console.log("svgmv", mv)
}, },
(err) => { (err) => {
console.log(err); console.log(err);
} }
) )
SvgaParser.loadSvga( SvgaParser.loadSvga(
snowSrc, snowSrc,
(v) => { (v) => {
console.log("svga"+v); console.log("svga" + v);
var mv =stage.addChild(new FYGE.MovieClip(v)); var mv = stage.addChild(new FYGE.MovieClip(v));
mv.x = 175; mv.x = 175;
mv.y = 585; mv.y = 585;
console.log("svgmv",mv) console.log("svgmv", mv)
}, },
(err) => { (err) => {
console.log(err); console.log(err);
} }
) )
}, this); }, this);
//循环 //循环
loop(); loop();
function loop() { function loop() {
FYGE.Tween.flush() FYGE.Tween.flush()
stage.flush(); stage.flush();
FYGE.getRequestAnimationFrame()(loop); FYGE.getRequestAnimationFrame()(loop);
} }
}, },
/** /**
* 获取用户授权信息 * 获取用户授权信息
...@@ -157,29 +158,51 @@ Page({ ...@@ -157,29 +158,51 @@ Page({
}) || {}; }) || {};
if (success) { if (success) {
this.getActivityBaseInfoById();
}
},
/*
* 获取活动信息
*/
async getActivityBaseInfoById() {
my.showLoading();
const {
success,
data
} = await API.getActivityBaseInfoById().catch(r => {
my.hideLoading();
commonToast(r && r.message)
}) || {};
if (success) {
my.hideLoading();
app.activityInfo = data;
this.judgeDoHelp(); this.judgeDoHelp();
} }
}, },
/**判断是否是助力 */ /**判断是否是助力 */
judgeDoHelp(){ judgeDoHelp() {
this.updateGameInfo(); this.updateGameInfo();
}, },
/**更新游戏信息 */ /**更新游戏信息 */
async updateGameInfo(){ async updateGameInfo() {
my.showLoading(); my.showLoading();
const {success,data} = await API.getGameInfo().catch(r=>{ const {
success,
data
} = await API.getGameInfo().catch(r => {
my.hideLoading(); my.hideLoading();
commonToast(r&&r.message); commonToast(r && r.message);
})||{}; }) || {};
if(success){ if (success) {
this.setData({ this.setData({
curWarms:data.warms+'', curWarms: data.warms + '',
curRank:data.rank, curRank: data.rank,
curGameStep:data.step curGameStep: data.step
}) })
my.hideLoading(); my.hideLoading();
} }
}, },
/**打开弹窗 */ /**打开弹窗 */
openModal(e) { openModal(e) {
...@@ -198,7 +221,7 @@ Page({ ...@@ -198,7 +221,7 @@ Page({
}) })
}, },
/**点击跳转页面 */ /**点击跳转页面 */
navigateTo(e){ navigateTo(e) {
const { const {
item item
} = e.target.dataset; } = e.target.dataset;
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"success": true, "success": true,
"data": { "data": {
"myRankInfo": { "myRankInfo": {
"rank": "560", "rank": "450",
"warms": "1", "warms": "1",
"userNick": "caoxingru12" "userNick": "caoxingru12"
}, },
......
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