线上版本更新

This commit is contained in:
2026-02-05 18:50:40 +08:00
parent fce706198a
commit 0dd02a13f6
7 changed files with 118 additions and 1629 deletions

View File

@@ -1,28 +1,6 @@
```
<template>
<div
class="min-h-screen bg-[#F0F4F8] flex items-center justify-center font-sans antialiased relative overflow-hidden transition-colors duration-300">
<div class="absolute top-8 right-8 flex gap-4 z-20">
<!-- Network Settings (Placeholder/Mock) -->
<!-- <div class="bg-white/95 border border-slate-200 rounded-2xl px-3 py-2 shadow-lg cursor-pointer hover:-translate-y-px transition-all flex items-center gap-2">
<span class="text-sm font-semibold text-slate-700">{{ $t('login.network') }}</span>
</div> -->
<!-- Language Selector -->
<el-dropdown>
<div
class="bg-white/95 border border-slate-200 rounded-2xl px-4 py-2 shadow-lg cursor-pointer hover:-translate-y-px transition-all flex items-center gap-2">
<span class="text-sm font-semibold text-slate-700">{{ locale === 'zh' ? '中文' : 'English' }}</span>
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="switchLanguage('zh')">中文</el-dropdown-item>
<el-dropdown-item @click="switchLanguage('en')">English</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
<!-- Background Shapes -->
<div class="absolute top-[-200px] right-[-200px] w-[800px] h-[800px] rounded-full mix-blend-multiply filter blur-3xl opacity-70 animate-pulse"
style="background: radial-gradient(circle, rgba(79, 129, 230, 0.2) 0%, rgba(79, 129, 230, 0) 70%)" />
@@ -157,24 +135,14 @@
<script setup>
import { ref, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { isElectron, getAppVersion } from '../utils/electronBridge'
import { setUser, setToken, setUserPass, getUserPass, setPermissions } from '@/utils/storage'
import logo from '../assets/logo.png'
import illustration from '../assets/illustration.png'
const emit = defineEmits(['loginSuccess'])
const { locale } = useI18n()
// Language Switcher
const switchLanguage = (lang) => {
locale.value = lang
localStorage.setItem('lang', lang)
}
// const STORAGE_KEY = 'login_credentials' // Deprecated in favor of getUserPass
// const USER_KEY = 'user_data' // Deprecated in favor of setUser
const STORAGE_KEY = 'login_credentials'
const USER_KEY = 'user_data'
const credentials = ref({
tenantName: '',
@@ -193,12 +161,13 @@ onMounted(() => {
// 加载保存的凭据
try {
const saved = getUserPass()
const saved = localStorage.getItem(STORAGE_KEY)
if (saved) {
const data = JSON.parse(saved)
credentials.value = {
tenantName: saved.tenantName || '',
username: saved.username || saved.userId || '',
password: saved.password || '',
tenantName: data.tenantName || '',
username: data.username || data.userId || '',
password: data.password || '',
}
}
} catch { } // eslint-disable-line no-empty
@@ -214,8 +183,8 @@ const handleSubmit = async () => {
error.value = ''
try {
// 保存凭据 (Using compatible storage helper)
setUserPass(credentials.value)
// 保存凭据
localStorage.setItem(STORAGE_KEY, JSON.stringify(credentials.value))
console.log('[LoginPage] 开始登录...', credentials.value)
@@ -229,17 +198,7 @@ const handleSubmit = async () => {
console.log('[LoginPage] 登录结果:', result)
if (result.success && result.user) {
// Save token and user info to localStorage using legacy keys to support ported views
setToken(result.user.tokenValue);
setUser(result.user);
// 保存权限信息
setPermissions({
bigBrother: result.user.bigBrother,
crawl: result.user.crawl,
webAi: result.user.webAi,
});
localStorage.setItem(USER_KEY, JSON.stringify(result.user))
emit('loginSuccess')
} else {
error.value = result.error || '登录失败'