世界书部分基本完成,剩余编辑条目部分,可以推进到下一步

This commit is contained in:
2026-04-07 05:40:27 +08:00
parent 4f9cf4b725
commit dd17206e1f
6 changed files with 1815 additions and 889 deletions

View File

@@ -1,5 +1,28 @@
import { create } from 'zustand';
// LocalStorage 键名
const GLOBAL_WORLDBOOKS_KEY = 'global_worldbooks';
// 辅助函数:从 LocalStorage 加载全局世界书
const loadGlobalWorldBooks = () => {
try {
const stored = localStorage.getItem(GLOBAL_WORLDBOOKS_KEY);
return stored ? JSON.parse(stored) : [];
} catch (error) {
console.error('加载全局世界书失败:', error);
return [];
}
};
// 辅助函数:保存全局世界书到 LocalStorage
const saveGlobalWorldBooks = (globalBooks) => {
try {
localStorage.setItem(GLOBAL_WORLDBOOKS_KEY, JSON.stringify(globalBooks));
} catch (error) {
console.error('保存全局世界书失败:', error);
}
};
// 辅助函数:处理 API 响应
const handleResponse = async (response) => {
if (!response.ok) {
@@ -26,7 +49,7 @@ const handleFileDownload = async (response, filename) => {
const useWorldBookStore = create((set, get) => ({
// 状态
worldBooks: [], // 世界书列表
globalWorldBooks: [], // 全局世界书列表
globalWorldBooks: loadGlobalWorldBooks(), // 从 LocalStorage 初始化全局世界书列表
currentWorldBook: null, // 当前选中的世界书
currentEntries: [], // 当前世界书的条目列表
currentEntry: null, // 当前选中的条目
@@ -58,14 +81,7 @@ const useWorldBookStore = create((set, get) => ({
toggleGlobalWorldBook: async (name, isGlobal) => {
set({ loading: true, error: null, success: false });
try {
// 先获取当前世界书的信息
const currentBook = get().worldBooks.find(wb => wb.name === name);
if (!currentBook) {
throw new Error(`世界书 "${name}" 不存在`);
}
const formData = new FormData();
formData.append('description', currentBook.description);
formData.append('is_global', isGlobal);
const response = await fetch(`/api/worldbooks/${name}`, {
@@ -100,6 +116,9 @@ const useWorldBookStore = create((set, get) => ({
}
}
// 保存到 LocalStorage
saveGlobalWorldBooks(updatedGlobalBooks);
return {
loading: false,
worldBooks: updatedWorldBooks,
@@ -108,7 +127,6 @@ const useWorldBookStore = create((set, get) => ({
? data
: state.currentWorldBook,
success: true,
message: isGlobal ? `已将 "${name}" 设置为全局世界书` : `已取消 "${name}" 的全局世界书状态`
};
});
@@ -130,8 +148,8 @@ const useWorldBookStore = create((set, get) => ({
const response = await fetch(`/api/worldbooks/`);
const data = await handleResponse(response);
// 筛选出全局世界书
const globalBooks = data.filter(book => book.is_global);
// 从 LocalStorage 获取全局世界书列表
const globalBooks = loadGlobalWorldBooks();
set({
loading: false,
@@ -171,12 +189,11 @@ const useWorldBookStore = create((set, get) => ({
},
// 异步操作:创建世界书
createWorldBook: async ({ name, description, is_global, file }) => {
createWorldBook: async ({ name, is_global, file }) => {
set({ loading: true, error: null, success: false });
try {
const formData = new FormData();
formData.append('name', name);
formData.append('description', description || '');
if (is_global !== undefined) {
formData.append('is_global', is_global);
}
@@ -193,9 +210,13 @@ const useWorldBookStore = create((set, get) => ({
set(state => {
const newWorldBooks = [...state.worldBooks, data];
const newGlobalBooks = data.is_global
? [...state.globalWorldBooks, data]
: state.globalWorldBooks;
let newGlobalBooks = [...state.globalWorldBooks];
// 如果是世界书被标记为全局,添加到全局列表
if (data.is_global) {
newGlobalBooks = [...newGlobalBooks, data];
saveGlobalWorldBooks(newGlobalBooks);
}
return {
loading: false,
@@ -219,13 +240,10 @@ const useWorldBookStore = create((set, get) => ({
},
// 异步操作:更新世界书
updateWorldBook: async ({ name, description, is_global, file }) => {
updateWorldBook: async ({ name, is_global, file }) => {
set({ loading: true, error: null, success: false });
try {
const formData = new FormData();
if (description !== undefined) {
formData.append('description', description);
}
if (is_global !== undefined) {
formData.append('is_global', is_global);
}
@@ -265,6 +283,9 @@ const useWorldBookStore = create((set, get) => ({
}
}
// 保存到 LocalStorage
saveGlobalWorldBooks(updatedGlobalBooks);
return {
loading: false,
worldBooks: updatedWorldBooks,
@@ -302,6 +323,9 @@ const useWorldBookStore = create((set, get) => ({
const filteredWorldBooks = state.worldBooks.filter(wb => wb.name !== name);
const filteredGlobalBooks = state.globalWorldBooks.filter(wb => wb.name !== name);
// 保存到 LocalStorage
saveGlobalWorldBooks(filteredGlobalBooks);
return {
loading: false,
worldBooks: filteredWorldBooks,
@@ -387,144 +411,142 @@ const useWorldBookStore = create((set, get) => ({
}
},
// 异步操作:创建世界书条目
createWorldBookEntry: async (name, entryData) => {
set({ loading: true, error: null, success: false });
try {
// 处理触发配置数据
const processedEntryData = { ...entryData };
if (processedEntryData.trigger_config && processedEntryData.trigger_config.triggers) {
// 创建新的触发配置对象
const triggerConfig = {
triggers: {}
};
// 异步操作:创建世界书条目
createWorldBookEntry: async (name, entryData) => {
set({ loading: true, error: null, success: false });
try {
// 处理触发配置数据
const processedEntryData = { ...entryData };
if (processedEntryData.trigger_config && processedEntryData.trigger_config.triggers) {
// 创建新的触发配置对象
const triggerConfig = {
triggers: {}
};
// 处理每个触发策略
for (const [strategy, triggerInfo] of Object.entries(processedEntryData.trigger_config.triggers)) {
if (Array.isArray(triggerInfo) && triggerInfo.length >= 2) {
triggerConfig.triggers[strategy] = [
triggerInfo[0], // 是否启用
triggerInfo[1] // 配置对象
];
} else {
// 如果格式不正确,设置为不启用
triggerConfig.triggers[strategy] = [false, null];
}
// 处理每个触发策略
for (const [strategy, triggerInfo] of Object.entries(processedEntryData.trigger_config.triggers)) {
if (Array.isArray(triggerInfo) && triggerInfo.length >= 2) {
triggerConfig.triggers[strategy] = [
triggerInfo[0], // 是否启用
triggerInfo[1] // 配置对象
];
} else {
// 如果格式不正确,设置为不启用
triggerConfig.triggers[strategy] = [false, null];
}
processedEntryData.trigger_config = triggerConfig;
}
const response = await fetch(`/api/worldbooks/${name}/entries`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(processedEntryData)
});
processedEntryData.trigger_config = triggerConfig;
}
const data = await handleResponse(response);
const response = await fetch(`/api/worldbooks/${name}/entries`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(processedEntryData)
});
set(state => {
if (state.currentWorldBook?.name === name) {
return {
loading: false,
currentEntries: [...state.currentEntries, data],
success: true,
message: '条目创建成功'
};
}
const data = await handleResponse(response);
set(state => {
if (state.currentWorldBook?.name === name) {
return {
loading: false,
currentEntries: [...state.currentEntries, data],
success: true,
message: '条目创建成功'
};
});
return data;
} catch (error) {
set({
}
return {
loading: false,
error: error.message,
success: false
});
throw error;
}
},
success: true,
message: '条目创建成功'
};
});
return data;
} catch (error) {
set({
loading: false,
error: error.message,
success: false
});
throw error;
}
},
// 异步操作:更新世界书条目
updateWorldBookEntry: async (name, uid, entryData) => {
set({ loading: true, error: null, success: false });
try {
// 处理触发配置数据
const processedEntryData = { ...entryData };
if (processedEntryData.trigger_config && processedEntryData.trigger_config.triggers) {
// 创建新的触发配置对象
const triggerConfig = {
triggers: {}
};
// 异步操作:更新世界书条目
updateWorldBookEntry: async (name, uid, entryData) => {
set({ loading: true, error: null, success: false });
try {
// 处理触发配置数据
const processedEntryData = { ...entryData };
if (processedEntryData.trigger_config && processedEntryData.trigger_config.triggers) {
// 创建新的触发配置对象
const triggerConfig = {
triggers: {}
};
// 处理每个触发策略
for (const [strategy, triggerInfo] of Object.entries(processedEntryData.trigger_config.triggers)) {
if (Array.isArray(triggerInfo) && triggerInfo.length >= 2) {
triggerConfig.triggers[strategy] = [
triggerInfo[0], // 是否启用
triggerInfo[1] // 配置对象
];
} else {
// 如果格式不正确,设置为不启用
triggerConfig.triggers[strategy] = [false, null];
}
// 处理每个触发策略
for (const [strategy, triggerInfo] of Object.entries(processedEntryData.trigger_config.triggers)) {
if (Array.isArray(triggerInfo) && triggerInfo.length >= 2) {
triggerConfig.triggers[strategy] = [
triggerInfo[0], // 是否启用
triggerInfo[1] // 配置对象
];
} else {
// 如果格式不正确,设置为不启用
triggerConfig.triggers[strategy] = [false, null];
}
processedEntryData.trigger_config = triggerConfig;
}
const response = await fetch(`/api/worldbooks/${name}/entries/${uid}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(processedEntryData)
});
processedEntryData.trigger_config = triggerConfig;
}
const data = await handleResponse(response);
const response = await fetch(`/api/worldbooks/${name}/entries/${uid}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(processedEntryData)
});
set(state => {
if (state.currentWorldBook?.name === name) {
const updatedEntries = state.currentEntries.map(entry =>
entry.uid === data.uid ? data : entry
);
const data = await handleResponse(response);
set(state => {
if (state.currentWorldBook?.name === name) {
const updatedEntries = state.currentEntries.map(entry =>
entry.uid === data.uid ? data : entry
);
return {
loading: false,
currentEntries: updatedEntries,
currentEntry: state.currentEntry?.uid === data.uid
? data
: state.currentEntry,
success: true,
message: '条目更新成功'
};
}
return {
loading: false,
currentEntries: updatedEntries,
currentEntry: state.currentEntry?.uid === data.uid
? data
: state.currentEntry,
success: true,
message: '条目更新成功'
};
});
return data;
} catch (error) {
set({
}
return {
loading: false,
error: error.message,
success: false
});
throw error;
}
},
success: true,
message: '条目更新成功'
};
});
return data;
} catch (error) {
set({
loading: false,
error: error.message,
success: false
});
throw error;
}
},
// 异步操作:删除世界书条目
deleteWorldBookEntry: async (name, uid) => {
@@ -613,6 +635,9 @@ const useWorldBookStore = create((set, get) => ({
}
}
// 保存到 LocalStorage
saveGlobalWorldBooks(updatedGlobalBooks);
return {
loading: false,
worldBooks: updatedWorldBooks,
@@ -668,4 +693,4 @@ const useWorldBookStore = create((set, get) => ({
},
}));
export default useWorldBookStore;
export default useWorldBookStore;

File diff suppressed because it is too large Load Diff

View File

@@ -2,52 +2,56 @@
display: flex;
flex-direction: column;
height: 100%;
padding: 12px;
gap: 12px;
overflow: hidden;
padding: 8px;
gap: 8px;
background: #f8f9fa;
overflow-y: auto;
}
/* 全局世界书区域 */
.global-worldbooks-section {
display: flex;
flex-direction: column;
gap: 8px;
gap: 6px;
}
.global-worldbooks-slot {
background: white;
border-radius: 6px;
border: 1px solid #e0e0e0;
border-radius: 4px;
border: 1px solid #e9ecef;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
overflow: hidden;
}
.global-books-header {
display: flex;
flex-direction: column;
gap: 4px;
padding: 8px 12px;
gap: 3px;
padding: 8px 10px;
background: #f8f9fa;
border-bottom: 1px solid #e9ecef;
}
.title-text {
font-size: 11px;
color: #777;
font-weight: 500;
font-weight: 600;
color: #2c3e50;
}
.active-books-list {
display: flex;
flex-wrap: wrap;
gap: 4px;
gap: 3px;
}
.active-book-item {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 12px;
gap: 3px;
font-size: 11px;
color: #4a6cf7;
font-weight: 500;
padding: 2px 6px;
padding: 3px 6px;
background: rgba(74, 108, 247, 0.1);
border-radius: 3px;
cursor: pointer;
@@ -56,6 +60,8 @@
.active-book-item:hover {
background: rgba(74, 108, 247, 0.2);
transform: translateY(-1px);
box-shadow: 0 1px 2px rgba(74, 108, 247, 0.15);
}
.active-book-item .remove-btn {
@@ -72,34 +78,40 @@
/* 操作按钮组 */
.worldbook-actions {
display: flex;
gap: 6px;
gap: 4px;
flex-wrap: wrap;
}
.action-btn {
padding: 5px 10px;
padding: 4px 8px;
background: white;
border: 1px solid #e0e0e0;
border-radius: 4px;
color: #555;
border: 1px solid #e9ecef;
border-radius: 3px;
color: #495057;
cursor: pointer;
font-size: 12px;
font-size: 11px;
transition: all 0.15s ease;
font-weight: 500;
flex: 1;
min-width: 60px;
min-width: 50px;
}
.action-btn:hover {
background: #f5f5f5;
background: #f8f9fa;
border-color: #4a6cf7;
color: #4a6cf7;
transform: translateY(-1px);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.action-btn:active {
transform: translateY(0);
}
/* 世界书选择区域 */
.worldbook-selector {
display: flex;
gap: 8px;
gap: 6px;
align-items: center;
}
@@ -109,24 +121,30 @@
.dropdown-btn {
width: 100%;
padding: 8px 10px;
background: white;
border: 1px solid #e0e0e0;
border-radius: 4px;
color: #333;
padding: 5px 8px;
background: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 3px;
color: #495057;
cursor: pointer;
text-align: left;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 13px;
font-size: 11px;
transition: all 0.15s ease;
font-weight: 500;
}
.dropdown-btn:hover {
background: #f5f5f5;
background: white;
border-color: #ced4da;
}
.dropdown-btn:focus {
outline: none;
border-color: #4a6cf7;
box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.1);
}
.dropdown-menu {
@@ -135,26 +153,26 @@
left: 0;
right: 0;
background: white;
border: 1px solid #e0e0e0;
border-radius: 4px;
margin-top: 4px;
max-height: 200px;
border: 1px solid #e9ecef;
border-radius: 3px;
margin-top: 3px;
max-height: 180px;
overflow-y: auto;
z-index: 1000;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.dropdown-item {
padding: 8px 10px;
padding: 5px 8px;
cursor: pointer;
transition: background 0.15s ease;
font-size: 13px;
color: #333;
transition: all 0.15s ease;
font-size: 11px;
color: #495057;
font-weight: 500;
}
.dropdown-item:hover {
background: #f5f5f5;
background: #f8f9fa;
}
.dropdown-item.active {
@@ -168,77 +186,78 @@
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 6px;
gap: 4px;
}
.entry-item {
padding: 10px;
background: white;
border: 1px solid #e0e0e0;
border-radius: 4px;
padding: 8px;
background: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 3px;
cursor: pointer;
transition: all 0.15s ease;
}
.entry-item:hover {
background: #f9f9f9;
border-color: #4a6cf7;
background: white;
border-color: #ced4da;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.entry-item.active {
background: rgba(74, 108, 247, 0.1);
border-color: #4a6cf7;
background: rgba(74, 108, 247, 0.05);
border-color: rgba(74, 108, 247, 0.2);
}
.entry-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 4px;
margin-bottom: 3px;
}
.entry-name {
font-weight: 600;
font-size: 14px;
color: #333;
font-size: 12px;
color: #2c3e50;
}
.entry-status {
font-size: 11px;
color: #777;
padding: 2px 6px;
border-radius: 3px;
background: #f5f5f5;
font-size: 10px;
color: #6c757d;
padding: 2px 5px;
border-radius: 2px;
background: #f1f3f5;
font-weight: 500;
}
.entry-status.enabled {
color: #4a90e2;
background: rgba(74, 144, 226, 0.1);
color: #4a6cf7;
background: rgba(74, 108, 247, 0.1);
}
.entry-meta {
display: flex;
gap: 12px;
font-size: 11px;
color: #777;
gap: 8px;
font-size: 10px;
color: #6c757d;
font-weight: 500;
}
/* 编辑面板 */
.edit-panel {
position: fixed;
top: 0;
top: 60px;
right: 0;
bottom: 0;
left: 300px;
left: 280px;
background: white;
z-index: 1000;
padding: 16px;
padding: 12px;
overflow-y: auto;
transform: translateX(100%);
transition: transform 0.2s ease-out;
border-left: 1px solid #e0e0e0;
border-left: 1px solid #e9ecef;
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}
@@ -250,14 +269,14 @@
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 1px solid #e0e0e0;
margin-bottom: 12px;
padding-bottom: 8px;
border-bottom: 1px solid #e9ecef;
}
.edit-panel-header h2 {
font-size: 16px;
color: #333;
font-size: 13px;
color: #2c3e50;
margin: 0;
font-weight: 600;
}
@@ -265,26 +284,31 @@
.close-btn {
background: none;
border: none;
color: #999;
font-size: 20px;
color: #adb5bd;
font-size: 18px;
cursor: pointer;
padding: 4px;
padding: 0;
width: 18px;
height: 18px;
display: flex;
align-items: center;
justify-content: center;
transition: color 0.15s ease;
}
.close-btn:hover {
color: #333;
color: #495057;
}
.form-group {
margin-bottom: 12px;
margin-bottom: 10px;
}
.form-label {
display: block;
margin-bottom: 6px;
font-size: 13px;
color: #555;
margin-bottom: 4px;
font-size: 11px;
color: #495057;
font-weight: 500;
}
@@ -292,12 +316,12 @@
.form-textarea,
.form-select {
width: 100%;
padding: 8px 10px;
background: white;
border: 1px solid #e0e0e0;
border-radius: 4px;
color: #333;
font-size: 13px;
padding: 5px 8px;
background: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 3px;
color: #495057;
font-size: 11px;
transition: all 0.15s ease;
}
@@ -310,17 +334,19 @@
}
.form-textarea {
min-height: 100px;
min-height: 80px;
resize: vertical;
font-family: inherit;
line-height: 1.4;
}
.form-checkbox {
display: flex;
align-items: center;
gap: 8px;
gap: 6px;
cursor: pointer;
font-size: 13px;
color: #555;
font-size: 11px;
color: #495057;
font-weight: 500;
}
@@ -330,11 +356,11 @@
/* 按钮样式 */
.btn {
padding: 8px 12px;
padding: 5px 10px;
border: none;
border-radius: 4px;
border-radius: 3px;
cursor: pointer;
font-size: 13px;
font-size: 11px;
transition: all 0.15s ease;
font-weight: 500;
}
@@ -346,6 +372,8 @@
.btn-primary:hover {
background: #3a5ce5;
transform: translateY(-1px);
box-shadow: 0 1px 2px rgba(74, 108, 247, 0.15);
}
.btn-danger {
@@ -355,24 +383,260 @@
.btn-danger:hover {
background: #c0392b;
transform: translateY(-1px);
box-shadow: 0 1px 2px rgba(231, 76, 60, 0.15);
}
/* 加载和错误状态 */
.loading,
.error {
text-align: center;
padding: 20px;
font-size: 13px;
padding: 16px;
font-size: 11px;
font-weight: 500;
}
.loading {
color: #777;
font-weight: 500;
color: #6c757d;
}
.error {
color: #e74c3c;
background: rgba(231, 76, 60, 0.1);
border-radius: 3px;
}
/* 滚动条样式 */
::-webkit-scrollbar {
width: 5px;
height: 5px;
}
::-webkit-scrollbar-track {
background: #f1f3f5;
border-radius: 2px;
}
::-webkit-scrollbar-thumb {
background: #ced4da;
border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
background: #adb5bd;
}
/* 插入位置权重提示 */
.position-tooltip {
position: relative;
display: inline-block;
cursor: help;
}
.position-tooltip::after {
content: attr(data-tooltip);
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
padding: 6px 10px;
background: rgba(0, 0, 0, 0.85);
color: white;
font-size: 11px;
font-weight: 500;
border-radius: 4px;
white-space: nowrap;
opacity: 0;
visibility: hidden;
transition: all 0.2s ease;
z-index: 1000;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
margin-bottom: 6px;
}
.position-tooltip:hover::after {
opacity: 1;
visibility: visible;
}
/* 紧凑的参数显示 */
.compact-params {
display: flex;
gap: 8px;
align-items: center;
flex-wrap: wrap;
}
.param-item {
display: flex;
align-items: center;
gap: 4px;
font-size: 10px;
color: #6c757d;
}
.param-label {
font-weight: 500;
}
.param-value {
color: #495057;
}
/* 响应式设计 */
@media (max-width: 768px) {
.worldbook-content {
padding: 6px;
gap: 6px;
}
.edit-panel {
left: 0;
top: 50px;
}
.compact-params {
gap: 6px;
}
}
/* 编辑面板打开状态优化 */
.edit-panel.open {
transform: translateX(0);
box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
}
/* 位置选择器样式 */
.position-selector {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 6px;
}
.position-option {
padding: 6px 8px;
background: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 3px;
cursor: pointer;
transition: all 0.15s ease;
}
.position-option:hover {
background: white;
border-color: #ced4da;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.position-option.active {
background: rgba(74, 108, 247, 0.05);
border-color: rgba(74, 108, 247, 0.2);
}
.position-label {
display: block;
font-size: 11px;
font-weight: 500;
color: #2c3e50;
margin-bottom: 2px;
}
.position-weight {
display: inline-block;
padding: 1px 4px;
font-size: 10px;
font-weight: 600;
border-radius: 2px;
background: #f1f3f5;
color: #6c757d;
}
.position-option.active .position-weight {
background: rgba(74, 108, 247, 0.1);
color: #4a6cf7;
}
/* 触发策略选择器样式 */
.trigger-strategy-selector {
display: flex;
gap: 4px;
flex-wrap: wrap;
}
.trigger-strategy-btn {
flex: 1;
min-width: 80px;
padding: 5px 8px;
background: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 3px;
cursor: pointer;
font-size: 11px;
font-weight: 500;
color: #495057;
transition: all 0.15s ease;
}
.trigger-strategy-btn:hover {
background: white;
border-color: #ced4da;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.trigger-strategy-btn.active {
background: rgba(74, 108, 247, 0.05);
border-color: rgba(74, 108, 247, 0.2);
color: #4a6cf7;
}
/* 编辑面板内容区域优化 */
.edit-panel .form-group {
margin-bottom: 8px;
}
.edit-panel .form-label {
margin-bottom: 3px;
}
.edit-panel .form-input,
.edit-panel .form-textarea,
.edit-panel .form-select {
padding: 4px 7px;
}
.edit-panel .form-textarea {
min-height: 60px;
line-height: 1.3;
}
/* 编辑面板按钮优化 */
.edit-panel .btn {
width: 100%;
margin-top: 8px;
}
/* 权重标签颜色区分 */
.weight-high {
background: rgba(231, 76, 60, 0.1);
color: #e74c3c;
}
.weight-medium {
background: rgba(241, 196, 15, 0.1);
color: #f39c12;
}
.weight-low {
background: rgba(52, 152, 219, 0.1);
color: #3498db;
}
.weight-extreme {
background: rgba(192, 57, 43, 0.1);
color: #c0392b;
}
.weight-maximum {
background: rgba(142, 68, 173, 0.1);
color: #8e44ad;
}