API数据表更新
This commit is contained in:
@@ -8,11 +8,11 @@ public class dataController {
|
||||
|
||||
@GetMapping("/Sys/data/list")
|
||||
public String listPage() {
|
||||
return "forward:/views/data/list.html";
|
||||
return "views/data/list";
|
||||
}
|
||||
|
||||
@GetMapping("/Sys/data/getTableDetail")
|
||||
public String getTableDetail(String taskId) {
|
||||
return "forward:/views/data/detail.html";
|
||||
return "views/data/detail";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,25 @@
|
||||
package com.mini.capi.sys.controller;
|
||||
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
public class LoginPageController {
|
||||
public class loginController {
|
||||
|
||||
@GetMapping("/login")
|
||||
public String loginPage() {
|
||||
return "forward:/index.html";
|
||||
return "index";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退出登录:清空 session 并返回到退出成功页面
|
||||
*/
|
||||
@GetMapping("/userLogout")
|
||||
public String logout(HttpSession session) {
|
||||
session.invalidate();
|
||||
return "index";
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +28,7 @@ public class LoginPageController {
|
||||
*/
|
||||
@GetMapping("/welcome")
|
||||
public String welcomePage() {
|
||||
return "forward:/views/demo.html";
|
||||
return "views/demo";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,9 +36,6 @@ public class LoginPageController {
|
||||
*/
|
||||
@GetMapping("/home")
|
||||
public String homePage() {
|
||||
return "forward:/views/home.html";
|
||||
return "views/home";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mini.capi.sys.controller;
|
||||
package com.mini.capi.sys.dataPageController;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mini.capi.biz.domain.DbConfig;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mini.capi.sys.controller;
|
||||
package com.mini.capi.sys.dataPageController;
|
||||
|
||||
import com.mini.capi.model.ApiResult;
|
||||
import com.mini.capi.model.TabResult;
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/Sys/dbs")
|
||||
public class dbController {
|
||||
public class dbPageController {
|
||||
|
||||
|
||||
@Resource
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mini.capi.sys.controller;
|
||||
package com.mini.capi.sys.dataPageController;
|
||||
|
||||
|
||||
import com.mini.capi.model.ApiResult;
|
||||
@@ -15,7 +15,7 @@ import java.util.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/Sys/hosts")
|
||||
public class hostController {
|
||||
public class hostPageController {
|
||||
|
||||
|
||||
@Resource
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mini.capi.sys.controller;
|
||||
package com.mini.capi.sys.dataPageController;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mini.capi.biz.domain.ApiMenus;
|
||||
@@ -20,7 +20,7 @@ import java.util.Objects;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/Sys/login")
|
||||
public class LoginController {
|
||||
public class loginPageController {
|
||||
|
||||
|
||||
@Resource
|
||||
@@ -1,180 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>数据库表管理</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
primary: '#3B82F6',
|
||||
secondary: '#64748B',
|
||||
accent: '#10B981',
|
||||
neutral: '#F8FAFC',
|
||||
'neutral-dark': '#1E293B',
|
||||
},
|
||||
fontFamily: { inter: ['Inter', 'system-ui', 'sans-serif'] },
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style type="text/tailwindcss">
|
||||
@layer utilities {
|
||||
.content-auto { content-visibility: auto; }
|
||||
.card-hover { transition: all .3s ease; }
|
||||
.card-hover:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-gray-50 font-inter text-neutral-dark">
|
||||
|
||||
<!-- 顶部搜索栏 -->
|
||||
<header class="fixed top-0 inset-x-0 z-30 bg-white shadow-md">
|
||||
<div class="max-w-7xl mx-auto px-[30px] py-3 flex items-center gap-4">
|
||||
<div class="relative flex-shrink-0">
|
||||
<select class="appearance-none bg-gray-50 border border-gray-300 text-gray-700 py-2 px-4 pr-8 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50">
|
||||
<option>MySQL</option><option>PostgreSQL</option><option>Oracle</option><option>MongoDB</option>
|
||||
</select>
|
||||
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"><i class="fa fa-chevron-down text-xs"></i></div>
|
||||
</div>
|
||||
<div class="relative flex-1 min-w-[200px]">
|
||||
<input type="text" placeholder="请输入搜索内容..." class="w-full bg-gray-50 border border-gray-300 text-gray-700 py-2 px-4 pr-10 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50"/>
|
||||
<button class="absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-primary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
<button class="bg-primary hover:bg-primary/90 text-white py-2 px-6 rounded-lg flex-shrink-0">搜索</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 主内容 -->
|
||||
<main class="pt-20 pb-8">
|
||||
<div class="max-w-7xl mx-auto px-[30px]">
|
||||
<!-- 统计卡片:一行内展示 -->
|
||||
<div class="bg-white rounded-xl shadow-md px-4 py-2 flex items-center justify-end space-x-1">
|
||||
<span class="text-gray-500 text-sm">共</span>
|
||||
<span class="text-xl font-bold text-primary" id="totalCount">3</span>
|
||||
<span class="text-gray-500 text-sm">个对象</span>
|
||||
</div>
|
||||
|
||||
<!-- 表列表 -->
|
||||
<div class="space-y-6 mt-6" id="tableList">
|
||||
<!-- 卡片 1 -->
|
||||
<div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
|
||||
<div class="p-6">
|
||||
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="bg-blue-100 p-3 rounded-lg"><i class="fa fa-table text-primary text-xl"></i></div>
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold text-gray-800 cursor-pointer hover:text-primary" onclick="openDetail()">ads_ghgsah_shjahsajs_shahsajs_01</h3>
|
||||
<p class="text-gray-500 text-sm mt-1">表说明: 系统表</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-x-8 gap-y-2 text-sm">
|
||||
<div><p class="text-gray-500">源端数据库</p><p class="font-medium">MySQL</p></div>
|
||||
<div><p class="text-gray-500">更新时间</p><p class="font-medium">2024-09-10 12:32:34</p></div>
|
||||
<div><p class="text-gray-500">访问时间</p><p class="font-medium">2024-09-10 13:22:02</p></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-6 flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
|
||||
<div class="text-gray-600"><span class="font-medium">存储量:</span> 20G</div>
|
||||
<div class="flex gap-3">
|
||||
<button class="bg-blue-50 hover:bg-blue-100 text-primary py-2 px-4 rounded-lg text-sm" onclick="window.location.href='apply-permission.html'">申请权限</button>
|
||||
<button class="bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 px-4 rounded-lg text-sm" onclick="dataSc(this)"><i class="fa fa-star-o mr-1"></i> 收藏</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 详情对话框 -->
|
||||
<div id="detailMask" class="fixed inset-0 bg-black/40 z-40 hidden flex items-center justify-center">
|
||||
<div class="bg-white rounded-xl shadow-2xl w-4/5 h-4/5 max-w-full max-h-full flex flex-col">
|
||||
<div class="flex items-center justify-between px-6 py-4 border-b">
|
||||
<h2 class="text-xl font-semibold text-gray-800">表详情</h2>
|
||||
<button onclick="closeDetail()" class="text-gray-500 hover:text-primary"><i class="fa fa-times text-xl"></i></button>
|
||||
</div>
|
||||
<div class="flex-1 overflow-auto p-6">
|
||||
<iframe id="detailFrame" src="detail.html" class="w-full h-full rounded-md border-0"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
/* ===== 收藏 ===== */
|
||||
function dataSc(btn) {
|
||||
const icon = btn.querySelector('i'), txt = btn.childNodes[2];
|
||||
const isFav = txt.textContent.trim() === '已收藏';
|
||||
if (!isFav) {
|
||||
icon.className = 'fa fa-star mr-1 text-yellow-400';
|
||||
txt.textContent = ' 已收藏';
|
||||
btn.className = 'bg-yellow-50 hover:bg-yellow-100 text-yellow-600 py-2 px-4 rounded-lg text-sm';
|
||||
showToast('收藏成功');
|
||||
} else {
|
||||
icon.className = 'fa fa-star-o mr-1';
|
||||
txt.textContent = ' 收藏';
|
||||
btn.className = 'bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 px-4 rounded-lg text-sm';
|
||||
showToast('已取消收藏');
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== Toast ===== */
|
||||
function showToast(msg) {
|
||||
const t = document.createElement('div');
|
||||
t.className = 'fixed bottom-4 right-4 bg-gray-800 text-white px-4 py-2 rounded-lg shadow-lg translate-y-10 opacity-0 transition-all duration-300 z-50';
|
||||
t.textContent = msg;
|
||||
document.body.appendChild(t);
|
||||
setTimeout(() => t.classList.remove('translate-y-10', 'opacity-0'), 10);
|
||||
setTimeout(() => {
|
||||
t.classList.add('translate-y-10', 'opacity-0');
|
||||
setTimeout(() => t.remove(), 300);
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
/* ===== 对话框 ===== */
|
||||
function openDetail() {
|
||||
const mask = document.getElementById('detailMask');
|
||||
mask.classList.remove('hidden');
|
||||
mask.onclick = e => { if (e.target === mask) closeDetail(); };
|
||||
}
|
||||
function closeDetail() {
|
||||
document.getElementById('detailMask').classList.add('hidden');
|
||||
}
|
||||
|
||||
/* ===== 无限加载 ===== */
|
||||
let loading = false;
|
||||
function loadMore() {
|
||||
if (loading) return;
|
||||
loading = true;
|
||||
setTimeout(() => {
|
||||
const list = document.getElementById('tableList');
|
||||
const card = baklist.children[0].cloneNode(true);
|
||||
// 重置收藏
|
||||
const btn = card.querySelector('button:last-child');
|
||||
btn.innerHTML = '<i class="fa fa-star-o mr-1"></i> 收藏';
|
||||
btn.className = 'bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 px-4 rounded-lg text-sm';
|
||||
btn.onclick = () => dataSc(btn);
|
||||
card.querySelector('h3').onclick = openDetail;
|
||||
baklist.appendChild(card);
|
||||
loading = false;
|
||||
showToast('已加载更多表数据');
|
||||
document.getElementById('totalCount').textContent = baklist.children.length;
|
||||
}, 800);
|
||||
}
|
||||
window.addEventListener('scroll', () => {
|
||||
if (window.innerHeight + window.scrollY >= document.body.offsetHeight - 100) loadMore();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,10 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.2/font/bootstrap-icons.min.css">
|
||||
<link rel="stylesheet" href="./assets/css/login-style.css">
|
||||
<link rel="stylesheet" th:href="@{/assets/css/login-style.css}">
|
||||
<title>cApi登录</title>
|
||||
<script>
|
||||
/* 如果当前窗口不是顶层窗口,就让顶层窗口跳转到登录页 */
|
||||
@@ -72,6 +72,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="./assets/js/login-script.js"></script>
|
||||
<script th:src="@{/assets/js/login-script.js}"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -250,7 +250,7 @@
|
||||
});
|
||||
|
||||
confirmLogout.addEventListener('click', function() {
|
||||
window.location.href = '/logout';
|
||||
window.location.href = 'userLogout';
|
||||
});
|
||||
|
||||
async function loadModules() {
|
||||
Reference in New Issue
Block a user