This commit is contained in:
oneao committed 2026-04-15 17:28:13 +08:00
1 parent 2215d4cd1a
commit c0862702e8
62 files changed
+1465 -3968

No files matched your search

+151 -72
View File
@@ -1,86 +1,165 @@
<!DOCTYPE html>
<html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>EasyUI Grid Demo</title>
<!-- 引入 jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- 引入 EasyUI 样式和 JS -->
<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/icon.css">
<script type="text/javascript" src="https://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>个人中心</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto;
}
.datagrid-cell-btn {
text-align: center;
body {
background: #f5f6f8;
}
.container {
max-width: 420px;
margin: 0 auto;
}
/* ===== Header ===== */
.header {
height: 180px;
padding: 20px;
background: linear-gradient(135deg, #4f8cff, #6ed0ff);
color: #fff;
position: relative;
}
.user {
display: flex;
align-items: center;
margin-top: 40px;
}
.avatar {
width: 64px;
height: 64px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.3);
}
.info {
margin-left: 14px;
}
.name {
font-size: 18px;
font-weight: 600;
}
.desc {
font-size: 13px;
opacity: 0.9;
margin-top: 4px;
}
/* ===== Card ===== */
.card {
background: #fff;
margin: -40px 16px 16px;
border-radius: 16px;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
overflow: hidden;
}
.section {
margin: 16px;
background: #fff;
border-radius: 16px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
overflow: hidden;
}
/* ===== Item ===== */
.item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px;
font-size: 15px;
border-bottom: 1px solid #f0f0f0;
}
.item:last-child {
border-bottom: none;
}
.item span {
color: #333;
}
.arrow {
color: #bbb;
}
/* Danger */
.danger {
color: #ff4d4f;
}
</style>
</head>
<body>
<div class="container">
<h2>EasyUI Grid 简单示例</h2>
```
<!-- Header -->
<div class="header">
<div class="user">
<div class="avatar"></div>
<div class="info">
<div class="name">张三</div>
<div class="desc">让工具更高效 ⚡</div>
</div>
</div>
</div>
<table id="dg" title="用户列表" class="easyui-datagrid" style="width:700px;height:300px"
data-options="
singleSelect: true,
fitColumns: true,
toolbar: '#toolbar',
rownumbers: true
">
<thead>
<tr>
<th data-options="field:'id',width:50">ID</th>
<th data-options="field:'name',width:100">姓名</th>
<th data-options="field:'age',width:50,align:'right'">年龄</th>
<th data-options="field:'email',width:150">邮箱</th>
<th data-options="field:'action',width:100,align:'center',
formatter: function(value,row,index){
return '<a href=\"javascript:void(0)\" onclick=\"editUser('+index+')\">编辑</a> | ' +
'<a href=\"javascript:void(0)\" onclick=\"deleteUser('+index+')\">删除</a>';
}">操作</th>
</tr>
</thead>
</table>
<!-- 功能区 -->
<div class="card">
<div class="item">
<span>我的工具</span>
<span class="arrow">›</span>
</div>
<div class="item">
<span>数据管理</span>
<span class="arrow">›</span>
</div>
<div class="item">
<span>云同步</span>
<span class="arrow">›</span>
</div>
</div>
<div id="toolbar">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" onclick="addUser()">添加用户</a>
</div>
<script>
// 模拟数据
var users = [
{id:1, name:'张三', age:18, email:'zhangsan@example.com'},
{id:2, name:'李四', age:22, email:'lisi@example.com'},
{id:3, name:'王五', age:30, email:'wangwu@example.com'},
{id:4, name:'赵六', age:25, email:'zhaoliu@example.com'}
];
$(function(){
$('#dg').datagrid({
data: users
});
});
function addUser() {
alert('这里可以弹出添加用户的表单');
}
function editUser(index) {
var row = $('#dg').datagrid('getRows')[index];
alert('编辑用户:' + row.name);
}
function deleteUser(index) {
var row = $('#dg').datagrid('getRows')[index];
if (confirm('确定删除用户:' + row.name + '吗?')) {
users.splice(index, 1);
$('#dg').datagrid('loadData', users);
}
}
</script>
<!-- 设置区 -->
<div class="section">
<div class="item">
<span>深色模式</span>
<span class="arrow">›</span>
</div>
<div class="item">
<span>通知设置</span>
<span class="arrow">›</span>
</div>
<div class="item">
<span>关于应用</span>
<span class="arrow">›</span>
</div>
<div class="item">
<span class="danger">退出登录</span>
</div>
</div>
```
</div>
</body>
</html>