This commit is contained in:
yanran200730
2022-11-02 17:47:19 +08:00
parent 33b9400e4a
commit 1a65407ef7

View File

@@ -1,5 +1,14 @@
<template> <template>
<div class="home"> <div class="home">
<div class="header" :class="[isFixed ? 'header-active' : '']">
<div class="status-bar" :style="{height: statusBarHeight + 'px'}"></div>
<div class="nav-bar">
<h2>天府星小程序</h2>
</div>
</div>
<div></div>
<image class="bg-img" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/home-bg.png" />
<div class="wrapper">
<image class="banner" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/banner.png" /> <image class="banner" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/banner.png" />
<div class="nav"> <div class="nav">
<div class="nav-item" hover-class="text-hover" @click="$linkTo('./PhotoReport')"> <div class="nav-item" hover-class="text-hover" @click="$linkTo('./PhotoReport')">
@@ -32,21 +41,25 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
import { mapActions, mapState } from 'vuex' import { mapActions, mapState } from 'vuex'
export default { export default {
appName: '天府星小程序', appName: '首页',
customNavigation: true,
navigationBarTitleText: '天府星小程序',
name: 'AppHome', name: 'AppHome',
data () { data () {
return { return {
current: 1, current: 1,
list: [], list: [],
isMore: false isMore: false,
isFixed: false,
statusBarHeight: 20,
} }
}, },
@@ -55,6 +68,10 @@
}, },
onLoad () { onLoad () {
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
uni.setNavigationBarColor({
frontColor: '#000000'
})
this.getList() this.getList()
if (!this.token) { if (!this.token) {
@@ -104,14 +121,89 @@
onReachBottom () { onReachBottom () {
this.getList() this.getList()
},
onPageScroll (params) {
this.isFixed = params.scrollTop > 60
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.home { .home {
position: relative;
padding: 32px 0 40px; padding: 32px 0 40px;
.bg-img {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 512px;
}
.wrapper {
position: relative;
z-index: 11;
padding-top: 208px;
}
.back-wrapper {
position: fixed;
z-index: 11;
left: 20px;
top: 24px;
width: 40px;
height: 40px;
image {
width: 40px;
height: 40px;
}
}
.header {
position: fixed;
left: 0;
top: 0;
z-index: 111;
width: 100%;
opacity: 1;
transition: all 0.2s ease;
.nav-bar {
position: relative;
height: 88px;
line-height: 88px;
color: #000;
font-size: 34px;
font-weight: 600;
text-align: center;
image {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 40px;
height: 40px;
padding: 24px 20px 0 20px;
box-sizing: content-box;
}
}
&.header-active {
z-index: 1111;
opacity: 1;
color: #fff;
background: linear-gradient(180deg, #2D7DFF 0%, #2D7DFF 40%);
.nav-bar {
color: #fff;
}
}
}
.banner { .banner {
display: block; display: block;
width: 686px; width: 686px;