Skip to content

Commit

Permalink
feat: 增加electron开机自启设置 (#90)
Browse files Browse the repository at this point in the history
* perf: 小优化

* docs: 添加服务端启动教程

* docs: 更新本地服务上传图片失败问题处理方案

* fix: 构建预览页面实时预览,布局错乱

* fix: 处理warning

* fix: 注册成功后登录模块的输入框无法输入

* fix: node创建多级文件夹报错

* perf: 优化模板分页,提高用户体验

* docs: update docs

* fix: 模板页面分页布局优化

* feat: platform-electron

* fix: 删除多余文件

* fix: 修复electron schema生成器组件不显示问题

* feat: 增加tray菜单以及优化tray

* fix: tray优化

* feat: 增加开机自启设置

---------

Co-authored-by: 雨尽阑珊 <[email protected]>
  • Loading branch information
Qiu-Jun and wangyuan389 authored May 18, 2023
1 parent 3317626 commit 2a46177
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 49 deletions.
Binary file modified packages/mall-cook-platform-electron/public/favicon.ico
Binary file not shown.
Binary file not shown.
Binary file not shown.
27 changes: 25 additions & 2 deletions packages/mall-cook-platform-electron/src/main/tray/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* @Author: June
* @Date: 2023-03-07 18:15:42
* @LastEditors: June
* @LastEditTime: 2023-05-05 01:11:42
* @LastEditTime: 2023-05-17 01:01:01
*/
const { app, Menu, Tray, nativeImage, dialog, BrowserWindow } = require('electron')
const path=require('path')
let tray = null
const initTray=(win)=>{
const iconPath = path.join(__dirname, '/icone.ico').replace('/\\/g','\\\\');
const iconPath = path.join(__dirname, '/icon.ico').replace('/\\/g','\\\\');
tray = new Tray(nativeImage.createFromPath(iconPath))
tray.setToolTip('Mall-Cook') // 鼠标指针在托盘图标上悬停时显示的文本
const contextMenu = Menu.buildFromTemplate([
Expand Down Expand Up @@ -41,6 +41,29 @@ const initTray=(win)=>{
})
},
},
{
label: '设置',
submenu: [
{
label: '开机自启',
type: 'checkbox',
checked: app.getLoginItemSettings().openAtLogin,
click: function() {
const curStatus = app.getLoginItemSettings().openAtLogin
if(!app.isPackaged) {
app.setLoginItemSettings({
openAtLogin: !curStatus,
path: process.execPath
})
} else {
app.setLoginItemSettings({
openAtLogin: !curStatus
})
}
}
}
]
},
{
label: "关于",
click: function() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
<!--
* @Description: 物料属性面板
* @Autor: WangYuan
* @Date: 2022-01-13 15:31:38
* @LastEditors: June
* @LastEditTime: 2023-03-10 01:32:15
-->
<template>
<div class="Config">
<config-ctn
v-if="control.curWidget"
:title="control.curWidget.name"
>
<custom-schema-template
:schema="curSchema"
v-model="control.curWidget"
></custom-schema-template>
</config-ctn>

<config-ctn v-else title="页面配置">
<page-config></page-config>
</config-ctn>
</div>
</template>

<script>
import PageConfig from "@/components/PageConfig/index.vue";
export default {
components: {
PageConfig
},

inject: ["control"],

computed: {
curSchema() {
console.log('curSchema');
console.log(this.control.curWidget);


return this.$fields[this.control.curWidget.component];
},
},
};
</script>

<style lang='scss'>
<!--
* @Description: 物料属性面板
* @Autor: WangYuan
* @Date: 2022-01-13 15:31:38
* @LastEditors: June
* @LastEditTime: 2023-05-17 00:05:23
-->
<template>
<div class="Config">
<config-ctn
v-if="control.curWidget"
:title="control.curWidget.name"
>
<custom-schema-template
:schema="curSchema"
v-model="control.curWidget"
:key="control.curWidget.id"
></custom-schema-template>
</config-ctn>

<config-ctn v-else title="页面配置">
<page-config></page-config>
</config-ctn>
</div>
</template>

<script>
import PageConfig from "@/components/PageConfig/index.vue";
export default {
components: {
PageConfig
},

inject: ["control"],

computed: {
curSchema() {
console.log('curSchema');
console.log(this.control.curWidget);


return this.$fields[this.control.curWidget.component];
},
},
};
</script>

<style lang='scss'>
</style>

0 comments on commit 2a46177

Please sign in to comment.