通讯录群详情新增手动同步群公告按钮
变更项:1) 新增POST接口用于手动同步群公告,仅在手动触发时调用Group/GetChatRoomInfoDetail。2) 同步逻辑采用基础群信息与Detail信息合并后再落库,确保公告可更新且不破坏原有群资料。3) 群详情页公告区域新增同步按钮和加载态,避免重复点击。4) 同步成功后自动刷新当前群资料。5) 补充中文注释说明手动同步链路。
This commit is contained in:
@@ -210,7 +210,17 @@
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="群公告">
|
||||
<span class="group-announcement">{% raw %}{{ currentGroupProfile.announcement || '暂无群公告' }}{% endraw %}</span>
|
||||
<div class="group-announcement-wrap">
|
||||
<span class="group-announcement">{% raw %}{{ currentGroupProfile.announcement || '暂无群公告' }}{% endraw %}</span>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
plain
|
||||
:loading="groupAnnouncementSyncing"
|
||||
@click="syncCurrentGroupAnnouncement">
|
||||
同步群公告
|
||||
</el-button>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="机器人状态">
|
||||
<el-tag :type="currentGroup.robot_status === 'enabled' ? 'success' : 'info'">
|
||||
@@ -778,6 +788,8 @@
|
||||
groupPermissionsLoading: false,
|
||||
// 当前群基础资料:用于展示群主、群公告、管理员、成员数等信息。
|
||||
currentGroupProfile: { owner_wxid: '', owner_name: '', announcement: '', member_count: 0, admin_count: 0, admins: [] },
|
||||
// 群公告手动同步按钮的加载态,避免重复点击触发多次请求。
|
||||
groupAnnouncementSyncing: false,
|
||||
groupInsight: null,
|
||||
groupInsightLoading: false,
|
||||
groupMembersList: [], groupMembersCurrentPage: 1, groupMembersPageSize: 10, groupMemberSearchQuery: '', groupMembersLoading: false,
|
||||
@@ -960,6 +972,27 @@
|
||||
this.$message.error('加载群资料失败');
|
||||
});
|
||||
},
|
||||
syncCurrentGroupAnnouncement() {
|
||||
if (!this.currentGroup || !this.currentGroup.wxid) return;
|
||||
this.groupAnnouncementSyncing = true;
|
||||
// 手动触发群公告同步:调用后端 Detail 接口并落库,再刷新当前群资料展示。
|
||||
axios.post(`/contacts/api/group_profile/${this.currentGroup.wxid}/sync_announcement`)
|
||||
.then(response => {
|
||||
if (response.data.success) {
|
||||
this.$message.success(response.data.message || '群公告同步成功');
|
||||
this.loadGroupProfile(this.currentGroup.wxid);
|
||||
} else {
|
||||
this.$message.error(response.data.error || '群公告同步失败');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('同步群公告失败:', error);
|
||||
this.$message.error('同步群公告失败');
|
||||
})
|
||||
.finally(() => {
|
||||
this.groupAnnouncementSyncing = false;
|
||||
});
|
||||
},
|
||||
toggleGroupPermission(permission) {
|
||||
const newStatus = permission.statusBool ? 'enabled' : 'disabled';
|
||||
axios.post(`/robot/api/group/${this.currentGroup.wxid}/permissions`, {
|
||||
@@ -1539,6 +1572,7 @@
|
||||
.detail-card-sub { font-size: 12px; color: #94a3b8; font-weight: 500; }
|
||||
.feature-chip-list { display: flex; gap: 8px; flex-wrap: wrap; min-height: 60px; align-items: flex-start; }
|
||||
.empty-inline, .detail-inline-note { font-size: 12px; color: #64748b; }
|
||||
.group-announcement-wrap { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
|
||||
.group-announcement { white-space: pre-wrap; line-height: 1.7; color: #334155; }
|
||||
.detail-inline-note { margin-top: 12px; line-height: 1.6; }
|
||||
.suggestion-list { display: flex; flex-direction: column; gap: 12px; }
|
||||
|
||||
Reference in New Issue
Block a user