diff --git a/package.json b/package.json index 99c4ada..c92e305 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "element-plus": "^2.7.6", "js-cookie": "^3.0.5", "jsencrypt": "^3.3.2", + "lodash": "^4.17.21", "pinia": "^2.1.7", "pinia-plugin-persistedstate": "^3.2.1", "spark-md5": "^3.0.2", diff --git a/src/main/index.js b/src/main/index.js index 56a0833..92cbb87 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -4,8 +4,10 @@ import { electronApp, optimizer, is } from '@electron-toolkit/utils' import icon from '../../resources/icon.png?asset' import File from './file' -File({ app, shell, BrowserWindow, ipcMain }) +// const handleUpdate = require("./handleUpdate"); +File({ app, shell, BrowserWindow, ipcMain }) +process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true' let mainWindow, loginWindow //登录窗口 @@ -24,9 +26,13 @@ function createLoginWindow() { nodeIntegration: true } }) - const loginURL = is.dev ? `http://localhost:5173/#/login` : `file://${__dirname}/index.html/login` + // handleUpdate(loginWindow,ipcMain) + const loginURL = is.dev ? `http://localhost:5173/#/login` : join(__dirname, '../renderer/index.html') loginWindow.loadURL(loginURL) + + + loginWindow.webContents.openDevTools() loginWindow.once('ready-to-show', () => { loginWindow.show() }) @@ -41,7 +47,7 @@ function createMainWindow() { width: 1200, height: 700, show: false, - frame: false,// 无边框 + frame: false, // 无边框 autoHideMenuBar: true, ...(process.platform === 'linux' ? { icon } : {}), webPreferences: { @@ -61,17 +67,18 @@ function createMainWindow() { mainWindow.webContents.openDevTools() if (is.dev && process.env['ELECTRON_RENDERER_URL']) { - mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL']) + mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'] ) } else { mainWindow.loadFile(join(__dirname, '../renderer/index.html')) } } + // 作业窗口相关-开发中 -let openWindow -function createOpenWin(data) { - if (openWindow) return - openWindow = new BrowserWindow({ +let linkWindow +async function createLinkWin(data) { + if (linkWindow) return + linkWindow = new BrowserWindow({ width: 650, height: 500, show: false, @@ -81,23 +88,26 @@ function createOpenWin(data) { ...(process.platform === 'linux' ? { icon } : {}), webPreferences: { sandbox: false, - nodeIntegration: true + nodeIntegration: true, + worldSafeExecuteJavaScript: true, + contextIsolation: true } }) - let cookieDetails = {...data.cookieData} - openWindow.webContents.session.cookies.set(cookieDetails).then(()=>{ - console.log('Cookie set successfully.') - }).catch(err =>{ - console.error('Set cookie failed:', error) + let cookieDetails = { ...data.cookieData } + await linkWindow.webContents.session.cookies.set(cookieDetails).then(()=>{ + console.log('Cookie is successful'); + }).catch( error =>{ + console.error('Cookie is error', error); }) - - openWindow.loadURL(data.fullPath) - openWindow.once('ready-to-show', () => { - openWindow.show() + linkWindow.loadURL(data.fullPath) + + linkWindow.once('ready-to-show', () => { + linkWindow.show() + linkWindow.maximize() }) - openWindow.on('closed', () => { - openWindow = null + linkWindow.on('closed', () => { + linkWindow = null }) } @@ -149,13 +159,14 @@ app.on('ready', () => { createLoginWindow() } mainWindow.destroy() + mainWindow = null loginWindow.show() loginWindow.focus() }) //打开作业窗口 - ipcMain.on('openWork', (e, data) => { - createOpenWin(data) + ipcMain.on('openWindow', (e, data) => { + createLinkWin(data) }) createLoginWindow() diff --git a/src/renderer/src/components/select-subject/index.vue b/src/renderer/src/components/select-subject/index.vue index d70c423..649337a 100644 --- a/src/renderer/src/components/select-subject/index.vue +++ b/src/renderer/src/components/select-subject/index.vue @@ -79,10 +79,6 @@ const subjectList = ref([]) const allSubject = ref([]) const dialogVisible = ref(false) -watch(() => props.modelValue, (newVal) => { - dialogVisible.value = newVal -}) - //切换年级 const changeGrade = ()=>{ // 切换年级 过滤出对应学科数据 @@ -120,8 +116,13 @@ const editUserInfo = async () =>{ emit('onSuccess') } +watch(() => props.modelValue, (newVal) => { + dialogVisible.value = newVal + if(newVal){ + getSubject() + } +}) -onMounted(getSubject) diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue index 9a04fdc..7d1954f 100644 --- a/src/renderer/src/views/prepare/index.vue +++ b/src/renderer/src/views/prepare/index.vue @@ -7,9 +7,9 @@
- 教材研读 - 电子课本 - 高考研读 + 课标研读 + 电子课本 + 高考研读 教学大模型
@@ -37,7 +37,7 @@
- 布置作业 + 布置作业 上传资料 新建课件
@@ -73,8 +73,8 @@ 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' + +import outLink from '@/utils/linkConfig' const { ipcRenderer } = window.electron || {} export default { @@ -102,7 +102,6 @@ export default { }, // 当前教材封面图 curBookImg: '', - userStore: '' } }, computed: { @@ -118,7 +117,7 @@ export default { this.callback(param) }) this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime') - this.userStore = useUserStore() + }, mounted() { }, @@ -251,15 +250,14 @@ export default { 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 - } + // 打开外部链接 + handleOutLink(key){ + // key 对应的 linkConfig.js 外部链接配置 + let configObj = outLink[key] + // 通知主进程 + ipcRenderer.send('openWindow', { + fullPath: configObj.fullPath, + cookieData: {...(configObj.data)} }) }, } diff --git a/src/renderer/src/views/resource/container/resoure-search.vue b/src/renderer/src/views/resource/container/resoure-search.vue index 11cd9ba..7272c0f 100644 --- a/src/renderer/src/views/resource/container/resoure-search.vue +++ b/src/renderer/src/views/resource/container/resoure-search.vue @@ -8,12 +8,13 @@ }}
- + -
@@ -22,7 +23,7 @@ {{ - item.label }} + item.label }}
@@ -58,7 +59,8 @@ const sourceStore = useResoureStore() .query-row { justify-content: space-between; - .row-left{ + + .row-left { align-items: center; } } @@ -70,11 +72,12 @@ const sourceStore = useResoureStore() margin: 0 10px; } - + } } -.el-button.is-round{ + +.el-button.is-round { padding: 3px 15px; font-size: 13px; } diff --git a/src/renderer/src/views/resource/index.vue b/src/renderer/src/views/resource/index.vue index df5d5bf..fad1f68 100644 --- a/src/renderer/src/views/resource/index.vue +++ b/src/renderer/src/views/resource/index.vue @@ -6,7 +6,7 @@
- + 新建资源 @@ -26,6 +26,7 @@ import ResoureSearch from './container/resoure-search.vue' import ResoureList from './container/resoure-list.vue' import uploadDialog from '@/components/upload-dialog/index.vue' import uploaderState from '@/store/modules/uploader' +import { hasPermission } from '@/utils/hasPermission' const sourceStore = useResoureStore() const isDialogOpen = ref(false) @@ -76,7 +77,6 @@ const submitFile = (data) => { const fileCallBack = (res) => { - console.log(res) if (res.code == 200) { sourceStore.handleQuery() } diff --git a/src/renderer/src/views/resource/store.js b/src/renderer/src/views/resource/store.js index fdf918a..3f2342e 100644 --- a/src/renderer/src/views/resource/store.js +++ b/src/renderer/src/views/resource/store.js @@ -2,6 +2,7 @@ import { defineStore } from 'pinia' import { getSmarttalkPage } from '@/api/file/index' import { tabs, resourceType, resourceFormat } from '@/utils/resourceDict' import useUserStore from '@/store/modules/user' +import { hasPermission } from '@/utils/hasPermission' const userStore = useUserStore() @@ -21,10 +22,15 @@ const resourceFormatList = [ ] // 校本资源为学校ID -tabs.forEach(item =>{ - if( item.label == "校本资源"){ - item.value = userStore.user.deptId - } +tabs.forEach((item) => { + if (item.label == '校本资源') { + item.value = userStore.user.deptId + } +}) +tabs.forEach((item, i) => { + if (item.label == '平台资源' && !hasPermission(['platformmanager'])) { + tabs.splice(i, 1) + } }) const structQuery = { @@ -39,14 +45,14 @@ export default defineStore('resource', { resourceFormatList, searchKey: '', - + //节点数据 - nodeData:{}, + nodeData: {}, loading: false, //查询条件 query: { textbookId: '', - fileSource: '平台', + fileSource: tabs[0].value, //资源格式 mp3 ppt ... fileSuffix: -1, // 资源类型 课件 素材 教案 @@ -66,10 +72,11 @@ export default defineStore('resource', { handleQuery() { try { this.loading = true - let data = {...this.query} - if(data.fileSuffix == -1){ + let data = { ...this.query } + if (data.fileSuffix == -1) { data.fileSuffix = '' } + console.log(data, 200) getSmarttalkPage(data).then((res) => { this.result.total = res.total this.result.list = res.rows @@ -86,14 +93,13 @@ export default defineStore('resource', { this.query.fileFlag = val this.handleQuery() }, - changeSuffix(val){ + changeSuffix(val) { this.query.fileSuffix = val this.handleQuery() }, // 关键词搜索 - changeName(){ - console.log(this.query.fileName) + changeName() { this.handleQuery() - }, + } } })