Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
taochunsheng committed Feb 22, 2020
2 parents 9dfdda9 + e905d8a commit 357017f
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 102 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ coverage
node_modules/
npm-debug.log
npm-debug.log.*
yarn-error.log
yarn-error.log.*
thumbs.db
!.gitkeep
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

| 平台 | Windows | Mac OS | Linux |
| :--- | :---: | :---: | :---: |
|下载链接| [![Windows 版本下载链接 v1.9.3](https://img.shields.io/badge/v1.9.3-Windows-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.3/whu-library-seat-1.9.3.exe) | [![Mac OS 版本下载链接 v1.9.3](https://img.shields.io/badge/v1.9.3-Mac%20OS-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.3/whu-library-seat-1.9.3.dmg) | [![Linux 版本下载链接 v1.9.3](https://img.shields.io/badge/v1.9.3-Linux-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.3/whu-library-seat-1.9.3-x86_64.AppImage) |
|下载链接| [![Windows 版本下载链接 v1.9.4](https://img.shields.io/badge/v1.9.4-Windows-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.4/whu-library-seat-1.9.4.exe) | [![Mac OS 版本下载链接 v1.9.4](https://img.shields.io/badge/v1.9.4-Mac%20OS-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.4/whu-library-seat-1.9.4.dmg) | [![Linux 版本下载链接 v1.9.4](https://img.shields.io/badge/v1.9.4-Linux-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.4/whu-library-seat-1.9.4-x86_64.AppImage) |

### 申请软件使用权

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "whu-library-seat",
"version": "1.9.3",
"version": "1.9.4",
"author": "CS-Tao <[email protected]>",
"description": "武汉大学图书馆抢座软件",
"license": null,
Expand Down
206 changes: 106 additions & 100 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ app.on('ready', () => {
})

const contextMenu = Menu.buildFromTemplate([
{
label: '打开软件',
click () {
mainWindow.show()
}
},
{ type: 'separator' },
{
label: '查看文档',
click () { require('electron').shell.openExternal('https://home.cs-tao.cc/whu-library-seat/') }
Expand Down Expand Up @@ -71,7 +78,7 @@ app.on('ready', () => {
click: (menuItem, browserWindow, event) => {
store.set('mainWindowPosition', mainWindow.getPosition())
mainWindow = null
if (tray) {
if (tray && process.platform !== 'darwin') {
tray.destroy()
}
app.exit()
Expand All @@ -80,113 +87,112 @@ app.on('ready', () => {
])
tray.setToolTip('武汉大学图书馆抢座软件')
tray.setContextMenu(contextMenu)
})

const template = [
{
label: '文件',
submenu: [
{
label: '退出程序',
click () {
store.set('mainWindowPosition', mainWindow.getPosition())
mainWindow = null
if (tray) {
tray.destroy()
const template = [
{
label: '文件',
submenu: [
{
label: '退出程序',
click () {
store.set('mainWindowPosition', mainWindow.getPosition())
mainWindow = null
if (tray) {
tray.destroy()
}
app.exit()
}
app.exit()
}
}
]
}, {
label: '设置',
submenu: [
{
label: '恢复所有设置',
click () {
store.clear()
if (mainWindow) {
mainWindow.reload()
]
}, {
label: '设置',
submenu: [
{
label: '恢复所有设置',
click () {
store.clear()
if (mainWindow) {
mainWindow.reload()
}
}
}
}
]
}, {
label: '视图',
submenu: [
{ role: 'reload', label: '重新加载' },
{ role: 'forcereload', label: '强制重新加载' }
]
}, {
label: '窗口',
role: 'window',
submenu: [
{
label: '置顶',
type: 'checkbox',
checked: store.get('mainWindowOnTop', false),
click: (menuItem, browserWindow, event) => {
mainWindow.setAlwaysOnTop(menuItem.checked)
store.set('mainWindowOnTop', menuItem.checked)
if (!mainWindow.isVisible()) {
mainWindow.show()
mainWindow.setSkipTaskbar(false)
]
}, {
label: '视图',
submenu: [
{ role: 'reload', label: '重新加载' },
{ role: 'forcereload', label: '强制重新加载' }
]
}, {
label: '窗口',
submenu: [
{
label: '置顶',
type: 'checkbox',
checked: store.get('mainWindowOnTop', false),
click: (menuItem, browserWindow, event) => {
mainWindow.setAlwaysOnTop(menuItem.checked)
store.set('mainWindowOnTop', menuItem.checked)
if (!mainWindow.isVisible()) {
mainWindow.show()
mainWindow.setSkipTaskbar(false)
}
}
},
{ role: 'minimize', label: '最小化' },
{
label: '退出到托盘',
click: (menuItem, browserWindow, event) => {
mainWindow.hide()
mainWindow.setSkipTaskbar(true)
}
}
},
{ role: 'minimize', label: '最小化' },
{
label: '退出到托盘',
click: (menuItem, browserWindow, event) => {
mainWindow.hide()
mainWindow.setSkipTaskbar(true)
]
}, {
label: '群聊',
submenu: [
{
label: 'Chat on gitter',
click () { require('electron').shell.openExternal('https://gitter.im/whu-library-seat/Lobby') }
}
}
]
}, {
label: '群聊',
submenu: [
{
label: 'Chat on gitter',
click () { require('electron').shell.openExternal('https://gitter.im/whu-library-seat/Lobby') }
}
]
}, {
label: '关于',
role: 'about',
submenu: [
{
label: '版本 v' + appVersion,
enabled: false
},
{
label: '更新日志',
click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat/releases/tag/v' + appVersion) }
},
{
label: '检查更新',
click () { mainWindow.webContents.send('check-update-menu-clicked') }
},
{ type: 'separator' },
{
label: '文档',
click () { require('electron').shell.openExternal('https://home.cs-tao.cc/whu-library-seat/') }
},
{
label: '项目',
click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat') }
},
{ type: 'separator' },
{
label: '问题反馈',
click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat/issues/new') }
}
]
}
]
]
}, {
label: '关于',
role: 'about',
submenu: [
{
label: '版本 v' + appVersion,
enabled: false
},
{
label: '更新日志',
click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat/releases/tag/v' + appVersion) }
},
{
label: '检查更新',
click () { mainWindow.webContents.send('check-update-menu-clicked') }
},
{ type: 'separator' },
{
label: '文档',
click () { require('electron').shell.openExternal('https://home.cs-tao.cc/whu-library-seat/') }
},
{
label: '项目',
click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat') }
},
{ type: 'separator' },
{
label: '问题反馈',
click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat/issues/new') }
}
]
}
]

const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
})

function createWindow () {
/**
Expand Down Expand Up @@ -259,7 +265,7 @@ function createWindow () {
})

mainWindow.on('show', () => {
tray.setHighlightMode('always')
tray.setHighlightMode('never')
})

mainWindow.on('hide', () => {
Expand Down

0 comments on commit 357017f

Please sign in to comment.