Skip to content

Commit

Permalink
feat(wip): 头像上传
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxinqi committed Apr 18, 2023
1 parent efc3cf6 commit 16cb505
Show file tree
Hide file tree
Showing 12 changed files with 1,585 additions and 531 deletions.
29 changes: 29 additions & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'

export {}

declare module '@vue/runtime-core' {
export interface GlobalComponents {
Button: typeof import('./src/components/widgets/Button.vue')['default']
Card: typeof import('./src/components/widgets/Card.vue')['default']
Content: typeof import('./src/components/Content.vue')['default']
ElButton: typeof import('element-plus/es')['ElButton']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElUpload: typeof import('element-plus/es')['ElUpload']
Header: typeof import('./src/components/Header.vue')['default']
InputKit: typeof import('./src/components/widgets/InputKit.vue')['default']
Modal: typeof import('./src/components/widgets/Modal.vue')['default']
Nav: typeof import('./src/components/Nav.vue')['default']
NewChat: typeof import('./src/components/NewChat.vue')['default']
Setting: typeof import('./src/components/Setting.vue')['default']
Switch: typeof import('./src/components/widgets/Switch.vue')['default']
Tool: typeof import('./src/components/Tool.vue')['default']
Upload: typeof import('./src/components/widgets/Upload.vue')['default']
}
}
9 changes: 8 additions & 1 deletion electron/main/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { release } from 'node:os'
import { join } from 'node:path'
import { BrowserWindow, app, ipcMain, shell } from 'electron'
import fs from 'fs'
import { BrowserWindow, app, contextBridge, ipcMain, ipcRenderer, shell } from 'electron'

process.env.DIST_ELECTRON = join(__dirname, '..')
process.env.DIST = join(process.env.DIST_ELECTRON, '../dist')
Expand Down Expand Up @@ -105,3 +106,9 @@ ipcMain.handle('open-win', (_, arg) => {
else
childWindow.loadFile(indexHtml, { hash: arg })
})

ipcMain.handle('uploadAvatar', (_, filePath) => {
const fileContent = fs.readFileSync(filePath).toString('base64')
return `data:image/png;base64,${fileContent}`
})

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"dependencies": {
"@vueuse/core": "^9.13.0",
"element-plus": "^2.3.3",
"eventsource-parser": "^0.1.0",
"microsoft-cognitiveservices-speech-sdk": "^1.26.0",
"pinia": "^2.0.33",
Expand All @@ -51,6 +52,7 @@
"rimraf": "^5.0.0",
"typescript": "^4.9.5",
"unplugin-auto-import": "^0.15.1",
"unplugin-vue-components": "^0.24.1",
"vite": "^4.1.4",
"vite-plugin-electron": "^0.11.1",
"vite-plugin-electron-renderer": "^0.12.1",
Expand Down

0 comments on commit 16cb505

Please sign in to comment.