From 519565f4636b22125d88ce05814318b1c8924615 Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Fri, 6 Dec 2024 14:25:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90PPT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.production | 2 +- package.json | 21 +- src/main/file.js | 5 +- src/renderer/src/utils/ppt-request.js | 31 +- .../src/views/prepare/container/ai-pptV2.vue | 389 ++++++++++++++++++ .../views/prepare/container/kj-list-item.vue | 2 +- .../views/prepare/container/ppt-dialog.vue | 2 +- src/renderer/src/views/prepare/index.vue | 11 +- 8 files changed, 443 insertions(+), 20 deletions(-) create mode 100644 src/renderer/src/views/prepare/container/ai-pptV2.vue diff --git a/.env.production b/.env.production index e103054..05e26a6 100644 --- a/.env.production +++ b/.env.production @@ -18,4 +18,4 @@ VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktx VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/' -VITE_SHOW_DEV_TOOLS = 'false' +VITE_SHOW_DEV_TOOLS = 'true' diff --git a/package.json b/package.json index 57803ba..9e8fbbb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aix-win", - "version": "2.1.36", + "version": "2.1.37", "description": "", "main": "./out/main/index.js", "author": "上海交大重庆人工智能研究院", @@ -21,11 +21,6 @@ "build:linux": "npm run build && electron-builder --linux" }, "dependencies": { - "@electron-toolkit/preload": "^3.0.1", - "@electron-toolkit/utils": "^3.0.0", - "@electron/remote": "^2.1.2", - "@element-plus/icons-vue": "^2.3.1", - "@vitejs/plugin-vue-jsx": "^4.0.0", "@antv/x6": "^2.18.1", "@antv/x6-plugin-clipboard": "^2.1.6", "@antv/x6-plugin-dnd": "^2.1.1", @@ -34,6 +29,11 @@ "@antv/x6-plugin-selection": "^2.2.2", "@antv/x6-plugin-snapline": "^2.1.7", "@antv/x6-plugin-transform": "^2.1.8", + "@electron-toolkit/preload": "^3.0.1", + "@electron-toolkit/utils": "^3.0.0", + "@electron/remote": "^2.1.2", + "@element-plus/icons-vue": "^2.3.1", + "@vitejs/plugin-vue-jsx": "^4.0.0", "@vue-office/docx": "^1.6.2", "@vue-office/excel": "^1.7.11", "@vue-office/pdf": "^2.0.2", @@ -53,20 +53,21 @@ "js-cookie": "^3.0.5", "jsencrypt": "^3.3.2", "jsondiffpatch": "0.6.0", + "less": "^4.2.0", + "less-loader": "^7.3.0", "lodash": "^4.17.21", "node-addon-api": "^8.1.0", "pdfjs-dist": "4.4.168", "pinia": "^2.1.7", "pinia-plugin-persistedstate": "^3.2.1", + "qs": "^6.13.1", "spark-md5": "^3.0.2", "vite-plugin-electron": "^0.28.8", "vue-qr": "^4.0.9", "vue-router": "^4.4.0", + "whiteboard_lyc": "^0.1.3", "xgplayer": "^3.0.19", - "xlsx": "^0.18.5", - "less": "^4.2.0", - "less-loader": "^7.3.0", - "whiteboard_lyc": "^0.1.3" + "xlsx": "^0.18.5" }, "devDependencies": { "@electron-toolkit/eslint-config": "^1.0.2", diff --git a/src/main/file.js b/src/main/file.js index 3de3333..d1d95fe 100644 --- a/src/main/file.js +++ b/src/main/file.js @@ -284,9 +284,10 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) { function downloadFiles(url,fileName) { console.log(url,fileName) return new Promise((resolve, reject)=>{ - const browserWindow = BrowserWindow.getFocusedWindow() + const browserWindow = BrowserWindow.getAllWindows() + console.log(browserWindow) const id = manager.download({ - window: browserWindow, + window: browserWindow[0], url: url, saveAsFilename: fileName, directory: appTempFilePath, diff --git a/src/renderer/src/utils/ppt-request.js b/src/renderer/src/utils/ppt-request.js index ccfc55f..1a36d3d 100644 --- a/src/renderer/src/utils/ppt-request.js +++ b/src/renderer/src/utils/ppt-request.js @@ -96,5 +96,34 @@ const getProgress = async (id) => { throw error; } }; +const getBackGroundV2 = async () => { + try { + const response = await req("/api/aipptV2/themeListV2", "GET"); + return response.data; + } catch (error) { + console.error("请求失败:", error); + throw error; + } +}; +const createPPTV2 = async (data) => { + try { + const response = await req("/api/aipptV2/createV2", "POST", data); + console.log("createOutline response:", response); -export { createOutline, getBackGround, createPPT, getProgress, createByOutline }; + return response.data; + } catch (error) { + console.error("请求失败:", error); + throw error; + } +}; +const getProgressV2 = async (id) => { + try { + const response = await req(`/api/aipptV2/progressV2?sid=${id}`, "GET"); + return response.data; + } catch (error) { + console.error("请求失败:", error); + throw error; + } +}; + +export { createOutline, getBackGround, createPPT, getProgress, getBackGroundV2, createPPTV2, getProgressV2, createByOutline }; diff --git a/src/renderer/src/views/prepare/container/ai-pptV2.vue b/src/renderer/src/views/prepare/container/ai-pptV2.vue new file mode 100644 index 0000000..7211bd6 --- /dev/null +++ b/src/renderer/src/views/prepare/container/ai-pptV2.vue @@ -0,0 +1,389 @@ + + + + + + diff --git a/src/renderer/src/views/prepare/container/kj-list-item.vue b/src/renderer/src/views/prepare/container/kj-list-item.vue index 8936e22..0de9e25 100644 --- a/src/renderer/src/views/prepare/container/kj-list-item.vue +++ b/src/renderer/src/views/prepare/container/kj-list-item.vue @@ -347,7 +347,7 @@ export default { Object.assign(items, item) asyncLocalFile(items).then(() => { ipcRenderer.send('open-path-app', item.fileNewName) - if (this.listenList.indexOf(item.fileNewName) === -1) { + if (this.listenList?.indexOf(item.fileNewName) === -1) { this.listenList.push(item.fileNewName) let cookie = localStorage.getItem('Admin-Token') ipcRenderer.send('listen-file-change', { diff --git a/src/renderer/src/views/prepare/container/ppt-dialog.vue b/src/renderer/src/views/prepare/container/ppt-dialog.vue index 7c96b3c..c670399 100644 --- a/src/renderer/src/views/prepare/container/ppt-dialog.vue +++ b/src/renderer/src/views/prepare/container/ppt-dialog.vue @@ -13,7 +13,7 @@