| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import { ref } from 'vue' |
| | | |
| | | import { Button, message, Modal } from 'ant-design-vue' |
| | | |
| | | import { muteMember } from '#/api/im/group' |
| | | |
| | | defineOptions({ name: 'ImGroupMuteMemberDialog' }) |
| | | |
| | | const emit = defineEmits<{ |
| | | success: [] |
| | | }>() |
| | | |
| | | const visible = ref(false) |
| | | const loading = ref(false) |
| | | const groupId = ref(0) |
| | | const userId = ref(0) |
| | | const memberName = ref('') |
| | | const selected = ref(600) // é»è®¤ 10 åé |
| | | |
| | | const presets = [ |
| | | { label: '10 åé', value: 600 }, |
| | | { label: '1 å°æ¶', value: 3600 }, |
| | | { label: '12 å°æ¶', value: 43_200 }, |
| | | { label: '1 天', value: 86_400 }, |
| | | { label: '7 天', value: 604_800 }, |
| | | { label: '30 天', value: 2_592_000 }, |
| | | { label: 'æ°¸ä¹
', value: 0 } |
| | | ] |
| | | |
| | | /** æå¼å¼¹çª */ |
| | | function open(gid: number, uid: number, name: string) { |
| | | groupId.value = gid |
| | | userId.value = uid |
| | | memberName.value = name |
| | | selected.value = 600 |
| | | visible.value = true |
| | | } |
| | | |
| | | /** 确认ç¦è¨ */ |
| | | async function handleConfirm() { |
| | | loading.value = true |
| | | try { |
| | | await muteMember({ |
| | | id: groupId.value, |
| | | userId: userId.value, |
| | | mutedSeconds: selected.value |
| | | }) |
| | | message.success('ç¦è¨æå') |
| | | visible.value = false |
| | | emit('success') |
| | | } finally { |
| | | loading.value = false |
| | | } |
| | | } |
| | | |
| | | defineExpose({ open }) |
| | | </script> |
| | | |
| | | <template> |
| | | <!-- ç¦è¨æ¶é¿éæ©å¼¹çª --> |
| | | <Modal v-model:open="visible" title="设置ç¦è¨" width="560px" :mask-closable="false"> |
| | | <div class="flex flex-col gap-4"> |
| | | <!-- æåä¿¡æ¯å¡ï¼å FriendAddDialog ç user å¡ä¿æä¸è´çæµ
è²èæ¯ --> |
| | | <div |
| | | class="flex items-center gap-2 px-3 py-2.5 rounded-md bg-[var(--ant-color-fill-secondary)]" |
| | | > |
| | | <span class="text-13px text-[var(--ant-color-text-secondary)]">ç¦è¨æå</span> |
| | | <span |
| | | class="text-sm font-medium text-[var(--ant-color-text)] truncate" |
| | | > |
| | | {{ memberName }} |
| | | </span> |
| | | </div> |
| | | |
| | | <!-- ç¦è¨æ¶é¿é项ï¼ç¨ el-button å¹³éºï¼éä¸èµ° primaryï¼é gap-2 çé´è· --> |
| | | <div> |
| | | <div class="mb-2 text-13px text-[var(--ant-color-text-secondary)]">ç¦è¨æ¶é¿</div> |
| | | <div class="grid grid-cols-3 gap-2"> |
| | | <Button |
| | | v-for="opt in presets" |
| | | :key="opt.value" |
| | | :type="selected === opt.value ? 'primary' : undefined" |
| | | class="!ml-0 w-full" |
| | | @click="selected = opt.value" |
| | | > |
| | | {{ opt.label }} |
| | | </Button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <template #footer> |
| | | <Button @click="visible = false">åæ¶</Button> |
| | | <Button type="primary" :loading="loading" @click="handleConfirm">ç¡®å®</Button> |
| | | </template> |
| | | </Modal> |
| | | </template> |