YYPOST群发软件 发表于 2026-4-10 08:40:21

苹果脚本TabView金黄色风格例子

苹果脚本TabView金黄色风格例子

// 🍎                                                                                                                           
// 交流QQ群:711841924(群一),苹果内测群:528816639

// 创建现代化TabView
var mainTab = new TabView();

// 设置标题(精简为2个字)
var tabTitles = ["控制", "任务", "设备", "数据", "系统"];
mainTab.setTitles(tabTitles);

// 启动界面
mainTab.show(() => {
    printl("✨ 金黄色风格界面已启动");
   
    // 为每个标签页添加内容
    for (var i = 0; i < tabTitles.length; i++) {
      mainTab.addView(i, buildTabPage(i, tabTitles));
    }
});

// 创建顶部联系信息栏
function createContactBar() {
    var contactBar = new Vertical();
    contactBar.setBackgroundColor(255, 215, 0); // 亮金黄色
    contactBar.setAlignment("center");
   
    var contactText1 = new Label();
    contactText1.setText("&#128241; 交流QQ群:711841924(群一)");
    contactText1.setTextColor(139, 90, 0); // 深金棕色
    contactText1.setFontSize(13);
    contactBar.addView(contactText1);
   
    var contactText2 = new Label();
    contactText2.setText("&#127822; 苹果内测群:528816639");
    contactText2.setTextColor(139, 90, 0); // 深金棕色
    contactText2.setFontSize(13);
    contactBar.addView(contactText2);
   
    return contactBar;
}

// 构建标签页内容
function buildTabPage(index, title) {
    var container = new Vertical();
    container.setBackgroundColor(255, 248, 220); // 暖黄色背景
   
    // 顶部联系信息栏
    var contactBar = createContactBar();
    container.addView(contactBar);
   
    // 顶部导航栏
    var headerBar = createHeaderBar(title);
    container.addView(headerBar);
   
    // 根据索引创建不同内容
    switch(index) {
      case 0:
            container.addView(createConsolePage());
            break;
      case 1:
            container.addView(createTaskCenterPage());
            break;
      case 2:
            container.addView(createDevicePage());
            break;
      case 3:
            container.addView(createDataPage());
            break;
      case 4:
            container.addView(createSystemPage());
            break;
    }
   
    return container;
}

// 创建顶部导航栏
function createHeaderBar(title) {
    var header = new Horizontal();
    header.setBackgroundColor(255, 223, 100); // 金黄色导航栏
    header.setAlignment("center_vertical");
   
    // 标题
    var titleLabel = new Label();
    titleLabel.setText("&#128081; " + title);
    titleLabel.setTextColor(139, 90, 0); // 深金棕色文字
    titleLabel.setFontSize(20);
    header.addView(titleLabel);
   
    // 状态指示器
    var statusIndicator = new Label();
    statusIndicator.setText("● 在线");
    statusIndicator.setTextColor(0, 150, 50); // 深绿色
    statusIndicator.setFontSize(14);
    header.addView(statusIndicator);
   
    return header;
}

// 控制台页面
function createConsolePage() {
    var page = new Vertical();
    page.setBackgroundColor(255, 248, 220);
   
    // 快速操作卡片
    var quickActions = createCardContainer("快速操作");
   
    var actionBtn1 = createActionButton("▶ 执行脚本", 218, 165, 32, () => {
      printl("开始执行脚本...");
      showToast("脚本执行中");
    });
    quickActions.addView(actionBtn1);
   
    var space1 = new Space();
    space1.setHeight(8);
    quickActions.addView(space1);
   
    var actionBtn2 = createActionButton("⏸ 暂停任务", 218, 165, 32, () => {
      printl("任务已暂停");
      showToast("任务暂停");
    });
    quickActions.addView(actionBtn2);
   
    var space2 = new Space();
    space2.setHeight(8);
    quickActions.addView(space2);
   
    var actionBtn3 = createActionButton("⏹ 停止运行", 220, 50, 50, () => {
      printl("停止所有任务");
      showToast("已停止");
    });
    quickActions.addView(actionBtn3);
   
    page.addView(quickActions);
   
    // 实时日志区域
    var logSection = createCardContainer("实时日志");
    var logDisplay = new Label();
    logDisplay.setText("等待操作...\n\n系统就绪 | 时间: " + getCurrentTime());
    logDisplay.setTextColor(120, 80, 20); // 深棕色文字
    logDisplay.setFontSize(14);
    logSection.addView(logDisplay);
    page.addView(logSection);
   
    return page;
}

// 任务中心页面
function createTaskCenterPage() {
    var page = new Vertical();
    page.setBackgroundColor(255, 248, 220);
   
    // 任务统计卡片
    var statsCard = createCardContainer("任务统计");
    var statsLayout = new Horizontal();
   
    var statItem1 = createStatItem("活跃", "12", 218, 165, 32);
    statsLayout.addView(statItem1);
   
    var statItem2 = createStatItem("完成", "156", 0, 180, 50);
    statsLayout.addView(statItem2);
   
    var statItem3 = createStatItem("失败", "3", 220, 50, 50);
    statsLayout.addView(statItem3);
   
    statsCard.addView(statsLayout);
    page.addView(statsCard);
   
    // 任务列表
    var taskList = createCardContainer("任务列表");
   
    addTaskItem(taskList, "每日签到任务", true, "运行中");
    addTaskItem(taskList, "自动刷视频", false, "待执行");
    addTaskItem(taskList, "宝箱收集", true, "运行中");
    addTaskItem(taskList, "广告跳过", false, "已完成");
    addTaskItem(taskList, "数据同步", false, "待执行");
   
    page.addView(taskList);
   
    return page;
}

// 设备管理页面
function createDevicePage() {
    var page = new Vertical();
    page.setBackgroundColor(255, 248, 220);
   
    // 设备信息卡片
    var deviceInfo = createCardContainer("设备信息");
   
    var infoLayout = new Vertical();
   
    var deviceName = createInfoRow("设备名称", "iPhone 14 Pro");
    infoLayout.addView(deviceName);
   
    var systemVer = createInfoRow("系统版本", "iOS 16.5");
    infoLayout.addView(systemVer);
   
    var batteryLevel = createInfoRow("电池电量", "85%");
    infoLayout.addView(batteryLevel);
   
    var networkStatus = createInfoRow("网络状态", "WiFi连接");
    infoLayout.addView(networkStatus);
   
    deviceInfo.addView(infoLayout);
    page.addView(deviceInfo);
   
    // 设备控制按钮
    var controlCard = createCardContainer("设备控制");
   
    var ctrlBtn1 = createActionButton("&#128241; 截屏", 180, 130, 30, () => {
      printl("执行截屏操作");
      showToast("截屏成功");
    });
    controlCard.addView(ctrlBtn1);
   
    var space1 = new Space();
    space1.setHeight(8);
    controlCard.addView(space1);
   
    var ctrlBtn2 = createActionButton("&#128260; 重启应用", 180, 130, 30, () => {
      printl("重启当前应用");
      showToast("应用重启中");
    });
    controlCard.addView(ctrlBtn2);
   
    var space2 = new Space();
    space2.setHeight(8);
    controlCard.addView(space2);
   
    var ctrlBtn3 = createActionButton("&#127968; 返回桌面", 180, 130, 30, () => {
      printl("返回桌面");
      hid.home();
    });
    controlCard.addView(ctrlBtn3);
   
    page.addView(controlCard);
   
    return page;
}

// 数据中心页面
function createDataPage() {
    var page = new Vertical();
    page.setBackgroundColor(255, 248, 220);
   
    // 数据概览
    var overviewCard = createCardContainer("数据概览");
   
    var chartPlaceholder = new Label();
    chartPlaceholder.setText("&#128202; 数据可视化区域\n\n今日执行: 45次\n成功率: 98.5%\n平均耗时: 2.3s");
    chartPlaceholder.setTextColor(120, 80, 20);
    chartPlaceholder.setFontSize(15);
    overviewCard.addView(chartPlaceholder);
   
    page.addView(overviewCard);
   
    // 数据导出选项
    var exportCard = createCardContainer("数据导出");
   
    var exportBtn1 = createActionButton("&#128196; 导出CSV", 200, 150, 40, () => {
      printl("导出CSV文件");
      showToast("CSV导出成功");
    });
    exportCard.addView(exportBtn1);
   
    var space1 = new Space();
    space1.setHeight(8);
    exportCard.addView(space1);
   
    var exportBtn2 = createActionButton("&#128203; 导出JSON", 200, 150, 40, () => {
      printl("导出JSON文件");
      showToast("JSON导出成功");
    });
    exportCard.addView(exportBtn2);
   
    page.addView(exportCard);
   
    return page;
}

// 系统设置页面
function createSystemPage() {
    var page = new Vertical();
    page.setBackgroundColor(255, 248, 220);
   
    // 系统设置卡片
    var settingsCard = createCardContainer("系统设置");
   
    var notifyCheck = createCheckBox("启用推送通知", true);
    settingsCard.addView(notifyCheck);
   
    var soundCheck = createCheckBox("启用操作音效", false);
    settingsCard.addView(soundCheck);
   
    var vibrationCheck = createCheckBox("启用震动反馈", true);
    settingsCard.addView(vibrationCheck);
   
    var autoUpdateCheck = createCheckBox("自动检查更新", true);
    settingsCard.addView(autoUpdateCheck);
   
    page.addView(settingsCard);
   
    // 关于信息
    var aboutCard = createCardContainer("关于");
   
    var versionInfo = new Label();
    versionInfo.setText("版本: v2.5.0\n构建: 20260409\n授权: 专业版");
    versionInfo.setTextColor(120, 80, 20);
    versionInfo.setFontSize(14);
    aboutCard.addView(versionInfo);
   
    page.addView(aboutCard);
   
    var space = new Space();
    space.setHeight(10);
    page.addView(space);
   
    var saveBtn = createActionButton("&#128190; 保存设置", 180, 130, 30, () => {
      printl("设置已保存");
      showToast("设置保存成功");
    });
    page.addView(saveBtn);
   
    return page;
}

// 创建卡片容器
function createCardContainer(title) {
    var card = new Vertical();
    card.setBackgroundColor(255, 250, 230); // 浅米黄色卡片背景
   
    // 卡片标题
    var cardTitle = new Label();
    cardTitle.setText(title);
    cardTitle.setTextColor(139, 90, 0); // 深金棕色
    cardTitle.setFontSize(16);
    card.addView(cardTitle);
   
    // 分隔线
    var divider = new Label();
    divider.setHeight(1);
    divider.setBackgroundColor(230, 200, 150); // 金棕色分隔线
    card.addView(divider);
   
    return card;
}

// 创建操作按钮
function createActionButton(text, r, g, b, clickHandler) {
    var btn = new Button();
    btn.setText(text);
    btn.setColor(r, g, b);
    btn.setTextColor(255, 255, 255);
    btn.setHeight(45);
    btn.onClick(clickHandler);
    return btn;
}

// 创建统计项
function createStatItem(label, value, r, g, b) {
    var item = new Vertical();
    item.setAlignment("center");
   
    var valueLabel = new Label();
    valueLabel.setText(value);
    valueLabel.setTextColor(r, g, b);
    valueLabel.setFontSize(24);
    item.addView(valueLabel);
   
    var labelTag = new Label();
    labelTag.setText(label);
    labelTag.setTextColor(139, 90, 0);
    labelTag.setFontSize(12);
    item.addView(labelTag);
   
    return item;
}

// 添加任务项
function addTaskItem(container, taskName, isActive, status) {
    var taskRow = new Horizontal();
    taskRow.setAlignment("center_vertical");
   
    // 复选框
    var checkBox = new CheckBox();
    checkBox.setText(taskName);
    if (isActive) {
      checkBox.setDefultSelect();
    }
    taskRow.addView(checkBox);
   
    // 状态标签
    var statusLabel = new Label();
    statusLabel.setText(status);
    if (status === "运行中") {
      statusLabel.setTextColor(0, 150, 50);
    } else if (status === "已完成") {
      statusLabel.setTextColor(139, 90, 0);
    } else {
      statusLabel.setTextColor(150, 150, 150);
    }
    statusLabel.setFontSize(12);
    taskRow.addView(statusLabel);
   
    container.addView(taskRow);
}

// 创建信息行
function createInfoRow(label, value) {
    var row = new Horizontal();
   
    // 左侧间距
    var leftSpace = new Space();
    leftSpace.setWidth(8);
    row.addView(leftSpace);
   
    var labelView = new Label();
    labelView.setText(label + ":");
    labelView.setTextColor(139, 90, 0);
    labelView.setFontSize(14);
    labelView.setWidth(100);
    row.addView(labelView);
   
    var valueView = new Label();
    valueView.setText(value);
    valueView.setTextColor(80, 50, 10);
    valueView.setFontSize(14);
    row.addView(valueView);
   
    // 右侧间距
    var rightSpace = new Space();
    rightSpace.setWidth(8);
    row.addView(rightSpace);
   
    return row;
}

// 创建复选框
function createCheckBox(text, defaultChecked) {
    var checkBox = new CheckBox();
    checkBox.setText(text);
    if (defaultChecked) {
      checkBox.setDefultSelect();
    }
    return checkBox;
}

// 获取当前时间
function getCurrentTime() {
    var now = new Date();
    return now.getHours().toString().padStart(2, '0') + ":" +
         now.getMinutes().toString().padStart(2, '0') + ":" +
         now.getSeconds().toString().padStart(2, '0');
}

// 显示提示消息
function showToast(message) {
    printl("&#128172; " + message);
}

// &#127822; 金黄色风格界面特点:
// 1. 金黄色主题配色方案
// 2. 卡片式布局设计
// 3. 现代化的图标和符号
// 4. 清晰的信息层级
// 5. 响应式交互反馈
// 6. 专业的数据展示方式



页: [1]
查看完整版本: 苹果脚本TabView金黄色风格例子