update
This commit is contained in:
@@ -45,7 +45,6 @@ const selectActionsheet = async (e) => {
|
||||
type: e.type,
|
||||
});
|
||||
showToast(msg);
|
||||
emits('success');
|
||||
} else {
|
||||
if (type === 0) {
|
||||
const {msg} = await Api.system.setChildrenRead({
|
||||
@@ -53,18 +52,19 @@ const selectActionsheet = async (e) => {
|
||||
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;
|
||||
}
|
||||
}
|
||||
emits('success');
|
||||
}
|
||||
|
||||
const openOpenTypeFun = () => {
|
||||
const index = SystemStore.message.findIndex(v => v.id === data.id);
|
||||
SystemStore.message[index].is_read = true;
|
||||
OpenTypeFun(data);
|
||||
emits('success');
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -7,6 +7,7 @@ import MessageCard from "../../components/MessageCard.vue";
|
||||
import useTableQuery from "../../hooks/useTableQuery.js";
|
||||
import Api from "../../api/index.js";
|
||||
import {useSystemStore} from "../../pinia/SystemStore/index.js";
|
||||
import {onShow} from "@dcloudio/uni-app";
|
||||
|
||||
const SystemStore = useSystemStore();
|
||||
const tabs = computed(() => [
|
||||
@@ -37,6 +38,7 @@ const {loading, pagination, initFetchData} = useTableQuery({
|
||||
parameter: po,
|
||||
callback: (data) => {
|
||||
Object.assign(vo, data);
|
||||
SystemStore.getMessageCount();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -44,6 +46,10 @@ const changeTab = ({index}) => {
|
||||
po.type = index;
|
||||
initFetchData();
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
SystemStore.getMessageCount();
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -18,7 +18,7 @@ const {data, home} = defineProps({
|
||||
}
|
||||
});
|
||||
|
||||
const list = computed(() => [data.comment_arr]?.flatMap(v => v.children ? [v, ...v.children] : [v]));
|
||||
const list = computed(() => data.comment_arr?.flatMap(v => v.children ? [v, ...v.children] : [v]));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -23,11 +23,13 @@ export const useSystemStore = defineStore('SystemStore', () => {
|
||||
messageCount.value.one = count;
|
||||
messageCount.value.two = message.value.filter(v => !v.is_read).length;
|
||||
|
||||
document.querySelectorAll('.uni-tabbar__item__dot').forEach(v => v.remove());
|
||||
// 生成角标
|
||||
if (messageCount.value.one + messageCount.value.two > 0) {
|
||||
const tabbar = document.querySelectorAll('.uni-tabbar__item')[2].querySelector('.uni-tabbar__bd');
|
||||
tabbar.style.position = 'relative';
|
||||
const div = document.createElement('div');
|
||||
div.className = 'uni-tabbar__item__dot';
|
||||
div.style.position = 'absolute';
|
||||
div.style.backgroundColor = 'red';
|
||||
div.style.color = 'white';
|
||||
|
||||
Reference in New Issue
Block a user