4c1d67b513
Squashed commit of the following: commit53d1f382c5Author: Sun <95302870@qq.com> Date: Tue Jan 9 11:54:33 2024 +0800 系统状态标题加上阴影,beta版本最终优化 commitfc56328765Author: Sun <95302870@qq.com> Date: Mon Jan 8 22:37:24 2024 +0800 磁盘监控增加表单验证 commit3905717d42Author: Sun <95302870@qq.com> Date: Mon Jan 8 22:36:10 2024 +0800 删除无用文件 commit89b6b63310Author: Sun <95302870@qq.com> Date: Mon Jan 8 21:10:10 2024 +0800 修改翻译文件为json格式(为了方便引用插件)优化过期登录弹窗多个的问题 commit2efb31571eAuthor: Sun <95302870@qq.com> Date: Mon Jan 8 13:56:57 2024 +0800 增加vscode工作区文件 commitbc79b661dbAuthor: Sun <95302870@qq.com> Date: Mon Jan 8 13:56:45 2024 +0800 暂时解决依赖循环的问题 commita24520f808Author: Sun <95302870@qq.com> Date: Sun Jan 7 20:07:52 2024 +0800 修改设置里面壁纸提示词错误的问题修改首页默认标题 commit394c6ce20cAuthor: 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 完成基础设置页面的语言国际化适配 commitffc378a38fAuthor: Sun <95302870@qq.com> Date: Sat Jan 6 17:35:13 2024 +0800 增加完善基本配置中的系统状态开关 commitc91eaf3e94Merge:7ebe358a60f72cAuthor: Sun <95302870@qq.com> Date: Sat Jan 6 12:57:05 2024 +0800 Merge branch 'feature/monitor2' into dev commit7ebe35856eMerge:d3e3cf5779712aAuthor: Sun <95302870@qq.com> Date: Sat Jan 6 12:56:15 2024 +0800 Merge branch 'feature/footer' into dev commita60f72c277Author: Sun <95302870@qq.com> Date: Sat Jan 6 12:55:04 2024 +0800 优化了首页 commit899c945fffAuthor: Sun <95302870@qq.com> Date: Sat Jan 6 12:54:19 2024 +0800 完成系统监控 commitcdf16277ffAuthor: Sun <95302870@qq.com> Date: Sat Jan 6 12:41:38 2024 +0800 增加删除功能 commit128af005ebAuthor: Sun <95302870@qq.com> Date: Sat Jan 6 11:56:32 2024 +0800 完成排序保存功能 commit3f4b3c67f2Author: Sun <95302870@qq.com> Date: Sat Jan 6 11:46:59 2024 +0800 初步完成了增改查包括磁盘状态 commita85d90985dAuthor: Sun <95302870@qq.com> Date: Fri Jan 5 22:19:47 2024 +0800 增加磁盘信息卡片的适配 commitc955afd861Author: Sun <95302870@qq.com> Date: Fri Jan 5 21:36:38 2024 +0800 增加获取磁盘挂载点接口 commit21e8e8f1b8Author: Sun <95302870@qq.com> Date: Fri Jan 5 21:14:57 2024 +0800 基础完成了增改查cpu和内存状态 commitbdbcd50aa1Author: Sun <95302870@qq.com> Date: Fri Jan 5 14:25:09 2024 +0800 优化公共入口组件 commit9735e67a7dAuthor: Sun <95302870@qq.com> Date: Fri Jan 5 14:01:46 2024 +0800 适配三个组件 commit3a82949afcAuthor: Sun <95302870@qq.com> Date: Fri Jan 5 13:58:58 2024 +0800 优化组件 commit0d0421c8ebAuthor: Sun <95302870@qq.com> Date: Fri Jan 5 13:27:29 2024 +0800 初步完成了编辑器 commit1474f796fcAuthor: Sun <95302870@qq.com> Date: Thu Jan 4 16:22:33 2024 +0800 完成大图标小图标切换 commitbaf64a9272Author: Sun <95302870@qq.com> Date: Thu Jan 4 12:08:39 2024 +0800 增加获取各项监控的单独api commitd3e3cf5d58Author: Sun <95302870@qq.com> Date: Wed Jan 3 20:46:58 2024 +0800 尝试将所有监控放在顶部 commit8dfec7e4b7Author: Sun <95302870@qq.com> Date: Wed Jan 3 20:02:03 2024 +0800 完整横条显示并对容量尺寸单位优化自动识别 commitfe967a9314Author: Sun <95302870@qq.com> Date: Wed Jan 3 18:55:39 2024 +0800 适配显示了cpu、硬盘、内存信息 commit11ea134be3Author: Sun <95302870@qq.com> Date: Tue Jan 2 23:14:04 2024 +0800 完成系统监控的基础api接口 commitc447884d77Author: Sun <95302870@qq.com> Date: Tue Jan 2 22:11:34 2024 +0800 完成基本的系统监控类库 commit779712a5daAuthor: Sun <95302870@qq.com> Date: Tue Jan 2 17:14:16 2024 +0800 增加自定义footer
656 lines
22 KiB
Vue
656 lines
22 KiB
Vue
<script setup lang="ts">
|
|
import { VueDraggable } from 'vue-draggable-plus'
|
|
import { NBackTop, NButton, NButtonGroup, NDropdown, NModal, NSkeleton, NSpin, useDialog, useMessage } from 'naive-ui'
|
|
import { nextTick, onMounted, ref } from 'vue'
|
|
import { AppIcon, AppStarter, EditItem } from './components'
|
|
import { Clock, SearchBox, SystemMonitor } from '@/components/deskModule'
|
|
import { SvgIcon } from '@/components/common'
|
|
import { deletes, getListByGroupId, saveSort } from '@/api/panel/itemIcon'
|
|
import { getList as getGroupList } from '@/api/panel/itemIconGroup'
|
|
|
|
import { setTitle, updateLocalUserInfo } from '@/utils/cmn'
|
|
import { useAuthStore, usePanelState } from '@/store'
|
|
import { PanelPanelConfigStyleEnum, PanelStateNetworkModeEnum } from '@/enums'
|
|
import { VisitMode } from '@/enums/auth'
|
|
import { router } from '@/router'
|
|
import { t } from '@/locales'
|
|
|
|
interface ItemGroup extends Panel.ItemIconGroup {
|
|
sortStatus?: boolean
|
|
hoverStatus: boolean
|
|
items?: Panel.ItemInfo[]
|
|
}
|
|
|
|
const ms = useMessage()
|
|
const dialog = useDialog()
|
|
const panelState = usePanelState()
|
|
const authStore = useAuthStore()
|
|
|
|
const scrollContainerRef = ref<HTMLElement | undefined>(undefined)
|
|
|
|
const editItemInfoShow = ref<boolean>(false)
|
|
const editItemInfoData = ref<Panel.ItemInfo | null>(null)
|
|
const windowShow = ref<boolean>(false)
|
|
const windowSrc = ref<string>('')
|
|
const windowTitle = ref<string>('')
|
|
|
|
const windowIframeRef = ref(null)
|
|
const windowIframeIsLoad = ref<boolean>(false)
|
|
|
|
const dropdownMenuX = ref(0)
|
|
const dropdownMenuY = ref(0)
|
|
const dropdownShow = ref(false)
|
|
const currentRightSelectItem = ref<Panel.ItemInfo | null>(null)
|
|
const currentAddItenIconGroupId = ref<number | undefined>()
|
|
|
|
const settingModalShow = ref(false)
|
|
|
|
const items = ref<ItemGroup[]>([])
|
|
const filterItems = ref<ItemGroup[]>([])
|
|
|
|
function openPage(openMethod: number, url: string, title?: string) {
|
|
switch (openMethod) {
|
|
case 1:
|
|
window.location.href = url
|
|
break
|
|
case 2:
|
|
window.open(url)
|
|
break
|
|
case 3:
|
|
windowShow.value = true
|
|
windowSrc.value = url
|
|
windowTitle.value = title || url
|
|
windowIframeIsLoad.value = true
|
|
break
|
|
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
|
|
function handleItemClick(itemGroupIndex: number, item: Panel.ItemInfo) {
|
|
if (items.value[itemGroupIndex] && items.value[itemGroupIndex].sortStatus) {
|
|
handleEditItem(item)
|
|
return
|
|
}
|
|
|
|
let jumpUrl = ''
|
|
|
|
if (item)
|
|
jumpUrl = (panelState.networkMode === PanelStateNetworkModeEnum.lan ? item.lanUrl : item.url) as string
|
|
if (item.lanUrl === '')
|
|
jumpUrl = item.url
|
|
|
|
openPage(item.openMethod, jumpUrl, item.title)
|
|
}
|
|
|
|
function handWindowIframeIdLoad(payload: Event) {
|
|
windowIframeIsLoad.value = false
|
|
}
|
|
|
|
function getList() {
|
|
// 获取组数据
|
|
getGroupList<Common.ListResponse<ItemGroup[]>>().then(({ code, data, msg }) => {
|
|
if (code === 0)
|
|
items.value = data.list
|
|
for (let i = 0; i < data.list.length; i++) {
|
|
const element = data.list[i]
|
|
if (element.id)
|
|
updateItemIconGroupByNet(i, element.id)
|
|
}
|
|
filterItems.value = items.value
|
|
// console.log(items)
|
|
})
|
|
}
|
|
|
|
// 从后端获取组下面的图标
|
|
function updateItemIconGroupByNet(itemIconGroupIndex: number, itemIconGroupId: number) {
|
|
getListByGroupId<Common.ListResponse<Panel.ItemInfo[]>>(itemIconGroupId).then((res) => {
|
|
if (res.code === 0)
|
|
items.value[itemIconGroupIndex].items = res.data.list
|
|
})
|
|
}
|
|
|
|
function handleRightMenuSelect(key: string | number) {
|
|
dropdownShow.value = false
|
|
// console.log(currentRightSelectItem, key)
|
|
let jumpUrl = panelState.networkMode === PanelStateNetworkModeEnum.lan ? currentRightSelectItem.value?.lanUrl : currentRightSelectItem.value?.url
|
|
if (currentRightSelectItem.value?.lanUrl === '')
|
|
jumpUrl = currentRightSelectItem.value.url
|
|
switch (key) {
|
|
case 'newWindows':
|
|
window.open(jumpUrl)
|
|
break
|
|
case 'openWanUrl':
|
|
if (currentRightSelectItem.value)
|
|
openPage(currentRightSelectItem.value?.openMethod, currentRightSelectItem.value?.url, currentRightSelectItem.value?.title)
|
|
break
|
|
case 'openLanUrl':
|
|
if (currentRightSelectItem.value && currentRightSelectItem.value.lanUrl)
|
|
openPage(currentRightSelectItem.value?.openMethod, currentRightSelectItem.value.lanUrl, currentRightSelectItem.value?.title)
|
|
break
|
|
case 'edit':
|
|
// 这里有个奇怪的问题,如果不使用{...}的方式 父组件的值会同步修改 标记一下
|
|
handleEditItem({ ...currentRightSelectItem.value } as Panel.ItemInfo)
|
|
break
|
|
case 'delete':
|
|
dialog.warning({
|
|
title: t('common.warning'),
|
|
content: t('common.deleteConfirmByName', { name: currentRightSelectItem.value?.title }),
|
|
positiveText: t('common.confirm'),
|
|
negativeText: t('common.cancel'),
|
|
onPositiveClick: () => {
|
|
deletes([currentRightSelectItem.value?.id as number]).then(({ code, msg }) => {
|
|
if (code === 0) {
|
|
ms.success(t('common.deleteSuccess'))
|
|
getList()
|
|
}
|
|
else {
|
|
ms.error(`${t('common.deleteFail')}:${msg}`)
|
|
}
|
|
})
|
|
},
|
|
})
|
|
|
|
break
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
|
|
function handleContextMenu(e: MouseEvent, itemGroupIndex: number, item: Panel.ItemInfo) {
|
|
if (items.value[itemGroupIndex] && items.value[itemGroupIndex].sortStatus)
|
|
return
|
|
|
|
e.preventDefault()
|
|
currentRightSelectItem.value = item
|
|
dropdownShow.value = false
|
|
nextTick().then(() => {
|
|
dropdownShow.value = true
|
|
dropdownMenuX.value = e.clientX
|
|
dropdownMenuY.value = e.clientY
|
|
})
|
|
}
|
|
|
|
function onClickoutside() {
|
|
// message.info('clickoutside')
|
|
dropdownShow.value = false
|
|
}
|
|
|
|
function handleEditSuccess(item: Panel.ItemInfo) {
|
|
getList()
|
|
}
|
|
|
|
function handleChangeNetwork(mode: PanelStateNetworkModeEnum) {
|
|
panelState.setNetworkMode(mode)
|
|
if (mode === PanelStateNetworkModeEnum.lan)
|
|
ms.success(t('panelHome.changeToLanModelSuccess'))
|
|
|
|
else
|
|
ms.success(t('panelHome.changeToWanModelSuccess'))
|
|
}
|
|
|
|
// 结束拖拽
|
|
// function handleEndDrag(event: any, itemIconGroup: Panel.ItemIconGroup) {
|
|
// // console.log(event)
|
|
// // console.log(items.value)
|
|
// }
|
|
|
|
function handleSaveSort(itemGroup: ItemGroup) {
|
|
const saveItems: Common.SortItemRequest[] = []
|
|
if (itemGroup.items) {
|
|
for (let i = 0; i < itemGroup.items.length; i++) {
|
|
const element = itemGroup.items[i]
|
|
saveItems.push({
|
|
id: element.id as number,
|
|
sort: i + 1,
|
|
})
|
|
}
|
|
|
|
saveSort({ itemIconGroupId: itemGroup.id as number, sortItems: saveItems }).then(({ code, msg }) => {
|
|
if (code === 0) {
|
|
ms.success(t('common.saveSuccess'))
|
|
itemGroup.sortStatus = false
|
|
}
|
|
else {
|
|
ms.error(`${t('common.saveFail')}:${msg}`)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
function getDropdownMenuOptions() {
|
|
const dropdownMenuOptions = [
|
|
{
|
|
label: t('iconItem.newWindowOpen'),
|
|
key: 'newWindows',
|
|
},
|
|
|
|
]
|
|
|
|
if (currentRightSelectItem.value?.lanUrl && panelState.networkMode === PanelStateNetworkModeEnum.wan) {
|
|
dropdownMenuOptions.push({
|
|
label: t('panelHome.openLanUrl'),
|
|
key: 'openLanUrl',
|
|
})
|
|
}
|
|
|
|
if (currentRightSelectItem.value?.lanUrl && panelState.networkMode === PanelStateNetworkModeEnum.lan) {
|
|
dropdownMenuOptions.push({
|
|
label: t('panelHome.openWanUrl'),
|
|
key: 'openWanUrl',
|
|
})
|
|
}
|
|
|
|
if (authStore.visitMode === VisitMode.VISIT_MODE_LOGIN) {
|
|
dropdownMenuOptions.push({
|
|
label: t('common.edit'),
|
|
key: 'edit',
|
|
}, {
|
|
label: t('common.delete'),
|
|
key: 'delete',
|
|
})
|
|
}
|
|
|
|
return dropdownMenuOptions
|
|
}
|
|
|
|
onMounted(() => {
|
|
// 更新用户信息
|
|
updateLocalUserInfo()
|
|
getList()
|
|
|
|
// 更新同步云端配置
|
|
panelState.updatePanelConfigByCloud()
|
|
|
|
// 设置标题
|
|
if (panelState.panelConfig.logoText)
|
|
setTitle(panelState.panelConfig.logoText)
|
|
})
|
|
|
|
// 前端搜索过滤
|
|
function itemFrontEndSearch(keyword?: string) {
|
|
keyword = keyword?.trim()
|
|
if (keyword !== '' && panelState.panelConfig.searchBoxSearchIcon) {
|
|
const filteredData = ref<ItemGroup[]>([])
|
|
for (let i = 0; i < items.value.length; i++) {
|
|
const element = items.value[i].items?.filter((item: Panel.ItemInfo) => {
|
|
return (
|
|
item.title.toLowerCase().includes(keyword?.toLowerCase() ?? '')
|
|
|| item.url.toLowerCase().includes(keyword?.toLowerCase() ?? '')
|
|
|| item.description?.toLowerCase().includes(keyword?.toLowerCase() ?? '')
|
|
)
|
|
})
|
|
if (element && element.length > 0)
|
|
filteredData.value.push({ items: element, hoverStatus: false })
|
|
}
|
|
filterItems.value = filteredData.value
|
|
}
|
|
else {
|
|
filterItems.value = items.value
|
|
}
|
|
}
|
|
|
|
function handleSetHoverStatus(groupIndex: number, hoverStatus: boolean) {
|
|
if (items.value[groupIndex])
|
|
items.value[groupIndex].hoverStatus = hoverStatus
|
|
}
|
|
|
|
function handleSetSortStatus(groupIndex: number, sortStatus: boolean) {
|
|
if (items.value[groupIndex])
|
|
items.value[groupIndex].sortStatus = sortStatus
|
|
|
|
// 并未保存排序重新更新数据
|
|
if (!sortStatus) {
|
|
// 单独更新组
|
|
if (items.value[groupIndex] && items.value[groupIndex].id)
|
|
updateItemIconGroupByNet(groupIndex, items.value[groupIndex].id as number)
|
|
}
|
|
}
|
|
|
|
function handleEditItem(item: Panel.ItemInfo) {
|
|
editItemInfoData.value = item
|
|
editItemInfoShow.value = true
|
|
currentAddItenIconGroupId.value = undefined
|
|
}
|
|
|
|
function handleAddItem(itemIconGroupId?: number) {
|
|
editItemInfoData.value = null
|
|
editItemInfoShow.value = true
|
|
if (itemIconGroupId)
|
|
currentAddItenIconGroupId.value = itemIconGroupId
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div class="w-full h-full sun-main ">
|
|
<div
|
|
class="cover" :style="{
|
|
filter: `blur(${panelState.panelConfig.backgroundBlur}px)`,
|
|
background: `url(${panelState.panelConfig.backgroundImageSrc}) no-repeat`,
|
|
backgroundSize: 'cover',
|
|
backgroundPosition: 'center',
|
|
}"
|
|
/>
|
|
<div class="mask" :style="{ backgroundColor: `rgba(0,0,0,${panelState.panelConfig.backgroundMaskNumber})` }" />
|
|
<div ref="scrollContainerRef" class="absolute w-full h-full overflow-auto">
|
|
<div
|
|
class="p-2.5 mx-auto"
|
|
:style="{
|
|
marginTop: `${panelState.panelConfig.marginTop}%`,
|
|
marginBottom: `${panelState.panelConfig.marginBottom}%`,
|
|
maxWidth: (panelState.panelConfig.maxWidth ?? '1200') + panelState.panelConfig.maxWidthUnit,
|
|
}"
|
|
>
|
|
<!-- 头 -->
|
|
<div class="mx-[auto] w-[80%]">
|
|
<div class="flex mx-[auto] items-center justify-center text-white">
|
|
<div>
|
|
<span class="text-2xl md:text-6xl font-bold text-shadow">
|
|
{{ panelState.panelConfig.logoText }}
|
|
</span>
|
|
</div>
|
|
<div class="text-base lg:text-2xl mx-[10px]">
|
|
|
|
|
</div>
|
|
<div class="text-shadow">
|
|
<Clock :hide-second="!panelState.panelConfig.clockShowSecond" />
|
|
</div>
|
|
</div>
|
|
<div v-if="panelState.panelConfig.searchBoxShow" class="flex mt-[20px] mx-auto sm:w-full lg:w-[80%]">
|
|
<SearchBox @itemSearch="itemFrontEndSearch" />
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 应用盒子 -->
|
|
<div :style="{ marginLeft: `${panelState.panelConfig.marginX}px`, marginRight: `${panelState.panelConfig.marginX}px` }">
|
|
<!-- 系统监控状态 -->
|
|
<div
|
|
v-if="panelState.panelConfig.systemMonitorShow
|
|
&& ((panelState.panelConfig.systemMonitorPublicVisitModeShow && authStore.visitMode === VisitMode.VISIT_MODE_PUBLIC)
|
|
|| authStore.visitMode === VisitMode.VISIT_MODE_LOGIN)"
|
|
class="flex mx-auto"
|
|
>
|
|
<SystemMonitor
|
|
:allow-edit="authStore.visitMode === VisitMode.VISIT_MODE_LOGIN"
|
|
:show-title="panelState.panelConfig.systemMonitorShowTitle"
|
|
/>
|
|
</div>
|
|
|
|
<!-- 组纵向排列 -->
|
|
<div
|
|
v-for="(itemGroup, itemGroupIndex) in filterItems" :key="itemGroupIndex"
|
|
class="mt-[50px]"
|
|
:class="itemGroup.sortStatus ? 'shadow-2xl border shadow-[0_0_30px_10px_rgba(0,0,0,0.3)] p-[10px] rounded-2xl' : ''"
|
|
@mouseenter="handleSetHoverStatus(itemGroupIndex, true)"
|
|
@mouseleave="handleSetHoverStatus(itemGroupIndex, false)"
|
|
>
|
|
<!-- 分组标题 -->
|
|
<div class="text-white text-xl font-extrabold mb-[20px] ml-[10px] flex items-center">
|
|
<span class="text-shadow">
|
|
{{ itemGroup.title }}
|
|
</span>
|
|
<div
|
|
v-if="authStore.visitMode === VisitMode.VISIT_MODE_LOGIN"
|
|
class="ml-2 delay-100 transition-opacity flex"
|
|
:class="itemGroup.hoverStatus ? 'opacity-100' : 'opacity-0'"
|
|
>
|
|
<span class="mr-2 cursor-pointer" :title="t('common.add')" @click="handleAddItem(itemGroup.id)">
|
|
<SvgIcon class="text-white font-xl" icon="typcn:plus" />
|
|
</span>
|
|
<span class="mr-2 cursor-pointer " :title="t('common.sort')" @click="handleSetSortStatus(itemGroupIndex, !itemGroup.sortStatus)">
|
|
<SvgIcon class="text-white font-xl" icon="ri:drag-drop-line" />
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 详情图标 -->
|
|
<div v-if="panelState.panelConfig.iconStyle === PanelPanelConfigStyleEnum.info">
|
|
<div v-if="itemGroup.items">
|
|
<VueDraggable
|
|
v-model="itemGroup.items" item-key="sort" :animation="300"
|
|
class="icon-info-box"
|
|
filter=".not-drag"
|
|
:disabled="!itemGroup.sortStatus"
|
|
>
|
|
<div v-for="item, index in itemGroup.items" :key="index" :title="item.description" @contextmenu="(e) => handleContextMenu(e, itemGroupIndex, item)">
|
|
<AppIcon
|
|
:class="itemGroup.sortStatus ? 'cursor-move' : 'cursor-pointer'"
|
|
:item-info="item"
|
|
:icon-text-color="panelState.panelConfig.iconTextColor"
|
|
:icon-text-info-hide-description="panelState.panelConfig.iconTextInfoHideDescription || false"
|
|
:icon-text-icon-hide-title="panelState.panelConfig.iconTextIconHideTitle || false"
|
|
:style="0"
|
|
@click="handleItemClick(itemGroupIndex, item)"
|
|
/>
|
|
</div>
|
|
|
|
<div v-if="itemGroup.items.length === 0" class="not-drag">
|
|
<AppIcon
|
|
:class="itemGroup.sortStatus ? 'cursor-move' : 'cursor-pointer'"
|
|
:item-info="{ icon: { itemType: 3, text: 'subway:add' }, title: t('common.add'), url: '', openMethod: 0 }"
|
|
:icon-text-color="panelState.panelConfig.iconTextColor"
|
|
:icon-text-info-hide-description="panelState.panelConfig.iconTextInfoHideDescription || false"
|
|
:icon-text-icon-hide-title="panelState.panelConfig.iconTextIconHideTitle || false"
|
|
:style="0"
|
|
@click="handleAddItem(itemGroup.id)"
|
|
/>
|
|
</div>
|
|
</VueDraggable>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- APP图标宫型盒子 -->
|
|
<div v-if="panelState.panelConfig.iconStyle === PanelPanelConfigStyleEnum.icon">
|
|
<div v-if="itemGroup.items">
|
|
<VueDraggable
|
|
v-model="itemGroup.items" item-key="sort" :animation="300"
|
|
class="icon-small-box"
|
|
|
|
filter=".not-drag"
|
|
:disabled="!itemGroup.sortStatus"
|
|
>
|
|
<div v-for="item, index in itemGroup.items" :key="index" :title="item.description" @contextmenu="(e) => handleContextMenu(e, itemGroupIndex, item)">
|
|
<AppIcon
|
|
:class="itemGroup.sortStatus ? 'cursor-move' : 'cursor-pointer'"
|
|
:item-info="item"
|
|
:icon-text-color="panelState.panelConfig.iconTextColor"
|
|
:icon-text-info-hide-description="!panelState.panelConfig.iconTextInfoHideDescription"
|
|
:icon-text-icon-hide-title="panelState.panelConfig.iconTextIconHideTitle || false"
|
|
:style="1"
|
|
@click="handleItemClick(itemGroupIndex, item)"
|
|
/>
|
|
</div>
|
|
|
|
<div v-if="itemGroup.items.length === 0" class="not-drag">
|
|
<AppIcon
|
|
class="cursor-pointer"
|
|
:item-info="{ icon: { itemType: 3, text: 'subway:add' }, title: $t('common.add'), url: '', openMethod: 0 }"
|
|
:icon-text-color="panelState.panelConfig.iconTextColor"
|
|
:icon-text-info-hide-description="!panelState.panelConfig.iconTextInfoHideDescription"
|
|
:icon-text-icon-hide-title="panelState.panelConfig.iconTextIconHideTitle || false"
|
|
:style="1"
|
|
@click="handleAddItem(itemGroup.id)"
|
|
/>
|
|
</div>
|
|
</vuedraggable>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 编辑栏 -->
|
|
<div v-if="itemGroup.sortStatus" class="flex mt-[10px]">
|
|
<div>
|
|
<NButton color="#2a2a2a6b" @click="handleSaveSort(itemGroup)">
|
|
<template #icon>
|
|
<SvgIcon class="text-white font-xl" icon="material-symbols:save" />
|
|
</template>
|
|
<div>
|
|
{{ $t('common.saveSort') }}
|
|
</div>
|
|
</NButton>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="mt-5 footer" v-html="panelState.panelConfig.footerHtml" />
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 右键菜单 -->
|
|
<NDropdown
|
|
placement="bottom-start" trigger="manual" :x="dropdownMenuX" :y="dropdownMenuY"
|
|
:options="getDropdownMenuOptions()" :show="dropdownShow" :on-clickoutside="onClickoutside" @select="handleRightMenuSelect"
|
|
/>
|
|
|
|
<!-- 悬浮按钮 -->
|
|
<div class="fixed-element shadow-[0_0_10px_2px_rgba(0,0,0,0.2)]">
|
|
<NButtonGroup vertical>
|
|
<NButton
|
|
v-if="panelState.networkMode === PanelStateNetworkModeEnum.lan" color="#2a2a2a6b"
|
|
:title="t('panelHome.changeToWanModel')" @click="handleChangeNetwork(PanelStateNetworkModeEnum.wan)"
|
|
>
|
|
<template #icon>
|
|
<SvgIcon class="text-white font-xl" icon="material-symbols:lan-outline-rounded" />
|
|
</template>
|
|
</NButton>
|
|
|
|
<NButton
|
|
v-if="panelState.networkMode === PanelStateNetworkModeEnum.wan" color="#2a2a2a6b"
|
|
:title="t('panelHome.changeToLanModel')" @click="handleChangeNetwork(PanelStateNetworkModeEnum.lan)"
|
|
>
|
|
<template #icon>
|
|
<SvgIcon class="text-white font-xl" icon="mdi:wan" />
|
|
</template>
|
|
</NButton>
|
|
|
|
<NButton v-if="authStore.visitMode === VisitMode.VISIT_MODE_LOGIN" color="#2a2a2a6b" @click="settingModalShow = !settingModalShow">
|
|
<template #icon>
|
|
<SvgIcon class="text-white font-xl" icon="majesticons-applications" />
|
|
</template>
|
|
</NButton>
|
|
|
|
<NButton v-if="authStore.visitMode === VisitMode.VISIT_MODE_PUBLIC" color="#2a2a2a6b" :title="$t('panelHome.goToLogin')" @click="router.push('/login')">
|
|
<template #icon>
|
|
<SvgIcon class="text-white font-xl" icon="material-symbols:account-circle" />
|
|
</template>
|
|
</NButton>
|
|
</NButtonGroup>
|
|
|
|
<NBackTop
|
|
:listen-to="() => scrollContainerRef"
|
|
:right="10"
|
|
:bottom="10"
|
|
style="background-color:transparent;border: none;box-shadow: none;"
|
|
>
|
|
<div class="shadow-[0_0_10px_2px_rgba(0,0,0,0.2)]">
|
|
<NButton color="#2a2a2a6b">
|
|
<template #icon>
|
|
<SvgIcon class="text-white font-xl" icon="icon-park-outline:to-top" />
|
|
</template>
|
|
</NButton>
|
|
</div>
|
|
</NBackTop>
|
|
|
|
<AppStarter v-model:visible="settingModalShow" />
|
|
<!-- <Setting v-model:visible="settingModalShow" /> -->
|
|
</div>
|
|
|
|
<EditItem v-model:visible="editItemInfoShow" :item-info="editItemInfoData" :item-group-id="currentAddItenIconGroupId" @done="handleEditSuccess" />
|
|
|
|
<!-- 弹窗 -->
|
|
<NModal
|
|
v-model:show="windowShow" :mask-closable="false" preset="card"
|
|
style="max-width: 1000px;height: 600px;border-radius: 1rem;" :bordered="false" size="small" role="dialog"
|
|
aria-modal="true"
|
|
>
|
|
<template #header>
|
|
<div class="flex items-center">
|
|
<span class="mr-[20px]">
|
|
{{ windowTitle }}
|
|
</span>
|
|
|
|
<NSpin v-if="windowIframeIsLoad" size="small" />
|
|
</div>
|
|
</template>
|
|
<div class="w-full h-full rounded-2xl overflow-hidden border">
|
|
<NSkeleton v-if="windowIframeIsLoad" height="100%" width="100%" />
|
|
<iframe
|
|
v-show="!windowIframeIsLoad" id="windowIframeId" ref="windowIframeRef" :src="windowSrc"
|
|
class="w-full h-full" frameborder="0" @load="handWindowIframeIdLoad"
|
|
/>
|
|
</div>
|
|
</NModal>
|
|
</div>
|
|
</template>
|
|
|
|
<style>
|
|
body,
|
|
html {
|
|
overflow: hidden;
|
|
background-color: rgb(54, 54, 54);
|
|
}
|
|
</style>
|
|
|
|
<style scoped>
|
|
.mask {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.sun-main {
|
|
user-select: none;
|
|
}
|
|
|
|
.cover {
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
/* background: url(@/assets/start_sky.jpg) no-repeat; */
|
|
|
|
transform: scale(1.05);
|
|
}
|
|
|
|
.text-shadow {
|
|
text-shadow: 2px 2px 50px rgb(0, 0, 0);
|
|
}
|
|
|
|
.app-icon-text-shadow {
|
|
text-shadow: 2px 2px 5px rgb(0, 0, 0);
|
|
}
|
|
|
|
.fixed-element {
|
|
position: fixed;
|
|
/* 将元素固定在屏幕上 */
|
|
right: 10px;
|
|
/* 距离屏幕顶部的距离 */
|
|
bottom: 50px;
|
|
/* 距离屏幕左侧的距离 */
|
|
}
|
|
|
|
.icon-info-box {
|
|
width: 100%;
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
|
gap: 18px;
|
|
|
|
}
|
|
|
|
.icon-small-box {
|
|
width: 100%;
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
|
|
gap: 18px;
|
|
|
|
}
|
|
|
|
@media (max-width: 500px) {
|
|
.icon-info-box{
|
|
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
|
}
|
|
}
|
|
</style>
|