Sun 4c1d67b513 更新 1.3.0-beta24-01-09
Squashed commit of the following:

commit 53d1f382c5142f6a388b2d3fa13caef04a48db91
Author: Sun <95302870@qq.com>
Date:   Tue Jan 9 11:54:33 2024 +0800

    系统状态标题加上阴影,beta版本最终优化

commit fc56328765b8a4d902b59f2393f43e10f3c3dac5
Author: Sun <95302870@qq.com>
Date:   Mon Jan 8 22:37:24 2024 +0800

    磁盘监控增加表单验证

commit 3905717d420d8339e0d04443a79e69229cd10a1a
Author: Sun <95302870@qq.com>
Date:   Mon Jan 8 22:36:10 2024 +0800

    删除无用文件

commit 89b6b633107832465973656abfdb6e25be156747
Author: Sun <95302870@qq.com>
Date:   Mon Jan 8 21:10:10 2024 +0800

    修改翻译文件为json格式(为了方便引用插件)优化过期登录弹窗多个的问题

commit 2efb31571ebe5997113c75e69f973dd436cef985
Author: Sun <95302870@qq.com>
Date:   Mon Jan 8 13:56:57 2024 +0800

    增加vscode工作区文件

commit bc79b661db2defa36bdfadb13b1038e906e36d7e
Author: Sun <95302870@qq.com>
Date:   Mon Jan 8 13:56:45 2024 +0800

    暂时解决依赖循环的问题

commit a24520f8087a45abe08ee7ea864169888754a5fc
Author: Sun <95302870@qq.com>
Date:   Sun Jan 7 20:07:52 2024 +0800

    修改设置里面壁纸提示词错误的问题修改首页默认标题

commit 394c6ce20ce33cd3edf43b33ac7c1f5b23cfe89a
Author: Sun <95302870@qq.com>
Date:   Sun Jan 7 14:53:53 2024 +0800

    适配多语言
    Squashed commit of the following:

    commit 632f86c0228c68391c01865c7576f3aa0408c102
    Author: Sun <95302870@qq.com>
    Date:   Sun Jan 7 14:47:55 2024 +0800

        退出的时候清除appstore

    commit b9d805e49a3c6b2ad38bc8d527cb12cc8709012e
    Author: Sun <95302870@qq.com>
    Date:   Sun Jan 7 13:55:20 2024 +0800

        系统状态监控适配国际化

    commit daece99723ec96d210241d2ca4e5a85dc5ae69bd
    Author: Sun <95302870@qq.com>
    Date:   Sun Jan 7 13:09:46 2024 +0800

        适配添加项目页面的国际化配置还有时钟的星期*

    commit 8ea2b2fe951f6266415c96a197cb8d00faef4058
    Author: Sun <95302870@qq.com>
    Date:   Sun Jan 7 12:01:55 2024 +0800

        完成适配所有apps国际化

    commit 21ef54e0d4afb10f560c8cb7aff666374afe0f87
    Author: Sun <95302870@qq.com>
    Date:   Sat Jan 6 21:36:07 2024 +0800

        增加读取默认浏览器语言

    commit 6f710bbebe63ab2800193f27c71e5c0034f11978
    Author: Sun <95302870@qq.com>
    Date:   Sat Jan 6 21:09:58 2024 +0800

        登录页面增加语言选择选项

    commit cb7c4a89a160ed3ef91ad566ec98e75325e7601f
    Author: Sun <95302870@qq.com>
    Date:   Sat Jan 6 20:37:16 2024 +0800

        首次尝试增加英文语言,并在我的信息设置

    commit fb996e17cd11611d30c0e12feee00ddf7b225e32
    Author: Sun <95302870@qq.com>
    Date:   Sat Jan 6 18:22:40 2024 +0800

        完成基础设置页面的语言国际化适配

commit ffc378a38fa4221a9240b067660614ab43009325
Author: Sun <95302870@qq.com>
Date:   Sat Jan 6 17:35:13 2024 +0800

    增加完善基本配置中的系统状态开关

commit c91eaf3e941dfa91b7feca925109ec7121874fda
Merge: 7ebe358 a60f72c
Author: Sun <95302870@qq.com>
Date:   Sat Jan 6 12:57:05 2024 +0800

    Merge branch 'feature/monitor2' into dev

commit 7ebe35856e423bb10d8078636b0c80e472203a68
Merge: d3e3cf5 779712a
Author: Sun <95302870@qq.com>
Date:   Sat Jan 6 12:56:15 2024 +0800

    Merge branch 'feature/footer' into dev

commit a60f72c2779a4adee77f4ab161fb4fad21ff0611
Author: Sun <95302870@qq.com>
Date:   Sat Jan 6 12:55:04 2024 +0800

    优化了首页

