mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-25 07:16:51 +00:00
聊天页面支持实况解析;朋友圈页面优化
This commit is contained in:
@@ -397,7 +397,7 @@ function createVideoPlayerWindow(videoPath: string, videoWidth?: number, videoHe
|
||||
/**
|
||||
* 创建独立的图片查看窗口
|
||||
*/
|
||||
function createImageViewerWindow(imagePath: string) {
|
||||
function createImageViewerWindow(imagePath: string, liveVideoPath?: string) {
|
||||
const isDev = !!process.env.VITE_DEV_SERVER_URL
|
||||
const iconPath = isDev
|
||||
? join(__dirname, '../public/icon.ico')
|
||||
@@ -430,7 +430,8 @@ function createImageViewerWindow(imagePath: string) {
|
||||
win.show()
|
||||
})
|
||||
|
||||
const imageParam = `imagePath=${encodeURIComponent(imagePath)}`
|
||||
let imageParam = `imagePath=${encodeURIComponent(imagePath)}`
|
||||
if (liveVideoPath) imageParam += `&liveVideoPath=${encodeURIComponent(liveVideoPath)}`
|
||||
|
||||
if (process.env.VITE_DEV_SERVER_URL) {
|
||||
win.loadURL(`${process.env.VITE_DEV_SERVER_URL}#/image-viewer-window?${imageParam}`)
|
||||
@@ -1119,8 +1120,18 @@ function registerIpcHandlers() {
|
||||
})
|
||||
|
||||
// 打开图片查看窗口
|
||||
ipcMain.handle('window:openImageViewerWindow', (_, imagePath: string) => {
|
||||
createImageViewerWindow(imagePath)
|
||||
ipcMain.handle('window:openImageViewerWindow', async (_, imagePath: string, liveVideoPath?: string) => {
|
||||
// 如果是 dataUrl,写入临时文件
|
||||
if (imagePath.startsWith('data:')) {
|
||||
const commaIdx = imagePath.indexOf(',')
|
||||
const meta = imagePath.slice(5, commaIdx) // e.g. "image/jpeg;base64"
|
||||
const ext = meta.split('/')[1]?.split(';')[0] || 'jpg'
|
||||
const tmpPath = join(app.getPath('temp'), `weflow_preview_${Date.now()}.${ext}`)
|
||||
await writeFile(tmpPath, Buffer.from(imagePath.slice(commaIdx + 1), 'base64'))
|
||||
createImageViewerWindow(`file://${tmpPath.replace(/\\/g, '/')}`, liveVideoPath)
|
||||
} else {
|
||||
createImageViewerWindow(imagePath, liveVideoPath)
|
||||
}
|
||||
})
|
||||
|
||||
// 完成引导,关闭引导窗口并显示主窗口
|
||||
|
||||
Reference in New Issue
Block a user