Commit 72651a60 authored by wjf's avatar wjf

l

parent 2c143171
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
console.log(shareApi.callMediaShare); console.log(shareApi.callMediaShare);
shareApi.callNativeShare(title, content, targetUrl, iconUrl, shareWays); shareApi.callNativeShare(title, content, targetUrl, iconUrl, shareWays);
} }
}
function isIphone() { function isIphone() {
var ua = navigator.userAgent.toLocaleLowerCase(); var ua = navigator.userAgent.toLocaleLowerCase();
if (ua.match(/iphone|ipad/)) { if (ua.match(/iphone|ipad/)) {
......
...@@ -78,7 +78,6 @@ import ShopTipPanel from "../../src/panels/ShopTipPanel"; ...@@ -78,7 +78,6 @@ import ShopTipPanel from "../../src/panels/ShopTipPanel";
import RechargePanel from "../../src/panels/RechargePanel"; import RechargePanel from "../../src/panels/RechargePanel";
import BombTips2Panel from "../../src/panels/BombTips2Panel"; import BombTips2Panel from "../../src/panels/BombTips2Panel";
import BackIndexPanel from "../../src/panels/BackIndexPanel"; import BackIndexPanel from "../../src/panels/BackIndexPanel";
import { ShareCodePanel } from "../../src/panels/ShareCodePanel";
export default class MainBase extends eui.UILayer { export default class MainBase extends eui.UILayer {
constructor() { constructor() {
...@@ -167,7 +166,6 @@ export default class MainBase extends eui.UILayer { ...@@ -167,7 +166,6 @@ export default class MainBase extends eui.UILayer {
['taskCenterNoPrize', { cls: TaskCenterNoPrize }], ['taskCenterNoPrize', { cls: TaskCenterNoPrize }],
['shopTip', { cls: ShopTipPanel }], ['shopTip', { cls: ShopTipPanel }],
['recharge', { cls: RechargePanel }], ['recharge', { cls: RechargePanel }],
['ShareCodePanel', { cls: ShareCodePanel }],
]; ];
const scenes = [ const scenes = [
......
...@@ -15,6 +15,11 @@ export default class NoPrizePanel extends Panel { ...@@ -15,6 +15,11 @@ export default class NoPrizePanel extends Panel {
super.start(); super.start();
this._level = parseInt(data.level + ''); this._level = parseInt(data.level + '');
this['lvTxt'].text = `关卡${this._level}` this['lvTxt'].text = `关卡${this._level}`
//0224需求,去掉炫耀按钮,继续闯关按钮居中
this['shareBtn'].visible = false;
this['goBtn'].horizontalCenter = 0;
this['shareBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this['shareBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(getlogItem(16)); NetManager.ins.clickLog(getlogItem(16));
if (iswx()) { if (iswx()) {
......
...@@ -47,6 +47,10 @@ export default class PrizePanel extends Panel { ...@@ -47,6 +47,10 @@ export default class PrizePanel extends Panel {
this.updateOption(data.option); this.updateOption(data.option);
//0224需求,去掉炫耀按钮,继续闯关按钮居中
this['shareBtn'].visible = false;
this['goBtn'].horizontalCenter = 0;
this['shareBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this['shareBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(getlogItem(15)); NetManager.ins.clickLog(getlogItem(15));
if (iswx()) { if (iswx()) {
......
...@@ -18,8 +18,8 @@ class Layers extends eui.UILayer { ...@@ -18,8 +18,8 @@ class Layers extends eui.UILayer {
this.addChild(this._sceneLayer); this.addChild(this._sceneLayer);
this.addChild(this._popupLayer); this.addChild(this._popupLayer);
this.addChild(this._topLayer); this.addChild(this._topLayer);
this.addChild(this._shareLayer);//toast和share替换下层级
this.addChild(this._toastLayer); this.addChild(this._toastLayer);
this.addChild(this._shareLayer);
} }
// _bg: egret.Bitmap; // _bg: egret.Bitmap;
......
...@@ -95,6 +95,7 @@ ...@@ -95,6 +95,7 @@
"resource/skins/TurntablePrize2Skin.exml", "resource/skins/TurntablePrize2Skin.exml",
"resource/skins/TurntablePrizeSkin.exml", "resource/skins/TurntablePrizeSkin.exml",
"resource/skins/TurntableSkin.exml", "resource/skins/TurntableSkin.exml",
"resource/skins/ShareCodePanelSkin.exml",
"resource/skins/VScrollBarSkin.exml" "resource/skins/VScrollBarSkin.exml"
], ],
"path": "resource/default.thm.json" "path": "resource/default.thm.json"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e:Skin class="ShareCodePanelSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing"> <e:Skin class="ShareCodePanelSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<w:Config id="16cd6d4c8ff"/> <w:Config id="16cd6d4c8ff"/>
<e:Rect id="clickBg" width="750" height="1624" fillAlpha="0.5"/> <e:Rect id="clickBg" width="750" height="1624" fillAlpha="0.7"/>
<e:Group id="inviteGroup" x="0" bottom="0"> <e:Group id="inviteGroup" x="0" bottom="0">
<e:Image source="朋友圈中间分享蒙层1_jpg" y="0" x="0"/> <e:Image source="朋友圈中间分享蒙层1_jpg" y="0" x="0"/>
<e:Group y="66" x="261"> <e:Group y="66" horizontalCenter="0">
<e:Button id="wxpyq" label="" x="0" y="0"> <e:Button id="wxpyq" label="" x="177" y="0">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="share_btn1_png" source.down="share_btn1_png" source.disabled="share_btn1_png"/> <e:Image width="100%" height="100%" source="share_btn1_png" source.down="share_btn1_png" source.disabled="share_btn1_png"/>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</e:Skin> </e:Skin>
</e:skinName> </e:skinName>
</e:Button> </e:Button>
<e:Button id="wx" label="" x="152"> <e:Button id="wx" label="" x="0">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="share_btn2_png" source.down="share_btn2_png" source.disabled="share_btn2_png"/> <e:Image width="100%" height="100%" source="share_btn2_png" source.down="share_btn2_png" source.disabled="share_btn2_png"/>
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
</e:Group> </e:Group>
<e:Group id="panelGroup" horizontalCenter="0" visible="false"> <e:Group id="panelGroup" horizontalCenter="0" visible="false">
<e:Rect width="750" height="1624" fillAlpha="0.7"/> <e:Rect width="750" height="1624" fillAlpha="0.7"/>
<e:Image y="223" source="copyCodeBg_png" horizontalCenter="0.5"/> <e:Image y="294" source="copyCodeBg_png" horizontalCenter="0.5"/>
<e:Label id="msg" text="" lineSpacing="10" size="32" multiline="true" y="542" textColor="0xf54500" fontFamily="FZY4JW" horizontalCenter="0.5" textAlign="center"/> <e:Label id="msg" text="" lineSpacing="10" size="32" multiline="true" y="613" textColor="0xf54500" fontFamily="FZY4JW" horizontalCenter="3.5" textAlign="center"/>
<e:Image id="goBtn" y="611" source="lijiqianwang_png" horizontalCenter="0"/> <e:Image id="goBtn" y="682" source="lijiqianwang_png" horizontalCenter="0"/>
<e:Button id="closeBtn" label="" x="625" y="220"> <e:Button id="closeBtn" label="" x="625" y="291">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/> <e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
......
...@@ -3,6 +3,8 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl"; ...@@ -3,6 +3,8 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { NetManager } from "../../libs/tw/manager/NetManager"; import { NetManager } from "../../libs/tw/manager/NetManager";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl"; import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
import ComponentBase from "../../libs/new_wx/components/ComponentBase";
import layers from "../../libs/new_wx/views/layers";
export enum CodeChannels { export enum CodeChannels {
/** /**
...@@ -28,8 +30,15 @@ const shareMsg = { ...@@ -28,8 +30,15 @@ const shareMsg = {
"2": "打开苏宁APP帮我刮卡赢现金", "2": "打开苏宁APP帮我刮卡赢现金",
"3": "打开苏宁APP帮我闯一关赢现金" "3": "打开苏宁APP帮我闯一关赢现金"
} }
const panelMsg = {
"0": "快去分享好友加体力吧",//快去请好友助力加体力吧
"1": "快去分享好友一起玩吧",
"2": "快去邀请好友帮你刮卡",
"3": "快去邀请好友闯关赢现金"
}
export class ShareCodePanel extends Panel { class ShareCodePanel extends ComponentBase {
public closeBtn: eui.Button; public closeBtn: eui.Button;
public clickBg: eui.Rect; public clickBg: eui.Rect;
public inviteGroup: eui.Group; public inviteGroup: eui.Group;
...@@ -51,14 +60,16 @@ export class ShareCodePanel extends Panel { ...@@ -51,14 +60,16 @@ export class ShareCodePanel extends Panel {
* 口令 * 口令
*/ */
private code: string private code: string
start(data) { setData(data) {
super.start();
this.data = data; this.data = data;
this.inviteGroup.bottom = this.stage.stageHeight - this.height; //显示提示文案
//直接生成码吧 this.msg.text = panelMsg[this.data.channel];
} }
start() {
super.start();
this.height = this.stage.stageHeight;
}
//不再关闭 //不再关闭
public onTouchTap_closeBtn() { public onTouchTap_closeBtn() {
// super.onTouchTap_closeBtn(); // super.onTouchTap_closeBtn();
...@@ -67,23 +78,39 @@ export class ShareCodePanel extends Panel { ...@@ -67,23 +78,39 @@ export class ShareCodePanel extends Panel {
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
// this.wx.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchBtn, this); this.wx.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchWxBtn, this);
// this.wxpyq.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchBtn, this); this.wxpyq.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchWxpyqBtn, this);
this.goBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchGoBtn, this);
this.clickBg.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchClickBg, this);
} }
onTouchWxBtn() { onTouchWxBtn() {
this.panelGroup.visible = true;
this.mark = 0; this.mark = 0;
this.codeOpr()
} }
onTouchWxpyqBtn() { onTouchWxpyqBtn() {
this.panelGroup.visible = true;
this.mark = 1; this.mark = 1;
this.codeOpr()
}
onTouchGoBtn() {
switch (this.mark) {
case 0:
linkWx();
break;
case 1:
linkWxpyq();
break;
}
//还需要根据channel加体力接口
}
onTouchClickBg() {
layers.shareLayer.visible = false;
} }
codeOpr() { private codeOpr() {
//如果是开发中,获取不到口令就用假的
if (window["development"]) this.code = "123";
if (!this.code) { if (!this.code) {
this.enableMouseEvent(false) this.enableMouseEvent(false)
generateCode((s, res) => { generateCode((s, res) => {
...@@ -94,13 +121,23 @@ export class ShareCodePanel extends Panel { ...@@ -94,13 +121,23 @@ export class ShareCodePanel extends Panel {
} }
this.code = res.data.result.content; this.code = res.data.result.content;
//复制口令 //复制口令
this.copyCodeOpr()
}, this.data.channel, this.data.shareCode) }, this.data.channel, this.data.shareCode)
} else {
this.enableMouseEvent(false)
this.copyCodeOpr()
} }
} }
copyCodeOpr(code:string){ private copyCodeOpr() {
// copyPassword() copyPassword((ss) => {
this.enableMouseEvent(true)
if (ss) {
this.panelGroup.visible = true;
} else {
showToast("口令生成失败,请重试")
}
}, "复制口令" + this.code + shareMsg[this.data.channel])
} }
private enableMouseEvent(b: boolean) { private enableMouseEvent(b: boolean) {
...@@ -110,13 +147,35 @@ export class ShareCodePanel extends Panel { ...@@ -110,13 +147,35 @@ export class ShareCodePanel extends Panel {
removeEvents() { removeEvents() {
super.removeEvents(); super.removeEvents();
// this.btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchBtn, this); this.wx.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchWxBtn, this);
this.wxpyq.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchWxpyqBtn, this);
this.goBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchGoBtn, this);
this.clickBg.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchClickBg, this);
} }
get skinKey() { get skinKey() {
return 'ShareCodePanel' return 'ShareCodePanel'
} }
} }
let inited = false;
let _share: ShareCodePanel;
const initShare = () => {
const layer = layers.shareLayer;
const share = new ShareCodePanel();
share.loadSkin();
layer.addChild(share);
share.start();
_share = share;
};
export const showShareCodePanel = (data: { channel: CodeChannels, shareCode?: string, }) => {
if (!inited) {
initShare();
inited = true;
}
_share.setData(data);
layers.shareLayer.visible = true;
}
// &snactCode&sceneCode&token // &snactCode&sceneCode&token
......
...@@ -85,10 +85,10 @@ export default class StartPanel extends Panel { ...@@ -85,10 +85,10 @@ export default class StartPanel extends Panel {
onTap_startBtn() { onTap_startBtn() {
const homeData = getHomeData(); const homeData = getHomeData();
if(homeData.remainEnargy <= 0) { // if(homeData.remainEnargy <= 0) {
if(homeData.askForEnergy) { // if(homeData.askForEnergy) {
PanelCtrl.instance.show('blood2Panel'); // PanelCtrl.instance.show('blood2Panel');
} else { // } else {
if(iswx()) { if(iswx()) {
getShareUrl(this.stage); getShareUrl(this.stage);
} else } else
...@@ -101,9 +101,9 @@ export default class StartPanel extends Panel { ...@@ -101,9 +101,9 @@ export default class StartPanel extends Panel {
showToast('分享成功~'); showToast('分享成功~');
}); });
}) })
} // }
return; // return;
} // }
// Loading.instace.show(); // Loading.instace.show();
this.touchChildren = false; this.touchChildren = false;
......
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