108 lines
2.1 KiB
Vue
108 lines
2.1 KiB
Vue
![]() |
<template>
|
||
|
<view>
|
||
|
<tui-navigation-bar @init="initNavigation" @change="opacityChange" :scrollTop="scrollTop" backgroundColor="#fff" color="#333">
|
||
|
<view class="content-bpx">
|
||
|
<view class="left-box">
|
||
|
<view @click="setBtn" class="set-btn">
|
||
|
<u-icon name="setting" :color="opacity > 0.85 ? '#333' : '#fff'" size="48"></u-icon>
|
||
|
</view>
|
||
|
<view @click="editUser" class="set-btn" v-show="opacity < 1">
|
||
|
<u-icon name="edit-pen" size="48"></u-icon>
|
||
|
</view>
|
||
|
</view>
|
||
|
<view v-if="opacity > 0.85" class="nickname">{{userInfo.nickname}}</view>
|
||
|
</view>
|
||
|
</tui-navigation-bar>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import tuiNavigationBar from "@/components/thorui/tui-navigation-bar/tui-navigation-bar.vue";
|
||
|
import sheep from '@/sheep';
|
||
|
export default {
|
||
|
components: {
|
||
|
tuiNavigationBar,
|
||
|
},
|
||
|
props: {
|
||
|
title: {
|
||
|
type: String,
|
||
|
default: '',
|
||
|
},
|
||
|
//滚动条滚动距离
|
||
|
scrollTop: {
|
||
|
type: [Number, String],
|
||
|
default: 0
|
||
|
},
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
top: 0, //标题图标距离顶部距离
|
||
|
opacity: 0,
|
||
|
height: 0,
|
||
|
}
|
||
|
},
|
||
|
computed: {
|
||
|
userInfo: {
|
||
|
get() {
|
||
|
return sheep.$store('user').userInfo;
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
methods: {
|
||
|
initNavigation(e) {
|
||
|
this.height = e.height;
|
||
|
this.opacity = e.opacity;
|
||
|
this.top = e.top;
|
||
|
this.$emit('initNav', e);
|
||
|
},
|
||
|
opacityChange(e) {
|
||
|
this.opacity = e.opacity;
|
||
|
},
|
||
|
setBtn() {
|
||
|
sheep.$router.go('/pages/public/setting')
|
||
|
},
|
||
|
editUser() {
|
||
|
sheep.$router.go('/pages/user/info')
|
||
|
},
|
||
|
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
.content-bpx {
|
||
|
color: #fff;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
height: 44px;
|
||
|
justify-content: center;
|
||
|
|
||
|
.left-box {
|
||
|
display: flex;
|
||
|
position: absolute;
|
||
|
left: 0;
|
||
|
}
|
||
|
|
||
|
.nickname {
|
||
|
position: absolute;
|
||
|
width: 100px;
|
||
|
display: flex;
|
||
|
justify-content: center;
|
||
|
align-items: center;
|
||
|
height: 44px;
|
||
|
font-size: 15px;
|
||
|
font-weight: bolder;
|
||
|
color: #1f2122;
|
||
|
}
|
||
|
|
||
|
.set-btn {
|
||
|
padding: 0 15px;
|
||
|
height: 44px;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
</style>
|