feat(users): 实现用户列表页面的异步数据加载与UI优化

- 添加角色服务依赖以获取用户组信息
- 将用户列表和角色信息改为流式加载
- 更新用户列表页面布局与样式
- 增加搜索框和用户组筛选下拉菜单
- 添加加载状态提示与错误处理显示
- 引入sass-embedded支持SCSS样式编写
- 调整表格列宽并增加响应式设计
- 添加面包屑导航与页面标题展示
- 新增添加用户按钮及操作下拉菜单
- 使用Icon组件替换原有图标实现方式
This commit is contained in:
Chaos
2025-11-26 07:23:20 +08:00
parent 7d627a45fb
commit e09129cab6
7 changed files with 943 additions and 49 deletions

View File

@@ -0,0 +1,12 @@
import { api } from '$lib/api/httpClient.ts';
import type { RoleResponse } from '$lib/types/user.ts';
export const roleService = {
getAllRoles: async (token:string) => {
const response = await api.get<RoleResponse[]>('/role/', {headers: {Authorization: `${token}`}});
if (response.code != 200 || !response.data){
throw new Error(response.msg);
}
return response.data;
},
}

View File

@@ -2,11 +2,13 @@ export interface UserProfile{
id: number;
username : string;
nickname : string;
roles : {
id: number;
name: string;
}[];
roles : RoleResponse[];
avatar? : string;
}
export interface RoleResponse {
id: number;
name: string;
}