feat: 登录改为 Casdoor 统一身份认证(SSO),重建用户体系
- 移除内置密码注册/登录/改密/删号/头像,统一走 Casdoor OIDC 授权码 - 服务端 casdoor-nodejs-sdk:code 换 token + 证书公钥验签 + get-account 补齐资料 - 用户表重建为 provider+provider_id(Casdoor sub 为准),邮箱不再唯一 - 管理员由 Casdoor token 的 isAdmin/IsAdmin 字段或 admin 角色判定,删除角色切换接口 - 前端登录弹窗改为申统认证跳转,注册去 Casdoor;后台用户列表只读角色 - 会话沿用 an_session httpOnly Cookie,requireUser/requireAdmin 守卫保留 - 配置注入 deploy.sh/.env.example;新增 casdoor 单测,删除 password 单测
This commit is contained in:
@@ -1,18 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onBeforeUnmount, ref } from 'vue'
|
||||
import { onMounted, onBeforeUnmount, ref, computed } from 'vue'
|
||||
import { useNuxtApp } from '#app'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import gsap from 'gsap'
|
||||
import AnimatedButton from '~/components/common/AnimatedButton.vue'
|
||||
import { useSiteSettings } from '~/composables/useSiteSettings'
|
||||
|
||||
const { t } = useI18n()
|
||||
const { settings } = useSiteSettings()
|
||||
|
||||
// 定义背景画廊与主视图绑定的总滚动距离(像素),数值越大,用户向下滚动时 Hero 面板缩放的过程就越长
|
||||
const heroPinDistance = 1200
|
||||
const heroGalleryColumns = [
|
||||
{ side: 'left', images: ['1018', '1015', '1024', '1039'].map(id => `https://picsum.photos/id/${id}/900/1200`) },
|
||||
{ side: 'right', images: ['1043', '1050', '1067', '1074'].map(id => `https://picsum.photos/id/${id}/900/1200`) },
|
||||
] as const
|
||||
// 背景画廊:由后台「首页 Hero 画廊」配置,图片均分到左右两列;为空时显示品牌纯色兜底
|
||||
const heroGalleryColumns = computed(() => {
|
||||
const gallery = settings.value?.hero?.gallery ?? []
|
||||
const left = gallery.filter((_, i) => i % 2 === 0)
|
||||
const right = gallery.filter((_, i) => i % 2 === 1)
|
||||
const columns: { side: 'left' | 'right'; images: string[] }[] = []
|
||||
if (left.length) columns.push({ side: 'left', images: left })
|
||||
if (right.length) columns.push({ side: 'right', images: right })
|
||||
return columns
|
||||
})
|
||||
|
||||
const heroStageRef = ref<HTMLElement | null>(null)
|
||||
const heroRef = ref<HTMLElement | null>(null)
|
||||
@@ -202,14 +210,16 @@ defineExpose({ play })
|
||||
class="relative bg-black"
|
||||
:style="{ height: `calc(100svh + ${heroPinDistance}px)` }"
|
||||
>
|
||||
<section ref="heroRef" class="sticky top-0 h-[100svh] overflow-hidden bg-[#111]" v-once>
|
||||
<section ref="heroRef" class="sticky top-0 h-[100svh] overflow-hidden bg-[#111]">
|
||||
<div class="absolute inset-0 overflow-hidden bg-black" aria-hidden="true">
|
||||
<div
|
||||
v-for="column in heroGalleryColumns"
|
||||
:key="column.side"
|
||||
class="absolute -bottom-10 -top-10 w-[49vw] overflow-hidden"
|
||||
:class="column.side === 'left' ? 'left-0' : 'right-0'"
|
||||
>
|
||||
<!-- 有后台画廊配置时渲染图片列;否则显示品牌纯色兜底 -->
|
||||
<template v-if="heroGalleryColumns.length">
|
||||
<div
|
||||
v-for="column in heroGalleryColumns"
|
||||
:key="column.side"
|
||||
class="absolute -bottom-10 -top-10 w-[49vw] overflow-hidden"
|
||||
:class="column.side === 'left' ? 'left-0' : 'right-0'"
|
||||
>
|
||||
<!-- 复制两份图片组,配合 translateY(-50%) 做无缝循环。 -->
|
||||
<div
|
||||
class="hero-gallery-track will-change-transform"
|
||||
@@ -228,6 +238,11 @@ defineExpose({ play })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<!-- 兜底:无后台画廊配置时的品牌背景 -->
|
||||
<div class="absolute inset-0 bg-gradient-to-br from-neutral-800 via-neutral-900 to-black"></div>
|
||||
</template>
|
||||
</div>
|
||||
<div ref="heroPanelRef" class="absolute inset-0 flex flex-col justify-between items-center bg-white text-black will-change-transform pt-24 pb-8 md:pt-36 md:pb-12 overflow-hidden">
|
||||
<div class="flex flex-col justify-between w-page-container max-w-[calc(100%-2rem)] mx-auto px-4 h-full">
|
||||
|
||||
Reference in New Issue
Block a user