feat: 新增个人页面跳转功能

This commit is contained in:
陈淳
2024-01-17 16:31:01 +08:00
parent 0d5c196f39
commit 98a4a2158a
17 changed files with 139 additions and 43 deletions

View File

@@ -34,7 +34,7 @@
</div>
<div class="info" v-if="!props.isSelf">
<el-tag class="ml-2" type="warning">V8</el-tag>
<el-tag class="ml-2" type="danger">会员</el-tag>
<el-tag class="ml-2" type="danger">核心</el-tag>
</div>
<el-button
v-if="props.showWatching"
@@ -73,6 +73,7 @@ const userInfo = reactive({
id: "",
level: "",
userLimit: "",
userName:""
});
const iconUrl = ref("/acquiesce.png");
const iconUrlHandler = (icon) => {
@@ -113,6 +114,7 @@ const Init = () => {
userInfo.money=props.userInfo.money;
userInfo.level = props.userInfo.level;
userInfo.userLimit = props.userInfo.userLimit;
userInfo.userName= props.userInfo.userName;
iconUrl.value = iconUrlHandler(userInfo.icon);
}

View File

@@ -9,12 +9,12 @@
v-if="!props.isSelf"
>
<template #reference>
<el-avatar :size="30" :src="iconUrl" />
<el-avatar :size="30" :src="iconUrl" />
</template>
<div class="top">
<div class="left">
<div class="image">
<img :src="iconUrl" alt="" />
<img :src="iconUrl" alt="" @click="gotoProfile(userInfo.userName)" style="cursor: pointer;" />
</div>
</div>
<div class="right">
@@ -64,7 +64,7 @@
<script setup name="UserInfoCard">
import { computed, defineProps } from "vue";
import { useRouter } from "vue-router";
const props = defineProps({
// 用户信息
userInfo: {
@@ -77,9 +77,8 @@ const props = defineProps({
default: () => "",
},
});
const router = useRouter();
const userInfo = computed(() => props.userInfo);
const statusTypeList = [
{
label: "正常",
@@ -100,6 +99,11 @@ const statusTypeList = [
const getStatusInfo = (type) => {
return statusTypeList.filter((item) => item.value === type)[0]?.label;
};
const gotoProfile=(userName)=>{
router.push(`/profile/${userName}`);
}
</script>
<style scoped lang="scss">