fix: 修正SQL表名并优化页面样式
修改更新状态的SQL语句,使用正确的表名ycsys和字段名 重构前端页面,添加现代CSS样式和响应式布局,改善用户体验
This commit is contained in:
+63
-10
@@ -3,22 +3,75 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>E3_ycsys</h2>
|
<div class="header">
|
||||||
|
<h2>E3_ycsys</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
<asp:Repeater ID="FeaturesRepeater" runat="server">
|
<asp:Repeater ID="FeaturesRepeater" runat="server">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<div class="feature">
|
<div class="feature-card">
|
||||||
<div class="feature-info">
|
|
||||||
<div class="feature-name"><%# Eval("khdm") %></div>
|
|
||||||
<div class="feature-desc"><%# Eval("khmc") %></div>
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
<%# (int)Eval("status") == 1 ?
|
<div style="font-weight: bold;"><%# Eval("khdm") %></div>
|
||||||
"<a href='?action=disable&id=" + Eval("khdm") + "' class='toggle-btn disable'>close</a><span class='status'>(opened)</span>" :
|
<div style="color: #666;"><%# Eval("khmc") %></div>
|
||||||
"<a href='?action=enable&id=" + Eval("khdm") + "' class='toggle-btn enable'>open</a><span class='status'>(closed)</span>" %>
|
|
||||||
</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>
|
</div>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:Repeater>
|
</asp:Repeater>
|
||||||
|
|||||||
+2
-1
@@ -26,7 +26,8 @@ public partial class E3_ycsys : System.Web.UI.Page
|
|||||||
string id = Request.QueryString["id"];
|
string id = Request.QueryString["id"];
|
||||||
int status = Request.QueryString["action"] == "enable" ? 1 : 0;
|
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);
|
SqlCommand cmd = new SqlCommand(sql, conn);
|
||||||
cmd.Parameters.AddWithValue("@status", status);
|
cmd.Parameters.AddWithValue("@status", status);
|
||||||
cmd.Parameters.AddWithValue("@id", id);
|
cmd.Parameters.AddWithValue("@id", id);
|
||||||
|
|||||||
Reference in New Issue
Block a user