|
|
Æ»¹û½Å±¾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[i]));
- }
- });
- // ´´½¨¶¥²¿ÁªÏµÐÅÏ¢À¸
- function createContactBar() {
- var contactBar = new Vertical();
- contactBar.setBackgroundColor(255, 215, 0); // ÁÁ½ð»ÆÉ«
- contactBar.setAlignment("center");
-
- var contactText1 = new Label();
- contactText1.setText("📱 ½»Á÷QQȺ£º711841924£¨ÈºÒ»£©");
- contactText1.setTextColor(139, 90, 0); // Éî½ðרɫ
- contactText1.setFontSize(13);
- contactBar.addView(contactText1);
-
- var contactText2 = new Label();
- contactText2.setText("🍎 Æ»¹ûÄÚ²âȺ£º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("👑 " + 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("📱 ½ØÆÁ", 180, 130, 30, () => {
- printl("Ö´ÐÐ½ØÆÁ²Ù×÷");
- showToast("½ØÆÁ³É¹¦");
- });
- controlCard.addView(ctrlBtn1);
-
- var space1 = new Space();
- space1.setHeight(8);
- controlCard.addView(space1);
-
- var ctrlBtn2 = createActionButton("🔄 ÖØÆôÓ¦ÓÃ", 180, 130, 30, () => {
- printl("ÖØÆôµ±Ç°Ó¦ÓÃ");
- showToast("Ó¦ÓÃÖØÆôÖÐ");
- });
- controlCard.addView(ctrlBtn2);
-
- var space2 = new Space();
- space2.setHeight(8);
- controlCard.addView(space2);
-
- var ctrlBtn3 = createActionButton("🏠 ·µ»Ø×ÀÃæ", 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("📊 Êý¾Ý¿ÉÊÓ»¯ÇøÓò\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("📄 µ¼³öCSV", 200, 150, 40, () => {
- printl("µ¼³öCSVÎļþ");
- showToast("CSVµ¼³ö³É¹¦");
- });
- exportCard.addView(exportBtn1);
-
- var space1 = new Space();
- space1.setHeight(8);
- exportCard.addView(space1);
-
- var exportBtn2 = createActionButton("📋 µ¼³ö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("💾 ±£´æÉèÖÃ", 180, 130, 30, () => {
- printl("ÉèÖÃÒѱ£´æ");
- showToast("ÉèÖñ£´æ³É¹¦");
- });
- page.addView(saveBtn);
-
- return page;
- }
- // ´´½¨¿¨Æ¬ÈÝÆ÷
- function createCardContainer(title) {
- var card = new Vertical();
- card.setBackgroundColor(255, 250, 230); // dzÃ×»ÆÉ«¿¨Æ¬±³¾°
-
- // ¿¨Æ¬±êÌâ
- 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("💬 " + message);
- }
- // 🍎 ½ð»ÆÉ«·ç¸ñ½çÃæÌØµã£º
- // 1. ½ð»ÆÉ«Ö÷ÌâÅäÉ«·½°¸
- // 2. ¿¨Æ¬Ê½²¼¾ÖÉè¼Æ
- // 3. ÏÖ´ú»¯µÄͼ±êºÍ·ûºÅ
- // 4. ÇåÎúµÄÐÅÏ¢²ã¼¶
- // 5. ÏìӦʽ½»»¥·´À¡
- // 6. רҵµÄÊý¾Ýչʾ·½Ê½
¸´ÖÆ´úÂë
|
|