From 61b607a057d28293d27fe81dee059ed404af46ff Mon Sep 17 00:00:00 2001 From: danial Date: Thu, 23 Oct 2025 18:19:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(jd-order):=20=E4=BC=98=E5=8C=96Cookie?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改输入格式为每行一个Cookie - 添加账户前缀和统一备注设置 - 调整文本框最小和最大行数 - 更新输入提示和标签文本 - 修改数据解析逻辑以适应新格式 - 强制要求输入账户前缀 - 清理表单重置逻辑 - 更新相关图标引入 - 调整样式以适应新表单元素 --- CLAUDE.md | 6 +- .../cookie/components/batch-import-modal.vue | 106 +++++++++++++----- 2 files changed, 85 insertions(+), 27 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 6dc3518..8543a08 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -111,7 +111,9 @@ The project uses a dual API approach: API clients are configured in `src/api/index.ts`: - `apiClient` - DefaultApi for main backend operations -- `apiCkClient` - CkApi for CK-related operations +- `jdCookieClient` - JDCookieManagementApi for JD cookie management +- `jdHistoryClient` - JDHistoryApi for JD order history +- `jdOrderClient` - JDOrderManagementApi for JD order management API base URL is configured via environment variables: @@ -187,7 +189,7 @@ Development settings in `.env.development`, production in `.env.production` **Note**: All linting tools are configured to run automatically via lint-staged on pre-commit hooks. -## Common Patterns +## Development Patterns ### API Calls diff --git a/src/views/jd-order/cookie/components/batch-import-modal.vue b/src/views/jd-order/cookie/components/batch-import-modal.vue index fc32b03..ea2ae6f 100644 --- a/src/views/jd-order/cookie/components/batch-import-modal.vue +++ b/src/views/jd-order/cookie/components/batch-import-modal.vue @@ -65,16 +65,17 @@ 输入数据
- 格式:Cookie 账号 备注 + 格式:每行一个Cookie
+ + +
+
+ + 账户前缀 +
+ +
+ + +
+
+ + 统一备注 +
+ +
+
- 行数:{{ lineCount }} + Cookie数量:{{ lineCount }} 有效数据:{{ parsedData.length }}
@@ -196,7 +225,10 @@ import { IconEye, IconImport, IconClose, - IconEdit + IconEdit, + IconUser, + IconMessage, + IconFile } from '@arco-design/web-vue/es/icon'; import { jdCookieClient } from '@/api'; @@ -225,7 +257,9 @@ const isFullscreen = ref(false); // 表单数据 const formModel = reactive({ - cookieData: '' + cookieData: '', + accountPrefix: '', + unifiedRemark: '' }); // 解析后的数据 @@ -247,31 +281,24 @@ const parseCookieData = (): void => { .filter(line => line.trim()); const parsed: ParsedCookieItem[] = lines.map((line, index) => { - // 使用单个空格作为分隔符 - let parts = line - .split(' ') - .map(part => part.trim()) - .filter(part => part); - - let cookieValue = ''; + // 提取Cookie值(整行作为Cookie) + let cookieValue = line.trim(); let accountName = ''; let remark = ''; let isValid = false; - if (parts.length === 1) { - // 只有一部分,整个作为Cookie值 - cookieValue = parts[0]; + // 生成账户名称:前缀 + 数字序号 + if (formModel.accountPrefix.trim()) { + accountName = `${formModel.accountPrefix.trim()}${index + 1}`; + } else { accountName = `账号${index + 1}`; - remark = ''; - } else if (parts.length >= 2) { - // 多个部分,第一部分是Cookie,第二部分是账号,第三部分是备注 - cookieValue = parts[0]; - accountName = parts[1] || `账号${index + 1}`; - remark = parts[2] || ''; } - // 验证Cookie格式 - 只要包含pt_key=就认为是有效的 - isValid = cookieValue.includes('pt_key='); + // 使用统一备注 + remark = formModel.unifiedRemark.trim() || ''; + + // 所有输入的Cookie都认为是有效的 + isValid = true; return { cookieValue, @@ -301,6 +328,8 @@ const toggleFullscreen = (): void => { const handleCancel = (): void => { emit('update:visible', false); formModel.cookieData = ''; + formModel.accountPrefix = ''; + formModel.unifiedRemark = ''; parsedData.value = []; isFullscreen.value = false; }; @@ -311,6 +340,11 @@ const handleSubmit = async (): Promise => { return false; } + if (!formModel.accountPrefix.trim()) { + Message.warning('请输入账户前缀'); + return false; + } + // 重新解析数据 parseCookieData(); @@ -525,6 +559,28 @@ const handleSubmit = async (): Promise => { border-color: rgb(var(--primary-6)); } +.form-item { + margin-top: 16px; +} + +.form-label { + display: flex; + align-items: center; + gap: 6px; + font-size: 13px; + font-weight: 500; + color: var(--color-text-2); + margin-bottom: 6px; +} + +.form-input { + width: 100%; +} + +.cookie-input-item { + margin-bottom: 0; +} + .input-stats { display: flex; justify-content: space-between;