文件
xionggeshop/public/assets/login/generate_login_previews_v2.py
可乐加冰 a8cdc763cb ```
chore(brand): 统一将品牌名从雄戈小酒更改为橙虎小酒

- 更新alisms插件配置中的签名值
- 修改shopro插件中所有SQL脚本的品牌名称引用
- 更新商城配置、商品分类、演示数据中的品牌名称
- 替换后台登录页面的品牌标识
- 更新汇付分账配置中的媒介名称
- 修改登录预览生成脚本中的品牌显示
```
2026-10-28 14:55:54 +08:00

307 行
13 KiB
Python

"""Generate additional admin login preview mockups — schemes D/E/F."""
from pathlib import Path
from PIL import Image, ImageDraw, ImageFont, ImageFilter
import math
ROOT = Path(__file__).resolve().parent
OUT = ROOT / "previews"
OUT.mkdir(exist_ok=True)
W, H = 1440, 900
def load_font(size: int, bold: bool = False):
for path in (
r"C:\Windows\Fonts\msyhbd.ttc" if bold else r"C:\Windows\Fonts\msyh.ttc",
r"C:\Windows\Fonts\simhei.ttf",
):
if Path(path).exists():
return ImageFont.truetype(path, size)
return ImageFont.load_default()
def vertical_gradient(size, top, bottom):
w, h = size
img = Image.new("RGB", size, top)
draw = ImageDraw.Draw(img)
for y in range(h):
t = y / max(h - 1, 1)
r = int(top[0] + (bottom[0] - top[0]) * t)
g = int(top[1] + (bottom[1] - top[1]) * t)
b = int(top[2] + (bottom[2] - top[2]) * t)
draw.line([(0, y), (w, y)], fill=(r, g, b))
return img
def radial_glow(base, cx, cy, r, color, alpha=60):
overlay = Image.new("RGBA", base.size, (0, 0, 0, 0))
draw = ImageDraw.Draw(overlay)
for i in range(r, 0, -6):
a = int(alpha * (i / r) ** 2)
draw.ellipse((cx - i, cy - i, cx + i, cy + i), fill=color + (a,))
return Image.alpha_composite(base.convert("RGBA"), overlay).convert("RGB")
def draw_mesh_bg(img):
"""Soft mesh gradient blobs."""
blobs = [
(300, 200, 280, (22, 119, 255)),
(900, 600, 320, (10, 36, 99)),
(1100, 150, 200, (64, 150, 255)),
(200, 700, 240, (9, 88, 217)),
]
base = Image.new("RGBA", img.size, (245, 247, 250, 255))
for cx, cy, r, rgb in blobs:
layer = Image.new("RGBA", img.size, (0, 0, 0, 0))
d = ImageDraw.Draw(layer)
for i in range(r, 0, -8):
a = int(35 * (i / r) ** 2)
d.ellipse((cx - i, cy - i, cx + i, cy + i), fill=rgb + (a,))
base = Image.alpha_composite(base, layer)
return base.convert("RGB")
def draw_form_card(draw, x, y, w, h, glass=False):
if glass:
draw.rounded_rectangle((x, y, x + w, y + h), radius=20, fill=(255, 255, 255, 230))
draw.rounded_rectangle((x, y, x + w, y + h), radius=20, outline=(255, 255, 255, 180), width=2)
else:
draw.rounded_rectangle((x + 4, y + 6, x + w + 4, y + h + 6), radius=20, fill=(10, 36, 99, 20))
draw.rounded_rectangle((x, y, x + w, y + h), radius=20, fill=(255, 255, 255))
draw.rounded_rectangle((x, y, x + w, y + h), radius=20, outline=(229, 231, 235), width=1)
def draw_form_content(draw, x, y, w, dark=False):
title_c = (255, 255, 255) if dark else (31, 41, 55)
sub_c = (180, 200, 230) if dark else (107, 114, 128)
label_c = (220, 230, 245) if dark else (31, 41, 55)
field_bg = (12, 25, 55) if dark else (250, 251, 252)
field_bd = (60, 80, 120) if dark else (229, 231, 235)
btn_bg = (201, 162, 39) if dark else (22, 119, 255)
btn_txt = (20, 35, 70) if dark else (255, 255, 255)
draw.text((x, y), "欢迎登录", fill=title_c, font=load_font(30, bold=True))
draw.text((x, y + 44), "橙虎小酒商城后台管理系统", fill=sub_c, font=load_font(14))
fy = y + 96
for label in ("用户名", "密码"):
draw.text((x, fy), label, fill=label_c, font=load_font(13, bold=True))
draw.rounded_rectangle((x, fy + 26, x + w, fy + 68), radius=10, fill=field_bg, outline=field_bd)
fy += 92
draw.rounded_rectangle((x, fy + 6, x + 20, fy + 26), radius=4, fill=btn_bg)
draw.text((x + 30, fy + 4), "保持会话", fill=sub_c, font=load_font(13))
draw.rounded_rectangle((x, fy + 42, x + w, fy + 94), radius=10, fill=btn_bg)
draw.text((x + w // 2, fy + 68), "登 录 后 台", fill=btn_txt, font=load_font(16, bold=True), anchor="mm")
def draw_gift_box(draw, cx, cy, scale=1.0):
s = scale
# shadow
draw.ellipse((cx - 70*s, cy + 95*s, cx + 70*s, cy + 115*s), fill=(0, 0, 0, 30))
# box
draw.rounded_rectangle((cx - 55*s, cy - 20*s, cx + 55*s, cy + 90*s), radius=int(8*s), fill=(22, 119, 255))
draw.polygon([
(cx - 50*s, cy - 20*s), (cx + 50*s, cy - 20*s),
(cx + 45*s, cy - 35*s), (cx - 45*s, cy - 35*s)
], fill=(64, 150, 255))
draw.rectangle((cx - 8*s, cy - 35*s, cx + 8*s, cy + 90*s), fill=(201, 162, 39))
draw.ellipse((cx - 18*s, cy - 50*s, cx + 18*s, cy - 28*s), fill=(245, 215, 142))
# bottles inside suggestion
for ox in (-22, 0, 22):
draw.rounded_rectangle((cx + ox*s - 8*s, cy + 10*s, cx + ox*s + 8*s, cy + 65*s), radius=3, fill=(255, 255, 255, 60))
def draw_network_lines(draw, w, h):
points = [(80, 120), (200, 280), (350, 180), (480, 350), (120, 450), (400, 520), (280, 680)]
for i, p1 in enumerate(points):
for p2 in points[i + 1:i + 3]:
draw.line([p1, p2], fill=(22, 119, 255, 40), width=1)
for px, py in points:
draw.ellipse((px - 5, py - 5, px + 5, py + 5), fill=(22, 119, 255))
draw.ellipse((px - 9, py - 9, px + 9, py + 9), outline=(22, 119, 255, 80), width=1)
def scheme_d_minimal_white():
"""D: 极简白底 + 大字号品牌 + 右侧登录"""
img = Image.new("RGB", (W, H), (255, 255, 255))
draw = ImageDraw.Draw(img)
split = int(W * 0.52)
# subtle grid
for x in range(0, split, 40):
draw.line([(x, 0), (x, H)], fill=(243, 244, 246), width=1)
for y in range(0, H, 40):
draw.line([(0, y), (split, y)], fill=(243, 244, 246), width=1)
# left accent bar
draw.rectangle((0, 0, 6, H), fill=(22, 119, 255))
draw.rounded_rectangle((60, 60, 130, 130), radius=35, fill=(10, 36, 99))
draw.text((95, 95), "雄戈", fill=(245, 215, 142), font=load_font(22, bold=True), anchor="mm")
draw.text((60, 160), "橙虎小酒", fill=(10, 36, 99), font=load_font(48, bold=True))
draw.text((60, 230), "一男人的朋友一", fill=(107, 114, 128), font=load_font(18))
draw.text((60, 270), "数字化商城运营平台", fill=(156, 163, 175), font=load_font(15))
# stats row
stats = [("商品管理", "SKU/分类/库存"), ("订单中心", "发货/售后/核销"), ("分销体系", "佣金/团队/等级")]
for i, (t, d) in enumerate(stats):
sy = 360 + i * 90
draw.rounded_rectangle((60, sy, 64, sy + 40), radius=2, fill=(22, 119, 255))
draw.text((80, sy + 4), t, fill=(31, 41, 55), font=load_font(18, bold=True))
draw.text((80, sy + 32), d, fill=(156, 163, 175), font=load_font(13))
# right panel
draw.rectangle((split, 0, W, H), fill=(245, 247, 250))
cw, ch = 400, 480
cx = split + (W - split - cw) // 2
cy = (H - ch) // 2
draw_form_card(draw, cx, cy, cw, ch)
draw_form_content(draw, cx + 40, cy + 40, cw - 80)
draw.rectangle((0, H - 36, W, H), fill=(10, 36, 99))
draw.text((W // 2, H - 18), "方案 D · 极简白底 · 商务专业", fill=(255, 255, 255), font=load_font(14, bold=True), anchor="mm")
return img
def scheme_e_glass_mesh():
"""E: 渐变网格 + 毛玻璃登录卡居中偏右"""
img = draw_mesh_bg(Image.new("RGB", (W, H), (245, 247, 250)))
img = radial_glow(img, W // 2, H // 2, 500, (22, 119, 255), 25)
draw = ImageDraw.Draw(img)
# decorative circles
for cx, cy, r in ((200, 150, 120), (1200, 750, 160), (1000, 200, 80)):
draw.ellipse((cx - r, cy - r, cx + r, cy + r), outline=(22, 119, 255, 60), width=2)
# left brand text
draw.text((80, 120), "橙虎小酒", fill=(10, 36, 99), font=load_font(52, bold=True))
draw.text((80, 195), "商城后台", fill=(22, 119, 255), font=load_font(36, bold=True))
draw.text((80, 260), "安全 · 高效 · 一站式管理", fill=(107, 114, 128), font=load_font(16))
draw_gift_box(draw, 280, 580, 2.0)
# floating glass card
cw, ch = 420, 500
cx = W - cw - 120
cy = (H - ch) // 2
# glass effect layers
for offset, alpha in ((8, 15), (4, 25), (0, 245)):
draw.rounded_rectangle((cx + offset, cy + offset, cx + cw + offset, cy + ch + offset),
radius=24, fill=(255, 255, 255, alpha if alpha < 200 else 255))
draw.rounded_rectangle((cx, cy, cx + cw, cy + ch), radius=24, fill=(255, 255, 255))
draw.rounded_rectangle((cx, cy, cx + cw, cy + ch), radius=24, outline=(255, 255, 255), width=2)
draw_form_content(draw, cx + 40, cy + 44, cw - 80)
draw.rectangle((0, H - 36, W, H), fill=(22, 119, 255))
draw.text((W // 2, H - 18), "方案 E · 渐变网格 · 毛玻璃卡片", fill=(255, 255, 255), font=load_font(14, bold=True), anchor="mm")
return img
def scheme_f_dashboard():
"""F: 左侧数据看板风 + 右侧紧凑登录"""
img = vertical_gradient((W, H), (10, 36, 99), (15, 45, 110))
draw = ImageDraw.Draw(img)
split = int(W * 0.62)
# grid dots
for gx in range(40, split, 32):
for gy in range(40, H, 32):
draw.ellipse((gx - 1, gy - 1, gx + 1, gy + 1), fill=(22, 119, 255, 80))
draw_network_lines(draw, split, H)
draw.text((56, 56), "XIONGGE ADMIN", fill=(64, 150, 255), font=load_font(13))
draw.text((56, 88), "橙虎小酒", fill=(255, 255, 255), font=load_font(44, bold=True))
draw.text((56, 150), "运营数据一目了然", fill=(180, 200, 230), font=load_font(16))
# mini dashboard cards
cards = [
(56, 220, 180, 100, "今日订单", "128", "+12%"),
(260, 220, 180, 100, "待发货", "36", ""),
(56, 340, 180, 100, "分销佣金", "¥8,520", ""),
(260, 340, 180, 100, "区域服务商", "24", ""),
]
for bx, by, bw, bh, title, val, extra in cards:
draw.rounded_rectangle((bx, by, bx + bw, by + bh), radius=12, fill=(255, 255, 255, 12), outline=(64, 150, 255, 60))
draw.text((bx + 16, by + 14), title, fill=(180, 200, 230), font=load_font(12))
draw.text((bx + 16, by + 40), val, fill=(255, 255, 255), font=load_font(26, bold=True))
if extra:
draw.text((bx + bw - 16, by + 48), extra, fill=(64, 200, 120), font=load_font(12), anchor="rm")
# chart bars
draw.rounded_rectangle((56, 480, 384, 680), radius=12, fill=(255, 255, 255, 10), outline=(64, 150, 255, 40))
draw.text((72, 496), "近7日销售趋势", fill=(180, 200, 230), font=load_font(13))
bars = [60, 90, 75, 110, 85, 130, 100]
for i, bh in enumerate(bars):
bx = 90 + i * 38
draw.rounded_rectangle((bx, 640 - bh, bx + 24, 640), radius=4, fill=(22, 119, 255))
# right login
draw.rectangle((split, 0, W, H), fill=(245, 247, 250))
cw, ch = 380, 460
cx = split + (W - split - cw) // 2
cy = (H - ch) // 2
draw_form_card(draw, cx, cy, cw, ch)
draw_form_content(draw, cx + 36, cy + 36, cw - 72)
draw.rectangle((0, H - 36, W, H), fill=(64, 150, 255))
draw.text((W // 2, H - 18), "方案 F · 数据看板风 · 运营感强", fill=(255, 255, 255), font=load_font(14, bold=True), anchor="mm")
return img
def scheme_g_luxury_split():
"""G: 奢品分栏 — 大图感左侧 + 窄登录条"""
img = Image.new("RGB", (W, H), (8, 18, 40))
draw = ImageDraw.Draw(img)
split = int(W * 0.68)
# left luxury panel
left = vertical_gradient((split, H), (8, 18, 40), (10, 36, 99))
img.paste(left, (0, 0))
draw = ImageDraw.Draw(img)
# gold line
draw.rectangle((48, 80, 120, 84), fill=(201, 162, 39))
draw.text((48, 100), "橙虎小酒", fill=(245, 215, 142), font=load_font(56, bold=True))
draw.text((48, 180), "XIONGGE · PREMIUM LIQUOR", fill=(201, 162, 39), font=load_font(14))
draw.text((48, 220), "后台管理系统", fill=(200, 210, 230), font=load_font(22))
# large product silhouette
cx, cy = split // 2 + 40, H // 2 + 40
draw.ellipse((cx - 160, cy - 160, cx + 160, cy + 160), outline=(201, 162, 39, 80), width=2)
draw.ellipse((cx - 120, cy - 120, cx + 120, cy + 120), outline=(201, 162, 39, 40), width=1)
# elegant bottle
draw.rounded_rectangle((cx - 35, cy - 100, cx + 35, cy + 120), radius=12, fill=(22, 119, 255))
draw.rectangle((cx - 28, cy - 120, cx + 28, cy - 100), fill=(9, 88, 217))
draw.rectangle((cx - 20, cy - 138, cx + 20, cy - 120), fill=(201, 162, 39))
draw.ellipse((cx - 50, cy + 120, cx + 50, cy + 140), fill=(0, 0, 0, 80))
# right narrow dark login
draw.rectangle((split, 0, W, H), fill=(12, 22, 48))
cw, ch = 340, 520
cx = split + (W - split - cw) // 2
cy = (H - ch) // 2
draw.rounded_rectangle((cx, cy, cx + cw, cy + ch), radius=16, outline=(201, 162, 39, 100), width=1)
draw_form_content(draw, cx + 32, cy + 48, cw - 64, dark=True)
draw.rectangle((0, H - 36, W, H), fill=(201, 162, 39))
draw.text((W // 2, H - 18), "方案 G · 奢品窄栏 · 金色高端", fill=(8, 18, 40), font=load_font(14, bold=True), anchor="mm")
return img
def main():
schemes = [
("login-preview-D-minimal-white.jpg", scheme_d_minimal_white),
("login-preview-E-glass-mesh.jpg", scheme_e_glass_mesh),
("login-preview-F-dashboard.jpg", scheme_f_dashboard),
("login-preview-G-luxury-split.jpg", scheme_g_luxury_split),
]
for name, fn in schemes:
path = OUT / name
fn().save(path, "JPEG", quality=93)
print(f"saved {path.name}")
if __name__ == "__main__":
main()