feat:新增网站通知,右上角显示,只显示一次同一个内容
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -66,7 +66,7 @@ const handleSubmitShareText = ()=>{
|
||||
:input-style="{'border-radius':'20px','border':'1px dashed var(--el-border-color)','box-shadow':'none'}"
|
||||
>
|
||||
</el-input>
|
||||
<el-button @click="handleSubmitShareText" style="position: absolute;right: 0;top: 0;border-radius: 0 20px 0 20px;margin: 1px;background: rgba(255,255,255,0.2)" size="large">{{t('send.share')}}</el-button>
|
||||
<el-button @click="handleSubmitShareText" style="position: absolute;right: 0;bottom: 0;border-radius: 20px 0 20px 0;margin: 1px;background: rgba(255,255,255,0.2)" size="large">{{t('send.share')}}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ export default {
|
||||
explain:'界面说明',
|
||||
errorlimit: '错误限制',
|
||||
keywords: '关键词',
|
||||
notify_title: '通知标题',
|
||||
notify_content: '通知内容',
|
||||
background: '背景图片',
|
||||
max_save_seconds: '最长保存',
|
||||
maxSaveSecondsNote: '最长保存时间,单位:(秒),默认为0则为7天',
|
||||
@@ -104,6 +106,8 @@ export default {
|
||||
systemSetting: '系统设置',
|
||||
about: '关于我们',
|
||||
color: '颜色模式',
|
||||
send: '寄件',
|
||||
receive: '收件',
|
||||
signout: '退出登录',
|
||||
},
|
||||
login: {
|
||||
|
||||
@@ -53,7 +53,15 @@ const menus = ref([
|
||||
{
|
||||
name: t('admin.menu.about'),
|
||||
path: '/admin/about',
|
||||
}
|
||||
},
|
||||
{
|
||||
name: t('admin.menu.send'),
|
||||
path: '/#/send',
|
||||
},
|
||||
{
|
||||
name: t('admin.menu.receive'),
|
||||
path: '/#/',
|
||||
},
|
||||
]);
|
||||
const refreshLoginStatus = () => {
|
||||
adminData.updateAdminPwd(adminData.adminPassword);
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
<el-form-item size="large" :label="t('admin.settings.keywords')" style="letter-spacing: 0.3rem">
|
||||
<el-input v-model="config.keywords" />
|
||||
</el-form-item>
|
||||
<el-form-item size="large" :label="t('admin.settings.notify_title')">
|
||||
<el-input v-model="config.notify_title" />
|
||||
</el-form-item>
|
||||
<el-form-item size="large" :label="t('admin.settings.notify_content')">
|
||||
<el-input v-model="config.notify_content" />
|
||||
</el-form-item>
|
||||
<el-form-item size="large" :label="t('admin.settings.background')">
|
||||
<el-input v-model="config.background" placeholder="url" />
|
||||
</el-form-item>
|
||||
@@ -125,6 +131,8 @@ const config = ref({
|
||||
expireStyle: [],
|
||||
admin_token: '',
|
||||
keywords: '',
|
||||
notify_title: '',
|
||||
notify_content: '',
|
||||
openUpload: 1,
|
||||
uploadSize: 1,
|
||||
uploadMinute: 1,
|
||||
|
||||
Reference in New Issue
Block a user