mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-10 00:51:00 +08:00
Compare commits
14 Commits
codex/anal
...
codex/upda
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
615832f112 | ||
|
|
cab8cd06dc | ||
|
|
b77a96938a | ||
|
|
1c28201cb8 | ||
|
|
0e26758585 | ||
|
|
786e60e8e5 | ||
|
|
df4a707e3a | ||
|
|
d94302635a | ||
|
|
9519f66474 | ||
|
|
14ee5faa1f | ||
|
|
92ba475f3b | ||
|
|
2eebc1c004 | ||
|
|
6fffdb0fd6 | ||
|
|
135a6b8c51 |
@@ -1,10 +1,10 @@
|
||||
|
||||
; 生产环境后端
|
||||
NUXT_PUBLIC_API_BASE_URL=https://open-isle.com
|
||||
NUXT_PUBLIC_API_BASE_URL=https://www.open-isle.com
|
||||
; 正式环境/生产环境
|
||||
NUXT_PUBLIC_WEBSITE_BASE_URL=https://open-isle.com
|
||||
NUXT_PUBLIC_WEBSITE_BASE_URL=https://www.open-isle.com
|
||||
; 生产环境ws后端
|
||||
NUXT_PUBLIC_WEBSOCKET_URL=https://open-isle.com/websocket
|
||||
NUXT_PUBLIC_WEBSOCKET_URL=https://www.open-isle.com/websocket
|
||||
|
||||
NUXT_PUBLIC_GOOGLE_CLIENT_ID=777830451304-nt8afkkap18gui4f9entcha99unal744.apps.googleusercontent.com
|
||||
NUXT_PUBLIC_GITHUB_CLIENT_ID=Ov23liVkO1NPAX5JyWxJ
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
--background-color-blur: rgba(255, 255, 255, 0.57);
|
||||
--menu-border-color: lightgray;
|
||||
--normal-border-color: lightgray;
|
||||
--menu-selected-background-color: rgba(242, 242, 242, 0.884);
|
||||
--menu-selected-background-color: rgba(88, 241, 255, 0.166);
|
||||
--normal-light-background-color: rgba(242, 242, 242, 0.884);
|
||||
--menu-selected-background-color-hover: rgba(242, 242, 242, 0.884);
|
||||
--menu-text-color: rgb(99, 99, 99);
|
||||
--scroller-background-color: rgba(130, 175, 180, 0.5);
|
||||
/* --normal-background-color: rgb(241, 241, 241); */
|
||||
@@ -58,6 +60,8 @@
|
||||
--menu-border-color: #555;
|
||||
--normal-border-color: #555;
|
||||
--menu-selected-background-color: rgba(255, 255, 255, 0.1);
|
||||
--normal-light-background-color: rgba(255, 255, 255, 0.1);
|
||||
--menu-selected-background-color-hover: rgba(17, 182, 197, 0.082);
|
||||
--menu-text-color: rgb(173, 173, 173);
|
||||
/* --normal-background-color: #000000; */
|
||||
--normal-background-color: #333;
|
||||
@@ -162,7 +166,7 @@ body {
|
||||
padding-left: 1em;
|
||||
border-left: 4px solid #d0d7de;
|
||||
color: var(--blockquote-text-color);
|
||||
background-color: var(--menu-selected-background-color);
|
||||
background-color: var(--normal-light-background-color);
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
@@ -295,7 +299,7 @@ body {
|
||||
|
||||
/* 鼠标悬停行高亮 */
|
||||
.info-content-text tbody tr:hover {
|
||||
background-color: var(--menu-selected-background-color);
|
||||
background-color: var(--normal-light-background-color);
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
<div class="article-category-container" v-if="category">
|
||||
<div class="article-info-item" @click="gotoCategory">
|
||||
<BaseImage
|
||||
v-if="category.smallIcon"
|
||||
v-if="isImageIcon(category.smallIcon)"
|
||||
class="article-info-item-img"
|
||||
:src="category.smallIcon"
|
||||
:alt="category.name"
|
||||
/>
|
||||
<component v-else :is="category.smallIcon || category.icon" class="article-info-item-img" />
|
||||
<div class="article-info-item-text">{{ category.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -22,6 +23,11 @@ const gotoCategory = async () => {
|
||||
const value = encodeURIComponent(props.category.id ?? props.category.name)
|
||||
await navigateTo({ path: '/', query: { category: value } }, { replace: true })
|
||||
}
|
||||
|
||||
const isImageIcon = (icon) => {
|
||||
if (!icon) return false
|
||||
return /^https?:\/\//.test(icon) || icon.startsWith('/')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -7,11 +7,17 @@
|
||||
@click="gotoTag(tag)"
|
||||
>
|
||||
<BaseImage
|
||||
v-if="tag.smallIcon"
|
||||
v-if="isImageIcon(tag.smallIcon)"
|
||||
class="article-info-item-img"
|
||||
:src="tag.smallIcon"
|
||||
:alt="tag.name"
|
||||
/>
|
||||
<component
|
||||
v-else-if="tag.smallIcon || tag.icon"
|
||||
:is="tag.smallIcon || tag.icon"
|
||||
class="article-info-item-img"
|
||||
/>
|
||||
<tag-one v-else class="article-info-item-img" />
|
||||
<div class="article-info-item-text">{{ tag.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -26,6 +32,11 @@ const gotoTag = async (tag) => {
|
||||
const value = encodeURIComponent(tag.id ?? tag.name)
|
||||
await navigateTo({ path: '/', query: { tags: value } }, { replace: true })
|
||||
}
|
||||
|
||||
const isImageIcon = (icon) => {
|
||||
if (!icon) return false
|
||||
return /^https?:\/\//.test(icon) || icon.startsWith('/')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
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>
|
||||
|
||||
@@ -404,7 +404,6 @@ const handleContentClick = (e) => {
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
opacity: 0.5;
|
||||
transform: scaleX(-1);
|
||||
}
|
||||
|
||||
.reply-user-name {
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
<div class="header-content-left">
|
||||
<div v-if="showMenuBtn" class="menu-btn-wrapper">
|
||||
<button class="menu-btn" ref="menuBtn" @click="$emit('toggle-menu')">
|
||||
<application-menu class="micon"></application-menu>
|
||||
<ToolTip content="展开/收起菜单" placement="bottom">
|
||||
<application-menu class="micon"></application-menu>
|
||||
</ToolTip>
|
||||
</button>
|
||||
<span
|
||||
v-if="isMobile && (unreadMessageCount > 0 || hasChannelUnread)"
|
||||
|
||||
@@ -122,6 +122,11 @@
|
||||
class="section-item-icon"
|
||||
:alt="t.name"
|
||||
/>
|
||||
<component
|
||||
v-else-if="t.smallIcon || t.icon"
|
||||
:is="t.smallIcon || t.icon"
|
||||
class="section-item-icon"
|
||||
/>
|
||||
<tag-one v-else class="section-item-icon" />
|
||||
<span class="section-item-text"
|
||||
>{{ t.name }} <span class="section-item-text-count">x {{ t.count }}</span></span
|
||||
@@ -311,6 +316,10 @@ const gotoTag = (t) => {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.menu-item:hover {
|
||||
background-color: var(--menu-selected-background-color-hover);
|
||||
}
|
||||
|
||||
.menu-item.selected {
|
||||
font-weight: bold;
|
||||
background-color: var(--menu-selected-background-color);
|
||||
@@ -402,7 +411,7 @@ const gotoTag = (t) => {
|
||||
}
|
||||
|
||||
.section-item:hover {
|
||||
background-color: var(--menu-selected-background-color);
|
||||
background-color: var(--menu-selected-background-color-hover);
|
||||
}
|
||||
|
||||
.section-item-text-count {
|
||||
|
||||
33
frontend_nuxt/components/NewMessageContainer.vue
Normal file
33
frontend_nuxt/components/NewMessageContainer.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div class="new-message-container" :style="{ bottom: bottom + 'px' }" @click="$emit('click')">
|
||||
{{ count }} 条新消息,点击查看
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
count: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
bottom: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.new-message-container {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background-color: var(--primary-color);
|
||||
color: #fff;
|
||||
padding: 6px 16px;
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
||||
z-index: 50;
|
||||
}
|
||||
</style>
|
||||
@@ -136,7 +136,7 @@ export default {
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: var(--menu-selected-background-color);
|
||||
background: var(--normal-light-background-color);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
@@ -331,11 +331,11 @@ onMounted(async () => {
|
||||
|
||||
.reactions-viewer-item.placeholder,
|
||||
.reactions-viewer-single-item.selected {
|
||||
background-color: var(--menu-selected-background-color);
|
||||
background-color: var(--normal-light-background-color);
|
||||
}
|
||||
|
||||
.reaction-option.selected {
|
||||
background-color: var(--menu-selected-background-color);
|
||||
background-color: var(--normal-light-background-color);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
|
||||
@@ -65,16 +65,17 @@
|
||||
class="article-item"
|
||||
v-for="article in articles"
|
||||
:key="article.id"
|
||||
@click="navigateTo(`/posts/${article.id}`)"
|
||||
>
|
||||
<div class="article-main-container">
|
||||
<NuxtLink class="article-item-title main-item" :to="`/posts/${article.id}`">
|
||||
<NuxtLink class="article-item-title main-item">
|
||||
<pin v-if="article.pinned" theme="outline" class="pinned-icon" />
|
||||
<gift v-if="article.type === 'LOTTERY'" class="lottery-icon" />
|
||||
<ranking-list v-else-if="article.type === 'POLL'" class="poll-icon" />
|
||||
<star v-if="!article.rssExcluded" class="featured-icon" />
|
||||
{{ article.title }}
|
||||
</NuxtLink>
|
||||
<NuxtLink class="article-item-description main-item" :to="`/posts/${article.id}`">
|
||||
<NuxtLink class="article-item-description main-item">
|
||||
{{ sanitizeDescription(article.description) }}
|
||||
</NuxtLink>
|
||||
<div class="article-info-container main-item">
|
||||
@@ -488,6 +489,11 @@ const sanitizeDescription = (text) => stripMarkdown(text)
|
||||
border-bottom: 1px solid var(--normal-border-color);
|
||||
}
|
||||
|
||||
.article-item:hover {
|
||||
background-color: var(--menu-selected-background-color-hover);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.article-main-container,
|
||||
.header-item.main-item {
|
||||
width: calc(60% - 20px);
|
||||
@@ -529,7 +535,7 @@ const sanitizeDescription = (text) => stripMarkdown(text)
|
||||
}
|
||||
|
||||
.article-item-title {
|
||||
margin-top: 10px;
|
||||
margin-top: 15px;
|
||||
font-size: 18px;
|
||||
text-decoration: none;
|
||||
color: var(--text-color);
|
||||
@@ -558,7 +564,7 @@ const sanitizeDescription = (text) => stripMarkdown(text)
|
||||
|
||||
.article-item-description {
|
||||
max-width: 100%;
|
||||
margin-top: 10px;
|
||||
margin-top: 5px;
|
||||
font-size: 13px;
|
||||
color: rgba(140, 140, 140, 0.888);
|
||||
display: -webkit-box;
|
||||
@@ -605,6 +611,7 @@ const sanitizeDescription = (text) => stripMarkdown(text)
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.article-member-avatars-container {
|
||||
@@ -719,10 +726,15 @@ const sanitizeDescription = (text) => stripMarkdown(text)
|
||||
}
|
||||
|
||||
.article-item-title {
|
||||
margin-top: 10px;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.article-main-container {
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
.article-item-description {
|
||||
margin-top: 2px;
|
||||
font-size: 10px;
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
:content-id="item.id"
|
||||
@update:modelValue="(v) => (item.reactions = v)"
|
||||
>
|
||||
<div class="reply-btn"><next @click="setReply(item)" /> 写个回复...</div>
|
||||
<div @click="setReply(item)" class="reply-btn"><next /> 写个回复...</div>
|
||||
</ReactionsGroup>
|
||||
</template>
|
||||
</BaseTimeline>
|
||||
@@ -62,7 +62,14 @@
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="message-input-area">
|
||||
<NewMessageContainer
|
||||
v-if="showNewMessageContainer"
|
||||
:count="newMessagesCount"
|
||||
:bottom="inputAreaHeight + 20"
|
||||
@click="handleNewMessagesClick"
|
||||
/>
|
||||
|
||||
<div class="message-input-area" ref="messageInputAreaEl">
|
||||
<div v-if="replyTo" class="active-reply">
|
||||
正在回复 {{ replyTo.sender.username }}:
|
||||
{{ stripMarkdownLength(replyTo.content, 50) }}
|
||||
@@ -96,6 +103,7 @@ import { useChannelsUnreadCount } from '~/composables/useChannelsUnreadCount'
|
||||
import TimeManager from '~/utils/time'
|
||||
import BaseTimeline from '~/components/BaseTimeline.vue'
|
||||
import BasePlaceholder from '~/components/BasePlaceholder.vue'
|
||||
import NewMessageContainer from '~/components/NewMessageContainer.vue'
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const route = useRoute()
|
||||
@@ -112,6 +120,7 @@ const error = ref(null)
|
||||
const conversationId = route.params.id
|
||||
const currentUser = ref(null)
|
||||
const messagesListEl = ref(null)
|
||||
const messageInputAreaEl = ref(null)
|
||||
const currentPage = ref(0)
|
||||
const totalPages = ref(0)
|
||||
const loadingMore = ref(false)
|
||||
@@ -120,6 +129,21 @@ const isChannel = ref(false)
|
||||
const isFloatMode = computed(() => route.query.float !== undefined)
|
||||
const floatRoute = useState('messageFloatRoute')
|
||||
const replyTo = ref(null)
|
||||
const newMessagesCount = ref(0)
|
||||
const inputAreaHeight = ref(0)
|
||||
const showNewMessageContainer = computed(
|
||||
() => newMessagesCount.value > 0 && !isUserNearBottom.value,
|
||||
)
|
||||
|
||||
function updateInputAreaHeight() {
|
||||
if (!messageInputAreaEl.value) return
|
||||
inputAreaHeight.value = messageInputAreaEl.value.offsetHeight
|
||||
}
|
||||
|
||||
function handleNewMessagesClick() {
|
||||
scrollToBottomSmooth()
|
||||
newMessagesCount.value = 0
|
||||
}
|
||||
|
||||
const isUserNearBottom = ref(true)
|
||||
function updateNearBottom() {
|
||||
@@ -329,6 +353,10 @@ onMounted(async () => {
|
||||
messagesListEl.value.addEventListener('scroll', updateNearBottom, { passive: true })
|
||||
}
|
||||
|
||||
window.addEventListener('resize', updateInputAreaHeight)
|
||||
await nextTick()
|
||||
updateInputAreaHeight()
|
||||
|
||||
currentUser.value = await fetchCurrentUser()
|
||||
if (currentUser.value) {
|
||||
await fetchMessages(0)
|
||||
@@ -370,9 +398,10 @@ const subscribeToConversation = () => {
|
||||
|
||||
await markConversationAsRead()
|
||||
await nextTick()
|
||||
|
||||
if (isUserNearBottom.value) {
|
||||
scrollToBottomSmooth()
|
||||
} else {
|
||||
newMessagesCount.value += 1
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to parse websocket message', e)
|
||||
@@ -386,6 +415,14 @@ watch(isConnected, (newValue) => {
|
||||
}
|
||||
})
|
||||
|
||||
watch(isUserNearBottom, (val) => {
|
||||
if (val) newMessagesCount.value = 0
|
||||
})
|
||||
|
||||
watch(replyTo, () => {
|
||||
nextTick(updateInputAreaHeight)
|
||||
})
|
||||
|
||||
onActivated(async () => {
|
||||
// 返回页面时:刷新数据与已读,并滚动到底部
|
||||
if (currentUser.value) {
|
||||
@@ -418,6 +455,7 @@ onUnmounted(() => {
|
||||
if (messagesListEl.value) {
|
||||
messagesListEl.value.removeEventListener('scroll', updateNearBottom)
|
||||
}
|
||||
window.removeEventListener('resize', updateInputAreaHeight)
|
||||
})
|
||||
|
||||
function minimize() {
|
||||
@@ -614,7 +652,7 @@ function goBack() {
|
||||
border-left: 5px solid var(--primary-color);
|
||||
margin-bottom: 5px;
|
||||
font-size: 13px;
|
||||
background-color: var(--menu-selected-background-color);
|
||||
background-color: var(--normal-light-background-color);
|
||||
}
|
||||
|
||||
.reply-author {
|
||||
@@ -634,7 +672,7 @@ function goBack() {
|
||||
}
|
||||
|
||||
.active-reply {
|
||||
background-color: var(--bg-color-soft);
|
||||
background-color: var(--normal-light-background-color);
|
||||
padding: 5px 10px;
|
||||
border-left: 5px solid var(--primary-color);
|
||||
margin-bottom: 5px;
|
||||
|
||||
@@ -419,7 +419,7 @@ function minimize() {
|
||||
}
|
||||
|
||||
.conversation-item:hover {
|
||||
background-color: var(--menu-selected-background-color);
|
||||
background-color: var(--normal-light-background-color);
|
||||
}
|
||||
|
||||
.conversation-avatar {
|
||||
|
||||
@@ -63,6 +63,16 @@ import {
|
||||
History,
|
||||
Lightning,
|
||||
PeoplesTwo,
|
||||
Code,
|
||||
GoodTwo,
|
||||
Twitter,
|
||||
Bitcoin,
|
||||
Fire,
|
||||
Communication,
|
||||
WaterLevel,
|
||||
RobotOne,
|
||||
Server,
|
||||
Protection,
|
||||
} from '@icon-park/vue-next'
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
@@ -129,4 +139,14 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||
nuxtApp.vueApp.component('HistoryIcon', History)
|
||||
nuxtApp.vueApp.component('Lightning', Lightning)
|
||||
nuxtApp.vueApp.component('PeoplesTwo', PeoplesTwo)
|
||||
nuxtApp.vueApp.component('CodeIcon', Code)
|
||||
nuxtApp.vueApp.component('GoodTwo', GoodTwo)
|
||||
nuxtApp.vueApp.component('Twitter', Twitter)
|
||||
nuxtApp.vueApp.component('Bitcoin', Bitcoin)
|
||||
nuxtApp.vueApp.component('Fire', Fire)
|
||||
nuxtApp.vueApp.component('Communication', Communication)
|
||||
nuxtApp.vueApp.component('WaterLevel', WaterLevel)
|
||||
nuxtApp.vueApp.component('RobotOne', RobotOne)
|
||||
nuxtApp.vueApp.component('ServerIcon', Server)
|
||||
nuxtApp.vueApp.component('Protection', Protection)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user