myHeader.vue 3.6 KB
<template>
	<view class="header_box">
		<!-- 未登录用户信息 -->
		<view v-if="!token" class="userInfo">
			<u-avatar src="" size="120rpx"></u-avatar>
			<view class="right" @click="goRouter('/pages/login/index')">
				<view class="username">登录/注册</view>
			</view>
		</view>
		<!-- 用户信息 -->
		<view v-else class="userInfo">
			<u-avatar :src="userInfo.avatar" size="120rpx"></u-avatar>
			<view class="right">
				<view class="username" @click="goRouter('/pages_my/editUserInfo/editUserInfo')">
					<text class="col-3d f-28 l-h-38 my-20 m-r-10">猎人事务所</text>
					<u-icon name="arrow-right" size="10" color="#333"></u-icon>
				</view>
				<view class="intro">
					<image style="width: 32rpx;" src="@/static/homeImg/QRCode.png" mode="widthFix" @click="showQRcode = true"></image>
				</view>
			</view>
		</view>
		<!-- 场地管理 -->
		<view class="pay_pitch" @click="goRouter('/pages_my/arenaControl/arenaControl')">
			<text>{{ isPay ? '续费门店' : '激活门店' }}</text>
		</view>
		<text v-show="isPay" class="tip">【剧本杀】2025-06-20到期</text>
		<!-- 出示二维码 -->
		<u-popup :show="showQRcode" round="20" mode="center" closeable overlayOpacity="0" @close="showQRcode = false">
			<view class="QRcode_box">
				<view class="QRCoce_img">
					<image style="width: 270rpx;height: 270rpx;" src="@/static/homeImg/big_QRCode.png" mode="widthFix"></image>
				</view>
				<view class="btn">保存二维码</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import { getUserInfo } from '@/api/user.js'
	import { mapGetters } from 'vuex'
	export default {
		props: {
			userInfo: {
				type: Object,
				require: true
			}
		},
		data() {
			return {
				isPay: false,
				showQRcode: false,
			}
		},
		computed: { ...mapGetters(['token']) },
		methods: {
			goRouter(path){
				uni.navigateTo({
					url: path
				})
			}
		}
	}
</script>

<style scoped lang="scss">
// 头部盒子
.header_box{
	position: relative;
	height: 376rpx;
	box-sizing: border-box;
	background-size: cover;
	// 用户信息
	.userInfo{
		position: absolute;
		top: 216rpx;
		left: 30rpx;
		display: flex;
		align-items: center;
		z-index: 10;
		.right{
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			flex: 1;
			margin-left: 20rpx;
			height: 100%;
			font-size: 24rpx;
			color: #fff;
			.username{
				display: flex;
				align-items: center;
				font-size: 32rpx;
				line-height: 48rpx;
				font-weight: 500;
			}
			.intro{
				display: flex;
				align-items: center;
				gap: 4rpx;
			}
		}
	}
	// 购买场地
	.pay_pitch{
		position: absolute;
		top: 248rpx;
		right: 30rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 140rpx;
		height: 56rpx;
		color: #fff;
		font-size: 28rpx;
		line-height: 38rpx;
		background: linear-gradient( 270deg, #001020 0%, #4A4E64 100%);
		border-radius: 8rpx;
		clip-path: polygon(0% 0%, 100% 0%, 100% 94%, 50% 100%, 0% 94%);
	}
	.tip{
		position: absolute;
		top: 306rpx;
		right: 30rpx;
		font-size: 20rpx;
		line-height: 26rpx;
		color: #3d3d3d;
	}
	// 显示二维码
	.QRcode_box{
		width: 500rpx;
		height: 550rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0,0,0,0.2);
		border-radius: 20rpx;
		padding: 40rpx;
		.QRCoce_img{
			display: flex;
			align-items: center;
			justify-content: center;
			margin: 0 auto;
			width: 360rpx;
			height: 360rpx;
		}
		.btn{
			width: 280rpx;
			height: 60rpx;
			line-height: 60rpx;
			background: #FFB336;
			border-radius: 12rpx;
			text-align: center;
			color: #fff;
			font-size: 28rpx;
			margin: 0 auto;
		}
	}
}
</style>