commit 899c945fff12290f3c81348a3c262400b1a0ce15
Author: Sun <95302870@qq.com>
Date:   Sat Jan 6 12:54:19 2024 +0800

    完成系统监控

commit cdf16277ff85cee5029de3b7ea78b14bc0274623
Author: Sun <95302870@qq.com>
Date:   Sat Jan 6 12:41:38 2024 +0800

    增加删除功能

commit 128af005ebc95b73ecef8873301a61556984fbea
Author: Sun <95302870@qq.com>
Date:   Sat Jan 6 11:56:32 2024 +0800

    完成排序保存功能

commit 3f4b3c67f261f21121c8e9f7c14d926f152a5836
Author: Sun <95302870@qq.com>
Date:   Sat Jan 6 11:46:59 2024 +0800

    初步完成了增改查包括磁盘状态

commit a85d90985df45af75f8fbc165021b160d5e6500d
Author: Sun <95302870@qq.com>
Date:   Fri Jan 5 22:19:47 2024 +0800

    增加磁盘信息卡片的适配

commit c955afd86134b38620a884e9e6540eda398392e4
Author: Sun <95302870@qq.com>
Date:   Fri Jan 5 21:36:38 2024 +0800

    增加获取磁盘挂载点接口

commit 21e8e8f1b872a7e7989c45b29061f52127dffce5
Author: Sun <95302870@qq.com>
Date:   Fri Jan 5 21:14:57 2024 +0800

    基础完成了增改查cpu和内存状态

commit bdbcd50aa1b1b6958043e26be5b705430312c64c
Author: Sun <95302870@qq.com>
Date:   Fri Jan 5 14:25:09 2024 +0800

    优化公共入口组件

commit 9735e67a7d6334e39d4f58b053c32b3be25e7fa8
Author: Sun <95302870@qq.com>
Date:   Fri Jan 5 14:01:46 2024 +0800

    适配三个组件

commit 3a82949afc64147209be046f9298d55096abd0c3
Author: Sun <95302870@qq.com>
Date:   Fri Jan 5 13:58:58 2024 +0800

    优化组件

commit 0d0421c8ebc749889422c416970fd5760f2a5f6a
Author: Sun <95302870@qq.com>
Date:   Fri Jan 5 13:27:29 2024 +0800

    初步完成了编辑器

commit 1474f796fc29051b7e0813839dbb6bdc22293990
Author: Sun <95302870@qq.com>
Date:   Thu Jan 4 16:22:33 2024 +0800

    完成大图标小图标切换

commit baf64a927280fdb04579d5afeff1b5d50e56556a
Author: Sun <95302870@qq.com>
Date:   Thu Jan 4 12:08:39 2024 +0800

    增加获取各项监控的单独api

commit d3e3cf5d58168cad1e2fa3c96e2381c21aabcab4
Author: Sun <95302870@qq.com>
Date:   Wed Jan 3 20:46:58 2024 +0800

    尝试将所有监控放在顶部

commit 8dfec7e4b78cc393fad96df9d452c5f2dd4933bb
Author: Sun <95302870@qq.com>
Date:   Wed Jan 3 20:02:03 2024 +0800

    完整横条显示并对容量尺寸单位优化自动识别

commit fe967a93141472970616a5eac416c59510810b64
Author: Sun <95302870@qq.com>
Date:   Wed Jan 3 18:55:39 2024 +0800

    适配显示了cpu、硬盘、内存信息

commit 11ea134be3ce8aca9c1bf6af4610e3bb4e09eca7
Author: Sun <95302870@qq.com>
Date:   Tue Jan 2 23:14:04 2024 +0800

    完成系统监控的基础api接口

commit c447884d77349553864e0e045b83b3a4b67345da
Author: Sun <95302870@qq.com>
Date:   Tue Jan 2 22:11:34 2024 +0800

    完成基本的系统监控类库

commit 779712a5da617fa090056a5d549145f687d8db54
Author: Sun <95302870@qq.com>
Date:   Tue Jan 2 17:14:16 2024 +0800

    增加自定义footer
2024-01-09 14:03:03 +08:00

308 lines
10 KiB
Vue

