Commit cc3f7933 authored by XieChuanJin's avatar XieChuanJin

上传

parent c12e865d
......@@ -4,7 +4,7 @@
<e:Group x="74" y="303">
<e:Image source="input_bg_png" />
<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:skinName>
<e:Skin states="up,down,disabled">
......
......@@ -3,7 +3,7 @@
<e:Image id="bg" source="main_bg_jpg" height="2237" scale9Grid="93,1542,564,456"/>
<e:Group>
<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:Label id="labelBank" text="" y="42" textColor="0xff7191" size="18" horizontalCenter="0" />
<ns1:MButton id="btnCopy" label="" x="167" y="138">
......@@ -38,7 +38,7 @@
</e:Button>
<e:Group id="rankList" x="37.67" y="1332.68" />
</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>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="main_btn_share_png" />
......
......@@ -4,7 +4,7 @@ import MSceneCtrl from "./MainSrc/MCtrls/MSceneCtrl";
import Loading from "./loading/Loading";
import layers from "./MainSrc/MViews/MLayers";
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 { Decorator } from "./MainSrc/Decorator/Decorator";
import ToastPanel from "./MainSrc/MComponents/MToastPanel";
......@@ -68,7 +68,6 @@ class Main extends eui.UILayer {
// resolve();
});
wx.ready(function () {
resolve();
});
......@@ -102,8 +101,14 @@ class Main extends eui.UILayer {
private async runGame() {
await this.loadResource()
await this.getShareInfo();
if (isWeiXin()) {
await this.getShareInfo();
shareActivity();
}
this.createGameScene();
/* setTimeout(() => {
}, 3000); */
}
/* private loadExml(url: string) {
......
......@@ -3,6 +3,7 @@ import MSceneCtrl from "../MCtrls/MSceneCtrl";
import StartScene from "../Scene/StartScene";
import MainScene from "../Scene/MainScene";
import { MConfigs } from "./MConfigs";
import ToastPanel from "../MComponents/MToastPanel";
export const getResPath = () => window['resPath'] || '';
export const getSkinPath = (key: any) => `resource/skins/${key}Skin.exml`
......@@ -39,13 +40,44 @@ export function copy(str: string) {
}
document.addEventListener('copy', save);
document.execCommand("copy");//使文档处于可编辑状态,否则无效
ToastPanel.show("复制成功");
}
export function getShareUrl(jobNum: string) {
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 share = MConfigs.share;
wx.onMenuShareTimeline({
......@@ -98,4 +130,13 @@ export function calculateReward(count: number): number {
reward = Math.min(4000, 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 {
}
export const appId = "0";
export const activityUrl = "http://www.baidu.com";
}
......
......@@ -19,8 +19,6 @@ class Layers extends eui.Group {
// this.sceneLayer.height = MConst.DesignResolution.minHeight;
this.addChild(this.sceneLayer);
this.addChild(this.popupLayer);
this.addChild(this.toastLayer);
this.addChild(this.topLayer);
this.topLayer.width = MConst.DesignResolution.width;
// this.topLayer.height = MConst.DesignResolution.minHeight;
GameMgr.instance.pageScroller = scroller;
......@@ -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_CANCEL, this.onTouchEnd, this);
root.addChild(this.toastLayer);
root.addChild(this.topLayer);
/* const minHeight = MConst.DesignResolution.minHeight;
if (document.body.clientWidth / document.body.clientHeight > ((MConst.DesignResolution.width) / minHeight)) {
let scroller = new eui.Scroller();
......
......@@ -30,7 +30,14 @@ export default class InputNumPanel extends MPanel {
}, () => {
MSceneCtrl.instance.change(MainScene);
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";
import MBuried from "../Global/MBuried";
import RankList from "../UIComponent/RankList";
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 Net from "../Global/Net";
import ToastPanel from "../MComponents/MToastPanel";
......@@ -16,6 +16,7 @@ import { NetUtils } from "../Global/NetUtils";
import RulePanel from "../Panel/RulePanel";
@Decorator.ClassName("MainScene")
@Decorator.OnUpdate
export default class MainScene extends MScene {
public iconEdit: eui.Image;
public labelBank: eui.Label;
......@@ -43,7 +44,7 @@ export default class MainScene extends MScene {
let res = (this.data && this.data.response) || (await NetUtils.getUserInfo());
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.textEditor.text = res.data.code;
this.jobNum = res.data.code;
......@@ -79,11 +80,16 @@ export default class MainScene extends MScene {
}, () => {
// this.jobNum = res.data.code;
MSceneCtrl.instance.change(MainScene);
}, () => {
}, (res2) => {
this.textEditor.text = this.jobNum;
this.testLabel.text = this.textEditor.text;
this.iconEdit.horizontalCenter = this.testLabel.width / 2 + 20;
return false;
if (res2.code == "100202") {
ToastPanel.show("请正确输入员工工号,以K3系统为准");
return true;
} else
return false;
});
}, this);
......@@ -91,15 +97,23 @@ export default class MainScene extends MScene {
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.groupShareTip.visible = true;
this.imgShareTip.y = 131 - GameMgr.instance.pageScroller.y;
invokeWX(this.jobNum);
shareJobNum(this.jobNum);
// window.open(getShareUrl(this.jobNum));
});
GameMgr.instance.pageScroller.onMoved = (target) => {
this.btnShare.y = Math.abs(target.y) + target.realGameHeight - 200;
};
window["onShared"] = () => {
this.groupShareTip.visible = false;
shareActivity();
}
}
}
\ No newline at end of file
......@@ -7,7 +7,9 @@ export default class MScroller extends eui.Group {
private prePosY: number = 0;
private gameMgr: GameMgr = null;
private minY = 0;
private realGameHeight: number = 0;
public realGameHeight: number = 0;
public onMoved: (target: MScroller) => void;
constructor() {
super();
......@@ -29,12 +31,15 @@ export default class MScroller extends eui.Group {
this.y += event.stageY - this.prePosY;
this.y = Math.clamp(this.y, this.realGameHeight - MSceneCtrl.instance.gameHeight, 0);
this.prePosY = event.stageY;
this.onMoved && this.onMoved(this);
}
}
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);
this.y = Math.max(-minY, this.y);
this.onMoved && this.onMoved(this);
}
}
\ No newline at end of file
{
"success": true,
"success": false,
"message": "",
"code": "",
"code": "10202",
"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