refactor(web): 注释通知相关代码并添加临时注释说明
注释右上角通知铃铛及实时推送相关代码,添加说明后续恢复时取消注释
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
|
.pnpm-store
|
||||||
/screenshots
|
/screenshots
|
||||||
/dist
|
/dist
|
||||||
dist.zip
|
dist.zip
|
||||||
|
|||||||
@@ -196,7 +196,7 @@
|
|||||||
ref,
|
ref,
|
||||||
computed,
|
computed,
|
||||||
unref,
|
unref,
|
||||||
watch,
|
// watch, // 随右上角弹窗推送暂时注释
|
||||||
h,
|
h,
|
||||||
onMounted,
|
onMounted,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
@@ -206,12 +206,12 @@
|
|||||||
NDialogProvider,
|
NDialogProvider,
|
||||||
useDialog,
|
useDialog,
|
||||||
useMessage,
|
useMessage,
|
||||||
NAvatar,
|
// NAvatar, // 随右上角弹窗推送暂时注释
|
||||||
NTag,
|
// NTag,
|
||||||
|
// useNotification,
|
||||||
|
// NotificationReactive,
|
||||||
|
// NButton,
|
||||||
NIcon,
|
NIcon,
|
||||||
useNotification,
|
|
||||||
NotificationReactive,
|
|
||||||
NButton,
|
|
||||||
NText,
|
NText,
|
||||||
} from 'naive-ui';
|
} from 'naive-ui';
|
||||||
import { TABS_ROUTES } from '@/store/mutation-types';
|
import { TABS_ROUTES } from '@/store/mutation-types';
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
import { NotificationsOutline as NotificationsIcon } from '@vicons/ionicons5';
|
import { NotificationsOutline as NotificationsIcon } from '@vicons/ionicons5';
|
||||||
import SystemMessage from './SystemMessage.vue';
|
import SystemMessage from './SystemMessage.vue';
|
||||||
import { notificationStoreWidthOut } from '@/store/modules/notification';
|
import { notificationStoreWidthOut } from '@/store/modules/notification';
|
||||||
import { getIcon } from '@/enums/systemMessageEnum';
|
// import { getIcon } from '@/enums/systemMessageEnum'; // 随右上角弹窗推送暂时注释
|
||||||
import { availableLocales, useI18nStore } from '@/store/modules/i18n';
|
import { availableLocales, useI18nStore } from '@/store/modules/i18n';
|
||||||
import Search from './Search.vue';
|
import Search from './Search.vue';
|
||||||
|
|
||||||
@@ -392,10 +392,10 @@
|
|||||||
click: () => window.open('https://github.com/bufanyun/hotgo'),
|
click: () => window.open('https://github.com/bufanyun/hotgo'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
icon: 'BellOutlined',
|
// icon: 'BellOutlined',
|
||||||
tips: '我的消息',
|
// tips: '我的消息',
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
icon: 'LockOutlined',
|
icon: 'LockOutlined',
|
||||||
tips: '锁屏',
|
tips: '锁屏',
|
||||||
@@ -470,88 +470,90 @@
|
|||||||
openDrawer();
|
openDrawer();
|
||||||
}
|
}
|
||||||
|
|
||||||
const notification = useNotification();
|
// 通知铃铛已暂时隐藏,暂停右上角实时弹窗推送;后续恢复时取消注释(连同下方 import)
|
||||||
const getMessages = computed(() => {
|
// const notification = useNotification();
|
||||||
return notificationStore.newMessage;
|
// const getMessages = computed(() => {
|
||||||
});
|
// return notificationStore.newMessage;
|
||||||
const nRef = ref<NotificationReactive | null>(null);
|
// });
|
||||||
|
// const nRef = ref<NotificationReactive | null>(null);
|
||||||
// 监听新消息,推送通知
|
// 监听新消息,推送通知
|
||||||
watch(
|
// watch(
|
||||||
getMessages,
|
// getMessages,
|
||||||
(newVal, _oldVal) => {
|
// (newVal, _oldVal) => {
|
||||||
if (newVal === null || newVal === undefined) {
|
// if (newVal === null || newVal === undefined) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
nRef.value = notification.create({
|
// nRef.value = notification.create({
|
||||||
title: newVal.title,
|
// title: newVal.title,
|
||||||
description:
|
// description:
|
||||||
newVal.tagTitle === '' || newVal.tagTitle === undefined
|
// newVal.tagTitle === '' || newVal.tagTitle === undefined
|
||||||
? undefined
|
// ? undefined
|
||||||
: () =>
|
// : () =>
|
||||||
h(
|
// h(
|
||||||
NTag,
|
// NTag,
|
||||||
{
|
// {
|
||||||
style: {
|
// style: {
|
||||||
marginRight: '6px',
|
// marginRight: '6px',
|
||||||
},
|
// },
|
||||||
type: newVal.tagProps?.type,
|
// type: newVal.tagProps?.type,
|
||||||
bordered: false,
|
// bordered: false,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
default: () => newVal.tagTitle,
|
// default: () => newVal.tagTitle,
|
||||||
}
|
// }
|
||||||
),
|
// ),
|
||||||
|
|
||||||
content: () =>
|
// content: () =>
|
||||||
newVal.content === '' || newVal.content === undefined
|
// newVal.content === '' || newVal.content === undefined
|
||||||
? undefined
|
// ? undefined
|
||||||
: h('div', { innerHTML: '<div>' + newVal.content + '</div>' }),
|
// : h('div', { innerHTML: '<div>' + newVal.content + '</div>' }),
|
||||||
meta: newVal.createdAt,
|
// meta: newVal.createdAt,
|
||||||
avatar: () =>
|
// avatar: () =>
|
||||||
newVal.senderAvatar !== '' || newVal.senderAvatar === undefined
|
// newVal.senderAvatar !== '' || newVal.senderAvatar === undefined
|
||||||
? h(NAvatar, {
|
// ? h(NAvatar, {
|
||||||
size: 'small',
|
// size: 'small',
|
||||||
round: true,
|
// round: true,
|
||||||
src: newVal.senderAvatar,
|
// src: newVal.senderAvatar,
|
||||||
})
|
// })
|
||||||
: h(NIcon, null, { default: () => h(getIcon(newVal)) }),
|
// : h(NIcon, null, { default: () => h(getIcon(newVal)) }),
|
||||||
action: () =>
|
// action: () =>
|
||||||
h(
|
// h(
|
||||||
NButton,
|
// NButton,
|
||||||
{
|
// {
|
||||||
text: true,
|
// text: true,
|
||||||
type: 'info',
|
// type: 'info',
|
||||||
onClick: () => {
|
// onClick: () => {
|
||||||
(nRef.value as NotificationReactive).destroy();
|
// (nRef.value as NotificationReactive).destroy();
|
||||||
router.push({
|
// router.push({
|
||||||
name: 'home_message',
|
// name: 'home_message',
|
||||||
query: {
|
// query: {
|
||||||
type: newVal.type,
|
// type: newVal.type,
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
default: () => '查看详情',
|
// default: () => '查看详情',
|
||||||
}
|
// }
|
||||||
),
|
// ),
|
||||||
onClose: () => {
|
// onClose: () => {
|
||||||
nRef.value = null;
|
// nRef.value = null;
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
{ immediate: true, deep: true }
|
// { immediate: true, deep: true }
|
||||||
);
|
// );
|
||||||
|
|
||||||
const updateMenu = () => {
|
const updateMenu = () => {
|
||||||
emit('update:collapsed', !props.collapsed);
|
emit('update:collapsed', !props.collapsed);
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (notificationStore.getUnreadCount() === 0) {
|
// 通知铃铛已暂时隐藏,暂停首屏未读拉取;后续恢复铃铛时取消注释
|
||||||
notificationStore.pullMessages();
|
// if (notificationStore.getUnreadCount() === 0) {
|
||||||
}
|
// notificationStore.pullMessages();
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
|
|||||||
Reference in New Issue
Block a user