保存一下
This commit is contained in:
18
src/core/apps/department/app.json
Normal file
18
src/core/apps/department/app.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "department",
|
||||||
|
"title": "部门",
|
||||||
|
"description": "部门",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"startName": "main",
|
||||||
|
"singleton": true,
|
||||||
|
"isJustProcess": false,
|
||||||
|
"windowFormConfigs": [
|
||||||
|
{
|
||||||
|
"name": "main",
|
||||||
|
"title": "部门",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"width": 800,
|
||||||
|
"height": 600
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
9
src/core/apps/department/main.vue
Normal file
9
src/core/apps/department/main.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
部门页面
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
18
src/core/apps/fileManage/app.json
Normal file
18
src/core/apps/fileManage/app.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "fileManage",
|
||||||
|
"title": "文件管理",
|
||||||
|
"description": "文件管理",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"startName": "main",
|
||||||
|
"singleton": true,
|
||||||
|
"isJustProcess": false,
|
||||||
|
"windowFormConfigs": [
|
||||||
|
{
|
||||||
|
"name": "main",
|
||||||
|
"title": "文件管理",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"width": 800,
|
||||||
|
"height": 600
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
9
src/core/apps/fileManage/main.vue
Normal file
9
src/core/apps/fileManage/main.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
文件管理页面
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
18
src/core/apps/music/app.json
Normal file
18
src/core/apps/music/app.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "music",
|
||||||
|
"title": "音乐",
|
||||||
|
"description": "音乐",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"startName": "main",
|
||||||
|
"singleton": true,
|
||||||
|
"isJustProcess": false,
|
||||||
|
"windowFormConfigs": [
|
||||||
|
{
|
||||||
|
"name": "main",
|
||||||
|
"title": "音乐",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"width": 800,
|
||||||
|
"height": 600
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
9
src/core/apps/music/main.vue
Normal file
9
src/core/apps/music/main.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
音乐页面
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
18
src/core/apps/personalCenter/app.json
Normal file
18
src/core/apps/personalCenter/app.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "personalCenter",
|
||||||
|
"title": "个人中心",
|
||||||
|
"description": "个人中心",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"startName": "main",
|
||||||
|
"singleton": true,
|
||||||
|
"isJustProcess": false,
|
||||||
|
"windowFormConfigs": [
|
||||||
|
{
|
||||||
|
"name": "main",
|
||||||
|
"title": "个人中心",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"width": 800,
|
||||||
|
"height": 600
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
9
src/core/apps/personalCenter/main.vue
Normal file
9
src/core/apps/personalCenter/main.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
个人中心页面
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
18
src/core/apps/photograph/app.json
Normal file
18
src/core/apps/photograph/app.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "photograph",
|
||||||
|
"title": "照片",
|
||||||
|
"description": "照片",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"startName": "main",
|
||||||
|
"singleton": true,
|
||||||
|
"isJustProcess": false,
|
||||||
|
"windowFormConfigs": [
|
||||||
|
{
|
||||||
|
"name": "main",
|
||||||
|
"title": "照片",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"width": 800,
|
||||||
|
"height": 600
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
9
src/core/apps/photograph/main.vue
Normal file
9
src/core/apps/photograph/main.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
照片页面
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
18
src/core/apps/recycleBin/app.json
Normal file
18
src/core/apps/recycleBin/app.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "recycleBin",
|
||||||
|
"title": "回收站",
|
||||||
|
"description": "回收站",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"startName": "main",
|
||||||
|
"singleton": true,
|
||||||
|
"isJustProcess": false,
|
||||||
|
"windowFormConfigs": [
|
||||||
|
{
|
||||||
|
"name": "main",
|
||||||
|
"title": "回收站",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"width": 800,
|
||||||
|
"height": 600
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
9
src/core/apps/recycleBin/main.vue
Normal file
9
src/core/apps/recycleBin/main.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
回收站页面
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
18
src/core/apps/tv/app.json
Normal file
18
src/core/apps/tv/app.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "tv",
|
||||||
|
"title": "电视",
|
||||||
|
"description": "电视",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"startName": "main",
|
||||||
|
"singleton": true,
|
||||||
|
"isJustProcess": false,
|
||||||
|
"windowFormConfigs": [
|
||||||
|
{
|
||||||
|
"name": "main",
|
||||||
|
"title": "电视",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"width": 800,
|
||||||
|
"height": 600
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
9
src/core/apps/tv/main.vue
Normal file
9
src/core/apps/tv/main.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
电视页面
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
18
src/core/apps/video/app.json
Normal file
18
src/core/apps/video/app.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "video",
|
||||||
|
"title": "电影",
|
||||||
|
"description": "电影",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"startName": "main",
|
||||||
|
"singleton": true,
|
||||||
|
"isJustProcess": false,
|
||||||
|
"windowFormConfigs": [
|
||||||
|
{
|
||||||
|
"name": "main",
|
||||||
|
"title": "电影",
|
||||||
|
"icon": "iconfont icon-setting",
|
||||||
|
"width": 800,
|
||||||
|
"height": 600
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
9
src/core/apps/video/main.vue
Normal file
9
src/core/apps/video/main.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
电影页面
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts"></script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
export interface IconType {
|
export interface IDesktopAppIcon {
|
||||||
name: string;
|
name: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
path: string;
|
path: string;
|
||||||
col: number;
|
col: number;
|
||||||
row: number;
|
row: number;
|
||||||
}
|
}
|
||||||
@@ -5,8 +5,8 @@
|
|||||||
>
|
>
|
||||||
<div ref="desktopRootDom" class="desktop-root">
|
<div ref="desktopRootDom" class="desktop-root">
|
||||||
<div class="desktop-container">
|
<div class="desktop-container">
|
||||||
<div v-for="icon in iconArr" class="icon-container"
|
<div v-for="icon in appIconsRef" class="icon-container"
|
||||||
:style="`grid-row: ${icon.row}/${icon.row + 1};grid-column: ${icon.col}/${icon.col + 1}};`">{{ icon.icon }}</div>
|
:style="`grid-row: ${icon.row}/${icon.row + 1};grid-column: ${icon.col}/${icon.col + 1}};`">{{ icon.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="task-bar"></div>
|
<div class="task-bar"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -20,16 +20,15 @@ import { notificationApi } from '@/core/common/naive-ui/discrete-api.ts'
|
|||||||
import { configProviderProps } from '@/core/common/naive-ui/theme.ts'
|
import { configProviderProps } from '@/core/common/naive-ui/theme.ts'
|
||||||
import { DesktopEventEnum } from '@/core/events/EventTypes.ts'
|
import { DesktopEventEnum } from '@/core/events/EventTypes.ts'
|
||||||
import { useIconDrag } from '@/core/desktop/utils/useIconDrag.ts'
|
import { useIconDrag } from '@/core/desktop/utils/useIconDrag.ts'
|
||||||
import { onMounted, ref, useTemplateRef, watchEffect } from 'vue'
|
import type { IDesktopAppIcon } from '@/core/desktop/types/IDesktopAppIcon.ts'
|
||||||
import type { IconType } from '@/core/desktop/types/IconType.ts'
|
|
||||||
import { useDesktopInit } from '@/core/desktop/ui/useDesktopInit.ts'
|
import { useDesktopInit } from '@/core/desktop/ui/useDesktopInit.ts'
|
||||||
|
|
||||||
const props = defineProps<{ process: DesktopProcess }>()
|
const props = defineProps<{ process: DesktopProcess }>()
|
||||||
// console.log(props.process)
|
// console.log(props.process)
|
||||||
|
|
||||||
const { colCount, rowCount } = useDesktopInit('.desktop-container')
|
const { colCount, rowCount, appIconsRef } = useDesktopInit('.desktop-container')
|
||||||
|
|
||||||
const iconArr: IconType[] = [
|
const iconArr: IDesktopAppIcon[] = [
|
||||||
{
|
{
|
||||||
name: '文件管理器',
|
name: '文件管理器',
|
||||||
icon: '🗂',
|
icon: '🗂',
|
||||||
@@ -96,12 +95,13 @@ $icon-height: 110px;
|
|||||||
.icon-container {
|
.icon-container {
|
||||||
width: $icon-width;
|
width: $icon-width;
|
||||||
height: $icon-height;
|
height: $icon-height;
|
||||||
@apply flex flex-col items-center justify-center rounded text-white bg-gray-200;
|
@apply flex flex-col items-center justify-center rounded bg-gray-200;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.task-bar {
|
.task-bar {
|
||||||
@apply w-full h-[40px] bg-gray-200;
|
@apply w-full h-[40px] bg-gray-200;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
import XSystem from '@/core/XSystem.ts'
|
import XSystem from '@/core/XSystem.ts'
|
||||||
import type { IconType } from '@/core/desktop/types/IconType.ts'
|
import type { IDesktopAppIcon } from '@/core/desktop/types/IDesktopAppIcon.ts'
|
||||||
import { nextTick, onMounted, onUnmounted, reactive, toRefs, useTemplateRef } from 'vue'
|
import {
|
||||||
|
nextTick,
|
||||||
|
onMounted,
|
||||||
|
onUnmounted,
|
||||||
|
reactive,
|
||||||
|
toRefs,
|
||||||
|
useTemplateRef,
|
||||||
|
watch,
|
||||||
|
watchEffect,
|
||||||
|
} from 'vue'
|
||||||
import { DesktopEventEnum } from '@/core/events/EventTypes.ts'
|
import { DesktopEventEnum } from '@/core/events/EventTypes.ts'
|
||||||
import { useDraggable } from '@vueuse/core'
|
import { useDraggable } from '@vueuse/core'
|
||||||
|
|
||||||
@@ -19,11 +28,11 @@ export function useDesktopInit(containerStr: string) {
|
|||||||
const containerRect = entry.contentRect
|
const containerRect = entry.contentRect
|
||||||
gridTemplate.colCount = Math.floor(containerRect.width / gridTemplate.cellWidth);
|
gridTemplate.colCount = Math.floor(containerRect.width / gridTemplate.cellWidth);
|
||||||
gridTemplate.rowCount = Math.floor(containerRect.height / (gridTemplate.cellHeight));
|
gridTemplate.rowCount = Math.floor(containerRect.height / (gridTemplate.cellHeight));
|
||||||
|
console.log('resize', gridTemplate)
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
container = document.querySelector(containerStr)!
|
container = document.querySelector(containerStr)!
|
||||||
console.log( container)
|
|
||||||
ro.observe(container)
|
ro.observe(container)
|
||||||
})
|
})
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
@@ -31,12 +40,11 @@ export function useDesktopInit(containerStr: string) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 有桌面图标的app
|
// 有桌面图标的app
|
||||||
const apps = XSystem.instance.processManages.processInfos.filter(processInfo => !processInfo.isJustProcess)
|
const appInfos = XSystem.instance.processManages.processInfos.filter(processInfo => !processInfo.isJustProcess)
|
||||||
console.log(apps)
|
const appIcons: IDesktopAppIcon[] = appInfos.map((processInfo, index) => {
|
||||||
const icons: IconType[] = apps.map((processInfo, index) => {
|
// 左上角坐标原点,从上到下从左到右 索引从1开始
|
||||||
// 左上角坐标原点,从上到下从左到右
|
const x = Math.floor(index / gridTemplate.rowCount) + 1
|
||||||
const x = Math.floor(index / gridTemplate.rowCount)
|
const y = index % gridTemplate.rowCount + 1
|
||||||
const y = index % gridTemplate.rowCount
|
|
||||||
return {
|
return {
|
||||||
name: processInfo.name,
|
name: processInfo.name,
|
||||||
icon: processInfo.icon,
|
icon: processInfo.icon,
|
||||||
@@ -45,8 +53,20 @@ export function useDesktopInit(containerStr: string) {
|
|||||||
row: y
|
row: y
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const appIconsRef = reactive(appIcons)
|
||||||
|
|
||||||
|
watch(() => [gridTemplate.rowCount, gridTemplate.colCount], () => {
|
||||||
|
appIconsRef.forEach((appIcon, index) => {
|
||||||
|
const x = Math.floor(index / gridTemplate.rowCount) + 1
|
||||||
|
const y = index % gridTemplate.rowCount + 1
|
||||||
|
appIcon.col = x
|
||||||
|
appIcon.row = y
|
||||||
|
})
|
||||||
|
console.log(appIconsRef)
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(gridTemplate)
|
...toRefs(gridTemplate),
|
||||||
|
appIconsRef
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user