feat(im): 优化下禁言弹窗的样式

im
YunaiV 2026-05-05 22:51:26 +08:00
parent 5bd99c53c2
commit f8cc9d14d9
1 changed files with 35 additions and 34 deletions

View File

@ -1,32 +1,34 @@
<template> <template>
<!-- 禁言时长选择弹窗 --> <!-- 禁言时长选择弹窗 -->
<!-- TODO @AI样式有点丑你看看怎么优化下例如说横着 radio/Users/yunai/Downloads/iShot_2026-05-05_17.51.35.png --> <el-dialog v-model="visible" title="设置禁言" width="560px" :close-on-click-modal="false">
<el-dialog v-model="visible" title="设置禁言" width="360px" :close-on-click-modal="false"> <div class="flex flex-col gap-4">
<div class="flex flex-col gap-3"> <!-- 成员信息卡 FriendAddDialog user 卡保持一致的浅色背景 -->
<div class="text-sm text-[var(--el-text-color-regular)]"> <div
禁言成员<span class="font-medium text-[var(--el-text-color-primary)]">{{ class="flex items-center gap-2 px-3 py-2.5 rounded-md bg-[var(--el-fill-color-light)]"
memberName >
}}</span> <span class="text-13px text-[var(--el-text-color-secondary)]">禁言成员</span>
<span
class="text-sm font-medium text-[var(--el-text-color-primary)] truncate"
>
{{ memberName }}
</span>
</div>
<!-- 禁言时长选项 el-button 平铺选中走 primary gap-2 留间距 -->
<div>
<div class="mb-2 text-13px text-[var(--el-text-color-secondary)]">禁言时长</div>
<div class="grid grid-cols-3 gap-2">
<el-button
v-for="opt in presets"
:key="opt.value"
:type="selected === opt.value ? 'primary' : ''"
class="!ml-0 w-full"
@click="selected = opt.value"
>
{{ opt.label }}
</el-button>
</div>
</div> </div>
<el-radio-group v-model="selected" class="flex flex-col gap-2">
<el-radio v-for="opt in presets" :key="opt.value" :value="opt.value">
{{ opt.label }}
</el-radio>
<el-radio :value="0">
<div class="flex items-center gap-2">
<span>自定义</span>
<el-input-number
v-model="customMinutes"
:min="1"
:max="43200"
:disabled="selected !== 0"
size="small"
class="!w-100px"
/>
<span class="text-sm">分钟</span>
</div>
</el-radio>
</el-radio-group>
</div> </div>
<template #footer> <template #footer>
<el-button @click="visible = false">取消</el-button> <el-button @click="visible = false">取消</el-button>
@ -54,14 +56,14 @@ const groupId = ref(0)
const userId = ref(0) const userId = ref(0)
const memberName = ref('') const memberName = ref('')
const selected = ref(600) // 10 const selected = ref(600) // 10
const customMinutes = ref(30)
const presets = [ const presets = [
{ label: '10 分钟', value: 600 }, { label: '10 分钟', value: 600 },
{ label: '1 小时', value: 3600 }, { label: '1 小时', value: 3600 },
{ label: '12 小时', value: 43200 }, { label: '12 小时', value: 43200 },
{ label: '1 天', value: 86400 }, { label: '1 天', value: 86400 },
{ label: '7 天', value: 604800 } { label: '7 天', value: 604800 },
{ label: '30 天', value: 2592000 }
] ]
/** 打开弹窗 */ /** 打开弹窗 */
@ -70,19 +72,18 @@ function open(gid: number, uid: number, name: string) {
userId.value = uid userId.value = uid
memberName.value = name memberName.value = name
selected.value = 600 selected.value = 600
customMinutes.value = 30
visible.value = true visible.value = true
} }
/** 确认禁言 */ /** 确认禁言 */
async function handleConfirm() { async function handleConfirm() {
const seconds = selected.value === 0 ? customMinutes.value * 60 : selected.value
if (seconds <= 0) {
return
}
loading.value = true loading.value = true
try { try {
await muteMember({ groupId: groupId.value, userId: userId.value, mutedSeconds: seconds }) await muteMember({
groupId: groupId.value,
userId: userId.value,
mutedSeconds: selected.value
})
successMessage('禁言成功') successMessage('禁言成功')
visible.value = false visible.value = false
emit('success') emit('success')