<template>
	<view class="home-poster">
		<image class="poster" src="~@/static/images/home_poster.png" mode="aspectFill"></image>
		<status-tag class="course-status" :text="courseStatus"></status-tag>
		<view class="ctrl">
			<navigator url="/pages/profile/profile" hover-class="none">
				<image class="set" src="~@/static/images/icon_set.png" mode="aspectFit"></image>
			</navigator>
			<view class="user-msg">
				<navigator url="/pages/information/information" hover-class="none">
					<image class="message" src="~@/static/images/icon_message.png" mode="aspectFit"></image>
					<u-badge numberType="ellipsis" type="error" max="99" :value="messageNum" :absolute="true"
						:offset="[25, 8]">
					</u-badge>
				</navigator>
			</view>
		</view>
		<view class="user">
			<text class="user-name">陈静雯</text>
			<image class="user-avatar" src="~@/static/images/avatar.png" mode="aspectFit"></image>
		</view>
	</view>
</template>

<script>
	import statusTag from "@/components/tag/tag"
	export default {
		props: {
			courseStatus: {
				type: String,
				default: '已完成'
			},
			messageNum: {
				type: Number || String,
				default: '',
			}
		},
		components: {
			statusTag
		}
	}
</script>

<style>
	.home-poster {
		width: 100%;
		height: 500rpx;
		position: relative;
		z-index: 9;
	}

	.home-poster .poster {
		width: 100%;
		height: 100%;
		position: absolute;
		z-index: 1;
	}

	.home-poster .ctrl {
		position: absolute;
		width: 100%;
		height: auto;
		z-index: 2;
		background-color: transparent;
		bottom: 0;
	}

	.user-msg {
		background: transparent;
		display: inline-block;
		position: relative;
	}

	.home-poster navigator {
		display: inline-block;
	}

	.home-poster .ctrl .set,
	.home-poster .ctrl .message {
		width: 40rpx;
		height: 40rpx;
		background-color: rgba(255, 255, 255, 0.5);
		padding: 20rpx;
		margin: 10rpx;
		margin-top: 40rpx;
		border-radius: 50%;
	}

	.home-poster .ctrl .set {
		margin-left: 20rpx;
	}

	.user {
		position: absolute;
		right: 40rpx;
		bottom: -30rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		z-index: 2;
	}

	.user .user-avatar {
		width: 150rpx;
		height: 150rpx;
		border-radius: 16rpx;
		z-index: 2;
		overflow: hidden;
	}

	.user .user-avatar>image {
		z-index: 2;
	}

	.user .user-name {
		color: #fff;
		display: inline-block;
		margin-right: 15rpx;
		font-weight: bold;
		font-size: 32rpx;
		text-shadow: 2rpx 2rpx 2rpx #999;
	}

	.course-status {
		position: absolute;
		z-index: 2;
		right: 0;
		top: 50%;
		transform: translateY(-100%);
	}
</style>
