Compare commits

...

13 Commits

Author SHA1 Message Date
朱浩 fe41a63b2d Merge pull request 'zhuhao_dev' (#170) from zhuhao_dev into main
Reviewed-on: #170
2024-09-03 16:39:57 +08:00
朱浩 cdf12cf213 区分生产和测试版本,测试版会直接显示测试版文字 2024-09-03 16:37:39 +08:00
朱浩 59ca00d6d1 Merge branch 'main' into zhuhao_dev
# Conflicts:
#	package.json
2024-09-03 16:15:07 +08:00
朱浩 0e5ca5eff2 Merge branch 'main' into zhuhao_dev 2024-08-31 14:13:56 +08:00
朱浩 e985c2e7af Merge branch 'main' into zhuhao_dev 2024-08-23 12:01:51 +08:00
朱浩 0ea628d174 二期:打包IM 2024-08-23 12:01:43 +08:00
朱浩 d4982d47c7 二期:打包IM 2024-08-23 12:01:21 +08:00
朱浩 f38a14bc0b Merge branch 'zdg' into zhuhao_dev
# Conflicts:
#	package.json
#	src/renderer/src/plugins/shareStore.js
2024-08-19 17:00:42 +08:00
朱浩 5f6839058a 二期:打包IM 2024-08-19 14:18:39 +08:00
朱浩 0ff0cd42bc 二期:修改自动同步检测逻辑 2024-08-16 18:10:20 +08:00
朱浩 6dfb2d4a8a Merge branch 'main' into zhuhao_dev 2024-08-16 17:41:01 +08:00
朱浩 88177d610e Merge branch 'main' into zhuhao_dev 2024-08-16 13:42:55 +08:00
朱浩 57b7d3d601 二期:修改自动同步检测逻辑 2024-08-16 13:42:19 +08:00
6 changed files with 32 additions and 15 deletions

View File

@ -1,5 +1,5 @@
# 页面标题 # 页面标题
VITE_APP_TITLE = AIx数字平台 VITE_APP_TITLE = AIx数字平台(测试版)
# 生产环境配置 # 生产环境配置
VITE_APP_ENV = 'production' VITE_APP_ENV = 'production'

View File

@ -34,10 +34,10 @@
"electron-updater": "^6.1.7", "electron-updater": "^6.1.7",
"element-plus": "^2.7.6", "element-plus": "^2.7.6",
"fabric": "^5.3.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", "jsondiffpatch": "0.6.0",
"im_electron_sdk": "^8.0.5904",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"pdfjs-dist": "4.4.168", "pdfjs-dist": "4.4.168",
"pinia": "^2.1.7", "pinia": "^2.1.7",

View File

@ -42,19 +42,23 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
let filePath = appRootFilePath + fileNewName let filePath = appRootFilePath + fileNewName
let uploadId = null let uploadId = null
let isOn = false let isOn = false
let lastMTime = fs.statSync(filePath).mtime.getTime()
console.log(lastMTime)
setInterval(() => { setInterval(() => {
getFileMD5(filePath).then((md5New) => { getFileMsg(filePath).then((msg) => {
if (md5New !== md5) { if (msg !== lastMTime) {
md5 = md5New lastMTime = msg
if (uploadId) { if (uploadId) {
clearTimeout(uploadId) clearTimeout(uploadId)
} }
if (isOn === false) { if (isOn === false) {
console.log(fileNewName)
e.reply('listen-file-change-on' + fileNewName) e.reply('listen-file-change-on' + fileNewName)
isOn = true isOn = true
} }
//倒数十秒提交更改,十秒之内有继续修改则重置倒数 //倒数十秒提交更改,十秒之内有继续修改则重置倒数
uploadId = setTimeout(() => { uploadId = setTimeout(() => {
console.log(223)
//执行更新,上传文件 //执行更新,上传文件
let formData = new FormData() let formData = new FormData()
formData.append('id', id) formData.append('id', id)
@ -77,12 +81,19 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
console.error('Error uploading file:', err) 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) { function getFileMD5(path) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fs.readFile(path, (err, dataFile) => { fs.readFile(path, (err, dataFile) => {
@ -121,13 +132,14 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'down' }) e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'down' })
return return
} }
getFileMD5(filePath).then((localMd5) => { getFileMsg(filePath).then((msg) => {
if (localMd5 === md5) { 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: '' }) e.reply('is-async-local-file-reply' + fileNewName, { isAsync: false, type: '' })
} else { } else {
const stats = fs.statSync(filePath) const stats = fs.statSync(filePath)
//如果线上时间大于线下时间,就需要从线上下载,否则则需要上传 //如果线上时间大于线下时间,就需要从线上下载,否则则需要上传
let time = new Date(lastModifyTime)
if (time > stats.mtime.getTime()) { if (time > stats.mtime.getTime()) {
e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'down' }) e.reply('is-async-local-file-reply' + fileNewName, { isAsync: true, type: 'down' })
} else if (time < stats.mtime.getTime()) { } else if (time < stats.mtime.getTime()) {

View File

@ -141,6 +141,11 @@ async function createLinkWin(data) {
.then(() => {}) .then(() => {})
.catch((error) => {}) .catch((error) => {})
data.fullPath = data.fullPath.replaceAll('//', '/') 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].loadURL(data.fullPath)
linkWin[data.key].once('ready-to-show', () => { linkWin[data.key].once('ready-to-show', () => {

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>AIx智慧教育</title> <title>%VITE_APP_TITLE%</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"

View File

@ -246,12 +246,12 @@ export default {
fileType: item.fileType fileType: item.fileType
}) })
ipcRenderer.on('listen-file-change-on' + item.fileNewName, () => { 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 }) => { ipcRenderer.on('listen-file-change-success' + item.fileNewName, (e, { data, md5 }) => {
item.fileSize = data.fileSize items.fileSize = data.fileSize
item.md5 = md5 items.md5 = md5
item.async = true items.async = true
}) })
} }
}) })