Files
jjx-wap/components/common/title.vue
T
2026-10-08 18:34:09 +08:00

90 lines
1.7 KiB
Vue

<template>
<view class="component">
<view class="layout-head flex justify-between align-center">
<view class="m-left-20">
<u-icon name="arrow-left" color="#ffffff" size="22" @click="handBack" v-if="showBack"></u-icon>
</view>
<view class="text flex-1 text-single p-right-20">
{{ title }}
</view>
<view class="user flex justify-center align-center p-right-30">
<view class="icon">
<image class="full" src="/static/img/h-user.png" mode=""></image>
</view>
<view class="text" @click="loginLink">{{
(userData && userData.nickname) ? userData.nickname : '未登录'
}}
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
isLogin: false,
userData: null
}
},
props: {
title: {
type: String,
default: '金久信'
},
showBack: {
type: Boolean,
default: true
},
},
methods: {
handBack() {
uni.navigateBack({
delta: 1,
})
},
loginLink() {
if (this.userData && this.userData.nickname) uni.switchTab({url: '/pages/user/user'})
else vk.navigateTo('/pages/login/login')
},
},
mounted() {
this.userData = vk.getStorageSync('uni_id_user_info')
},
}
</script>
<style lang="scss">
.layout-head {
// width: 750rpx;
height: 80rpx;
background: #ae4f4d;
.num {
width: 48rpx;
height: 48rpx;
}
.img {
width: 220rpx;
height: 58rpx;
}
.text {
font-size: 28rpx;
color: #ffffff;
}
.user {
.icon {
width: 32rpx;
height: 32rpx;
}
.text {
padding-left: 10rpx;
font-size: 24rpx;
line-height: 32rpx;
color: #ffffff;
}
}
}
</style>