feat: add profile click

This commit is contained in:
tim
2025-07-09 17:54:16 +08:00
parent ef08bf32bd
commit 5554594123
4 changed files with 23 additions and 10 deletions

View File

@@ -40,7 +40,7 @@ export default {
width: 32px; width: 32px;
height: 32px; height: 32px;
border-radius: 50%; border-radius: 50%;
color: var(--text-color); color: white;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;

View File

@@ -9,11 +9,11 @@ import { checkToken, clearToken } from './utils/auth'
import { initTheme } from './utils/theme' import { initTheme } from './utils/theme'
// Configurable API domain and port // Configurable API domain and port
// export const API_DOMAIN = 'http://127.0.0.1' export const API_DOMAIN = 'http://127.0.0.1'
// export const API_PORT = 8081 export const API_PORT = 8081
export const API_DOMAIN = 'http://129.204.254.110' // export const API_DOMAIN = 'http://129.204.254.110'
export const API_PORT = 8080 // export const API_PORT = 8080
export const API_BASE_URL = API_PORT ? `${API_DOMAIN}:${API_PORT}` : API_DOMAIN export const API_BASE_URL = API_PORT ? `${API_DOMAIN}:${API_PORT}` : API_DOMAIN
export const GOOGLE_CLIENT_ID = '777830451304-nt8afkkap18gui4f9entcha99unal744.apps.googleusercontent.com' export const GOOGLE_CLIENT_ID = '777830451304-nt8afkkap18gui4f9entcha99unal744.apps.googleusercontent.com'

View File

@@ -13,7 +13,7 @@
</div> </div>
<div class="info-content-container author-info-container"> <div class="info-content-container author-info-container">
<div class="user-avatar-container"> <div class="user-avatar-container" @click="gotoProfile">
<div class="user-avatar-item"> <div class="user-avatar-item">
<img class="user-avatar-item-img" :src="author.avatar" alt="avatar"> <img class="user-avatar-item-img" :src="author.avatar" alt="avatar">
</div> </div>
@@ -102,6 +102,7 @@ import { renderMarkdown } from '../utils/markdown'
import { API_BASE_URL, toast } from '../main' import { API_BASE_URL, toast } from '../main'
import { getToken } from '../utils/auth' import { getToken } from '../utils/auth'
import { hatch } from 'ldrs' import { hatch } from 'ldrs'
import { useRouter } from 'vue-router'
hatch.register() hatch.register()
export default { export default {
@@ -110,6 +111,7 @@ export default {
setup() { setup() {
const route = useRoute() const route = useRoute()
const postId = route.params.id const postId = route.params.id
const router = useRouter()
const title = ref('') const title = ref('')
const author = ref('') const author = ref('')
@@ -293,6 +295,10 @@ export default {
} }
} }
const gotoProfile = () => {
router.push(`/users/${author.value.id}`)
}
onMounted(async () => { onMounted(async () => {
const hash = location.hash const hash = location.hash
const id = hash.startsWith('#comment-') ? hash.substring('#comment-'.length) : null const id = hash.startsWith('#comment-') ? hash.substring('#comment-'.length) : null
@@ -322,7 +328,8 @@ export default {
copyPostLink, copyPostLink,
renderMarkdown, renderMarkdown,
isWaitingFetchingPost, isWaitingFetchingPost,
isWaitingPostingComment isWaitingPostingComment,
gotoProfile
} }
} }
} }
@@ -451,7 +458,9 @@ export default {
border-bottom: 1px solid #e2e2e2; border-bottom: 1px solid #e2e2e2;
} }
.user-avatar-container {} .user-avatar-container {
cursor: pointer;
}
.user-avatar-item { .user-avatar-item {
width: 50px; width: 50px;

View File

@@ -66,7 +66,7 @@
<div class="summary-divider"> <div class="summary-divider">
<div class="hot-reply"> <div class="hot-reply">
<div class="summary-title">热门回复</div> <div class="summary-title">热门回复</div>
<div v-if="hotReplies.length > 0"> <div class="summary-content" v-if="hotReplies.length > 0">
<BaseTimeline :items="hotReplies"> <BaseTimeline :items="hotReplies">
<template #item="{ item }"> <template #item="{ item }">
@@ -107,7 +107,7 @@
</div> </div>
<div class="hot-topic"> <div class="hot-topic">
<div class="summary-title">热门话题</div> <div class="summary-title">热门话题</div>
<div v-if="hotPosts.length > 0"> <div class="summary-content" v-if="hotPosts.length > 0">
<BaseTimeline :items="hotPosts"> <BaseTimeline :items="hotPosts">
<template #item="{ item }"> <template #item="{ item }">
<router-link <router-link
@@ -413,4 +413,8 @@ export default {
opacity: 0.5; opacity: 0.5;
} }
.summary-content {
margin-top: 10px;
}
</style> </style>