Commit f370d2f9 authored by wildfirecode's avatar wildfirecode

1

parent 5c248596
No preview for this file type
......@@ -4,16 +4,16 @@
* 简单的api组件
*/
import {utils, } from 'scilla/src'
import { utils, } from 'scilla/src'
import ApiComponent from "./ApiComponent";
import {callApi} from "../net/webService";
import { callApi } from "../net/webService";
export default class SampleApi extends ApiComponent {
uri: string;
ignoreSuccessField = false;
async callApi(name, paramsInput, ...args){
if(this.name == name){
async callApi(name, paramsInput, ...args) {
if (this.name == name) {
await this.execute(paramsInput, ...args);
}
}
......@@ -23,20 +23,27 @@ export default class SampleApi extends ApiComponent {
const params = {};
if(this.params){
if (this.params) {
utils.injectProp(params, this.params);
}
if(paramsInput){
if (paramsInput) {
utils.injectProp(params, paramsInput);
}
const {uri, method} = this;
const { uri, method } = this;
try {
console.log(`${uri}==>${JSON.stringify(params)}`);
const response = await callApi(uri, params, method, 'json', this.ignoreSuccessField);
this.onGotResponse(response);
console.log(`${uri}<<==${JSON.stringify(response)}`);
return response.data;
} catch (e) {
......
......@@ -73,7 +73,7 @@ export default class PrizeDialogContent extends DialogContent {
} else {//线下
imgUrl = data.imgurl;
this._link =getRecordURL();;
this._link = getRecordURL();;
setY(this.useBtn, this._y + 30)
}
......@@ -83,12 +83,24 @@ export default class PrizeDialogContent extends DialogContent {
const texRender = this.pic.getComponent(TextureRenderer);
const texture = await this.loadTexture(imgUrl);
texRender.texture = texture;
if (texture.bounds.width > texture.bounds.height) {
const maxWidth = 500;
setScale(this.pic, maxWidth / texture.bounds.width)
if (isDuibaPrize) {
if (texture.bounds.width > texture.bounds.height) {
const maxWidth = 500;
setScale(this.pic, maxWidth / texture.bounds.width)
} else {
const width = 250;
setScale(this.pic, width / texture.bounds.width)
}
} else {
const width = 250;
setScale(this.pic, width / texture.bounds.width)
if (texture.bounds.width > texture.bounds.height) {
const maxwidth = 250;
setScale(this.pic, maxwidth / texture.bounds.width)
} else {
const maxheight = 250;
setScale(this.pic, maxheight / texture.bounds.height)
}
}
}
......@@ -105,5 +117,6 @@ export default class PrizeDialogContent extends DialogContent {
if (type == 4) {
return `获得四等奖`
}
return '幸运奖'
}
}
......@@ -58,6 +58,21 @@ export default class SceneStart extends ScillaComponent implements INavigatorVie
}
onClick_startbtn() {
// if (error === '400005') {
// this.bubbling('showToast', '活动还未开始\n敬请期待~');
// } else if (error === '400006') {
// this.bubbling('showToast', '活动已结束\n下次早点来哦~');
// }
const { startTime, endTime } = window['CFG'];
const now = Date.now();
if (now < startTime) {
this.bubbling('showToast', '活动还未开始\n敬请期待~');
return;
}
if (now > endTime) {
this.bubbling('showToast', '活动已结束\n下次早点来哦~');
return;
}
this.startbtn.getComponent(Button).enabled = false;
this._shakeTimes = this.SHAK_TIMERS;
this._counter = 0;
......
......@@ -10,7 +10,7 @@
<body duiba-page-id="4">
<script src="https://cdn.bootcss.com/fetch-jsonp/1.1.3/fetch-jsonp.min.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
......@@ -22,7 +22,7 @@
<div id="gameContainer" style="width: 100%;height: 100%;overflow: hidden;"></div>
<script src="//yun.duiba.com.cn/db_games/zepto.min.js"></script>
<script src="//yun.duiba.com.cn/db_games/security.js"></script>
<script src="//yun.duiba.com.cn/db_games/1561634601/bundle.js"></script>
<script src="//yun.duiba.com.cn/db_games/1561708722/bundle.js"></script>
<script>
setTimeout(function () {
var loadingEl = document.getElementById('loading');
......@@ -34,7 +34,7 @@
}
var options = {
resPath: "//yun.duiba.com.cn/db_games/1561627312/"
resPath: "//yun.duiba.com.cn/db_games/1561708722/"
};
window['shuijf'].startup(document.getElementById('gameContainer'), options, onProcess);
}, 100);
......
......@@ -58,8 +58,8 @@
<script src="debug/bundle.js"></script>
<script>
var CFG = {
'startTime': 1,
'endTime': 2,
'startTime': 1561703100000,
'endTime': 1561714980000,
'weddingId': 1111,
'freeLimit': 10,
'weixinUid': 00000,
......
......@@ -16,8 +16,8 @@
"entryScene": "main"
},
"webServiceUrl-": "http://10.10.93.204:7555 http://localhost:3010",
"webServiceUrl1": "",
"webServiceUrl": "http://localhost:4001"
"webServiceUrl": "",
"webServiceUrl1": "http://localhost:4001"
},
"dataCenterConfig": {
"dataCenterRoot": [
......
{
"success": true,
"code": null,
"desc": null,
"timestamp": 1561704434453,
"data": {
"imgurl": null,
"orderId": 497,
"prizeId": 70,
"title": "测试数据优化广告1",
"prizeType": 0,
"orderStatus": 2,
"imgurl": "//yun.dui88.com/babi/img/adbc3446-da1wjlykae.png",
"link": null,
"freeLimit": 99,
"exposure": {
"consumerId": 1561704433922,
"appId": 1,
"orderId": "497",
"activityId": 21,
"advertId": 4337,
"materialId": 20515,
"activityUseType": "0",
"dpm": "1.4.1.0",
"os": "Android",
"dcm": "104.4337.0.0",
"os": "iPhone",
"ip": "124.160.32.2",
"isEmbed": true,
"orderId": "39",
"consumerId": 1561541886179,
"ip": "127.0.0.1",
"materialId": 18245,
"advertId": 2958,
"dcm": "104.2958.0.0",
"activityId": 2,
"activityUseType": "0",
"appId": 1,
"domain": "//activity.tuia.cn",
"slotId": null
"domain": "//activity.tuiatest.cn",
"slotId": 2053
},
"lottery": {
"androidDownloadUrl": "//activity.tuia.cn/activity/redirect?orderId=39&activityId=2&appId=1&consumerId=1561541886179&materialId=18245&os=Android&advertId=2958&ip=127.0.0.1&activityUseType=0&dpm=1.4.1.0&dcm=104.2958.0.0&device_type=directad&url=www.baidu.com",
"title": "测试数据优化广告1",
"tip": "一句话描述",
"androidDownloadUrl": "//activity.tuiatest.cn/activity/redirect?orderId=497&activityId=21&appId=1&consumerId=1561704433922&materialId=20515&os=iPhone&advertId=4337&ip=124.160.32.2&activityUseType=0&dpm=1.4.1.0&dcm=104.4337.0.0&device_type=directad&url=http%3A%2F%2Fwww.baidu.com",
"iosDownloadUrl": "//activity.tuiatest.cn/activity/redirect?orderId=497&activityId=21&appId=1&consumerId=1561704433922&materialId=20515&os=iPhone&advertId=4337&ip=124.160.32.2&activityUseType=0&dpm=1.4.1.0&dcm=104.4337.0.0&device_type=directad&url=http%3A%2F%2Fwww.baidu.com",
"couponCode": null,
"couponKey": null,
"link": null,
"stInfoDpmImg": null,
"useBtnText": "马上使用",
"title": "mock test",
"stInfoDpmGoUse": null,
"stInfoDpmClose": null,
"openUrl": "",
"imgurl": "//yun.dui88.com/babi/img/2omlvuy6mf.jpg",
"useBtnText": "数据优化",
"imgurl": "//yun.dui88.com/babi/img/f7a300fb-9yfljp606y.png",
"showUse": true,
"linkTo": null,
"iosDownloadUrl": "//activity.tuia.cn/activity/redirect?orderId=39&activityId=2&appId=1&consumerId=1561541886179&materialId=18245&os=Android&advertId=2958&ip=127.0.0.1&activityUseType=0&dpm=1.4.1.0&dcm=104.2958.0.0&device_type=directad&url=www.baidu.com",
"couponKey": null,
"tip": "1",
"couponCode": null,
"isDownloadUrl": null,
"validate": "2019-04-26"
},
"orderId": 39,
"freeLimit": -6,
"prizeType": 0,
"link": null,
"orderStatus": 2,
"title": "福袋",
"prizeId": null
},
"success": true,
"desc": null,
"timestamp": 1561541886231
"validate": "2019-06-30",
"linkTo": null
}
}
}
\ No newline at end of file
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