vue3实现内置文件管理、录音、拍照、多tab浏览器、记事本等窗口的window11桌面操作系统代码,

代码语言:html

所属分类:其他

代码描述:vue3实现内置文件管理、录音、拍照、多tab浏览器、记事本等窗口的window11桌面操作系统代码,数据存储在本地。

代码标签: vue 模拟 window 桌面 操作 系统 ui 代码 文件 管理 录音 拍照 浏览器

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Windows 11 - UI 原型 </title>
    <!-- Vue 2 CDN -->
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue@2.6.1-dev.js"></script>
    
    <!-- ECharts CDN (备用) -->
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/echarts.5.5.0.js"></script>
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/bootstrap-icons.1.8.1.css">

    <style>
        /* --- 全局与主题 --- */
        :root {
            --win-bg: #0d1117;
            --taskbar-bg: rgba(30, 30, 30, 0.7);
            --window-bg: rgba(40, 40, 40, 0.85);
            --start-menu-bg: rgba(35, 35, 35, 0.85);
            --accent-blue: #0078d4;
            --text-color: #ffffff;
            --text-secondary: #cccccc;
            --border-color: rgba(128, 128, 128, 0.3);
            --font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
            --win-border-radius: 8px;
        }

        * { box-sizing: border-box; }
        html, body {
            margin: 0;
            padding: 0;
            height: 100%;
            width: 100%;
            overflow: hidden;
            font-family: var(--font-family);
            color: var(--text-color);
            user-select: none;
        }

        #app {
            height: 100%;
            width: 100%;
            background-size: cover;
            background-position: center;
            transition: background-image 0.5s ease-in-out;
        }

        /* --- Bootstrap Icons 样式调整 --- */
        .bi {
            font-size: 16px;
            vertical-align: middle;
        }
        
        /* --- 登录与锁屏界面 --- */
        .auth-screen {
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background-size: cover;
            background-position: center;
            backdrop-filter: blur(20px);
            z-index: 10000;
        }
        .auth-box {
            background: rgba(0, 0, 0, 0.4);
            padding: 40px;
            border-radius: var(--win-border-radius);
            text-align: center;
            border: 1px solid var(--border-color);
        }
        .auth-avatar { width: 100px; height: 100px; border-radius: 50%; margin-bottom: 20px; }
        .auth-user { font-size: 1.5rem; margin-bottom: 20px; }
        .password-input {
            padding: 10px 15px;
            width: 250px;
            border: 1px solid var(--border-color);
            background: rgba(255, 255, 255, 0.1);
            color: var(--text-color);
            border-radius: 5px;
            font-size: 1rem;
            outline: none;
        }
        .password-input:focus { border-color: var(--accent-blue); }
        .auth-error { color: #ff7675; margin-top: 10px; height: 1em; }

        /* --- 屏保 --- */
        .screensaver {
            position: absolute; top: 0; left: 0;
            width: 100%; height: 100%;
            background: #000;
            z-index: 9999;
            animation: screensaver-fade-in 1s ease;
        }
        @keyframes screensaver-fade-in { from { opacity: 0; } to { opacity: 1; } }
        .screensaver-content {
            position: absolute;
            color: white;
            font-size: 3rem;
            font-weight: bold;
            animation: float 20s infinite linear;
            display: flex;
            align-items: center;
            gap: 20px;
        }
        @keyframes float {
            0% { transform: translate(5vw, 10vh); }
            25% { transform: translate(60vw, 80vh); }
            50% { transform: translate(70vw, 20vh); }
            75% { transform: translate(10vw, 50vh); }
            100% { transform: translate(5vw, 10vh); }
        }
        
        /* --- 桌面 --- */
        .desktop {
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: calc(100% - 48px); /* 减去任务栏高度 */
            padding: 10px;
            display: flex;
            flex-direction: column;
            flex-wrap: wrap;
            align-content: flex-start;
            gap: 5px;
        }
        .desktop-icon {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 90px;
            height: 90px;
            padding: 5px 0;
            border-radius: 5px;
            cursor: pointer;
            border: 1px solid transparent;
        }
        .desktop-icon:hover { background: rgba(255, 255, 255, 0.1); }
        .desktop-icon.selected { background: rgba(0, 120, 212, 0.4); border-color: rgba(0, 120, 212, 0.8); }
        .desktop-icon i { font-size: 36px; margin-bottom: 5px; color: #FFCA28; } /* Default folder color */
        .desktop-icon i.bi-file-earmark-text { color: #fff; } /* File color */
        .desktop-icon span { font-size: 12px; text-align: center; text-shadow: 1px 1px 2px black; word-break: break-word; color: white; padding: 2px 4px; border-radius: 3px; }
        .desktop-icon input {
            width: 100%; text-align: center; background: #eee; color: #000; border: 1px solid var(--accent-blue); outline: none; font-size: 12px;
        }


        /* --- 右键菜单 --- */
        .context-menu {
            position: absolute;
            background: var(--start-menu-bg);
            backdrop-filter: blur(15px);
            border: 1px solid var(--border-color);
            border-radius: var(--win-border-radius);
            padding: 5px;
            min-width: 220px;
            z-index: 5000;
        }
        .context-menu-item {
            padding: 8px 15px;
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            border-radius: 5px;
        }
        .context-menu-item:hover { background: rgba(255, 255, 255, 0.1); }
        .context-menu-item.disabled { color: #888; cursor: not-allowed; }
        .context-menu-item.disabled:hover { background: none; }
        .context-menu-separator { height: 1px; background: var(--border-color); margin: 5px; }

        /* --- 任务栏 --- */
        .taskbar {
            position: absolute;
            bottom: 0; left: 0;
            width: 100%; height: 48px;
            background: var(--taskbar-bg);
            backdrop-filter: blur(20px);
            display: flex;
            justify-content: space-between;
            align-items: center;
            z-index: 4000;
        }
        .taskbar-center {
            display: flex;
            justify-content: center;
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            height: 100%;
        }
        .taskbar-item {
            padding: 0 12px;
            height: 100%;
            display: flex;
            align-items: center;
            position: relative;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        .taskbar-item:hover { background: rgba(255, 255, 255, 0.1); }
        .taskbar-item.active::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 20px;
            height: 3px;
            background: var(--accent-blue);
            border-radius: 2px;
        }
        .taskbar-item i { font-size: 24px; }
        
        .system-tray {
            display: flex;
            align-items: center;
            padding-right: 15px;
            gap: 15px;
        }
        .time-display {
            text-align: right;
            font-size: 12px;
            line-height: 1.2;
        }

        /* --- 开始菜单 --- */
        .start-menu {
            position: absolute;
            bottom: 58px; /* 任务栏高度 + 间距 */
            left: 50%;
            transform: translateX(-50%);
            width: 600px;
            height: 650px;
            background: var(--start-menu-bg);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: var(--win-border-radius);
            z-index: 3999;
            padding: 20px;
            display: flex;
            flex-direction: column;
            animation: slide-up 0.3s ease-out;
        }
        @keyframes slide-up { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

        .start-menu-pinned { padding: 10px; }
        .start-menu-header { display: flex; justify-content: space-between; align-items: center; padding: 0 10px; }
        .start-menu-grid {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 10px;
            margin-top: 10px;
        }
        .start-menu-app {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 10px;
            border-radius: 5px;
            cursor: pointer;
        }
        .start-menu-app:hover { background: rgba(255, 255, 255, 0.1); }
        .start-menu-app i { font-size: 32px; margin-bottom: 8px; }
        .start-menu-app span { font-size: 12px; }

        .start-menu-footer {
            margin-top: auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px;
            background: rgba(0,0,0,0.2);
            border-radius: 5px;
        }
        .user-profile, .power-controls { display: flex; align-items: center; gap: 10px; padding: 5px; border-radius: 5px; cursor: pointer; }
        .user-profile:hover, .power-controls:hover { background: rgba(255, 255, 255, 0.1); }
        .user-profile img { width: 32px; height: 32px; border-radius: 50%; }

        /* --- 窗口管理器 --- */
        .window {
            position: absolute;
            background: var(--window-bg);
            backdrop-filter: blur(25px);
            border: 1px solid var(--border-color);
            border-radius: var(--win-border-radius);
            box-shadow: 0 10px 30px rgba(0,0,0,0.3);
            display: flex;
            flex-direction: column;
            min-width: 300px;
            min-height: 200px;
            transition: opacity 0.2s, transform 0.2s;
        }
        .window.minimized {
            opacity: 0;
            transform: translateY(100vh);
        }

        .title-bar {
            height: 32px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-left: 10px;
            cursor: move;
            flex-shrink: 0;
        }
        .title-bar-text { display: flex; align-items: center; gap: 8px; font-size: 13px; }
        .title-bar-text i { font-size: 16px; }
        .title-bar-controls { display: flex; height: 100%; }
        .title-bar-btn {
            width: 46px; height: 100%;
            display: flex; justify-content: center; align-items: center;
            cursor: pointer;
        }
        .title-bar-btn:hover { background: rgba(255, 255, 255, 0.1); }
        .title-bar-btn.close:hover { background: #e81123; }

        .window-content {
            flex-grow: 1;
            position: relative;
            overflow: auto;
            background-color: #2b2b2b;
            border-bottom-left-radius: var(--win-border-radius);
            border-bottom-right-radius: var(--win-border-radius);
        }
        .resize-handle { position: absolute; width: 10px; height: 10px; }
        .resize-handle.bottom-right { bottom: 0; right: 0; cursor: nwse-resize; }

        /.........完整代码请登录后点击上方下载按钮下载查看

网友评论0