diff --git a/src/api/system/index.js b/src/api/system/index.js index 9a5ce36..1c03908 100644 --- a/src/api/system/index.js +++ b/src/api/system/index.js @@ -407,7 +407,14 @@ const system = { setExchangeTop: async (data) => { return request({ method: MethodsENUM.POST, - url: "/task/setExchangeTop", + url: "/task/setChildrenTop", + data: data + }); + }, + setChildrenRead: async (data) => { + return request({ + method: MethodsENUM.POST, + url: "/task/setChildrenRead", data: data }); }, diff --git a/src/components/MessageCard.vue b/src/components/MessageCard.vue index 99a926f..9410055 100644 --- a/src/components/MessageCard.vue +++ b/src/components/MessageCard.vue @@ -25,20 +25,21 @@ const {contextRow, type, data} = defineProps({ }); const itemList = computed(() => { + const tp = SystemStore.message.find(v => v.id === data.id); const list = type === 0 ? [ {text: '置顶', type: 1, hide: data.is_top === 1}, {text: '取消置顶', type: 0, hide: data.is_top === 0}, - {text: '标记已读', type: 0, hide: data.is_read === 0}, - {text: '标记未读', type: 1, hide: data.is_read === 1}, + {text: '标记已读', type: 1, hide: data.is_read === 0}, + {text: '标记未读', type: 0, hide: data.is_read > 0}, ] : [ - {text: '标记已读', type: 0, hide: data.is_read === 0}, - {text: '标记未读', type: 1, hide: data.is_read === 1}, + {text: '标记已读', type: 0, hide: tp.is_read}, + {text: '标记未读', type: 1, hide: !tp.is_read}, ] return list.filter(v => !v.hide); }) const selectActionsheet = async (e) => { - if (type === 0) { + if (e.text === '置顶' || e.text === '取消置顶') { const {msg} = await Api.system.setExchangeTop({ id: data.id, type: e.type, @@ -46,8 +47,17 @@ const selectActionsheet = async (e) => { showToast(msg); emits('success'); } else { - const index = SystemStore.message.findIndex(v => v.id === data.id); - SystemStore.message[index].is_read = true; + if (type === 0) { + const {msg} = await Api.system.setChildrenRead({ + id: data.id, + type: e.type, + }); + showToast(msg); + emits('success'); + } else { + const index = SystemStore.message.findIndex(v => v.id === data.id); + SystemStore.message[index].is_read = !SystemStore.message[index].is_read; + } } } @@ -75,7 +85,7 @@ onMounted(() => { class="!py-[30rpx] !px-[24rpx] bg-[#fff] rounded-[8rpx] !flex items-center gap-[20rpx] overflow-hidden relative !mb-[20rpx]"> - diff --git a/src/components/XActionsheet.vue b/src/components/XActionsheet.vue index 32443ca..08a6a05 100644 --- a/src/components/XActionsheet.vue +++ b/src/components/XActionsheet.vue @@ -5,6 +5,7 @@ const emits = defineEmits(['success']); const show = ref(false); const success = (e) => { + show.value = false; emits('success', e); } @@ -19,7 +20,6 @@ const success = (e) => { :show="show" @click="success" @cancel="show=false"> - diff --git a/src/components/XFilter.vue b/src/components/XFilter.vue index aae9710..5bf48ff 100644 --- a/src/components/XFilter.vue +++ b/src/components/XFilter.vue @@ -1,23 +1,40 @@