diff --git a/im-admin-ui/src/api/im/group/index.ts b/im-admin-ui/src/api/im/group/index.ts index e9fbe5c..60a62d5 100644 --- a/im-admin-ui/src/api/im/group/index.ts +++ b/im-admin-ui/src/api/im/group/index.ts @@ -39,7 +39,6 @@ export const ban = (data: GroupBanDTO) => { }); }; - /** * 解封用户 * @param data @@ -52,16 +51,13 @@ export const unban = (data: GroupUnbanDTO) => { }); }; - - export const findGroupByName = (name?: String): AxiosPromise => { return request({ - url: '/im/group/findByName?name='+name, + url: '/im/group/findByName?name=' + name, method: 'get' }); }; - /** * 获取总群组数量 */ @@ -71,4 +67,3 @@ export const getTotalGroupCount = (): AxiosPromise => { method: 'get' }); }; - diff --git a/im-admin-ui/src/views/im/user/index.vue b/im-admin-ui/src/views/im/user/index.vue index b60d449..774c38c 100644 --- a/im-admin-ui/src/views/im/user/index.vue +++ b/im-admin-ui/src/views/im/user/index.vue @@ -106,8 +106,8 @@ 解封 封禁 --> - 设置标签 - 设置分组 + 设置标签 + 设置分组 @@ -303,13 +303,13 @@ const handleLabel = (row?: UserVO) => { proxy?.$modal?.msgError('请选择一个用户'); return; } - + editingUser.value = row || userList.value.find((u) => u.id === ids.value[0]) || null; if (!editingUser.value) { proxy?.$modal?.msgError('请先选择一个用户'); return; } - + isBatchMode.value = false; selectedLabelIds.value = (editingUser.value.labelIds || '') .toString() @@ -325,13 +325,13 @@ const handleGroup = (row?: UserVO) => { proxy?.$modal?.msgError('请选择一个用户'); return; } - + editingUser.value = row || userList.value.find((u) => u.id === ids.value[0]) || null; if (!editingUser.value) { proxy?.$modal?.msgError('请先选择一个用户'); return; } - + isBatchMode.value = false; selectedGroupIds.value = (editingUser.value.groupIds || '') .toString() @@ -350,13 +350,13 @@ const confirmLabel = async () => { proxy?.$modal?.msgError('请至少选择一个用户'); return; } - + const labelIdsStr = selectedLabelIds.value.join(','); - const payload = ids.value.map(id => ({ + const payload = ids.value.map((id) => ({ id: id, labelIds: labelIdsStr })); - + await updateBatchUser(payload); proxy?.$modal?.msgSuccess(`成功为 ${ids.value.length} 个用户设置标签`); } else { @@ -365,19 +365,21 @@ const confirmLabel = async () => { proxy?.$modal?.msgError('用户信息不存在'); return; } - - const payload = [{ - id: editingUser.value.id, - labelIds: selectedLabelIds.value.join(',') - }]; - + + const payload = [ + { + id: editingUser.value.id, + labelIds: selectedLabelIds.value.join(',') + } + ]; + // 乐观更新 UI editingUser.value.labelIds = payload[0].labelIds; - + await updateBatchUser(payload); proxy?.$modal?.msgSuccess('设置标签成功'); } - + // 刷新列表 await getList(); } catch (error) { @@ -409,13 +411,13 @@ const confirmGroup = async () => { proxy?.$modal?.msgError('请至少选择一个用户'); return; } - + const groupIdsStr = selectedGroupIds.value.join(','); - const payload = ids.value.map(id => ({ + const payload = ids.value.map((id) => ({ id: id, groupIds: groupIdsStr })); - + await updateBatchUser(payload); proxy?.$modal?.msgSuccess(`成功为 ${ids.value.length} 个用户设置分组`); } else { @@ -424,19 +426,21 @@ const confirmGroup = async () => { proxy?.$modal?.msgError('用户信息不存在'); return; } - - const payload = [{ - id: editingUser.value.id, - groupIds: selectedGroupIds.value.join(',') - }]; - + + const payload = [ + { + id: editingUser.value.id, + groupIds: selectedGroupIds.value.join(',') + } + ]; + // 乐观更新 UI editingUser.value.groupIds = payload[0].groupIds; - + await updateBatchUser(payload); proxy?.$modal?.msgSuccess('设置分组成功'); } - + // 刷新列表 await getList(); } catch (error) { @@ -610,4 +614,4 @@ onMounted(async () => { await getLabelAndGroupList(); getList(); }); - \ No newline at end of file + diff --git a/im-admin-ui/src/views/index.vue b/im-admin-ui/src/views/index.vue index f0a2c11..c3eb608 100644 --- a/im-admin-ui/src/views/index.vue +++ b/im-admin-ui/src/views/index.vue @@ -5,7 +5,7 @@
-
+
@@ -20,7 +20,7 @@
-
+
@@ -35,7 +35,7 @@
-
+
@@ -50,7 +50,7 @@
-
+
@@ -67,34 +67,32 @@
- + -
+
- +
@@ -165,7 +163,6 @@ const loadActiveUserStats = async () => { } }; - // 加载图表数据 const loadChartData = async () => { try { @@ -217,11 +214,11 @@ const processChartData = (privateData: any[], groupData: any[]) => { dates.push(dateStr); // 查找对应日期的私聊数据 - const privateDayData = privateData.find(item => item.date === dateStr); + const privateDayData = privateData.find((item) => item.date === dateStr); privateCounts.push(privateDayData ? parseInt(privateDayData.count) : 0); // 查找对应日期的群聊数据 - const groupDayData = groupData.find(item => item.date === dateStr); + const groupDayData = groupData.find((item) => item.date === dateStr); groupCounts.push(groupDayData ? parseInt(groupDayData.count) : 0); } @@ -243,9 +240,11 @@ const loadRegistrationChartData = async () => { xAxis: { data: chartData.dates }, - series: [{ - data: chartData.counts - }] + series: [ + { + data: chartData.counts + } + ] }); } } catch (error) { @@ -267,7 +266,7 @@ const processRegistrationChartData = (data: any[]) => { dates.push(dateStr); // 查找对应日期的数据 - const dayData = data.find(item => item.date === dateStr); + const dayData = data.find((item) => item.date === dateStr); counts.push(dayData ? parseInt(dayData.count) : 0); } @@ -328,11 +327,16 @@ const initChart = async () => { y: 0, x2: 0, y2: 1, - colorStops: [{ - offset: 0, color: 'rgba(64, 158, 255, 0.3)' - }, { - offset: 1, color: 'rgba(64, 158, 255, 0.1)' - }] + colorStops: [ + { + offset: 0, + color: 'rgba(64, 158, 255, 0.3)' + }, + { + offset: 1, + color: 'rgba(64, 158, 255, 0.1)' + } + ] } } }, @@ -351,11 +355,16 @@ const initChart = async () => { y: 0, x2: 0, y2: 1, - colorStops: [{ - offset: 0, color: 'rgba(103, 194, 58, 0.3)' - }, { - offset: 1, color: 'rgba(103, 194, 58, 0.1)' - }] + colorStops: [ + { + offset: 0, + color: 'rgba(103, 194, 58, 0.3)' + }, + { + offset: 1, + color: 'rgba(103, 194, 58, 0.1)' + } + ] } } } @@ -415,29 +424,36 @@ const initRegistrationChart = async () => { type: 'value', name: '注册用户数' }, - series: [{ - name: '注册用户', - type: 'line', - data: [], - smooth: true, - itemStyle: { - color: '#E6A23C' - }, - areaStyle: { - color: { - type: 'linear', - x: 0, - y: 0, - x2: 0, - y2: 1, - colorStops: [{ - offset: 0, color: 'rgba(230, 162, 60, 0.3)' - }, { - offset: 1, color: 'rgba(230, 162, 60, 0.1)' - }] + series: [ + { + name: '注册用户', + type: 'line', + data: [], + smooth: true, + itemStyle: { + color: '#E6A23C' + }, + areaStyle: { + color: { + type: 'linear', + x: 0, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { + offset: 0, + color: 'rgba(230, 162, 60, 0.3)' + }, + { + offset: 1, + color: 'rgba(230, 162, 60, 0.1)' + } + ] + } } } - }], + ], grid: { left: '3%', right: '4%',