免打扰变量命名优化:muted => dnd(Do Not Disturb)

This commit is contained in:
bob
2024-11-19 16:18:49 +08:00
parent 52655da705
commit e720ca1a40
5 changed files with 21 additions and 21 deletions

View File

@@ -479,9 +479,9 @@ const handleChangeTop = () => {
console.log(isTop.value)
}
const isSilentMode = ref(false) //TODO
const handleChangeSilentMode = () => {
console.log(isSilentMode.value)
const isDnd = ref(false) //TODO
const handleChangeDnd = () => {
console.log(isDnd.value)
}
// const isAllMuted = ref(false) //TODO
@@ -621,7 +621,7 @@ const handleAllInvite = () => {
</div>
<div style="display: flex; justify-content: space-between; align-items: center">
<span style="font-size: 14px">设置免打扰</span>
<el-switch v-model="isSilentMode" @change="handleChangeSilentMode" />
<el-switch v-model="isDnd" @change="handleChangeDnd" />
</div>
<div
style="

View File

@@ -34,8 +34,8 @@ export const messageStore = defineStore('anyim-message', () => {
params.top = obj.top
flag = true
}
if ('muted' in obj) {
params.muted = obj.muted
if ('dnd' in obj) {
params.dnd = obj.dnd
flag = true
}
// 注意,这里draft允许为""空串,有实际意义
@@ -69,7 +69,7 @@ export const messageStore = defineStore('anyim-message', () => {
// 云端更新成功再更新本地,保持数据同步
if (res.data.code === 0) {
if ('top' in obj) mySession.top = obj.top
if ('muted' in obj) mySession.muted = obj.muted
if ('dnd' in obj) mySession.dnd = obj.dnd
if ('draft' in obj) mySession.draft = obj.draft
if ('mark' in obj) {
mySession.mark = obj.mark

View File

@@ -28,7 +28,7 @@ const sessionInfo = computed(() => {
})
const top = ref(sessionInfo.value.top)
const muted = ref(sessionInfo.value.muted)
const dnd = ref(sessionInfo.value.dnd)
const hasBeenSelected = computed(() => {
return props.sessionId === props.selectedSessionId
@@ -101,7 +101,7 @@ const switchTag = (func) => {
func()
clearTimeout(timer)
timer = setTimeout(() => {
if (top.value === sessionInfo.value.top && muted.value === sessionInfo.value.muted) {
if (top.value === sessionInfo.value.top && dnd.value === sessionInfo.value.dnd) {
return
}
@@ -109,7 +109,7 @@ const switchTag = (func) => {
messageData.updateSession({
sessionId: props.sessionId,
top: top.value,
muted: muted.value
dnd: dnd.value
})
}, 100) // 这个时间太长会影响置顶按钮的响应时长
}
@@ -122,9 +122,9 @@ const handleSelectedMenuItem = async () => {
top.value = !top.value
})
break
case 'muted':
case 'dnd':
switchTag(() => {
muted.value = !muted.value
dnd.value = !dnd.value
})
break
case 'delete':
@@ -175,7 +175,7 @@ defineExpose({
</span>
<SessionTag :tagType="sessionInfo.sessionType"></SessionTag>
<SessionTag v-if="top" tagType="top"></SessionTag>
<SessionTag v-if="muted" tagType="mute"></SessionTag>
<SessionTag v-if="dnd" tagType="dnd"></SessionTag>
</div>
<div class="datetime">
<span>{{ showTime }}</span>
@@ -204,10 +204,10 @@ defineExpose({
/>
<el-button
class="action-button"
:icon="muted ? Bell : MuteNotification"
:icon="dnd ? Bell : MuteNotification"
@click.stop="
switchTag(() => {
muted = !muted
dnd = !dnd
})
"
circle

View File

@@ -12,8 +12,8 @@ const top = computed(() => {
return messageData.sessionList[props.sessionId].top
})
const muted = computed(() => {
return messageData.sessionList[props.sessionId].muted
const dnd = computed(() => {
return messageData.sessionList[props.sessionId].dnd
})
const menu = computed(() => {
@@ -24,9 +24,9 @@ const menu = computed(() => {
icon: top.value ? Bottom : Top
},
{
label: 'muted',
desc: muted.value ? '取消免打扰' : '开启免打扰',
icon: muted.value ? Bell : MuteNotification
label: 'dnd',
desc: dnd.value ? '取消免打扰' : '开启免打扰',
icon: dnd.value ? Bell : MuteNotification
},
{
label: 'mark',

View File

@@ -6,7 +6,7 @@ const items = {
organize: { color: '#E6A23C', label: '组' },
assistant: { color: '#E734F5', label: '助' },
top: { color: '#F56C6C', label: '顶' },
mute: { color: '#73767a', label: '静' }
dnd: { color: '#73767a', label: '静' }
}
const props = defineProps(['tagType'])