feat(electron): 添加Electron桌面应用支持

- 新增Electron主进程、预加载脚本和构建配置
- 修改前端配置以支持Electron打包
- 更新项目文档和依赖
- 重构API调用使用统一axios实例
This commit is contained in:
dmy
2026-01-15 00:35:19 +08:00
parent f736f30248
commit eca3f4f9fd
22 changed files with 421 additions and 109 deletions

View File

@@ -77,7 +77,7 @@
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import axios from 'axios'
import api from '../utils/api'
import { ElMessage } from 'element-plus'
import { Refresh, Paperclip } from '@element-plus/icons-vue'
import PinnedProject from './PinnedProject.vue'
@@ -275,7 +275,7 @@ const handleCrawl = async () => {
}
crawling.value = true
try {
await axios.post('/api/crawler/run')
await api.post('/api/crawler/run')
ElMessage.success('Crawl completed successfully')
emit('refresh') // Refresh data after crawl
} catch (error) {
@@ -301,7 +301,7 @@ const handlePinChanged = async (title: string) => {
const togglePin = async (item: any) => {
try {
const newPinStatus = !item.pin
await axios.patch(`/api/bids/${encodeURIComponent(item.title)}/pin`, { pin: newPinStatus })
await api.patch(`/api/bids/${encodeURIComponent(item.title)}/pin`, { pin: newPinStatus })
item.pin = newPinStatus
ElMessage.success(newPinStatus ? '已置顶' : '已取消置顶')
// 刷新 PinnedProject 组件的数据