mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-20 05:50:53 +08:00
Compare commits
7 Commits
codex/adap
...
codex/adap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba5f0148af | ||
|
|
cfe24b5e8e | ||
|
|
52633c8073 | ||
|
|
cf2299f9bf | ||
|
|
f03bf92641 | ||
|
|
8bb9c3e3d9 | ||
|
|
8c554465f6 |
@@ -24,7 +24,7 @@
|
||||
</template>
|
||||
<template #option="{ option }">
|
||||
<div class="search-option-item">
|
||||
<i :class="['result-icon', iconMap[option.type]]"></i>
|
||||
<component :is="iconMap[option.type]" class="result-icon" />
|
||||
<div class="result-body">
|
||||
<div class="result-main" v-html="highlight(option.text)"></div>
|
||||
<div v-if="option.subText" class="result-sub" v-html="highlight(option.subText)"></div>
|
||||
@@ -83,11 +83,12 @@ const highlight = (text) => {
|
||||
}
|
||||
|
||||
const iconMap = {
|
||||
user: 'fas fa-user',
|
||||
post: 'fas fa-file-alt',
|
||||
comment: 'fas fa-comment',
|
||||
category: 'fas fa-folder',
|
||||
tag: 'fas fa-hashtag',
|
||||
user: 'UserIcon',
|
||||
post: 'FileText',
|
||||
post_title: 'FileText',
|
||||
comment: 'CommentIcon',
|
||||
category: 'Inbox',
|
||||
tag: 'TagOne',
|
||||
}
|
||||
|
||||
watch(selected, (val) => {
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
<template #option="{ option }">
|
||||
<div class="option-container">
|
||||
<div class="option-main">
|
||||
<template v-if="option.icon">
|
||||
<template v-if="option.smallIcon || option.icon">
|
||||
<BaseImage
|
||||
v-if="isImageIcon(option.icon)"
|
||||
:src="option.icon"
|
||||
v-if="isImageIcon(option.smallIcon || option.icon)"
|
||||
:src="option.smallIcon || option.icon"
|
||||
class="option-icon"
|
||||
:alt="option.name"
|
||||
/>
|
||||
<i v-else :class="['option-icon', option.icon]"></i>
|
||||
<component v-else :is="option.smallIcon || option.icon" class="option-icon" />
|
||||
</template>
|
||||
<span>{{ option.name }}</span>
|
||||
<span class="option-count" v-if="option.count > 0"> x {{ option.count }}</span>
|
||||
|
||||
@@ -368,11 +368,11 @@ const selectedTab = ref(
|
||||
: 'summary',
|
||||
)
|
||||
const tabs = [
|
||||
{ key: 'summary', label: '总结', icon: 'ChartLine' },
|
||||
{ key: 'timeline', label: '时间线', icon: 'AlarmClock' },
|
||||
{ key: 'following', label: '关注', icon: 'AddUser' },
|
||||
{ key: 'favorites', label: '收藏', icon: 'Bookmark' },
|
||||
{ key: 'achievements', label: '勋章', icon: 'MedalOne' },
|
||||
{ key: 'summary', label: '总结', icon: 'chart-line' },
|
||||
{ key: 'timeline', label: '时间线', icon: 'alarm-clock' },
|
||||
{ key: 'following', label: '关注', icon: 'add-user' },
|
||||
{ key: 'favorites', label: '收藏', icon: 'bookmark' },
|
||||
{ key: 'achievements', label: '勋章', icon: 'medal-one' },
|
||||
]
|
||||
const followTab = ref('followers')
|
||||
|
||||
@@ -415,19 +415,19 @@ const fetchSummary = async () => {
|
||||
const postsRes = await fetch(`${API_BASE_URL}/api/users/${username}/hot-posts`)
|
||||
if (postsRes.ok) {
|
||||
const data = await postsRes.json()
|
||||
hotPosts.value = data.map((p) => ({ icon: 'fas fa-book', post: p }))
|
||||
hotPosts.value = data.map((p) => ({ icon: 'file-text', post: p }))
|
||||
}
|
||||
|
||||
const repliesRes = await fetch(`${API_BASE_URL}/api/users/${username}/hot-replies`)
|
||||
if (repliesRes.ok) {
|
||||
const data = await repliesRes.json()
|
||||
hotReplies.value = data.map((c) => ({ icon: 'fas fa-comment', comment: c }))
|
||||
hotReplies.value = data.map((c) => ({ icon: 'comment-icon', comment: c }))
|
||||
}
|
||||
|
||||
const tagsRes = await fetch(`${API_BASE_URL}/api/users/${username}/hot-tags`)
|
||||
if (tagsRes.ok) {
|
||||
const data = await tagsRes.json()
|
||||
hotTags.value = data.map((t) => ({ icon: 'fas fa-tag', tag: t }))
|
||||
hotTags.value = data.map((t) => ({ icon: 'tag-one', tag: t }))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,19 +443,19 @@ const fetchTimeline = async () => {
|
||||
const mapped = [
|
||||
...posts.map((p) => ({
|
||||
type: 'post',
|
||||
icon: 'fas fa-book',
|
||||
icon: 'file-text',
|
||||
post: p,
|
||||
createdAt: p.createdAt,
|
||||
})),
|
||||
...replies.map((r) => ({
|
||||
type: r.parentComment ? 'reply' : 'comment',
|
||||
icon: 'fas fa-comment',
|
||||
icon: 'comment-icon',
|
||||
comment: r,
|
||||
createdAt: r.createdAt,
|
||||
})),
|
||||
...tags.map((t) => ({
|
||||
type: 'tag',
|
||||
icon: 'fas fa-tag',
|
||||
icon: 'tag-one',
|
||||
tag: t,
|
||||
createdAt: t.createdAt,
|
||||
})),
|
||||
@@ -477,7 +477,7 @@ const fetchFavorites = async () => {
|
||||
const res = await fetch(`${API_BASE_URL}/api/users/${username}/subscribed-posts`)
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
favoritePosts.value = data.map((p) => ({ icon: 'fas fa-bookmark', post: p }))
|
||||
favoritePosts.value = data.map((p) => ({ icon: 'bookmark', post: p }))
|
||||
} else {
|
||||
favoritePosts.value = []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user