first commit
This commit is contained in:
55
frontend/sgClaw验证/download-libs.sh
Executable file
55
frontend/sgClaw验证/download-libs.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
# ============================================================
|
||||
# 下载前端依赖到本地 — 适用于无外网环境
|
||||
#
|
||||
# 用法: ./download-libs.sh
|
||||
#
|
||||
# 下载后将 index.html 中的 CDN 链接替换为 ./lib/ 本地路径:
|
||||
# 1. 注释掉 unpkg.com 的 3 行
|
||||
# 2. 取消注释 ./lib/ 的 3 行
|
||||
# ============================================================
|
||||
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
LIB_DIR="$DIR/lib"
|
||||
|
||||
mkdir -p "$LIB_DIR"
|
||||
|
||||
echo "[1/3] 下载 Vue 2.6.14 ..."
|
||||
curl -sL "https://unpkg.com/vue@2.6.14/dist/vue.min.js" -o "$LIB_DIR/vue.min.js"
|
||||
echo " -> lib/vue.min.js ($(du -h "$LIB_DIR/vue.min.js" | cut -f1))"
|
||||
|
||||
echo "[2/3] 下载 Element UI 2.15.14 JS ..."
|
||||
curl -sL "https://unpkg.com/element-ui@2.15.14/lib/index.js" -o "$LIB_DIR/element-ui.js"
|
||||
echo " -> lib/element-ui.js ($(du -h "$LIB_DIR/element-ui.js" | cut -f1))"
|
||||
|
||||
echo "[3/3] 下载 Element UI 2.15.14 CSS ..."
|
||||
curl -sL "https://unpkg.com/element-ui@2.15.14/lib/theme-chalk/index.css" -o "$LIB_DIR/element-ui.css"
|
||||
echo " -> lib/element-ui.css ($(du -h "$LIB_DIR/element-ui.css" | cut -f1))"
|
||||
|
||||
# 下载字体 (Element UI 图标需要)
|
||||
echo ""
|
||||
echo "[附加] 下载 Element UI 字体文件 ..."
|
||||
mkdir -p "$LIB_DIR/fonts"
|
||||
FONT_BASE="https://unpkg.com/element-ui@2.15.14/lib/theme-chalk/fonts"
|
||||
for f in element-icons.woff element-icons.ttf; do
|
||||
curl -sL "$FONT_BASE/$f" -o "$LIB_DIR/fonts/$f"
|
||||
echo " -> lib/fonts/$f"
|
||||
done
|
||||
|
||||
# 修正 CSS 中字体路径 (element-ui.css 默认引用 ./fonts/)
|
||||
# 本地部署时 fonts 已在 lib/fonts/ 下,CSS 也在 lib/ 下,路径正确
|
||||
|
||||
echo ""
|
||||
echo "========================================"
|
||||
echo " 下载完成!文件列表:"
|
||||
echo "========================================"
|
||||
ls -lh "$LIB_DIR/"
|
||||
echo ""
|
||||
ls -lh "$LIB_DIR/fonts/" 2>/dev/null || true
|
||||
echo ""
|
||||
echo "接下来请编辑 index.html:"
|
||||
echo " 1. 注释掉 unpkg.com 的 CDN 引用"
|
||||
echo " 2. 取消注释 ./lib/ 的本地引用"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user