Commit cc3f7933 authored by XieChuanJin's avatar XieChuanJin

上传

parent c12e865d
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<e:Group x="74" y="303"> <e:Group x="74" y="303">
<e:Image source="input_bg_png" /> <e:Image source="input_bg_png" />
<e:Image source="input_editor_bg_png" y="156" x="43"/> <e:Image source="input_editor_bg_png" y="156" x="43"/>
<e:EditableText id="editor" width="516" height="95" text="" x="43" y="156" textColor="0xbebebe" size="24" textAlign="center" verticalAlign="middle" prompt="请在此输入员工号" promptColor="0xbebebe"/> <e:EditableText id="editor" width="516" height="95" text="" x="43" y="156" textColor="0xbebebe" size="24" textAlign="center" verticalAlign="middle" prompt="请在此输入员工号" promptColor="0xbebebe"/>
<ns1:MButton id="btnOk" label="" x="41" y="291"> <ns1:MButton id="btnOk" label="" x="41" y="291">
<ns1:skinName> <ns1:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<e:Image id="bg" source="main_bg_jpg" height="2237" scale9Grid="93,1542,564,456"/> <e:Image id="bg" source="main_bg_jpg" height="2237" scale9Grid="93,1542,564,456"/>
<e:Group> <e:Group>
<e:Group width="582" height="296" x="85" y="352" anchorOffsetY="0" anchorOffsetX="0"> <e:Group width="582" height="296" x="85" y="352" anchorOffsetY="0" anchorOffsetX="0">
<e:Label text="员工号" y="9" textColor="0xfb2b5e" size="30" x="231" /> <e:Label text="员工号" y="9" textColor="0xfb2b5e" size="30" x="231" />
<e:Image id="iconEdit" source="main_edit_icon_png" x="402" y="85" /> <e:Image id="iconEdit" source="main_edit_icon_png" x="402" y="85" />
<e:Label id="labelBank" text="" y="42" textColor="0xff7191" size="18" horizontalCenter="0" /> <e:Label id="labelBank" text="" y="42" textColor="0xff7191" size="18" horizontalCenter="0" />
<ns1:MButton id="btnCopy" label="" x="167" y="138"> <ns1:MButton id="btnCopy" label="" x="167" y="138">
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</e:Button> </e:Button>
<e:Group id="rankList" x="37.67" y="1332.68" /> <e:Group id="rankList" x="37.67" y="1332.68" />
</e:Group> </e:Group>
<ns1:MButton id="btnShare" label="" x="25.1" bottom="23"> <ns1:MButton id="btnShare" label="" x="25.1" y="0" visible="false">
<ns1:skinName> <ns1:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="main_btn_share_png" /> <e:Image width="100%" height="100%" source="main_btn_share_png" />
......
...@@ -4,7 +4,7 @@ import MSceneCtrl from "./MainSrc/MCtrls/MSceneCtrl"; ...@@ -4,7 +4,7 @@ import MSceneCtrl from "./MainSrc/MCtrls/MSceneCtrl";
import Loading from "./loading/Loading"; import Loading from "./loading/Loading";
import layers from "./MainSrc/MViews/MLayers"; import layers from "./MainSrc/MViews/MLayers";
import MTopLayerCtrl from './MainSrc/MCtrls/MTopLayerCtrl'; import MTopLayerCtrl from './MainSrc/MCtrls/MTopLayerCtrl';
import { getResPath, calculateReward } from "./MainSrc/Global/GUtils"; import { getResPath, calculateReward, isWeiXin, shareActivity } from "./MainSrc/Global/GUtils";
import { customClassPrototype } from "./MainSrc/MComponents/Custom"; import { customClassPrototype } from "./MainSrc/MComponents/Custom";
import { Decorator } from "./MainSrc/Decorator/Decorator"; import { Decorator } from "./MainSrc/Decorator/Decorator";
import ToastPanel from "./MainSrc/MComponents/MToastPanel"; import ToastPanel from "./MainSrc/MComponents/MToastPanel";
...@@ -68,7 +68,6 @@ class Main extends eui.UILayer { ...@@ -68,7 +68,6 @@ class Main extends eui.UILayer {
// resolve(); // resolve();
}); });
wx.ready(function () { wx.ready(function () {
resolve(); resolve();
}); });
...@@ -102,8 +101,14 @@ class Main extends eui.UILayer { ...@@ -102,8 +101,14 @@ class Main extends eui.UILayer {
private async runGame() { private async runGame() {
await this.loadResource() await this.loadResource()
await this.getShareInfo(); if (isWeiXin()) {
await this.getShareInfo();
shareActivity();
}
this.createGameScene(); this.createGameScene();
/* setTimeout(() => {
}, 3000); */
} }
/* private loadExml(url: string) { /* private loadExml(url: string) {
......
...@@ -3,6 +3,7 @@ import MSceneCtrl from "../MCtrls/MSceneCtrl"; ...@@ -3,6 +3,7 @@ import MSceneCtrl from "../MCtrls/MSceneCtrl";
import StartScene from "../Scene/StartScene"; import StartScene from "../Scene/StartScene";
import MainScene from "../Scene/MainScene"; import MainScene from "../Scene/MainScene";
import { MConfigs } from "./MConfigs"; import { MConfigs } from "./MConfigs";
import ToastPanel from "../MComponents/MToastPanel";
export const getResPath = () => window['resPath'] || ''; export const getResPath = () => window['resPath'] || '';
export const getSkinPath = (key: any) => `resource/skins/${key}Skin.exml` export const getSkinPath = (key: any) => `resource/skins/${key}Skin.exml`
...@@ -39,13 +40,44 @@ export function copy(str: string) { ...@@ -39,13 +40,44 @@ export function copy(str: string) {
} }
document.addEventListener('copy', save); document.addEventListener('copy', save);
document.execCommand("copy");//使文档处于可编辑状态,否则无效 document.execCommand("copy");//使文档处于可编辑状态,否则无效
ToastPanel.show("复制成功");
} }
export function getShareUrl(jobNum: string) { export function getShareUrl(jobNum: string) {
return MConfigs.share.url + "&jobNum=" + jobNum; return MConfigs.share.url + "&jobNum=" + jobNum;
} }
export function invokeWX(jobNum: string) {
export function shareActivity() {
let wx = window["wx"];
let share = {
title: "重庆银行营销精英挑战赛",
desc: "您的好友邀请您参加重庆银行营销精英挑战赛,快来参与吧!",
imgUrl: MConfigs.share.imgUrl
}
wx.onMenuShareTimeline({
title: share.title,
desc: share.desc,
link:/* MConfigs.activityUrl */window.location.href,
imgUrl: share.imgUrl,
success: function () {
},
cancel: function () {
}
});
wx.onMenuShareAppMessage({
title: share.title,
desc: share.desc,
link: /* MConfigs.activityUrl */window.location.href,
imgUrl: share.imgUrl,
success: function () {
},
cancel: function () {
}
});
}
export function shareJobNum(jobNum: string) {
let wx = window["wx"]; let wx = window["wx"];
let share = MConfigs.share; let share = MConfigs.share;
wx.onMenuShareTimeline({ wx.onMenuShareTimeline({
...@@ -98,4 +130,13 @@ export function calculateReward(count: number): number { ...@@ -98,4 +130,13 @@ export function calculateReward(count: number): number {
reward = Math.min(4000, reward); reward = Math.min(4000, reward);
return reward; return reward;
}
export function isWeiXin() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i)) {
return true
} else {
return false
}
} }
\ No newline at end of file
...@@ -24,6 +24,8 @@ export namespace MConfigs { ...@@ -24,6 +24,8 @@ export namespace MConfigs {
} }
export const appId = "0"; export const appId = "0";
export const activityUrl = "http://www.baidu.com";
} }
......
...@@ -19,8 +19,6 @@ class Layers extends eui.Group { ...@@ -19,8 +19,6 @@ class Layers extends eui.Group {
// this.sceneLayer.height = MConst.DesignResolution.minHeight; // this.sceneLayer.height = MConst.DesignResolution.minHeight;
this.addChild(this.sceneLayer); this.addChild(this.sceneLayer);
this.addChild(this.popupLayer); this.addChild(this.popupLayer);
this.addChild(this.toastLayer);
this.addChild(this.topLayer);
this.topLayer.width = MConst.DesignResolution.width; this.topLayer.width = MConst.DesignResolution.width;
// this.topLayer.height = MConst.DesignResolution.minHeight; // this.topLayer.height = MConst.DesignResolution.minHeight;
GameMgr.instance.pageScroller = scroller; GameMgr.instance.pageScroller = scroller;
...@@ -28,6 +26,9 @@ class Layers extends eui.Group { ...@@ -28,6 +26,9 @@ class Layers extends eui.Group {
this.stage.addEventListener(egret.TouchEvent.TOUCH_END, this.onTouchEnd, this); this.stage.addEventListener(egret.TouchEvent.TOUCH_END, this.onTouchEnd, this);
this.stage.addEventListener(egret.TouchEvent.TOUCH_CANCEL, this.onTouchEnd, this); this.stage.addEventListener(egret.TouchEvent.TOUCH_CANCEL, this.onTouchEnd, this);
root.addChild(this.toastLayer);
root.addChild(this.topLayer);
/* const minHeight = MConst.DesignResolution.minHeight; /* const minHeight = MConst.DesignResolution.minHeight;
if (document.body.clientWidth / document.body.clientHeight > ((MConst.DesignResolution.width) / minHeight)) { if (document.body.clientWidth / document.body.clientHeight > ((MConst.DesignResolution.width) / minHeight)) {
let scroller = new eui.Scroller(); let scroller = new eui.Scroller();
......
...@@ -30,7 +30,14 @@ export default class InputNumPanel extends MPanel { ...@@ -30,7 +30,14 @@ export default class InputNumPanel extends MPanel {
}, () => { }, () => {
MSceneCtrl.instance.change(MainScene); MSceneCtrl.instance.change(MainScene);
this.hidePanel(); this.hidePanel();
}, () => { r() }); }, (res2) => {
r();
if (res2.code == "100202") {
ToastPanel.show("请正确输入员工工号,以K3系统为准");
return true;
} else
return false;
});
}); });
} }
} }
\ No newline at end of file
...@@ -8,7 +8,7 @@ import GameMgr from "../Mgr/GameMgr"; ...@@ -8,7 +8,7 @@ import GameMgr from "../Mgr/GameMgr";
import MBuried from "../Global/MBuried"; import MBuried from "../Global/MBuried";
import RankList from "../UIComponent/RankList"; import RankList from "../UIComponent/RankList";
import MTextEditor from "../MUI/MTextEditor"; import MTextEditor from "../MUI/MTextEditor";
import { copy as copyToClipboard, invokeWX, calculateReward, getShareUrl } from "../Global/GUtils"; import { copy as copyToClipboard, shareJobNum, calculateReward, getShareUrl, shareActivity } from "../Global/GUtils";
import MSceneCtrl from "../MCtrls/MSceneCtrl"; import MSceneCtrl from "../MCtrls/MSceneCtrl";
import Net from "../Global/Net"; import Net from "../Global/Net";
import ToastPanel from "../MComponents/MToastPanel"; import ToastPanel from "../MComponents/MToastPanel";
...@@ -16,6 +16,7 @@ import { NetUtils } from "../Global/NetUtils"; ...@@ -16,6 +16,7 @@ import { NetUtils } from "../Global/NetUtils";
import RulePanel from "../Panel/RulePanel"; import RulePanel from "../Panel/RulePanel";
@Decorator.ClassName("MainScene") @Decorator.ClassName("MainScene")
@Decorator.OnUpdate
export default class MainScene extends MScene { export default class MainScene extends MScene {
public iconEdit: eui.Image; public iconEdit: eui.Image;
public labelBank: eui.Label; public labelBank: eui.Label;
...@@ -43,7 +44,7 @@ export default class MainScene extends MScene { ...@@ -43,7 +44,7 @@ export default class MainScene extends MScene {
let res = (this.data && this.data.response) || (await NetUtils.getUserInfo()); let res = (this.data && this.data.response) || (await NetUtils.getUserInfo());
this.labelBank.text = `(${res.data.department})`; this.labelBank.text = `(${res.data.department})`;
this.labelMonthInvite.text = `周累计邀请${res.data.weekCount}人`; this.labelMonthInvite.text = `周累计邀请${res.data.weekCount}人`;
this.labelReward.text = `总邀请${res.data.totalCount}人 预计可获得奖励${calculateReward(res.data.totalCount)}元`; this.labelReward.text = `总邀请${res.data.totalCount}人 预计可获得奖励${calculateReward(res.data.totalCount)}元`;
this.textEditor.text = res.data.code; this.textEditor.text = res.data.code;
this.jobNum = res.data.code; this.jobNum = res.data.code;
...@@ -79,11 +80,16 @@ export default class MainScene extends MScene { ...@@ -79,11 +80,16 @@ export default class MainScene extends MScene {
}, () => { }, () => {
// this.jobNum = res.data.code; // this.jobNum = res.data.code;
MSceneCtrl.instance.change(MainScene); MSceneCtrl.instance.change(MainScene);
}, () => { }, (res2) => {
this.textEditor.text = this.jobNum; this.textEditor.text = this.jobNum;
this.testLabel.text = this.textEditor.text; this.testLabel.text = this.textEditor.text;
this.iconEdit.horizontalCenter = this.testLabel.width / 2 + 20; this.iconEdit.horizontalCenter = this.testLabel.width / 2 + 20;
return false;
if (res2.code == "100202") {
ToastPanel.show("请正确输入员工工号,以K3系统为准");
return true;
} else
return false;
}); });
}, this); }, this);
...@@ -91,15 +97,23 @@ export default class MainScene extends MScene { ...@@ -91,15 +97,23 @@ export default class MainScene extends MScene {
copyToClipboard(this.jobNum); copyToClipboard(this.jobNum);
}); });
this.btnShare.visible = true;
this.btnShare.y = Math.abs(GameMgr.instance.pageScroller.y) + GameMgr.instance.pageScroller.realGameHeight - 200;
this.btnShare.onTap(this, () => { this.btnShare.onTap(this, () => {
this.groupShareTip.visible = true; this.groupShareTip.visible = true;
this.imgShareTip.y = 131 - GameMgr.instance.pageScroller.y; this.imgShareTip.y = 131 - GameMgr.instance.pageScroller.y;
invokeWX(this.jobNum); shareJobNum(this.jobNum);
// window.open(getShareUrl(this.jobNum)); // window.open(getShareUrl(this.jobNum));
}); });
GameMgr.instance.pageScroller.onMoved = (target) => {
this.btnShare.y = Math.abs(target.y) + target.realGameHeight - 200;
};
window["onShared"] = () => { window["onShared"] = () => {
this.groupShareTip.visible = false; this.groupShareTip.visible = false;
shareActivity();
} }
} }
} }
\ No newline at end of file
...@@ -7,7 +7,9 @@ export default class MScroller extends eui.Group { ...@@ -7,7 +7,9 @@ export default class MScroller extends eui.Group {
private prePosY: number = 0; private prePosY: number = 0;
private gameMgr: GameMgr = null; private gameMgr: GameMgr = null;
private minY = 0; private minY = 0;
private realGameHeight: number = 0; public realGameHeight: number = 0;
public onMoved: (target: MScroller) => void;
constructor() { constructor() {
super(); super();
...@@ -29,12 +31,15 @@ export default class MScroller extends eui.Group { ...@@ -29,12 +31,15 @@ export default class MScroller extends eui.Group {
this.y += event.stageY - this.prePosY; this.y += event.stageY - this.prePosY;
this.y = Math.clamp(this.y, this.realGameHeight - MSceneCtrl.instance.gameHeight, 0); this.y = Math.clamp(this.y, this.realGameHeight - MSceneCtrl.instance.gameHeight, 0);
this.prePosY = event.stageY; this.prePosY = event.stageY;
this.onMoved && this.onMoved(this);
} }
} }
refreshPos() { refreshPos() {
let minY = this.height - (document.body.clientHeight / document.body.clientWidth) * MConst.DesignResolution.width; let minY = MSceneCtrl.instance.curBg.height - (document.body.clientHeight / document.body.clientWidth) * MConst.DesignResolution.width;
// console.error(-minY, this.y); // console.error(-minY, this.y);
this.y = Math.max(-minY, this.y); this.y = Math.max(-minY, this.y);
this.onMoved && this.onMoved(this);
} }
} }
\ No newline at end of file
{ {
"success": true, "success": false,
"message": "", "message": "",
"code": "", "code": "10202",
"data": null "data": 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