聊天室管理权限统一为职务权限

This commit is contained in:
2026-04-26 20:55:11 +08:00
parent b07f4e971a
commit 0402097b59
21 changed files with 590 additions and 395 deletions
+38 -7
View File
@@ -603,18 +603,49 @@ export function userCardComponent() {
}
},
/** 冻结用户 */
async freezeUser() {
/** 封禁账号 */
async banUser() {
const confirmed = await this.$confirm(
'确定要冻结 ' + this.userInfo.username + ' 的账号吗?冻结后将无法登录',
'冻结账号',
'#cc4444'
'确定要封禁 ' + this.userInfo.username + ' 的账号吗?封禁后将无法登录',
'封禁账号',
'#991b1b'
);
if (!confirmed) return;
const reason = await this.$prompt('冻结原因:', '严重违规', '填写原因', '#cc4444');
const reason = await this.$prompt('封禁原因:', '严重违规', '填写原因', '#991b1b');
if (reason === null) return;
try {
const res = await fetch('/command/freeze', {
const res = await fetch('/command/ban', {
method: 'POST',
headers: this._headers(),
body: JSON.stringify({
username: this.userInfo.username,
room_id: window.chatContext.roomId,
reason: reason || '严重违规'
})
});
const data = await res.json();
if (data.status === 'success') {
this.showUserModal = false;
} else {
this.$alert('操作失败:' + data.message, '操作失败', '#cc4444');
}
} catch (e) {
this.$alert('网络异常', '错误', '#cc4444');
}
},
/** 封禁 IP */
async banIpUser() {
const confirmed = await this.$confirm(
'确定要封禁 ' + this.userInfo.username + ' 的 IP 吗?该操作会同时冻结账号。',
'封禁 IP',
'#9a3412'
);
if (!confirmed) return;
const reason = await this.$prompt('封禁原因:', '严重违规', '填写原因', '#9a3412');
if (reason === null) return;
try {
const res = await fetch('/command/banip', {
method: 'POST',
headers: this._headers(),
body: JSON.stringify({