Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ac082785f4 | |||
| fc640407d9 |
Vendored
+5
@@ -13,7 +13,12 @@ declare module 'vue' {
|
|||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
AddDataDialog: typeof import('./src/components/AddDataDialog.vue')['default']
|
AddDataDialog: typeof import('./src/components/AddDataDialog.vue')['default']
|
||||||
ElButton: typeof import('element-plus/es')['ElButton']
|
ElButton: typeof import('element-plus/es')['ElButton']
|
||||||
|
ElCard: typeof import('element-plus/es')['ElCard']
|
||||||
|
ElCollapse: typeof import('element-plus/es')['ElCollapse']
|
||||||
|
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
|
||||||
|
ElContainer: typeof import('element-plus/es')['ElContainer']
|
||||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||||
|
ElDivider: typeof import('element-plus/es')['ElDivider']
|
||||||
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
||||||
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
||||||
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
|
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
|
||||||
|
|||||||
+1
-64
@@ -3,70 +3,7 @@ const themeMode = ref('light')
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="themeMode" class="app-container">
|
<div :class="themeMode" class="min-h-screen bg-(--bg-page) max-w-full">
|
||||||
<router-view></router-view>
|
<router-view></router-view>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-page: #f5f7fa;
|
|
||||||
--bg-card: #ffffff;
|
|
||||||
--bg-header: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-container {
|
|
||||||
min-height: 100vh;
|
|
||||||
background: var(--bg-page);
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 卡片通用样式 */
|
|
||||||
.content-card {
|
|
||||||
background: var(--bg-card);
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 24px;
|
|
||||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 页面标题样式 */
|
|
||||||
.page-title {
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--el-text-color-primary);
|
|
||||||
margin-bottom: 20px;
|
|
||||||
padding-bottom: 12px;
|
|
||||||
border-bottom: 1px solid var(--el-border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Section 标题 */
|
|
||||||
.section-title {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--el-text-color-primary);
|
|
||||||
margin: 20px 0 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 响应式 */
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.content-card {
|
|
||||||
padding: 16px;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hide-on-mobile {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1 +1,23 @@
|
|||||||
@import "tailwindcss" important;
|
@import "tailwindcss" important;
|
||||||
|
|
||||||
|
@theme {
|
||||||
|
--animate-fade-in: fade-in 0.3s ease;
|
||||||
|
--bg-page: #f5f7fa;
|
||||||
|
--bg-card: #ffffff;
|
||||||
|
--bg-header: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fade-in {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(10px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|||||||
+16
-8
@@ -1,21 +1,29 @@
|
|||||||
import {createApp} from 'vue'
|
import {createApp} from 'vue'
|
||||||
import {createPinia} from 'pinia'
|
import {createPinia} from 'pinia'
|
||||||
import persistedState from 'pinia-plugin-persistedstate';
|
import persistedState from 'pinia-plugin-persistedstate';
|
||||||
|
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import ElementPlus from 'element-plus'
|
import ElementPlus from 'element-plus'
|
||||||
import 'element-plus/dist/index.css'
|
import 'element-plus/dist/index.css'
|
||||||
import './assets/main.css'
|
import './assets/main.css'
|
||||||
|
|
||||||
|
const pinia = createPinia()
|
||||||
|
pinia.use(persistedState)
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
app.use(pinia)
|
||||||
if (import.meta.env.DEV) {
|
|
||||||
document.title = '抖音数据去重 - dev'
|
|
||||||
}
|
|
||||||
|
|
||||||
app.use(createPinia().use(persistedState))
|
|
||||||
app.use(router)
|
app.use(router)
|
||||||
app.use(ElementPlus)
|
app.use(ElementPlus)
|
||||||
|
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|
||||||
|
|
||||||
|
router.beforeEach((to, from) => {
|
||||||
|
var postfix: string = ''
|
||||||
|
if (import.meta.env.DEV) {
|
||||||
|
postfix = '-dev'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to.meta.title) {
|
||||||
|
document.title = to.meta.title + postfix
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -4,17 +4,20 @@ import TokenManageView from '@/views/admin/TokenManageView.vue'
|
|||||||
import TokenDetailView from '@/views/admin/TokenDetailView.vue'
|
import TokenDetailView from '@/views/admin/TokenDetailView.vue'
|
||||||
import AdminView from '@/views/AdminView.vue'
|
import AdminView from '@/views/AdminView.vue'
|
||||||
import HomeView from '@/views/HomeView.vue'
|
import HomeView from '@/views/HomeView.vue'
|
||||||
|
import SettingsView from '@/views/admin/SettingsView.vue'
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
name: "Home",
|
name: "Home",
|
||||||
component: HomeView,
|
component: HomeView,
|
||||||
|
meta: {title: "抖音数据去重",}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/haha',
|
path: '/haha',
|
||||||
name: "Admin",
|
name: "Admin",
|
||||||
component: AdminView,
|
component: AdminView,
|
||||||
|
meta: {title: "抖音数据去重 | 管理后台",},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
@@ -26,6 +29,11 @@ const routes = [
|
|||||||
name: "TokenDetail",
|
name: "TokenDetail",
|
||||||
component: TokenDetailView
|
component: TokenDetailView
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "settings",
|
||||||
|
name: "AdminSettings",
|
||||||
|
component: SettingsView,
|
||||||
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,9 @@ import {ref} from 'vue'
|
|||||||
import {defineStore} from 'pinia'
|
import {defineStore} from 'pinia'
|
||||||
|
|
||||||
export const useCounterStore = defineStore('counter', () => {
|
export const useCounterStore = defineStore('counter', () => {
|
||||||
const homeToken = ref("")
|
|
||||||
|
|
||||||
const token = ref("")
|
const token = ref("")
|
||||||
|
|
||||||
const isAdmin = ref(false)
|
const isAdmin = ref(false)
|
||||||
|
|
||||||
|
|
||||||
return {token, isAdmin}
|
return {token, isAdmin}
|
||||||
}, {
|
}, {
|
||||||
persist: true
|
persist: true
|
||||||
|
|||||||
+105
-115
@@ -1,56 +1,101 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {useCounterStore} from "@/stores/counter.ts"
|
import {useCounterStore} from "@/stores/counter.ts"
|
||||||
import {CloseBold, Document, Edit, User} from '@element-plus/icons-vue'
|
import {CloseBold, Document, Edit, Lock, Setting, User} from '@element-plus/icons-vue'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const store = useCounterStore()
|
const store = useCounterStore()
|
||||||
|
|
||||||
const activeIndex = ref(route.name?.toString() || "TokenManage")
|
const activeIndex = ref(route.name?.toString() || "TokenManage")
|
||||||
|
const _userName = ref("未登录")
|
||||||
|
const _isAdmin = ref(store.isAdmin)
|
||||||
|
const inputPassWord = ref('')
|
||||||
|
|
||||||
|
if (_isAdmin.value) {
|
||||||
|
_userName.value = "管理员"
|
||||||
|
} else {
|
||||||
|
_userName.value = "未登录"
|
||||||
|
}
|
||||||
|
watch(_isAdmin, (newValue) => {
|
||||||
|
store.isAdmin = newValue
|
||||||
|
if (newValue) {
|
||||||
|
_userName.value = "管理员"
|
||||||
|
} else {
|
||||||
|
_userName.value = "未登录"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
watch(route, (newRoute) => {
|
watch(route, (newRoute) => {
|
||||||
activeIndex.value = newRoute.name?.toString() || "TokenManage"
|
activeIndex.value = newRoute.name?.toString() || "TokenManage"
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleSelect = (key: string) => {
|
const handleSelect = (name: string) => {
|
||||||
router.push({name: key})
|
router.push({name: name})
|
||||||
}
|
}
|
||||||
|
|
||||||
const menuItems = [
|
|
||||||
{key: 'TokenManage', label: '管理 Token', icon: Edit},
|
|
||||||
{key: 'TokenDetail', label: 'Token 详情', icon: Document},
|
|
||||||
]
|
|
||||||
|
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
store.isAdmin = false
|
_isAdmin.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkPassword = () => {
|
||||||
|
if (inputPassWord.value === "haha") {
|
||||||
|
ElMessage({message: '登录成功', type: 'success'})
|
||||||
|
_isAdmin.value = true
|
||||||
|
} else {
|
||||||
|
ElMessage.error('密码错误')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const navItemClass = (name: string) => {
|
||||||
|
return activeIndex.value === name
|
||||||
|
? 'bg-[var(--el-color-primary)] text-white'
|
||||||
|
: 'text-[var(--el-text-color-regular)] hover:bg-[var(--bg-page)] hover:text-[var(--el-text-color-primary)]'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="admin-layout">
|
<div class="min-h-screen flex flex-col bg-(--bg-page)">
|
||||||
<el-header class="admin-header">
|
<el-header
|
||||||
<div class="header-left">
|
class="flex items-center justify-between bg-(--bg-header) border-b border-(--el-border-color) sticky top-0 z-50 max-md:flex-wrap max-md:h-auto max-md:px-4 max-md:py-3">
|
||||||
<div class="logo">
|
<div class="flex items-center">
|
||||||
DYPID 管理后台
|
<div class="flex items-center gap-2.5 text-(--el-color-primary) font-semibold text-lg">DYPID 管理后台</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav class="header-nav">
|
<nav class="flex gap-2 max-md:order-3 max-md:w-full max-md:mt-3 max-md:overflow-x-auto max-md:pb-1">
|
||||||
<div v-for="item in menuItems" class="nav-item"
|
<div
|
||||||
:key="item.key"
|
class="flex items-center gap-1.5 px-4 py-2 rounded-lg cursor-pointer text-sm transition-all duration-200 max-md:px-3 max-md:py-2 max-md:text-xs"
|
||||||
:class="{ active: activeIndex === item.key }"
|
:class="navItemClass('TokenManage')"
|
||||||
@click="handleSelect(item.key)"
|
@click="handleSelect('TokenManage')"
|
||||||
>
|
>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<component :is="item.icon"/>
|
<Edit/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span>{{ item.label }}</span>
|
<span>管理 Token</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="flex items-center gap-1.5 px-4 py-2 rounded-lg cursor-pointer text-sm transition-all duration-200 max-md:px-3 max-md:py-2 max-md:text-xs"
|
||||||
|
:class="navItemClass('TokenDetail')"
|
||||||
|
@click="handleSelect('TokenDetail')"
|
||||||
|
>
|
||||||
|
<el-icon>
|
||||||
|
<Document/>
|
||||||
|
</el-icon>
|
||||||
|
<span>Token 详情</span>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="header-right">
|
<div class="flex items-center">
|
||||||
<el-dropdown v-if="store.isAdmin">
|
<el-button v-if="_isAdmin" circle link
|
||||||
<el-button :icon="User">管理员</el-button>
|
@click="handleSelect('AdminSettings')"
|
||||||
|
>
|
||||||
|
<el-icon size="16">
|
||||||
|
<Setting/>
|
||||||
|
</el-icon>
|
||||||
|
</el-button>
|
||||||
|
<el-divider direction="vertical"/>
|
||||||
|
<el-dropdown :disabled="!_isAdmin">
|
||||||
|
<el-button :icon="User" link>{{ _userName }}</el-button>
|
||||||
|
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
@@ -69,98 +114,43 @@ const logout = () => {
|
|||||||
</el-header>
|
</el-header>
|
||||||
|
|
||||||
<el-main>
|
<el-main>
|
||||||
<router-view v-slot="{ Component }">
|
<!-- 登录页面 -->
|
||||||
<transition name="fade" mode="out-in">
|
<div v-if="!_isAdmin" class="flex justify-center items-center min-h-[60vh]">
|
||||||
|
<div
|
||||||
|
class="w-full max-w-100 text-center py-12 px-10 bg-(--bg-card) rounded-2xl shadow-[0_4px_24px_rgba(0,0,0,0.08)]">
|
||||||
|
<div class="mb-6">
|
||||||
|
<el-icon size="48" color="#409eff">
|
||||||
|
<Lock/>
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
<div class="text-2xl font-semibold text-(--el-text-color-primary) mb-2">管理员登录</div>
|
||||||
|
<div class="text-sm text-(--el-text-color-secondary) mb-8">请输入管理员密码访问管理后台</div>
|
||||||
|
|
||||||
|
<el-input
|
||||||
|
v-model="inputPassWord"
|
||||||
|
type="password"
|
||||||
|
placeholder="请输入管理员密码"
|
||||||
|
size="large"
|
||||||
|
show-password
|
||||||
|
class="mb-4"
|
||||||
|
@keyup.enter="checkPassword"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<el-icon>
|
||||||
|
<Lock/>
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
|
||||||
|
<el-button type="primary" size="large" class="w-full mt-2" @click="checkPassword">
|
||||||
|
登录
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<router-view v-else v-slot="{ Component }">
|
||||||
<component :is="Component"/>
|
<component :is="Component"/>
|
||||||
</transition>
|
|
||||||
</router-view>
|
</router-view>
|
||||||
</el-main>
|
</el-main>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.admin-layout {
|
|
||||||
min-height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
background: var(--bg-page);
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
background: var(--bg-header);
|
|
||||||
border-bottom: 1px solid var(--el-border-color);
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-left {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
color: var(--el-color-primary);
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-nav {
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
padding: 8px 16px;
|
|
||||||
border-radius: 8px;
|
|
||||||
cursor: pointer;
|
|
||||||
color: var(--el-text-color-regular);
|
|
||||||
font-size: 14px;
|
|
||||||
transition: all 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item:hover {
|
|
||||||
background: var(--bg-page);
|
|
||||||
color: var(--el-text-color-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item.active {
|
|
||||||
background: var(--el-color-primary);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-right {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.admin-header {
|
|
||||||
flex-wrap: wrap;
|
|
||||||
height: auto;
|
|
||||||
padding: 12px 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-nav {
|
|
||||||
order: 3;
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 12px;
|
|
||||||
overflow-x: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item {
|
|
||||||
padding: 8px 12px;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
+150
-191
@@ -56,220 +56,179 @@ onMounted(() => {
|
|||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
})
|
})
|
||||||
|
|
||||||
const statCards = [
|
|
||||||
{label: '去重对象', key: 'dedup_object', icon: DataAnalysis, color: '#409eff'},
|
|
||||||
{label: '上传数据格式', key: 'data_format', icon: Document, color: '#67c23a'},
|
|
||||||
{label: '去重记录值', key: 'dedup_items_number', icon: Key, color: '#e6a23c'},
|
|
||||||
{label: 'Redis中数据条数', key: 'cache_list_number', icon: Warning, color: '#909399'},
|
|
||||||
]
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="home-page">
|
<div class="p-6 h-dvh">
|
||||||
<div class="content-card" style="max-width: 1600px">
|
<div class="bg-white rounded-lg p-6 shadow-[0_2px_12px_rgba(0,0,0,0.08)] h-full">
|
||||||
<div class="page-header">
|
<div class="text-center mb-4">
|
||||||
<div class="page-title">Token 信息查询</div>
|
<div class="text-xl font-semibold text-(--el-text-color-primary) mb-5 pb-3 border-b border-(--el-border-color)">
|
||||||
<div class="header-subtitle">输入 Token 以查看去重和缓存信息</div>
|
Token 信息查询
|
||||||
|
</div>
|
||||||
|
<div class="text-(--el-text-color-secondary) mt-2">输入 Token 以查看去重和缓存信息</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="search-box">
|
<div class="flex justify-center mb-8">
|
||||||
<el-input placeholder="输入 Token" size="large" clearable class="token-input"
|
<el-input placeholder="请输入要查询数据的Token..." size="large" clearable
|
||||||
v-model="inputToken" @change="inputChange"/>
|
class="max-w-120"
|
||||||
|
v-model="inputToken" @change="inputChange"
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
Token
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
|
||||||
<el-button type="primary" size="large"
|
<el-button type="primary" size="large"
|
||||||
@click="refresh" :loading="loading" :icon="Search">
|
class="ml-3"
|
||||||
|
@click="refresh" :loading="loading" :icon="Search"
|
||||||
|
>
|
||||||
查询
|
查询
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
<el-button type="success" size="large" class=""
|
|
||||||
@click="showAddDataDialog = true" :icon="Plus">
|
|
||||||
增加数据
|
|
||||||
</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<AddDataDialog v-model="showAddDataDialog" :token="inputToken"/>
|
<el-space direction="vertical"
|
||||||
|
class="w-full animate-fade-in"
|
||||||
|
v-if="result"
|
||||||
|
>
|
||||||
|
<el-card class="p-6">
|
||||||
|
<template #header>
|
||||||
|
<el-text>Token 信息</el-text>
|
||||||
|
<el-divider direction="vertical"/>
|
||||||
|
<el-tag type="primary" effect="plain">{{ inputToken }}</el-tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
<div v-if="result" class="result-section">
|
<el-space direction="vertical">
|
||||||
<div class="result-header">
|
<el-space>
|
||||||
<span class="section-title">Token 信息</span>
|
<div
|
||||||
<span class="auto-refresh">每5秒自动刷新</span>
|
class="flex items-center gap-4 p-5 bg-(--bg-page) rounded-xl transition-all duration-200
|
||||||
</div>
|
hover:-translate-y-0.5 hover:shadow-[0_4px_16px_rgba(0,0,0,0.1)]
|
||||||
|
min-w-100"
|
||||||
<div class="stat-cards">
|
>
|
||||||
<div v-for="card in statCards" :key="card.key" class="stat-card">
|
<div
|
||||||
<div class="stat-icon" :style="{ background: card.color + '20', color: card.color }">
|
class="w-14 h-14 rounded-xl flex items-center justify-center shrink-0"
|
||||||
|
style="background: #409eff20; color: #409eff"
|
||||||
|
>
|
||||||
<el-icon size="24">
|
<el-icon size="24">
|
||||||
<component :is="card.icon"/>
|
<DataAnalysis/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-content">
|
<div class="flex-1">
|
||||||
<div class="stat-label">{{ card.label }}</div>
|
<div class="text-xs text-(--el-text-color-secondary) mb-1">
|
||||||
<div class="stat-value">{{ result[card.key] || '-' }}</div>
|
去重对象
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="text-lg font-semibold text-(--el-text-color-primary) overflow-hidden text-ellipsis whitespace-nowrap"
|
||||||
|
>
|
||||||
|
{{ result['dedup_object'] || '-' }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="flex items-center gap-4 p-5 bg-(--bg-page) rounded-xl transition-all duration-200
|
||||||
|
hover:-translate-y-0.5 hover:shadow-[0_4px_16px_rgba(0,0,0,0.1)]
|
||||||
|
min-w-100"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="w-14 h-14 rounded-xl flex items-center justify-center shrink-0"
|
||||||
|
style="background: #67c23a20; color: #67c23a"
|
||||||
|
>
|
||||||
|
<el-icon size="24">
|
||||||
|
<Document/>
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="text-xs text-(--el-text-color-secondary) mb-1">
|
||||||
|
上传数据格式
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="text-lg font-semibold text-(--el-text-color-primary) overflow-hidden text-ellipsis whitespace-nowrap"
|
||||||
|
>
|
||||||
|
{{ result['data_format'] || '-' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-space>
|
||||||
|
<el-space>
|
||||||
|
<div
|
||||||
|
class="flex items-center gap-4 p-5 bg-(--bg-page) rounded-xl transition-all duration-200
|
||||||
|
hover:-translate-y-0.5 hover:shadow-[0_4px_16px_rgba(0,0,0,0.1)]
|
||||||
|
min-w-100"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="w-14 h-14 rounded-xl flex items-center justify-center shrink-0"
|
||||||
|
style="background: #e6a23c20; color: #e6a23c"
|
||||||
|
>
|
||||||
|
<el-icon size="24">
|
||||||
|
<Key/>
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="text-xs text-(--el-text-color-secondary) mb-1">
|
||||||
|
去重记录值
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="text-lg font-semibold text-(--el-text-color-primary) overflow-hidden text-ellipsis whitespace-nowrap"
|
||||||
|
>
|
||||||
|
{{ result['dedup_items_number'] || '-' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="flex items-center gap-4 p-5 bg-(--bg-page) rounded-xl transition-all duration-200
|
||||||
|
hover:-translate-y-0.5 hover:shadow-[0_4px_16px_rgba(0,0,0,0.1)]
|
||||||
|
min-w-100"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="w-14 h-14 rounded-xl flex items-center justify-center shrink-0"
|
||||||
|
style="background: #90939920; color: #909399"
|
||||||
|
>
|
||||||
|
<el-icon size="24">
|
||||||
|
<Warning/>
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
<div class="flex-1">
|
||||||
|
<div class="text-xs text-(--el-text-color-secondary) mb-1">
|
||||||
|
Redis中数据条数
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="text-lg font-semibold text-(--el-text-color-primary) overflow-hidden text-ellipsis whitespace-nowrap"
|
||||||
|
>
|
||||||
|
{{ result['cache_list_number'] || '-' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-space>
|
||||||
|
</el-space>
|
||||||
|
|
||||||
<div v-if="lastUpdate" class="update-time">
|
<el-text v-if="lastUpdate" type="info"
|
||||||
最后更新: {{ lastUpdate }}
|
class="block w-full mt-5 text-center"
|
||||||
</div>
|
>
|
||||||
</div>
|
每5秒更新一次数据 最后更新: {{ lastUpdate }}
|
||||||
|
</el-text>
|
||||||
|
|
||||||
<div v-else class="empty-state">
|
<template #footer>
|
||||||
|
<el-text>操作</el-text>
|
||||||
|
<el-divider direction="vertical"/>
|
||||||
|
<el-button type="primary" size=""
|
||||||
|
class=""
|
||||||
|
@click="showAddDataDialog = true" :icon="Plus"
|
||||||
|
>
|
||||||
|
添加数据
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-card>
|
||||||
|
</el-space>
|
||||||
|
|
||||||
|
<el-space v-else direction="vertical"
|
||||||
|
class="flex p-16"
|
||||||
|
>
|
||||||
<el-icon size="64" color="#dcdfe6">
|
<el-icon size="64" color="#dcdfe6">
|
||||||
<Search/>
|
<Search/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<div class="empty-text">请输入 Token 进行查询</div>
|
<el-text type="info" size="large" class="">请输入 Token 进行查询</el-text>
|
||||||
</div>
|
</el-space>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<AddDataDialog v-model="showAddDataDialog" :token="inputToken"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.home-page {
|
|
||||||
padding: 24px 48px;
|
|
||||||
max-width: 100%;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-header {
|
|
||||||
text-align: center;
|
|
||||||
margin-bottom: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-subtitle {
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-box {
|
|
||||||
display: flex;
|
|
||||||
gap: 12px;
|
|
||||||
margin-bottom: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.token-input {
|
|
||||||
max-width: 400px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.result-section {
|
|
||||||
animation: fadeIn 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes fadeIn {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(10px);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.result-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.auto-refresh {
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-cards {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(4, 1fr);
|
|
||||||
gap: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-card {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 16px;
|
|
||||||
padding: 20px;
|
|
||||||
background: var(--bg-page);
|
|
||||||
border-radius: 12px;
|
|
||||||
transition: transform 0.2s, box-shadow 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-card:hover {
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-icon {
|
|
||||||
width: 56px;
|
|
||||||
height: 56px;
|
|
||||||
border-radius: 12px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-content {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-label {
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-value {
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--el-text-color-primary);
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.update-time {
|
|
||||||
text-align: center;
|
|
||||||
margin-top: 20px;
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-state {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
padding: 64px;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-text {
|
|
||||||
margin-top: 16px;
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 1200px) {
|
|
||||||
.stat-cards {
|
|
||||||
grid-template-columns: repeat(2, 1fr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.home-page {
|
|
||||||
padding: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-box {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.token-input {
|
|
||||||
max-width: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-cards {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
TODO
|
||||||
|
</template>
|
||||||
@@ -143,19 +143,8 @@ const statCards = [
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="token-detail">
|
<div class="token-detail">
|
||||||
<!-- 检查权限 -->
|
|
||||||
<div v-if="!store.isAdmin" class="no-permission">
|
|
||||||
<div class="no-permission-card">
|
|
||||||
<el-icon size="64" color="#f56c6c">
|
|
||||||
<InfoFilled/>
|
|
||||||
</el-icon>
|
|
||||||
<div class="no-permission-title">无权限访问</div>
|
|
||||||
<div class="no-permission-text">您没有权限访问此页面</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 管理页面 -->
|
<!-- 管理页面 -->
|
||||||
<div v-else class="detail-page">
|
<div class="detail-page">
|
||||||
<div class="content-card">
|
<div class="content-card">
|
||||||
<div class="page-title">Token 详情</div>
|
<div class="page-title">Token 详情</div>
|
||||||
|
|
||||||
@@ -321,30 +310,6 @@ const statCards = [
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 无权限 */
|
|
||||||
.no-permission {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 60vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-permission-card {
|
|
||||||
text-align: center;
|
|
||||||
padding: 48px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-permission-title {
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: 600;
|
|
||||||
margin-top: 24px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-permission-text {
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Token 选择 */
|
/* Token 选择 */
|
||||||
.token-select {
|
.token-select {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import api from "@/api"
|
import api from "@/api"
|
||||||
import {useCounterStore} from "@/stores/counter.ts"
|
import {useCounterStore} from "@/stores/counter.ts"
|
||||||
import {Delete, Edit, Key, Lock, Memo, Plus, View} from '@element-plus/icons-vue'
|
import {Delete, Edit, Key, Memo, Plus, View} from '@element-plus/icons-vue'
|
||||||
|
|
||||||
const store = useCounterStore()
|
const store = useCounterStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -12,8 +12,7 @@ const input = ref('')
|
|||||||
const value = ref('')
|
const value = ref('')
|
||||||
const dataFormat = ref('')
|
const dataFormat = ref('')
|
||||||
const inputNotes = ref('')
|
const inputNotes = ref('')
|
||||||
const inputPassWord = ref('')
|
const activeNames = ref(['1'])
|
||||||
const passwordVisible = ref(true)
|
|
||||||
|
|
||||||
const rowOut = ref<any>(null)
|
const rowOut = ref<any>(null)
|
||||||
const addDataDialogVisible = ref(false)
|
const addDataDialogVisible = ref(false)
|
||||||
@@ -46,24 +45,11 @@ const fetchTokens = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!store.isAdmin) {
|
if (store.isAdmin) {
|
||||||
passwordVisible.value = true
|
|
||||||
} else {
|
|
||||||
fetchTokens()
|
fetchTokens()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const checkPassword = () => {
|
|
||||||
if (inputPassWord.value === "haha") {
|
|
||||||
ElMessage({message: '登录成功', type: 'success'})
|
|
||||||
store.isAdmin = true
|
|
||||||
passwordVisible.value = false
|
|
||||||
fetchTokens()
|
|
||||||
} else {
|
|
||||||
ElMessage.error('密码错误')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const addToken = async () => {
|
const addToken = async () => {
|
||||||
if (!input.value || !value.value || !dataFormat.value) {
|
if (!input.value || !value.value || !dataFormat.value) {
|
||||||
ElMessage.warning('请填写完整信息')
|
ElMessage.warning('请填写完整信息')
|
||||||
@@ -176,46 +162,14 @@ const deleteToken = async (row: any) => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="token-manage">
|
<div class="token-manage">
|
||||||
<!-- 登录页面 -->
|
|
||||||
<div v-if="!store.isAdmin" class="login-page">
|
|
||||||
<div class="login-card">
|
|
||||||
<div class="login-icon">
|
|
||||||
<el-icon size="48" color="#409eff">
|
|
||||||
<Lock/>
|
|
||||||
</el-icon>
|
|
||||||
</div>
|
|
||||||
<div class="login-title">管理员登录</div>
|
|
||||||
<div class="login-subtitle">请输入管理员密码访问管理后台</div>
|
|
||||||
|
|
||||||
<el-input
|
|
||||||
v-model="inputPassWord"
|
|
||||||
type="password"
|
|
||||||
placeholder="请输入管理员密码"
|
|
||||||
size="large"
|
|
||||||
show-password
|
|
||||||
@keyup.enter="checkPassword"
|
|
||||||
>
|
|
||||||
<template #prefix>
|
|
||||||
<el-icon>
|
|
||||||
<Lock/>
|
|
||||||
</el-icon>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
|
|
||||||
<el-button type="primary" size="large" class="login-btn" @click="checkPassword">
|
|
||||||
登录
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 管理页面 -->
|
<!-- 管理页面 -->
|
||||||
<div v-else class="manage-page">
|
<div class="manage-page">
|
||||||
<div class="content-card">
|
<div class="content-card">
|
||||||
<div class="page-title">Token 管理</div>
|
<div class="page-title">Token 管理</div>
|
||||||
|
|
||||||
<!-- 添加表单 -->
|
<!-- 添加表单 -->
|
||||||
<div class="add-form">
|
<el-collapse class="add-form" v-model="activeNames">
|
||||||
<div class="form-title">添加新 Token</div>
|
<el-collapse-item title="添加新 Token" name="1">
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<el-input v-model="input" placeholder="Token 名称" clearable>
|
<el-input v-model="input" placeholder="Token 名称" clearable>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
@@ -230,7 +184,8 @@ const deleteToken = async (row: any) => {
|
|||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
<el-select v-model="dataFormat" placeholder="数据格式" clearable>
|
<el-select v-model="dataFormat" placeholder="数据格式" clearable>
|
||||||
<el-option v-for="item in dataFormatOptions" :key="item.value" :value="item.value" :label="item.label"/>
|
<el-option v-for="item in dataFormatOptions" :key="item.value" :value="item.value"
|
||||||
|
:label="item.label"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
<el-input v-model="inputNotes" placeholder="备注(可选)" clearable>
|
<el-input v-model="inputNotes" placeholder="备注(可选)" clearable>
|
||||||
@@ -248,7 +203,8 @@ const deleteToken = async (row: any) => {
|
|||||||
添加
|
添加
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</el-collapse-item>
|
||||||
|
</el-collapse>
|
||||||
|
|
||||||
<!-- Token 列表 -->
|
<!-- Token 列表 -->
|
||||||
<div class="table-section">
|
<div class="table-section">
|
||||||
@@ -387,50 +343,6 @@ const deleteToken = async (row: any) => {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 登录页面 */
|
|
||||||
.login-page {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 60vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-card {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 400px;
|
|
||||||
text-align: center;
|
|
||||||
padding: 48px 40px;
|
|
||||||
background: var(--bg-card);
|
|
||||||
border-radius: 16px;
|
|
||||||
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-icon {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-title {
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--el-text-color-primary);
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-subtitle {
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
margin-bottom: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-card :deep(.el-input) {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-btn {
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 管理页面 */
|
/* 管理页面 */
|
||||||
.add-form {
|
.add-form {
|
||||||
margin-bottom: 32px;
|
margin-bottom: 32px;
|
||||||
|
|||||||
Reference in New Issue
Block a user