style: code format

This commit is contained in:
Lan
2025-02-15 21:56:41 +08:00
parent 5aa5d9475d
commit 83021e2170
9 changed files with 535 additions and 1304 deletions
+119 -303
View File
@@ -1,8 +1,6 @@
<template>
<div
class="min-h-screen flex flex-col lg:flex-row transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-900' : 'bg-gray-50']"
>
<div class="min-h-screen flex flex-col lg:flex-row transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-900' : 'bg-gray-50']">
<!-- Sidebar -->
<aside
class="fixed inset-y-0 left-0 z-50 w-64 transform transition-all duration-300 ease-in-out lg:relative lg:translate-x-0 border-r"
@@ -11,28 +9,17 @@
? 'bg-gray-800 bg-opacity-90 backdrop-filter backdrop-blur-xl border-gray-700'
: 'bg-white border-gray-200',
{ '-translate-x-full': !isSidebarOpen }
]"
>
]">
<!-- Logo区域 -->
<div
class="flex items-center justify-between h-16 px-4 border-b"
:class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']"
>
<div class="flex items-center justify-between h-16 px-4 border-b"
:class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']">
<div class="flex items-center">
<div
class="rounded-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 p-1 animate-spin-slow"
>
<div class="rounded-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 p-1 animate-spin-slow">
<div class="rounded-full p-1" :class="[isDarkMode ? 'bg-gray-800' : 'bg-white']">
<BoxIcon
class="w-6 h-6"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
/>
<BoxIcon class="w-6 h-6" :class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']" />
</div>
</div>
<h1
class="ml-2 text-xl font-semibold"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
<h1 class="ml-2 text-xl font-semibold" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
FileCodeBox
</h1>
</div>
@@ -45,11 +32,8 @@
<nav class="flex-1 overflow-y-auto">
<ul class="p-4 space-y-2">
<li v-for="item in menuItems" :key="item.id">
<a
href="#"
@click="currentSection = item.id"
class="flex items-center p-2 rounded-lg transition-colors duration-200"
:class="[
<a href="#" @click="currentSection = item.id"
class="flex items-center p-2 rounded-lg transition-colors duration-200" :class="[
currentSection === item.id
? isDarkMode
? 'bg-indigo-900 text-indigo-400'
@@ -57,8 +41,7 @@
: isDarkMode
? 'text-gray-400 hover:bg-gray-700'
: 'text-gray-600 hover:bg-gray-100'
]"
>
]">
<component :is="item.icon" class="w-5 h-5 mr-3" />
{{ item.name }}
</a>
@@ -70,10 +53,8 @@
<!-- Main Content -->
<div class="flex-1 flex flex-col min-h-screen">
<!-- Header -->
<header
class="shadow-md border-b transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 border-gray-700' : 'bg-white border-gray-200']"
>
<header class="shadow-md border-b transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 border-gray-700' : 'bg-white border-gray-200']">
<div class="flex items-center justify-between h-16 px-4">
<button @click="toggleSidebar" class="lg:hidden">
<MenuIcon class="w-6 h-6" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']" />
@@ -82,44 +63,28 @@
</header>
<!-- Content -->
<main
class="flex-1 p-6 overflow-y-auto transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-900' : 'bg-gray-50']"
>
<main class="flex-1 p-6 overflow-y-auto transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-900' : 'bg-gray-50']">
<div v-if="currentSection === 'dashboard'">
<h2
class="text-2xl font-bold mb-6"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
<h2 class="text-2xl font-bold mb-6" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
仪表盘
</h2>
<!-- 统计卡片区域 -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<div
class="p-6 rounded-lg shadow-md transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']"
>
<div class="p-6 rounded-lg shadow-md transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']">
<div class="flex items-center justify-between">
<div>
<p class="text-sm" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']">
总文件数
</p>
<h3
class="text-2xl font-bold mt-1"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
<h3 class="text-2xl font-bold mt-1" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
128
</h3>
</div>
<div
class="p-3 rounded-full"
:class="[isDarkMode ? 'bg-indigo-900' : 'bg-indigo-100']"
>
<FileIcon
class="w-6 h-6"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
/>
<div class="p-3 rounded-full" :class="[isDarkMode ? 'bg-indigo-900' : 'bg-indigo-100']">
<FileIcon class="w-6 h-6" :class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']" />
</div>
</div>
<p class="text-sm mt-2" :class="[isDarkMode ? 'text-green-400' : 'text-green-600']">
@@ -128,30 +93,19 @@
</p>
</div>
<div
class="p-6 rounded-lg shadow-md transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']"
>
<div class="p-6 rounded-lg shadow-md transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']">
<div class="flex items-center justify-between">
<div>
<p class="text-sm" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']">
存储空间
</p>
<h3
class="text-2xl font-bold mt-1"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
<h3 class="text-2xl font-bold mt-1" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
1.2 TB
</h3>
</div>
<div
class="p-3 rounded-full"
:class="[isDarkMode ? 'bg-purple-900' : 'bg-purple-100']"
>
<HardDriveIcon
class="w-6 h-6"
:class="[isDarkMode ? 'text-purple-400' : 'text-purple-600']"
/>
<div class="p-3 rounded-full" :class="[isDarkMode ? 'bg-purple-900' : 'bg-purple-100']">
<HardDriveIcon class="w-6 h-6" :class="[isDarkMode ? 'text-purple-400' : 'text-purple-600']" />
</div>
</div>
<div class="mt-4 h-2 bg-gray-200 rounded-full overflow-hidden">
@@ -162,30 +116,19 @@
</p>
</div>
<div
class="p-6 rounded-lg shadow-md transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']"
>
<div class="p-6 rounded-lg shadow-md transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']">
<div class="flex items-center justify-between">
<div>
<p class="text-sm" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']">
活跃用户
</p>
<h3
class="text-2xl font-bold mt-1"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
<h3 class="text-2xl font-bold mt-1" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
25
</h3>
</div>
<div
class="p-3 rounded-full"
:class="[isDarkMode ? 'bg-green-900' : 'bg-green-100']"
>
<UsersIcon
class="w-6 h-6"
:class="[isDarkMode ? 'text-green-400' : 'text-green-600']"
/>
<div class="p-3 rounded-full" :class="[isDarkMode ? 'bg-green-900' : 'bg-green-100']">
<UsersIcon class="w-6 h-6" :class="[isDarkMode ? 'text-green-400' : 'text-green-600']" />
</div>
</div>
<p class="text-sm mt-2" :class="[isDarkMode ? 'text-red-400' : 'text-red-600']">
@@ -194,27 +137,19 @@
</p>
</div>
<div
class="p-6 rounded-lg shadow-md transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']"
>
<div class="p-6 rounded-lg shadow-md transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']">
<div class="flex items-center justify-between">
<div>
<p class="text-sm" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']">
系统状态
</p>
<h3
class="text-2xl font-bold mt-1"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
<h3 class="text-2xl font-bold mt-1" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
正常
</h3>
</div>
<div class="p-3 rounded-full" :class="[isDarkMode ? 'bg-blue-900' : 'bg-blue-100']">
<ActivityIcon
class="w-6 h-6"
:class="[isDarkMode ? 'text-blue-400' : 'text-blue-600']"
/>
<ActivityIcon class="w-6 h-6" :class="[isDarkMode ? 'text-blue-400' : 'text-blue-600']" />
</div>
</div>
<p class="text-sm mt-2" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']">
@@ -224,34 +159,19 @@
</div>
<!-- 最近活动 -->
<div
class="rounded-lg shadow-md overflow-hidden transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']"
>
<div
class="px-6 py-4 border-b"
:class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']"
>
<h3
class="text-lg font-medium"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
<div class="rounded-lg shadow-md overflow-hidden transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']">
<div class="px-6 py-4 border-b" :class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']">
<h3 class="text-lg font-medium" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
最近活动
</h3>
</div>
<div class="p-6">
<div class="space-y-4">
<div
v-for="(activity, index) in recentActivities"
:key="index"
class="flex items-center space-x-4"
>
<div v-for="(activity, index) in recentActivities" :key="index" class="flex items-center space-x-4">
<div class="flex-shrink-0">
<component
:is="activity.icon"
class="w-5 h-5"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']"
/>
<component :is="activity.icon" class="w-5 h-5"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']" />
</div>
<div class="flex-1">
<p :class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']">
@@ -268,46 +188,31 @@
</div>
<div v-if="currentSection === 'files'">
<h2
class="text-2xl font-bold mb-6"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
<h2 class="text-2xl font-bold mb-6" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
文件管理
</h2>
<!-- 添加文件操作栏 -->
<div
class="mb-6 flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between"
>
<div class="mb-6 flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between">
<!-- 搜索和过滤 -->
<div class="flex flex-1 gap-4">
<div class="relative flex-1">
<input
type="text"
v-model="fileSearchQuery"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400'
: 'bg-white border-gray-300 text-gray-900 placeholder-gray-400'
]"
<input type="text" v-model="fileSearchQuery" :class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400'
: 'bg-white border-gray-300 text-gray-900 placeholder-gray-400'
]"
class="w-full pl-10 pr-4 py-2 rounded-lg border focus:ring-2 focus:ring-indigo-500 focus:border-transparent"
placeholder="搜索文件..."
/>
<SearchIcon
class="absolute left-3 top-2.5 w-5 h-5"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
/>
placeholder="搜索文件..." />
<SearchIcon class="absolute left-3 top-2.5 w-5 h-5"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']" />
</div>
<select
v-model="fileTypeFilter"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white'
: 'bg-white border-gray-300 text-gray-900'
]"
class="border rounded-lg px-4 py-2 focus:ring-2 focus:ring-indigo-500 focus:border-transparent"
>
<select v-model="fileTypeFilter" :class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white'
: 'bg-white border-gray-300 text-gray-900'
]" class="border rounded-lg px-4 py-2 focus:ring-2 focus:ring-indigo-500 focus:border-transparent">
<option value="">所有类型</option>
<option value="PDF">PDF</option>
<option value="Image">图片</option>
@@ -318,90 +223,53 @@
<!-- 上传按钮 -->
<div class="flex gap-4">
<button
@click="$refs.fileInput.click()"
class="flex items-center px-4 py-2 rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 transition-colors duration-200"
>
<button @click="$refs.fileInput.click()"
class="flex items-center px-4 py-2 rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 transition-colors duration-200">
<UploadIcon class="w-5 h-5 mr-2" />
上传文件
</button>
<input
ref="fileInput"
type="file"
multiple
class="hidden"
@change="handleFileUpload"
/>
<input ref="fileInput" type="file" multiple class="hidden" @change="handleFileUpload" />
</div>
</div>
<!-- 拖拽上传区域 -->
<div
v-if="showDropZone"
class="mb-6 border-2 border-dashed rounded-lg p-8 text-center"
<div v-if="showDropZone" class="mb-6 border-2 border-dashed rounded-lg p-8 text-center"
:class="[isDarkMode ? 'border-gray-600 bg-gray-800/50' : 'border-gray-300 bg-gray-50']"
@drop.prevent="handleFileDrop"
@dragover.prevent="showDropZone = true"
@dragleave.prevent="showDropZone = false"
>
<UploadCloudIcon
class="mx-auto w-12 h-12 mb-4"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
/>
@drop.prevent="handleFileDrop" @dragover.prevent="showDropZone = true"
@dragleave.prevent="showDropZone = false">
<UploadCloudIcon class="mx-auto w-12 h-12 mb-4" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']" />
<p :class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']">拖拽文件到此处上传</p>
</div>
<!-- File List -->
<div
class="rounded-lg shadow-md overflow-hidden transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']"
>
<div
class="px-6 py-4 border-b"
:class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']"
>
<h3
class="text-lg font-medium"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
<div class="rounded-lg shadow-md overflow-hidden transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']">
<div class="px-6 py-4 border-b" :class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']">
<h3 class="text-lg font-medium" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
所有文件
</h3>
</div>
<div class="overflow-x-auto">
<table
class="min-w-full divide-y"
:class="[isDarkMode ? 'divide-gray-700' : 'divide-gray-200']"
>
<table class="min-w-full divide-y" :class="[isDarkMode ? 'divide-gray-700' : 'divide-gray-200']">
<thead :class="[isDarkMode ? 'bg-gray-900' : 'bg-gray-100']">
<tr>
<th
v-for="header in fileTableHeaders"
:key="header"
<th v-for="header in fileTableHeaders" :key="header"
class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
>
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']">
{{ header }}
</th>
</tr>
</thead>
<tbody
:class="[
isDarkMode
? 'bg-gray-800 divide-y divide-gray-700'
: 'bg-white divide-y divide-gray-200'
]"
>
<tbody :class="[
isDarkMode
? 'bg-gray-800 divide-y divide-gray-700'
: 'bg-white divide-y divide-gray-200'
]">
<tr v-for="file in files" :key="file.id">
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<FileIcon
class="w-5 h-5 mr-2"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-500']"
/>
<span
class="font-medium"
:class="[isDarkMode ? 'text-white' : 'text-gray-900']"
>
<FileIcon class="w-5 h-5 mr-2" :class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-500']" />
<span class="font-medium" :class="[isDarkMode ? 'text-white' : 'text-gray-900']">
{{ file.name }}
</span>
</div>
@@ -422,26 +290,18 @@
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<button
@click="downloadFile(file)"
class="mr-3 transition-colors duration-200"
:class="[
isDarkMode
? 'text-indigo-400 hover:text-indigo-300'
: 'text-indigo-600 hover:text-indigo-900'
]"
>
<button @click="downloadFile(file)" class="mr-3 transition-colors duration-200" :class="[
isDarkMode
? 'text-indigo-400 hover:text-indigo-300'
: 'text-indigo-600 hover:text-indigo-900'
]">
下载
</button>
<button
@click="deleteFile(file)"
class="transition-colors duration-200"
:class="[
isDarkMode
? 'text-red-400 hover:text-red-300'
: 'text-red-600 hover:text-red-900'
]"
>
<button @click="deleteFile(file)" class="transition-colors duration-200" :class="[
isDarkMode
? 'text-red-400 hover:text-red-300'
: 'text-red-600 hover:text-red-900'
]">
删除
</button>
</td>
@@ -452,15 +312,10 @@
</div>
<!-- 在文件列表表格下方添加分页组件 -->
<div
class="mt-4 flex items-center justify-between px-6 py-3 border-t"
:class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']"
>
<div class="mt-4 flex items-center justify-between px-6 py-3 border-t"
:class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']">
<!-- 分页信息 -->
<div
class="flex items-center text-sm"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
>
<div class="flex items-center text-sm" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']">
显示第 {{ (params.page - 1) * params.size + 1 }}
{{ Math.min(params.page * params.size, params.total) }} {{ params.total }}
</div>
@@ -468,11 +323,8 @@
<!-- 分页控制器 -->
<div class="flex items-center space-x-2">
<!-- 上一页 -->
<button
@click="handlePageChange(params.page - 1)"
:disabled="params.page === 1"
class="px-3 py-1 rounded-md transition-colors duration-200"
:class="[
<button @click="handlePageChange(params.page - 1)" :disabled="params.page === 1"
class="px-3 py-1 rounded-md transition-colors duration-200" :class="[
isDarkMode
? params.page === 1
? 'bg-gray-700 text-gray-500 cursor-not-allowed'
@@ -480,44 +332,32 @@
: params.page === 1
? 'bg-gray-100 text-gray-400 cursor-not-allowed'
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
]"
>
]">
上一页
</button>
<!-- 页码 -->
<div class="flex items-center space-x-1">
<template v-for="pageNum in displayedPages" :key="pageNum">
<button
v-if="pageNum !== '...'"
@click="handlePageChange(pageNum)"
class="px-3 py-1 rounded-md transition-colors duration-200"
:class="[
<button v-if="pageNum !== '...'" @click="handlePageChange(pageNum)"
class="px-3 py-1 rounded-md transition-colors duration-200" :class="[
params.page === pageNum
? 'bg-indigo-600 text-white'
: isDarkMode
? 'bg-gray-700 text-gray-300 hover:bg-gray-600'
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
]"
>
]">
{{ pageNum }}
</button>
<span
v-else
class="px-2"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
>
<span v-else class="px-2" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']">
...
</span>
</template>
</div>
<!-- 下一页 -->
<button
@click="handlePageChange(params.page + 1)"
:disabled="params.page >= totalPages"
class="px-3 py-1 rounded-md transition-colors duration-200"
:class="[
<button @click="handlePageChange(params.page + 1)" :disabled="params.page >= totalPages"
class="px-3 py-1 rounded-md transition-colors duration-200" :class="[
isDarkMode
? params.page >= totalPages
? 'bg-gray-700 text-gray-500 cursor-not-allowed'
@@ -525,8 +365,7 @@
: params.page >= totalPages
? 'bg-gray-100 text-gray-400 cursor-not-allowed'
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
]"
>
]">
下一页
</button>
</div>
@@ -534,26 +373,17 @@
</div>
<div v-if="currentSection === 'settings'">
<h2
class="text-2xl font-bold mb-6"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
<h2 class="text-2xl font-bold mb-6" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
系统设置
</h2>
<div
class="rounded-lg shadow-md p-6 transition-colors duration-300"
:class="[
isDarkMode
? 'bg-gray-800 bg-opacity-70 backdrop-filter backdrop-blur-xl border border-gray-700'
: 'bg-white border border-gray-200'
]"
>
<div class="rounded-lg shadow-md p-6 transition-colors duration-300" :class="[
isDarkMode
? 'bg-gray-800 bg-opacity-70 backdrop-filter backdrop-blur-xl border border-gray-700'
: 'bg-white border border-gray-200'
]">
<div class="space-y-6">
<div>
<h3
class="text-lg font-medium mb-2"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
<h3 class="text-lg font-medium mb-2" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
常规设置
</h3>
<div class="space-y-4">
@@ -575,47 +405,32 @@
</div>
<div>
<h3
class="text-lg font-medium mb-2"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
<h3 class="text-lg font-medium mb-2" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
安全设置
</h3>
<div class="space-y-4">
<div class="flex items-center justify-between">
<span :class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
>双因素认证</span
>
<span :class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']">双因素认证</span>
<label class="switch">
<input type="checkbox" v-model="settings.twoFactor" />
<span class="slider round"></span>
</label>
</div>
<div>
<label
for="password"
class="block text-sm font-medium mb-1"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
>
<label for="password" class="block text-sm font-medium mb-1"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']">
更改密码
</label>
<div class="mt-1 relative rounded-md shadow-sm">
<input
type="password"
id="password"
v-model="newPassword"
<input type="password" id="password" v-model="newPassword"
class="block w-full pr-10 sm:text-sm rounded-md focus:ring-indigo-500 focus:border-indigo-500"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400'
: 'border-gray-300 text-gray-900 placeholder-gray-400'
]"
placeholder="新密码"
/>
<button
@click="changePassword"
class="absolute inset-y-0 right-0 px-3 flex items-center bg-indigo-600 text-white rounded-r-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition-colors duration-200"
>
]" placeholder="新密码" />
<button @click="changePassword"
class="absolute inset-y-0 right-0 px-3 flex items-center bg-indigo-600 text-white rounded-r-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition-colors duration-200">
更改
</button>
</div>
@@ -886,11 +701,11 @@ onMounted(() => {
background-color: #4b5563;
}
input:checked + .slider {
input:checked+.slider {
background-color: #4f46e5;
}
.dark input:checked + .slider {
.dark input:checked+.slider {
background-color: #4f46e5;
}
@@ -921,6 +736,7 @@ input:checked + .slider {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}