Commit 89093b6e authored by haiyoucuv's avatar haiyoucuv

1

parent 80794010
<component name="ProjectDictionaryState">
<dictionary name="haiyoucuv">
<words>
<w>projectx</w>
</words>
</dictionary>
</component>
\ No newline at end of file
...@@ -3,9 +3,13 @@ ...@@ -3,9 +3,13 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="9464afa6-0efb-46c2-9cfd-05475acd81df" name="Default Changelist" comment=""> <list default="true" id="9464afa6-0efb-46c2-9cfd-05475acd81df" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/libs/tw/enum/NetName.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/libs/tw/enum/NetName.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/libs/tw/manager/NetManager.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/libs/tw/manager/NetManager.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/egret/libs/tw/manager/NetManager.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/libs/tw/manager/NetManager.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/resource/skins/ShopItemSkin.exml" beforeDir="false" afterPath="$PROJECT_DIR$/egret/resource/skins/ShopItemSkin.exml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/egret/src/Scenes/ShopScene/ShopScene.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/Scenes/ShopScene/ShopScene.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/egret/src/comm/UtilsConst.ts" beforeDir="false" afterPath="$PROJECT_DIR$/egret/src/comm/UtilsConst.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mock/config.js" beforeDir="false" afterPath="$PROJECT_DIR$/mock/config.js" afterDir="false" /> <change beforePath="$PROJECT_DIR$/mock/config.js" beforeDir="false" afterPath="$PROJECT_DIR$/mock/config.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mock/joyousManor/userProp.json" beforeDir="false" afterPath="$PROJECT_DIR$/mock/joyousManor/useProp.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/mock/projectX/mergeQuery.json" beforeDir="false" afterPath="$PROJECT_DIR$/mock/projectX/mergeQuery.json" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -114,7 +118,8 @@ ...@@ -114,7 +118,8 @@
<workItem from="1576806980182" duration="7591000" /> <workItem from="1576806980182" duration="7591000" />
<workItem from="1577069181480" duration="20171000" /> <workItem from="1577069181480" duration="20171000" />
<workItem from="1577106840316" duration="37273000" /> <workItem from="1577106840316" duration="37273000" />
<workItem from="1577244740252" duration="3568000" /> <workItem from="1577244740252" duration="3830000" />
<workItem from="1577254370549" duration="3663000" />
</task> </task>
<servers /> <servers />
</component> </component>
...@@ -134,10 +139,10 @@ ...@@ -134,10 +139,10 @@
<screen x="36" y="23" width="1644" height="1027" /> <screen x="36" y="23" width="1644" height="1027" />
</state> </state>
<state x="614" y="412" key="#com.intellij.ide.actions.ChooseComponentsToExportDialog/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027" timestamp="1575511344808" /> <state x="614" y="412" key="#com.intellij.ide.actions.ChooseComponentsToExportDialog/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027" timestamp="1575511344808" />
<state x="367" y="174" key="SettingsEditor" timestamp="1575691018533"> <state x="367" y="174" key="SettingsEditor" timestamp="1577254345247">
<screen x="36" y="23" width="1644" height="1027" /> <screen x="36" y="23" width="1644" height="1027" />
</state> </state>
<state x="367" y="174" key="SettingsEditor/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027" timestamp="1575691018533" /> <state x="367" y="174" key="SettingsEditor/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027" timestamp="1577254345247" />
<state x="659" y="460" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1577173626166"> <state x="659" y="460" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1577173626166">
<screen x="36" y="23" width="1644" height="1027" /> <screen x="36" y="23" width="1644" height="1027" />
</state> </state>
...@@ -150,10 +155,10 @@ ...@@ -150,10 +155,10 @@
<screen x="36" y="23" width="1644" height="1027" /> <screen x="36" y="23" width="1644" height="1027" />
</state> </state>
<state x="586" y="160" key="refactoring.ChangeSignatureDialog/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027" timestamp="1575965663028" /> <state x="586" y="160" key="refactoring.ChangeSignatureDialog/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027" timestamp="1575965663028" />
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1577254040986"> <state x="523" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1577258013559">
<screen x="36" y="23" width="1644" height="1027" /> <screen x="36" y="23" width="1644" height="1027" />
</state> </state>
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027" timestamp="1577254040986" /> <state x="523" y="250" width="670" height="676" key="search.everywhere.popup/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027" timestamp="1577258013559" />
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup/36.23.1644.1027@36.23.1644.1027" timestamp="1576573315855" /> <state x="523" y="250" width="670" height="676" key="search.everywhere.popup/36.23.1644.1027@36.23.1644.1027" timestamp="1576573315855" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
......
...@@ -129,6 +129,7 @@ export enum NetName { ...@@ -129,6 +129,7 @@ export enum NetName {
QUERY_RECORDS, QUERY_RECORDS,
GET_PROJECTUSERINFO, GET_PROJECTUSERINFO,
GET_RULE, GET_RULE,
MERGE_QUERY,
GET_LANDINFO, GET_LANDINFO,
DO_PLANT, DO_PLANT,
......
...@@ -2499,7 +2499,7 @@ export class NetManager extends ABNetManager { ...@@ -2499,7 +2499,7 @@ export class NetManager extends ABNetManager {
*/ */
public mergeQuery(callback: Function, querys) { public mergeQuery(callback: Function, querys) {
const net: INetData = { const net: INetData = {
name: NetName.GET_RULE, name: NetName.MERGE_QUERY,
uri: '/projectx/{projectId}/merge.query', uri: '/projectx/{projectId}/merge.query',
type: 'get', type: 'get',
dataType: 'json', dataType: 'json',
...@@ -2676,15 +2676,15 @@ export class NetManager extends ABNetManager { ...@@ -2676,15 +2676,15 @@ export class NetManager extends ABNetManager {
this.send(net); this.send(net);
} }
public prizeInfo(callback: Function, prizeIds) { public prizeInfo(callback: Function, prizeIds?) {
const net: INetData = { const net: INetData = {
name: NetName.GET_PRIZEINFO, name: NetName.GET_PRIZEINFO,
uri: '/projectx/{projectId}/join_6/prizeInfo.do', uri: '/projectx/{projectId}/join_6/prizeInfo.do',
type: 'get', type: 'get',
dataType: 'json', dataType: 'json',
param: { param: prizeIds ? {
prizeIds: prizeIds prizeIds: prizeIds
}, } : {},
callback: callback callback: callback
}; };
this.send(net); this.send(net);
...@@ -2717,7 +2717,7 @@ export class NetManager extends ABNetManager { ...@@ -2717,7 +2717,7 @@ export class NetManager extends ABNetManager {
this.send(net); this.send(net);
} }
public userProp(callback: Function, spId, landId) { public useProp(callback: Function, spId, landId) {
const net: INetData = { const net: INetData = {
name: NetName.USER_PROP, name: NetName.USER_PROP,
uri: '/projectx/{projectId}/join_8/join.do', uri: '/projectx/{projectId}/join_8/join.do',
......
...@@ -5,7 +5,7 @@ import { NetManager } from "../../../libs/tw/manager/NetManager"; ...@@ -5,7 +5,7 @@ import { NetManager } from "../../../libs/tw/manager/NetManager";
import PanelCtrl from "../../ctrls/panelCtrl"; import PanelCtrl from "../../ctrls/panelCtrl";
import { GDispatcher } from "../../../libs/tc/util/GDispatcher"; import { GDispatcher } from "../../../libs/tc/util/GDispatcher";
import { getSkinPath } from "../../utils"; import { getSkinPath } from "../../utils";
import { btnDelay } from "../../comm/UtilsConst"; import { btnDelay, deepClone } from "../../comm/UtilsConst";
import { G_GetHomeDataByKey, HOME } from "../Home"; import { G_GetHomeDataByKey, HOME } from "../Home";
export const shopSpData = { export const shopSpData = {
...@@ -35,6 +35,8 @@ export const shopSpData = { ...@@ -35,6 +35,8 @@ export const shopSpData = {
}, },
}; };
const ruNum = 20; // 发奖规则的个数
export default class ShopScene extends Scene { export default class ShopScene extends Scene {
public group: eui.Group; public group: eui.Group;
public shopLayer: eui.Group; public shopLayer: eui.Group;
...@@ -55,6 +57,8 @@ export default class ShopScene extends Scene { ...@@ -55,6 +57,8 @@ export default class ShopScene extends Scene {
public foodLabel: eui.Label; public foodLabel: eui.Label;
public foodBtn: eui.Image; public foodBtn: eui.Image;
private prizeData = {};
constructor(data?) { constructor(data?) {
super(data); super(data);
} }
...@@ -67,32 +71,19 @@ export default class ShopScene extends Scene { ...@@ -67,32 +71,19 @@ export default class ShopScene extends Scene {
private reset() { private reset() {
console.log(G_GetHomeDataByKey(HOME.PRODUCT)); console.log(G_GetHomeDataByKey(HOME.PRODUCT));
this.getPropInfo(); // 获得道具详情 this.getPropInfo(); // 获得道具详情
this.setGoods();
let data = [1, 2, 3, 4]; let data = [1, 2, 3, 4];
this.list.useVirtualLayout = false; this.list.useVirtualLayout = false;
this.list.itemRenderer = ShopItem; this.list.itemRenderer = ShopItem;
this.list.dataProvider = new eui.ArrayCollection(data); this.list.dataProvider = new eui.ArrayCollection(data);
} }
protected initEvents() {
super.initEvents();
GDispatcher.addEvent('docVisible', this.reset, this);
}
protected removeEvents() {
super.removeEvents();
GDispatcher.removeEvent('docVisible', this.reset, this);
}
private initUI(): void { private initUI(): void {
this.group.height = 750 / window.innerWidth * window.innerHeight; this.group.height = 750 / window.innerWidth * window.innerHeight;
this.reset(); this.reset();
} }
destroy() {
super.destroy();
}
protected getTapEvts(): any[] { protected getTapEvts(): any[] {
return super.getTapEvts().concat([ return super.getTapEvts().concat([
[this.backBtn, this.onTouchTap, this], [this.backBtn, this.onTouchTap, this],
...@@ -130,6 +121,7 @@ export default class ShopScene extends Scene { ...@@ -130,6 +121,7 @@ export default class ShopScene extends Scene {
this.propBtn.source = '道具b_png'; this.propBtn.source = '道具b_png';
this.goodsGroup.visible = true; this.goodsGroup.visible = true;
this.propGroup.visible = false; this.propGroup.visible = false;
this.setGoods();
break; break;
case this.propBtn: case this.propBtn:
...@@ -137,6 +129,7 @@ export default class ShopScene extends Scene { ...@@ -137,6 +129,7 @@ export default class ShopScene extends Scene {
this.propBtn.source = '道具w_png'; this.propBtn.source = '道具w_png';
this.goodsGroup.visible = false; this.goodsGroup.visible = false;
this.propGroup.visible = true; this.propGroup.visible = true;
this.getPropInfo();
break; break;
default: default:
...@@ -144,6 +137,45 @@ export default class ShopScene extends Scene { ...@@ -144,6 +137,45 @@ export default class ShopScene extends Scene {
} }
} }
private setGoods() {
this.getGoodsInfo().then((res) => {
}).catch((err)=>{
});
}
private getGoodsInfo() {
// 聚合查询
let querys = {};
for(let i = 1; i <= ruNum; i++) {
querys[`ru_${i}`] = {
path: `/projectx/${window['projectId']}/ru_${i}.query`,
optionId: {},
}
}
return new Promise((resolve, reject) => {
NetManager.ins.mergeQuery((success, res) => {
if(!success) {
reject();
return;
}
console.log(res);
const data = res.data;
for(let k in data) {
this.prizeData[data[k]['prizeId']] = deepClone(data[k]); // 保存商品信息
this.prizeData[data[k]['prizeId']]['strategyId'] = k; // 保存规则Id
}
console.log(this.prizeData);
NetManager.ins.prizeInfo((success)=>{
});
resolve();
}, querys);
});
}
// shop_buy_png shop_none_png shop_done_png // shop_buy_png shop_none_png shop_done_png
/** /**
...@@ -181,6 +213,20 @@ export default class ShopScene extends Scene { ...@@ -181,6 +213,20 @@ export default class ShopScene extends Scene {
}); });
} }
protected initEvents() {
super.initEvents();
GDispatcher.addEvent('docVisible', this.reset, this);
}
protected removeEvents() {
super.removeEvents();
GDispatcher.removeEvent('docVisible', this.reset, this);
}
destroy() {
super.destroy();
}
public get skinKey() { public get skinKey() {
return 'ShopScene' return 'ShopScene'
} }
...@@ -188,7 +234,6 @@ export default class ShopScene extends Scene { ...@@ -188,7 +234,6 @@ export default class ShopScene extends Scene {
public get groupName() { public get groupName() {
return 'shop' return 'shop'
} }
} }
// 商店列表 // 商店列表
......
...@@ -91,21 +91,16 @@ export const prefixInteger = function(num, length) { ...@@ -91,21 +91,16 @@ export const prefixInteger = function(num, length) {
* @returns {Object} obj - 拷贝完成的对象 * @returns {Object} obj - 拷贝完成的对象
*/ */
export const deepClone = function(src, dst = undefined) { export const deepClone = function(src, dst = undefined) {
if(src) { if(!(src instanceof Object) && !(src instanceof Array)){
return src; return src;
} }
let _obj = dst || (src instanceof Array ? [] : {}); let _obj = dst || src instanceof Array ? [] : {};
for(let key in src) { for(let key in src) {
let prop = src[key]; let prop = src[key];
if(prop === _obj) { // 避免相互引用对象导致死循环,如src.a = dst的情况 if(prop === _obj) { // 避免相互引用对象导致死循环,如src.a = dst的情况
continue; continue;
} }
_obj[key] = ((typeof prop === 'object') ? this.deepClone(prop) : _obj[key] = prop); _obj[key] = ((typeof prop === 'object') ? deepClone(prop) : _obj[key] = prop);
// if (typeof prop === 'object') { // 如果这是个对象则递归调用
// _obj[key] = _deepClone(prop);
// } else {
// _obj[key] = prop;
// }
} }
return _obj; return _obj;
}; };
......
...@@ -336,7 +336,7 @@ const config = { ...@@ -336,7 +336,7 @@ const config = {
data: './joyousManor/propInfo.json' data: './joyousManor/propInfo.json'
}, },
'/projectx/{projectId}/join_8/join.do': { '/projectx/{projectId}/join_8/join.do': {
data: './joyousManor/userProp.json' data: './joyousManor/useProp.json'
}, },
}; };
......
{
"success": true,
"message": "WmV^#z",
"data": {
"ru_1": {
"icon": "//yun.dui88.com/images/201907/ui83og75fr.png",
"id": "o8c947e58",
"index": 1,
"name": "看看看看看",
"prizeId": "sss_1",
"prizeType": 2
},
"ru_2": {
"icon": "//yun.dui88.com/images/201907/ui83og75fr.png",
"id": "o8c947e58",
"index": 1,
"name": "啊啊啊啊啊",
"prizeId": "sss_2",
"prizeType": 2
},
"ru_3": {
"icon": "//yun.dui88.com/projectxh5/alipay-250-250.png",
"id": "o8c947e58",
"index": 1,
"name": "呵呵呵呵呵",
"prizeId": "sss_3",
"prizeType": 2
},
"ru_4": {
"icon": "//yun.dui88.com/projectxh5/phonebill-250-250.png",
"id": "o8c947e58",
"index": 1,
"name": "哈哈哈哈哈",
"prizeId": "sss_4",
"prizeType": 2
}
}
}
\ 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