Commit 4104ce72 authored by AU-Pro-mac's avatar AU-Pro-mac

add new code & fixed some bugs --01

parent abcff205
...@@ -126,7 +126,6 @@ var RES; ...@@ -126,7 +126,6 @@ var RES;
for (var key in resList) { for (var key in resList) {
list.push(resList[key]); list.push(resList[key]);
} }
console.log("开始加载spark资源1");
var p = new Promise(function (resolve, reject) { var p = new Promise(function (resolve, reject) {
loadResList(function (s) { loadResList(function (s) {
if (s) { if (s) {
...@@ -174,7 +173,6 @@ var RES; ...@@ -174,7 +173,6 @@ var RES;
RES.loadGroup = loadGroup; RES.loadGroup = loadGroup;
function getResAsync(str, comFun, thisObj) { function getResAsync(str, comFun, thisObj) {
var type = str.substring(str.lastIndexOf(".") + 1, str.length); var type = str.substring(str.lastIndexOf(".") + 1, str.length);
console.log("开始加载spark资源4", type);
if (type == "png" || type == "jpg") { if (type == "png" || type == "jpg") {
if (FYGE.TextureCache[str]) { if (FYGE.TextureCache[str]) {
comFun && comFun.call(thisObj, FYGE.TextureCache[str], str); comFun && comFun.call(thisObj, FYGE.TextureCache[str], str);
...@@ -186,7 +184,6 @@ var RES; ...@@ -186,7 +184,6 @@ var RES;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
FYGE.GlobalLoader.loadImage(function (s, image) { FYGE.GlobalLoader.loadImage(function (s, image) {
if (s) { if (s) {
console.log("加载成功图片", image);
FYGE.Texture.addToCache(FYGE.Texture.from(image), str); FYGE.Texture.addToCache(FYGE.Texture.from(image), str);
comFun && comFun.call(thisObj, FYGE.TextureCache[str], str); comFun && comFun.call(thisObj, FYGE.TextureCache[str], str);
resolve(FYGE.TextureCache[str]); resolve(FYGE.TextureCache[str]);
...@@ -261,7 +258,6 @@ var RES; ...@@ -261,7 +258,6 @@ var RES;
if (!countAll) if (!countAll)
callback(true); callback(true);
var mark = true; var mark = true;
console.log("开始加载spark资源2");
for (var i = 0; i < countAll; i++) { for (var i = 0; i < countAll; i++) {
var resName = arr[i]['url']; var resName = arr[i]['url'];
getResAsync("" + resName, function (res, str) { getResAsync("" + resName, function (res, str) {
...@@ -269,7 +265,6 @@ var RES; ...@@ -269,7 +265,6 @@ var RES;
mark = false; mark = false;
if (++count == countAll) if (++count == countAll)
callback(mark); callback(mark);
console.log("开始加载spark资源3");
}, this); }, this);
} }
} }
...@@ -1878,6 +1873,7 @@ var Main = (function () { ...@@ -1878,6 +1873,7 @@ var Main = (function () {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
FYGE.GlobalLoader.loadImage(function (s, image) { FYGE.GlobalLoader.loadImage(function (s, image) {
if (s) { if (s) {
console.log('ssss', image);
FYGE.createTextureSheet(new FYGE.BaseTexture(image), lottieTexture); FYGE.createTextureSheet(new FYGE.BaseTexture(image), lottieTexture);
resolve('complete'); resolve('complete');
} }
...@@ -1920,7 +1916,6 @@ var Main = (function () { ...@@ -1920,7 +1916,6 @@ var Main = (function () {
return [4, RES_1.RES.loadSparkAssets(resCanvasList)]; return [4, RES_1.RES.loadSparkAssets(resCanvasList)];
case 1: case 1:
_a.sent(); _a.sent();
console.log("FYGE.TextureCache", FYGE.TextureCache);
console.log('resloadingList 加载完毕'); console.log('resloadingList 加载完毕');
this.loadImageTextures(resCanvasList).then(function (res) { return __awaiter(_this, void 0, void 0, function () { this.loadImageTextures(resCanvasList).then(function (res) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
......
This diff is collapsed.
...@@ -128,7 +128,6 @@ var RES; ...@@ -128,7 +128,6 @@ var RES;
for (var key in resList) { for (var key in resList) {
list.push(resList[key]); list.push(resList[key]);
} }
console.log("开始加载spark资源1");
var p = new Promise(function (resolve, reject) { var p = new Promise(function (resolve, reject) {
loadResList(function (s) { loadResList(function (s) {
if (s) { if (s) {
...@@ -176,7 +175,6 @@ var RES; ...@@ -176,7 +175,6 @@ var RES;
RES.loadGroup = loadGroup; RES.loadGroup = loadGroup;
function getResAsync(str, comFun, thisObj) { function getResAsync(str, comFun, thisObj) {
var type = str.substring(str.lastIndexOf(".") + 1, str.length); var type = str.substring(str.lastIndexOf(".") + 1, str.length);
console.log("开始加载spark资源4", type);
if (type == "png" || type == "jpg") { if (type == "png" || type == "jpg") {
if (FYGE.TextureCache[str]) { if (FYGE.TextureCache[str]) {
comFun && comFun.call(thisObj, FYGE.TextureCache[str], str); comFun && comFun.call(thisObj, FYGE.TextureCache[str], str);
...@@ -188,7 +186,6 @@ var RES; ...@@ -188,7 +186,6 @@ var RES;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
FYGE.GlobalLoader.loadImage(function (s, image) { FYGE.GlobalLoader.loadImage(function (s, image) {
if (s) { if (s) {
console.log("加载成功图片", image);
FYGE.Texture.addToCache(FYGE.Texture.from(image), str); FYGE.Texture.addToCache(FYGE.Texture.from(image), str);
comFun && comFun.call(thisObj, FYGE.TextureCache[str], str); comFun && comFun.call(thisObj, FYGE.TextureCache[str], str);
resolve(FYGE.TextureCache[str]); resolve(FYGE.TextureCache[str]);
...@@ -263,7 +260,6 @@ var RES; ...@@ -263,7 +260,6 @@ var RES;
if (!countAll) if (!countAll)
callback(true); callback(true);
var mark = true; var mark = true;
console.log("开始加载spark资源2");
for (var i = 0; i < countAll; i++) { for (var i = 0; i < countAll; i++) {
var resName = arr[i]['url']; var resName = arr[i]['url'];
getResAsync("" + resName, function (res, str) { getResAsync("" + resName, function (res, str) {
...@@ -271,7 +267,6 @@ var RES; ...@@ -271,7 +267,6 @@ var RES;
mark = false; mark = false;
if (++count == countAll) if (++count == countAll)
callback(mark); callback(mark);
console.log("开始加载spark资源3");
}, this); }, this);
} }
} }
...@@ -1880,6 +1875,7 @@ var Main = (function () { ...@@ -1880,6 +1875,7 @@ var Main = (function () {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
FYGE.GlobalLoader.loadImage(function (s, image) { FYGE.GlobalLoader.loadImage(function (s, image) {
if (s) { if (s) {
console.log('ssss', image);
FYGE.createTextureSheet(new FYGE.BaseTexture(image), lottieTexture); FYGE.createTextureSheet(new FYGE.BaseTexture(image), lottieTexture);
resolve('complete'); resolve('complete');
} }
...@@ -1922,7 +1918,6 @@ var Main = (function () { ...@@ -1922,7 +1918,6 @@ var Main = (function () {
return [4, RES_1.RES.loadSparkAssets(resCanvasList)]; return [4, RES_1.RES.loadSparkAssets(resCanvasList)];
case 1: case 1:
_a.sent(); _a.sent();
console.log("FYGE.TextureCache", FYGE.TextureCache);
console.log('resloadingList 加载完毕'); console.log('resloadingList 加载完毕');
this.loadImageTextures(resCanvasList).then(function (res) { return __awaiter(_this, void 0, void 0, function () { this.loadImageTextures(resCanvasList).then(function (res) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) { return __generator(this, function (_a) {
......
...@@ -6,8 +6,8 @@ var fs = require("fs"); ...@@ -6,8 +6,8 @@ var fs = require("fs");
// fs.readFileSync("./output.js") // fs.readFileSync("./output.js")
// ) // )
// var endPath = 'D:/duibaGame/测试项目0527/taobaominiTest/client/pages/index1/'; // var endPath = 'D:/duibaGame/测试项目0527/taobaominiTest/client/pages/index1/';
var endPath = "C:/Users/Duiba/Desktop/work/雅顿/new/new_taobao/taobao_mini/client/pages/pagecanvas/" // var endPath = "C:/Users/Duiba/Desktop/work/雅顿/new/new_taobao/taobao_mini/client/pages/pagecanvas/"
// var endPath = '/Applications/DUIBA-TAOBAO/YD/new_taobao/taobao_mini/client/pages/pagecanvas/'; var endPath = '/Applications/DUIBA-TAOBAO/YD/new_taobao/taobao_mini/client/pages/pagecanvas/';
var version = Math.round(new Date().getTime() / 1000); var version = Math.round(new Date().getTime() / 1000);
......
...@@ -98,8 +98,11 @@ export class Main { ...@@ -98,8 +98,11 @@ export class Main {
FYGE.GlobalLoader.loadImage( FYGE.GlobalLoader.loadImage(
(s, image) => { (s, image) => {
if (s) { if (s) {
console.log('ssss', image)
setTimeout(() => {
FYGE.createTextureSheet(new FYGE.BaseTexture(image), lottieTexture); FYGE.createTextureSheet(new FYGE.BaseTexture(image), lottieTexture);
resolve('complete') resolve('complete')
}, 60);
} }
}, resCanvasList['63cb446e-1158-4a94-bf0c-c19ecc7d2cc6'].url) }, resCanvasList['63cb446e-1158-4a94-bf0c-c19ecc7d2cc6'].url)
// [ // [
......
...@@ -94,18 +94,21 @@ Page({ ...@@ -94,18 +94,21 @@ Page({
// 开始旋转 转盘 // 开始旋转 转盘
async startDraw () { async startDraw () {
console.log('%cstartDraw run', ConsoleStyle)
if (this.data.rotateFlag) return if (this.data.rotateFlag) return
this.setData({ rotateFlag: true })
console.log('%cstartDraw run', ConsoleStyle)
if (!this.data.leftTimes > 0) { if (!this.data.leftTimes > 0) {
commonToast('您还没有抽奖次数') commonToast('您还没有抽奖次数')
setTimeout(() => { this.setData({ rotateFlag: false }) }, 300)
return return
} }
const { success, data } = await API.drawLotteryPrize({ activityId: this.activityId}).catch(res => { const { success, data } = await API.drawLotteryPrize({ activityId: this.activityId}).catch(res => {
commonToast(res && res.message) commonToast(res && res.message)
this.setData({ rotateFlag: false })
return return
}) || {} }) || {}
console.log('%c--------领取实物奖品\n' + '-----yd.receiveObjectPrize\n', ConsoleStyle, data) console.log('%c--------转盘抽奖\n' + '-----yd.drawLotteryPrize\n', ConsoleStyle, data)
// test code - // test code -
// let success = true // let success = true
...@@ -115,9 +118,6 @@ Page({ ...@@ -115,9 +118,6 @@ Page({
// name: '一碗热翔', // name: '一碗热翔',
// image: '//yun.duiba.com.cn/spark/assets/9be08f492b1e9fb4006cd676bcf5df760856b74a.png' // image: '//yun.duiba.com.cn/spark/assets/9be08f492b1e9fb4006cd676bcf5df760856b74a.png'
// } // }
// test code -
this.setData({ rotateFlag: true })
if (success && data) { if (success && data) {
...@@ -132,7 +132,7 @@ Page({ ...@@ -132,7 +132,7 @@ Page({
// 1:权益(优惠券),2:积分,3:实物 // 1:权益(优惠券),2:积分,3:实物
} else if (data.type == 1 || data.type == 2 || data.type == 3) { } else if (data.type == 1 || data.type == 2 || data.type == 3) {
this.data.listTurnTable.forEach((item, index) => { this.data.listTurnTable.forEach((item, index) => {
if (item._id == data.id) { if (item._id == data.prizeId) {
rotateT = index + 1 rotateT = index + 1
rotateT = 4 + 1 rotateT = 4 + 1
this.setData({ rewardsInfo: data }) this.setData({ rewardsInfo: data })
...@@ -144,26 +144,28 @@ Page({ ...@@ -144,26 +144,28 @@ Page({
} }
// 调整位置-归零 // 调整位置-归零
this.animateRotation(this.timerCount ? 360 * (++this.timerCount * 2) : 0, 1) this.animateRotation(this.timerCount ? 360 * (++this.timerCount * 2) : 0, 20)
rotateDeg = rotateT * 60 - 30 rotateDeg = rotateT * 60 - 30
this.timerCount += 1
// 开始动画 // 开始动画
setTimeout(() => { setTimeout(() => {
this.animateRotation(360 * (++this.timerCount * 2) + rotateDeg, 1000 * (rotateDeg / 360) + 1000) this.animateRotation(360 * (this.timerCount * 2) + rotateDeg, 1000 * (rotateDeg / 360) + 40)
}, 300)
// 更改 rotateFlag - 弹窗 结果弹窗 // 更改 rotateFlag - 弹窗 结果弹窗
setTimeout(() => { setTimeout(() => {
this.setData({ rotateFlag: false })
if (data.type !== 5) { if (data.type !== 5) {
this.showCommonMoadalT2({ this.showCommonMoadalT2({
title: '恭喜你', title: '恭喜你',
content: `恭喜您获得${data.name}`, content: `恭喜您获得${data.name}`,
confirmCallback1: async () => { confirmCallback1: async () => {
this.setData({ rotateFlag: false })
await this.getGameInfo() await this.getGameInfo()
this.closeCommonModalT2() this.closeCommonModalT2()
this.gotoMyPrize() this.gotoMyPrize()
}, },
confirmCallback2: async () => { confirmCallback2: async () => {
this.setData({ rotateFlag: false })
await this.getGameInfo() await this.getGameInfo()
this.closeCommonModalT2() this.closeCommonModalT2()
}, },
...@@ -176,24 +178,27 @@ Page({ ...@@ -176,24 +178,27 @@ Page({
title: '很遗憾', title: '很遗憾',
content: `奖励与你擦肩而过\n 再接再厉哦~`, content: `奖励与你擦肩而过\n 再接再厉哦~`,
confirmCallback: async () => { confirmCallback: async () => {
this.setData({ rotateFlag: false })
await this.getGameInfo() await this.getGameInfo()
this.closeCommonModalT1() this.closeCommonModalT1()
}, },
btnImg: resList['fd0d94ef-fe1a-4771-8ba2-ad7aadacafc0'].url btnImg: resList['fd0d94ef-fe1a-4771-8ba2-ad7aadacafc0'].url
}) })
} }
}, 1000 * (rotateDeg / 360) + 1000 + 20) }, 1000 * (rotateDeg / 360) + 1000 + 100)
}, 300)
let time = this.data.leftTimes - 1 let time = this.data.leftTimes - 1
this.setData({ leftTimes: time }) this.setData({ leftTimes: time })
} else {
commonToast('网络拥堵,请稍后再试')
this.setData({ rotateFlag: false })
} }
}, },
// 旋转动画rot:旋转角度,timegap:旋转时间 // 旋转动画rot:旋转角度,timegap:旋转时间
animateRotation (rot, timegap) { animateRotation (rot, timegap) {
console.log('animateRotation run') console.log('animateRotation run', rot, timegap)
let animation = my.createAnimation({ let animation = my.createAnimation({
transformOrigin: 'center center', transformOrigin: 'center center',
duration: timegap, duration: timegap,
...@@ -296,11 +301,11 @@ Page({ ...@@ -296,11 +301,11 @@ Page({
// 通用弹层 - 关闭 - T1 // 通用弹层 - 关闭 - T1
closeCommonModalT1() { closeCommonModalT1() {
this.setData({ commonModalVisibleT1: false }); this.setData({ commonModalVisibleT1: false, rotateFlag: false });
}, },
// 通用弹层 - 关闭 - T2 // 通用弹层 - 关闭 - T2
closeCommonModalT2() { closeCommonModalT2() {
this.setData({ commonModalVisibleT2: false }); this.setData({ commonModalVisibleT2: false, rotateFlag: false });
}, },
onModalT2One () { this.data.onModalT2One() }, onModalT2One () { this.data.onModalT2One() },
......
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