wms_worker_station/scripts/gen-android-assets.ps1
liufumingren 0adaaa5bd6 feat: 打包模式工牌扫码上线/下线、多成员管理与30分钟自动登出等
打包模式(pages/packaging):
- 工牌(base64 JSON)扫码识别,经 index.queryUserByToken 查询用户:同用户已在线则下线,否则绑定为在线成员
- 多成员模型 workbenchMembers:弹窗仅展示成员列表+逐个下线;上报打包携带全部在线成员(users)
- 成员列表以服务端 getWorkbenchInfo.members 为准,绑定/下线后静默重拉
- 无在线成员时非工牌码拦截提示需要先登录,不走查询用户
- 带打包台 token 请求 401/403 统一清除工作台状态回登录(请求守卫)
- 30 分钟无新打包任务:结束打包任务+下线全部成员(不退出工作台模式,留在当前页)
- 移除手动退出工作台入口;扫描记录持久化 localStorage(50 条出入栈)
- 操作员列表弹窗重新排版(头像/姓名/下线按钮)

其他:
- 登录页扫码/更新流程、导航守卫与路由封装、Electron 主进程/预加载、发布脚本与配置模板(deploy.example.json)等调整
2026-09-19 01:05:54 +08:00

150 lines
6.2 KiB
PowerShell

