Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-cr20g
Project
Project
Details
Activity
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
Administrator
dsk-cr20g
Commits
7051c46d
Commit
7051c46d
authored
Jul 14, 2023
by
caixingbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*
parent
ab732da8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
25 deletions
+29
-25
jskplug.js
dsk-operate-ui/src/assets/js/jskplug.js
+25
-21
index.vue
dsk-operate-ui/src/views/detail/party-b/index.vue
+4
-4
No files found.
dsk-operate-ui/src/assets/js/jskplug.js
View file @
7051c46d
...
...
@@ -3,16 +3,19 @@
* 1、url地址,如企业详情:https://pre-plug.jiansheku.com/enterprise?ak=aec7b3ff2y2q8x6t49a7e2c463ce21912&uid=a704fb35bca54707b9b5f8c9bba57815(ak:平台唯一标识;uid:用户标识)
*
* */
const
steerScroll
=
function
(
iframeId
,
navHeight
,
state
,
parentId
){
//state:监听or移除监听;navHeight
:页面排除iframe后剩下高度;iframeId: iframe的id
const
steerScroll
=
function
(
iframeId
,
navigation
,
state
,
parentId
)
{
// state:监听or移除监听;navigation
:页面排除iframe后剩下高度;iframeId: iframe的id
let
dom
=
window
if
(
parentId
){
// 默认页面可以滚动
if
(
parentId
)
{
// 默认页面可以滚动
dom
=
document
.
getElementById
(
parentId
)
if
(
!
dom
){
return
}
dom
.
style
.
overflow
=
'auto'
navHeight
=
0
}
else
{
nav
igation
.
total
Height
=
0
}
else
{
document
.
body
.
style
.
overflow
=
'visible'
}
if
(
state
)
{
if
(
state
)
{
window
.
addEventListener
(
'message'
,
function
(
e
)
{
const
data
=
e
.
data
const
sct
=
parentId
?
dom
.
scrollTop
:
document
&&
document
.
documentElement
.
scrollTop
||
document
&&
document
.
body
.
scrollTop
...
...
@@ -20,10 +23,11 @@ const steerScroll = function (iframeId, navHeight, state, parentId){ //state:
// 动态设置iFrame高度
if
(
data
.
height
)
{
document
.
getElementById
(
iframeId
).
style
.
height
=
data
.
height
+
'px'
scrolling
(
iframeId
,
nav
Height
,
parentId
)
// 初始加载获取滚动条距离顶部高度
scrolling
(
iframeId
,
nav
igation
,
parentId
)
// 初始加载获取滚动条距离顶部高度
}
// 点击企业详情页 栏目名动态设置滚动高度
if
(
data
.
scrollHeight
)
{
let
navHeight
=
navigation
.
isFixed
?
navigation
.
totalHeight
-
navigation
.
fixedHeight
:
navigation
.
totalHeight
dom
.
scrollTo
(
sct
,
parseInt
(
data
.
scrollHeight
)
+
navHeight
)
}
// 点击企业详情页 栏目下拉子标签动态设置滚动高度
...
...
@@ -31,38 +35,38 @@ const steerScroll = function (iframeId, navHeight, state, parentId){ //state:
dom
.
scrollTo
(
sct
,
sct
-
parseInt
(
data
.
clientHeight
))
}
// 点击下拉子标签动态设置滚动高度
if
(
data
.
initHeight
>=
0
)
{
if
(
data
.
initHeight
>=
0
)
{
dom
.
scrollTo
(
sct
,
data
.
initHeight
)
}
// 根据子页面弹窗显示隐藏控制当前页面是否固定不可滚动
if
(
data
.
scrollDisabled
||
data
.
scrollDisabled
==
false
)
{
if
(
parentId
)
{
dom
.
style
.
overflow
=
data
.
scrollDisabled
?
'hidden'
:
'auto'
}
else
{
document
.
body
.
style
.
overflow
=
data
.
scrollDisabled
?
'hidden'
:
'visible'
if
(
data
.
scrollDisabled
||
data
.
scrollDisabled
===
false
)
{
if
(
parentId
)
{
dom
.
style
.
overflow
=
data
.
scrollDisabled
?
'hidden'
:
'auto'
}
else
{
document
.
body
.
style
.
overflow
=
data
.
scrollDisabled
?
'hidden'
:
'visible'
}
}
}
})
dom
.
addEventListener
(
'scroll'
,
(
event
)
=>
{
scrolling
(
iframeId
,
nav
Height
,
parentId
)
dom
.
addEventListener
(
'scroll'
,
(
event
)
=>
{
scrolling
(
iframeId
,
nav
igation
,
parentId
)
})
}
else
{
dom
.
removeEventListener
(
'scroll'
,
(
event
)
=>
{
scrolling
(
iframeId
,
nav
Height
,
parentId
)
}
else
{
dom
.
removeEventListener
(
'scroll'
,
(
event
)
=>
{
scrolling
(
iframeId
,
nav
igation
,
parentId
)
})
}
}
const
scrolling
=
function
(
iframeId
,
navHeight
,
parentId
)
{
const
scrolling
=
function
(
iframeId
,
navigation
,
parentId
)
{
// 滚动条距文档顶部的距离
let
scrollTop
=
parentId
?
document
.
getElementById
(
parentId
).
scrollTop
:
window
.
pageYOffset
||
document
.
documentElement
.
scrollTop
||
document
.
body
.
scrollTop
// 将滚动距离传入子组件
const
ifa
=
document
.
getElementById
(
iframeId
)
if
(
scrollTop
<
navHeight
)
{
scrollTop
=
scrollTop
+
nav
Height
if
((
scrollTop
<
navigation
.
totalHeight
&&
!
navigation
.
isFixed
)
||
navigation
.
isFixed
)
{
scrollTop
=
scrollTop
+
navigation
.
total
Height
}
let
bodyHeight
=
document
.
body
.
clientHeight
-
nav
Height
const
bodyHeight
=
document
.
body
.
clientHeight
-
navigation
.
total
Height
ifa
.
contentWindow
.
postMessage
({
'scrollTop'
:
scrollTop
,
'bodyHeight'
:
bodyHeight
},
'*'
)
}
...
...
dsk-operate-ui/src/views/detail/party-b/index.vue
View file @
7051c46d
...
...
@@ -16,8 +16,8 @@ export default {
loading
:
false
,
// 是否加载完成-当前页控制
iframeTimer
:
''
,
// 是否加载中定时器-当前页控制
iframeHight
:
window
.
innerHeight
,
// iframe高度-当前页控制
nav
Height
:
68
,
// iframe以为的高度px
src
:
''
,
nav
igation
:
{
isFixed
:
true
,
fixedHeight
:
56
,
totalHeight
:
68
},
// iframe之外页面顶部对象,ifFixed:是否浮动;fixedHeight:浮动对象高度;totalHeight:顶部整体高度
src
:
''
,
//iframe嵌套页面地址
domain
:
'https://pre-plug.jiansheku.com'
,
// domain: 'http://192.168.60.30:3300',
ak
:
'aec7b3ff2y2q8x6t49a7e2c463ce21912'
// 需要携带的sdkId
...
...
@@ -36,11 +36,11 @@ export default {
},
mounted
()
{
this
.
iframeLoading
()
// 判断iframe页面是否加载完成-当前页控制
steerScroll
(
'companyIframe'
,
this
.
nav
Height
,
true
)
// 监听滚动(iframe的id、页面排除iframe后页面剩下
高度[例:80]、增加监听[不传就是移除监听]、父级id[不带默认就是铺满整个页面]])
steerScroll
(
'companyIframe'
,
this
.
nav
igation
,
true
)
// 监听滚动(iframe的id、页面排除iframe后页面剩下顶部
高度[例:80]、增加监听[不传就是移除监听]、父级id[不带默认就是铺满整个页面]])
},
beforeDestroy
()
{
clearInterval
(
this
.
iframeTimer
)
// -当前页控制
steerScroll
(
'companyIframe'
,
this
.
nav
Height
)
// 销毁滚动
steerScroll
(
'companyIframe'
,
this
.
nav
igation
)
// 销毁滚动
},
methods
:
{
//判断iframe页面是否加载完成-当前页控制
...
...
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