diff --git a/.env.lt b/.env.lt new file mode 100644 index 0000000..79007b1 --- /dev/null +++ b/.env.lt @@ -0,0 +1,19 @@ +# 页面标题 +VITE_APP_TITLE = 文枢课堂 + +# 生产环境配置 +VITE_APP_ENV = 'production' + +# AIx融合数字管理系统/生产环境 +VITE_APP_BASE_API = 'https://prev.ysaix.com:7868/prod-api' + +VITE_APP_DOMAIN = 'prev.ysaix.com' + +VITE_APP_UPLOAD_API = 'https://prev.ysaix.com:7868/prod-api' + +# 是否在打包时开启压缩,支持 gzip 和 brotli +VITE_BUILD_COMPRESS = gzip + +VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktxt/' + +VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/' diff --git a/.env.production b/.env.production index 3998cfc..8640aa3 100644 --- a/.env.production +++ b/.env.production @@ -1,5 +1,5 @@ # 页面标题 -VITE_APP_TITLE = AIx数字平台 +VITE_APP_TITLE = AIX智慧课堂 # 生产环境配置 VITE_APP_ENV = 'production' diff --git a/electron-builder-lt.yml b/electron-builder-lt.yml new file mode 100644 index 0000000..f8e0b9a --- /dev/null +++ b/electron-builder-lt.yml @@ -0,0 +1,54 @@ +appId: com.electron.app +productName: 文枢课堂 +directories: + output: dist + buildResources: build +win: + executableName: 文枢课堂 + icon: resources/logo2.ico +files: + - '!**/.vscode/*' + - '!src/*' + - '!electron.vite.config.{js,ts,mjs,cjs}' + - '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}' + - '!{.env,.env.*,.npmrc,pnpm-lock.yaml}' +asarUnpack: + - resources/** +nsis: + oneClick: false + allowToChangeInstallationDirectory: true + artifactName: ${name}-${version}-setup.${ext} + shortcutName: ${productName} + uninstallDisplayName: ${productName} + createDesktopShortcut: always +mac: + entitlementsInherit: build/entitlements.mac.plist + extendInfo: + - NSCameraUsageDescription: Application requests access to the device's camera. + - NSMicrophoneUsageDescription: Application requests access to the device's microphone. + - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. + - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder. + notarize: false +dmg: + artifactName: ${name}-${version}.${ext} +linux: + target: + - AppImage + - snap + - deb + maintainer: electronjs.org + category: Utility +appImage: + artifactName: ${name}-${version}.${ext} +npmRebuild: false +publish: + provider: generic + url: https://prev.ysaix.com:7868/src/assets/smarttalk/ +electronDownload: + mirror: https://npmmirror.com/mirrors/electron/ +# 额外依赖打包到输出目录 +extraFiles: + - from: ./node_modules/im_electron_sdk/lib/ + to: ./resources + filter: + - '**/*' diff --git a/electron.vite.config.mjs b/electron.vite.config.mjs index 18b8cea..01bf054 100644 --- a/electron.vite.config.mjs +++ b/electron.vite.config.mjs @@ -3,7 +3,14 @@ import path from 'path' import { defineConfig, externalizeDepsPlugin } from 'electron-vite' import vue from '@vitejs/plugin-vue' import WindiCSS from "vite-plugin-windicss" - +/*import electron from 'vite-plugin-electron' +plugins: [electron({ + main: { + builderOptions: { + asar: false + } + } +})],*/ export default defineConfig({ main: { plugins: [externalizeDepsPlugin()] diff --git a/package.json b/package.json index bc6282a..825ea85 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "aix-win", - "version": "2.0.2", - "description": "An Electron application with Vue", + "version": "2.0.6", + "description": "", "main": "./out/main/index.js", "author": "example.com", "homepage": "https://electron-vite.org", @@ -16,6 +16,7 @@ "build:dev": "npm run build && electron-builder --win --config ./electron-builder-test.yml", "build:test": "electron-vite build --mode test && electron-builder --win --config ./electron-builder.yml", "build:prod": "electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml", + "build:lt": "electron-vite build --mode lt && electron-builder --win --config ./electron-builder-lt.yml", "build:mac": "npm run build && electron-builder --mac", "build:linux": "npm run build && electron-builder --linux" }, @@ -45,10 +46,12 @@ "jsencrypt": "^3.3.2", "jsondiffpatch": "0.6.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", "spark-md5": "^3.0.2", + "vite-plugin-electron": "^0.28.8", "vue-qr": "^4.0.9", "vue-router": "^4.4.0", "xgplayer": "^3.0.19", diff --git a/src/main/index.js b/src/main/index.js index ac96916..49433ec 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -21,6 +21,27 @@ File({ app, shell, BrowserWindow, ipcMain }) process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true' let mainWindow, loginWindow +const additionalData = {myKey:'ys_axi_smarttalk'} +const gotTheLock = app.requestSingleInstanceLock(additionalData) + +if(!gotTheLock){ + app.quit() +}else{ + app.on('second-instance',(event,commandLine,workingDirectory,additionalData)=>{ + //输入从第二个实例中接收到的数据 + console.log(additionalData) + //有人试图运行第二个实例,我们应该关注我们的窗口 + if(mainWindow){ + if(mainWindow.isMinimized()) mainWindow.restore() + mainWindow.focus() + } + if(loginWindow){ + if(loginWindow.isMinimized()) loginWindow.restore() + loginWindow.focus() + } + }) +} + //登录窗口 function createLoginWindow() { if (loginWindow) return @@ -53,7 +74,7 @@ function createLoginWindow() { updateInit(loginWindow) } - loginWindow.webContents.openDevTools() + // loginWindow.webContents.openDevTools() loginWindow.once('ready-to-show', () => { loginWindow.show() }) @@ -101,7 +122,7 @@ function createMainWindow() { shell.openExternal(details.url) return { action: 'deny' } }) - mainWindow.webContents.openDevTools() + // mainWindow.webContents.openDevTools() if (is.dev && process.env['ELECTRON_RENDERER_URL']) { mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL']) diff --git a/src/renderer/src/components/ai-chart/index.vue b/src/renderer/src/components/ai-chart/index.vue index 8d95703..18b00f5 100644 --- a/src/renderer/src/components/ai-chart/index.vue +++ b/src/renderer/src/components/ai-chart/index.vue @@ -115,7 +115,7 @@ const outerAi = [ title: '生成图片', secondTit: '文生图大模型', img: new URL('../../../src/assets/images/ai-01.png', import.meta.url).href, - path: '/ais/aisd3' + path: '/ais/aiwenxinyige' }, { id: 2, diff --git a/src/renderer/src/components/choose-textbook/index.vue b/src/renderer/src/components/choose-textbook/index.vue index 2436521..a79d68b 100644 --- a/src/renderer/src/components/choose-textbook/index.vue +++ b/src/renderer/src/components/choose-textbook/index.vue @@ -109,6 +109,20 @@ const emitChangeBook = async () => { }, node: curData } + /** + * 临时用 后续删除 unitId + */ + let levelFirstId = null + let levelSecondId = null + let bookeId = curBook.data.id + if (curData.parentNode) { + levelFirstId = curData.parentNode.id + levelSecondId = curData.id + } else { + levelFirstId = curData.id + levelSecondId = '' + } + localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId, bookeId})) emit('changeBook', data) } @@ -187,6 +201,22 @@ const handleNodeClick = (data, node) => { } localStorage.setItem('defaultExpandedKeys', parentNode ? JSON.stringify([parentNode.id]) : JSON.stringify([data.id])) localStorage.setItem('curNode', JSON.stringify(nodeData)) + + /** + * 临时用 后续删除 unitId + */ + let levelFirstId = null + let levelSecondId = null + let bookeId = curBook.data.id + if (nodeData.parentNode) { + levelFirstId = nodeData.parentNode.id + levelSecondId = nodeData.id + } else { + levelFirstId = nodeData.id + levelSecondId = '' + } + localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId, bookeId})) + emit('nodeClick', curData) } @@ -205,6 +235,7 @@ onMounted( async () => { } else{ curBook.data = useSubject.subjectList[0] + localStorage.setItem('curBook', JSON.stringify(curBook.data)) treeData.value = useSubject.treeData } // 设置展开并选中 diff --git a/src/renderer/src/hooks/useGetClassWork.js b/src/renderer/src/hooks/useGetClassWork.js index 7aa313a..2d7c654 100644 --- a/src/renderer/src/hooks/useGetClassWork.js +++ b/src/renderer/src/hooks/useGetClassWork.js @@ -102,8 +102,9 @@ const getTreeData = () => { levelFirstId = curNode.id levelSecondId = '' } + let bookeId = curBookId // 头部 教材分析、作业设计:打开外部链接需要当前章节ID - localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId})) + localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId, bookeId})) // const data = { // textBook: { diff --git a/src/renderer/src/layout/components/Header.vue b/src/renderer/src/layout/components/Header.vue index 620e6a8..8d50bbd 100644 --- a/src/renderer/src/layout/components/Header.vue +++ b/src/renderer/src/layout/components/Header.vue @@ -1,7 +1,10 @@