B2B网络软件

标题: IOS苹果脚本View的完整功能实例 [打印本页]

作者: YYPOST群发软件    时间: 2 小时前
标题: IOS苹果脚本View的完整功能实例
IOS苹果脚本View的完整功能实例
IOS苹果脚本View的完整功能实例 B2B网络软件

IOS苹果脚本View的完整功能实例 B2B网络软件
  1. // 🍎交流QQ群711841924群一,苹果内测群,528816639
  2. // 📱IOSView综合应用示例 - 智能助手控制台
  3. // 基于AIWROK开发平台,展示IOSView的完整功能

  4. printl("=== 智能助手控制台启动中 ===");

  5. // 创建主TabView
  6. var mainTab = new TabView();

  7. // 设置Tab标题
  8. var tabTitles = ["控制中心", "任务管理", "数据监控", "系统设置"];
  9. mainTab.setTitles(tabTitles);

  10. // 显示TabView
  11. mainTab.show(() => {
  12.     printl("✅ 智能助手控制台已加载");
  13.    
  14.     // 添加各个Tab页面的内容
  15.     mainTab.addView(0, createControlCenter());
  16.     mainTab.addView(1, createTaskManager());
  17.     mainTab.addView(2, createDataMonitor());
  18.     mainTab.addView(3, createSystemSettings());
  19.    
  20.     printl("✅ 所有页面初始化完成");
  21. });

  22. printl("✅ 智能助手控制台启动成功");

  23. // ====================== 第一页:控制中心 ======================
  24. function createControlCenter() {
  25.     var v = new Vertical();
  26.     v.setBackgroundColor(245, 247, 250);
  27.     v.setSpacing(15);
  28.    
  29.     // 页面标题
  30.     var header = new Horizontal();
  31.     header.setAlignment("center");
  32.    
  33.     var title = new Label();
  34.     title.setText("⚡ 智能控制中心");
  35.     title.setTextColor(41, 128, 185);
  36.     title.setFontSize(22);
  37.     header.addView(title);
  38.    
  39.     v.addView(header);
  40.    
  41.     // 分隔线
  42.     var divider = new Label();
  43.     divider.setHeight(2);
  44.     divider.setBackgroundColor(200, 200, 200);
  45.     v.addView(divider);
  46.    
  47.     // 快捷操作区域
  48.     var quickActions = new Vertical();
  49.     quickActions.setBackgroundColor(255, 255, 255);
  50.    
  51.     var quickTitle = new Label();
  52.     quickTitle.setText("快捷操作");
  53.     quickTitle.setTextColor(80, 80, 80);
  54.     quickTitle.setFontSize(16);
  55.     quickActions.addView(quickTitle);
  56.    
  57.     // 按钮网格
  58.     var buttonGrid = new Horizontal();
  59.     buttonGrid.setSpacing(10);
  60.    
  61.     var btn1 = createQuickButton("🚀 启动", 46, 204, 113, () => {
  62.         printl("🚀 启动按钮被点击");
  63.         showToast("正在启动服务...");
  64.     });
  65.     buttonGrid.addView(btn1);
  66.    
  67.     var btn2 = createQuickButton("⏸️ 暂停", 241, 196, 15, () => {
  68.         printl("⏸️ 暂停按钮被点击");
  69.         showToast("服务已暂停");
  70.     });
  71.     buttonGrid.addView(btn2);
  72.    
  73.     var btn3 = createQuickButton("🔄 重启", 52, 152, 219, () => {
  74.         printl("🔄 重启按钮被点击");
  75.         showToast("正在重启服务...");
  76.     });
  77.     buttonGrid.addView(btn3);
  78.    
  79.     var btn4 = createQuickButton("⏹️ 停止", 231, 76, 60, () => {
  80.         printl("⏹️ 停止按钮被点击");
  81.         showToast("服务已停止");
  82.     });
  83.     buttonGrid.addView(btn4);
  84.    
  85.     quickActions.addView(buttonGrid);
  86.     v.addView(quickActions);
  87.    
  88.     // 功能开关区域
  89.     var featureSwitches = new Vertical();
  90.     featureSwitches.setBackgroundColor(255, 255, 255);
  91.    
  92.     var switchTitle = new Label();
  93.     switchTitle.setText("功能开关");
  94.     switchTitle.setTextColor(80, 80, 80);
  95.     switchTitle.setFontSize(16);
  96.     featureSwitches.addView(switchTitle);
  97.    
  98.     var switch1 = new CheckBox();
  99.     switch1.setText("启用自动化脚本");
  100.     switch1.setID("auto_script");
  101.     switch1.setDefultSelect();
  102.     featureSwitches.addView(switch1);
  103.    
  104.     var switch2 = new CheckBox();
  105.     switch2.setText("启用日志记录");
  106.     switch2.setID("log_record");
  107.     switch2.setDefultSelect();
  108.     featureSwitches.addView(switch2);
  109.    
  110.     var switch3 = new CheckBox();
  111.     switch3.setText("启用通知提醒");
  112.     switch3.setID("notification");
  113.     featureSwitches.addView(switch3);
  114.    
  115.     var switch4 = new CheckBox();
  116.     switch4.setText("启用定时任务");
  117.     switch4.setID("scheduled_task");
  118.     featureSwitches.addView(switch4);
  119.    
  120.     v.addView(featureSwitches);
  121.    
  122.     // 执行按钮
  123.     var executeBtn = new Button();
  124.     executeBtn.setText("执行选中操作");
  125.     executeBtn.setColor(41, 128, 185);
  126.     executeBtn.setTextColor(255, 255, 255);
  127.     executeBtn.setHeight(45);
  128.     executeBtn.onClick(() => {
  129.         var autoScript = switch1.isSelect();
  130.         var logRecord = switch2.isSelect();
  131.         var notification = switch3.isSelect();
  132.         var scheduledTask = switch4.isSelect();
  133.         
  134.         printl("执行配置:");
  135.         printl("  自动化脚本: " + autoScript);
  136.         printl("  日志记录: " + logRecord);
  137.         printl("  通知提醒: " + notification);
  138.         printl("  定时任务: " + scheduledTask);
  139.         
  140.         showToast("配置已应用");
  141.     });
  142.     v.addView(executeBtn);
  143.    
  144.     // 返回按钮
  145.     var backBtn = new Button();
  146.     backBtn.setText("返回");
  147.     backBtn.setColor(149, 165, 166);
  148.     backBtn.setTextColor(255, 255, 255);
  149.     backBtn.setHeight(40);
  150.     backBtn.onClick(() => {
  151.         printl("返回按钮被点击");
  152.         mainTab.dismiss();
  153.     });
  154.     v.addView(backBtn);
  155.    
  156.     return v;
  157. }

  158. // ====================== 第二页:任务管理 ======================
  159. function createTaskManager() {
  160.     var v = new Vertical();
  161.     v.setBackgroundColor(245, 247, 250);
  162.     v.setSpacing(15);
  163.    
  164.     // 页面标题
  165.     var header = new Horizontal();
  166.     header.setAlignment("center");
  167.    
  168.     var title = new Label();
  169.     title.setText("📋 任务管理中心");
  170.     title.setTextColor(41, 128, 185);
  171.     title.setFontSize(22);
  172.     header.addView(title);
  173.    
  174.     v.addView(header);
  175.    
  176.     // 分隔线
  177.     var divider = new Label();
  178.     divider.setHeight(2);
  179.     divider.setBackgroundColor(200, 200, 200);
  180.     v.addView(divider);
  181.    
  182.     // 任务输入区域
  183.     var inputContainer = new Horizontal();
  184.     inputContainer.setAlignment("center_vertical");
  185.    
  186.     var inputLabel = new Label();
  187.     inputLabel.setText("新任务:");
  188.     inputLabel.setWidth(70);
  189.     inputContainer.addView(inputLabel);
  190.    
  191.     var taskInput = new Input();
  192.     taskInput.setWidth(200);
  193.     taskInput.setID("task_input");
  194.     taskInput.setDefultText("输入任务名称...");
  195.     inputContainer.addView(taskInput);
  196.    
  197.     v.addView(inputContainer);
  198.    
  199.     // 优先级选择
  200.     var priorityContainer = new Horizontal();
  201.     priorityContainer.setAlignment("center_vertical");
  202.    
  203.     var priorityLabel = new Label();
  204.     priorityLabel.setText("优先级:");
  205.     priorityLabel.setWidth(70);
  206.     priorityContainer.addView(priorityLabel);
  207.    
  208.     var priorityGroup = new RadioButtonGroup();
  209.     priorityGroup.setID("task_priority");
  210.     priorityGroup.setDefultSelect("中");
  211.    
  212.     var highPriority = new RadioButton();
  213.     highPriority.setText("高");
  214.     highPriority.setGroup(priorityGroup);
  215.    
  216.     var mediumPriority = new RadioButton();
  217.     mediumPriority.setText("中");
  218.     mediumPriority.setGroup(priorityGroup);
  219.    
  220.     var lowPriority = new RadioButton();
  221.     lowPriority.setText("低");
  222.     lowPriority.setGroup(priorityGroup);
  223.    
  224.     priorityContainer.addView(highPriority);
  225.     priorityContainer.addView(mediumPriority);
  226.     priorityContainer.addView(lowPriority);
  227.    
  228.     v.addView(priorityContainer);
  229.    
  230.     // 添加任务按钮
  231.     var addBtn = new Button();
  232.     addBtn.setText("➕ 添加任务");
  233.     addBtn.setColor(46, 204, 113);
  234.     addBtn.setTextColor(255, 255, 255);
  235.     addBtn.setHeight(40);
  236.     addBtn.onClick(() => {
  237.         var taskName = taskInput.getText();
  238.         var selectedRadio = priorityGroup.currentSelectedRadio();
  239.         var priority = selectedRadio ? selectedRadio.getText() : "";
  240.         
  241.         if (taskName && taskName.length > 0) {
  242.             printl("添加任务: " + taskName + ", 优先级: " + priority);
  243.             showToast("任务已添加: " + taskName);
  244.             taskInput.setText("");
  245.         } else {
  246.             showToast("请输入任务名称");
  247.         }
  248.     });
  249.     v.addView(addBtn);
  250.    
  251.     // 任务列表
  252.     var taskList = new Vertical();
  253.     taskList.setBackgroundColor(255, 255, 255);
  254.    
  255.     var listTitle = new Label();
  256.     listTitle.setText("任务列表");
  257.     listTitle.setTextColor(80, 80, 80);
  258.     listTitle.setFontSize(16);
  259.     taskList.addView(listTitle);
  260.    
  261.     // 添加示例任务
  262.     addTaskItem(taskList, "执行自动化脚本", "高");
  263.     addTaskItem(taskList, "检查系统状态", "中");
  264.     addTaskItem(taskList, "清理缓存数据", "低");
  265.     addTaskItem(taskList, "更新配置文件", "中");
  266.     addTaskItem(taskList, "生成日志报告", "低");
  267.    
  268.     v.addView(taskList);
  269.    
  270.     // 批量操作按钮
  271.     var batchContainer = new Horizontal();
  272.     batchContainer.setSpacing(10);
  273.    
  274.     var completeAllBtn = new Button();
  275.     completeAllBtn.setText("全部完成");
  276.     completeAllBtn.setColor(46, 204, 113);
  277.     completeAllBtn.setTextColor(255, 255, 255);
  278.     completeAllBtn.setWidth(100);
  279.     completeAllBtn.setHeight(40);
  280.     completeAllBtn.onClick(() => {
  281.         printl("所有任务标记为完成");
  282.         showToast("所有任务已完成");
  283.     });
  284.     batchContainer.addView(completeAllBtn);
  285.    
  286.     var clearCompletedBtn = new Button();
  287.     clearCompletedBtn.setText("清除已完成");
  288.     clearCompletedBtn.setColor(241, 196, 15);
  289.     clearCompletedBtn.setTextColor(50, 50, 50);
  290.     clearCompletedBtn.setWidth(120);
  291.     clearCompletedBtn.setHeight(40);
  292.     clearCompletedBtn.onClick(() => {
  293.         printl("清除已完成任务");
  294.         showToast("已完成任务已清除");
  295.     });
  296.     batchContainer.addView(clearCompletedBtn);
  297.    
  298.     v.addView(batchContainer);
  299.    
  300.     // 返回按钮
  301.     var backBtn = new Button();
  302.     backBtn.setText("返回");
  303.     backBtn.setColor(149, 165, 166);
  304.     backBtn.setTextColor(255, 255, 255);
  305.     backBtn.setHeight(40);
  306.     backBtn.onClick(() => {
  307.         printl("返回按钮被点击");
  308.         mainTab.dismiss();
  309.     });
  310.     v.addView(backBtn);
  311.    
  312.     return v;
  313. }

  314. // ====================== 第三页:数据监控 ======================
  315. function createDataMonitor() {
  316.     var v = new Vertical();
  317.     v.setBackgroundColor(245, 247, 250);
  318.     v.setSpacing(15);
  319.    
  320.     // 页面标题
  321.     var header = new Horizontal();
  322.     header.setAlignment("center");
  323.    
  324.     var title = new Label();
  325.     title.setText("📊 数据监控中心");
  326.     title.setTextColor(41, 128, 185);
  327.     title.setFontSize(22);
  328.     header.addView(title);
  329.    
  330.     v.addView(header);
  331.    
  332.     // 分隔线
  333.     var divider = new Label();
  334.     divider.setHeight(2);
  335.     divider.setBackgroundColor(200, 200, 200);
  336.     v.addView(divider);
  337.    
  338.     // 实时数据统计
  339.     var statsContainer = new Vertical();
  340.     statsContainer.setBackgroundColor(255, 255, 255);
  341.    
  342.     var statsTitle = new Label();
  343.     statsTitle.setText("实时数据");
  344.     statsTitle.setTextColor(80, 80, 80);
  345.     statsTitle.setFontSize(16);
  346.     statsContainer.addView(statsTitle);
  347.    
  348.     // 数据项
  349.     addStatItem(statsContainer, "运行时间", "2小时35分钟", 52, 152, 219);
  350.     addStatItem(statsContainer, "执行任务数", "128", 46, 204, 113);
  351.     addStatItem(statsContainer, "成功率", "98.5%", 155, 89, 182);
  352.     addStatItem(statsContainer, "内存使用", "256MB", 241, 196, 15);
  353.     addStatItem(statsContainer, "CPU占用", "12%", 231, 76, 60);
  354.    
  355.     v.addView(statsContainer);
  356.    
  357.     // 分类统计
  358.     var categoryContainer = new Vertical();
  359.     categoryContainer.setBackgroundColor(255, 255, 255);
  360.    
  361.     var categoryTitle = new Label();
  362.     categoryTitle.setText("分类统计");
  363.     categoryTitle.setTextColor(80, 80, 80);
  364.     categoryTitle.setFontSize(16);
  365.     categoryContainer.addView(categoryTitle);
  366.    
  367.     addStatItem(categoryContainer, "自动化任务", "45", 52, 152, 219);
  368.     addStatItem(categoryContainer, "数据处理", "32", 46, 204, 113);
  369.     addStatItem(categoryContainer, "网络请求", "28", 155, 89, 182);
  370.     addStatItem(categoryContainer, "文件操作", "23", 241, 196, 15);
  371.    
  372.     v.addView(categoryContainer);
  373.    
  374.     // 刷新按钮
  375.     var refreshBtn = new Button();
  376.     refreshBtn.setText("🔄 刷新数据");
  377.     refreshBtn.setColor(52, 152, 219);
  378.     refreshBtn.setTextColor(255, 255, 255);
  379.     refreshBtn.setHeight(45);
  380.     refreshBtn.onClick(() => {
  381.         printl("数据已刷新");
  382.         showToast("数据已更新");
  383.     });
  384.     v.addView(refreshBtn);
  385.    
  386.     // 导出按钮
  387.     var exportBtn = new Button();
  388.     exportBtn.setText("📥 导出报告");
  389.     exportBtn.setColor(155, 89, 182);
  390.     exportBtn.setTextColor(255, 255, 255);
  391.     exportBtn.setHeight(45);
  392.     exportBtn.onClick(() => {
  393.         printl("导出数据报告");
  394.         showToast("报告已导出");
  395.     });
  396.     v.addView(exportBtn);
  397.    
  398.     // 返回按钮
  399.     var backBtn = new Button();
  400.     backBtn.setText("返回");
  401.     backBtn.setColor(149, 165, 166);
  402.     backBtn.setTextColor(255, 255, 255);
  403.     backBtn.setHeight(40);
  404.     backBtn.onClick(() => {
  405.         printl("返回按钮被点击");
  406.         mainTab.dismiss();
  407.     });
  408.     v.addView(backBtn);
  409.    
  410.     return v;
  411. }

  412. // ====================== 第四页:系统设置 ======================
  413. function createSystemSettings() {
  414.     var v = new Vertical();
  415.     v.setBackgroundColor(245, 247, 250);
  416.     v.setSpacing(15);
  417.    
  418.     // 页面标题
  419.     var header = new Horizontal();
  420.     header.setAlignment("center");
  421.    
  422.     var title = new Label();
  423.     title.setText("⚙️ 系统设置");
  424.     title.setTextColor(41, 128, 185);
  425.     title.setFontSize(22);
  426.     header.addView(title);
  427.    
  428.     v.addView(header);
  429.    
  430.     // 分隔线
  431.     var divider = new Label();
  432.     divider.setHeight(2);
  433.     divider.setBackgroundColor(200, 200, 200);
  434.     v.addView(divider);
  435.    
  436.     // 基本设置
  437.     var basicSettings = new Vertical();
  438.     basicSettings.setBackgroundColor(255, 255, 255);
  439.    
  440.     var basicTitle = new Label();
  441.     basicTitle.setText("基本设置");
  442.     basicTitle.setTextColor(80, 80, 80);
  443.     basicTitle.setFontSize(16);
  444.     basicSettings.addView(basicTitle);
  445.    
  446.     var autoSaveCheck = new CheckBox();
  447.     autoSaveCheck.setText("自动保存配置");
  448.     autoSaveCheck.setID("auto_save");
  449.     autoSaveCheck.setDefultSelect();
  450.     basicSettings.addView(autoSaveCheck);
  451.    
  452.     var autoStartCheck = new CheckBox();
  453.     autoStartCheck.setText("开机自动启动");
  454.     autoStartCheck.setID("auto_start");
  455.     basicSettings.addView(autoStartCheck);
  456.    
  457.     var debugModeCheck = new CheckBox();
  458.     debugModeCheck.setText("调试模式");
  459.     debugModeCheck.setID("debug_mode");
  460.     basicSettings.addView(debugModeCheck);
  461.    
  462.     v.addView(basicSettings);
  463.    
  464.     // 通知设置
  465.     var notificationSettings = new Vertical();
  466.     notificationSettings.setBackgroundColor(255, 255, 255);
  467.    
  468.     var notifTitle = new Label();
  469.     notifTitle.setText("通知设置");
  470.     notifTitle.setTextColor(80, 80, 80);
  471.     notifTitle.setFontSize(16);
  472.     notificationSettings.addView(notifTitle);
  473.    
  474.     var soundCheck = new CheckBox();
  475.     soundCheck.setText("启用声音提示");
  476.     soundCheck.setID("sound_enable");
  477.     soundCheck.setDefultSelect();
  478.     notificationSettings.addView(soundCheck);
  479.    
  480.     var vibrationCheck = new CheckBox();
  481.     vibrationCheck.setText("启用震动反馈");
  482.     vibrationCheck.setID("vibration_enable");
  483.     vibrationCheck.setDefultSelect();
  484.     notificationSettings.addView(vibrationCheck);
  485.    
  486.     var popupCheck = new CheckBox();
  487.     popupCheck.setText("显示弹窗通知");
  488.     popupCheck.setID("popup_enable");
  489.     popupCheck.setDefultSelect();
  490.     notificationSettings.addView(popupCheck);
  491.    
  492.     v.addView(notificationSettings);
  493.    
  494.     // 主题设置
  495.     var themeContainer = new Horizontal();
  496.     themeContainer.setAlignment("center");
  497.     themeContainer.setSpacing(15);
  498.    
  499.     var themeLabel = new Label();
  500.     themeLabel.setText("主题颜色:");
  501.     themeLabel.setTextColor(80, 80, 80);
  502.     themeContainer.addView(themeLabel);
  503.    
  504.     var lightThemeBtn = new Button();
  505.     lightThemeBtn.setText("浅色");
  506.     lightThemeBtn.setColor(255, 255, 255);
  507.     lightThemeBtn.setTextColor(50, 50, 50);
  508.     lightThemeBtn.setWidth(80);
  509.     lightThemeBtn.setHeight(40);
  510.     lightThemeBtn.onClick(() => {
  511.         printl("切换到浅色主题");
  512.         showToast("已切换到浅色主题");
  513.     });
  514.     themeContainer.addView(lightThemeBtn);
  515.    
  516.     var darkThemeBtn = new Button();
  517.     darkThemeBtn.setText("深色");
  518.     darkThemeBtn.setColor(50, 50, 50);
  519.     darkThemeBtn.setTextColor(255, 255, 255);
  520.     darkThemeBtn.setWidth(80);
  521.     darkThemeBtn.setHeight(40);
  522.     darkThemeBtn.onClick(() => {
  523.         printl("切换到深色主题");
  524.         showToast("已切换到深色主题");
  525.     });
  526.     themeContainer.addView(darkThemeBtn);
  527.    
  528.     v.addView(themeContainer);
  529.    
  530.     // 数据管理
  531.     var dataContainer = new Vertical();
  532.    
  533.     var backupBtn = new Button();
  534.     backupBtn.setText("💾 备份数据");
  535.     backupBtn.setColor(52, 152, 219);
  536.     backupBtn.setTextColor(255, 255, 255);
  537.     backupBtn.setHeight(40);
  538.     backupBtn.onClick(() => {
  539.         printl("备份数据中...");
  540.         showToast("数据备份中...");
  541.     });
  542.     dataContainer.addView(backupBtn);
  543.    
  544.     var restoreBtn = new Button();
  545.     restoreBtn.setText("📂 恢复数据");
  546.     restoreBtn.setColor(155, 89, 182);
  547.     restoreBtn.setTextColor(255, 255, 255);
  548.     restoreBtn.setHeight(40);
  549.     restoreBtn.onClick(() => {
  550.         printl("恢复数据中...");
  551.         showToast("数据恢复中...");
  552.     });
  553.     dataContainer.addView(restoreBtn);
  554.    
  555.     var clearDataBtn = new Button();
  556.     clearDataBtn.setText("🗑️ 清除数据");
  557.     clearDataBtn.setColor(231, 76, 60);
  558.     clearDataBtn.setTextColor(255, 255, 255);
  559.     clearDataBtn.setHeight(40);
  560.     clearDataBtn.onClick(() => {
  561.         printl("清除所有数据");
  562.         showToast("数据已清除");
  563.     });
  564.     dataContainer.addView(clearDataBtn);
  565.    
  566.     v.addView(dataContainer);
  567.    
  568.     // 保存设置按钮
  569.     var saveBtn = new Button();
  570.     saveBtn.setText("💾 保存设置");
  571.     saveBtn.setColor(46, 204, 113);
  572.     saveBtn.setTextColor(255, 255, 255);
  573.     saveBtn.setHeight(45);
  574.     saveBtn.onClick(() => {
  575.         printl("设置已保存");
  576.         showToast("设置已保存");
  577.     });
  578.     v.addView(saveBtn);
  579.    
  580.     // 返回按钮
  581.     var backBtn = new Button();
  582.     backBtn.setText("返回");
  583.     backBtn.setColor(149, 165, 166);
  584.     backBtn.setTextColor(255, 255, 255);
  585.     backBtn.setHeight(40);
  586.     backBtn.onClick(() => {
  587.         printl("返回按钮被点击");
  588.         mainTab.dismiss();
  589.     });
  590.     v.addView(backBtn);
  591.    
  592.     // 关于信息
  593.     var aboutLabel = new Label();
  594.     aboutLabel.setText("智能助手控制台 v1.0\n基于AIWROK开发平台");
  595.     aboutLabel.setTextColor(120, 120, 120);
  596.     aboutLabel.setFontSize(12);
  597.     aboutLabel.setTextAlignment("center");
  598.     v.addView(aboutLabel);
  599.    
  600.     return v;
  601. }

  602. // ====================== 辅助函数 ======================

  603. // 创建快捷按钮
  604. function createQuickButton(text, r, g, b, onClick) {
  605.     var btn = new Button();
  606.     btn.setText(text);
  607.     btn.setColor(r, g, b);
  608.     btn.setTextColor(255, 255, 255);
  609.     btn.setWidth(80);
  610.     btn.setHeight(50);
  611.     btn.onClick(onClick);
  612.     return btn;
  613. }

  614. // 添加任务项
  615. function addTaskItem(container, taskName, priority) {
  616.     var item = new Horizontal();
  617.     item.setAlignment("center_vertical");
  618.    
  619.     var checkBox = new CheckBox();
  620.     checkBox.setText(taskName);
  621.     checkBox.setWidth(180);
  622.     item.addView(checkBox);
  623.    
  624.     var priorityLabel = new Label();
  625.     priorityLabel.setText(priority);
  626.     priorityLabel.setWidth(50);
  627.    
  628.     if (priority === "高") {
  629.         priorityLabel.setTextColor(231, 76, 60);
  630.     } else if (priority === "中") {
  631.         priorityLabel.setTextColor(241, 196, 15);
  632.     } else {
  633.         priorityLabel.setTextColor(46, 204, 113);
  634.     }
  635.    
  636.     item.addView(priorityLabel);
  637.    
  638.     var deleteBtn = new Button();
  639.     deleteBtn.setText("删除");
  640.     deleteBtn.setColor(231, 76, 60);
  641.     deleteBtn.setTextColor(255, 255, 255);
  642.     deleteBtn.setWidth(60);
  643.     deleteBtn.setHeight(30);
  644.     deleteBtn.onClick(() => {
  645.         printl("删除任务: " + taskName);
  646.         showToast("任务已删除");
  647.     });
  648.     item.addView(deleteBtn);
  649.    
  650.     container.addView(item);
  651. }

  652. // 添加统计项
  653. function addStatItem(container, label, value, r, g, b) {
  654.     var item = new Horizontal();
  655.     item.setAlignment("space_between");
  656.     item.setSpacing(10);
  657.    
  658.     var labelView = new Label();
  659.     labelView.setText(label);
  660.     labelView.setTextColor(80, 80, 80);
  661.     labelView.setWidth(120);
  662.     item.addView(labelView);
  663.    
  664.     var valueView = new Label();
  665.     valueView.setText(value);
  666.     valueView.setTextColor(r, g, b);
  667.     valueView.setTextAlignment("right");
  668.     item.addView(valueView);
  669.    
  670.     container.addView(item);
  671. }

  672. // 显示提示信息
  673. function showToast(message) {
  674.     printl("提示: " + message);
  675. }

  676. // 日志输出函数
  677. function printl(message) {
  678.     console.log("[智能助手] " + message);
  679. }
复制代码








欢迎光临 B2B网络软件 (http://bbs.niubt.cn/) Powered by Discuz! X3.2