Compare commits
No commits in common. "main" and "cys" have entirely different histories.
|
@ -7,13 +7,8 @@ VITE_APP_ENV = 'development'
|
||||||
# AIx融合数字管理系统/开发环境
|
# AIx融合数字管理系统/开发环境
|
||||||
VITE_APP_BASE_API = '/dev-api'
|
VITE_APP_BASE_API = '/dev-api'
|
||||||
|
|
||||||
VITE_APP_DOMAIN = 'file.ysaix.com'
|
VITE_APP_UPLOAD_API = 'http://192.168.2.52:7863'
|
||||||
|
|
||||||
VITE_APP_UPLOAD_API = 'https://file.ysaix.com:7868/prod-api'
|
|
||||||
#VITE_APP_UPLOAD_API = 'http://192.168.2.52:7863'
|
|
||||||
|
|
||||||
VITE_APP_RES_FILE_PATH = 'https://file.ysaix.com:7868/src/assets/textbook/booktxt/'
|
VITE_APP_RES_FILE_PATH = 'https://file.ysaix.com:7868/src/assets/textbook/booktxt/'
|
||||||
|
|
||||||
VITE_APP_BUILD_BASE_PATH = 'https://file.ysaix.com:7868/'
|
VITE_APP_BUILD_BASE_PATH = 'https://file.ysaix.com:7868/'
|
||||||
|
|
||||||
VITE_SHOW_DEV_TOOLS = 'true'
|
|
||||||
|
|
19
.env.old
19
.env.old
|
@ -1,19 +0,0 @@
|
||||||
# 页面标题
|
|
||||||
VITE_APP_TITLE = AIX智慧课堂
|
|
||||||
|
|
||||||
# 生产环境配置
|
|
||||||
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/'
|
|
|
@ -1,15 +1,13 @@
|
||||||
# 页面标题
|
# 页面标题
|
||||||
VITE_APP_TITLE = 文枢课堂
|
VITE_APP_TITLE = AIx数字平台
|
||||||
|
|
||||||
# 生产环境配置
|
# 生产环境配置
|
||||||
VITE_APP_ENV = 'production'
|
VITE_APP_ENV = 'production'
|
||||||
|
|
||||||
# AIx融合数字管理系统/生产环境
|
# AIx融合数字管理系统/生产环境
|
||||||
VITE_APP_BASE_API = 'https://prev.ysaix.com:7868/prod-api'
|
VITE_APP_BASE_API = 'http://192.168.2.52:7863'
|
||||||
|
|
||||||
VITE_APP_DOMAIN = 'prev.ysaix.com'
|
VITE_APP_UPLOAD_API = 'https://prev.ysaix.com:7868'
|
||||||
|
|
||||||
VITE_APP_UPLOAD_API = 'https://prev.ysaix.com:7868/prod-api'
|
|
||||||
|
|
||||||
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
||||||
VITE_BUILD_COMPRESS = gzip
|
VITE_BUILD_COMPRESS = gzip
|
||||||
|
@ -17,5 +15,3 @@ VITE_BUILD_COMPRESS = gzip
|
||||||
VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktxt/'
|
VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktxt/'
|
||||||
|
|
||||||
VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
|
VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
|
||||||
|
|
||||||
VITE_SHOW_DEV_TOOLS = 'false'
|
|
||||||
|
|
19
.env.test
19
.env.test
|
@ -1,19 +0,0 @@
|
||||||
# 页面标题
|
|
||||||
VITE_APP_TITLE = AIx数字平台(测试版)
|
|
||||||
|
|
||||||
# 生产环境配置
|
|
||||||
VITE_APP_ENV = 'production'
|
|
||||||
|
|
||||||
# AIx融合数字管理系统/生产环境
|
|
||||||
VITE_APP_BASE_API = 'https://file.ysaix.com:7868/prod-api'
|
|
||||||
|
|
||||||
VITE_APP_DOMAIN = 'file.ysaix.com'
|
|
||||||
|
|
||||||
VITE_APP_UPLOAD_API = 'https://file.ysaix.com:7868/prod-api'
|
|
||||||
|
|
||||||
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
|
||||||
VITE_BUILD_COMPRESS = gzip
|
|
||||||
|
|
||||||
VITE_APP_RES_FILE_PATH = 'https://file.ysaix.com:7868/src/assets/textbook/booktxt/'
|
|
||||||
|
|
||||||
VITE_APP_BUILD_BASE_PATH = 'https://file.ysaix.com:7868/'
|
|
|
@ -10,7 +10,6 @@ module.exports = {
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
'vue/require-default-prop': 'off',
|
'vue/require-default-prop': 'off',
|
||||||
'vue/multi-word-component-names': 'off',
|
'vue/multi-word-component-names': 'off'
|
||||||
'prettier/prettier': 'off'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
provider: generic
|
provider: generic
|
||||||
url: http://localhost:3000/
|
url: https://example.com/auto-updates
|
||||||
updaterCacheDirName: electron-app-updater
|
updaterCacheDirName: electron-app-updater
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
appId: com.electron.app
|
|
||||||
productName: AIx
|
|
||||||
directories:
|
|
||||||
output: dist
|
|
||||||
buildResources: build
|
|
||||||
win:
|
|
||||||
executableName: AIx
|
|
||||||
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:
|
|
||||||
- '**/*'
|
|
|
@ -1,54 +0,0 @@
|
||||||
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:
|
|
||||||
- '**/*'
|
|
|
@ -1,53 +0,0 @@
|
||||||
appId: com.electron.app
|
|
||||||
productName: AIx
|
|
||||||
directories:
|
|
||||||
buildResources: build
|
|
||||||
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/**
|
|
||||||
win:
|
|
||||||
executableName: AIx
|
|
||||||
icon: resources/logo2.ico
|
|
||||||
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: http://localhost:3000
|
|
||||||
electronDownload:
|
|
||||||
mirror: https://npmmirror.com/mirrors/electron/
|
|
||||||
# 额外依赖打包到输出目录
|
|
||||||
extraFiles:
|
|
||||||
- from: ./node_modules/im_electron_sdk/lib/
|
|
||||||
to: ./resources
|
|
||||||
filter:
|
|
||||||
- '**/*'
|
|
|
@ -12,11 +12,10 @@ asarUnpack:
|
||||||
- resources/**
|
- resources/**
|
||||||
win:
|
win:
|
||||||
executableName: AIx
|
executableName: AIx
|
||||||
icon: resources/logo2.ico
|
|
||||||
nsis:
|
nsis:
|
||||||
oneClick: false
|
oneClick: false
|
||||||
allowToChangeInstallationDirectory: true
|
allowToChangeInstallationDirectory: true
|
||||||
artifactName: ${name}-${version}-test.${ext}
|
artifactName: ${name}-${version}-setup.${ext}
|
||||||
shortcutName: ${productName}
|
shortcutName: ${productName}
|
||||||
uninstallDisplayName: ${productName}
|
uninstallDisplayName: ${productName}
|
||||||
createDesktopShortcut: always
|
createDesktopShortcut: always
|
||||||
|
@ -42,12 +41,6 @@ appImage:
|
||||||
npmRebuild: false
|
npmRebuild: false
|
||||||
publish:
|
publish:
|
||||||
provider: generic
|
provider: generic
|
||||||
url: https://file.ysaix.com:7868/src/assets/smarttalk/
|
url: https://example.com/auto-updates
|
||||||
electronDownload:
|
electronDownload:
|
||||||
mirror: https://npmmirror.com/mirrors/electron/
|
mirror: https://npmmirror.com/mirrors/electron/
|
||||||
# 额外依赖打包到输出目录
|
|
||||||
extraFiles:
|
|
||||||
- from: ./node_modules/im_electron_sdk/lib/
|
|
||||||
to: ./resources
|
|
||||||
filter:
|
|
||||||
- '**/*'
|
|
||||||
|
|
|
@ -3,14 +3,7 @@ import path from 'path'
|
||||||
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
|
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import WindiCSS from "vite-plugin-windicss"
|
import WindiCSS from "vite-plugin-windicss"
|
||||||
/*import electron from 'vite-plugin-electron'
|
|
||||||
plugins: [electron({
|
|
||||||
main: {
|
|
||||||
builderOptions: {
|
|
||||||
asar: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})],*/
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
main: {
|
main: {
|
||||||
plugins: [externalizeDepsPlugin()]
|
plugins: [externalizeDepsPlugin()]
|
||||||
|
@ -24,29 +17,20 @@ export default defineConfig({
|
||||||
// '@': resolve('./src/renderer/src'),
|
// '@': resolve('./src/renderer/src'),
|
||||||
// '@': path.resolve(__dirname, 'src/renderer/src'),
|
// '@': path.resolve(__dirname, 'src/renderer/src'),
|
||||||
'@': path.join(__dirname, './src/renderer/src'),
|
'@': path.join(__dirname, './src/renderer/src'),
|
||||||
'@root': path.join(__dirname, '.'),
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
'/dev-api': {
|
'/dev-api': {
|
||||||
target: 'http://27.128.240.72:7865',
|
// target: 'http://27.128.240.72:7865',
|
||||||
// target: 'http://36.134.181.164:7863',
|
target: 'http://192.168.2.52:7863',
|
||||||
// target: 'http://192.168.2.52:7863',
|
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (p) => p.replace(/^\/dev-api/, '')
|
rewrite: (p) => p.replace(/^\/dev-api/, '')
|
||||||
},
|
},
|
||||||
'/baidubce': {
|
'/profile': {
|
||||||
target: 'https://aip.baidubce.com',
|
target: 'http://192.168.2.52:7863',
|
||||||
ws: true,
|
ws: true,
|
||||||
changeOrigin: true,
|
changeOrigin: true
|
||||||
rewrite: (p) => p.replace(/^\/baidubce/, '')
|
|
||||||
},
|
|
||||||
'/parth': {
|
|
||||||
target: 'https://zwapi.xfyun.cn', // 第三方API的地址
|
|
||||||
changeOrigin: true, // 改变请求的起源
|
|
||||||
rewrite: (path) => path.replace(/^\/parth/, '') // 重写路径
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*":[
|
"@/*":[
|
||||||
"src/renderer/src/*"
|
"src/renderer/src/*"
|
||||||
],
|
]
|
||||||
"@root/*":["./*"]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
|
53
package.json
53
package.json
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "aix-win",
|
"name": "electron-app",
|
||||||
"version": "2.1.30",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "An Electron application with Vue",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "上海交大重庆人工智能研究院",
|
"author": "example.com",
|
||||||
"homepage": "https://electron-vite.org",
|
"homepage": "https://electron-vite.org",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
|
@ -13,60 +13,25 @@
|
||||||
"build": "electron-vite build",
|
"build": "electron-vite build",
|
||||||
"postinstall": "electron-builder install-app-deps",
|
"postinstall": "electron-builder install-app-deps",
|
||||||
"build:unpack": "npm run build && electron-builder --dir",
|
"build:unpack": "npm run build && electron-builder --dir",
|
||||||
"build:dev": "npm run build && electron-builder --win --config ./electron-builder-test.yml",
|
"build:win": "npm run build && electron-builder --win",
|
||||||
"build:test": "electron-vite build --mode test && electron-builder --win --config ./electron-builder.yml",
|
"build:mac": "npm run build && electron-builder --mac",
|
||||||
"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": "electron-vite build --mode production && electron-builder --mac --config ./electron-builder-prod.yml",
|
|
||||||
"build:linux": "npm run build && electron-builder --linux"
|
"build:linux": "npm run build && electron-builder --linux"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron-toolkit/preload": "^3.0.1",
|
"@electron-toolkit/preload": "^3.0.1",
|
||||||
"@electron-toolkit/utils": "^3.0.0",
|
"@electron-toolkit/utils": "^3.0.0",
|
||||||
"@electron/remote": "^2.1.2",
|
|
||||||
"@element-plus/icons-vue": "^2.3.1",
|
"@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",
|
|
||||||
"@antv/x6-plugin-export": "^2.1.6",
|
|
||||||
"@antv/x6-plugin-keyboard": "^2.2.3",
|
|
||||||
"@antv/x6-plugin-selection": "^2.2.2",
|
|
||||||
"@antv/x6-plugin-snapline": "^2.1.7",
|
|
||||||
"@antv/x6-plugin-transform": "^2.1.8",
|
|
||||||
"@vue-office/docx": "^1.6.2",
|
|
||||||
"@vue-office/excel": "^1.7.11",
|
|
||||||
"@vue-office/pdf": "^2.0.2",
|
|
||||||
"@vueuse/core": "^10.11.0",
|
"@vueuse/core": "^10.11.0",
|
||||||
"circular-json": "^0.5.9",
|
|
||||||
"cropperjs": "^1.6.2",
|
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"echarts": "^5.5.1",
|
|
||||||
"electron-dl-manager": "^3.0.0",
|
"electron-dl-manager": "^3.0.0",
|
||||||
"electron-log": "^5.1.7",
|
|
||||||
"electron-store": "8.0.0",
|
|
||||||
"electron-updater": "^6.1.7",
|
"electron-updater": "^6.1.7",
|
||||||
"element-china-area-data": "^6.1.0",
|
"element-plus": "^2.7.6",
|
||||||
"element-plus": "^2.8.0",
|
|
||||||
"fabric": "^5.3.0",
|
|
||||||
"im_electron_sdk": "^8.0.5904",
|
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"jsencrypt": "^3.3.2",
|
"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": "^2.1.7",
|
||||||
"pinia-plugin-persistedstate": "^3.2.1",
|
"pinia-plugin-persistedstate": "^3.2.1",
|
||||||
"spark-md5": "^3.0.2",
|
"vue-cropper": "^1.0.3",
|
||||||
"vite-plugin-electron": "^0.28.8",
|
"vue-router": "^4.4.0"
|
||||||
"vue-qr": "^4.0.9",
|
|
||||||
"vue-router": "^4.4.0",
|
|
||||||
"xgplayer": "^3.0.19",
|
|
||||||
"xlsx": "^0.18.5",
|
|
||||||
"less": "^4.2.0",
|
|
||||||
"less-loader": "^7.3.0",
|
|
||||||
"whiteboard_lyc": "^0.1.3"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron-toolkit/eslint-config": "^1.0.2",
|
"@electron-toolkit/eslint-config": "^1.0.2",
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 57 KiB |
Binary file not shown.
Before Width: | Height: | Size: 48 KiB |
Binary file not shown.
Before Width: | Height: | Size: 59 KiB |
Binary file not shown.
Before Width: | Height: | Size: 65 KiB |
|
@ -1,20 +0,0 @@
|
||||||
/**
|
|
||||||
* @description 腾讯云-即时通讯-sdkID
|
|
||||||
*/
|
|
||||||
// import { ipcMain } from 'electron'
|
|
||||||
// const TimMain = require('im_electron_sdk/dist/main')
|
|
||||||
import TimMain from 'im_electron_sdk/dist/main'
|
|
||||||
// import {TIMErrCode} from 'im_electron_sdk/dist/enumbers'
|
|
||||||
const sdkappidDef = 1600034736 // 可以去腾讯云即时通信IM控制台申请
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
function init(sdkappid = sdkappidDef) {
|
|
||||||
return new TimMain({sdkappid})
|
|
||||||
}
|
|
||||||
export function initialize(){
|
|
||||||
// ipcMain.handle('im-chat:init', (event, sdkappid) => {
|
|
||||||
// return init(sdkappid)
|
|
||||||
// })
|
|
||||||
return init()
|
|
||||||
}
|
|
||||||
export default { initialize, init }
|
|
297
src/main/file.js
297
src/main/file.js
|
@ -1,116 +1,16 @@
|
||||||
import SparkMD5 from 'spark-md5'
|
import CryptoJS from 'crypto-js'
|
||||||
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
import { ElectronDownloadManager } from 'electron-dl-manager'
|
import { ElectronDownloadManager } from 'electron-dl-manager'
|
||||||
import { dialog } from 'electron'
|
import { dialog } from 'electron'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
const uploadUrl = import.meta.env.VITE_APP_UPLOAD_API + '/smarttalk/file/upload'
|
const uploadUrl = import.meta.env.VITE_APP_UPLOAD_API + '/smarttalk/file/upload'
|
||||||
const asyncUploadUrl = import.meta.env.VITE_APP_UPLOAD_API + '/smarttalk/file/asyncUpload'
|
|
||||||
const manager = new ElectronDownloadManager()
|
const manager = new ElectronDownloadManager()
|
||||||
export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
const userDataPath = app.getPath('userData')
|
const userDataPath = app.getPath('userData')
|
||||||
const appRootFilePath = userDataPath + '\\selfFile\\'
|
const appRootFilePath = userDataPath + '\\selfFile\\'
|
||||||
const appTempFilePath = userDataPath + '\\tempFile\\'
|
const appTempFilePath = userDataPath + '\\tempFile\\'
|
||||||
let Spark = new SparkMD5.ArrayBuffer()
|
|
||||||
|
|
||||||
ipcMain.on('upload-file-change', (e, { id, fileNewName, cookie, fileType }) => {
|
|
||||||
let filePath = appRootFilePath + fileNewName
|
|
||||||
//执行更新,上传文件
|
|
||||||
let formData = new FormData()
|
|
||||||
formData.append('id', id)
|
|
||||||
uploadFileByFS({
|
|
||||||
url: asyncUploadUrl,
|
|
||||||
path: filePath,
|
|
||||||
name: fileNewName,
|
|
||||||
cookie,
|
|
||||||
fileType,
|
|
||||||
formData,
|
|
||||||
success: (response) => {
|
|
||||||
e.reply('upload-file-change-success' + fileNewName, {
|
|
||||||
data: response.data,
|
|
||||||
md5: formData.md5
|
|
||||||
})
|
|
||||||
},
|
|
||||||
error: (err) => {
|
|
||||||
console.error('Error uploading file:', err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
/*监听文件改变,如果有改变则返回触发*/
|
|
||||||
ipcMain.on('listen-file-change', (e, { id, fileNewName, md5, cookie, fileType }) => {
|
|
||||||
let filePath = appRootFilePath + fileNewName
|
|
||||||
let uploadId = null
|
|
||||||
let isOn = false
|
|
||||||
let lastMTime = fs.statSync(filePath).mtime.getTime()
|
|
||||||
console.log(lastMTime)
|
|
||||||
setInterval(() => {
|
|
||||||
getFileMsg(filePath).then((msg) => {
|
|
||||||
if (msg !== lastMTime) {
|
|
||||||
lastMTime = msg
|
|
||||||
if (uploadId) {
|
|
||||||
clearTimeout(uploadId)
|
|
||||||
}
|
|
||||||
if (isOn === false) {
|
|
||||||
console.log(fileNewName)
|
|
||||||
e.reply('listen-file-change-on' + fileNewName)
|
|
||||||
isOn = true
|
|
||||||
}
|
|
||||||
//倒数十秒提交更改,十秒之内有继续修改则重置倒数
|
|
||||||
uploadId = setTimeout(() => {
|
|
||||||
console.log(223)
|
|
||||||
//执行更新,上传文件
|
|
||||||
let formData = new FormData()
|
|
||||||
formData.append('id', id)
|
|
||||||
uploadFileByFS({
|
|
||||||
url: asyncUploadUrl,
|
|
||||||
path: filePath,
|
|
||||||
name: fileNewName,
|
|
||||||
cookie,
|
|
||||||
fileType,
|
|
||||||
formData,
|
|
||||||
success: (response) => {
|
|
||||||
e.reply('listen-file-change-success' + fileNewName, {
|
|
||||||
data: response.data,
|
|
||||||
md5: formData.md5
|
|
||||||
})
|
|
||||||
clearTimeout(uploadId)
|
|
||||||
isOn = false
|
|
||||||
},
|
|
||||||
error: (err) => {
|
|
||||||
console.error('Error uploading file:', err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, 5000)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, 1000)
|
|
||||||
})
|
|
||||||
|
|
||||||
function getFileMsg(path) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const stats = fs.statSync(path)
|
|
||||||
return resolve(stats.mtime.getTime())
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFileMD5(path) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
fs.readFile(path, (err, dataFile) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err)
|
|
||||||
return console.error(err)
|
|
||||||
}
|
|
||||||
Spark.append(dataFile)
|
|
||||||
let md5 = Spark.end()
|
|
||||||
resolve(md5)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 判断是否有本地文件
|
|
||||||
* */
|
|
||||||
ipcMain.on('is-have-local-file', (e, fileNewName) => {
|
ipcMain.on('is-have-local-file', (e, fileNewName) => {
|
||||||
let filePath = appRootFilePath + fileNewName
|
let filePath = appRootFilePath + fileNewName
|
||||||
fs.access(filePath, fs.constants.F_OK, (err) => {
|
fs.access(filePath, fs.constants.F_OK, (err) => {
|
||||||
|
@ -121,44 +21,14 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
e.reply('is-have-local-file-reply' + fileNewName, true)
|
e.reply('is-have-local-file-reply' + fileNewName, true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
/*
|
|
||||||
* 判断是需要同步本地文件
|
|
||||||
* */
|
|
||||||
ipcMain.on('is-async-local-file', (e, { fileNewName, lastModifyTime, md5 }) => {
|
|
||||||
let filePath = appRootFilePath + fileNewName
|
|
||||||
fs.access(filePath, fs.constants.F_OK, (err) => {
|
|
||||||
if (err) {
|
|
||||||
e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'down' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
getFileMsg(filePath).then((msg) => {
|
|
||||||
let time = new Date(lastModifyTime).getTime();
|
|
||||||
msg = parseInt(msg/1000)*1000;
|
|
||||||
if (msg == time) {
|
|
||||||
e.reply('is-async-local-file-reply' + fileNewName, { isAsync: false, type: '' })
|
|
||||||
} else {
|
|
||||||
const stats = fs.statSync(filePath)
|
|
||||||
//如果线上时间大于线下时间,就需要从线上下载,否则则需要上传
|
|
||||||
if (time > stats.mtime.getTime()) {
|
|
||||||
e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'down' })
|
|
||||||
} else if (time < stats.mtime.getTime()) {
|
|
||||||
e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'upload' })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
//默认浏览器打开url
|
//默认浏览器打开url
|
||||||
ipcMain.on('open-url-browser', (e, url) => {
|
ipcMain.on('open-url-browser', (e, url) => {
|
||||||
shell.openPath(url)
|
shell.openPath(url)
|
||||||
})
|
})
|
||||||
|
|
||||||
//使用默认应用打开本地文件
|
//使用默认应用打开本地文件
|
||||||
ipcMain.on('open-path-app', (e, destination) => {
|
ipcMain.on('open-path-app', (e, destination) => {
|
||||||
let path = appRootFilePath + destination
|
let path = appRootFilePath + destination
|
||||||
shell.openPath(path).catch((error) => {
|
shell.openExternal(path).catch((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -170,14 +40,30 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
//导出文件
|
//复制文件
|
||||||
ipcMain.on('export-file-default', (e, list) => {
|
ipcMain.on('export-file-default', (e, list) => {
|
||||||
exportFile(list, (res) => {
|
exportFile(list, (res) => {
|
||||||
e.reply('export-file-default-reply', res)
|
e.reply('export-file-default-reply', res)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function uploadFileByFS({ url, path, name, cookie, fileType, formData, success, error }) {
|
function getFileMD5(file) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const fileReader = new FileReader()
|
||||||
|
fileReader.onload = (e) => {
|
||||||
|
const buffer = e.target.result
|
||||||
|
let md5 = CryptoJS.MD5(buffer).toString()
|
||||||
|
resolve(md5)
|
||||||
|
}
|
||||||
|
fileReader.readAsArrayBuffer(file)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
ipcMain.on('creat-file-default', (e, { name, uploadData, cookie }) => {
|
||||||
|
createFolder('tempFile').then(() => {
|
||||||
|
let path = appTempFilePath + name
|
||||||
|
fs.writeFileSync(path, '', 'utf-8')
|
||||||
|
// 读取文件
|
||||||
fs.readFile(path, (err, data) => {
|
fs.readFile(path, (err, data) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return console.error(err)
|
return console.error(err)
|
||||||
|
@ -189,134 +75,33 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
Authorization: 'Bearer ' + cookie
|
Authorization: 'Bearer ' + cookie
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Spark.append(data)
|
let md5 = CryptoJS.MD5(data).toString()
|
||||||
let md5 = Spark.end()
|
let formData = new FormData()
|
||||||
// 使用axios上传文件
|
// 使用axios上传文件
|
||||||
let file = new File([data], name, {
|
let file = new File([data], name, {
|
||||||
type: fileType
|
type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
|
||||||
})
|
})
|
||||||
const stats = fs.statSync(path)
|
|
||||||
formData.append('file', file)
|
formData.append('file', file)
|
||||||
formData.append('md5',md5)
|
formData.append('md5',md5)
|
||||||
formData.append('lastModifyTime', stats.mtime.toLocaleString())
|
|
||||||
axios
|
|
||||||
.post(url, formData, config)
|
|
||||||
.then((response) => {
|
|
||||||
success(response)
|
|
||||||
})
|
|
||||||
.catch((errorMsg) => {
|
|
||||||
error(errorMsg)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/*创建新的ppt文件*/
|
|
||||||
ipcMain.on('creat-file-default', (e, { name, uploadData, cookie }) => {
|
|
||||||
createFolder('tempFile').then(() => {
|
|
||||||
let path = appTempFilePath + name.replace(/[\\/:*?"<>|]/, '')
|
|
||||||
console.log(path)
|
|
||||||
fs.writeFileSync(path, '', 'utf-8')
|
|
||||||
let fileType = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
|
|
||||||
let formData = new FormData()
|
|
||||||
for (let key in uploadData) {
|
for (let key in uploadData) {
|
||||||
if (Object.prototype.hasOwnProperty.call(uploadData, key)) {
|
if (uploadData.hasOwnProperty(key)) { // 检查是否是对象自身的属性
|
||||||
// 检查是否是对象自身的属性
|
|
||||||
formData.append(key,uploadData[key])
|
formData.append(key,uploadData[key])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
formData.append('fileFlag', '课件')
|
formData.append("fileFlag","教案")
|
||||||
uploadFileByFS({
|
axios
|
||||||
url: uploadUrl,
|
.post(uploadUrl, formData, config)
|
||||||
path,
|
.then((response) => {
|
||||||
name,
|
|
||||||
cookie,
|
|
||||||
fileType,
|
|
||||||
formData,
|
|
||||||
success: (response) => {
|
|
||||||
e.reply('creat-file-default-reply', response.data)
|
e.reply('creat-file-default-reply', response.data)
|
||||||
console.log('File uploaded successfully:', response.data)
|
console.log('File uploaded successfully:', response.data)
|
||||||
},
|
})
|
||||||
error: (err) => {
|
.catch((error) => {
|
||||||
console.error('Error uploading file:', err)
|
console.error('Error uploading file:', error)
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
/*创建新的ppt文件*/
|
|
||||||
ipcMain.on('creat-ai-file-default', (e, { name, url, uploadData, cookie }) => {
|
|
||||||
createFolder('tempFile').then(async () => {
|
|
||||||
let lastname = decodeURIComponent(url);
|
|
||||||
name = lastname.substring(lastname.lastIndexOf("/")+1)
|
|
||||||
let path = appTempFilePath + name.replace(/[\\/:*?"<>|]/, '')
|
|
||||||
let {type,item} = await downloadFiles(url,name)
|
|
||||||
if (type==="成功") {
|
|
||||||
let fileType = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
|
|
||||||
let formData = new FormData()
|
|
||||||
for (let key in uploadData) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(uploadData, key)) {
|
|
||||||
// 检查是否是对象自身的属性
|
|
||||||
formData.append(key, uploadData[key])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
formData.append('fileFlag', '课件')
|
|
||||||
uploadFileByFS({
|
|
||||||
url: uploadUrl,
|
|
||||||
path,
|
|
||||||
name,
|
|
||||||
cookie,
|
|
||||||
fileType,
|
|
||||||
formData,
|
|
||||||
success: (response) => {
|
|
||||||
e.reply('creat-ai-file-default-reply', response.data)
|
|
||||||
console.log('File uploaded successfully:', response.data)
|
|
||||||
},
|
|
||||||
error: (err) => {
|
|
||||||
console.error('Error uploading file:', err)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}else {
|
|
||||||
e.reply('creat-ai-file-default-reply', type)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
function downloadFiles(url,fileName) {
|
|
||||||
console.log(url,fileName)
|
|
||||||
return new Promise((resolve, reject)=>{
|
|
||||||
const browserWindow = BrowserWindow.getFocusedWindow()
|
|
||||||
const id = manager.download({
|
|
||||||
window: browserWindow,
|
|
||||||
url: url,
|
|
||||||
saveAsFilename: fileName,
|
|
||||||
directory: appTempFilePath,
|
|
||||||
callbacks: {
|
|
||||||
onDownloadStarted: async ({ id, item, webContents }) => {
|
|
||||||
// Do something with the download id
|
|
||||||
},
|
|
||||||
onDownloadProgress: async ({ id, item, percentCompleted }) => {
|
|
||||||
// console.log(percentCompleted)
|
|
||||||
},
|
|
||||||
onDownloadCompleted: async ({ id, item }) => {
|
|
||||||
console.log('完成')
|
|
||||||
resolve({type:"成功",item})
|
|
||||||
},
|
|
||||||
onDownloadCancelled: async () => {
|
|
||||||
console.log("取消")
|
|
||||||
reject({type:"取消了下载"})
|
|
||||||
},
|
|
||||||
onDownloadInterrupted: async () => {
|
|
||||||
console.log('中断')
|
|
||||||
reject({type:"下载被中断"})
|
|
||||||
},
|
|
||||||
onError: (err, data) => {
|
|
||||||
console.log(err.toString())
|
|
||||||
reject({type:"下载出错",err})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取应用文件目录
|
//获取应用文件目录
|
||||||
ipcMain.on('get-root-file-path', (e) => {
|
ipcMain.on('get-root-file-path', (e) => {
|
||||||
|
@ -325,9 +110,8 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
|
|
||||||
//下载文件
|
//下载文件
|
||||||
ipcMain.on('download-file-default', (e, { url, fileName }) => {
|
ipcMain.on('download-file-default', (e, { url, fileName }) => {
|
||||||
createFolder('selfFile')
|
createFolder('selfFile').then(async () => {
|
||||||
.then(async () => {
|
const browserWindow = BrowserWindow.fromId(e.sender.id)
|
||||||
const browserWindow = BrowserWindow.getFocusedWindow()
|
|
||||||
const id = await manager.download({
|
const id = await manager.download({
|
||||||
window: browserWindow,
|
window: browserWindow,
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -337,9 +121,7 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
onDownloadStarted: async ({ id, item, webContents }) => {
|
onDownloadStarted: async ({ id, item, webContents }) => {
|
||||||
// Do something with the download id
|
// Do something with the download id
|
||||||
},
|
},
|
||||||
onDownloadProgress: async ({ id, item, percentCompleted }) => {
|
onDownloadProgress: async ({ id, item, percentCompleted }) => {},
|
||||||
e.reply('download-file-default-prog' + fileName, percentCompleted)
|
|
||||||
},
|
|
||||||
onDownloadCompleted: async ({ id, item }) => {
|
onDownloadCompleted: async ({ id, item }) => {
|
||||||
console.log('完成')
|
console.log('完成')
|
||||||
e.reply('download-file-default' + fileName, true)
|
e.reply('download-file-default' + fileName, true)
|
||||||
|
@ -359,9 +141,6 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
|
||||||
e.reply('download-file-default' + fileName, false)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/**另存为...
|
/**另存为...
|
||||||
|
@ -412,7 +191,6 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
/*导出文件*/
|
|
||||||
function exportFile(list, callback) {
|
function exportFile(list, callback) {
|
||||||
let win = BrowserWindow.getFocusedWindow()
|
let win = BrowserWindow.getFocusedWindow()
|
||||||
//通过扩展名识别文件类型
|
//通过扩展名识别文件类型
|
||||||
|
@ -442,12 +220,10 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/*文件是否已经存在*/
|
|
||||||
function isHaveFile(path) {
|
function isHaveFile(path) {
|
||||||
return fs.existsSync(path)
|
return fs.existsSync(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*判断是否已经存在这个名字的文件,如果已经存在则递增导出*/
|
|
||||||
function filterCopyFile(path, index = 0) {
|
function filterCopyFile(path, index = 0) {
|
||||||
if (isHaveFile(path) === true) {
|
if (isHaveFile(path) === true) {
|
||||||
index++
|
index++
|
||||||
|
@ -458,7 +234,6 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*复制文件*/
|
|
||||||
function copyRelFile(source, destination, callback) {
|
function copyRelFile(source, destination, callback) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const readStream = fs.createReadStream(source)
|
const readStream = fs.createReadStream(source)
|
||||||
|
@ -481,7 +256,6 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/*复制文件*/
|
|
||||||
function copyFile(source, destination, callback) {
|
function copyFile(source, destination, callback) {
|
||||||
let path = appRootFilePath + destination
|
let path = appRootFilePath + destination
|
||||||
createFolder('selfFile').then(() => {
|
createFolder('selfFile').then(() => {
|
||||||
|
@ -502,7 +276,6 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/*创建文件夹*/
|
|
||||||
function createFolder(folderName) {
|
function createFolder(folderName) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const folderPath = path.join(userDataPath, folderName)
|
const folderPath = path.join(userDataPath, folderName)
|
||||||
|
|
|
@ -1,261 +1,72 @@
|
||||||
import { app, shell, BrowserWindow, ipcMain, session, BrowserView } from 'electron'
|
import { app, shell, BrowserWindow, ipcMain } from 'electron'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
||||||
import icon from '../../resources/icon.png?asset'
|
import icon from '../../resources/icon.png?asset'
|
||||||
import File from './file'
|
import File from './file'
|
||||||
import Logger from './logger' // 日志封装
|
|
||||||
import chat from './chat' // chat封装
|
|
||||||
import Store from './store' // Store封装
|
|
||||||
import updateInit from './update'
|
|
||||||
// 代理 electron/remote
|
|
||||||
// 第一步:引入remote
|
|
||||||
import remote from '@electron/remote/main'
|
|
||||||
// 第二步: 初始化remote
|
|
||||||
remote.initialize()
|
|
||||||
// 日志配置-初始化(日志直接绑定到console上)
|
|
||||||
if(!is.dev) Logger.initialize()
|
|
||||||
// 持久化数据-初始化
|
|
||||||
Store.initialize()
|
|
||||||
|
|
||||||
File({ app, shell, BrowserWindow, ipcMain })
|
File({ app, shell, BrowserWindow, ipcMain })
|
||||||
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
|
function createWindow() {
|
||||||
let mainWindow, loginWindow
|
// Create the browser window.
|
||||||
|
const mainWindow = new BrowserWindow({
|
||||||
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
|
|
||||||
loginWindow = new BrowserWindow({
|
|
||||||
width: 888,
|
width: 888,
|
||||||
height: 520,
|
height: 520,
|
||||||
show: false,
|
show: false,
|
||||||
frame: false,
|
frame: false,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
maximizable: false,
|
|
||||||
resizable: false,
|
|
||||||
icon: join(__dirname, '../../resources/logo2.ico'),
|
|
||||||
...(process.platform === 'linux' ? { icon } : {}),
|
...(process.platform === 'linux' ? { icon } : {}),
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
defaultEncoding: 'utf-8',
|
|
||||||
preload: join(__dirname, '../preload/index.js'),
|
preload: join(__dirname, '../preload/index.js'),
|
||||||
sandbox: false,
|
sandbox: false,
|
||||||
nodeIntegration: true,
|
nodeIntegration: true
|
||||||
contextIsolation: false // 沙箱取消
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
loginWindow.type = 'login' // 唯一标识
|
|
||||||
// handleUpdate(loginWindow,ipcMain)
|
|
||||||
// const loginURL = is.dev ? `http://localhost:5173/#/login` : `file://${__dirname}/index.html/#/login`
|
|
||||||
// loginWindow.loadURL(loginURL)
|
|
||||||
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
|
|
||||||
loginWindow.loadURL('http://localhost:5173/#/login')
|
|
||||||
} else {
|
|
||||||
loginWindow.loadFile(join(__dirname, '../renderer/index.html'), { hash: 'login' })
|
|
||||||
updateInit(loginWindow)
|
|
||||||
}
|
|
||||||
if (import.meta.env.VITE_SHOW_DEV_TOOLS === 'true') loginWindow.webContents.openDevTools()
|
|
||||||
loginWindow.once('ready-to-show', () => {
|
|
||||||
loginWindow.show()
|
|
||||||
})
|
|
||||||
|
|
||||||
loginWindow.on('closed', () => {
|
|
||||||
loginWindow = null
|
|
||||||
})
|
|
||||||
|
|
||||||
remote.enable(loginWindow.webContents)
|
|
||||||
}
|
|
||||||
//主窗口
|
|
||||||
function createMainWindow() {
|
|
||||||
mainWindow = new BrowserWindow({
|
|
||||||
width: 1350,
|
|
||||||
minWidth: 1200,
|
|
||||||
height: 700,
|
|
||||||
minHeight: 700,
|
|
||||||
show: false,
|
|
||||||
frame: false, // 无边框
|
|
||||||
autoHideMenuBar: true,
|
|
||||||
maximizable: false,
|
|
||||||
icon: join(__dirname, '../../resources/logo2.ico'),
|
|
||||||
...(process.platform === 'linux' ? { icon } : {}),
|
|
||||||
webPreferences: {
|
|
||||||
defaultEncoding: 'utf-8',
|
|
||||||
preload: join(__dirname, '../preload/index.js'),
|
|
||||||
sandbox: false,
|
|
||||||
// nodeIntegration: true,
|
|
||||||
nodeIntegration: true, // nodeApi调用
|
|
||||||
contextIsolation: false // 沙箱取消
|
|
||||||
// webSecurity: false // 跨域关闭
|
|
||||||
}
|
|
||||||
})
|
|
||||||
mainWindow.type = 'main' // 唯一标识
|
|
||||||
mainWindow.on('ready-to-show', () => {
|
mainWindow.on('ready-to-show', () => {
|
||||||
mainWindow.show()
|
mainWindow.show()
|
||||||
})
|
})
|
||||||
mainWindow.on('closed', () => {
|
|
||||||
setTimeout(() => {
|
|
||||||
// 延迟销毁
|
|
||||||
mainWindow = null
|
|
||||||
}, 1000)
|
|
||||||
// app.quit() // 主窗口关闭-结束所有进程
|
|
||||||
})
|
|
||||||
mainWindow.on('resize', () => {
|
|
||||||
const { width, height } = mainWindow.getBounds();
|
|
||||||
mainWindow.webContents.send('minWinResize', { width, height });
|
|
||||||
});
|
|
||||||
|
|
||||||
mainWindow.webContents.setWindowOpenHandler((details) => {
|
mainWindow.webContents.setWindowOpenHandler((details) => {
|
||||||
shell.openExternal(details.url)
|
shell.openExternal(details.url)
|
||||||
return { action: 'deny' }
|
return { action: 'deny' }
|
||||||
})
|
})
|
||||||
if (import.meta.env.VITE_SHOW_DEV_TOOLS === 'true') mainWindow.webContents.openDevTools()
|
|
||||||
|
|
||||||
|
// HMR for renderer base on electron-vite cli.
|
||||||
|
// Load the remote URL for development or the local html file for production.
|
||||||
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
|
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
|
||||||
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
|
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
|
||||||
|
mainWindow.webContents.openDevTools()
|
||||||
|
// mainWindow.loadURL('https://file.ysaix.com:7868/')
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// mainWindow.loadURL('https://file.ysaix.com:7868/')
|
||||||
mainWindow.loadFile(join(__dirname, '../renderer/index.html'))
|
mainWindow.loadFile(join(__dirname, '../renderer/index.html'))
|
||||||
}
|
}
|
||||||
|
|
||||||
// mainWindow.setAlwaysOnTop(true, "screen-saver") // 将窗口设置为顶层窗口
|
|
||||||
// mainWindow.setVisibleOnAllWorkspaces(true) // 如果窗口在所有工作区都可见
|
|
||||||
mainWindow.maximize();
|
|
||||||
// 第三步: 开启remote服务
|
|
||||||
remote.enable(mainWindow.webContents)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开外部链接窗口
|
// This method will be called when Electron has finished
|
||||||
let linkWin = {}
|
// initialization and is ready to create browser windows.
|
||||||
async function createLinkWin(data) {
|
// Some APIs can only be used after this event occurs.
|
||||||
if (linkWin[data.key]) return
|
app.whenReady().then(() => {
|
||||||
|
// Set app user model id for windows
|
||||||
linkWin[data.key] = new BrowserWindow({
|
|
||||||
show: false,
|
|
||||||
frame: true,
|
|
||||||
maximizable: true,
|
|
||||||
autoHideMenuBar: true,
|
|
||||||
...(process.platform === 'linux' ? { icon } : {}),
|
|
||||||
webPreferences: {
|
|
||||||
defaultEncoding: 'utf-8',
|
|
||||||
sandbox: false,
|
|
||||||
nodeIntegration: true,
|
|
||||||
worldSafeExecuteJavaScript: true,
|
|
||||||
contextIsolation: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
linkWin[data.key].type = 'link'+data.key // 唯一标识
|
|
||||||
|
|
||||||
let cookieDetails = { ...data.cookieData }
|
|
||||||
await linkWin[data.key].webContents.session.cookies
|
|
||||||
.set(cookieDetails)
|
|
||||||
.then(() => {})
|
|
||||||
.catch((error) => {})
|
|
||||||
data.fullPath = data.fullPath.replaceAll('//', '/')
|
|
||||||
if (data.fullPath.indexOf('?') !== -1) {
|
|
||||||
data.fullPath += '&urlSource=smarttalk&t' + Date.now()
|
|
||||||
}else {
|
|
||||||
data.fullPath += '?urlSource=smarttalk&t' + Date.now()
|
|
||||||
}
|
|
||||||
linkWin[data.key].loadURL(data.fullPath)
|
|
||||||
if (import.meta.env.VITE_SHOW_DEV_TOOLS === 'true') linkWin[data.key].webContents.openDevTools()
|
|
||||||
|
|
||||||
linkWin[data.key].once('ready-to-show', () => {
|
|
||||||
linkWin[data.key].show()
|
|
||||||
linkWin[data.key].maximize()
|
|
||||||
})
|
|
||||||
linkWin[data.key].on('closed', () => {
|
|
||||||
linkWin[data.key] = null
|
|
||||||
delete linkWin[data.key]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化完成
|
|
||||||
app.on('ready', () => {
|
|
||||||
appWatchError() // 监听app错误
|
|
||||||
process.env.LANG = 'en_US.UTF-8'
|
|
||||||
// 设置应用程序用户模型标识符
|
|
||||||
electronApp.setAppUserModelId('com.electron')
|
electronApp.setAppUserModelId('com.electron')
|
||||||
|
|
||||||
//一个新的browserWindow 被创建时触发
|
// Default open or close DevTools by F12 in development
|
||||||
|
// and ignore CommandOrControl + R in production.
|
||||||
|
// see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils
|
||||||
app.on('browser-window-created', (_, window) => {
|
app.on('browser-window-created', (_, window) => {
|
||||||
optimizer.watchWindowShortcuts(window)
|
optimizer.watchWindowShortcuts(window)
|
||||||
})
|
})
|
||||||
|
|
||||||
//窗口 最大、最小、关闭
|
|
||||||
ipcMain.on('minimize-window', () => {
|
|
||||||
if (loginWindow) {
|
|
||||||
loginWindow.minimize()
|
|
||||||
}
|
|
||||||
if (mainWindow) {
|
|
||||||
mainWindow.minimize()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
ipcMain.on('maximize-window', () => {
|
|
||||||
mainWindow.isMaximized() ? mainWindow.unmaximize() : mainWindow.maximize()
|
|
||||||
})
|
|
||||||
|
|
||||||
ipcMain.on('close-window', () => {
|
createWindow()
|
||||||
if (loginWindow) {
|
|
||||||
loginWindow.destroy()
|
|
||||||
}
|
|
||||||
if (mainWindow) {
|
|
||||||
mainWindow.close() // 先发出这个关闭指令
|
|
||||||
setTimeout(() => {
|
|
||||||
//
|
|
||||||
mainWindow.destroy()
|
|
||||||
}, 200)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// 打开主窗口
|
|
||||||
ipcMain.on('openMainWindow', () => {
|
|
||||||
if (!mainWindow) {
|
|
||||||
createMainWindow()
|
|
||||||
}
|
|
||||||
loginWindow.destroy()
|
|
||||||
loginWindow = null
|
|
||||||
})
|
|
||||||
// 打开登录窗口
|
|
||||||
ipcMain.on('openLoginWindow', () => {
|
|
||||||
if (!loginWindow) {
|
|
||||||
createLoginWindow()
|
|
||||||
}
|
|
||||||
mainWindow.destroy()
|
|
||||||
mainWindow = null
|
|
||||||
loginWindow.show()
|
|
||||||
loginWindow.focus()
|
|
||||||
})
|
|
||||||
|
|
||||||
//打开作业窗口
|
|
||||||
ipcMain.on('openWindow', (e, data) => {
|
|
||||||
createLinkWin(data)
|
|
||||||
})
|
|
||||||
// zdg: 消息监听
|
|
||||||
handleAll()
|
|
||||||
// 打开-登录窗口
|
|
||||||
createLoginWindow()
|
|
||||||
|
|
||||||
app.on('activate', function () {
|
app.on('activate', function () {
|
||||||
if (BrowserWindow.getAllWindows().length === 0) createLoginWindow()
|
// On macOS it's common to re-create a window in the app when the
|
||||||
|
// dock icon is clicked and there are no other windows open.
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -268,64 +79,34 @@ app.on('window-all-closed', () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 监听全局事件
|
ipcMain.on('toggle-top', (event) => {
|
||||||
function handleAll() {
|
const win = BrowserWindow.getFocusedWindow();
|
||||||
const chatInstance = chat.initialize() // im-chat 实例
|
const isAlwaysOnTop = win.isAlwaysOnTop();
|
||||||
// 新窗口创建-监听
|
win.setAlwaysOnTop(!isAlwaysOnTop);
|
||||||
ipcMain.handle('new-window', (e, data) => {
|
event.sender.send('top-status-changed', !isAlwaysOnTop);
|
||||||
const { id, type } = data
|
|
||||||
const win = BrowserWindow.fromId(id)
|
|
||||||
win.type = type // 绑定独立标识
|
|
||||||
remote.enable(win.webContents) // 开启远程服务
|
|
||||||
chatInstance.enable(win.webContents) // 开启im-chat
|
|
||||||
console.log(`主进程 [${type}]: 窗口注册-远程代理-完毕(${Date.now()})`)
|
|
||||||
})
|
})
|
||||||
// 用于监听-状态管理变化-同步所有窗口
|
|
||||||
ipcMain.handle('pinia-state-change', (e, storeName, jsonStr) => {
|
|
||||||
|
|
||||||
for(const curWin of BrowserWindow.getAllWindows()){
|
|
||||||
const id = curWin.webContents.id
|
ipcMain.on('minimize-window', () => {
|
||||||
const bool = id !== e.sender.id && !curWin.isDestroyed()
|
const win = BrowserWindow.getFocusedWindow();
|
||||||
if (bool) { // 除了消息发送窗口和销毁的窗口 其他都发送
|
win.minimize();
|
||||||
curWin.webContents.send('pinia-state-set', storeName, jsonStr)
|
});
|
||||||
}
|
|
||||||
}
|
ipcMain.on('maximize-window', () => {
|
||||||
})
|
const win = BrowserWindow.getFocusedWindow();
|
||||||
// 用于监听-状态管理变化-初始同步
|
if (win.isMaximized()) {
|
||||||
ipcMain.handle('pinia-state-init', (e, wid, storeName, jsonStr) => {
|
win.unmaximize();
|
||||||
// console.log('pinia-state-init', jsonStr)
|
} else {
|
||||||
const win = BrowserWindow.fromId(wid)
|
win.maximize();
|
||||||
win.webContents.send('pinia-state-set', storeName, jsonStr)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// app 崩溃监听器
|
ipcMain.on('close-window', () => {
|
||||||
function appWatchError() {
|
const win = BrowserWindow.getFocusedWindow();
|
||||||
// 渲染进程崩溃
|
win.close();
|
||||||
app.on('renderer-process-crashed', (event, webContents, killed) => {
|
});
|
||||||
console.error(
|
ipcMain.on('set-winsize', (e, {x, y})=>{
|
||||||
`APP-ERROR:renderer-process-crashed; event: ${JSON.stringify(event)}; webContents:${JSON.stringify(
|
const win = BrowserWindow.getFocusedWindow();
|
||||||
webContents
|
win.setSize(x,y);
|
||||||
)}; killed:${JSON.stringify(killed)}`
|
win.center()
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// GPU进程崩溃
|
|
||||||
app.on('gpu-process-crashed', (event, killed) => {
|
|
||||||
console.error(`APP-ERROR:gpu-process-crashed; event: ${JSON.stringify(event)}; killed: ${JSON.stringify(killed)}`)
|
|
||||||
})
|
|
||||||
|
|
||||||
// 渲染进程结束
|
|
||||||
app.on('render-process-gone', async (event, webContents, details) => {
|
|
||||||
console.error(
|
|
||||||
`APP-ERROR:render-process-gone; event: ${JSON.stringify(event)}; webContents:${JSON.stringify(
|
|
||||||
webContents
|
|
||||||
)}; details:${JSON.stringify(details)}`
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
// 子进程结束
|
|
||||||
app.on('child-process-gone', async (event, details) => {
|
|
||||||
console.error(`APP-ERROR:child-process-gone; event: ${JSON.stringify(event)}; details:${JSON.stringify(details)}`)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
/**
|
|
||||||
* @description 日志配置
|
|
||||||
* @author zdg
|
|
||||||
* @date 2021-07-05 14:07:01
|
|
||||||
*/
|
|
||||||
// import log from 'electron-log'
|
|
||||||
import log from 'electron-log/main'
|
|
||||||
import { app } from 'electron'
|
|
||||||
import path from 'path'
|
|
||||||
|
|
||||||
// 关闭控制台打印
|
|
||||||
// 日志控制台等级,默认值:false
|
|
||||||
log.transports.console.level = false
|
|
||||||
// log.transports.console.level = 'info'
|
|
||||||
// 日志文件等级,默认值:false
|
|
||||||
log.transports.file.level = 'info'
|
|
||||||
// 日志文件名,默认:main.log
|
|
||||||
// log.transports.file.fileName = 'main.log';
|
|
||||||
// 日志大小,默认:1048576(1M),达到最大上限后,备份文件并重命名为:main.old.log,有且仅有一个备份文件
|
|
||||||
log.transports.file.maxSize = 10 * 1024 * 1024; // 文件最大不超过 10M
|
|
||||||
// 自定义日志文件滚动策略
|
|
||||||
log.transports.file.rollSize = 10 * 1024 * 1024; // 10MB
|
|
||||||
// 日志格式,默认:[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}
|
|
||||||
log.transports.file.format = '[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}'
|
|
||||||
let date = new Date()
|
|
||||||
let dateStr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
|
|
||||||
// 文件位置及命名方式
|
|
||||||
// 默认位置为:C:\Users\[user]\AppData\Roaming\[appname]\electron_log\
|
|
||||||
// 文件名为:年-月-日.log
|
|
||||||
// 自定义文件保存位置为安装目录下 \log\年-月-日.log
|
|
||||||
// log.transports.file.resolvePathFn = () => 'logs\\' + dateStr+ '.log';
|
|
||||||
log.transports.file.resolvePathFn = () => path.join(app.getPath('userData'), `logs/${dateStr}.log`)
|
|
||||||
|
|
||||||
// 有六个日志级别error, warn, info, verbose, debug, silly。默认是silly
|
|
||||||
export const logger = {
|
|
||||||
error: (...args) => log.error(...args),
|
|
||||||
warn: (...args) => log.warn(...args),
|
|
||||||
info: (...args) => log.info(...args),
|
|
||||||
verbose: (...args) => log.verbose(...args),
|
|
||||||
debug: (...args) => log.debug(...args),
|
|
||||||
silly: (...args) => log.silly(...args)
|
|
||||||
}
|
|
||||||
export function initialize(bool = true, type = 'all') {
|
|
||||||
log.initialize() // 为渲染器进行初始化
|
|
||||||
if (bool) { // 是否替换默认的console
|
|
||||||
if (type == 'all') Object.assign(console, log.functions)
|
|
||||||
else { // 替换指定类型
|
|
||||||
console[type] = log[type]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export default { initialize }
|
|
|
@ -1,70 +0,0 @@
|
||||||
/**
|
|
||||||
* @description 解决 主进程|渲染进程 数据共享
|
|
||||||
*/
|
|
||||||
import Store from 'electron-store' // 持久化存储
|
|
||||||
|
|
||||||
// 设置ipc与渲染器通信
|
|
||||||
Store.initRenderer()
|
|
||||||
|
|
||||||
// 默认共享数据
|
|
||||||
const defaultData = {
|
|
||||||
session: { // 缓存(临时sessionStorage)
|
|
||||||
model: 'select', // 悬浮球-当前模式
|
|
||||||
showBoardAll: false, // 全屏画板-是否显示
|
|
||||||
isPdfWin: false, // pdf窗口是否打开
|
|
||||||
isToolWin: false, // 工具窗口是否打开
|
|
||||||
isTaskWin: false, // 批改窗口是否打开
|
|
||||||
curSubjectNode: {
|
|
||||||
querySearch: {} // 查询资源所需参数
|
|
||||||
},
|
|
||||||
subject: { // 不走同步 Pinia
|
|
||||||
bookList: null, // 教材列表
|
|
||||||
curBook: null, // 当前选中的教材
|
|
||||||
curNode: null, // 当前选中的节点
|
|
||||||
defaultExpandedKeys: [], //展开的节点
|
|
||||||
subjectTree: [] // "树结构" 章节
|
|
||||||
},
|
|
||||||
env: {}, // 不走同步 Pinia - 变量
|
|
||||||
curr: {} // 不走同步 Pinia - 当前信息
|
|
||||||
},
|
|
||||||
local: { // 本地(永久localStorage)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
export function initialize(){
|
|
||||||
// 缓存数据-sessionStore
|
|
||||||
const sessionStore = new Store({
|
|
||||||
name: 'session-store', // 存储文件名
|
|
||||||
fileExtension: 'ini', // 文件后缀名
|
|
||||||
encryptionKey: 'BvPLmgCC4DSIG0KkTec5', // 数据加密-防止用户直接改配置
|
|
||||||
beforeEachMigration: (store, context) => { // 版本迁移回调
|
|
||||||
console.log(`[session-store] 迁移从 ${context.fromVersion} → ${context.toVersion}`);
|
|
||||||
},
|
|
||||||
migrations: { // 版本变化
|
|
||||||
'0.0.0': store => {
|
|
||||||
// store.set('debugPhase', true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
sessionStore.clear() // 先清除-所有缓存数据
|
|
||||||
sessionStore.set(defaultData.session) // 初始化-默认数据
|
|
||||||
|
|
||||||
// 缓存数据-localStore
|
|
||||||
const localStore = new Store({
|
|
||||||
name: 'local-store', // 存储文件名
|
|
||||||
fileExtension: 'ini', // 文件后缀名
|
|
||||||
encryptionKey: '6CyoHQmUaPmLzvVsh', // 数据加密-防止用户直接改配置
|
|
||||||
beforeEachMigration: (store, context) => { // 版本迁移回调
|
|
||||||
console.log(`[local-store] 迁移从 ${context.fromVersion} → ${context.toVersion}`);
|
|
||||||
},
|
|
||||||
migrations: { // 版本变化
|
|
||||||
'0.0.0': store => {
|
|
||||||
// store.set('debugPhase', true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
localStore.set(defaultData.local) // 初始化-默认数据
|
|
||||||
return {sessionStore, localStore}
|
|
||||||
}
|
|
||||||
export default { initialize }
|
|
|
@ -1,66 +0,0 @@
|
||||||
import { dialog } from 'electron'
|
|
||||||
import logger from 'electron-log'
|
|
||||||
const updateURL = 'http://27.128.240.72:3000/zhuhao/AIx_Smarttalk/releases/tag/V1.0.0%28%E6%B5%8B%E8%AF%95%E7%89%88%29/'
|
|
||||||
|
|
||||||
// 主进程中的更新检查
|
|
||||||
const { autoUpdater } = require('electron-updater')
|
|
||||||
|
|
||||||
const updateInit = (win) => {
|
|
||||||
logger.info('进来了')
|
|
||||||
// 检查更新
|
|
||||||
autoUpdater.checkForUpdates()
|
|
||||||
// 自动下载
|
|
||||||
autoUpdater.autoDownload = false
|
|
||||||
// 设置版本更新服务器地址
|
|
||||||
// autoUpdater.setFeedURL(updateURL)
|
|
||||||
|
|
||||||
//监听更新事件
|
|
||||||
autoUpdater.on('update-available', (info) => {
|
|
||||||
logger.info('发现新版本')
|
|
||||||
dialog
|
|
||||||
.showMessageBox(win,{
|
|
||||||
type: 'info',
|
|
||||||
title: '新版本可用',
|
|
||||||
message: '有一个可用的新版本,要更新吗',
|
|
||||||
buttons: ['是', '否']
|
|
||||||
})
|
|
||||||
.then((result) => {
|
|
||||||
if (result.response === 0) {
|
|
||||||
// 用户选择更新,触发下载和安装
|
|
||||||
autoUpdater.downloadUpdate()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
// 没有新版本
|
|
||||||
autoUpdater.on('update-not-available', () => {
|
|
||||||
logger.info('没有新版本')
|
|
||||||
})
|
|
||||||
|
|
||||||
// 更新发生错误
|
|
||||||
autoUpdater.on('error', () => {
|
|
||||||
logger.error('检查更新失败')
|
|
||||||
})
|
|
||||||
|
|
||||||
// 监听下载进度
|
|
||||||
autoUpdater.on('download-progress', (progressObj) => {
|
|
||||||
win.webContents.send('update-app-progress', progressObj.percent);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 跟新下载完毕
|
|
||||||
autoUpdater.on('update-downloaded', () => {
|
|
||||||
dialog
|
|
||||||
.showMessageBox({
|
|
||||||
type: 'info',
|
|
||||||
title: '更新下载完成',
|
|
||||||
message: '点击确定重启获取最新内容',
|
|
||||||
buttons: ['确定']
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
// 调用 quitAndInstall 来安装更新
|
|
||||||
autoUpdater.quitAndInstall()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export default updateInit
|
|
|
@ -1,11 +1,9 @@
|
||||||
import { contextBridge } from 'electron'
|
import { contextBridge } from 'electron'
|
||||||
import { electronAPI } from '@electron-toolkit/preload'
|
import { electronAPI } from '@electron-toolkit/preload'
|
||||||
import TimRender from 'im_electron_sdk/dist/renderer' // im渲染部分实例
|
|
||||||
// Custom APIs for renderer
|
// Custom APIs for renderer
|
||||||
const api = {
|
const api = {}
|
||||||
preloadPath: __dirname, // 当前preload地址
|
|
||||||
getTimRender: () => new TimRender(), // im渲染部分实例
|
|
||||||
}
|
|
||||||
// Use `contextBridge` APIs to expose Electron APIs to
|
// Use `contextBridge` APIs to expose Electron APIs to
|
||||||
// renderer only if context isolation is enabled, otherwise
|
// renderer only if context isolation is enabled, otherwise
|
||||||
// just add to the DOM global.
|
// just add to the DOM global.
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>%VITE_APP_TITLE%</title>
|
<title>Electron</title>
|
||||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||||
<!-- <meta
|
<!-- <meta
|
||||||
http-equiv="Content-Security-Policy"
|
http-equiv="Content-Security-Policy"
|
||||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
|
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
|
||||||
/> -->
|
/> -->
|
||||||
<meta http-equiv="Content-Security-Policy" content="connect-src *; default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *;img-src * 'self' data: blob:" />
|
<meta http-equiv="Content-Security-Policy" content="connect-src *; default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src * 'self' data: blob:" />
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 48 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,177 +0,0 @@
|
||||||
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,3 +0,0 @@
|
||||||
àRCopyright 1990-2009 Adobe Systems Incorporated.
|
|
||||||
All rights reserved.
|
|
||||||
See ./LICENSEáCNS2-H
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue