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

Commit

Permalink
Merge pull request #258 from nashaofu/dev
Browse files Browse the repository at this point in the history
升级截图程序
  • Loading branch information
nashaofu authored Dec 26, 2019
2 parents b9e67ac + 307b07f commit dbbc73f
Show file tree
Hide file tree
Showing 11 changed files with 1,194 additions and 781 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

钉钉桌面版,基于 electron 和钉钉网页版开发,支持 Windows、Linux 和 macOS

## 公司招人

招聘 react 技术栈的开发者,公司研发中心位于杭州,当前是北京团队招聘初级、中级和高级前端人员。高级或者中级工程师可培养为团队 leader,有带团队的经验加分,有意向的请私聊我,邮箱:[email protected]

## 安装步骤

> 直接从[GitHub releases](https://github.com/nashaofu/dingtalk/releases/latest)页面下载最新版安装包即可
Expand Down Expand Up @@ -73,7 +69,7 @@ npm run pack
1. 支持屏幕截图,并且支持多显示器截图。截图快捷键为`ctrl+alt+a`,2017-10-23
2. 支持网络错误页面提示,网络恢复自动跳转到登陆页面,2017-12-28
3. 修改网络错误页面,支持快捷键设置,2018-02-07
4. 更新截图功能,支持多显示器截图,目前确认支持 Ubuntu16,Ubuntu17 不支持,其他 Linux 系统未测试,其中使用了[shortcut-capture](https://github.com/nashaofu/shortcut-capture)模块来实现截图;修复设置页面不修改快捷键时,点击保存时提示错误的 BUG,2018-03-03
4. 更新截图功能,支持多显示器截图,目前确认支持 Ubuntu16,Ubuntu17 不支持,其他 Linux 系统未测试,其中使用了[electron-screenshots](https://github.com/nashaofu/electron-screenshots)模块来实现截图;修复设置页面不修改快捷键时,点击保存时提示错误的 BUG,2018-03-03
5. 整个项目采用 webpack 打包,采用 electron-builder 来构建应用,分别构建生成三大平台安装包,2018-03-22
6. 添加关于页面,文件下载进度支持,消息提示不弹出问题修复,修复 Linux 更新问题,2018-04-01
7. 修复消息提示 node-notifier 图标显示问题,2018-04-07
Expand Down
70 changes: 38 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dingtalk",
"version": "2.1.1",
"version": "2.1.2",
"description": "钉钉桌面版,基于electron和钉钉网页版开发,支持Windows、Linux和macOS",
"author": "nashaofu <[email protected]>",
"main": "dist/main.js",
Expand All @@ -27,57 +27,57 @@
"Windows"
],
"dependencies": {
"@babel/runtime": "^7.5.5",
"@babel/runtime": "^7.7.7",
"axios": "^0.19.0",
"electron-updater": "^4.1.2",
"electron-screenshots": "^0.0.5",
"electron-updater": "^4.2.0",
"lodash": "^4.17.15",
"normalize.css": "^8.0.1",
"shortcut-capture": "^1.2.1",
"vue": "^2.6.10"
"vue": "^2.6.11"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-export-default-from": "^7.5.2",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"autoprefixer": "^9.6.1",
"@babel/core": "^7.7.7",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-proposal-export-default-from": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.7.7",
"autoprefixer": "^9.7.3",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"chalk": "^2.4.2",
"css-loader": "^3.2.0",
"electron": "^5.0.10",
"chalk": "^3.0.0",
"css-loader": "^3.4.0",
"electron": "^6.1.7",
"electron-builder": "^21.2.0",
"electron-debug": "^3.0.1",
"electron-dev-webpack-plugin": "^1.0.4",
"electron-devtools-installer": "^2.2.4",
"eslint": "^6.2.2",
"eslint-config-standard": "^14.0.1",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^3.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^9.1.0",
"eslint-loader": "^3.0.3",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-vue": "^5.2.3",
"file-loader": "^4.2.0",
"eslint-plugin-vue": "^6.0.2",
"file-loader": "^5.0.2",
"friendly-errors-webpack-plugin": "^1.7.0",
"html-webpack-plugin": "^3.2.0",
"less": "^3.10.3",
"less-loader": "^5.0.0",
"mini-css-extract-plugin": "^0.8.0",
"mini-css-extract-plugin": "^0.9.0",
"postcss-loader": "^3.0.0",
"pug": "^2.0.4",
"pug-plain-loader": "^1.0.0",
"registry-auth-token": "^4.0.0",
"registry-url": "^5.1.0",
"url-loader": "^2.1.0",
"vue-loader": "^15.7.1",
"vue-template-compiler": "^2.6.10",
"webpack": "^4.39.3",
"webpack-cli": "^3.3.7",
"webpack-dev-server": "^3.8.0",
"webpack-merge": "^4.2.1"
"url-loader": "^3.0.0",
"vue-loader": "^15.8.3",
"vue-template-compiler": "^2.6.11",
"webpack": "^4.41.4",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.1",
"webpack-merge": "^4.2.2"
},
"build": {
"appId": "com.electron.dingtalk",
Expand Down Expand Up @@ -122,21 +122,27 @@
"target": "AppImage",
"arch": [
"x64",
"ia32"
"ia32",
"arm64",
"armv7l"
]
},
{
"target": "deb",
"arch": [
"x64",
"ia32"
"ia32",
"arm64",
"armv7l"
]
},
{
"target": "rpm",
"arch": [
"x64",
"ia32"
"ia32",
"arm64",
"armv7l"
]
}
],
Expand Down
Binary file modified screenshot/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions src/main/dingtalk.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import aboutWin from './aboutWin'
import shortcut from './shortcut'
import settingWin from './settingWin'
import DingtalkTray from './dingtalkTray'
import ShortcutCapture from 'shortcut-capture'
import Screenshots from 'electron-screenshots'

export default class DingTalk {
// app对象是否ready
Expand All @@ -27,7 +27,7 @@ export default class DingTalk {
// 关于窗口
$aboutWin = null
// 截图对象
$shortcutCapture = null
$screenshots = null
// 网络情况,默认为null,必须等到页面报告状态
online = null
// 默认配置
Expand All @@ -36,7 +36,7 @@ export default class DingTalk {
enableCapture: true,
enableFlicker: true,
keymap: {
'shortcut-capture': ['Control', 'Alt', 'A']
'screenshots-capture': ['Control', 'Alt', 'A']
}
}

Expand All @@ -48,7 +48,7 @@ export default class DingTalk {
Menu.setApplicationMenu(null)
this.initMainWin()
this.initTray()
this.initShortcutCapture()
this.initScreenshots()
this.initNotify()
this.bindShortcut()
})
Expand Down Expand Up @@ -93,8 +93,8 @@ export default class DingTalk {
/**
* 初始化截图
*/
initShortcutCapture () {
this.$shortcutCapture = new ShortcutCapture()
initScreenshots () {
this.$screenshots = new Screenshots()
}

/**
Expand Down Expand Up @@ -167,9 +167,9 @@ export default class DingTalk {
/**
* 截图
*/
shortcutCapture () {
if (this.$shortcutCapture) {
this.$shortcutCapture.shortcutCapture()
screenshotsCapture () {
if (this.$screenshots) {
this.$screenshots.startCapture()
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/dingtalkTray.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class DingtalkTray {
if (this._dingtalk.setting.enableCapture) {
menu.splice(1, 0, {
label: '屏幕截图',
click: () => this._dingtalk.shortcutCapture()
click: () => this._dingtalk.screenshotsCapture()
})
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export const readSetting = dingtalk => () => {
if (err) return reject(err)
try {
const setting = JSON.parse(data)
if (typeof setting.keymap['shortcut-capture'] === 'string') {
setting.keymap['shortcut-capture'] = setting.keymap['shortcut-capture'].split('+')
if (typeof setting.keymap['screenshots-capture'] === 'string') {
setting.keymap['screenshots-capture'] = setting.keymap['screenshots-capture'].split('+')
}
resolve({ ...dingtalk.setting, ...setting })
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/shortcut.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { globalShortcut } from 'electron'

export default dingtalk => () => {
const actions = {
'shortcut-capture': () => dingtalk.shortcutCapture()
'screenshots-capture': () => dingtalk.screenshotsCapture()
}
const keymap = dingtalk.setting.keymap

if (!dingtalk.setting.enableCapture) delete actions['shortcut-capture']
if (!dingtalk.setting.enableCapture) delete actions['screenshots-capture']

// 注销所有的快捷键
globalShortcut.unregisterAll()
Expand Down
20 changes: 19 additions & 1 deletion src/preload/mainWin/open.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,30 @@ export default injector => {
iframe.style.display = 'none'
document.body.append(iframe)

window.open = function (url, ...args) {
function download (url) {
if (url.indexOf('https://space.dingtalk.com/auth/download') === 0) {
iframe.src = url
return true
} else if (url.indexOf('https://space.dingtalk.com/attachment') === 0) {
iframe.src = url
return true
}
}

document.addEventListener('click', e => {
for (let i = 0, length = e.path.length; i < length; i++) {
const node = e.path[i]
if (node.nodeName === 'A' && node.href) {
if (download(node.href)) {
e.preventDefault()
return
}
}
}
})

window.open = function (url, ...args) {
download(url)
return op.call(window, url, ...args)
}
}
4 changes: 3 additions & 1 deletion src/renderer/aboutWin/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="pug">
.app
.app-logo
img.app-logo-image(src="./logo.png")
img.app-logo-image(:src="logo")
.app-logo-title 钉钉 {{ version }}

.app-update
Expand Down Expand Up @@ -33,11 +33,13 @@ import {
ipcRenderer,
shell
} from 'electron'
import logo from './logo.png'
export default {
name: 'App',
data () {
return {
logo,
version,
description,
author,
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/settingWin/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default {
shortcutCapture: {
get () {
return this.setting.keymap
? this.setting.keymap['shortcut-capture']
? this.setting.keymap['screenshots-capture']
: []
},
set (val) {
Expand All @@ -53,7 +53,7 @@ export default {
...this.setting,
keymap: {
...keymap,
'shortcut-capture': val
'screenshots-capture': val
}
}
}
Expand Down
Loading

0 comments on commit dbbc73f

Please sign in to comment.