Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jd-vx-app
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
jd-vx-app
Commits
1594045f
Commit
1594045f
authored
Jan 05, 2023
by
肖健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
广告动态垂直居中
parent
e4e40ee1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
686 additions
and
631 deletions
+686
-631
personal.vue
pages/personal.vue
+686
-631
No files found.
pages/personal.vue
View file @
1594045f
...
...
@@ -54,9 +54,12 @@
</view>
</view>
<view
class=
"ps__btn"
v-if=
"token"
@
click=
"loginOut"
>
退出登录
</view>
</view>
<view
v-if=
"carouselHeight == 0"
>
<u-gap
bgColor=
"transparent"
v-if=
"carouselFlag"
height=
"20"
></u-gap>
<view
v-if=
"carouselFlag"
style=
"width: 700rpx;margin: 0 auto;position: relative;"
>
</view>
<view
v-if=
"carouselFlag"
:class=
"carouselHeight > 0 ? 'carouselView' : 'carouselView carouselView2'"
:style=
"
{height: carouselHeight > 0 ? carouselHeight + 'rpx' : '120px'}">
<view
style=
"position: relative; width: 100%;"
>
<u-swiper
radius=
"12rpx"
:height=
"120"
:list=
"list5"
circular
@
change=
"e => current = e.current"
:autoplay=
"true"
keyName=
"imageUrl"
@
click=
"goOtherLink"
>
</u-swiper>
...
...
@@ -66,7 +69,6 @@
</view>
</view>
</view>
<u-gap
bgColor=
"transparent"
height=
"70"
></u-gap>
</view>
</
template
>
...
...
@@ -138,6 +140,7 @@
list5
:
[],
current
:
0
,
carouselFlag
:
false
,
carouselHeight
:
0
,
}
},
methods
:
{
...
...
@@ -367,7 +370,10 @@
},
});
},
async
getElInfo
()
{
let
rectInfo
=
await
this
.
$u
.
getRect
(
'.personal'
);
console
.
log
(
'rectInfo'
,
rectInfo
);
}
},
mounted
()
{
setTimeout
(()
=>
{
...
...
@@ -378,6 +384,41 @@
this
.
getUserInfo
()
}
this
.
getRotationList
()
let
that
=
this
uni
.
getSystemInfo
({
success
:
(
res
)
=>
{
// 注意这里获得的高度宽度都是px,需要转换rpx
// 可使用窗口高度,不包含导航栏
let
windowHeight
=
res
.
windowHeight
// 可使用窗口宽度
let
windowWidth
=
res
.
windowWidth
let
query
=
uni
.
createSelectorQuery
().
in
(
that
);
setTimeout
(()
=>
{
query
.
select
(
".personal"
).
boundingClientRect
(
function
(
data
)
{
//data - 各种参数 // 获取元素高度
let
personalHeight
=
data
.
height
uni
.
createSelectorQuery
().
in
(
that
.
$parent
.
$refs
.
myTab
).
select
(
".weui-tabbar"
).
boundingClientRect
(
function
(
data
)
{
//data - 各种参数
console
.
log
(
'weui-tabbar'
,
data
)
// 获取元素高度
let
tabbarHeight
=
data
.
height
let
remainder
=
windowHeight
-
personalHeight
-
tabbarHeight
console
.
log
(
'remainder'
,
remainder
);
if
(
remainder
>
130
)
{
//可使用窗口高度,将px转换rpx
that
.
carouselHeight
=
(
remainder
*
(
750
/
windowWidth
))
}
}).
exec
()
}).
exec
()
},
100
);
}
})
},
onReady
:
function
()
{
uni
.
setNavigationBarTitle
({
...
...
@@ -388,7 +429,21 @@
</
script
>
<
style
lang=
"scss"
scoped
>
.carouselView
{
width
:
700rpx
;
margin
:
0
auto
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
height
:
120rpx
;
}
.carouselView2
{
display
:
block
;
margin-bottom
:
30px
;
// margin: 20rpx 30rpx auto auto;
}
.personal
{
.ps__bg
{
background
:
url('@/static/my/my-bg.png')
no-repeat
;
background-size
:
cover
;
...
...
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