新增管理师移动端前端模块

This commit is contained in:
2026-06-29 20:58:39 +08:00
parent 9cfaac3e18
commit 48c47fe3ff
78 changed files with 9276 additions and 5 deletions
@@ -0,0 +1,101 @@
# FM-Front 移动端发布配置说明
更新时间:2026-06-29
## 访问路径
`FM-Front` 是管理师移动端 Web 模块,生产访问路径固定为:
```text
https://yunail.art/fm-front/
```
Vite `base` 固定为 `/fm-front/`,不能部署到域名根路径,否则静态资源路径会不匹配。
## 构建产物
`FM-Front` 独立执行:
```text
npm ci
npm run build
```
构建产物目录为:
```text
FM-Front/dist
```
`scripts/package-release.ps1` 会先构建 `FD-Frontend`,再构建 `FM-Front`,发布包内包含:
```text
frontend/dist
frontend/dist/fm-front
frontend/fm-front-dist
```
其中 `frontend/dist/fm-front` 用于与现有 Web 前端一起部署,`frontend/fm-front-dist` 用于人工核查和独立备份。
## 生产部署目录
`scripts/deploy-fingertip-designer-production.ps1` 会把 `FD-Frontend/dist` 与 `FM-Front/dist` 合并为同一个 Web tar 包:
```text
dist/
dist/fm-front/
```
远端 Web 发布目录沿用:
```text
/opt/fingertip-designer-frontend
```
脚本解压后仍使用现有软链:
```text
/opt/fingertip-designer-frontend/current -> releases/{timestamp}/dist
```
因此 `/fm-front/` 实际对应:
```text
/opt/fingertip-designer-frontend/current/fm-front/
```
## 接口与鉴权
移动端 Web 复用现有后端接口,不新增后端配置:
```text
/admin/api
/api
```
请求签名、设备 ID、本地会话和鉴权刷新逻辑由 `FM-Front/src/api` 与 `FM-Front/src/utils/request-signature.ts` 维护。
## 回滚注意事项
回滚 Web 版本时,回滚单位是整个 Web `current` 软链;`FD-Frontend` 与 `FM-Front` 会一起回到上一个 Web 发布版本。
如只需临时下线移动端,可以在当前 Web 目录中移除 `fm-front` 子目录,但下一次发布会重新生成。
## 验证方式
发布前至少执行:
```text
cd FM-Front
npm ci
npm run test:unit
npm run build
```
生产发布脚本的公开冒烟会检查:
```text
GET https://yunail.art/health/check
GET https://yunail.art/api/shop/list
GET https://yunail.art/fm-front/
```
@@ -495,12 +495,20 @@ function Build-ReleasePackage {
Invoke-Native "npm" @("ci") $frontendRoot
}
Invoke-Native "npm" @("run", "build") $frontendRoot
Write-Step "构建 FM-Front"
$managerMobileRoot = Join-Path $resolvedRepoRoot "FM-Front"
if (-not (Test-Path -LiteralPath (Join-Path $managerMobileRoot "node_modules"))) {
Invoke-Native "npm" @("ci") $managerMobileRoot
}
Invoke-Native "npm" @("run", "build") $managerMobileRoot
}
$coreJar = Join-Path $resolvedRepoRoot "FD-Core\target\FingertipDesigner-Core.jar"
$gatewayJar = Join-Path $resolvedRepoRoot "FD-Gateway\target\FingertipDesigner-Gateway.jar"
$frontendDist = Join-Path $resolvedRepoRoot "FD-Frontend\dist"
foreach ($requiredPath in @($coreJar, $gatewayJar, $frontendDist, $InitSqlPath)) {
$managerMobileDist = Join-Path $resolvedRepoRoot "FM-Front\dist"
foreach ($requiredPath in @($coreJar, $gatewayJar, $frontendDist, $managerMobileDist, $InitSqlPath)) {
if (-not (Test-Path -LiteralPath $requiredPath)) {
throw "缺少发布产物:$requiredPath"
}
@@ -521,7 +529,17 @@ function Build-ReleasePackage {
if (Test-Path -LiteralPath $frontendArtifact) {
Remove-Item -LiteralPath $frontendArtifact -Force
}
Invoke-Native $tar.Source @("-czf", $frontendArtifact, "-C", (Join-Path $resolvedRepoRoot "FD-Frontend"), "dist")
$frontendStagingRoot = Join-Path $frontendDir "web-dist"
$frontendStagingDist = Join-Path $frontendStagingRoot "dist"
$managerMobileStagingDist = Join-Path $frontendStagingDist "fm-front"
if (Test-Path -LiteralPath $frontendStagingRoot) {
Remove-Item -LiteralPath $frontendStagingRoot -Recurse -Force
}
New-Item -ItemType Directory -Force -Path $frontendStagingRoot, $managerMobileStagingDist | Out-Null
Copy-Item -LiteralPath $frontendDist -Destination $frontendStagingRoot -Recurse -Force
Copy-Item -Path (Join-Path $managerMobileDist "*") -Destination $managerMobileStagingDist -Recurse -Force
Invoke-Native $tar.Source @("-czf", $frontendArtifact, "-C", $frontendStagingRoot, "dist")
Remove-Item -LiteralPath $frontendStagingRoot -Recurse -Force
$hashes = foreach ($artifact in @($coreArtifact, $gatewayArtifact, $frontendArtifact, $sqlArtifact)) {
$hash = Get-FileHash -LiteralPath $artifact -Algorithm SHA256
@@ -750,6 +768,7 @@ function Write-ReleaseManifest {
gatewayRemoteAppDir = $GatewayRemoteAppDir
webRemoteDir = $WebRemoteDir
publicBaseUrl = $PublicBaseUrl
managerMobileWeb = "$PublicBaseUrl/fm-front/"
managerMiniProgramApi = "$PublicBaseUrl/api/admin"
nacosNamespace = "FingertipDesigner"
dryRun = [bool]$DryRun
@@ -765,11 +784,12 @@ function Invoke-PublicSmokeTests {
Write-Host "DryRun public smoke tests:"
Write-Host "GET $PublicBaseUrl/health/check"
Write-Host "GET $PublicBaseUrl/api/shop/list"
Write-Host "GET $PublicBaseUrl/fm-front/"
return
}
Write-Step "生产公开冒烟"
foreach ($url in @("$PublicBaseUrl/health/check", "$PublicBaseUrl/api/shop/list")) {
foreach ($url in @("$PublicBaseUrl/health/check", "$PublicBaseUrl/api/shop/list", "$PublicBaseUrl/fm-front/")) {
Write-Host "GET $url"
$response = Invoke-WebRequest -Uri $url -UseBasicParsing -TimeoutSec 20
Write-Host "Status $($response.StatusCode) Length $($response.RawContentLength)"
+15 -2
View File
@@ -66,7 +66,7 @@ function Copy-Directory {
}
New-Item -ItemType Directory -Force -Path $Destination | Out-Null
Copy-Item -LiteralPath $Source -Destination $Destination -Recurse -Force
Copy-Item -Path (Join-Path $Source "*") -Destination $Destination -Recurse -Force
}
function Copy-RequiredFile {
@@ -110,13 +110,23 @@ if (-not (Test-Path -LiteralPath (Join-Path $frontendRoot "node_modules"))) {
}
Invoke-Native "npm" @("run", "build") $frontendRoot
Write-Step "构建 FM-Front"
$managerMobileRoot = Join-Path $repoRoot "FM-Front"
if (-not (Test-Path -LiteralPath (Join-Path $managerMobileRoot "node_modules"))) {
Invoke-Native "npm" @("ci") $managerMobileRoot
}
Invoke-Native "npm" @("run", "build") $managerMobileRoot
$coreJar = Join-Path $repoRoot "FD-Core\target\FingertipDesigner-Core.jar"
$gatewayJar = Join-Path $repoRoot "FD-Gateway\target\FingertipDesigner-Gateway.jar"
$frontendDist = Join-Path $frontendRoot "dist"
$managerMobileDist = Join-Path $managerMobileRoot "dist"
Copy-RequiredFile $coreJar (Join-Path $backendDir "FingertipDesigner-Core.jar")
Copy-RequiredFile $gatewayJar (Join-Path $backendDir "FingertipDesigner-Gateway.jar")
Copy-Directory $frontendDist (Join-Path $frontendDir "dist")
Copy-Directory $managerMobileDist (Join-Path $frontendDir "fm-front-dist")
Copy-Directory $managerMobileDist (Join-Path $frontendDir "dist\fm-front")
Copy-Directory (Join-Path $repoRoot "FD-WeChat-Fronted") (Join-Path $miniProgramDir "FD-WeChat-Fronted")
Copy-Directory (Join-Path $repoRoot "FM-Wechat-Fronted") (Join-Path $miniProgramDir "FM-Wechat-Fronted")
Copy-RequiredFile $sqlPath (Join-Path $releaseDir "FingertipDesigner.sql")
@@ -127,6 +137,8 @@ $manifest = @(
"- backend/FingertipDesigner-Core.jar",
"- backend/FingertipDesigner-Gateway.jar",
"- frontend/dist",
"- frontend/dist/fm-front",
"- frontend/fm-front-dist",
"- miniprograms/FD-WeChat-Fronted",
"- miniprograms/FM-Wechat-Fronted",
"- FingertipDesigner.sql",
@@ -134,7 +146,8 @@ $manifest = @(
"Nacos namespace: FingertipDesigner",
"Database initialized by: scripts/sql/init/FingertipDesigner.sql",
"Database name: FingertipDesigner",
"Manager mini program API: https://yunail.art/api/admin"
"Manager mini program API: https://yunail.art/api/admin",
"Manager mobile web: https://yunail.art/fm-front/"
)
$manifest | Set-Content -Encoding UTF8 (Join-Path $releaseDir "README.md")