<template>
|
<div class="card-avatar-wrapper">
|
<Avatar
|
class="card-avatar"
|
:size="30"
|
:src="src ? setOSSLink(src) : ''"
|
@click.stop="goUserHomePage"
|
/>
|
<div class="card-avatar-name-wrapper">
|
<div class="card-avatar-name">
|
{{ name }}
|
<template v-if="jobTitle">·{{ jobTitle }}</template>
|
</div>
|
<!-- <template v-if="jobTitle">
|
<div class="card-avatar-dot"></div>
|
<div class="card-avatar-jobTitle">{{ jobTitle }}</div>
|
</template> -->
|
<div :class="['card-avatar-certified', { isCertified }]">
|
{{ isCertified ? '已认证' : '未认证' }}
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script setup lang="ts">
|
import { Avatar } from '@12333/components';
|
import { setOSSLink } from '@12333/utils';
|
import Taro from '@tarojs/taro';
|
|
defineOptions({
|
name: 'CardAvatar',
|
});
|
|
type Props = {
|
src?: string;
|
name?: string;
|
jobTitle?: string;
|
userId?: string;
|
isCertified?: boolean;
|
};
|
|
const props = withDefaults(defineProps<Props>(), {});
|
|
function goUserHomePage() {
|
if (props.userId) {
|
Taro.navigateTo({
|
url: `${RouterPath.userHomePage}?userId=${props.userId}`,
|
});
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
@import '@/styles/common.scss';
|
|
.card-avatar-wrapper {
|
flex: 1;
|
min-width: 0;
|
display: flex;
|
align-items: center;
|
|
.card-avatar {
|
margin-right: 16px;
|
}
|
|
.card-avatar-name-wrapper {
|
color: boleGetCssVar('text-color', 'primary');
|
line-height: 40px;
|
font-size: 0;
|
display: flex;
|
align-items: center;
|
flex: 1;
|
min-width: 0;
|
}
|
|
.card-avatar-name {
|
font-weight: bold;
|
font-size: 28px;
|
vertical-align: middle;
|
@include ellipsis;
|
}
|
|
.card-avatar-dot {
|
width: 4px;
|
height: 4px;
|
background: boleGetCssVar('text-color', 'primary');
|
vertical-align: middle;
|
border-radius: 50%;
|
margin: 0 8px;
|
flex-shrink: 0;
|
}
|
|
.card-avatar-jobTitle {
|
font-weight: 400;
|
font-size: 28px;
|
vertical-align: middle;
|
flex-shrink: 0;
|
}
|
|
.card-avatar-certified {
|
font-weight: 400;
|
font-size: 28px;
|
vertical-align: middle;
|
flex-shrink: 0;
|
margin-left: 8px;
|
|
&.isCertified {
|
color: boleGetCssVar('color', 'success');
|
}
|
}
|
}
|
</style>
|