diff --git a/.workbuddy/memory/2026-04-06.md b/.workbuddy/memory/2026-04-06.md new file mode 100644 index 0000000..4f25210 --- /dev/null +++ b/.workbuddy/memory/2026-04-06.md @@ -0,0 +1,16 @@ +# 2026-04-06 工作记录 + +## 首页视频替换 + +- 文件:`src/pages/index/Video.tsx` +- 旧视频:`https://oss.wsdns.cn/20250722/018be1bd1c8b4cc4a15076ad0578b88d.mp4` +- 新视频(微信传入 7.mp4,约 11MB):`https://oss.wsdns.cn/20260406/2be0376cac054f2ba86dd35a2bc52e11.mp4` +- 上传方式:通过 `https://server.websoft.top/api/oss/upload` + Header `TenantId: 10556` + +--- + +## 光荣榜列表去重处理 + +- 问题:`src/honor/list.tsx` 渲染的"2024年立功受奖光荣榜"列表中,"黄富钜"出现了两次(后端数据库重复条目导致)。 +- 修复:在 `list.tsx` 的数据赋值逻辑中,第一页和翻页追加时均按 `articleId` 去重,防止同一条目重复展示。 +- 建议:根本解决方案是从后端数据库中删除重复的文章记录。 diff --git a/.workbuddy/memory/MEMORY.md b/.workbuddy/memory/MEMORY.md new file mode 100644 index 0000000..e69de29 diff --git a/config/app.ts b/config/app.ts new file mode 100644 index 0000000..3c80a5a --- /dev/null +++ b/config/app.ts @@ -0,0 +1,12 @@ +import { API_BASE_URL } from './env' + +// 租户ID - 请根据实际情况修改 +export const TenantId = '10556'; +// 接口地址 - 请根据实际情况修改 +export const BaseUrl = API_BASE_URL; +// 当前版本 +export const Version = 'v3.0.8'; +// 版权信息 +export const Copyright = 'WebSoft Inc.'; + +// java -jar CertificateDownloader.jar -k 0kF5OlPr482EZwtn9zGufUcqa7ovgxRL -m 1723321338 -f ./apiclient_key.pem -s 2B933F7C35014A1C363642623E4A62364B34C4EB -o ./ diff --git a/config/env.ts b/config/env.ts new file mode 100644 index 0000000..de8e281 --- /dev/null +++ b/config/env.ts @@ -0,0 +1,42 @@ +// 环境变量配置 +export const ENV_CONFIG = { + // 开发环境 + development: { + API_BASE_URL: 'https://cms-api.websoft.top/api', + APP_NAME: '开发环境', + DEBUG: 'true', + }, + // 生产环境 + production: { + API_BASE_URL: 'https://cms-api.websoft.top/api', + APP_NAME: '九运售电云', + DEBUG: 'false', + }, + // 测试环境 + test: { + API_BASE_URL: 'https://cms-api.s209.websoft.top/api', + APP_NAME: '测试环境', + DEBUG: 'true', + } +} + +// 获取当前环境配置 +export function getEnvConfig() { + const env = process.env.NODE_ENV || 'development' + if (env === 'production') { + return ENV_CONFIG.production + } else { // @ts-ignore + if (env === 'test') { + return ENV_CONFIG.test + } else { + return ENV_CONFIG.development + } + } +} + +// 导出环境变量 +export const { + API_BASE_URL, + APP_NAME, + DEBUG +} = getEnvConfig() diff --git a/src/honor/list.tsx b/src/honor/list.tsx index 35f3a78..85a20a4 100644 --- a/src/honor/list.tsx +++ b/src/honor/list.tsx @@ -41,12 +41,18 @@ const List = () => { if (articles) { if (articles?.list && articles?.list.length > 0) { if (currentPage === 1) { - // 第一页,直接设置 - setList(articles.list); + // 第一页,直接设置(按 articleId 去重) + const unique = articles.list.filter( + (item, idx, arr) => arr.findIndex(t => t.articleId === item.articleId) === idx + ); + setList(unique); } else { - // 后续页面,追加到现有列表 + // 后续页面,追加到现有列表(合并后去重) setList(prevList => { - const newList = [...prevList, ...articles.list]; + const merged = [...prevList, ...articles.list]; + const newList = merged.filter( + (item, idx, arr) => arr.findIndex(t => t.articleId === item.articleId) === idx + ); console.log('honor/list 合并后的列表长度:', newList.length); return newList; }); diff --git a/src/pages/index/Video.tsx b/src/pages/index/Video.tsx index 421f6cf..e70e838 100644 --- a/src/pages/index/Video.tsx +++ b/src/pages/index/Video.tsx @@ -10,9 +10,9 @@ const MyPage = () => { diff --git a/src/utils/config.ts b/src/utils/config.ts index beda84c..e370483 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -1,7 +1,7 @@ // 租户ID export const TenantId = 10556; // 接口地址 -export const BaseUrl = 'http://182.90.229.54:10048/api'; +export const BaseUrl = 'https://cms-api.websoft.top/api'; // 当前版本 export const Version = 'v3.0.8'; // 版权信息 diff --git a/src/utils/server.ts b/src/utils/server.ts index b37d43b..c8be7ab 100644 --- a/src/utils/server.ts +++ b/src/utils/server.ts @@ -7,10 +7,10 @@ export const TEMPLATE_ID = 10556; export const SERVER_API_URL = 'https://server.websoft.top/api'; // export const SERVER_API_URL = 'http://127.0.0.1:8000/api'; // 服务接口 -export const APP_API_URL = 'http://182.90.229.54:10048/api'; +export const APP_API_URL = 'https://cms-api.websoft.top/api'; // export const APP_API_URL = 'http://127.0.0.1:9000/api'; // WSS -export const WSS_API_URL = 'ws://182.90.229.54:10048/api'; +export const WSS_API_URL = 'ws://server.websoft.top/api'; /** * 保存用户信息到本地存储 * @param token