mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-09-04 17:37:20 +00:00
fix: 修改登录遮罩
This commit is contained in:
@@ -1,19 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="post-page-container">
|
<BasePopup v-if="isRestricted" :visible="true" @close="closeRestrictedPopup">
|
||||||
<div v-if="isWaitingFetchingPost" class="loading-container">
|
|
||||||
<l-hatch size="28" stroke="4" speed="3.5" color="var(--primary-color)"></l-hatch>
|
|
||||||
</div>
|
|
||||||
<div v-else
|
|
||||||
class="post-page-main-container"
|
|
||||||
ref="mainContainer"
|
|
||||||
>
|
|
||||||
<!-- 🔒 遮罩层 -->
|
|
||||||
<ClientOnly>
|
|
||||||
<div v-if="isRestricted" class="restricted-overlay">
|
|
||||||
<div class="restricted-content">
|
<div class="restricted-content">
|
||||||
<Lock class="restricted-icon" />
|
<Lock class="restricted-icon" />
|
||||||
|
|
||||||
<!-- 🔒 权限文案 -->
|
|
||||||
<template v-if="visibleScope === 'ONLY_ME'">
|
<template v-if="visibleScope === 'ONLY_ME'">
|
||||||
<p>这是一篇私密文章,仅作者本人及管理员可见</p>
|
<p>这是一篇私密文章,仅作者本人及管理员可见</p>
|
||||||
<div class="restricted-actions">
|
<div class="restricted-actions">
|
||||||
@@ -24,13 +13,16 @@
|
|||||||
<template v-else-if="visibleScope === 'ONLY_REGISTER'">
|
<template v-else-if="visibleScope === 'ONLY_REGISTER'">
|
||||||
<p>请登录后查看这篇文章</p>
|
<p>请登录后查看这篇文章</p>
|
||||||
<div class="restricted-actions">
|
<div class="restricted-actions">
|
||||||
<NuxtLink to="/login" class="restricted-button" v-if="!loggedIn" >登录</NuxtLink>
|
<NuxtLink to="/login" class="restricted-button" v-if="!loggedIn">登录</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
</div></BasePopup
|
||||||
|
>
|
||||||
|
<div class="post-page-container">
|
||||||
|
<div v-if="isWaitingFetchingPost" class="loading-container">
|
||||||
|
<l-hatch size="28" stroke="4" speed="3.5" color="var(--primary-color)"></l-hatch>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div v-else class="post-page-main-container" ref="mainContainer">
|
||||||
</ClientOnly>
|
|
||||||
<div :class="{ 'is-blurred': isRestricted }">
|
|
||||||
<div class="article-title-container">
|
<div class="article-title-container">
|
||||||
<div class="article-title-container-left">
|
<div class="article-title-container-left">
|
||||||
<div class="article-title">{{ title }}</div>
|
<div class="article-title">{{ title }}</div>
|
||||||
@@ -191,7 +183,6 @@
|
|||||||
</BaseTimeline>
|
</BaseTimeline>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <div class="post-page-scroller-container">
|
<!-- <div class="post-page-scroller-container">
|
||||||
<div class="scroller">
|
<div class="scroller">
|
||||||
@@ -537,17 +528,23 @@ const tokenHeader = computed(() => {
|
|||||||
const token = getToken()
|
const token = getToken()
|
||||||
return token ? { Authorization: `Bearer ${token}` } : {}
|
return token ? { Authorization: `Bearer ${token}` } : {}
|
||||||
})
|
})
|
||||||
const { data: postData, pending: pendingPost, error: postError, refresh: refreshPost } =
|
const {
|
||||||
await useAsyncData(`post-${postId}`, async () => {
|
data: postData,
|
||||||
|
pending: pendingPost,
|
||||||
|
error: postError,
|
||||||
|
refresh: refreshPost,
|
||||||
|
} = await useAsyncData(
|
||||||
|
`post-${postId}`,
|
||||||
|
async () => {
|
||||||
try {
|
try {
|
||||||
return await $fetch(`${API_BASE_URL}/api/posts/${postId}`, { headers: tokenHeader.value })
|
return await $fetch(`${API_BASE_URL}/api/posts/${postId}`, { headers: tokenHeader.value })
|
||||||
} catch (err) {
|
} catch (err) {}
|
||||||
}
|
},
|
||||||
}, {
|
{
|
||||||
server: false,
|
server: false,
|
||||||
lazy: false,
|
lazy: false,
|
||||||
})
|
},
|
||||||
|
)
|
||||||
|
|
||||||
// 用 pendingPost 驱动现有 UI(替代 isWaitingFetchingPost 手控)
|
// 用 pendingPost 驱动现有 UI(替代 isWaitingFetchingPost 手控)
|
||||||
const isWaitingFetchingPost = computed(() => pendingPost.value)
|
const isWaitingFetchingPost = computed(() => pendingPost.value)
|
||||||
@@ -1385,7 +1382,6 @@ onMounted(async () => {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ======== 权限锁定状态 ======== */
|
/* ======== 权限锁定状态 ======== */
|
||||||
.is-blurred {
|
.is-blurred {
|
||||||
filter: blur(10px);
|
filter: blur(10px);
|
||||||
@@ -1413,11 +1409,8 @@ onMounted(async () => {
|
|||||||
/* 中央提示框 */
|
/* 中央提示框 */
|
||||||
.restricted-content {
|
.restricted-content {
|
||||||
background: #ffff;
|
background: #ffff;
|
||||||
color:var(--primary-color);
|
color: var(--primary-color);
|
||||||
padding: 50px 60px;
|
|
||||||
border-radius: 12px;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.restricted-icon {
|
.restricted-icon {
|
||||||
|
|||||||
Reference in New Issue
Block a user