MOC移动端页面
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { getUserInfo } from '@/utils/auth'
|
||||
import type { AppHeaderProps, HeaderUserInfo } from './types'
|
||||
|
||||
const { title, unread = 0 } = defineProps<AppHeaderProps>()
|
||||
|
||||
// 当前登录用户信息(来自本地缓存)
|
||||
const userInfo = getUserInfo() as HeaderUserInfo
|
||||
// 用户显示名,兼容 real_name / realname 两种字段
|
||||
const displayName = computed(
|
||||
() => userInfo.real_name ?? userInfo.realname ?? ''
|
||||
)
|
||||
// 角色名称
|
||||
const roleName = computed(() => userInfo.roles?.name ?? '')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<header class="top-bar">
|
||||
<h1 class="page-title">{{ title }}</h1>
|
||||
<div class="top-actions">
|
||||
<button class="icon-btn" type="button">
|
||||
<van-icon name="bell" class="bell" />
|
||||
<span v-if="unread > 0" class="dot-badge">{{ unread }}</span>
|
||||
</button>
|
||||
<p class="applicant">
|
||||
{{ displayName }}
|
||||
<span v-if="roleName">({{ roleName }})</span>
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.top-bar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1d2430;
|
||||
}
|
||||
|
||||
.top-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.icon-btn {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
padding: 0;
|
||||
color: #3b4656;
|
||||
font-size: 19px;
|
||||
background: #fff;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 2px 8px rgba(31, 93, 179, 0.16);
|
||||
}
|
||||
|
||||
.icon-btn .bell {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.icon-btn .dot-badge {
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
right: -8px;
|
||||
min-width: 16px;
|
||||
padding: 0 4px;
|
||||
font-size: 10px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background: #ee4d2d;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.applicant {
|
||||
padding: 3px 7px;
|
||||
font-size: 12px;
|
||||
color: #1f5db3;
|
||||
background: #f7faff;
|
||||
border: 1px solid #a9c7ef;
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user