# Generate Android app icon (1024x1024) and splash (1920x1080) for WMS worker station.
# Design: dark-blue gradient + white parcel box + teal scan line. No text.
# ASCII-only script to avoid encoding issues on Windows PowerShell 5.1.
Add-Type -AssemblyName System.Drawing
function New-RoundedRectPath([float]$x, [float]$y, [float]$w, [float]$h, [float]$r) {
$p = New-Object System.Drawing.Drawing2D.GraphicsPath
$d = 2 * $r
$p.AddArc($x, $y, $d, $d, 180, 90)
$p.AddArc($x + $w - $d, $y, $d, $d, 270, 90)
$p.AddArc($x + $w - $d, $y + $h - $d, $d, $d, 0, 90)
$p.AddArc($x, $y + $h - $d, $d, $d, 90, 90)
$p.CloseFigure()
return $p
}
function New-GradientBrush([System.Drawing.Rectangle]$rect, [System.Drawing.Color]$c1, [System.Drawing.Color]$c2, [float]$angle) {
return [System.Drawing.Drawing2D.LinearGradientBrush]::new($rect, $c1, $c2, $angle)
}
function Draw-Parcel([System.Drawing.Graphics]$g, [float]$cx, [float]$cy, [float]$bw, [float]$bh, [float]$radius, [float]$lineW) {
# parcel box: white rounded outline
$boxPath = New-RoundedRectPath ($cx - $bw/2) ($cy - $bh/2) $bw $bh $radius
$penBox = [System.Drawing.Pen]::new([System.Drawing.Color]::White, $lineW)
$g.DrawPath($penBox, $boxPath)
$penBox.Dispose()
$boxPath.Dispose()
# center vertical seam
$penSeam = [System.Drawing.Pen]::new([System.Drawing.Color]::White, $lineW * 0.55)
$g.DrawLine($penSeam, $cx, $cy - $bh/2, $cx, $cy + $bh/2)
$penSeam.Dispose()
# scan line with glow
$sy = $cy + $bh * 0.10
$x0 = $cx - $bw/2 + $radius
$x1 = $cx + $bw/2 - $radius
$glow = [System.Drawing.Pen]::new([System.Drawing.Color]::FromArgb(70, 62, 230, 196), $lineW * 2.6)
$scan = [System.Drawing.Pen]::new([System.Drawing.Color]::FromArgb(62, 230, 196), $lineW * 0.9)
$g.DrawLine($glow, $x0, $sy, $x1, $sy)
$g.DrawLine($scan, $x0, $sy, $x1, $sy)
$glow.Dispose()
$scan.Dispose()
# small teal dot at scan line left end (scanner hint)
$dotR = $lineW * 0.9
$dotBrush = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::FromArgb(62, 230, 196))
$g.FillEllipse($dotBrush, $x1 - $dotR, $sy - $dotR, $dotR * 2, $dotR * 2)
$dotBrush.Dispose()
}
# ---------------- icon 1024x1024 ----------------
function New-AppIcon([string]$path) {
$size = 1024
$bmp = [System.Drawing.Bitmap]::new($size, $size)
$g = [System.Drawing.Graphics]::FromImage($bmp)
$g.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
# background gradient clipped to rounded rect
$rect = [System.Drawing.Rectangle]::new(0, 0, $size, $size)
$bgPath = New-RoundedRectPath 0 0 $size $size ($size * 0.22)
$brush = New-GradientBrush $rect ([System.Drawing.Color]::FromArgb(15, 40, 105)) ([System.Drawing.Color]::FromArgb(44, 90, 214)) 90.0
$g.FillPath($brush, $bgPath)
$brush.Dispose()
# thin inner border
$border = [System.Drawing.Pen]::new([System.Drawing.Color]::FromArgb(80, 255, 255, 255), $size * 0.006)
$g.DrawPath($border, $bgPath)
$border.Dispose()
$bgPath.Dispose()
# parcel
Draw-Parcel $g ($size/2) ($size * 0.44) ($size * 0.38) ($size * 0.32) ($size * 0.05) ($size * 0.020)
# three dots below (warehouse shelf hint)
$dotY = $size * 0.78
$dotR = $size * 0.028
$dimBrush = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::FromArgb(160, 255, 255, 255))
$midBrush = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::FromArgb(62, 230, 196))
$g.FillEllipse($dimBrush, $size * 0.5 - $size * 0.16 - $dotR, $dotY, $dotR * 2, $dotR * 2)
$g.FillEllipse($midBrush, $size * 0.5 - $dotR, $dotY, $dotR * 2, $dotR * 2)
$g.FillEllipse($dimBrush, $size * 0.5 + $size * 0.16 - $dotR, $dotY, $dotR * 2, $dotR * 2)
$dimBrush.Dispose()
$midBrush.Dispose()
$g.Dispose()
$bmp.Save($path, [System.Drawing.Imaging.ImageFormat]::Png)
$bmp.Dispose()
Write-Host "icon saved: $path"
}
# ---------------- splash 1920x1080 (landscape) ----------------
function New-Splash([string]$path) {
$w = 1920
$h = 1080
$bmp = [System.Drawing.Bitmap]::new($w, $h)
$g = [System.Drawing.Graphics]::FromImage($bmp)
$g.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
# horizontal gradient background
$rect = [System.Drawing.Rectangle]::new(0, 0, $w, $h)
$brush = New-GradientBrush $rect ([System.Drawing.Color]::FromArgb(10, 28, 80)) ([System.Drawing.Color]::FromArgb(37, 84, 214)) 0.0
$g.FillRectangle($brush, $rect)
$brush.Dispose()
# soft light circle on the right
$halo = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::FromArgb(26, 255, 255, 255))
$g.FillEllipse($halo, $w * 0.62, -$h * 0.42, $h * 0.92, $h * 0.92)
$halo.Dispose()
# parcel centered, slightly left
Draw-Parcel $g ($w * 0.42) ($h * 0.50) ($w * 0.30) ($h * 0.46) ($h * 0.10) ($h * 0.030)
# bottom progress bar decoration
$barW = $w * 0.28
$barH = $h * 0.012
$barX = ($w - $barW) / 2
$barY = $h * 0.80
$barPath = New-RoundedRectPath $barX $barY $barW $barH ($barH / 2)
$track = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::FromArgb(70, 255, 255, 255))
$g.FillPath($track, $barPath)
$track.Dispose()
$fillW = $barW * 0.45
$fillPath = New-RoundedRectPath $barX $barY $fillW $barH ($barH / 2)
$fill = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::FromArgb(62, 230, 196))
$g.FillPath($fill, $fillPath)
$fill.Dispose()
$fillPath.Dispose()
$barPath.Dispose()
$g.Dispose()
$bmp.Save($path, [System.Drawing.Imaging.ImageFormat]::Png)
$bmp.Dispose()
Write-Host "splash saved: $path"
}
$iconPath = 'd:\wms_worker_station\android-offline\icon\app-icon.png'
$splashPath = 'd:\wms_worker_station\android-offline\splash\splash.png'
$buildIconDir = 'd:\wms_worker_station\build'
$buildIconPath = Join-Path $buildIconDir 'icon.png'
New-AppIcon $iconPath
New-Splash $splashPath
# Windows exe icon: electron-builder auto-converts build/icon.png (>=256x256) to .ico
if (-not (Test-Path $buildIconDir)) { New-Item -ItemType Directory -Path $buildIconDir -Force | Out-Null }
Copy-Item -Path $iconPath -Destination $buildIconPath -Force
Write-Host "windows icon saved: $buildIconPath"