feat:新增网站通知,右上角显示,只显示一次同一个内容

This commit is contained in:
lan
2024-06-15 20:52:01 +08:00
parent f9cd9c95c3
commit c13602d634
29 changed files with 112 additions and 76 deletions
+13
View File
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { onMounted } from "vue";
import { request } from "@/utils/request";
import { ElNotification } from 'element-plus'
import { useConfigStore } from "@/stores/config";
const { config } = useConfigStore();
onMounted(() => {
request({
url:'/',
@@ -9,9 +12,19 @@ onMounted(() => {
}).then((res:any)=>{
if (res.code === 200) {
localStorage.setItem('config', JSON.stringify(res.detail));
if (config.notify_title && config.notify_content && localStorage.getItem('notify') !== config.notify_title + config.notify_content) {
localStorage.setItem('notify', config.notify_title + config.notify_content);
ElNotification({
title: config.notify_title,
dangerouslyUseHTMLString: true,
message: config.notify_content,
type: 'success'
});
}
}
})
});
</script>
<template>