diff --git a/src/main/index.js b/src/main/index.js index 441bf06..d5e6f75 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -126,12 +126,8 @@ async function createLinkWin(data) { let cookieDetails = { ...data.cookieData } await linkWin[data.key].webContents.session.cookies .set(cookieDetails) - .then(() => { - console.log('Cookie is successful') - }) - .catch((error) => { - console.error('Cookie is error', error) - }) + .then(() => {}) + .catch((error) => {}) data.fullPath = data.fullPath.replaceAll('//', '/') linkWin[data.key].loadURL(data.fullPath) diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue index c086d14..bc300b3 100644 --- a/src/renderer/src/views/prepare/index.vue +++ b/src/renderer/src/views/prepare/index.vue @@ -192,7 +192,6 @@ export default { // 用户信息 userStore: '', entpcourseid: '', - timerId: null, // 布置作业弹窗 setDialog: false, row: '' @@ -205,13 +204,7 @@ export default { ) } }, - watch: { - $route(to) { - if (to.path != '/prepare' && this.timerId) { - clearInterval(this.timerId) - } - } - }, + created() { this.userStore = useUserStore().user ipcRenderer.removeAllListeners('copy-file-default-reply') @@ -229,6 +222,13 @@ export default { setTimeout(this.initReserv, 500) } ) + // electron 当前窗口 + const curWin = Remote.getCurrentWindow() + curWin.on('focus', ()=>{ + this.initHomeWork() + }) + + }, // activated() { // if (this.uploadData.textbookId !== null) { @@ -423,9 +423,7 @@ export default { await this.asyncAllFile() }, async initHomeWork() { - if (this.timerId) { - clearInterval(this.timerId) - } + if (this.uploadData.levelSecondId) { // 获取作业列表所需ID 可能存在没有 let { rows } = await this.getChapterId() @@ -468,10 +466,7 @@ export default { }, // 打开外部链接 handleOutLink(key) { - if (key == 'homeWork') { - // 查询作业 - this.createTimer() - } + // key 对应的 linkConfig.js 外部链接配置 let configObj = outLink()[key] // 通知主进程 @@ -483,19 +478,13 @@ export default { }, // 根据教材章节单元ID 查询作业列表所需ID getChapterId() { - console.log(this.userStore, 'this.userStore') return listEntpcourse({ evalid: this.uploadData.levelSecondId, edituserid: this.userStore.userId, pageSize: 500 }) }, - // 查询作业列表定时器 - createTimer() { - this.timerId = setInterval(() => { - this.getHomeWorkList() - }, 2500) - }, + // 查询作业列表 getHomeWorkList() { homeworklist({