Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wildfirecode13
xiaoxiaole
Commits
25a6e4d2
Commit
25a6e4d2
authored
May 21, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增webview
parent
5657e609
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
158 additions
and
7 deletions
+158
-7
MapScene.ts
egret/src/mapScene/MapScene.ts
+4
-1
WebView.ts
egret/src/webview/WebView.ts
+148
-0
advert.json
mock/happyclear/advert.json
+6
-6
No files found.
egret/src/mapScene/MapScene.ts
View file @
25a6e4d2
...
@@ -39,6 +39,7 @@ import getAdBtn from "./getAdBtn";
...
@@ -39,6 +39,7 @@ import getAdBtn from "./getAdBtn";
import
getInviteBtn
from
"./getInviteBtn"
;
import
getInviteBtn
from
"./getInviteBtn"
;
import
{
play2
,
play1
}
from
"../panels/help/svgaTool"
;
import
{
play2
,
play1
}
from
"../panels/help/svgaTool"
;
import
{
snpmAdStatic
}
from
"../statics/snpmAdStatic"
;
import
{
snpmAdStatic
}
from
"../statics/snpmAdStatic"
;
import
WebView
from
"../webview/WebView"
;
let
doHelpFlag
=
false
;
let
doHelpFlag
=
false
;
// let doScratchHelpFlag = false;
// let doScratchHelpFlag = false;
...
@@ -757,7 +758,9 @@ export default class MapScene extends Scene {
...
@@ -757,7 +758,9 @@ export default class MapScene extends Scene {
NetManager
.
ins
.
clickLog1
(
getlogItem
(
32
));
NetManager
.
ins
.
clickLog1
(
getlogItem
(
32
));
snpmAdStatic
.
snpmAdReport
(
"click"
,
"icon"
,
result
);
snpmAdStatic
.
snpmAdReport
(
"click"
,
"icon"
,
result
);
if
(
result
.
url
!=
0
){
if
(
result
.
url
!=
0
){
window
.
location
.
href
=
decodeURI
(
result
.
url
);
var
webview
=
WebView
.
getInstance
();
webview
.
setSrc
(
result
.
url
);
webview
.
show
();
}
}
},
this
);
},
this
);
}
}
...
...
egret/src/webview/WebView.ts
0 → 100644
View file @
25a6e4d2
/**
* WebView
* 适配FIXED_WIDTH、FIXED_HEIGHT、NO_BORDER、SHOW_ALL四种缩放模式
* 暂未考虑屏幕大小改变、屏幕旋转以及单页面多Webplay实例的情形
* Created by yxiao on 2015/9/30.
*/
export
default
class
WebView
extends
egret
.
DisplayObjectContainer
{
static
instance
:
WebView
;
static
getInstance
(){
if
(
!
this
.
instance
){
this
.
instance
=
new
WebView
();
}
return
this
.
instance
;
}
private
_x
:
number
=
0
;
private
_y
:
number
=
0
;
private
_width
:
number
=
0
;
private
_height
:
number
=
0
;
private
_src
:
string
=
""
;
private
_scaleMode
:
string
=
egret
.
StageScaleMode
.
FIXED_WIDTH
;
_stageW
:
number
;
_stageH
:
number
;
private
_windowW
:
number
;
private
_windowH
:
number
;
private
_iframeWrapper
:
HTMLDivElement
=
null
;
private
_iframe
:
HTMLIFrameElement
=
null
;
closebtn
:
HTMLImageElement
=
null
;
/**
* @param src
*/
public
constructor
(){
super
();
var
stageDelegateDom
:
HTMLElement
=
document
.
getElementById
(
"StageDelegateDiv"
);
var
body
=
document
.
body
;
// stageDelegateDom.style.width="100%";
// stageDelegateDom.style.height="100%";
this
.
_iframeWrapper
=
document
.
createElement
(
"div"
);
this
.
_iframeWrapper
.
style
.
display
=
"none"
;
this
.
_iframeWrapper
.
attributes
[
'style'
].
value
+=
'position:absolute;-webkit-overflow-scrolling: touch;overflow-y: scroll;'
;
//解决iframe在ios下的显示问题
this
.
_iframeWrapper
.
id
=
"iframe-wrapper"
;
stageDelegateDom
.
appendChild
(
this
.
_iframeWrapper
);
this
.
_iframeWrapper
.
style
.
display
=
"none"
;
this
.
_iframeWrapper
.
style
.
opacity
=
"0"
;
this
.
_iframe
=
document
.
createElement
(
"iframe"
);
this
.
_iframe
.
id
=
"webview-iframead"
;
this
.
_iframe
.
name
=
"webview-iframead"
;
this
.
_iframe
.
style
.
position
=
"absolute"
;
this
.
_iframe
.
style
.
top
=
"0"
;
this
.
_iframe
.
style
.
left
=
"0"
;
this
.
_iframe
.
style
.
opacity
=
"0"
;
this
.
_iframe
.
style
.
display
=
'none'
;
this
.
_iframe
.
frameBorder
=
'0'
;
this
.
_iframeWrapper
.
appendChild
(
this
.
_iframe
);
this
.
_iframeWrapper
.
style
.
opacity
=
"1"
;
this
.
_iframe
.
style
.
opacity
=
"1"
;
console
.
log
(
"啦啦啦"
,
stageDelegateDom
,
stageDelegateDom
.
clientWidth
,
stageDelegateDom
.
clientHeight
);
this
.
_windowW
=
Number
(
stageDelegateDom
.
clientWidth
);
this
.
_windowH
=
Number
(
stageDelegateDom
.
clientHeight
);
this
.
_iframe
.
width
=
this
.
_iframeWrapper
.
style
.
width
=
body
.
clientWidth
*
3
+
"px"
;
this
.
_iframe
.
height
=
this
.
_iframeWrapper
.
style
.
height
=
body
.
clientHeight
*
3
+
"px"
;
// this._iframe.width = this._iframeWrapper.style.width = this._windowW+"px";
// this._iframe.height = this._iframeWrapper.style.height = this._windowH+"px";
this
.
closebtn
=
document
.
createElement
(
"img"
);
this
.
closebtn
.
src
=
"//yun.duiba.com.cn/aurora/assets/571906f5a3b59d6e654e6522c916ed1707231551.png"
;
this
.
closebtn
.
style
.
position
=
"absolute"
;
this
.
closebtn
.
style
.
top
=
"100px"
;
this
.
closebtn
.
style
.
right
=
"100px"
;
this
.
_iframeWrapper
.
append
(
this
.
closebtn
);
this
.
closebtn
.
style
.
width
=
"150px"
;
this
.
closebtn
.
style
.
height
=
"150px"
;
this
.
closebtn
.
addEventListener
(
"click"
,
this
.
clickCloseBtn
.
bind
(
this
),
false
);
}
clickCloseBtn
(){
console
.
log
(
"closeBtn----------click"
);
this
.
destroy
();
}
public
setSrc
(
src
:
string
){
this
.
_iframe
.
src
=
src
;
}
public
show
():
void
{
this
.
_iframe
.
style
.
display
=
'block'
;
this
.
_iframeWrapper
.
style
.
display
=
'block'
;
}
public
destroy
():
void
{
if
(
this
.
_iframeWrapper
){
this
.
_iframeWrapper
.
style
.
display
=
"none"
;
}
}
// public get width():number {
// return this._width;
// }
// public set width(value:number) {
// this._width = value;
// this._iframe.width = this._iframeWrapper.style.width =
// console.log("设置宽度",this._iframe.width,this._iframeWrapper.style.width);
// }
// public get height():number {
// return this._height;
// }
// public set height(value:number) {
// this._height = value;
// this._iframe.height = this._iframeWrapper.style.height = value+"px";
// console.log("设置高度",this._iframe.height,this._iframeWrapper.style.height);
// }
// public set x(value:number) {
// this._x = value;
// }
// public set y(value:number) {
// this._y = value;
// }
// public get x():number {
// return this._x;
// }
// public get y():number {
// return this._y;
// }
public
get
src
():
string
{
return
this
.
_src
;
}
public
set
src
(
value
:
string
)
{
this
.
_src
=
value
;
}
}
\ No newline at end of file
mock/happyclear/advert.json
View file @
25a6e4d2
...
@@ -9,11 +9,11 @@
...
@@ -9,11 +9,11 @@
"advertList"
:[
"advertList"
:[
{
{
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"url"
:
"
0
"
"url"
:
"
https://cuxiao.m.suning.com/scms/BECHEERY.html?adTypeCode=1137&adId=https%3A%2F%2Flib.suning.com%2Fweex%2FBECHEERY.js%3FpageCode%3DBECHEERY%26adtype%3D3
"
},
},
{
{
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"url"
:
"
0
"
"url"
:
"
https://cuxiao.m.suning.com/scms/BECHEERY.html?adTypeCode=1137&adId=https%3A%2F%2Flib.suning.com%2Fweex%2FBECHEERY.js%3FpageCode%3DBECHEERY%26adtype%3D3
"
}
}
]
]
},
},
...
@@ -22,11 +22,11 @@
...
@@ -22,11 +22,11 @@
"advertList"
:[
"advertList"
:[
{
{
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"url"
:
"
0
"
"url"
:
"
https://cuxiao.m.suning.com/scms/BECHEERY.html?adTypeCode=1137&adId=https%3A%2F%2Flib.suning.com%2Fweex%2FBECHEERY.js%3FpageCode%3DBECHEERY%26adtype%3D3
"
},
},
{
{
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"url"
:
"
0
"
"url"
:
"
https://cuxiao.m.suning.com/scms/BECHEERY.html?adTypeCode=1137&adId=https%3A%2F%2Flib.suning.com%2Fweex%2FBECHEERY.js%3FpageCode%3DBECHEERY%26adtype%3D3
"
}
}
]
]
},
},
...
@@ -35,11 +35,11 @@
...
@@ -35,11 +35,11 @@
"advertList"
:[
"advertList"
:[
{
{
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"url"
:
"
0
"
"url"
:
"
https://cuxiao.m.suning.com/scms/BECHEERY.html?adTypeCode=1137&adId=https%3A%2F%2Flib.suning.com%2Fweex%2FBECHEERY.js%3FpageCode%3DBECHEERY%26adtype%3D3
"
},
},
{
{
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"img"
:
"http://yun.dui88.com/images/201909/lsh4tdkp5n.jpg"
,
"url"
:
"
0
"
"url"
:
"
https://cuxiao.m.suning.com/scms/BECHEERY.html?adTypeCode=1137&adId=https%3A%2F%2Flib.suning.com%2Fweex%2FBECHEERY.js%3FpageCode%3DBECHEERY%26adtype%3D3
"
}
}
]
]
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment