#!/bin/bash # 定义颜色 GREEN='\033[0;32m' BLUE='\033[0;34m' NC='\033[0m' # No Color # 确认函数 confirm() { read -p "$1 (y/n): " choice case "$choice" in y|Y ) return 0;; * ) return 1;; esac } echo -e "${BLUE}爱智农平台页面修复工具${NC}" echo "-----------------------------------" echo "此脚本将批量修复所有页面的UI按钮遮挡问题" echo "-----------------------------------" # 获取未处理的页面 pages_to_process=() for file in pages/*.html; do # 排除已经创建的content页面 if [[ ! $file == *-content.html ]] && [[ ! -f "${file%.*}-content.html" ]] && [[ ! $file == "field-management.html" ]] && [[ ! $file == "device-management.html" ]] && [[ ! $file == "machine-monitor.html" ]] && [[ ! $file == "device-monitor.html" ]]; then pages_to_process+=("$file") fi done # 显示待处理的页面 echo -e "\n${GREEN}找到以下待处理页面:${NC}" for page in "${pages_to_process[@]}"; do echo "- $page" done if confirm "是否继续处理这些页面?"; then for page in "${pages_to_process[@]}"; do base_name=$(basename "$page" .html) content_file="pages/${base_name}-content.html" echo -e "\n${GREEN}处理页面: $page${NC}" # 1. 复制原始文件为content文件 cp "$page" "$content_file" echo "✓ 已创建内容页面: $content_file" # 2. 为内容页面添加必要的CSS和类 sed -i '' 's///' "$content_file" sed -i '' 's/
/
/' "$content_file" sed -i '' 's/
/