<script setup lang="ts">
import { ref, watch } from 'vue'
import type { UploadFileInfo } from 'naive-ui'
import { NButton, NCard, NColorPicker, NGrid, NGridItem, NInput, NInputGroup, NPopconfirm, NSelect, NSlider, NSwitch, NUpload, NUploadDragger, useMessage } from 'naive-ui'
import { useAuthStore, usePanelState } from '@/store'
import { set as setUserConfig } from '@/api/panel/userConfig'
import { PanelPanelConfigStyleEnum } from '@/enums/panel'
import { t } from '@/locales'
const authStore = useAuthStore()
const panelState = usePanelState()
const ms = useMessage()
const showWallpaperInput = ref(false)
const isSaveing = ref(false)
const iconTypeOptions = [
{
label: t('apps.baseSettings.detailIcon'),
value: PanelPanelConfigStyleEnum.info,
},
{
label: t('apps.baseSettings.smallIcon'),
value: PanelPanelConfigStyleEnum.icon,
},
]
const maxWidthUnitOption = [
{
label: 'px',
value: 'px',
},
{
label: '%',
value: '%',
},
]
watch(panelState.panelConfig, () => {
if (!isSaveing.value) {
isSaveing.value = true
setTimeout(() => {
panelState.recordState()// 本地记录
isSaveing.value = false
uploadCloud()
}, 1000)
}
})
function handleUploadBackgroundFinish({
file,
event,
}: {
file: UploadFileInfo
event?: ProgressEvent
}) {
const res = JSON.parse((event?.target as XMLHttpRequest).response)
panelState.panelConfig.backgroundImageSrc = res.data.imageUrl
return file
}
function uploadCloud() {
setUserConfig({ panel: panelState.panelConfig }).then((res) => {
if (res.code === 0)
ms.success(t('apps.baseSettings.configSaved'))
else
ms.error(t('apps.baseSettings.configFailed', { message: res.msg }))
})
}
function resetPanelConfig() {
panelState.resetPanelConfig()
uploadCloud()
}
</script>
<template>
<div class="bg-slate-200 rounded-[10px] p-[8px] overflow-auto">
<NCard style="border-radius:10px" size="small">
<div class="text-slate-500 mb-[5px] font-bold">
LOGO
</div>
<div>
<div>
{{ $t('apps.baseSettings.textContent') }}
</div>
<div class="flex items-center mt-[5px]">
<NInput v-model:value="panelState.panelConfig.logoText" type="text" show-count :maxlength="20" placeholder="请输入文字" />
</div>
</div>
</NCard>
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
<div class="text-slate-500 mb-[5px] font-bold">
{{ $t('apps.baseSettings.clock') }}
</div>
<div class="flex items-center mt-[5px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.clockSecondShow') }}</span>
<NSwitch v-model:value="panelState.panelConfig.clockShowSecond" />
</div>
</NCard>
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
<div class="text-slate-500 mb-[5px] font-bold">
{{ $t('apps.baseSettings.searchBar') }}
</div>
<div class="flex items-center mt-[5px]">
<span class="mr-[10px]">{{ $t('common.show') }}</span>
<NSwitch v-model:value="panelState.panelConfig.searchBoxShow" />
</div>
<div v-if="panelState.panelConfig.searchBoxShow" class="flex items-center mt-[5px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.searchBarSearchItem') }}</span>
<NSwitch v-model:value="panelState.panelConfig.searchBoxSearchIcon" />
</div>
</NCard>
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
<div class="text-slate-500 mb-[5px] font-bold">
{{ $t('apps.baseSettings.systemMonitorStatus') }}
</div>
<div class="flex items-center mt-[5px]">
<span class="mr-[10px]">{{ $t('common.show') }}</span>
<NSwitch v-model:value="panelState.panelConfig.systemMonitorShow" />
</div>
<div v-if="panelState.panelConfig.systemMonitorShow" class="flex items-center mt-[5px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.showTitle') }}</span>
<NSwitch v-model:value="panelState.panelConfig.systemMonitorShowTitle" />
</div>
<div v-if="panelState.panelConfig.systemMonitorShow" class="flex items-center mt-[5px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.publicVisitModeShow') }}</span>
<NSwitch v-model:value="panelState.panelConfig.systemMonitorPublicVisitModeShow" />
</div>
</NCard>
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
<div class="text-slate-500 mb-[5px] font-bold">
{{ $t('common.icon') }}
</div>
<div class="mt-[5px]">
<div>
{{ $t('common.style') }}
</div>
<div class="flex items-center mt-[5px]">
<NSelect v-model:value="panelState.panelConfig.iconStyle" :options="iconTypeOptions" />
</div>
</div>
<div v-if="panelState.panelConfig.iconStyle === PanelPanelConfigStyleEnum.info" class="mt-[5px]">
<div>
{{ $t('apps.baseSettings.hideDescription') }}
</div>
<div class="flex items-center mt-[5px]">
<NSwitch v-model:value="panelState.panelConfig.iconTextInfoHideDescription" />
</div>
</div>
<div v-if="panelState.panelConfig.iconStyle === PanelPanelConfigStyleEnum.icon" class="mt-[5px]">
<div>
{{ $t('apps.baseSettings.hideTitle') }}
</div>
<div class="flex items-center mt-[5px]">
<NSwitch v-model:value="panelState.panelConfig.iconTextIconHideTitle" />
</div>
</div>
<div class="mt-[5px]">
<div>
{{ $t('common.textColor') }}
</div>
<div class="flex items-center mt-[5px]">
<NColorPicker
v-model:value="panelState.panelConfig.iconTextColor"
:show-alpha="false"
size="small"
:modes="['hex']"
:swatches="[
'#000000',
'#ffffff',
'#18A058',
'#2080F0',
'#F0A020',
]"
/>
</div>
</div>
</NCard>
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
<div class="text-slate-500 mb-[5px] font-bold">
{{ $t('apps.baseSettings.wallpaper') }}
</div>
<NUpload
action="/api/file/uploadImg"
:show-file-list="false"
name="imgfile"
:headers="{
token: authStore.token as string,
}"
:directory-dnd="true"
@finish="handleUploadBackgroundFinish"
>
<NUploadDragger style="width: 100%;">
<div
class="h-[200px] w-full border bg-slate-100 flex justify-center items-center cursor-pointer rounded-[10px]"
:style="{ background: `url(${panelState.panelConfig.backgroundImageSrc}) no-repeat`, backgroundSize: 'cover' }"
>
<div class="text-shadow text-white">
{{ $t('apps.baseSettings.uploadOrDragText') }}
</div>
</div>
</NUploadDragger>
</NUpload>
<div class="flex items-center mt-[5px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.customImageAddress') }}</span>
<NSwitch v-model:value="showWallpaperInput" />
</div>
<div v-if="showWallpaperInput" class="mt-1">
<NInput v-model:value="panelState.panelConfig.backgroundImageSrc" type="text" size="small" clearable />
</div>
<div class="flex items-center mt-[10px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.vague') }}</span>
<NSlider v-model:value="panelState.panelConfig.backgroundBlur" class="max-w-[200px]" :step="2" :max="20" />
</div>
<div class="flex items-center mt-[10px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.mask') }}</span>
<NSlider v-model:value="panelState.panelConfig.backgroundMaskNumber" class="max-w-[200px]" :step="0.1" :max="1" />
</div>
</NCard>
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
<div class="text-slate-500 mb-[5px] font-bold">
{{ $t('apps.baseSettings.contentArea') }}
</div>
<NGrid cols="2">
<NGridItem span="12 400:12">
<div class="flex items-center mt-[10px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.maxWidth') }}</span>
<div class="flex">
<NInputGroup>
<NInput v-model:value="panelState.panelConfig.maxWidth" size="small" type="number" :maxlength="10" :style="{ width: '100px' }" placeholder="1200" />
<NSelect v-model:value="panelState.panelConfig.maxWidthUnit" :style="{ width: '80px' }" :options="maxWidthUnitOption" size="small" />
</NInputGroup>
</div>
</div>
</NGridItem>
<NGridItem span="12 400:12">
<div class="flex items-center mt-[10px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.leftRightMargin') }}</span>
<NSlider v-model:value="panelState.panelConfig.marginX" class="max-w-[200px]" :step="1" :max="100" />
</div>
</NGridItem>
<NGridItem span="12 400:12">
<div class="flex items-center mt-[10px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.topMargin') }} (%)</span>
<NSlider v-model:value="panelState.panelConfig.marginTop" class="max-w-[200px]" :step="1" :max="50" />
</div>
</NGridItem>
<NGridItem span="12 400:6">
<div class="flex items-center mt-[10px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.bottomMargin') }} (%)</span>
<NSlider v-model:value="panelState.panelConfig.marginBottom" class="max-w-[200px]" :step="1" :max="50" />
</div>
</NGridItem>
</NGrid>
</NCard>
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
<div class="text-slate-500 mb-[5px] font-bold">
{{ $t('apps.baseSettings.customFooter') }}
</div>
<NInput
v-model:value="panelState.panelConfig.footerHtml"
type="textarea"
clearable
/>
</NCard>
<NCard style="border-radius:10px" class="mt-[10px]" size="small">
<NPopconfirm
@positive-click="resetPanelConfig"
>
<template #trigger>
<NButton size="small" quaternary type="error">
{{ $t('common.reset') }}
</NButton>
</template>
{{ $t('apps.baseSettings.resetWarnText') }}
</NPopconfirm>
<NButton size="small" quaternary type="success" class="ml-[10px]" @click="uploadCloud">
{{ $t('common.save') }}
</NButton>
</NCard>
</div>
</template>
<style scoped>
.text-shadow{
text-shadow: 0px 0px 5px gray;
}
</style>