mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-28 12:50:48 +00:00
no message
This commit is contained in:
parent
a925102881
commit
bebeb49ae4
33
electron/electron.js
vendored
33
electron/electron.js
vendored
@ -201,13 +201,9 @@ if (!getTheLock) {
|
||||
}
|
||||
// 截图对象
|
||||
screenshotObj = new Screenshots({
|
||||
singleWindow: true
|
||||
singleWindow: true,
|
||||
mainWindow: mainWindow
|
||||
})
|
||||
globalShortcut.register("esc", () => {
|
||||
if (screenshotObj.$win?.isFocused()) {
|
||||
screenshotObj.endCapture().then(_ => {});
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
@ -229,6 +225,10 @@ app.on('before-quit', () => {
|
||||
willQuitApp = true
|
||||
})
|
||||
|
||||
app.on("will-quit",function(){
|
||||
globalShortcut.unregisterAll();
|
||||
})
|
||||
|
||||
app.on('browser-window-blur', () => {
|
||||
if (mainWindow) {
|
||||
mainWindow.webContents.send("browserWindowBlur", {})
|
||||
@ -473,7 +473,10 @@ ipcMain.on('bindScreenshotKey', (event, args) => {
|
||||
if (key) {
|
||||
screenshotKey = key
|
||||
globalShortcut.register(key, () => {
|
||||
screenshotObj.startCapture().then(_ => {})
|
||||
screenshotObj.startCapture().then(_ => {
|
||||
screenshotObj.view.webContents.executeJavaScript('if(typeof window.__initializeShortcuts===\'undefined\'){window.__initializeShortcuts=true;document.addEventListener(\'keydown\',function(e){console.log(e);if(e.keyCode===27){window.screenshots.cancel()}})}', true).catch(() => {});
|
||||
screenshotObj.view.webContents.focus()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -483,8 +486,20 @@ ipcMain.on('bindScreenshotKey', (event, args) => {
|
||||
/**
|
||||
* 执行截图
|
||||
*/
|
||||
ipcMain.on('onScreenshot', (event) => {
|
||||
screenshotObj.startCapture().then(_ => {})
|
||||
ipcMain.on('openScreenshot', (event) => {
|
||||
if (screenshotObj) {
|
||||
screenshotObj.startCapture().then(_ => {})
|
||||
}
|
||||
event.returnValue = "ok"
|
||||
})
|
||||
|
||||
/**
|
||||
* 关闭截图
|
||||
*/
|
||||
ipcMain.on('closeScreenshot', (event) => {
|
||||
if (screenshotObj && screenshotObj.window?.isFocused()) {
|
||||
screenshotObj.endCapture().then(_ => {});
|
||||
}
|
||||
event.returnValue = "ok"
|
||||
})
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ export default {
|
||||
}, 6000)
|
||||
}
|
||||
//
|
||||
if (this.$openLog) {
|
||||
if ($A.openLog) {
|
||||
$A.loadScript('js/vconsole.min.js', (e) => {
|
||||
if (e !== null || typeof window.VConsole !== 'function') {
|
||||
$A.modalError("vConsole 组件加载失败!");
|
||||
|
||||
57
resources/assets/js/app.js
vendored
57
resources/assets/js/app.js
vendored
@ -135,6 +135,7 @@ Vue.prototype.goBack = function () {
|
||||
};
|
||||
|
||||
// 全局对象/变量
|
||||
$A.L = $L;
|
||||
$A.Electron = null;
|
||||
$A.Platform = "web";
|
||||
$A.isMainElectron = false;
|
||||
@ -148,35 +149,7 @@ if (isElectron) {
|
||||
$A.isSubElectron = /\s+SubTaskWindow\//.test(window.navigator.userAgent);
|
||||
}
|
||||
|
||||
Vue.prototype.$A = $A;
|
||||
Vue.prototype.$L = $L;
|
||||
Vue.prototype.$Electron = $A.Electron;
|
||||
Vue.prototype.$Platform = $A.Platform;
|
||||
Vue.prototype.$isMainElectron = $A.isMainElectron;
|
||||
Vue.prototype.$isSubElectron = $A.isSubElectron;
|
||||
Vue.prototype.$isEEUiApp = $A.isEEUiApp;
|
||||
Vue.prototype.$openLog = $A.openLog;
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
Vue.mixin(mixin)
|
||||
|
||||
const app = new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
store,
|
||||
template: '<App/>',
|
||||
components: { App }
|
||||
});
|
||||
|
||||
|
||||
$A.goForward = app.goForward;
|
||||
$A.goBack = app.goBack;
|
||||
$A.Message = app.$Message;
|
||||
$A.Notice = app.$Notice;
|
||||
$A.Modal = app.$Modal;
|
||||
$A.store = app.$store;
|
||||
$A.L = app.$L;
|
||||
|
||||
// 子窗口给主窗口发送指令相关
|
||||
$A.execMainDispatch = (action, data) => {
|
||||
if ($A.isSubElectron) {
|
||||
$A.Electron.sendMessage('sendForwardMain', {
|
||||
@ -193,6 +166,7 @@ $A.execMainCacheJudge = (key) => {
|
||||
return val
|
||||
};
|
||||
|
||||
// 绑定截图快捷键
|
||||
$A.bindScreenshotKey = (data) => {
|
||||
let key = "";
|
||||
if (data.screenshot_key && (data.screenshot_mate || data.screenshot_shift)) {
|
||||
@ -206,3 +180,28 @@ $A.bindScreenshotKey = (data) => {
|
||||
}
|
||||
$A.Electron.sendMessage('bindScreenshotKey', {key});
|
||||
};
|
||||
|
||||
Vue.prototype.$A = $A;
|
||||
Vue.prototype.$L = $L;
|
||||
Vue.prototype.$Electron = $A.Electron;
|
||||
Vue.prototype.$Platform = $A.Platform;
|
||||
Vue.prototype.$isMainElectron = $A.isMainElectron;
|
||||
Vue.prototype.$isSubElectron = $A.isSubElectron;
|
||||
Vue.prototype.$isEEUiApp = $A.isEEUiApp;
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
Vue.mixin(mixin)
|
||||
|
||||
const app = new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
store,
|
||||
template: '<App/>',
|
||||
components: { App }
|
||||
});
|
||||
|
||||
$A.goForward = app.goForward;
|
||||
$A.goBack = app.goBack;
|
||||
$A.Message = app.$Message;
|
||||
$A.Notice = app.$Notice;
|
||||
$A.Modal = app.$Modal;
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
</FormItem>
|
||||
</Form>
|
||||
<div class="setting-footer">
|
||||
<Button :loading="loadIng > 0" type="primary" @click="submitForm">{{$L('提交')}}</Button>
|
||||
<Button :loading="loadIng > 0" type="primary" @click="submitForm">{{$L('保存')}}</Button>
|
||||
<Button :loading="loadIng > 0" @click="resetForm" style="margin-left: 8px">{{$L('重置')}}</Button>
|
||||
</div>
|
||||
</div>
|
||||
@ -65,8 +65,13 @@ export default {
|
||||
this.formData_bak = $A.cloneJSON(this.formData);
|
||||
},
|
||||
|
||||
onKeydown({key}) {
|
||||
this.formData.screenshot_key = key && key.length === 1 ? key.toUpperCase() : ""
|
||||
onKeydown({key, keyCode}) {
|
||||
if (keyCode !== 8) {
|
||||
key = key && key.length === 1 ? key.toUpperCase() : ""
|
||||
if (key) {
|
||||
this.formData.screenshot_key = key
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
submitForm() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user