Commit 201afcec authored by wjf's avatar wjf

l

parent f7d5ecd8
...@@ -78,6 +78,7 @@ import ShopTipPanel from "../../src/panels/ShopTipPanel"; ...@@ -78,6 +78,7 @@ 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() {
...@@ -166,6 +167,7 @@ export default class MainBase extends eui.UILayer { ...@@ -166,6 +167,7 @@ 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 = [
......
<?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 width="750" height="1624" fillAlpha="0.7"/> <e:Rect id="clickBg" width="750" height="1624" fillAlpha="0.5"/>
<e:Group id="pic1" y="46" horizontalCenter="0">
<e:Image source="share3_jpg" y="0" x="0"/>
</e:Group>
<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" x="261">
<e:Button id="btn1" label="" x="0" y="0"> <e:Button id="wxpyq" label="" x="0" 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"/>
...@@ -18,7 +15,7 @@ ...@@ -18,7 +15,7 @@
</e:Skin> </e:Skin>
</e:skinName> </e:skinName>
</e:Button> </e:Button>
<e:Button id="btn2" label="" x="152"> <e:Button id="wx" label="" x="152">
<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"/>
...@@ -28,4 +25,18 @@ ...@@ -28,4 +25,18 @@
</e:Button> </e:Button>
</e:Group> </e:Group>
</e:Group> </e:Group>
<e:Group id="panelGroup" horizontalCenter="0" visible="false">
<e:Rect width="750" height="1624" fillAlpha="0.7"/>
<e:Image y="223" 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:Image id="goBtn" y="611" source="lijiqianwang_png" horizontalCenter="0"/>
<e:Button id="closeBtn" label="" x="625" y="220">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
<e:Label id="labelDisplay" horizontalCenter="0" verticalCenter="0"/>
</e:Skin>
</e:skinName>
</e:Button>
</e:Group>
</e:Skin> </e:Skin>
\ No newline at end of file
import { NetManager } from "../libs/tw/manager/NetManager";
// &snactCode&sceneCode&token
export enum CodeChannels {
/**
* 分享加体力
*/
AddBlood = "0",
/**
* 个人中心排行榜邀请好友一起玩
*/
RankPlay = "1",
/**
* 刮刮卡邀请
*/
Scratch = "2",
/**
* 邀请有礼
*/
InvitePrize = "3"
}
/**
* 生成口令
* @param channel
* @param shareCode 分享加体力暂时没有分享码(27号版本要加上),排行榜邀请一起玩也没有分享码,默认传0
*/
export function generateCode(callback: Function, channel: CodeChannels, shareCode: string = "0") {
var activityCode = getParamString("snactCode") || "ACT0000002863";
var sceneCode = channel;
var token = shareCode;
window['$'].ajax({
type: "post",
url: "https://gameapi.suning.com/sngame-web/api/getShareGameInfo.do",
dataType: "json",
data: {
activityCode,
sceneCode,
token
},
async: true,
success: (result) => {
callback(true, result)
},
error: (message) => {
callback(false, message)
}
});
}
/**
* 复制口令
*/
export function copyPassword(code: string, callback: Function) {
window["snShare"].passwordShare({
ele: '#kouling',
txt: code + "",
success: function (e) {
callback(true, e);
// console.log(e,e.text)
// alert('复制口令内容:'+e.text,function(){window.location.href='weixin://';});
},
error: function (e) {
callback(false, e);
// console.log(e)
// alert('复制失败')
}
})
}
/**
* 唤起微信客户端
*/
export function linkWx() {
var locatUrl = "weixin://";
if (/ipad|iphone|mac/i.test(navigator.userAgent)) {
var ifr = document.createElement("iframe");
ifr.src = locatUrl;
ifr.style.display = "none";
document.body.appendChild(ifr);
} else {
window.location.href = locatUrl;
}
}
/**
* 唤起微信朋友圈
* 暂未实现
*/
export function linkWxpyq() {
}
/**
* 获取链接字段信息
* @param name 字段名
*/
function getParamString(name) {
var paramUrl = window.location.search.substr(1);
var paramStrs = paramUrl.split('&');
var params = {};
for (var index = 0; index < paramStrs.length; index++) {
params[paramStrs[index].split('=')[0]] = decodeURIComponent(paramStrs[index].split('=')[1]);
}
return params[name];
}
...@@ -2,40 +2,209 @@ import Panel from "../../libs/new_wx/components/Panel"; ...@@ -2,40 +2,209 @@ import Panel from "../../libs/new_wx/components/Panel";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl"; 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";
export enum CodeChannels {
/**
* 分享加体力
*/
AddBlood = "0",
/**
* 个人中心排行榜邀请好友一起玩
*/
RankPlay = "1",
/**
* 刮刮卡邀请
*/
Scratch = "2",
/**
* 邀请有礼
*/
InvitePrize = "3"
}
const shareMsg = {
"0": "打开苏宁APP快来和我一起玩游戏",//打开苏宁APP帮我助力赢体力
"1": "打开苏宁APP快来和我一起玩游戏",
"2": "打开苏宁APP帮我刮卡赢现金",
"3": "打开苏宁APP帮我闯一关赢现金"
}
export class ShareCodePanel extends Panel { export class ShareCodePanel extends Panel {
public closeBtn: eui.Button; public closeBtn: eui.Button;
public btn: eui.Image; public clickBg: eui.Rect;
public inviteGroup: eui.Group; public inviteGroup: eui.Group;
public wxpyq: eui.Button;
public wx: eui.Button;
public panelGroup: eui.Group;
public msg: eui.Label;
public goBtn: eui.Image;
/**
* 0表示微信,1表示朋友圈
*/
private mark: 0 | 1
data: {
channel: CodeChannels,
shareCode?: string,
}
/**
* 口令
*/
private code: string
start(data) { start(data) {
super.start(); super.start();
this.data = data; this.data = data;
this.inviteGroup.bottom = this.stage.stageHeight - this.height this.inviteGroup.bottom = this.stage.stageHeight - this.height;
//直接生成码吧
} }
//不再关闭
public onTouchTap_closeBtn() { public onTouchTap_closeBtn() {
super.onTouchTap_closeBtn(); // super.onTouchTap_closeBtn();
this.panelGroup.visible = false;
} }
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
this.btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchBtn, this); // this.wx.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchBtn, this);
// this.wxpyq.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchBtn, this);
} }
onTouchBtn() { onTouchWxBtn() {
this.panelGroup.visible = true;
this.mark = 0;
}
onTouchWxpyqBtn() {
this.panelGroup.visible = true;
this.mark = 1;
} }
codeOpr() {
if (!this.code) {
this.enableMouseEvent(false)
generateCode((s, res) => {
if (!s || !res.data || !res.data.result || !res.data.result.content) {
this.enableMouseEvent(true)
showToast("口令生成失败,请重试")
return
}
this.code = res.data.result.content;
//复制口令
}, this.data.channel, this.data.shareCode)
}
}
copyCodeOpr(code:string){
// copyPassword()
}
private enableMouseEvent(b: boolean) {
this.touchEnabled = b;
this.touchChildren = b;
}
removeEvents() { removeEvents() {
super.removeEvents(); super.removeEvents();
this.btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchBtn, this); // this.btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchBtn, this);
} }
get skinKey() { get skinKey() {
return 'ShareCodePanel' return 'ShareCodePanel'
} }
} }
// &snactCode&sceneCode&token
/**
* 生成口令
* @param channel
* @param shareCode 分享加体力暂时没有分享码(27号版本要加上),排行榜邀请一起玩也没有分享码,默认传0
*/
function generateCode(callback: Function, channel: CodeChannels, shareCode: string = "0") {
var activityCode = getParamString("snactCode") || "ACT0000002863";
var sceneCode = channel;
var token = shareCode || "0";
window['$'].ajax({
type: "post",
url: "https://gameapi.suning.com/sngame-web/api/getShareGameInfo.do",
dataType: "json",
data: {
activityCode,
sceneCode,
token
},
async: true,
success: (result) => {
callback(true, result)
},
error: (message) => {
callback(false, message)
}
});
}
/**
* 复制口令
*/
function copyPassword(callback: Function, code: string) {
window["snShare"].passwordShare({
ele: '#kouling',
txt: code + "",
success: function (e) {
callback(true, e);
// console.log(e,e.text)
// alert('复制口令内容:'+e.text,function(){window.location.href='weixin://';});
},
error: function (e) {
callback(false, e);
// console.log(e)
// alert('复制失败')
}
})
}
/**
* 唤起微信客户端
*/
function linkWx() {
var locatUrl = "weixin://";
if (/ipad|iphone|mac/i.test(navigator.userAgent)) {
var ifr = document.createElement("iframe");
ifr.src = locatUrl;
ifr.style.display = "none";
document.body.appendChild(ifr);
} else {
window.location.href = locatUrl;
}
}
/**
* 唤起微信朋友圈
* 暂未实现
*/
function linkWxpyq() {
}
/**
* 获取链接字段信息
* @param name 字段名
*/
function getParamString(name) {
var paramUrl = window.location.search.substr(1);
var paramStrs = paramUrl.split('&');
var params = {};
for (var index = 0; index < paramStrs.length; index++) {
params[paramStrs[index].split('=')[0]] = decodeURIComponent(paramStrs[index].split('=')[1]);
}
return params[name];
}
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