From 57b7d3d60179292838adf43626b2b1c635e4f73a Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Fri, 16 Aug 2024 13:42:19 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BA=8C=E6=9C=9F=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=87=AA=E5=8A=A8=E5=90=8C=E6=AD=A5=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/file.js | 21 ++++++++++++++----- .../prepare/container/file-list-item.vue | 8 +++---- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/main/file.js b/src/main/file.js index 348c703..9dcba26 100644 --- a/src/main/file.js +++ b/src/main/file.js @@ -42,19 +42,23 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) { let filePath = appRootFilePath + fileNewName let uploadId = null let isOn = false + let lastMTime = fs.statSync(filePath).mtime.getTime() + console.log(lastMTime) setInterval(() => { - getFileMD5(filePath).then((md5New) => { - if (md5New !== md5) { - md5 = md5New + 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) @@ -77,12 +81,19 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) { console.error('Error uploading file:', err) } }) - }, 20000) + }, 5000) } }) - }, 10000) + }, 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) => { diff --git a/src/renderer/src/views/prepare/container/file-list-item.vue b/src/renderer/src/views/prepare/container/file-list-item.vue index 77de6b1..8c4f2dc 100644 --- a/src/renderer/src/views/prepare/container/file-list-item.vue +++ b/src/renderer/src/views/prepare/container/file-list-item.vue @@ -246,12 +246,12 @@ export default { fileType: item.fileType }) ipcRenderer.on('listen-file-change-on' + item.fileNewName, () => { - item.async = 'on' + items.async = 'on' }) ipcRenderer.on('listen-file-change-success' + item.fileNewName, (e, { data, md5 }) => { - item.fileSize = data.fileSize - item.md5 = md5 - item.async = true + items.fileSize = data.fileSize + items.md5 = md5 + items.async = true }) } }) From 0ff0cd42bcc87ebcb6366bafd76b881629f83f84 Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Fri, 16 Aug 2024 18:10:20 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BA=8C=E6=9C=9F=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=87=AA=E5=8A=A8=E5=90=8C=E6=AD=A5=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +-- src/main/file.js | 7 ++++--- src/renderer/src/plugins/shareStore.js | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 71aafb4..1629b15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aix-win", - "version": "1.1.1", + "version": "1.1.2", "description": "An Electron application with Vue", "main": "./out/main/index.js", "author": "example.com", @@ -33,7 +33,6 @@ "electron-updater": "^6.1.7", "element-plus": "^2.7.6", "fabric": "^5.3.0", - "im_electron_sdk": "^8.0.5904", "js-cookie": "^3.0.5", "jsencrypt": "^3.3.2", "jsondiffpatch": "0.6.0", diff --git a/src/main/file.js b/src/main/file.js index 9dcba26..ddabb2c 100644 --- a/src/main/file.js +++ b/src/main/file.js @@ -132,13 +132,14 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) { e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'down' }) return } - getFileMD5(filePath).then((localMd5) => { - if (localMd5 === md5) { + 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) //如果线上时间大于线下时间,就需要从线上下载,否则则需要上传 - let time = new Date(lastModifyTime) if (time > stats.mtime.getTime()) { e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'down' }) } else if (time < stats.mtime.getTime()) { diff --git a/src/renderer/src/plugins/shareStore.js b/src/renderer/src/plugins/shareStore.js index 31060a8..bb003b8 100644 --- a/src/renderer/src/plugins/shareStore.js +++ b/src/renderer/src/plugins/shareStore.js @@ -12,7 +12,7 @@ export function shareStorePlugin({store}) { // console.log('store.$subscribe', mutation) // 在存储变化的时候执行 // const storeName = store.$id - // const storeName = mutation.storeId + const storeName = mutation.storeId // 用于多窗口共享(需要共享的状态名称) const names = ['tool'] if (names.includes(storeName)) { @@ -37,7 +37,9 @@ export function shareStorePlugin({store}) { function stateSync(storeName, key, value) { // console.log('state-change', storeName, key, value) let jsonStr = '' - if (typeof key === 'string') jsonStr = JSON.stringify({[key]:value}) + let obj = {[key]:value} + window.test = obj + if (typeof key === 'string') jsonStr = JSON.stringify(obj) else if (typeof value === 'object') jsonStr = JSON.stringify(key) // 通知主线程更新 ipcRenderer?.invoke('pinia-state-change', storeName, jsonStr) From 5f6839058ab56726fc414cf81efed5a42ac34e9b Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Mon, 19 Aug 2024 14:18:39 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BA=8C=E6=9C=9F=EF=BC=9A=E6=89=93?= =?UTF-8?q?=E5=8C=85IM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/package.json b/package.json index 1629b15..f37b315 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "js-cookie": "^3.0.5", "jsencrypt": "^3.3.2", "jsondiffpatch": "0.6.0", + "im_electron_sdk": "^8.0.5904", "lodash": "^4.17.21", "pdfjs-dist": "4.4.168", "pinia": "^2.1.7", @@ -61,5 +62,80 @@ "vite-plugin-windicss": "^1.9.3", "vue": "^3.4.30", "windicss": "^3.5.6" + }, + "build": { + "files": [ + "src/app", + "bundle", + "icon" + ], + "appId": "aix-win", + "mac": { + "gatekeeperAssess": false, + "hardenedRuntime": true, + "entitlements": "./signing/entitlements.mac.plist", + "entitlementsInherit": "./signing/entitlements.mac.plist", + "extendInfo": { + "NSMicrophoneUsageDescription": "Please give us access to your microphone", + "NSCameraUsageDescription": "Allow your conversational partners to see you in a Grape Call. You can turn off your video anytime during a call." + }, + "icon": "./icon/im_electron_logo.png", + "extraFiles": [ + { + "from": "./node_modules/im_electron_sdk/lib/", + "to": "./Resources", + "filter": [ + "**/*" + ] + }, + + { + "from": "./icon/", + "to": "./Resources", + "filter": [ + "**/*" + ] + } + ] + }, + "win": { + "icon": "./resources/logo.ico", + "target": [ + { + "target": "nsis", + "arch": [ + "x64" + ] + } + ], + "extraFiles": [ + { + "from": "./node_modules/im_electron_sdk/lib/", + "to": "./resources", + "filter": [ + "**/*" + ] + } + ] + }, + "linux": { + "target": "deb", + "extraFiles": [ + { + "from": "./node_modules/im_electron_sdk/lib/", + "to": "./resources", + "filter": [ + "**/*" + ] + }, + { + "from": "node_modules/trtc-electron-sdk/build/Release/", + "to": "./resources", + "filter": [ + "**/*" + ] + } + ] + } } } From d4982d47c76a572b81edd6a09d1eb53e584e5496 Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Fri, 23 Aug 2024 12:01:21 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BA=8C=E6=9C=9F=EF=BC=9A=E6=89=93?= =?UTF-8?q?=E5=8C=85IM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7e805fd..7af5238 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aix-win", - "version": "1.1.2", + "version": "1.1.3", "description": "An Electron application with Vue", "main": "./out/main/index.js", "author": "example.com", From 0ea628d1748d75dae7a6f803c612f9d1949eaa04 Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Fri, 23 Aug 2024 12:01:43 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BA=8C=E6=9C=9F=EF=BC=9A=E6=89=93?= =?UTF-8?q?=E5=8C=85IM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/index.js b/src/main/index.js index da96c0b..1a38d28 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -135,6 +135,11 @@ async function createLinkWin(data) { .then(() => {}) .catch((error) => {}) data.fullPath = data.fullPath.replaceAll('//', '/') + if (data.fullPath.indexOf('?') !== -1) { + data.fullPath += '&urlSource=smarttalk' + }else { + data.fullPath += '?urlSource=smarttalk' + } linkWin[data.key].loadURL(data.fullPath) linkWin[data.key].once('ready-to-show', () => { From cdf12cf213049ea44af878aa9268324e62e230ec Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Tue, 3 Sep 2024 16:37:39 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=8C=BA=E5=88=86=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E5=92=8C=E6=B5=8B=E8=AF=95=E7=89=88=E6=9C=AC=EF=BC=8C=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=89=88=E4=BC=9A=E7=9B=B4=E6=8E=A5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.test | 2 +- src/renderer/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.test b/.env.test index 993cace..3d671e1 100644 --- a/.env.test +++ b/.env.test @@ -1,5 +1,5 @@ # 页面标题 -VITE_APP_TITLE = AIx数字平台 +VITE_APP_TITLE = AIx数字平台(测试版) # 生产环境配置 VITE_APP_ENV = 'production' diff --git a/src/renderer/index.html b/src/renderer/index.html index 8ee7d0b..1de810c 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -2,7 +2,7 @@ - AIx智慧教育 + %VITE_APP_TITLE%