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:
2026-08-09 00:18:47 +08:00
parent bdafac2857
commit 337eb4f05a
51 changed files with 1395 additions and 1504 deletions
+30 -13
View File
@@ -1,5 +1,5 @@
<template>
<section ref="rootRef" class="relative bg-gradient-to-b from-gray-50 to-white min-h-screen flex flex-col items-center justify-center overflow-hidden py-20">
<section v-if="testimonials.length" ref="rootRef" class="relative bg-gradient-to-b from-gray-50 to-white min-h-screen flex flex-col items-center justify-center overflow-hidden py-20">
<div class="w-full max-w-[1400px] mx-auto px-6 md:px-10">
<!-- 标题 -->
<div ref="headerRef" class="text-center mb-16 md:mb-20">
@@ -33,7 +33,7 @@
<!-- 评价内容 -->
<p class="text-gray-700 text-base md:text-lg leading-relaxed mb-8 italic">
"{{ t(`home.testimonials.items.${item.id}.content`) }}"
"{{ item.content }}"
</p>
<!-- 客户信息 -->
@@ -45,10 +45,10 @@
</div>
<div>
<h4 class="text-lg md:text-xl font-bold text-black">
{{ t(`home.testimonials.items.${item.id}.name`) }}
{{ item.name }}
</h4>
<p class="text-sm md:text-base text-gray-500">
{{ t(`home.testimonials.items.${item.id}.role`) }}
{{ item.role }}
</p>
</div>
</div>
@@ -69,10 +69,12 @@ import { ref, onMounted, onUnmounted, nextTick, computed } from 'vue'
import { useI18n } from 'vue-i18n'
import gsap from 'gsap'
import { ScrollTrigger } from 'gsap/ScrollTrigger'
import { useSiteSettings } from '~/composables/useSiteSettings'
gsap.registerPlugin(ScrollTrigger)
const { t } = useI18n()
const { t, locale } = useI18n()
const { settings } = useSiteSettings()
const rootRef = ref<HTMLElement | null>(null)
const headerRef = ref<HTMLElement | null>(null)
@@ -80,16 +82,31 @@ const trackRef = ref<HTMLElement | null>(null)
let ctx: gsap.Context | null = null
let animFrameId: number | null = null
const testimonials = [
{ id: 'client1', initial: 'A', avatarGradient: 'from-blue-500 to-cyan-500' },
{ id: 'client2', initial: 'B', avatarGradient: 'from-purple-500 to-pink-500' },
{ id: 'client3', initial: 'C', avatarGradient: 'from-orange-500 to-red-500' },
{ id: 'client4', initial: 'D', avatarGradient: 'from-green-500 to-emerald-500' },
{ id: 'client5', initial: 'E', avatarGradient: 'from-indigo-500 to-purple-500' },
// 头像渐变预设按序号循环,后台无需逐条选色
const AVATAR_STYLES = [
'from-blue-500 to-cyan-500',
'from-purple-500 to-pink-500',
'from-orange-500 to-red-500',
'from-green-500 to-emerald-500',
'from-indigo-500 to-purple-500',
]
const locStr = (zh: string, en: string) => (locale.value === 'zh' ? zh : en)
// 客户评价来自后台配置(/admin/settings 客户评价),空则不渲染该板块
const testimonials = computed(() =>
(settings.value?.testimonials ?? []).map((t, i) => ({
id: t.id,
name: t.name,
role: locStr(t.roleZh, t.roleEn),
content: locStr(t.contentZh, t.contentEn),
initial: (t.name || '?').trim().charAt(0).toUpperCase(),
avatarGradient: AVATAR_STYLES[i % AVATAR_STYLES.length],
})),
)
// 复制一份用于无缝循环
const allTestimonials = computed(() => [...testimonials, ...testimonials])
const allTestimonials = computed(() => [...testimonials.value, ...testimonials.value])
// 自动滚动状态
const offset = ref(0)
@@ -98,7 +115,7 @@ let isPaused = false
const cardWidth = 400 + 32 // 卡片宽度 + gap
const startAutoplay = () => {
const totalWidth = testimonials.length * cardWidth
const totalWidth = testimonials.value.length * cardWidth
const animate = () => {
if (!isPaused) {