feat: 群组管理页面优化 + 分类管理图标修复
- 创建/加入群组合并为 Tab 切换卡片 - 群主可刷新邀请码(后端+前端完整链路) - 群主可管理成员:查看列表、移除成员 - 新增后端 API:refresh-code / members / remove-member - 修复分类管理页 FAB 按钮缺少 plus 图标 - 新增 plus/refresh 图标资源
This commit is contained in:
@@ -97,6 +97,32 @@ export const useGroupStore = defineStore('group', () => {
|
||||
await fetchGroups()
|
||||
}
|
||||
|
||||
/** 刷新邀请码(群主) */
|
||||
async function refreshInviteCode(groupId: number) {
|
||||
const result = await api.refreshInviteCode(groupId)
|
||||
// 更新本地 groups 中的 invite_code
|
||||
const group = groups.value.find(g => g.id === groupId)
|
||||
if (group) {
|
||||
group.invite_code = result.invite_code
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/** 获取成员列表 */
|
||||
async function fetchGroupMembers(groupId: number) {
|
||||
return await api.getGroupMembers(groupId)
|
||||
}
|
||||
|
||||
/** 移除成员(群主) */
|
||||
async function removeMember(groupId: number, userId: number) {
|
||||
await api.removeMember(groupId, userId)
|
||||
// 更新本地成员数
|
||||
const group = groups.value.find(g => g.id === groupId)
|
||||
if (group && group.member_count > 0) {
|
||||
group.member_count--
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化:从本地存储恢复选中状态 */
|
||||
function init() {
|
||||
const saved = uni.getStorageSync('xc:currentGroupId')
|
||||
@@ -108,6 +134,7 @@ export const useGroupStore = defineStore('group', () => {
|
||||
return {
|
||||
groups, loading, currentGroupId, currentGroup, isGroupMode,
|
||||
switchToPersonal, switchToGroup, refreshAll,
|
||||
fetchGroups, createGroup, joinGroup, leaveGroup, deleteGroup, init
|
||||
fetchGroups, createGroup, joinGroup, leaveGroup, deleteGroup,
|
||||
refreshInviteCode, fetchGroupMembers, removeMember, init
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user