Commit 2423e91a authored by wildfirecode's avatar wildfirecode

1

parent d6498bf5
......@@ -2,6 +2,7 @@ module.exports = {
devPort: 8080,
opn:0,
proxy: {
'/signactivity/*': 'http://localhost:3000',
'/customActivity/*': 'http://localhost:3000',
'/ngapi/*': 'http://localhost:3000',
'/plugin/*': 'http://localhost:3000',
......
......@@ -48,6 +48,7 @@
<script src="libs/pad-zeropadding.js"></script>
<img id="pic" style="width:100%;position: absolute;z-index: 999;display: none;" />
<script>
localStorage.clear();
window['total_level'] = 18 + 13 * 4;
window['last_level'] = 69;//必须大于等于total_level
......
......@@ -1241,8 +1241,8 @@ export class NetManager extends ABNetManager {
*/
public getSignInfo(callback: Function, signActivityId: number): void {
const net: INetData = {
name: NetName.SIGN_INFO,
uri: '/signactivity/getSignInfo',
name: 'getSignInfo',
uri: window['duiba']+'/signactivity/getSignInfo',
type: 'post',
dataType: 'json',
param: {
......@@ -1259,15 +1259,14 @@ export class NetManager extends ABNetManager {
* @param {number} signActivityId 签到活动ID
* @param {number} activityId 插件活动ID,用于加抽奖次数,不传则使用签到身上配置的插件活动ID,否则不加抽奖次数
*/
public doSign(callback: Function, signActivityId: number, activityId: number): void {
public doSign(callback: Function, signActivityId: number): void {
const net: INetData = {
name: NetName.SIGN_DO_SIGN,
name:'dosign',
uri: '/signactivity/doSign',
type: 'post',
dataType: 'json',
param: {
id: signActivityId,
activityId: activityId
id: signActivityId
},
callback: callback
};
......
......@@ -46,7 +46,7 @@ export class SignModel extends ActivityModel {
* @param {number} signActivityId 签到插件ID
*/
public doSign(callback: Function, signActivityId: number): void {
NetManager.ins.doSign(callback, signActivityId, DataManager.ins.petIndexData.activityId);
// NetManager.ins.doSign(callback, signActivityId, DataManager.ins.petIndexData.activityId);
}
......
......@@ -83,6 +83,10 @@
{
"keys": "",
"name": "sign"
},
{
"name": "preload",
"keys": "signicon4_png,signicon5_png,signbg_png,sign_line2_png,sign_light_png"
}
],
"resources": [
......@@ -1805,6 +1809,31 @@
"url": "assets/blood2/blood2.png",
"type": "image",
"name": "blood2_png"
},
{
"name": "signicon4_png",
"type": "image",
"url": "assets/sign/signicon4.png"
},
{
"name": "signicon5_png",
"type": "image",
"url": "assets/sign/signicon5.png"
},
{
"name": "signbg_png",
"type": "image",
"url": "assets/sign/signbg.png"
},
{
"name": "sign_line2_png",
"type": "image",
"url": "assets/sign/sign_line2.png"
},
{
"name": "sign_light_png",
"type": "image",
"url": "assets/sign/sign_light.png"
}
]
}
\ No newline at end of file
......@@ -2,6 +2,7 @@
"skins": {},
"autoGenerateExmlsList": true,
"exmls": [
"resource/skins/SignItemSkin.exml",
"resource/skins/AlertSkin.exml",
"resource/skins/Blood2Skin.exml",
"resource/skins/BloodSkin.exml",
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="SignItemSkin" width="560" height="162" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image id="line1" source="sign_line_png" x="5.36" y="2.01"/>
<e:Image source="signitem_png" right="0" y="2"/>
<e:Image id="line2" source="sign_line2_png" x="5.36" y="2.01"/>
<e:Label id="title" text="第1天" x="77" y="14" textColor="0x955200" size="24"/>
<e:Label id="amount" text="1" x="186" y="80.23" textColor="0x955200" size="24"/>
<e:Image id="light" source="sign_light_png" x="3.65" y="1.34"/>
<e:Image id="object" source="sign_icon1_png" x="96" y="46.73" visible="false"/>
<e:Image id="money" source="signicon2_png" x="90" y="67.5" visible="false"/>
<e:Image id="hammer" source="signicon3_png" x="96" y="53.23" visible="false"/>
<e:Image id="boom" source="signicon4_png" x="103" y="55" visible="false"/>
<e:Image id="steps" source="signicon5_png" x="104" y="57"/>
<e:Button id="btn1" label="" x="364" y="65" visible="false">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="signbtn1_png" source.down="signbtn1_png" source.disabled="signbtn1_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="btn2" label="" x="364" y="65" visible="false">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="signbtn2_png" source.down="signbtn2_png" source.disabled="signbtn2_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="btn3" label="" x="364" y="65" visible="false">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="signbtn3_png" source.down="signbtn3_png" source.disabled="signbtn3_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Button id="btn4" label="" x="364" y="65" visible="false">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="signbtn4_png" source.down="signbtn4_png" source.disabled="signbtn4_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="SignSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui">
<e:Skin class="SignSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="signbg_png" y="0" horizontalCenter="0"/>
<e:Button id="closeBtn" label="" x="630" y="188" visible="false">
<e:skinName>
<e:Skin states="up,down,disabled" xmlns:w="http://ns.egret.com/wing">
<e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
<e:Scroller id="scroll" width="560" height="495" x="91" y="409">
<e:Group>
<e:List id="list" width="560" itemRendererSkinName="SignItemSkin">
</e:List>
</e:Group>
</e:Scroller>
</e:Skin>
\ No newline at end of file
......@@ -33,6 +33,15 @@ export default class MapScene extends Scene {
super.start();
const date = new Date();
date.setHours(0, 0, 0, 0);
const nowTimerStr = date.getTime() + '';
const oldTimerStr = localStorage.getItem('nowTimerStr' + window['CFG'].consumerId);
if (oldTimerStr != nowTimerStr) {
localStorage.setItem('nowTimerStr' + window['CFG'].consumerId, nowTimerStr);
PanelCtrl.instance.show('sign');
}
if (getBgOn() && MapScene['firstPlayBgTag'] == true) {
playBg();
}
......@@ -47,6 +56,10 @@ export default class MapScene extends Scene {
this.initSound();
// setTimeout(function() {
// PanelCtrl.instance.show('sign')
// }, 1000);
// window['gameover'] = ()=>{
// NetManager.ins.hc_submit(() => { }, 1, 1, null, '');
// NetManager.ins.getPlugOrderStatus(() => { }, 1, () => { return false })
......
import getSkinPath from "../../libs/new_wx/utils/getSkinPath";
export default class SignItem extends eui.ItemRenderer {
constructor() {
super();
this.skinName = getSkinPath('SignItem');
}
dataChanged(){
this['object'].visible=false;
this['money'].visible=false;
this['hammer'].visible=false;
this['boom'].visible=false;
this['steps'].visible=false;
this['btn1'].visible=false;
this['btn2'].visible=false;
this['btn3'].visible=false;
this['btn4'].visible=false;
this['line1'].visible=this.data.index!=6;
this['line2'].visible=!this['line1'].visible;
this['light'].visible=this.data.signed;
this['title'].text = `第${this.data.index+1}天`;
this['amount'].text = this.data.config.nums;
this[this.data.config.type].visible=true;
this['btn'+this.data.btn].visible=true;
console.log(this.data);
this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{
this.data.func(this.data.index,this)
},this);
}
setSinged(){
this['btn1'].visible=false;
this['btn2'].visible=false;
this['btn3'].visible=false;
this['btn4'].visible=false;
this['light'].visible=true;
this['btn2'].visible=true;
}
}
\ No newline at end of file
import Panel from "../../libs/new_wx/components/Panel";
import SignItem from "./SignItem";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { DataManager } from "../../libs/tw/manager/DataManager";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
export default class SignPanel extends Panel {
start(data) {
getSignInfo() {
return new Promise((r) => {
NetManager.ins.getSignInfo(() => {
r();
}, window['signActivityId']);
})
}
list: eui.List;
scroll: eui.Scroller;
async start(data) {
super.start();
await this.getSignInfo();
console.log(DataManager.ins.getData('getSignInfo'))
const { signInfoVO } = DataManager.ins.getData('getSignInfo');
// for (let i = 1; i <= 7; i++) {
// if (i <= signInfoVO.continueDay)
// this.view['mask' + i].visible = true;
// }
// this.view.signBtn.visible = !signInfoVO.todaySigned;
// this.view.signBtn2.visible = signInfoVO.todaySigned;
// //如果今天签到过了
// if (signInfoVO.todaySigned)
// this.setGray();
let todayIndex = signInfoVO.continueDay - 1;
if (!signInfoVO.todaySigned) {
todayIndex = signInfoVO.continueDay;
}
this.scroll.viewport.scrollV = todayIndex * 162;
if(todayIndex >=4) {
this.scroll.viewport.scrollV = 4 * 162;
}
const tomorrowIndex = todayIndex + 1;
this.list.itemRenderer = SignItem;
const configs = [
{ nums: 1, type: 'object' },
{ nums: 2, type: 'money' },
{ nums: 3, type: 'hammer' },
{ nums: 4, type: 'boom' },
{ nums: 5, type: 'steps' },
{ nums: 6, type: 'object' },
{ nums: 7, type: 'money' }
]
const func = (data,item:SignItem) => {
NetManager.ins.doSign((s)=>{
if(s) {
item.setSinged();
showToast('签到成功~')
}
}, window['signActivityId'])
console.log(data);
}
const list: any[] = [{}, {}, {}, {}, {}, {}, {}];
list.forEach((ele, index) => {
ele.index = index;
ele.config = configs[index];
ele.func = func;
ele.signed = signInfoVO.continueDay > index;
if (index < todayIndex) {//以前
ele.btn = 2;
} else if (index == todayIndex) {//现在
if (signInfoVO.todaySigned)
ele.btn = 2;
else
ele.btn = 1;
} else if (index == tomorrowIndex) {
ele.btn = 3;
} else
ele.btn = 4;
});
this.list.dataProvider = new eui.ArrayCollection(list);
this.list.useVirtualLayout = false;
//要更新元宝数量
......@@ -18,6 +100,6 @@ export default class SignPanel extends Panel {
// showlog() {
// NetManager.ins.showLog(getlogItem(17));
// }
protected get closeBtns(): eui.Button[] { return [this['closeBtn'],this['close2Btn']] }
protected get closeBtns(): eui.Button[] { return [this['closeBtn'], this['close2Btn']] }
get skinKey() { return 'Sign' }
}
\ No newline at end of file
const path = require('path');
const config = {
'/signactivity/getSignInfo': {
data: './sign/getSignInfo.json'
},
'/signactivity/doSign': {
data: './sign/doSign.json'
},
'/customActivity/duiba/imgUrl': {
data: './json/imgUrl.json'
},
......
{
"signInfoVO": {
"acmDay": 1,
"acmDays": 1,
"activityCount": 0,
"activityCountTomorrow": 0,
"continueDay": 1,
"credits": 11,
"creditsTomorrow": 12,
"cusCirDays": 31,
"firstSignDate": 1557902703000,
"hasAcmReward": false,
"lastDays": 1,
"maxContinueDay": 1,
"monthResignedMap": {},
"monthSignedMap": {
"2019-05-15": true
},
"prizeChance": 0,
"prizeChanceTomorrow": 0,
"redCount": 0,
"redCountTomorrow": 0,
"resignCount": -1,
"rewardMap": {
"CONTINUE": {
"activityCount": 0,
"credits": 11,
"rwType": "CONTINUE"
}
},
"todaySigned": true,
"totalCredits": 0
},
"success": true,
"logId": 99003235848145,
"customInfo1": {
"count": 1,
"propsType": "ADD_100"
},
"customInfo": {
"itemUrl": "//activity.m.duibadev.com.cn/activity/takePrizeNew?recordId=30033656",
"orderNum": "989045616311520016",
"prizeName": "zyj测试商品",
"prizeType": "object",
"propsType": "COUPON_2",
"smallImage": "//yun.dui88.com/images/201901/5p8g3g5juc.jpg"
}
}
\ No newline at end of file
{
"signInfoVO": {
"acmDay": 0,
"acmDays": 0,
"activityCount": 0,
"activityCountTomorrow": 0,
"continueDay": 0,
"credits": 0,
"creditsTomorrow": 0,
"cusCirDays": 7,
"firstSignDate": 1557815545160,
"hasAcmReward": false,
"lastDays": 0,
"maxContinueDay": 0,
"monthResignedMap": {},
"monthSignedMap": {},
"prizeChance": 0,
"prizeChanceTomorrow": 0,
"redCount": 0,
"redCountTomorrow": 0,
"resignCount": 0,
"rewardMap": {},
"todaySigned": false,
"totalCredits": 0
},
"credits": 10000,
"success": true
}
\ No newline at end of file
{
"success": true,
"signInfoVO": {
"continueDay": 7,
"todaySigned": 1
}
}
\ 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