Commit a03c4e5b authored by zjz1994's avatar zjz1994

代码暂存

parent 25a6e4d2
...@@ -4,6 +4,7 @@ import { DataManager } from "../../libs/tw/manager/DataManager"; ...@@ -4,6 +4,7 @@ import { DataManager } from "../../libs/tw/manager/DataManager";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import wait from "../../libs/new_tc/wait"; import wait from "../../libs/new_tc/wait";
import { snpmAdStatic } from "../statics/snpmAdStatic"; import { snpmAdStatic } from "../statics/snpmAdStatic";
import WebView from "../webview/WebView";
export default class AdSmallComp extends ComponentBase { export default class AdSmallComp extends ComponentBase {
...@@ -40,7 +41,11 @@ export default class AdSmallComp extends ComponentBase { ...@@ -40,7 +41,11 @@ export default class AdSmallComp extends ComponentBase {
snpmAdStatic.snpmAdReport("click","bottom",result); snpmAdStatic.snpmAdReport("click","bottom",result);
wait(50).then(() => { wait(50).then(() => {
if (result.url != 0) window.location.href = decodeURI(result.url); if (result.url != 0){
var webview = WebView.getInstance();
webview.setSrc(result.url);
webview.show();
}
}); });
}, this); }, this);
} }
......
...@@ -4,6 +4,7 @@ import { DataManager } from "../../libs/tw/manager/DataManager"; ...@@ -4,6 +4,7 @@ import { DataManager } from "../../libs/tw/manager/DataManager";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import wait from "../../libs/new_tc/wait"; import wait from "../../libs/new_tc/wait";
import { snpmAdStatic } from "../statics/snpmAdStatic"; import { snpmAdStatic } from "../statics/snpmAdStatic";
import WebView from "../webview/WebView";
export default class ADPanel extends Panel { export default class ADPanel extends Panel {
start(data) { start(data) {
...@@ -30,7 +31,9 @@ export default class ADPanel extends Panel { ...@@ -30,7 +31,9 @@ export default class ADPanel extends Panel {
snpmAdStatic.snpmAdReport("click","dialog",result); snpmAdStatic.snpmAdReport("click","dialog",result);
NetManager.ins.clickLog1(getlogItem(25)); NetManager.ins.clickLog1(getlogItem(25));
wait(100).then(()=>{ wait(100).then(()=>{
window.location.href = decodeURI(result.url); var webview = WebView.getInstance();
webview.setSrc(result.url);
webview.show();
}); });
}, this); }, this);
} }
......
...@@ -6,6 +6,7 @@ import { GDispatcher } from "../../../libs/tc/util/GDispatcher"; ...@@ -6,6 +6,7 @@ import { GDispatcher } from "../../../libs/tc/util/GDispatcher";
import { Buried } from "../../../libs/tw/util/Buried"; import { Buried } from "../../../libs/tw/util/Buried";
import { DataManager } from "../../../libs/tw/manager/DataManager"; import { DataManager } from "../../../libs/tw/manager/DataManager";
import { NetName } from "../../../libs/tw/enum/NetName"; import { NetName } from "../../../libs/tw/enum/NetName";
import WebView from "../../webview/WebView";
export default class TaskCenter extends Panel { export default class TaskCenter extends Panel {
public closeBtn: eui.Button; public closeBtn: eui.Button;
...@@ -156,7 +157,10 @@ class TaskCenterItem extends eui.ItemRenderer { ...@@ -156,7 +157,10 @@ class TaskCenterItem extends eui.ItemRenderer {
this.btnGroup.addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this.btnGroup.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(this.getlogItem()); NetManager.ins.clickLog(this.getlogItem());
// 跳转任务链接 // 跳转任务链接
window.location.href = this.data.appIncompletelink; // window.location.href = this.data.appIncompletelink;
var webview = WebView.getInstance();
webview.setSrc(this.data.appIncompletelink);
webview.show();
}, this); }, this);
} else { // 已完成 } else { // 已完成
this.btnImg.source = 'TaskCenter_' + 'done' + 'Btn_png'; this.btnImg.source = 'TaskCenter_' + 'done' + 'Btn_png';
......
...@@ -6,6 +6,7 @@ import { getlogItem } from "../../Main"; ...@@ -6,6 +6,7 @@ import { getlogItem } from "../../Main";
import getHomeData from "../../getHomeData"; import getHomeData from "../../getHomeData";
import { changeMapScene } from "../../startScene/StartScene"; import { changeMapScene } from "../../startScene/StartScene";
import SceneCtrl from "../../../libs/new_wx/ctrls/sceneCtrl"; import SceneCtrl from "../../../libs/new_wx/ctrls/sceneCtrl";
import WebView from "../../webview/WebView";
export default class TaskCenterPrize extends Panel { export default class TaskCenterPrize extends Panel {
public closeBtn:eui.Button; public closeBtn:eui.Button;
...@@ -42,7 +43,11 @@ export default class TaskCenterPrize extends Panel { ...@@ -42,7 +43,11 @@ export default class TaskCenterPrize extends Panel {
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1);
} else { } else {
window.location.href = taskData.appIncompletelink; // window.location.href = taskData.appIncompletelink;
var webview = WebView.getInstance();
webview.setSrc(taskData.appIncompletelink);
webview.show();
super.hidePanel(); super.hidePanel();
} }
}, this); }, this);
......
import { NetManager } from "../libs/tw/manager/NetManager"; import { NetManager } from "../libs/tw/manager/NetManager";
//换用webview实现了,废弃
let startTimer = new Date().getTime(); let startTimer = new Date().getTime();
let endTimer; let endTimer;
//设置隐藏属性和改变可见属性的事件的名称 //设置隐藏属性和改变可见属性的事件的名称
...@@ -40,14 +40,15 @@ const sendData = () => { ...@@ -40,14 +40,15 @@ const sendData = () => {
} }
export const initstatistics = () => { export const initstatistics = () => {
document.addEventListener( //使用webview来处理时间,废弃
visibilityChange, // document.addEventListener(
handleVisibilityChange, // visibilityChange,
false // handleVisibilityChange,
); // false
// );
document.body['onbeforeunload']=()=>{ // document.body['onbeforeunload']=()=>{
endTimer = new Date().getTime(); // endTimer = new Date().getTime();
return sendData(); // return sendData();
} // }
} }
import { NetManager } from "../../libs/tw/manager/NetManager";
/** /**
* WebView * WebView
* 适配FIXED_WIDTH、FIXED_HEIGHT、NO_BORDER、SHOW_ALL四种缩放模式 * 适配FIXED_WIDTH、FIXED_HEIGHT、NO_BORDER、SHOW_ALL四种缩放模式
...@@ -30,6 +32,11 @@ export default class WebView extends egret.DisplayObjectContainer { ...@@ -30,6 +32,11 @@ export default class WebView extends egret.DisplayObjectContainer {
closebtn:HTMLImageElement=null; closebtn:HTMLImageElement=null;
nshowurl:string;
showtime:number;
endtime:number;
/** /**
* @param src * @param src
*/ */
...@@ -89,18 +96,29 @@ export default class WebView extends egret.DisplayObjectContainer { ...@@ -89,18 +96,29 @@ export default class WebView extends egret.DisplayObjectContainer {
this.destroy(); this.destroy();
} }
public setSrc(src:string){ public setSrc(src:string){
console.log("跳转地址",src);
if(this.nshowurl&&this.nshowurl==src){
}else{
this._iframe.src = "";
this.nshowurl = src;
this._iframe.src=src; this._iframe.src=src;
} }
}
public show():void { public show():void {
this._iframe.style.display='block'; this._iframe.style.display='block';
this._iframeWrapper.style.display='block'; this._iframeWrapper.style.display='block';
this.showtime = Date.now();
} }
public destroy():void { public destroy():void {
if(this._iframeWrapper){ if(this._iframeWrapper){
this._iframeWrapper.style.display="none"; this._iframeWrapper.style.display="none";
} }
this.endtime = Date.now();
var passtime = this.endtime - this.showtime;
NetManager.ins.remainDuration(passtime,false);
} }
// public get width():number { // public get width():number {
// return this._width; // return this._width;
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
{ {
"subActivityId": "SUB446971598063218688", "subActivityId": "SUB446971598063218688",
"subActivityName": "狮狮连萌下单", "subActivityName": "狮狮连萌下单",
"status": "1", "status": "0",
"taskStatus": "0", "taskStatus": "0",
"remark": "下单得1000元宝", "remark": "下单得1000元宝",
"taskTitle": "狮狮连萌下单任务", "taskTitle": "狮狮连萌下单任务",
"taskViceTitle": "狮狮连萌下单任务", "taskViceTitle": "狮狮连萌下单任务",
"icon": "//yun.dui88.com/images/201910/s0yhv1nlil.jpeg", "icon": "//yun.dui88.com/images/201910/s0yhv1nlil.jpeg",
"limit": "1", "limit": "1",
"done": "1", "done": "0",
"appIncompleteText": "去看看", "appIncompleteText": "去看看",
"appCompleteText": "已完成", "appCompleteText": "已完成",
"appIncompletelink": "http://cprexg.m.cnsuning.com/snWhale.html#/fight", "appIncompletelink": "http://cprexg.m.cnsuning.com/snWhale.html#/fight",
......
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