no message

This commit is contained in:
kuaifan 2024-12-12 23:10:33 +08:00
parent 29bc009c07
commit a06a4095b6
5 changed files with 20 additions and 2 deletions

View File

@ -456,6 +456,7 @@ export default {
return; return;
} }
window.__onBeforeUnload = () => { window.__onBeforeUnload = () => {
this.$store.dispatch("onBeforeUnload");
if (this.$Modal.removeLast()) { if (this.$Modal.removeLast()) {
return true; return true;
} }

View File

@ -227,7 +227,7 @@
if (this.max > 0 && this.disSource.length >= this.max) { if (this.max > 0 && this.disSource.length >= this.max) {
this.content = ''; this.content = '';
this.tis = '最多只能添加' + this.max + '个'; this.tis = '最多只能添加' + this.max + '个';
clearInterval(this.tisTimeout); clearTimeout(this.tisTimeout);
this.tisTimeout = setTimeout(() => { this.tis = ''; }, 2000); this.tisTimeout = setTimeout(() => { this.tis = ''; }, 2000);
return; return;
} }

View File

@ -188,6 +188,7 @@ export default {
// //
if (this.$isSubElectron) { if (this.$isSubElectron) {
window.__onBeforeUnload = () => { window.__onBeforeUnload = () => {
this.$store.dispatch("onBeforeUnload");
if (!this.equalContent) { if (!this.equalContent) {
$A.modalConfirm({ $A.modalConfirm({
content: '修改的内容尚未保存,确定要放弃修改吗?', content: '修改的内容尚未保存,确定要放弃修改吗?',

View File

@ -53,6 +53,7 @@ export default {
// //
if (this.$isSubElectron) { if (this.$isSubElectron) {
window.__onBeforeUnload = () => { window.__onBeforeUnload = () => {
this.$store.dispatch("onBeforeUnload");
if (this.$refs.taskDetail.checkUpdate()) { if (this.$refs.taskDetail.checkUpdate()) {
this.canUpdateBlur = false; this.canUpdateBlur = false;
$A.modalConfirm({ $A.modalConfirm({

View File

@ -941,6 +941,17 @@ export default {
}) })
}, },
/**
* Electron 页面卸载触发
* @param dispatch
*/
onBeforeUnload({dispatch}) {
if ($A.isSubElectron && $A.isJson(window.__dialogDraft)) {
dispatch("saveDialog", window.__dialogDraft)
window.__dialogDraft = null;
}
},
/** *****************************************************************************************/ /** *****************************************************************************************/
/** *************************************** 新窗口打开 ****************************************/ /** *************************************** 新窗口打开 ****************************************/
/** *****************************************************************************************/ /** *****************************************************************************************/
@ -3065,7 +3076,11 @@ export default {
*/ */
saveDialogDraft({state, dispatch}, data) { saveDialogDraft({state, dispatch}, data) {
data.extra_draft_content = $A.filterInvalidLine(data.extra_draft_content) data.extra_draft_content = $A.filterInvalidLine(data.extra_draft_content)
state.dialogDraftTimer[data.id] && clearInterval(state.dialogDraftTimer[data.id]) if ($A.isSubElectron) {
window.__dialogDraft = data
return
}
state.dialogDraftTimer[data.id] && clearTimeout(state.dialogDraftTimer[data.id])
state.dialogDraftTimer[data.id] = setTimeout(_ => { state.dialogDraftTimer[data.id] = setTimeout(_ => {
if (state.dialogId != data.id) { if (state.dialogId != data.id) {
data.extra_draft_has = data.extra_draft_content ? 1 : 0 data.extra_draft_has = data.extra_draft_content ? 1 : 0