Commit ec1680f1 authored by haiyoucuv's avatar haiyoucuv

111

parent aebab240
This diff is collapsed.
{
"success": true,
"message": "",
"data": true
}
{
"code":"000000",
"data":{
"image":"https://source.unsplash.com/user/erondu/250x250",
"amount":20,
"drawStatus":4,
"openId":"AAEAuNyCAKrpWdzBzedO22-F",
"remark":"订购应用已过期,请联系商家处理",
"type":1,
"prizeId":"5edf3a16f344891ad1f6adab",
"activityId":"5edf3a162fccfb74b1d9c5e3",
"ename":"111111",
"userNick":"wmm",
"name":"权益奖品",
"_id":"AAEAuNyCAKrpWdzBzedO22-F1591776396365",
"exchangeDay":"2020/06/10"
},
"success":true,
"message":"成功"
}
......@@ -19,7 +19,9 @@
"startTime": 1591682068000,
"_id": "5edf3a16f344891ad1f6adab",
"endTime": 1591682068000,
"type": 1
"type": 1,
"desc": "描述描述描述描述",
"stock": 2000
},
{
"image": "https://source.unsplash.com/user/erondu/100x100",
......@@ -69,7 +71,9 @@
"startTime": 1591682068000,
"_id": "5edf3a16f344891ad1f6adab",
"endTime": 1591682068000,
"type": 1
"type": 1,
"desc": "描述描述描述描述",
"stock": 2000
},
{
"image": "https://source.unsplash.com/user/erondu/100x100",
......@@ -89,7 +93,9 @@
"startTime": 1591682068000,
"_id": "5edf3a16f344891ad1f6adab",
"endTime": 1591682068000,
"type": 1
"type": 1,
"desc": "描述描述描述描述",
"stock": 2000
}
],
"success": true
......
{
"code": "000000",
"data": [
{
"image": "https://source.unsplash.com/user/erondu/250x250",
"amount": 20,
"drawStatus": 4,
"openId": "AAEAuNyCAKrpWdzBzedO22-F",
"remark": "订购应用已过期,请联系商家处理",
"updateTime": 1591775841679,
"type": 1,
"prizeId": "5edf3a16f344891ad1f6adab",
"activityId": "5edf3a162fccfb74b1d9c5e3",
"ename": "111111",
"userNick": "wmm",
"createTime": 1591775841651,
"name": "权益奖品",
"_id": "AAEAuNyCAKrpWdzBzedO22-F1591775841650",
"exchangeDay": "2020/06/10"
},
{
"image": "https://source.unsplash.com/user/erondu/250x250",
"amount": 20,
"drawStatus": 4,
"openId": "AAEAuNyCAKrpWdzBzedO22-F",
"remark": "订购应用已过期,请联系商家处理",
"updateTime": 1591775703547,
"type": 1,
"prizeId": "5edf3a16f344891ad1f6adab",
"activityId": "5edf3a162fccfb74b1d9c5e3",
"ename": "111111",
"userNick": "wmm",
"createTime": 1591775703513,
"name": "权益奖品",
"_id": "AAEAuNyCAKrpWdzBzedO22-F1591775703513",
"exchangeDay": "2020/06/10"
}
],
"success": true,
"message": "成功"
}
......@@ -20,7 +20,7 @@
{
"taskType": "follow",
"times": 1,
"todayCompleteTimes": 0,
"todayCompleteTimes": 1,
"rewards": 2,
"value": "",
"waitReceive": 0
......
import { Panel } from "../views/Panel";
import { layers } from "../views/layers";
import { showWaiting, hideWaiting } from "./waitingCtrl";
import { showToast } from "./toastCtrl";
import Tween = FYGE.Tween;
export default class PanelCtrl {
/**
......@@ -45,7 +44,12 @@ export default class PanelCtrl {
* 关闭所有弹框
*/
closeAll() {
this.stacks.forEach(e => e.hidePanel());
this.stacks.forEach(e => {
Tween.removeTweens(e);
// e.hidePanel();
e.destroy();
}
);
}
show<T extends Panel>(cls: any, data?: any): T {
......@@ -82,7 +86,7 @@ export default class PanelCtrl {
this._bg.visible = true;
this._bg.alpha = 0;
FYGE.Tween.removeTweens(this._bg);
FYGE.Tween.get(this._bg).to({ alpha: 0.7 }, 200, FYGE.Ease.cubicOut)
FYGE.Tween.get(this._bg).to({alpha: 0.7}, 200, FYGE.Ease.cubicOut)
}
}
......@@ -99,7 +103,7 @@ export default class PanelCtrl {
/**
* 添加进父级并添加事件
* @param panel
* @param panel
*/
private add(panel: Panel) {
this._parent.addChild(panel);
......@@ -108,7 +112,7 @@ export default class PanelCtrl {
/**
* 移除
* @param panel
* @param panel
*/
private remove(panel: Panel) {
this._parent.removeChild(panel);
......@@ -117,7 +121,7 @@ export default class PanelCtrl {
/**
* 弹框移除时执行
* @param e
* @param e
*/
private onPanelHide(e: FYGE.Event) {
const panel = e.target as Panel;
......@@ -149,4 +153,4 @@ export default class PanelCtrl {
this._bg.destroy();
this._bg = null;
}
}
\ No newline at end of file
}
......@@ -33,10 +33,16 @@ export enum TbNetName {
shopList = 'qiaqia2.getExchangeGoodsList',
completeTask = 'qiaqia2.completeTask',
taskList = 'qiaqia2.getTaskList',
wareHouse = 'qiaqiaHome.getStorages',
exchangeGoods = 'qiaqia2.exchangeGoods',
getMyPrizeList = 'qiaqia2.getMyPrizeList',
// 游戏信息
gameInfo = 'qiaqiaHome.getGameInfo',
......
import { Panel } from "../../module/views/Panel";
import { Tool } from "../Tools";
import Sprite = FYGE.Sprite;
import { layers } from "../../module/views/layers";
import { activityId, sendTbNet, TbNetName } from "../TaoBaoNet";
import Sprite = FYGE.Sprite;
import Tween = FYGE.Tween;
import ScrollList = FYGE.ScrollList;
import Container = FYGE.Container;
......@@ -32,36 +33,12 @@ export default class ExRecordPanel extends Panel {
this.scroll = this.addChild(new ScrollList(RecordItem, 653, 200, 653, 830));
this.scroll.position.set((this.width - this.scroll.width) / 2, 210);
this.scroll.updateData([
{
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
prizeName: '恰恰10元抵扣卷',
prizeDate: '1010.01.01',
},
{
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
prizeName: '恰恰20元抵扣卷',
prizeDate: '2020.02.02',
},
{
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
prizeName: '恰恰30元抵扣卷',
prizeDate: '3030.03.03',
},
{
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
prizeName: '恰恰40元抵扣卷',
prizeDate: '4040.04.04',
},
{
prizeImg: 'https://source.unsplash.com/user/erondu/116x116',
prizeName: '恰恰50元抵扣卷',
prizeDate: '5050.05.05',
},
]);
sendTbNet(TbNetName.getMyPrizeList, {
activityId: activityId
}, (success, res) => {
if (!success) return;
this.scroll.updateData(res.data);
});
}
public showAni() {
......@@ -111,9 +88,9 @@ class RecordItem extends Container implements IScrollListItem {
public initData(id: number, data: any): void {
if (!data) return;
this.prizeImg.texture = Texture.fromUrl(data.prizeImg);
this.prizeName.text = data.prizeName;
this.prizeDate.text = `${data.prizeDate}兑换`;
this.prizeImg.texture = Texture.fromUrl(data.image);
this.prizeName.text = data.name;
this.prizeDate.text = `${data.exchangeDay}兑换`;
}
constructor() {
......@@ -123,6 +100,7 @@ class RecordItem extends Container implements IScrollListItem {
this.prizeImg = this.addChild(new Sprite());
this.prizeImg.position.set(34, 25);
this.prizeImg.width = this.prizeImg.height = 116;
const mask = this.addChild(new Graphics());
mask.drawCircle(92, 83, 58);
......
......@@ -3,6 +3,9 @@ import { Tool } from "../Tools";
import Sprite = FYGE.Sprite;
import MouseEvent = FYGE.MouseEvent;
import TextField = FYGE.TextField;
import Texture = FYGE.Texture;
import { showToast } from "../../module/ctrls";
import PanelCtrl from "../../module/ctrls/panelCtrl";
export default class ExSuccessPanel extends Panel {
get groupNames() {
......@@ -22,14 +25,15 @@ export default class ExSuccessPanel extends Panel {
this.closeBtn.position.set(600, 350);
// 图片
this.prizeImg = this.addChild(Tool.getSprite('进度_fill.png'));
this.prizeImg = this.addChild(new Sprite());
this.prizeImg.texture = Texture.fromUrl(this.data.image);
this.prizeImg.width = 427;
this.prizeImg.height = 200;
this.prizeImg.position.set((this.width - this.prizeImg.width) / 2, 677);
// 文案
this.prizeLabel = this.addChild(new TextField());
this.prizeLabel.text = '6字文案';
this.prizeLabel.text = this.data.name;
this.prizeLabel.fillColor = '#c28b4c';
this.prizeLabel.size = 24;
this.prizeLabel.position.set((this.width - this.prizeLabel.textWidth) / 2, 910);
......@@ -39,18 +43,31 @@ export default class ExSuccessPanel extends Panel {
this.btn.position.set((this.width - this.btn.width) / 2, 960);
}
private clickBtn() {
if (+this.data.type == 1 && (this.data.drawStatus == 4 || this.data.drawStatus == 6)) {
showToast('奖品发放失败\n请前往我的奖品处进行处理');
} else if (+this.data.type == 3) {
/// TODO 淘宝地址选择页?
}
this.hideAll();
}
private hideAll() {
PanelCtrl.instance.closeAll();
}
start(data) {
super.start();
}
initEvents() {
this.closeBtn.addEventListener(MouseEvent.CLICK, this.hidePanel, this);
this.btn.addEventListener(MouseEvent.CLICK, this.hidePanel, this);
this.closeBtn.addEventListener(MouseEvent.CLICK, this.hideAll, this);
this.btn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
removeEvents() {
this.closeBtn.removeEventListener(MouseEvent.CLICK, this.hidePanel, this);
this.btn.removeEventListener(MouseEvent.CLICK, this.hidePanel, this);
this.closeBtn.removeEventListener(MouseEvent.CLICK, this.hideAll, this);
this.btn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
}
......@@ -8,6 +8,10 @@ import MouseEvent = FYGE.MouseEvent;
import Container = FYGE.Container;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import TEXT_lINETYPE = FYGE.TEXT_lINETYPE;
import { activityId, sendTbNet, TbNetName } from "../TaoBaoNet";
import PanelCtrl from "../../module/ctrls/panelCtrl";
import ExSuccessPanel from "./ExSuccessPanel";
import { showToast } from "../../module/ctrls";
export class ExchangePanel extends Panel {
get groupNames() {
......@@ -50,32 +54,48 @@ export class ExchangePanel extends Panel {
this.btn = this.addChild(Tool.getSprite(enough ? 'exchange_btn_en.png' : 'exchange_btn_dis.png'));
enough && this.btn.addEventListener(MouseEvent.CLICK, () => {
console.log('兑换');
/// TODO
});
this.btn.position.set((this.width - this.btn.width) / 2, 876);
this.setExchangeInfo();
let introduction = this.addChild(Tool.getText(`商品介绍:${this.data.name}`, 20, '#dbd2ca'));
let introduction = this.addChild(Tool.getText(`商品介绍:${this.data.desc}`, 20, '#dbd2ca'));
introduction.textWidth = 470;
introduction.lineType = TEXT_lINETYPE.MULTI;
introduction.textAlign = TEXT_ALIGN.LEFT;
introduction.position.set(139, 980);
if (this.data.type == 1) {
// let sDate = new Date(this.data.startTime);
let eDate = new Date(this.data.endTime);
// let sLabel = `${sDate.getFullYear()}/${sDate.getMonth() + 1}/${sDate.getDate()}`;
let eLabel = `${eDate.getFullYear()}/${eDate.getMonth() + 1}/${eDate.getDate()} ${eDate.getHours()}:${eDate.getMinutes()}`;
let date = this.addChild(Tool.getText(`${eLabel}合成截止`, 20, '#dbd2ca'));
date.position.set(137, introduction.y + introduction.textHeight + 5);
}
// if (this.data.type == 1) {
// // let sDate = new Date(this.data.startTime);
// let eDate = new Date(this.data.endTime);
// // let sLabel = `${sDate.getFullYear()}/${sDate.getMonth() + 1}/${sDate.getDate()}`;
// let eLabel = `${eDate.getFullYear()}/${eDate.getMonth() + 1}/${eDate.getDate()} ${eDate.getHours()}:${eDate.getMinutes()}`;
// let date = this.addChild(Tool.getText(`${eLabel}合成截止`, 20, '#dbd2ca'));
// date.position.set(137, introduction.y + introduction.textHeight + 5);
// }
if (this.data.isLimitStock) {
// 库存剩余label
let stock = this.addChild(Tool.getText(`剩余数量:${this.data.restStock}/${this.data.stock}份`, 20, '#dbd2ca'));
introduction.textWidth = 470;
introduction.lineType = TEXT_lINETYPE.MULTI;
introduction.textAlign = TEXT_ALIGN.LEFT;
stock.position.set(137, introduction.y + introduction.textHeight + 5);
}
enough && this.btn.addEventListener(MouseEvent.CLICK, () => {
console.log('兑换');
sendTbNet(TbNetName.exchangeGoods, {
activityId: activityId,
_id: this.data._id
}, (success, res) => {
if (!success || !res || !res.data) {
showToast('兑换失败,请稍后再试')
return;
}
let data = res.data;
PanelCtrl.instance.show(ExSuccessPanel, data);
});
});
}
private setExchangeInfo() {
......
......@@ -11,6 +11,7 @@ import Tween = FYGE.Tween;
import TextField = FYGE.TextField;
import MouseEvent = FYGE.MouseEvent;
import Ease = FYGE.Ease;
import { showToast } from "../../module/ctrls";
const TASK_TYPE = {
sign: 'sign',
......@@ -52,7 +53,19 @@ export default class TaskPanel extends Panel {
if (!success) {
return;
}
this.scroll.updateData(res.data);
const a = [
'member',
'follow',
'joinGroup',
];
let data = [];
for (let i = 0; i < res.data.length; i++) {
if (a.indexOf(res.data[i].taskType) > -1 && res.data[i].todayCompleteTimes >= res.data[i].times) {
continue;
}
data.push(res.data[i]);
}
this.scroll.updateData(data);
});
}
......@@ -159,11 +172,23 @@ class TaskItem extends Container implements IScrollListItem {
} else {
this.btn.texture = RES.getRes('task_go.png');
this.btn.addEventListener(MouseEvent.CLICK, () => {
/// TODO 跳转链接?
if (data.taskType == 'joinGroup' || data.taskType == 'member') {
console.log('跳转', data.value);
} else {
console.log('不跳转');
}
sendTbNet(TbNetName.completeTask, {
taskType:data.taskType,
activityId: activityId
}, (success, res) => {
if(!success || !res || !res.data){
showToast('网络异常,请稍后重试');
return;
}
});
});
}
}
......
......@@ -11,6 +11,7 @@ import WareHousePanel from "../../panels/WareHousePanel";
import ShopPanel from "../../panels/ShopPanel";
import RulePanel from "../../panels/RulePanel";
import { getTbData, TbNetName } from "../../TaoBaoNet";
import ExRecordPanel from "../../panels/ExRecordPanel";
export let G_wareHouseEffect = () => {
};
......@@ -74,8 +75,8 @@ export class UILayer extends Container {
break;
case this.ruleBtn:
console.log('点击了规则');
PanelCtrl.instance.show(RulePanel);
// PanelCtrl.instance.show(ExRecordPanel);
// PanelCtrl.instance.show(RulePanel);
PanelCtrl.instance.show(ExRecordPanel);
break;
}
}
......
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