fix: 修正SQL表名并优化页面样式

修改更新状态的SQL语句,使用正确的表名ycsys和字段名
重构前端页面,添加现代CSS样式和响应式布局,改善用户体验
This commit is contained in:
2025-06-16 15:08:48 +08:00
parent c335dc8a80
commit 4ff24710d2
2 changed files with 65 additions and 11 deletions
+63 -10
View File
@@ -3,22 +3,75 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>E3_ycsys</title>
<style>
body {
font-family: 'Microsoft YaHei', sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 20px;
}
.header {
background-color: #1890ff;
color: white;
padding: 15px;
border-radius: 4px;
margin-bottom: 20px;
}
.feature-card {
background: white;
border-radius: 4px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
display: flex;
justify-content: space-between;
align-items: center;
}
.toggle-btn {
padding: 6px 18px;
border-radius: 4px;
cursor: pointer;
border: none;
color: white;
}
.enable { background-color: #52c41a; }
.disable { background-color: #f5222d; }
/* 这里可能不需要额外的 <style> 标签,因为上方已经有一个 <style> 标签开始了样式定义,故移除多余的 <style> 标签 */
body {
font-size: 16px; /* 基础字体大小 */
}
.header h2 {
font-size: 24px; /* 标题字体大小 */
}
.feature-card {
font-size: 30px; /* 卡片内容字体大小 */
}
.feature-name {
font-size: 25px; /* 客户名称字体大小 */
font-weight: bold;
}
.toggle-btn {
font-size: 30px; /* 按钮字体大小 */
}
</style>
</head>
<body>
<h2>E3_ycsys</h2>
<div class="header">
<h2>E3_ycsys</h2>
</div>
<asp:Repeater ID="FeaturesRepeater" runat="server">
<ItemTemplate>
<div class="feature">
<div class="feature-info">
<div class="feature-name"><%# Eval("khdm") %></div>
<div class="feature-desc"><%# Eval("khmc") %></div>
</div>
<div class="feature-card">
<div>
<%# (int)Eval("status") == 1 ?
"<a href='?action=disable&id=" + Eval("khdm") + "' class='toggle-btn disable'>close</a><span class='status'>(opened)</span>" :
"<a href='?action=enable&id=" + Eval("khdm") + "' class='toggle-btn enable'>open</a><span class='status'>(closed)</span>" %>
<div style="font-weight: bold;"><%# Eval("khdm") %></div>
<div style="color: #666;"><%# Eval("khmc") %></div>
</div>
<%# (int)Eval("status") == 1 ?
"<a href='E3_ycsys.aspx?action=disable&id=" + Eval("khdm") + "' class='toggle-btn disable'>close</a>" :
"<a href='E3_ycsys.aspx?action=enable&id=" + Eval("khdm") + "' class='toggle-btn enable'>open</a>" %>
</div>
</ItemTemplate>
</asp:Repeater>
+2 -1
View File
@@ -26,7 +26,8 @@ public partial class E3_ycsys : System.Web.UI.Page
string id = Request.QueryString["id"];
int status = Request.QueryString["action"] == "enable" ? 1 : 0;
string sql = "UPDATE features SET status = @status WHERE id = @id";
// 修改更新状态的SQL语句,确保表名一致
string sql = "UPDATE ycsys SET flag1 = @status WHERE dm = @id";
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.Parameters.AddWithValue("@status", status);
cmd.Parameters.AddWithValue("@id", id);