fix(honor): 优化光荣榜列表去重逻辑,防止重复显示

- 列表第一页渲染时根据 articleId 去重,避免重复条目显示
- 翻页追加数据时合并并去重列表,确保展示无重复内容
- 修复因后端数据重复导致的同一条目多次出现问题

feat(config): 新增环境变量配置及配置文件重构

- 新增 config/env.ts 支持开发、测试、生产环境变量配置
- 通过 getEnvConfig 函数动态获取当前环境配置
- config/app.ts 引入环境变量,实现接口地址等配置统一管理
This commit is contained in:
2026-04-06 12:21:06 +08:00
parent e2a703fac5
commit fa917639d2
8 changed files with 85 additions and 9 deletions

View File

@@ -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;
});

View File

@@ -10,9 +10,9 @@ const MyPage = () => {
<video
controls
className='w-full max-w-2xl mx-auto'
poster='https://oss.wsdns.cn/20250722/018be1bd1c8b4cc4a15076ad0578b88d.mp4?x-oss-process=video/snapshot,t_1000,f_jpg,w_396,h_222,m_fast'
poster='https://oss.wsdns.cn/20260406/2be0376cac054f2ba86dd35a2bc52e11.mp4?x-oss-process=video/snapshot,t_1000,f_jpg,w_396,h_222,m_fast'
>
<source src='https://oss.wsdns.cn/20250722/018be1bd1c8b4cc4a15076ad0578b88d.mp4' type='video/mp4' />
<source src='https://oss.wsdns.cn/20260406/2be0376cac054f2ba86dd35a2bc52e11.mp4' type='video/mp4' />
</video>
</div>

View File

@@ -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';
// 版权信息

View File

@@ -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