删除文件 desktop
This commit is contained in:
@@ -1,74 +0,0 @@
|
|||||||
# 桌面端启动
|
|
||||||
|
|
||||||
## Python 要求
|
|
||||||
|
|
||||||
桌面端当前依赖 `pywebview`,在 Windows 下建议使用:
|
|
||||||
|
|
||||||
- `Python 3.12`
|
|
||||||
- `Python 3.11`
|
|
||||||
|
|
||||||
不要直接用 `Python 3.14`。你当前遇到的 `pythonnet` 构建失败就是这个兼容性问题。
|
|
||||||
|
|
||||||
## 开发模式
|
|
||||||
|
|
||||||
前置条件:
|
|
||||||
|
|
||||||
- `frontend-vue` 的 Vite 开发服务已启动在 `http://127.0.0.1:5173`
|
|
||||||
- 后端 API 已启动在 `http://127.0.0.1:8000`
|
|
||||||
- 本机已安装 `Python 3.12` 或 `Python 3.11`
|
|
||||||
|
|
||||||
启动命令:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
cd F:\project\crawler-plugin
|
|
||||||
.\desktop\run_desktop_dev.ps1
|
|
||||||
```
|
|
||||||
|
|
||||||
脚本会自动:
|
|
||||||
|
|
||||||
- 选择兼容的 Python 解释器
|
|
||||||
- 安装 `desktop/requirements.txt`
|
|
||||||
- 启动 `pywebview` 桌面窗口
|
|
||||||
|
|
||||||
如果脚本检测不到兼容 Python,会直接提示并退出,不再继续错误安装。
|
|
||||||
|
|
||||||
## 发布模式
|
|
||||||
|
|
||||||
先构建前端:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
cd F:\project\crawler-plugin\frontend-vue
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
再启动桌面端:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
cd F:\project\crawler-plugin
|
|
||||||
.\desktop\run_desktop_dist.ps1
|
|
||||||
```
|
|
||||||
|
|
||||||
## 手动安装依赖
|
|
||||||
|
|
||||||
如果要手动安装,请显式使用兼容版本,例如:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
py -3.12 -m pip install -r .\desktop\requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
## 当前桌面能力
|
|
||||||
|
|
||||||
- 选择品牌 Excel 文件
|
|
||||||
- 选择文件夹
|
|
||||||
- 选择保存目录
|
|
||||||
- 另存模板文件
|
|
||||||
- 按 URL 下载结果文件到本地
|
|
||||||
|
|
||||||
## 说明
|
|
||||||
|
|
||||||
发布模式下,桌面宿主会:
|
|
||||||
|
|
||||||
- 本地托管 `frontend-vue/dist`
|
|
||||||
- 将 `/api`、`/login`、`/logout`、`/static` 代理到 `--backend-url`
|
|
||||||
|
|
||||||
所以后端仍然需要运行。
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1017
desktop/app.py
1017
desktop/app.py
File diff suppressed because it is too large
Load Diff
@@ -1,3 +0,0 @@
|
|||||||
pywebview>=5.1
|
|
||||||
requests>=2.32.0
|
|
||||||
openpyxl>=3.1.5
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
Set-StrictMode -Version Latest
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
$root = Split-Path -Parent $PSScriptRoot
|
|
||||||
Set-Location $root
|
|
||||||
|
|
||||||
function Get-CompatiblePythonCommand {
|
|
||||||
$pyLauncher = Get-Command py -ErrorAction SilentlyContinue
|
|
||||||
if ($pyLauncher) {
|
|
||||||
foreach ($version in @("3.12", "3.11")) {
|
|
||||||
try {
|
|
||||||
& py "-$version" --version *> $null
|
|
||||||
if ($LASTEXITCODE -eq 0) {
|
|
||||||
return @("py", "-$version")
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$pythonCommand = Get-Command python -ErrorAction SilentlyContinue
|
|
||||||
if ($pythonCommand) {
|
|
||||||
try {
|
|
||||||
$pythonVersion = (& python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" 2>$null).Trim()
|
|
||||||
if ($pythonVersion -in @("3.12", "3.11")) {
|
|
||||||
return @("python")
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $null
|
|
||||||
}
|
|
||||||
|
|
||||||
function Invoke-Python {
|
|
||||||
param(
|
|
||||||
[string[]]$PythonCommand,
|
|
||||||
[string[]]$Arguments
|
|
||||||
)
|
|
||||||
|
|
||||||
$exe = $PythonCommand[0]
|
|
||||||
$prefix = @()
|
|
||||||
if ($PythonCommand.Length -gt 1) {
|
|
||||||
$prefix = $PythonCommand[1..($PythonCommand.Length - 1)]
|
|
||||||
}
|
|
||||||
|
|
||||||
& $exe @prefix @Arguments
|
|
||||||
}
|
|
||||||
|
|
||||||
$pythonCmd = Get-CompatiblePythonCommand
|
|
||||||
if (-not $pythonCmd) {
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "No compatible Python version was found."
|
|
||||||
Write-Host "Desktop mode requires Python 3.12 or 3.11 for pywebview on Windows."
|
|
||||||
Write-Host "Only Python 3.14 was detected, which will fail when installing pythonnet."
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "Install Python 3.12 first, then run:"
|
|
||||||
Write-Host " .\desktop\run_desktop_dev.ps1"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "Using Python: $($pythonCmd -join ' ')"
|
|
||||||
Write-Host "Ensuring desktop dependencies..."
|
|
||||||
Invoke-Python -PythonCommand $pythonCmd -Arguments @("-m", "pip", "install", "-r", ".\desktop\requirements.txt")
|
|
||||||
|
|
||||||
Write-Host "Starting desktop app..."
|
|
||||||
Invoke-Python -PythonCommand $pythonCmd -Arguments @("-m", "desktop.app", "--mode", "dev", "--frontend-url", "http://127.0.0.1:5173", "--backend-url", "http://127.0.0.1:18080")
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
Set-StrictMode -Version Latest
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
$root = Split-Path -Parent $PSScriptRoot
|
|
||||||
Set-Location $root
|
|
||||||
|
|
||||||
function Get-CompatiblePythonCommand {
|
|
||||||
$pyLauncher = Get-Command py -ErrorAction SilentlyContinue
|
|
||||||
if ($pyLauncher) {
|
|
||||||
foreach ($version in @("3.12", "3.11")) {
|
|
||||||
try {
|
|
||||||
& py "-$version" --version *> $null
|
|
||||||
if ($LASTEXITCODE -eq 0) {
|
|
||||||
return @("py", "-$version")
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$pythonCommand = Get-Command python -ErrorAction SilentlyContinue
|
|
||||||
if ($pythonCommand) {
|
|
||||||
try {
|
|
||||||
$pythonVersion = (& python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" 2>$null).Trim()
|
|
||||||
if ($pythonVersion -in @("3.12", "3.11")) {
|
|
||||||
return @("python")
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $null
|
|
||||||
}
|
|
||||||
|
|
||||||
function Invoke-Python {
|
|
||||||
param(
|
|
||||||
[string[]]$PythonCommand,
|
|
||||||
[string[]]$Arguments
|
|
||||||
)
|
|
||||||
|
|
||||||
$exe = $PythonCommand[0]
|
|
||||||
$prefix = @()
|
|
||||||
if ($PythonCommand.Length -gt 1) {
|
|
||||||
$prefix = $PythonCommand[1..($PythonCommand.Length - 1)]
|
|
||||||
}
|
|
||||||
|
|
||||||
& $exe @prefix @Arguments
|
|
||||||
}
|
|
||||||
|
|
||||||
$pythonCmd = Get-CompatiblePythonCommand
|
|
||||||
if (-not $pythonCmd) {
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "No compatible Python version was found."
|
|
||||||
Write-Host "Desktop mode requires Python 3.12 or 3.11 for pywebview on Windows."
|
|
||||||
Write-Host "Only Python 3.14 was detected, which will fail when installing pythonnet."
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "Install Python 3.12 first, then run:"
|
|
||||||
Write-Host " .\desktop\run_desktop_dist.ps1"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "Using Python: $($pythonCmd -join ' ')"
|
|
||||||
Write-Host "Ensuring desktop dependencies..."
|
|
||||||
Invoke-Python -PythonCommand $pythonCmd -Arguments @("-m", "pip", "install", "-r", ".\desktop\requirements.txt")
|
|
||||||
|
|
||||||
Write-Host "Starting desktop app..."
|
|
||||||
Invoke-Python -PythonCommand $pythonCmd -Arguments @("-m", "desktop.app", "--mode", "dist", "--backend-url", "http://127.0.0.1:8000")
|
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
{
|
|
||||||
"default_template_id": null,
|
|
||||||
"templates": {
|
|
||||||
"user_1773929220357": {
|
|
||||||
"id": "user_1773929220357",
|
|
||||||
"label": "自定义 Offer 模板",
|
|
||||||
"output_filename": "英国.txt",
|
|
||||||
"is_default": false,
|
|
||||||
"built_in": false,
|
|
||||||
"preamble_lines": [
|
|
||||||
"TemplateType=Offer\tVersion=1.4\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
|
|
||||||
],
|
|
||||||
"header_columns": [
|
|
||||||
"sku",
|
|
||||||
"price",
|
|
||||||
"quantity",
|
|
||||||
"product-id",
|
|
||||||
"product-id-type",
|
|
||||||
"condition-type",
|
|
||||||
"condition-note",
|
|
||||||
"ASIN-hint",
|
|
||||||
"title",
|
|
||||||
"product-tax-code",
|
|
||||||
"operation-type",
|
|
||||||
"sale-price",
|
|
||||||
"sale-start-date",
|
|
||||||
"sale-end-date",
|
|
||||||
"leadtime-to-ship",
|
|
||||||
"launch-date",
|
|
||||||
"is-giftwrap-available",
|
|
||||||
"is-gift-message-available"
|
|
||||||
],
|
|
||||||
"blank_header_rows_after_schema": 1,
|
|
||||||
"required_source_columns": [
|
|
||||||
"ASIN",
|
|
||||||
"价格"
|
|
||||||
],
|
|
||||||
"defaults": {
|
|
||||||
"quantity": "100",
|
|
||||||
"product-id-type": "ASIN",
|
|
||||||
"condition-type": "new",
|
|
||||||
"leadtime-to-ship": "4"
|
|
||||||
},
|
|
||||||
"field_mapping": {
|
|
||||||
"price": "价格",
|
|
||||||
"product-id": "ASIN"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"user_1773929734779": {
|
|
||||||
"id": "user_1773929734779",
|
|
||||||
"label": "测试",
|
|
||||||
"output_filename": "测试.txt",
|
|
||||||
"is_default": false,
|
|
||||||
"built_in": false,
|
|
||||||
"preamble_lines": [
|
|
||||||
"TemplateType=Offer\tVersion=1.4\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
|
|
||||||
],
|
|
||||||
"header_columns": [
|
|
||||||
"sku",
|
|
||||||
"price",
|
|
||||||
"quantity",
|
|
||||||
"product-id",
|
|
||||||
"product-id-type",
|
|
||||||
"condition-type",
|
|
||||||
"condition-note",
|
|
||||||
"ASIN-hint",
|
|
||||||
"title",
|
|
||||||
"product-tax-code",
|
|
||||||
"operation-type",
|
|
||||||
"sale-price",
|
|
||||||
"sale-start-date",
|
|
||||||
"sale-end-date",
|
|
||||||
"leadtime-to-ship",
|
|
||||||
"launch-date",
|
|
||||||
"is-giftwrap-available",
|
|
||||||
"is-gift-message-available"
|
|
||||||
],
|
|
||||||
"blank_header_rows_after_schema": 1,
|
|
||||||
"required_source_columns": [
|
|
||||||
"ASIN",
|
|
||||||
"价格"
|
|
||||||
],
|
|
||||||
"defaults": {
|
|
||||||
"quantity": "100",
|
|
||||||
"product-id-type": "ASIN",
|
|
||||||
"condition-type": "new",
|
|
||||||
"leadtime-to-ship": "4"
|
|
||||||
},
|
|
||||||
"field_mapping": {
|
|
||||||
"price": "价格",
|
|
||||||
"product-id": "ASIN"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"user_1773982097249": {
|
|
||||||
"id": "user_1773982097249",
|
|
||||||
"label": "默认",
|
|
||||||
"output_filename": "默认.txt",
|
|
||||||
"is_default": false,
|
|
||||||
"built_in": false,
|
|
||||||
"preamble_lines": [
|
|
||||||
"TemplateType=Offer\tVersion=1.4\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
|
|
||||||
],
|
|
||||||
"header_columns": [
|
|
||||||
"sku",
|
|
||||||
"price",
|
|
||||||
"quantity",
|
|
||||||
"product-id",
|
|
||||||
"product-id-type",
|
|
||||||
"condition-type",
|
|
||||||
"condition-note",
|
|
||||||
"ASIN-hint",
|
|
||||||
"title",
|
|
||||||
"product-tax-code",
|
|
||||||
"operation-type",
|
|
||||||
"sale-price",
|
|
||||||
"sale-start-date",
|
|
||||||
"sale-end-date",
|
|
||||||
"leadtime-to-ship",
|
|
||||||
"launch-date",
|
|
||||||
"is-giftwrap-available",
|
|
||||||
"is-gift-message-available"
|
|
||||||
],
|
|
||||||
"blank_header_rows_after_schema": 1,
|
|
||||||
"required_source_columns": [
|
|
||||||
"ASIN",
|
|
||||||
"价格"
|
|
||||||
],
|
|
||||||
"defaults": {
|
|
||||||
"quantity": "100",
|
|
||||||
"product-id-type": "ASIN",
|
|
||||||
"condition-type": "new",
|
|
||||||
"leadtime-to-ship": "4"
|
|
||||||
},
|
|
||||||
"field_mapping": {
|
|
||||||
"price": "价格",
|
|
||||||
"product-id": "ASIN"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user