Compare commits

...

8 Commits

Author SHA1 Message Date
朱浩 62248dfafa Merge branch 'main' into zhuhao_dev
# Conflicts:
#	src/renderer/src/views/prepare/index.vue
2024-07-23 16:01:53 +08:00
朱浩 af941a22b7 Merge pull request '二期:自动同步功能开发' (#56) from zhuhao_dev into main
Reviewed-on: #56
2024-07-23 14:32:01 +08:00
lyc 3487cabc02 Merge pull request 'lyc-dev' (#55) from lyc-dev into main 2024-07-23 14:08:22 +08:00
lyc 5712e77a29 openwindow 2024-07-23 14:08:00 +08:00
朱浩 7106d75964 Merge pull request '二期:自动同步功能开发' (#54) from zhuhao_dev into main
Reviewed-on: #54
2024-07-23 14:07:13 +08:00
lyc 4a5fb04362 Merge branch 'main' into lyc-dev 2024-07-23 13:46:32 +08:00
lyc d91f08d398 布置作业 2024-07-23 13:46:09 +08:00
朱浩 5afa31b8c3 Merge pull request 'zhuhao_dev' (#53) from zhuhao_dev into main
Reviewed-on: #53
2024-07-23 13:45:27 +08:00
3 changed files with 48 additions and 33 deletions

View File

@ -41,7 +41,7 @@ function createMainWindow() {
width: 1200,
height: 700,
show: false,
frame: false,
frame: false,// 无边框
autoHideMenuBar: true,
...(process.platform === 'linux' ? { icon } : {}),
webPreferences: {
@ -68,15 +68,15 @@ function createMainWindow() {
}
// 作业窗口相关-开发中
let workWindow
function createWork(data) {
if (workWindow) return
workWindow = new BrowserWindow({
let openWindow
function createOpenWin(data) {
if (openWindow) return
openWindow = new BrowserWindow({
width: 650,
height: 500,
show: false,
frame: true,
maximizable: true,
autoHideMenuBar: true,
...(process.platform === 'linux' ? { icon } : {}),
webPreferences: {
@ -84,30 +84,20 @@ function createWork(data) {
nodeIntegration: true
}
})
workWindow.webContents.session.cookies.set(
{
url: 'https://file.ysaix.com:7868',
name: 'Admin-Token',
value: data
},
function (error) {
if (error) {
console.error('Set cookie failed:', error)
} else {
console.log('Cookie set successfully.')
}
}
)
workWindow.loadURL(
'https://file.ysaix.com:7868/teaching/classtaskassign?titleName=%E4%BD%9C%E4%B8%9A%E5%B8%83%E7%BD%AE'
)
workWindow.once('ready-to-show', () => {
workWindow.show()
let cookieDetails = {...data.cookieData}
openWindow.webContents.session.cookies.set(cookieDetails).then(()=>{
console.log('Cookie set successfully.')
}).catch(err =>{
console.error('Set cookie failed:', error)
})
workWindow.on('closed', () => {
workWindow = null
openWindow.loadURL(data.fullPath)
openWindow.once('ready-to-show', () => {
openWindow.show()
})
openWindow.on('closed', () => {
openWindow = null
})
}
@ -165,7 +155,7 @@ app.on('ready', () => {
//打开作业窗口
ipcMain.on('openWork', (e, data) => {
createWork(data)
createOpenWin(data)
})
createLoginWindow()

View File

@ -0,0 +1,9 @@
// 作业
export const homeWorkConfig = {
// host 设置token 等
host: 'https://file.ysaix.com:7868',
name: 'Admin-Token',
// 完整路径
fullPath: 'https://file.ysaix.com:7868/teaching/classtaskassign?titleName=%E4%BD%9C%E4%B8%9A%E5%B8%83%E7%BD%AE'
}

View File

@ -37,7 +37,7 @@
</el-popover>
</div>
<div style="display: flex">
<el-button>布置作业</el-button>
<el-button @click="handleHomeWork">布置作业</el-button>
<el-button @click="isDialogOpen = true">上传资料</el-button>
<el-button type="primary" style="margin-left: 10px" @click="createFile">新建课件</el-button>
</div>
@ -73,7 +73,10 @@ import { toTimeText } from '@/utils/date'
import { ElMessage } from 'element-plus'
import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile'
import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue'
import useUserStore from '@/store/modules/user'
import { homeWorkConfig } from '@/utils/config'
const { ipcRenderer } = window.electron || {}
export default {
name: 'Prepare',
components: { ChooseTextbook, Refresh, uploadDialog, FileListItem, FileOperBatch, MoveFile },
@ -98,7 +101,8 @@ export default {
fileRoot: '备课'
},
//
curBookImg: ''
curBookImg: '',
userStore: ''
}
},
computed: {
@ -114,6 +118,7 @@ export default {
this.callback(param)
})
this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime')
this.userStore = useUserStore()
},
mounted() {
},
@ -245,7 +250,18 @@ export default {
this.uploadData.levelThirdId = cata[2]
this.uploadData.textbookId = data.textBook.curBookId
this.asyncAllFile()
}
},
//
handleHomeWork(){
ipcRenderer.send('openWork',{
fullPath: homeWorkConfig.fullPath,
cookieData: {
url: homeWorkConfig.host,
name: homeWorkConfig.name,
value: this.userStore.token
}
})
},
}
}
</script>