Files
Yi.Admin/Yi.Bbs.Vue3/src/components/UserInfoCard/index.vue

164 lines
3.8 KiB
Vue
Raw Normal View History

2023-12-27 23:55:59 +08:00
<template>
2024-01-07 20:51:20 +08:00
<!-- 悬浮卡片 -->
<el-popover
placement="right"
:width="300"
:show-arrow="false"
trigger="hover"
popper-class="userCard"
v-if="!props.isSelf"
>
<template #reference>
2024-01-17 16:31:01 +08:00
<el-avatar :size="30" :src="iconUrl" />
2024-01-07 20:51:20 +08:00
</template>
<div class="top">
<div class="left">
<div class="image">
2024-01-17 16:31:01 +08:00
<img :src="iconUrl" alt="" @click="gotoProfile(userInfo.userName)" style="cursor: pointer;" />
2024-01-07 20:51:20 +08:00
</div>
</div>
<div class="right">
<div class="userInfo">
<div class="name">{{ userInfo.nick }}</div>
<div class="level">
<el-tag effect="light" type="success" v-if="userInfo.level"
>等级{{ userInfo.level }}</el-tag
>
</div>
</div>
<div class="website">
<div class="icon">
<img src="@/assets/box/github-icon.png" alt="" />
</div>
<div class="icon">
<img src="@/assets/box/website-icon.png" alt="" />
</div>
<div class="icon">
<img src="@/assets/box/gitee-icon.png" alt="" />
</div>
</div>
<div class="btn">
<el-button type="primary" icon="Plus">关注</el-button>
</div>
</div>
2023-12-27 23:55:59 +08:00
</div>
2024-01-07 20:51:20 +08:00
<div class="line"></div>
<div class="bottom">
<div class="header">
2024-01-15 15:44:55 +08:00
<div class="score">钱钱{{ userInfo.money }}</div>
2024-01-07 20:51:20 +08:00
<div class="status">
<span>状态</span>
2024-01-27 10:55:12 +08:00
<UserLimitTag :userLimit="userInfo.userLimit"/>
2024-01-07 20:51:20 +08:00
</div>
</div>
<div class="hobby">
<span>关注</span>
<el-tag type="info">C#</el-tag>
<el-tag type="info">前端</el-tag>
<el-tag type="info">Python</el-tag>
<el-tag type="info">算法</el-tag>
</div>
</div>
</el-popover>
2023-12-27 23:55:59 +08:00
</template>
2024-01-07 20:51:20 +08:00
<script setup name="UserInfoCard">
import { computed, defineProps } from "vue";
2024-01-17 16:31:01 +08:00
import { useRouter } from "vue-router";
2024-01-27 10:55:12 +08:00
import UserLimitTag from "../UserLimitTag.vue";
2023-12-27 23:55:59 +08:00
const props = defineProps({
2024-01-07 20:51:20 +08:00
// 用户信息
userInfo: {
type: Object,
default: () => {},
},
// icon地址
iconUrl: {
type: String,
default: () => "",
2023-12-27 23:55:59 +08:00
},
});
2024-01-17 16:31:01 +08:00
const router = useRouter();
2024-01-07 20:51:20 +08:00
const userInfo = computed(() => props.userInfo);
2024-01-17 16:31:01 +08:00
const gotoProfile=(userName)=>{
router.push(`/profile/${userName}`);
}
2024-01-07 20:51:20 +08:00
</script>
<style scoped lang="scss">
.userCard {
.top {
display: flex;
width: 100%;
height: 100px;
.left {
width: 80px;
.image {
width: 80px;
height: 80px;
img {
width: 100%;
height: 100%;
}
2023-12-27 23:55:59 +08:00
}
2024-01-07 20:51:20 +08:00
}
.right {
display: flex;
flex-direction: column;
justify-content: space-between;
flex: 1;
margin-left: 20px;
.userInfo {
width: 100%;
display: flex;
justify-content: flex-start;
align-items: center;
.level {
margin: 0 10px;
}
}
.website {
display: flex;
.icon {
cursor: pointer;
width: 20px;
height: 20px;
margin-right: 10px;
img {
width: 100%;
height: 100%;
}
}
2023-12-27 23:55:59 +08:00
}
}
2024-01-07 20:51:20 +08:00
}
.line {
margin: 20px 0;
border-top: 1px solid #eee;
}
.bottom {
display: flex;
flex-direction: column;
justify-content: space-around;
width: 100%;
height: 100px;
.header {
display: flex;
align-items: center;
.status {
margin-left: 50px;
}
}
.hobby {
display: flex;
align-items: center;
> .el-tag {
margin-right: 10px;
}
}
}
2023-12-27 23:55:59 +08:00
}
</style>