Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
fix: 修复应用不能打开问题 (#395)
Browse files Browse the repository at this point in the history
* fix: 修复应用不能打开问题
  • Loading branch information
nashaofu authored Dec 17, 2021
1 parent 3824ca7 commit b8b744d
Show file tree
Hide file tree
Showing 8 changed files with 500 additions and 403 deletions.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
'@babel/preset-env',
{
targets: {
electron: 15
electron: 16
}
}
]
Expand Down
1 change: 1 addition & 0 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ linux:
- arm64
- armv7l
executableName: dingtalk
desktop: 钉钉
icon: './resources/icons'
category: InstantMessaging;Network
nsis:
Expand Down
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dingtalk",
"version": "2.1.14",
"version": "2.1.13",
"description": "钉钉桌面版,基于electron和钉钉网页版开发,支持Windows、Linux和macOS",
"author": "nashaofu <[email protected]>",
"main": "dist/main.js",
Expand All @@ -27,27 +27,28 @@
"Windows"
],
"dependencies": {
"@babel/runtime": "^7.16.3",
"@babel/runtime": "^7.16.5",
"@sentry/electron": "^2.5.4",
"axios": "^0.24.0",
"electron-localshortcut": "^3.2.1",
"electron-screenshots": "^0.1.3",
"electron-updater": "^4.3.9",
"electron-updater": "^4.6.1",
"lodash": "^4.17.21",
"normalize.css": "^8.0.1",
"vue": "^2.6.14"
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/eslint-parser": "^7.16.3",
"@babel/plugin-proposal-class-properties": "^7.16.0",
"@babel/plugin-proposal-export-default-from": "^7.16.0",
"@babel/plugin-transform-runtime": "^7.16.4",
"@babel/preset-env": "^7.16.4",
"@babel/core": "^7.16.5",
"@babel/eslint-parser": "^7.16.5",
"@babel/plugin-proposal-class-properties": "^7.16.5",
"@babel/plugin-proposal-export-default-from": "^7.16.5",
"@babel/plugin-transform-runtime": "^7.16.5",
"@babel/preset-env": "^7.16.5",
"autoprefixer": "^10.4.0",
"babel-loader": "^8.2.3",
"css-loader": "^6.5.1",
"electron": "^14.2.2",
"electron-builder": "22.10.5",
"electron": "^16.0.5",
"electron-builder": "^22.14.5",
"electron-debug": "^3.2.0",
"electron-dev-webpack-plugin": "^1.0.5",
"electron-devtools-installer": "^3.2.0",
Expand All @@ -63,7 +64,7 @@
"less-loader": "^10.2.0",
"mini-css-extract-plugin": "^2.4.5",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.4",
"postcss": "^8.4.5",
"postcss-loader": "^6.2.1",
"pug": "^3.0.2",
"pug-plain-loader": "^1.1.0",
Expand Down
7 changes: 0 additions & 7 deletions src/main/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import { app } from 'electron'
import DingTalk from './dingtalk'
import debug from 'electron-debug'

app.whenReady().then(() => {
// 生产环境添加开发者工具
debug({ isEnabled: true, showDevTools: false })
})

export default new DingTalk()
19 changes: 18 additions & 1 deletion src/main/shortcut.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
import { globalShortcut } from 'electron'
import { BrowserWindow, globalShortcut } from 'electron'
import localShortcut from 'electron-localshortcut'

function toggleDevTools (win = BrowserWindow.getFocusedWindow()) {
if (!win) {
return
}

const { webContents } = win
if (webContents.isDevToolsOpened()) {
webContents.closeDevTools()
} else {
webContents.openDevTools()
}
}

export default dingtalk => () => {
const actions = {
Expand All @@ -15,4 +29,7 @@ export default dingtalk => () => {
globalShortcut.register(keymap[key].join('+'), actions[key])
}
})

localShortcut.register(process.platform === 'darwin' ? 'Command+Alt+I' : 'Control+Shift+I', toggleDevTools)
localShortcut.register('F12', toggleDevTools)
}
13 changes: 5 additions & 8 deletions src/renderer/settingWin/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
.app-item-button
dt-button(@click="reset") 还原设置
dt-button(
tabIndex="1"
type="primary"
@click="save"
) 保存设置
Expand All @@ -43,9 +44,7 @@ export default {
computed: {
shortcutCapture: {
get () {
return this.setting.keymap
? this.setting.keymap['screenshots-capture']
: []
return this.setting.keymap ? this.setting.keymap['screenshots-capture'] : []
},
set (val) {
const keymap = this.setting.keymap || {}
Expand Down Expand Up @@ -117,12 +116,10 @@ export default {
</script>

<style lang="less">
@import "~normalize.css";
@import '~normalize.css';
@font-family: "PingFang-SC-Medium", "Source Han Sans", "Segoe UI",
"Lucida Grande", Helvetica, Arial, "Microsoft YaHei", FreeSans, Arimo,
"Droid Sans", "wenquanyi micro hei", "Hiragino Sans GB", "Hiragino Sans GB W3",
sans-serif;
@font-family: 'PingFang-SC-Medium', 'Source Han Sans', 'Segoe UI', 'Lucida Grande', Helvetica, Arial, 'Microsoft YaHei',
FreeSans, Arimo, 'Droid Sans', 'wenquanyi micro hei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', sans-serif;
*,
*:before,
Expand Down
6 changes: 4 additions & 2 deletions src/renderer/settingWin/components/keybinding/keybinding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ export default {
}
// 必须要保证按键是keys中的键按下时的
if (($e.ctrlKey && this.keys[0] === 'Control') ||
if (
($e.ctrlKey && this.keys[0] === 'Control') ||
($e.altKey && this.keys[0] === 'Alt') ||
($e.shiftKey && this.keys[0] === 'Shift')) {
($e.shiftKey && this.keys[0] === 'Shift')
) {
this.keys.push(key)
} else {
// 当this.keys中有元素的时候,单独按下keys中的键
Expand Down
Loading

0 comments on commit b8b744d

Please sign in to comment.