├── .browserslistrc
├── .eslintrc.js
├── .gitignore
├── .workflow
├── branch-pipeline.yml
├── master-pipeline.yml
├── pipeline-20220810.yml
└── pr-pipeline.yml
├── LICENSE
├── README.md
├── babel.config.js
├── doc
├── README.md
├── 应用菜单配置.md
├── 应用配置说明.md
├── 目录说明.md
└── 窗口API.md
├── package.json
├── public
├── favicon.ico
├── index.html
└── robots.txt
├── src
├── MacOS.vue
├── asset
│ ├── css
│ │ ├── animation.css
│ │ └── app.css
│ ├── fonts
│ │ ├── Gotham-Book.woff2
│ │ ├── element-icons.ttf
│ │ └── element-icons.woff
│ └── img
│ │ ├── bg.jpg
│ │ └── mac.jpg
├── components
│ ├── App.vue
│ ├── Bg.vue
│ ├── DeskTop.vue
│ ├── Dock.vue
│ ├── LaunchPad.vue
│ ├── Loading.vue
│ ├── Login.vue
│ └── Widget.vue
├── config.js
├── helper
│ ├── request.js
│ └── tool.js
├── main.js
├── model
│ └── App.js
├── store
│ └── App.js
└── view
│ ├── demo
│ ├── camera.vue
│ ├── colorfull.vue
│ ├── demo.vue
│ ├── dock.vue
│ ├── hidedesktop.vue
│ ├── multitask.vue
│ ├── unclose.vue
│ ├── unresize.vue
│ └── web.vue
│ └── system
│ ├── about.vue
│ ├── finder.vue
│ ├── setting.vue
│ ├── store.vue
│ └── task.vue
└── yarn.lock
/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not dead
4 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | node: true
5 | },
6 | 'extends': [
7 | 'plugin:vue/vue3-essential',
8 | 'eslint:recommended'
9 | ],
10 | parserOptions: {
11 | parser: 'babel-eslint'
12 | },
13 | rules: {
14 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
15 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | package-lock.json
4 | /dist
5 |
6 |
7 | # local env files
8 | .env.local
9 | .env.*.local
10 |
11 | # Log files
12 | npm-debug.log*
13 | yarn-debug.log*
14 | yarn-error.log*
15 | pnpm-debug.log*
16 |
17 | # Editor directories and files
18 | .idea
19 | .vscode
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/.workflow/branch-pipeline.yml:
--------------------------------------------------------------------------------
1 | version: '1.0'
2 | name: branch-pipeline
3 | displayName: BranchPipeline
4 | stages:
5 | - stage:
6 | name: compile
7 | displayName: 编译
8 | steps:
9 | - step: build@nodejs
10 | name: build_nodejs
11 | displayName: Nodejs 构建
12 | # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
13 | nodeVersion: 14.16.0
14 | # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
15 | commands:
16 | - npm install && rm -rf ./dist && npm run build
17 | # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
18 | artifacts:
19 | # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
20 | - name: BUILD_ARTIFACT
21 | # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
22 | path:
23 | - ./dist
24 | - step: publish@general_artifacts
25 | name: publish_general_artifacts
26 | displayName: 上传制品
27 | # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
28 | dependArtifact: BUILD_ARTIFACT
29 | # 上传到制品库时的制品命名,默认output
30 | artifactName: output
31 | dependsOn: build_nodejs
32 | - stage:
33 | name: release
34 | displayName: 发布
35 | steps:
36 | - step: publish@release_artifacts
37 | name: publish_release_artifacts
38 | displayName: '发布'
39 | # 上游上传制品任务的产出
40 | dependArtifact: output
41 | # 发布制品版本号
42 | version: '1.0.0.0'
43 | # 是否开启版本号自增,默认开启
44 | autoIncrement: true
45 | triggers:
46 | push:
47 | branches:
48 | exclude:
49 | - master
50 | include:
51 | - .*
52 |
--------------------------------------------------------------------------------
/.workflow/master-pipeline.yml:
--------------------------------------------------------------------------------
1 | version: '1.0'
2 | name: master-pipeline
3 | displayName: MasterPipeline
4 | triggers:
5 | trigger: auto
6 | push:
7 | branches:
8 | include:
9 | - master
10 | stages:
11 | - name: compile
12 | displayName: 编译
13 | strategy: naturally
14 | trigger: auto
15 | steps:
16 | - step: build@nodejs
17 | name: build_nodejs
18 | displayName: Nodejs 构建
19 | nodeVersion: 14.16.0
20 | commands:
21 | - npm install && rm -rf ./dist && npm run build
22 | artifacts:
23 | - name: BUILD_ARTIFACT
24 | path:
25 | - ./dist
26 | strategy: {}
27 | - step: publish@general_artifacts
28 | name: publish_general_artifacts
29 | displayName: 上传制品
30 | dependArtifact: BUILD_ARTIFACT
31 | artifactName: output
32 | strategy: {}
33 | dependsOn: build_nodejs
34 | - name: release
35 | displayName: 发布
36 | strategy: naturally
37 | trigger: auto
38 | steps:
39 | - step: deploy@agent
40 | name: deploy_agent
41 | displayName: 主机部署
42 | hostGroupID: 服务器
43 | deployArtifact:
44 | - source: build
45 | name: output
46 | target: ~/gitee_go/deploy
47 | dependArtifact: BUILD_ARTIFACT
48 | script:
49 | - 'rm -rf /home/www/mac.hamm.cn/* && '
50 | - tar zxvf ~/gitee_go/deploy/output.tar.gz -C /home/www/mac.hamm.cn
51 | notify: []
52 | strategy:
53 | retry: '0'
54 |
--------------------------------------------------------------------------------
/.workflow/pipeline-20220810.yml:
--------------------------------------------------------------------------------
1 | version: '1.0'
2 | name: pipeline-20220810
3 | displayName: pipeline-20220810
4 | triggers:
5 | trigger: auto
6 | stages:
7 | - name: stage-da9628c7
8 | displayName: 未命名
9 | strategy: naturally
10 | trigger: auto
11 | executor: []
12 | steps:
13 | - step: build@nodejs
14 | name: build_nodejs
15 | displayName: Nodejs 构建
16 | nodeVersion: 14.16.0
17 | commands:
18 | - '# 设置NPM源,提升安装速度'
19 | - npm config set registry https://registry.npmmirror.com
20 | - ''
21 | - '# 执行编译命令'
22 | - npm install && npm run build
23 | artifacts:
24 | - name: BUILD_ARTIFACT
25 | path:
26 | - ./dist
27 | caches:
28 | - ~/.npm
29 | - ~/.yarn
30 | notify: []
31 | strategy:
32 | retry: '0'
33 | - name: stage-ed1d034c
34 | displayName: 未命名
35 | strategy: naturally
36 | trigger: auto
37 | executor: []
38 | steps:
39 | - step: deploy@agent
40 | name: deploy_agent
41 | displayName: 主机部署
42 | hostGroupID: 服务器
43 | deployArtifact:
44 | - source: artifact
45 | name: output
46 | target: ~/gitee_go/deploy
47 | artifactRepository: default
48 | artifactName: output
49 | artifactVersion: latest
50 | script:
51 | - '# 功能:部署脚本会在部署主机组的每台机器上执行'
52 | - '# 使用场景:先将制品包解压缩到指定目录中,再执行启动脚本deploy.sh,脚本示例地址:https://gitee.com/gitee-go/spring-boot-maven-deploy-case/blob/master/deploy.sh'
53 | - '# mkdir -p /home/admin/app'
54 | - '# tar zxvf ~/gitee_go/deploy/output.tar.gz -C /home/admin/app'
55 | - '# sh /home/admin/app/deploy.sh restart'
56 | - '# 如果你是php之类的无需制品包的制品方式,可以使用 git clone 或者 git pull 将源代码更新到服务器,再执行其他命令'
57 | - '# git clone ***@***.git'
58 | - echo 'Hello Gitee Go!'
59 | notify: []
60 | strategy:
61 | retry: '0'
62 |
--------------------------------------------------------------------------------
/.workflow/pr-pipeline.yml:
--------------------------------------------------------------------------------
1 | version: '1.0'
2 | name: pr-pipeline
3 | displayName: PRPipeline
4 | stages:
5 | - stage:
6 | name: compile
7 | displayName: 编译
8 | steps:
9 | - step: build@nodejs
10 | name: build_nodejs
11 | displayName: Nodejs 构建
12 | # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
13 | nodeVersion: 14.16.0
14 | # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
15 | commands:
16 | - npm install && rm -rf ./dist && npm run build
17 | # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
18 | artifacts:
19 | # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
20 | - name: BUILD_ARTIFACT
21 | # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
22 | path:
23 | - ./dist
24 | - step: publish@general_artifacts
25 | name: publish_general_artifacts
26 | displayName: 上传制品
27 | # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
28 | dependArtifact: BUILD_ARTIFACT
29 | # 上传到制品库时的制品命名,默认output
30 | artifactName: output
31 | dependsOn: build_nodejs
32 | triggers:
33 | pr:
34 | branches:
35 | include:
36 | - master
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | 木兰宽松许可证, 第2版
2 |
3 | 木兰宽松许可证, 第2版
4 | 2020年1月 http://license.coscl.org.cn/MulanPSL2
5 |
6 |
7 | 您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束:
8 |
9 | 0. 定义
10 |
11 | “软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。
12 |
13 | “贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。
14 |
15 | “贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。
16 |
17 | “法人实体”是指提交贡献的机构及其“关联实体”。
18 |
19 | “关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。
20 |
21 | 1. 授予版权许可
22 |
23 | 每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。
24 |
25 | 2. 授予专利许可
26 |
27 | 每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。
28 |
29 | 3. 无商标许可
30 |
31 | “本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。
32 |
33 | 4. 分发限制
34 |
35 | 您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。
36 |
37 | 5. 免责声明与责任限制
38 |
39 | “软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
40 |
41 | 6. 语言
42 | “本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。
43 |
44 | 条款结束
45 |
46 | 如何将木兰宽松许可证,第2版,应用到您的软件
47 |
48 | 如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步:
49 |
50 | 1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字;
51 |
52 | 2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中;
53 |
54 | 3, 请将如下声明文本放入每个源文件的头部注释中。
55 |
56 | Copyright (c) [Year] [name of copyright holder]
57 | [Software Name] is licensed under Mulan PSL v2.
58 | You can use this software according to the terms and conditions of the Mulan PSL v2.
59 | You may obtain a copy of Mulan PSL v2 at:
60 | http://license.coscl.org.cn/MulanPSL2
61 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
62 | See the Mulan PSL v2 for more details.
63 |
64 |
65 | Mulan Permissive Software License,Version 2
66 |
67 | Mulan Permissive Software License,Version 2 (Mulan PSL v2)
68 | January 2020 http://license.coscl.org.cn/MulanPSL2
69 |
70 | Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions:
71 |
72 | 0. Definition
73 |
74 | Software means the program and related documents which are licensed under this License and comprise all Contribution(s).
75 |
76 | Contribution means the copyrightable work licensed by a particular Contributor under this License.
77 |
78 | Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
79 |
80 | Legal Entity means the entity making a Contribution and all its Affiliates.
81 |
82 | Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.
83 |
84 | 1. Grant of Copyright License
85 |
86 | Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
87 |
88 | 2. Grant of Patent License
89 |
90 | Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.
91 |
92 | 3. No Trademark License
93 |
94 | No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4.
95 |
96 | 4. Distribution Restriction
97 |
98 | You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.
99 |
100 | 5. Disclaimer of Warranty and Limitation of Liability
101 |
102 | THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
103 |
104 | 6. Language
105 |
106 | THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL.
107 |
108 | END OF THE TERMS AND CONDITIONS
109 |
110 | How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software
111 |
112 | To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps:
113 |
114 | i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;
115 |
116 | ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package;
117 |
118 | iii Attach the statement to the appropriate annotated syntax at the beginning of each source file.
119 |
120 |
121 | Copyright (c) [Year] [name of copyright holder]
122 | [Software Name] is licensed under Mulan PSL v2.
123 | You can use this software according to the terms and conditions of the Mulan PSL v2.
124 | You may obtain a copy of Mulan PSL v2 at:
125 | http://license.coscl.org.cn/MulanPSL2
126 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
127 | See the Mulan PSL v2 for more details.
128 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MacOS WebUI
2 |
3 |
4 |
5 |
6 |
7 |
8 | ---
9 |
10 | ### 项目介绍
11 | 一套基于Vue3和ElementUI实现类似MacOS风格的WebUI,尽可能还原MacOS相关的设计,目前正在开发中。
12 | QQ群:1140258698
13 |
14 | ### 体验地址
15 |
16 | 点击查看我们的在线DEMO: https://mac.hamm.cn
17 |
18 | ### 依赖项目
19 |
20 | Vue3 / Element-UI
21 |
22 | ### 开发计划
23 |
24 | 请移步Issues: [https://gitee.com/hamm/mac-ui/issues](https://gitee.com/hamm/mac-ui/issues)
25 |
26 | ### 版权说明
27 |
28 | 本项目所用MacOS图标版权为Apple.Inc所有,向MacOS致敬!
29 |
30 | ### 项目截图
31 |
32 | 开机
33 |
34 | 
35 |
36 | 登录
37 |
38 | 
39 |
40 | 桌面 程序坞与菜单栏
41 |
42 | 
43 |
44 | 多应用窗口与关于默认小应用
45 |
46 | 
47 |
48 |
49 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/doc/README.md:
--------------------------------------------------------------------------------
1 | ## MacOS WebUI 开发文档
2 |
3 | 一套基于Vue3和ElementUI实现类似MacOS风格的WebUI,你可以使用这个UI进行快速的开始你的类MacOS项目的开发。
4 |
5 | ## 知识储备
6 |
7 | 你可能需要熟悉 Vue3、Element UI Pro等第三方框架的使用。
8 |
9 | ## 开发流程
10 |
11 | - 安装Node与npm等开发环境
12 | - 下载代码或Clone仓库 ```git clone https://gitee.com/hamm/mac-ui.git```
13 | - 进入项目目录 执行 ```npm install```
14 | - 运行开发服务器 ```npm run serve```
15 | - ......你的编码工作......
16 | - 运行项目打包部署 ```npm run build```
17 |
18 | ## 开始编写
19 |
20 | 接下来你可以参照其他开发文档开始编写你的窗口应用啦
21 |
22 |
23 |
--------------------------------------------------------------------------------
/doc/应用菜单配置.md:
--------------------------------------------------------------------------------
1 | ## 应用菜单配置说明
--------------------------------------------------------------------------------
/doc/应用配置说明.md:
--------------------------------------------------------------------------------
1 | ## 应用配置说明
2 |
3 |
4 | "key": "system_about",
5 | > 指定一个APP的唯一值
6 |
7 | "component": "SystemAbout",
8 | > 应用对应的组件地址
9 |
10 | "icon": "icon-question",
11 | > 应用使用的图标
12 |
13 | "title": "关于本站",
14 | > 应用标题
15 |
16 | "iconColor": "#fff",
17 | > 图标颜色
18 |
19 | "iconBgColor": "#23282d",
20 | > 图标背景色
21 |
22 | "width": 400,
23 | > 应用宽度
24 |
25 | "height": 250,
26 | > 应用高度
27 |
28 | "disableResize": true,
29 | > 是否固定大小
30 |
31 | "hideInDesktop": true,
32 | > 是否从桌面隐藏
33 |
34 | "keepInDock": true,
35 | > 保持在Dock上显示
36 |
37 | "outLink": true,
38 | "url": "https://github.com/HammCn/MacOS-Web-UI"
39 | > 外链 url
40 |
41 | "innerLink": true,
42 | "url": "https://github.com/HammCn/MacOS-Web-UI"
43 | > 内链 url
44 |
45 | "hideWhenClose": true
46 | > 打开后只能隐藏无法彻底关闭
47 |
48 | "titleBgColor": "#ff4500",
49 | > 标题栏背景色
50 |
51 | "titleColor": "#fff",
52 | > 标题栏前景色
53 |
54 | "multiTask": true,
55 | > 是否允许多任务方式打开
--------------------------------------------------------------------------------
/doc/目录说明.md:
--------------------------------------------------------------------------------
1 | ## 目录说明
2 |
3 | ```
4 | src/ 源代码目录
5 | ├── asset 资源目录
6 | │ ├── css css目录
7 | │ │ ├── animation.css 动画css
8 | │ │ └── app.css 全局css
9 | │ ├── fonts 字体目录
10 | │ │ ├── element-icons.ttf
11 | │ │ ├── element-icons.woff
12 | │ │ └── Gotham-Book.woff2
13 | │ └── img 图片目录
14 | │ └── bg.jpg 背景图
15 | ├── components 组件目录
16 | │ ├── App.vue 应用窗口加载器
17 | │ ├── Bg.vue 背景组件
18 | │ ├── DeskTop.vue 桌面组件
19 | │ ├── Dock.vue DOCK组件
20 | │ ├── Loading.vue 加载Loading
21 | │ └── Login.vue 登录组件
22 | ├── config.js 全局配置文件
23 | ├── helper 助手工具目录
24 | │ ├── request.js 网络请求助手
25 | │ └── tool.js 工具助手
26 | ├── MacOS.vue 主应用
27 | ├── main.js 入口文件
28 | ├── model 模型目录
29 | │ ├── App.js 应用模型
30 | │ └── User.js
31 | ├── store 状态管理目录
32 | │ └── App.js 应用状态
33 | └── view 应用页面
34 | ├── demo 示例应用目录
35 | │ ├── camera.vue
36 | │ ├── colorfull.vue
37 | │ ├── demo.vue
38 | │ ├── dock.vue
39 | │ ├── hidedesktop.vue
40 | │ ├── multitask.vue
41 | │ ├── unclose.vue
42 | │ ├── unresize.vue
43 | │ └── web.vue
44 | └── system 系统应用目录
45 | ├── about.vue
46 | └── task.vue
47 |
48 |
49 | ```
--------------------------------------------------------------------------------
/doc/窗口API.md:
--------------------------------------------------------------------------------
1 | ## 窗口API说明文档
2 |
3 | ```
4 | /**
5 | * @description: 打开上一次的应用
6 | */
7 | openTheLastApp()
8 |
9 | /**
10 | * @description: 最小化应用
11 | */
12 | hideApp(app)
13 |
14 | /**
15 | * @description: 根据PID关闭应用
16 | */
17 | closeWithPid(pid)
18 |
19 | /**
20 | * @description: 关闭应用
21 | */
22 | closeApp(app)
23 |
24 | /**
25 | * @description: 打开应用
26 | */
27 | openApp(app)
28 |
29 | /**
30 | * @description: 显示并置顶APP
31 | */
32 | showApp(app)
33 |
34 | /**
35 | * @description: 根据key打开APP
36 | */
37 | openAppByKey(key)
38 |
39 | /**
40 | * @description: 带参数打开App
41 | */
42 | openWithData(data)
43 |
44 | /**
45 | * @description: 获取常驻Dock的App列表
46 | */
47 | getDockAppList()
48 | ```
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "macos-web-ui",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve",
7 | "build": "vue-cli-service build",
8 | "lint": "vue-cli-service lint"
9 | },
10 | "dependencies": {
11 | "axios": "^0.21.1",
12 | "core-js": "^3.6.5",
13 | "element-plus": "^2.2.18",
14 | "register-service-worker": "^1.7.1",
15 | "vue": "^3.2.0",
16 | "vue-router": "^4.0.0-0",
17 | "vuex": "^4.0.0",
18 | "vue3-eventbus": "^2.0.0"
19 | },
20 | "devDependencies": {
21 | "@vue/cli-plugin-babel": "~4.5.0",
22 | "@vue/cli-plugin-eslint": "~4.5.0",
23 | "@vue/cli-plugin-router": "~4.5.0",
24 | "@vue/cli-service": "~4.5.0",
25 | "@vue/compiler-sfc": "^3.0.0",
26 | "babel-eslint": "^10.1.0",
27 | "eslint": "^6.7.2",
28 | "eslint-plugin-vue": "^7.0.0",
29 | "sass": "^1.26.5",
30 | "sass-loader": "^8.0.2"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HammCn/MacOS-Web-UI/fa3a974688fcc9801090d2f27a810d8c8cb4cfcc/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | MacOS WebUI
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/src/MacOS.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
11 |
12 |
13 |
15 |
16 |
17 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
40 |
91 |
--------------------------------------------------------------------------------
/src/asset/css/animation.css:
--------------------------------------------------------------------------------
1 | .fade-enter-active {
2 | animation: fade-in 1s;
3 | }
4 |
5 | .fade-leave-active {
6 | animation: fade-out 1s;
7 | }
8 |
9 | @keyframes fade-in {
10 | 0% {
11 | opacity: 0;
12 | }
13 | 100% {
14 | opacity: 1;
15 | }
16 | }
17 |
18 | @keyframes fade-out {
19 | 0% {
20 | opacity: 1;
21 | }
22 | 100% {
23 | opacity: 0;
24 | }
25 | }
26 |
27 | .fade-window-enter-active {
28 | /* animation: fade-window-in .1s; */
29 | opacity: 1;
30 | }
31 |
32 | .fade-window-leave-active {
33 | animation: fade-window-out .8s;
34 | }
35 |
36 | @keyframes fade-window-in {
37 | 0% {
38 | opacity: 0;
39 | }
40 | 100% {
41 | opacity: 1;
42 | }
43 | }
44 |
45 | @keyframes fade-window-out {
46 | 0% {
47 | opacity: 1;
48 | }
49 | 30% {
50 | opacity: 0.8;
51 | left: 30%;
52 | right: 30%;
53 | }
54 | 100% {
55 | opacity: 0;
56 | left: 100%;
57 | right: 100%;
58 | top: 100%;
59 | }
60 | }
61 |
62 | .fade-menu-enter-active {
63 | animation: fade-menu-in .1s;
64 | }
65 |
66 | .fade-menu-leave-active {
67 | animation: fade-menu-out .1s;
68 | }
69 |
70 | @keyframes fade-menu-in {
71 | 0% {
72 | width: 0px;
73 | opacity: 0;
74 | }
75 | 100% {
76 | width: 200px;
77 | opacity: 1;
78 | }
79 | }
80 |
81 | @keyframes fade-menu-out {
82 | 0% {
83 | width: 200px;
84 | opacity: 1;
85 | }
86 | 100% {
87 | width: 0px;
88 | opacity: 0;
89 | }
90 | }
91 |
92 | @keyframes jumpAnimation {
93 | 0% {
94 | transform: translateY(0);
95 | }
96 | 50% {
97 | transform: translateY(-20px);
98 | }
99 | 0% {
100 | transform: translateY(0);
101 | }
102 | }
103 |
104 | @keyframes dockTitleAnimation {
105 | 0% {
106 | opacity: 0;
107 | top: 0;
108 | }
109 | 100% {
110 | opacity: 1;
111 | top: -66px;
112 | }
113 | }
114 |
115 | @keyframes loginErrorAnimation {
116 | 0% {
117 | margin-left: -30px;
118 | }
119 | 50% {
120 | margin-left: 30px;
121 | }
122 | 100% {
123 | margin-left: 0;
124 | }
125 | }
--------------------------------------------------------------------------------
/src/asset/css/app.css:
--------------------------------------------------------------------------------
1 | body, html {
2 | width: 100%;
3 | height: 100%;
4 | margin: 0;
5 | padding: 0;
6 | background-color: #000;
7 | }
8 |
9 | .space {
10 | flex-grow: 1;
11 | }
12 |
13 | .el-dropdown-menu__item {
14 | font-size: 13px!important;
15 | color: #333;
16 | margin: 3px 5px;
17 | border-radius: 5px;
18 | padding: 0px 12px;
19 | display: flex;
20 | align-items: center;
21 | line-height: 2;
22 | }
23 |
24 | .el-scrollbar {
25 | width: 200px;
26 | }
27 |
28 | .el-dropdown__popper.el-popper[role=tooltip] {
29 | top: 32px !important;
30 | }
31 |
32 | .el-dropdown-menu__item:hover {
33 | background-color: #4b9efb!important;
34 | color: white!important;
35 | }
36 |
37 | .el-dropdown-menu__item span:hover {
38 | color: white!important;
39 | }
40 |
41 | .el-dropdown-menu {
42 | padding: 0!important;
43 | background: transparent!important;
44 | }
45 |
46 | .el-dropdown__popper.el-popper[role=tooltip] {
47 | background: rgba(255, 255, 255, 0.8);
48 | backdrop-filter: blur(20px);
49 | }
50 |
51 | .el-dropdown-menu__item.line {
52 | height: 1px;
53 | background: rgba(0, 0, 0, 0.1);
54 | margin: 0px 15px;
55 | }
56 |
57 | .el-dropdown-menu__item span {
58 | color: #aaa;
59 | }
60 |
61 | .el-popper__arrow, .el-popper__arrow::before {
62 | content: '' !important;
63 | width: 0;
64 | height: 0;
65 | opacity: 0;
66 | display: none !important;
67 | }
68 |
69 | .el-tag__close {
70 | position: absolute!important;
71 | right: 3px!important;
72 | top: 6px!important;
73 | }
74 |
75 | audio {
76 | position: relative;
77 | z-index: 99;
78 | }
79 |
80 | [v-cloak] {
81 | visibility: hidden !important;
82 | }
83 |
84 | body {
85 | display: flex;
86 | align-items: center;
87 | /*定义body的元素垂直居中*/
88 | justify-content: center;
89 | /*定义body的里的元素水平居中*/
90 | }
91 |
92 | @font-face {
93 | font-family: 'Gotham-Book';
94 | src: url('../fonts/Gotham-Book.woff2');
95 | }
96 |
97 | * {
98 | font-family: 'Gotham-Book';
99 | background-attachment: fixed;
100 | outline: none;
101 | -webkit-text-size-adjust: none;
102 | -moz-text-size-adjust: none;
103 | -ms-text-size-adjust: none;
104 | text-size-adjust: none;
105 | -moz-user-select: none;
106 | /*火狐*/
107 | -webkit-user-select: none;
108 | /*webkit浏览器*/
109 | -ms-user-select: none;
110 | /*IE10*/
111 | -khtml-user-select: none;
112 | /*早期浏览器*/
113 | user-select: none;
114 | }
115 |
116 | input, textarea {
117 | -moz-user-select: text;
118 | -webkit-user-select: text;
119 | -ms-user-select: text;
120 | -khtml-user-select: text;
121 | user-select: text;
122 | }
123 |
124 | ::-webkit-scrollbar {
125 | width: 5px;
126 | /*对垂直流动条有效*/
127 | height: 5px;
128 | /*对水平流动条有效*/
129 | }
130 |
131 | /*定义滚动条的轨道颜色、内阴影及圆角*/
132 |
133 | ::-webkit-scrollbar-track {
134 | background-color: transparent;
135 | border-radius: 5px;
136 | }
137 |
138 | /*定义滑块颜色、内阴影及圆角*/
139 |
140 | ::-webkit-scrollbar-thumb {
141 | border-radius: 5px;
142 | background-color: rgba(0, 0, 0, 0.2);
143 | }
144 |
145 | /*定义两端按钮的样式*/
146 |
147 | ::-webkit-scrollbar-button {
148 | background-color: transparent;
149 | }
150 |
151 | /*定义右下角汇合处的样式*/
152 |
153 | ::-webkit-scrollbar-corner {
154 | background: transparent;
155 | }
--------------------------------------------------------------------------------
/src/asset/fonts/Gotham-Book.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HammCn/MacOS-Web-UI/fa3a974688fcc9801090d2f27a810d8c8cb4cfcc/src/asset/fonts/Gotham-Book.woff2
--------------------------------------------------------------------------------
/src/asset/fonts/element-icons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HammCn/MacOS-Web-UI/fa3a974688fcc9801090d2f27a810d8c8cb4cfcc/src/asset/fonts/element-icons.ttf
--------------------------------------------------------------------------------
/src/asset/fonts/element-icons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HammCn/MacOS-Web-UI/fa3a974688fcc9801090d2f27a810d8c8cb4cfcc/src/asset/fonts/element-icons.woff
--------------------------------------------------------------------------------
/src/asset/img/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HammCn/MacOS-Web-UI/fa3a974688fcc9801090d2f27a810d8c8cb4cfcc/src/asset/img/bg.jpg
--------------------------------------------------------------------------------
/src/asset/img/mac.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HammCn/MacOS-Web-UI/fa3a974688fcc9801090d2f27a810d8c8cb4cfcc/src/asset/img/mac.jpg
--------------------------------------------------------------------------------
/src/components/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
12 |
22 |
27 |
28 |
29 |
30 |
36 |
45 |
46 | {{ appData.title || app.title }}
47 |
48 |
49 |
50 |
55 |
56 |
57 |
58 |
59 |
64 |
65 |
66 |
67 |
68 |
376 |
596 |
--------------------------------------------------------------------------------
/src/components/Bg.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
20 |
--------------------------------------------------------------------------------
/src/components/DeskTop.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | 关于本站
12 |
13 |
14 |
15 | 系统偏好设置
16 |
17 |
18 | 应用商店
19 |
20 |
21 |
22 | 强制退出...
23 |
24 |
25 |
26 | 关机...
27 |
28 |
29 |
30 | 锁定屏幕
31 |
32 |
33 | 退出登录 {{ userName }}...
34 |
35 |
36 |
37 |
38 |
59 |
60 |
61 |
62 |
66 |
67 |
68 |
74 |
75 |
76 |
77 | {{ timeString }}
78 |
79 |
80 |
81 |
82 |
83 |
87 |
88 |
89 |
90 |
98 |
99 |
100 |
105 |
106 |
114 |
115 |
{{ item.title }}
116 |
117 |
118 |
119 |
120 |
121 |
127 |
128 |
129 |
130 |
143 |
144 |
145 |
146 |
147 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
330 |
343 |
580 |
--------------------------------------------------------------------------------
/src/components/Dock.vue:
--------------------------------------------------------------------------------
1 |
2 |
30 |
31 |
51 |
52 |
122 |
--------------------------------------------------------------------------------
/src/components/LaunchPad.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
12 |
20 |
21 |
{{ item.title }}
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
52 |
53 |
126 |
--------------------------------------------------------------------------------
/src/components/Loading.vue:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
53 |
--------------------------------------------------------------------------------
/src/components/Login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 | {{ haveSavedUserName ? user_name : "Login Please" }}
9 |
10 |
38 |
39 |
40 |
41 |
151 |
--------------------------------------------------------------------------------
/src/components/Widget.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
13 |
23 |
--------------------------------------------------------------------------------
/src/config.js:
--------------------------------------------------------------------------------
1 | export default {
2 | debug: true,
3 | apiBaseUrl: "https://hamm.cn",
4 | qiyeWechatWebhook: '',
5 | enableErrorReporter: false,
6 | httpStatusCode: {
7 | OK: 200,
8 | MOVED_PERMANENTLY: 301,
9 | FOUND: 302,
10 | NOT_MODIFIED: 304,
11 | BAD_REQUEST: 400,
12 | UNAUTHORIZED: 401,
13 | FORBIDDEN: 403,
14 | NOT_FOUND: 404,
15 | METHOD_NOT_ALLOWED: 405,
16 | INTERNAL_SERVER_ERROR: 500,
17 | BAD_GATEWAY: 502,
18 | SERVICE_UNAVAILABLE: 503,
19 | GATEWAY_TIMEOUT: 504,
20 | },
21 | version: 10000,
22 | defaultErrorMessage: "请求服务器失败,请稍后再试",
23 | requestMissingUrl: "请求缺少url,请检查!"
24 | }
--------------------------------------------------------------------------------
/src/helper/request.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 | import tool from "./tool"
3 | import config from "@/config"
4 |
5 | import { ElMessage } from 'element-plus'
6 | const HTTP_STATUS_CODE = config.httpStatusCode
7 | const DEFAULT_ERROR_MESSAGE = config.defaultErrorMessage
8 | /**
9 | * 高度封装的请求方法
10 | * 支持参数 url,method,header,data,success,error
11 | * @param {object} 请求参数对象
12 | * @param {object} 如需要回调 请原封不动传入
13 | */
14 | function request(data, object = {}) {
15 | data.success = object.success || data.success
16 | if (!data.success || typeof data.success !== 'function') {
17 | data.success = false
18 | }
19 |
20 | data.error = object.error || data.error
21 | if (!data.error || typeof data.error !== 'function') {
22 | data.error = false
23 | }
24 |
25 | data.final = object.final || data.final
26 | if (!data.final || typeof data.final !== 'function') {
27 | data.final = false
28 | }
29 |
30 | if (!data.data) {
31 | data.data = {}
32 | }
33 |
34 | if (data.url.indexOf("https://") < 0 && data.url.indexOf("http://") < 0) {
35 | //相对地址 追加 apiBaseUrl
36 | data.url = config.apiBaseUrl + data.url
37 | }
38 |
39 | //处理请求方法 默认GET
40 | data.method = data.method || "get"
41 |
42 | //默认header
43 | let header = {
44 | 'Content-Type': 'application/json',
45 | 'Version': config.version,
46 | }
47 | //自定义header
48 | if (data.header) {
49 | if (typeof data.header == "object" && data.header instanceof Array) {
50 | for (let i in data.header) {
51 | header[i] = data.header[i]
52 | }
53 | }
54 | }
55 | //如未指定不需要传TOKEN,则默认带上
56 | if (!data.noToken) {
57 | header['Authorization'] = tool.getAccessToken()
58 | }
59 |
60 | let axiosResource = false
61 |
62 | //走不同的请求方法
63 | switch (data.method.toLowerCase()) {
64 | case 'post':
65 | axiosResource = axios.post(data.url, data.data, {
66 | headers: header
67 | })
68 | break
69 | case 'put':
70 | axiosResource = axios.put(data.url, data.data, {
71 | headers: header
72 | })
73 | break
74 | case 'delete':
75 | axiosResource = axios.delete(data.url, {
76 | headers: header
77 | })
78 | break
79 | default:
80 | axiosResource = axios.get(data.url, {
81 | headers: header
82 | })
83 | }
84 | axiosResource.then(function (response) {
85 | switch (response.data.code) {
86 | case HTTP_STATUS_CODE.OK:
87 | data.success ? data.success(response.data) :
88 | ElMessage.success({
89 | message: response.data.msg || DEFAULT_ERROR_MESSAGE,
90 | type: 'warning',
91 | })
92 | break
93 | default:
94 | data.error ? (
95 | data.error(response.data) ? false :
96 | ElMessage.warning({
97 | message: response.data.msg || DEFAULT_ERROR_MESSAGE,
98 | type: 'warning',
99 | })
100 | ) : ElMessage.warning({
101 | message: response.data.msg || DEFAULT_ERROR_MESSAGE,
102 | type: 'warning',
103 | })
104 | }
105 | data.final && data.final()
106 | })
107 | .catch(function (error) {
108 | config.debug && console.log(error)
109 | ElMessage.warning({
110 | message: DEFAULT_ERROR_MESSAGE,
111 | type: 'warning',
112 | })
113 | data.final && data.final()
114 | })
115 | }
116 | export default request
--------------------------------------------------------------------------------
/src/helper/tool.js:
--------------------------------------------------------------------------------
1 | import AppModel from "@/model/App"
2 | export default {
3 | /**
4 | * @description: 从localstorage中获取access_token
5 | */
6 | getAccessToken() {
7 | return localStorage.getItem('AcessToken') || ""
8 | },
9 | /**
10 | * @description: 保存access_token到localstorage
11 | */
12 | saveAccessToken(access_token) {
13 | localStorage.setItem('AcessToken', access_token)
14 | },
15 | /**
16 | * @description: APP是否常驻Dock
17 | */
18 | isAppInKeepList(app, dockAppList) {
19 | for (let item of dockAppList) {
20 | if (item.key == app.key) {
21 | return true;
22 | }
23 | }
24 | return false;
25 | },
26 | /**
27 | * @description: APP是否打开
28 | */
29 | isAppInOpenList(app, openAppList) {
30 | for (let item of openAppList) {
31 | if (item.key == app.key) {
32 | return true;
33 | }
34 | }
35 | return false;
36 | },
37 | /**
38 | * @description: 获取指定key的App
39 | */
40 | getAppByKey(key) {
41 | let appList = AppModel.allAppList
42 | for (let app of appList) {
43 | if (app.key == key) {
44 | return app
45 | }
46 | }
47 | return false
48 | },
49 | /**
50 | * @description: 获取桌面App列表
51 | */
52 | getDeskTopApp() {
53 | return AppModel.allAppList
54 | },
55 | /**
56 | * @description: 格式化时间
57 | * @param {any} date
58 | * @param {string} format
59 | */
60 | formatTime(date, format) {
61 | if (!date) return;
62 | if (!format) format = "yyyy-MM-dd";
63 | switch (typeof date) {
64 | case "string":
65 | date = new Date(date.replace(/-/, "/"));
66 | break;
67 | case "number":
68 | date = new Date(date);
69 | break;
70 | default:
71 | }
72 | var dict = {
73 | "yyyy": date.getFullYear(),
74 | "M": date.getMonth() + 1,
75 | "d": date.getDate(),
76 | "H": date.getHours(),
77 | "m": date.getMinutes(),
78 | "s": date.getSeconds(),
79 | "MM": ("" + (date.getMonth() + 101)).substr(1),
80 | "dd": ("" + (date.getDate() + 100)).substr(1),
81 | "HH": ("" + (date.getHours() + 100)).substr(1),
82 | "mm": ("" + (date.getMinutes() + 100)).substr(1),
83 | "ss": ("" + (date.getSeconds() + 100)).substr(1)
84 | };
85 | return format.replace(/(yyyy|MM?|dd?|HH?|ss?|mm?)/g, function () {
86 | return dict[arguments[0]];
87 | });
88 | }
89 | }
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import { createStore } from 'vuex'
3 |
4 | import MacOS from './MacOS'
5 | let macOS = createApp(MacOS)
6 |
7 |
8 | import ElementPlus from 'element-plus';
9 | import 'element-plus/dist/index.css'
10 | import zhCn from 'element-plus/es/locale/lang/zh-cn'
11 | macOS.use(ElementPlus, {
12 | locale: zhCn,
13 | })
14 |
15 | import "@/asset/css/app.css"
16 | import "@/asset/css/animation.css"
17 |
18 | import config from './config'
19 | macOS.config.globalProperties.config = config
20 |
21 | import tool from './helper/tool'
22 | macOS.config.globalProperties.tool = tool
23 |
24 | import AppStore from './store/App'
25 | const store = createStore(AppStore)
26 | macOS.use(store)
27 |
28 | window.macOS = macOS
29 | macOS.mount('#app')
--------------------------------------------------------------------------------
/src/model/App.js:
--------------------------------------------------------------------------------
1 | export default {
2 | allAppList: [
3 | {
4 | key: "system_about",
5 | component: "SystemAbout",
6 | icon: "icon-question",
7 | title: "关于本站",
8 | iconColor: "#fff",
9 | iconBgColor: "#23282d",
10 | width: 400,
11 | height: 250,
12 | disableResize: true,
13 | hideInDesktop: true,
14 | menu: [
15 | {
16 | key: "about",
17 | title: "关于",
18 | sub: [
19 | {
20 | key: "close",
21 | title: "关闭",
22 | },
23 | ],
24 | },
25 | {
26 | key: "help",
27 | title: "帮助",
28 | sub: [
29 | {
30 | key: "send",
31 | title: "发送反馈",
32 | },
33 | ],
34 | },
35 | ],
36 | },
37 | {
38 | key: "system_finder",
39 | component: "SystemFinder",
40 | icon: "icon-MIS_chanpinshezhi",
41 | title: "访达",
42 | iconColor: "#fff",
43 | iconBgColor: "#db5048",
44 | width: 800,
45 | height: 600,
46 | keepInDock: true,
47 | menu: [
48 | {
49 | key: "finder",
50 | title: "访达",
51 | sub: [
52 | {
53 | key: "about",
54 | title: "关于 访达",
55 | },
56 | {
57 | isLine: true,
58 | },
59 | {
60 | key: "setting",
61 | title: "首选项",
62 | },
63 | {
64 | isLine: true,
65 | },
66 | {
67 | key: "close",
68 | title: "退出 访达",
69 | },
70 | ],
71 | },
72 | {
73 | key: "window",
74 | title: "窗口",
75 | sub: [
76 | {
77 | key: "min",
78 | title: "最小化",
79 | },
80 | {
81 | key: "max",
82 | title: "最大化",
83 | },
84 | ],
85 | },
86 | {
87 | key: "help",
88 | title: "帮助",
89 | sub: [
90 | {
91 | key: "send",
92 | title: "发送反馈",
93 | },
94 | ],
95 | },
96 | ],
97 | },
98 | {
99 | key: "system_launchpad",
100 | component: "SystemLaunchPad",
101 | icon: "icon-shezhi",
102 | title: "启动台",
103 | iconColor: "#333",
104 | iconBgColor: "#d4dbef",
105 | width: 500,
106 | height: 300,
107 | hideInDesktop: true,
108 | keepInDock: true,
109 | },
110 | {
111 | key: "system_setting",
112 | component: "SystemSetting",
113 | icon: "icon-setting",
114 | title: "系统偏好设置",
115 | iconColor: "#fff",
116 | iconBgColor: "#23282d",
117 | width: 800,
118 | height: 600,
119 | disableResize: true,
120 | hideInDesktop: true,
121 | keepInDock: true,
122 | menu: [
123 | {
124 | key: "setting",
125 | title: "系统偏好设置",
126 | sub: [
127 | {
128 | key: "close",
129 | title: "关闭",
130 | },
131 | ],
132 | },
133 | {
134 | key: "help",
135 | title: "帮助",
136 | sub: [
137 | {
138 | key: "send",
139 | title: "发送反馈",
140 | },
141 | ],
142 | },
143 | ],
144 | },
145 | {
146 | key: "system_store",
147 | component: "SystemStore",
148 | icon: "icon-store",
149 | title: "应用商店",
150 | iconColor: "#fff",
151 | iconBgColor: "#23282d",
152 | width: 800,
153 | height: 600,
154 | disableResize: true,
155 | hideInDesktop: true,
156 | keepInDock: true,
157 | menu: [
158 | {
159 | key: "store",
160 | title: "应用商店",
161 | sub: [
162 | {
163 | key: "about",
164 | title: "关于 应用商店",
165 | },
166 | {
167 | isLine: true,
168 | },
169 | {
170 | key: "setting",
171 | title: "首选项",
172 | },
173 | {
174 | isLine: true,
175 | },
176 | {
177 | key: "close",
178 | title: "退出 应用商店",
179 | },
180 | ],
181 | },
182 | {
183 | key: "window",
184 | title: "窗口",
185 | sub: [
186 | {
187 | key: "min",
188 | title: "最小化",
189 | },
190 | {
191 | key: "max",
192 | title: "最大化",
193 | },
194 | ],
195 | },
196 | {
197 | key: "help",
198 | title: "帮助",
199 | sub: [
200 | {
201 | key: "send",
202 | title: "发送反馈",
203 | },
204 | ],
205 | },
206 | ],
207 | },
208 | {
209 | key: "system_task",
210 | component: "SystemTask",
211 | icon: "icon-icon_roundclose_fill",
212 | title: "强制退出...",
213 | iconColor: "#fff",
214 | iconBgColor: "#333",
215 | width: 300,
216 | height: 400,
217 | disableResize: true,
218 | hideInDesktop: true,
219 | menu: [
220 | {
221 | key: "task",
222 | title: "TASK",
223 | sub: [
224 | {
225 | key: "close",
226 | title: "关闭",
227 | },
228 | ],
229 | },
230 | {
231 | key: "help",
232 | title: "帮助",
233 | sub: [
234 | {
235 | key: "send",
236 | title: "发送反馈",
237 | },
238 | ],
239 | },
240 | ],
241 | },
242 | {
243 | key: "demo_demo",
244 | component: "Demo",
245 | icon: "icon-MIS_chanpinshezhi",
246 | title: "DEMO",
247 | iconColor: "#fff",
248 | iconBgColor: "#db5048",
249 | width: 600,
250 | height: 400,
251 | keepInDock: true,
252 | },
253 | {
254 | key: "demo_github",
255 | icon: "icon-github",
256 | title: "Github仓库",
257 | iconColor: "rgb(36,41,46)",
258 | iconBgColor: "#eee",
259 | keepInDock: true,
260 | outLink: true,
261 | url: "https://github.com/HammCn/MacOS-Web-UI",
262 | },
263 | {
264 | key: "demo_gitee",
265 | icon: "icon-gitee",
266 | title: "Gitee仓库",
267 | iconColor: "#fff",
268 | iconBgColor: "rgb(199,29,35)",
269 | keepInDock: true,
270 | outLink: true,
271 | url: "https://gitee.com/hamm/mac-ui",
272 | },
273 | {
274 | key: "demo_dy",
275 | component: "DemoWeb",
276 | icon: "icon-video_fill",
277 | title: "抖音去水印",
278 | iconColor: "#fff",
279 | iconBgColor: "rgb(33,179,81)",
280 | width: 600,
281 | height: 600,
282 | innerLink: true,
283 | url: "https://dy.hamm.cn/",
284 | },
285 | {
286 | key: "demo_dock",
287 | component: "DemoDock",
288 | icon: "icon-MIS_bangongOA",
289 | title: "常驻Dock应用",
290 | iconColor: "#fff",
291 | iconBgColor: "#022732",
292 | width: 420,
293 | height: 350,
294 | keepInDock: true,
295 | },
296 | {
297 | key: "demo_unresize",
298 | component: "DemoUnResize",
299 | icon: "icon-smallscreen_fill",
300 | title: "固定尺寸应用",
301 | iconColor: "#fff",
302 | iconBgColor: "#1573fa",
303 | width: 600,
304 | height: 400,
305 | disableResize: true,
306 | },
307 | {
308 | key: "demo_unclose",
309 | component: "DemoUnClose",
310 | icon: "icon-wechat-fill",
311 | title: "无法彻底关闭",
312 | iconColor: "#fff",
313 | iconBgColor: "#24dc72",
314 | width: 610,
315 | height: 430,
316 | hideWhenClose: true,
317 | },
318 | {
319 | key: "demo_hidedesktop",
320 | component: "DemoHideDesktop",
321 | icon: "icon-shezhi",
322 | title: "不在桌面显示",
323 | iconColor: "#333",
324 | iconBgColor: "#d4dbef",
325 | width: 500,
326 | height: 300,
327 | hideInDesktop: true,
328 | keepInDock: true,
329 | },
330 | {
331 | key: "demo_colorfull",
332 | component: "DemoColorFull",
333 | icon: "icon-changyongtubiao-mianxing-86",
334 | title: "花里胡哨",
335 | iconColor: "#fff",
336 | iconBgColor: "#ff4500",
337 | width: 420,
338 | height: 310,
339 | titleBgColor: "#ff4500",
340 | titleColor: "#fff",
341 | },
342 | {
343 | key: "demo_camera",
344 | component: "DemoCamera",
345 | icon: "icon-camera1",
346 | title: "Photo Booth",
347 | iconColor: "#fff",
348 | iconBgColor: "#E24637",
349 | width: 540,
350 | height: 540,
351 | disableResize: true,
352 | },
353 | ],
354 | };
355 |
--------------------------------------------------------------------------------
/src/store/App.js:
--------------------------------------------------------------------------------
1 | import AppModel from "@/model/App";
2 | import tool from "@/helper/tool";
3 | import bus from 'vue3-eventbus'
4 | export default {
5 | state() {
6 | return {
7 | showLogin: false,
8 | nowApp: false,
9 | openAppList: [],
10 | dockAppList: [],
11 | openWidgetList: [],
12 | volumn: 80,
13 | launchpad: false,
14 | };
15 | },
16 | mutations: {
17 | /**
18 | * @description: 设置全局音量
19 | */
20 | setVolumn(state, volumn) {
21 | state.volumn = volumn;
22 | },
23 | /**
24 | * @description: 退出登录
25 | */
26 | logout(state) {
27 | state.nowApp = false;
28 | state.openAppList = [];
29 | state.showLogin = true;
30 | },
31 | /**
32 | * @description: 登录
33 | */
34 | login(state) {
35 | state.showLogin = false;
36 | },
37 | /**
38 | * @description: 打开上一次的应用
39 | */
40 | openTheLastApp(state) {
41 | for (let i = state.openAppList.length - 1; i >= 0; i--) {
42 | if (!state.openAppList[i].hide) {
43 | this.commit("showApp", state.openAppList[i]);
44 | break;
45 | }
46 | }
47 | },
48 | /**
49 | * @description: 最小化应用
50 | */
51 | hideApp(state, app) {
52 | for (let i in state.openAppList) {
53 | if (state.openAppList[i].pid == app.pid) {
54 | state.openAppList[i].hide = true;
55 | break;
56 | }
57 | }
58 | this.commit("openTheLastApp");
59 | },
60 | /**
61 | * @description: 根据PID关闭应用
62 | */
63 | closeWithPid(state, pid) {
64 | for (let i in state.openAppList) {
65 | if (state.openAppList[i].pid == pid) {
66 | state.openAppList.splice(i, 1);
67 | break;
68 | }
69 | }
70 | for (let i in state.dockAppList) {
71 | if (
72 | state.dockAppList[i].pid == pid &&
73 | !state.dockAppList[i].keepInDock
74 | ) {
75 | state.dockAppList.splice(i, 1);
76 | break;
77 | }
78 | }
79 | },
80 | /**
81 | * @description: 关闭应用
82 | */
83 | closeApp(state, app) {
84 | if (app.hideWhenClose) {
85 | this.commit("hideApp", app);
86 | } else {
87 | for (let i in state.openAppList) {
88 | if (app.pid) {
89 | if (state.openAppList[i].pid == app.pid) {
90 | state.openAppList.splice(i, 1);
91 | break;
92 | }
93 | } else {
94 | if (state.openAppList[i].key == app.key) {
95 | state.openAppList.splice(i, 1);
96 | break;
97 | }
98 | }
99 | }
100 | if (!app.keepInDock) {
101 | for (let i in state.dockAppList) {
102 | if (app.pid) {
103 | if (state.dockAppList[i].pid == app.pid) {
104 | state.dockAppList.splice(i, 1);
105 | break;
106 | }
107 | } else {
108 | if (state.dockAppList[i].key == app.key) {
109 | state.dockAppList.splice(i, 1);
110 | break;
111 | }
112 | }
113 | }
114 | }
115 | this.commit("openTheLastApp");
116 | }
117 | },
118 | /**
119 | * @description: 打开应用
120 | */
121 | openApp(state, app) {
122 | if (state.launchpad) {
123 | state.launchpad = false;
124 | }
125 | if (app.outLink) {
126 | app.url && window.open(app.url);
127 | return;
128 | }
129 | app.hide = false;
130 | let isExist = false;
131 | for (let i in state.openAppList) {
132 | if (state.openAppList[i].key == app.key) {
133 | isExist = true;
134 | break;
135 | }
136 | }
137 | if (isExist) {
138 | this.commit("showApp", app);
139 | } else {
140 | app.pid =
141 | new Date().valueOf() + "." + parseInt(Math.random() * 99999999);
142 | app = JSON.parse(JSON.stringify(app));
143 | state.openAppList.push(app);
144 | let isExistDock = false;
145 | for (let i in state.dockAppList) {
146 | if (state.dockAppList[i].key == app.key) {
147 | //dock里已经有相同的应用了 不push
148 | isExistDock = true;
149 | break;
150 | }
151 | }
152 | if (!isExistDock) {
153 | state.dockAppList.push(app);
154 | }
155 | }
156 | state.nowApp = JSON.parse(JSON.stringify(app));
157 | },
158 | /**
159 | * @description: 显示并置顶APP
160 | */
161 | showApp(state, app) {
162 | let openAppList = JSON.parse(JSON.stringify(state.openAppList));
163 | for (let i in openAppList) {
164 | if (openAppList[i].pid == app.pid) {
165 | openAppList.splice(i, 1);
166 | break;
167 | }
168 | }
169 | app.hide = false;
170 | app = JSON.parse(JSON.stringify(app));
171 | openAppList.push(app);
172 | state.openAppList = openAppList;
173 | state.nowApp = app;
174 | },
175 | /**
176 | * @description: 根据key打开APP
177 | */
178 | openAppByKey(state, key) {
179 | let app = tool.getAppByKey(key);
180 | if (app) {
181 | this.commit("openApp", app);
182 | }
183 | },
184 | /**
185 | * @description: 带参数打开App
186 | */
187 | openWithData(state, data) {
188 | data.app.data = data.data;
189 | this.commit("openApp", data.app);
190 | },
191 | /**
192 | * @description: 获取常驻Dock的App列表
193 | */
194 | getDockAppList(state) {
195 | let arr = [];
196 | let appList = AppModel.allAppList;
197 | for (let app of appList) {
198 | if (app.keepInDock) {
199 | app.pid =
200 | new Date().valueOf() + "." + parseInt(Math.random() * 99999999);
201 | arr.push(app);
202 | }
203 | }
204 | state.dockAppList = arr;
205 | },
206 | openMenu(state, key) {
207 | switch (key) {
208 | case "close":
209 | this.commit("closeApp", state.nowApp);
210 | break;
211 | default:
212 | bus.emit(key); //默认通过事件总线发送,注意保证事件名称唯一
213 | break;
214 | }
215 | },
216 | launchpad(state) {
217 | state.launchpad = !state.launchpad;
218 | },
219 | },
220 | };
221 |
--------------------------------------------------------------------------------
/src/view/demo/camera.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
![]()
10 |
11 |
16 |
21 |
22 |
23 |
24 |
![]()
29 |
30 |
31 |
32 |
67 |
浏览器不支持
68 |
69 |
70 |
71 |
154 |
--------------------------------------------------------------------------------
/src/view/demo/colorfull.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 我的标题栏花里胡哨
你可以通过设置
titleBgColor/titleColor
6 | 来修饰我
7 |
8 |
{{ app && app.data }}
9 |
10 |
11 |
12 |
13 |
29 |
--------------------------------------------------------------------------------
/src/view/demo/demo.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
{{ demo.title }}
7 |
{{ demo.desc }}
8 |
9 |
10 |
11 | 窗口最大化
14 | 普通窗口
17 | 窗口最小化
20 | 关闭当前窗口
23 | 窗口全屏
26 | 打开某app
29 | 关闭某app
32 | 修改窗口标题
35 | 带参打开App
38 |
39 |
40 |
41 |
42 |
82 |
--------------------------------------------------------------------------------
/src/view/demo/dock.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 我是一个常驻Dock上的App,
关闭后也一直在Dock上,
你可以通过配置
5 | keepInDock 来修饰我
6 |
7 |
8 |
9 |
10 |
26 |
--------------------------------------------------------------------------------
/src/view/demo/hidedesktop.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 我被设置了 hideInDesktop ,
5 |
不会出现在桌面上,如果把keepInDock设置false,
我就跟关于那个一样,也不出现在Dock上
6 |
7 |
看看关于长什么样
10 |
11 |
12 |
13 |
31 |
--------------------------------------------------------------------------------
/src/view/demo/multitask.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 我允许被多次打开,但我无法被固定在Dock上,
因为我的 keepInDock 在
5 |
multiTask = true 时将自动失效
6 |
7 |
8 |
9 |
10 |
27 |
--------------------------------------------------------------------------------
/src/view/demo/unclose.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 我无法被彻底关闭,只会被隐藏,
因为我 hideWhenClose = true ,
5 |
你猜我适合做什么应用?
6 |
7 |
8 |
9 |
10 |
26 |
--------------------------------------------------------------------------------
/src/view/demo/unresize.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 我无法拖动大小,也无法绿灯改变大小,也无法双击改变大小,
为我设置修饰
5 | disableResize = true 即可
6 |
7 |
8 |
9 |
10 |
27 |
--------------------------------------------------------------------------------
/src/view/demo/web.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
24 |
--------------------------------------------------------------------------------
/src/view/system/about.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
{{ about.title }}
7 |
{{ about.version }}
8 |
9 |
10 |
11 |

12 |

13 |
14 |
{{ about.copyright }}
15 |
16 |
17 |
18 |
63 |
--------------------------------------------------------------------------------
/src/view/system/finder.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
15 |
16 |
50 |
--------------------------------------------------------------------------------
/src/view/system/setting.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
13 |
14 |
27 |
--------------------------------------------------------------------------------
/src/view/system/store.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/view/system/task.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
9 |
15 | {{ item.title }}
16 |
17 |
18 |
19 |
20 | 强制退出
24 |
25 |
26 |
27 |
28 |
92 |
--------------------------------------------------------------------------------