|
|
H5ÈÎÎñ½Å±¾Ñ¡ÔñÓëÖ´ÐÐÖÐÐÄ
- //🍎½»Á÷QQȺ711841924Ⱥһ£¬Æ»¹ûÄÚ²âȺ£¬528816639
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <title>AIWROK ÈÎÎñ½Å±¾Ñ¡ÔñÓëÖ´ÐÐÖÐÐÄ</title>
- <style>
- /* »ù´¡ÑùÊ½ÖØÖà */
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- -webkit-tap-highlight-color: transparent;
- }
- body {
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
- background-color: #f5f5f5;
- color: #333;
- line-height: 1.6;
- overflow-x: hidden;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- }
- /* ÊÖ»úÈÝÆ÷ */
- .mobile-container {
- max-width: 414px;
- margin: 0 auto;
- background-color: white;
- min-height: 100vh;
- position: relative;
- overflow: hidden;
- box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
- }
- /* ¶¥²¿µ¼º½À¸ */
- .top-nav {
- display: flex;
- background-color: white;
- border-bottom: 1px solid #f0f0f0;
- padding: 12px 0;
- }
- .top-nav-item {
- flex: 1;
- text-align: center;
- font-size: 16px;
- color: #333;
- text-decoration: none;
- padding: 8px 0;
- }
- .top-nav-item.active {
- color: #2196f3;
- font-weight: 600;
- border-bottom: 2px solid #2196f3;
- }
- /* Ö÷ÒªÄÚÈÝÇøÓò */
- .content {
- padding: 0;
- padding-bottom: 80px;
- }
- /* Ò³ÃæÈÝÆ÷Ñùʽ */
- .page {
- display: none;
- }
- .page.active {
- display: block;
- }
- /* ·µ»Ø°´Å¥ */
- .back-button {
- width: 100%;
- height: 56px;
- background-color: #ff0000;
- color: white;
- border: none;
- border-radius: 0;
- font-size: 18px;
- font-weight: 600;
- cursor: pointer;
- margin-bottom: 0;
- transition: all 0.3s ease;
- transform: scale(1);
- }
- .back-button:active {
- background-color: #cc0000;
- transform: scale(0.95);
- }
- /* Ñ¡ÔñÁбí */
- .select-list {
- margin-bottom: 0;
- padding: 0 16px;
- }
- /* ÏÂÀÑ¡Ôñ¿òÑùʽ */
- .select-item {
- margin-bottom: 12px;
- padding: 12px 16px;
- border-bottom: 1px solid #f0f0f0;
- }
- .select-item:last-child {
- border-bottom: none;
- }
- .select-item select {
- width: 100%;
- height: 40px;
- padding: 8px 12px;
- font-size: 16px;
- color: #333;
- border: 1px solid #ddd;
- border-radius: 4px;
- background-color: #fff;
- cursor: pointer;
- -webkit-appearance: none;
- -moz-appearance: none;
- appearance: none;
- background-image: url('data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%23666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpolyline points="6 9 12 15 18 9"%3E%3C/polyline%3E%3C/svg%3E');
- background-repeat: no-repeat;
- background-position: right 12px center;
- background-size: 14px;
- }
- .select-item select:focus {
- outline: none;
- border-color: #ff0000;
- box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.2);
- }
- /* ¼æÈݾɵĸ´Ñ¡¿òÑùʽ */
- .checkbox-list {
- margin-bottom: 0;
- padding-left: 50px;
- }
- .checkbox-item {
- display: flex;
- align-items: center;
- padding: 12px 16px;
- border-bottom: 1px solid #f0f0f0;
- }
- .checkbox-item:last-child {
- border-bottom: none;
- }
- .checkbox-item input[type="checkbox"] {
- width: 20px;
- height: 20px;
- margin-right: 12px;
- accent-color: #ff0000;
- -webkit-appearance: none;
- -moz-appearance: none;
- appearance: none;
- border: 1px solid #000;
- border-radius: 2px;
- background-color: #fff;
- cursor: pointer;
- position: relative;
- }
- .checkbox-item input[type="checkbox"]:checked {
- background-color: #fff;
- border-color: #000;
- }
- .checkbox-item input[type="checkbox"]:checked::after {
- content: "✓";
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- color: #ff0000;
- font-size: 14px;
- font-weight: bold;
- }
- .checkbox-item label {
- flex: 1;
- font-size: 16px;
- color: #333;
- cursor: pointer;
- }
- /* ÔËÐа´Å¥ */
- .run-button {
- width: 100%;
- height: 56px;
- background-color: #1976d2;
- color: white;
- border: none;
- border-radius: 0;
- font-size: 18px;
- font-weight: 600;
- cursor: pointer;
- transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
- margin-top: 20px;
- position: relative;
- overflow: hidden;
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
- }
- .run-button:hover {
- background-color: #1565c0;
- box-shadow: 0 4px 8px rgba(25, 118, 210, 0.3);
- transform: translateY(-2px);
- }
- .run-button:active {
- background-color: #0d47a1;
- transform: scale(0.98) translateY(0);
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
- }
- .run-button:disabled {
- background-color: #90caf9;
- cursor: not-allowed;
- transform: none;
- box-shadow: none;
- }
- /* ²¨ÎÆÐ§¹û */
- .run-button::before {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- width: 0;
- height: 0;
- border-radius: 50%;
- background-color: rgba(255, 255, 255, 0.5);
- transform: translate(-50%, -50%);
- transition: width 0.6s ease, height 0.6s ease;
- }
- .run-button:active::before {
- width: 300px;
- height: 300px;
- }
- /* ¼ÓÔØ¶¯» */
- @keyframes spin {
- from { transform: rotate(0deg); }
- to { transform: rotate(360deg); }
- }
- .run-button.loading {
- background-color: #1976d2;
- }
- .run-button.loading::after {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- width: 24px;
- height: 24px;
- margin-top: -12px;
- margin-left: -12px;
- border: 2px solid rgba(255, 255, 255, 0.3);
- border-top-color: white;
- border-radius: 50%;
- animation: spin 0.8s linear infinite;
- }
- .run-button.loading span {
- opacity: 0;
- }
- /* ÏìӦʽÉè¼Æ */
- @media (max-width: 375px) {
- .mobile-container {
- max-width: 100%;
- }
- }
- /* ÊÊÅäiOSÉ豸µÄÌØÊâÓÅ»¯ */
- @supports (-webkit-touch-callout: none) {
- /* ÊÊÅäiOSµ×²¿°²È«ÇøÓò */
- .content {
- padding-bottom: calc(80px + env(safe-area-inset-bottom, 0));
- }
- /* ÊÊÅäiOS¶¥²¿°²È«ÇøÓò */
- .status-bar {
- padding-top: env(safe-area-inset-top, 0);
- height: calc(44px + env(safe-area-inset-top, 0));
- }
- }
- </style>
- </head>
- <body>
- <div class="mobile-container">
- <!-- ¶¥²¿µ¼º½À¸ -->
- <div class="top-nav">
- <a href="#" class="top-nav-item active">Ê×Ò³</a>
- <a href="#" class="top-nav-item">µÚ¶þÒ³</a>
- <a href="#" class="top-nav-item">µÚÈýÒ³</a>
- <a href="#" class="top-nav-item">µÚËÄÒ³</a>
- </div>
-
- <!-- ½á¹ûÏÔÊ¾ÇøÓò -->
- <div id="resultDisplay" style="
- background-color: #f5f5f5;
- padding: 10px;
- margin: 0 10px 10px;
- border-radius: 8px;
- font-size: 14px;
- color: #333;
- max-height: 150px;
- overflow-y: auto;
- border: 1px solid #e0e0e0;
- ">
- <div style="font-weight: bold; margin-bottom: 5px;">½»»¥½á¹û£º</div>
- <div id="resultContent">³õʼ»¯Íê³É£¬µÈ´ý½»»¥...</div>
- </div>
-
- <!-- Ö÷ÒªÄÚÈÝÇøÓò -->
- <div class="content">
- <!-- Ê×Ò³ÄÚÈÝ -->
- <div id="page1" class="page active">
- <!-- ·µ»Ø°´Å¥ -->
- <button class="back-button" onclick="handleBackButton()">·µ»Ø</button>
- <!-- ÏÂÀÑ¡Ôñ¿ò -->
- <div class="select-list">
- <div class="select-item">
- <select id="page1-select" onchange="handleSelectChange(this)">
- <option value="">ÇëÑ¡ÔñÒªÖ´ÐеÄÈÎÎñ</option>
- <option value="item1">¶¶Òô¼«ËÙ°æ</option>
- <option value="item2">¿ìÊÖ¼«ËÙ°æ</option>
- <option value="item3">ÆûË®ÒôÀÖ</option>
- <option value="item4">·¬Çѳ©ÌýÒôÀÖ°æ</option>
- <option value="item5">Î÷¹ÏÊÓÆµ</option>
- <option value="item6">·¬Çѳ©Ìý</option>
- <option value="item7">·¬ÇÑС˵</option>
- <option value="item8">Îò¿Õä¯ÀÀÆ÷</option>
- <option value="item9">ºì¹û¶Ì¾ç</option>
- <option value="item10">½ñÈÕÍ·Ìõ</option>
- <option value="item11">½ñÈÕÍ·Ìõ¼«ËÙ°æ</option>
- <option value="item12">ϲ·¬¶Ì¾ç</option>
- <option value="item13">¿ìÊÖÕýʽ°æ</option>
- <option value="item14">Ð¶ÔØAPP</option>
- <option value="item15">²âÊÔ2</option>
- </select>
- </div>
- </div>
- <!-- ÔËÐа´Å¥ -->
- <button class="run-button" onclick="handleRunButton(this)"><span>µã»÷ÔËÐÐ</span></button>
- </div>
- <!-- µÚ¶þÒ³ÄÚÈÝ -->
- <div id="page2" class="page">
- <!-- ·µ»Ø°´Å¥ -->
- <button class="back-button" onclick="handleBackButton()">·µ»Ø</button>
- <!-- ÏÂÀÑ¡Ôñ¿ò -->
- <div class="select-list">
- <div class="select-item">
- <select id="page2-select" onchange="handleSelectChange(this)">
- <option value="">ÇëÑ¡ÔñÒªÖ´ÐеÄÈÎÎñ</option>
- <option value="item21">ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«ËÙ</option>
- <option value="item22">¶¶Òô¼«ËÙÎ÷¹ÏÆûË®</option>
- <option value="item23">ºì¹ûÎò¿Õ·¬Çѳ©ÌýÒôÀÖ</option>
- <option value="item24">·¬ÇÑС˵·¬Çѳ©Ìý</option>
- <option value="item25">¶¶Òô¼«ËÙÎ÷¹ÏÆûË®ÐÂÊÖģʽ</option>
- <option value="item26">ºì¹ûÎò¿Õ·¬Çѳ©ÌýÒôÀÖÐÂÊÖģʽ</option>
- <option value="item27">·¬ÇÑС˵·¬Çѳ©ÌýÐÂÊÖģʽ</option>
- <option value="item28">ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«ËÙÐÂÊÖģʽ</option>
- <option value="item29">ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«ËÙÖÜÆÚ</option>
- <option value="item30">¶¶ÒôϵÖÜÆÚÈÎÎñ</option>
- <option value="item31">¶¶ÒôϵÖÜÆÚÑøºÅ</option>
- </select>
- </div>
- </div>
- <!-- ÔËÐа´Å¥ -->
- <button class="run-button" onclick="handleRunButton(this)"><span>µã»÷ÔËÐÐ</span></button>
- </div>
- <!-- µÚÈýÒ³ÄÚÈÝ -->
- <div id="page3" class="page">
- <!-- ·µ»Ø°´Å¥ -->
- <button class="back-button" onclick="handleBackButton()">·µ»Ø</button>
- <!-- ÏÂÀÑ¡Ôñ¿ò -->
- <div class="select-list">
- <div class="select-item">
- <select id="page3-select" onchange="handleSelectChange(this)">
- <option value="">ÇëÑ¡ÔñÒªÖ´ÐеÄÈÎÎñ</option>
- <option value="item41">¶¶ÒôϵÖÜÆÚÑøºÅ</option>
- <option value="item42">¶¶ÒôϵÖÜÆÚÈÎÎñ</option>
- <option value="item43">ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«ËÙÖÜÆÚ</option>
- <option value="item44">¶¶ÒôϵÐÂÊÖģʽ</option>
- <option value="item45">¿ìÊÖϵÐÂÊÖģʽ</option>
- <option value="item46">·¬ÇÑС˵·¬Çѳ©ÌýÐÂÊÖģʽ</option>
- <option value="item47">ºì¹ûÎò¿Õ·¬Çѳ©ÌýÒôÀÖÐÂÊÖģʽ</option>
- <option value="item48">¶¶Òô¼«ËÙÎ÷¹ÏÆûË®ÐÂÊÖģʽ</option>
- <option value="item49">¿ìÊÖϵÐÂÊÖģʽ</option>
- <option value="item50">·¬ÇÑС˵·¬Çѳ©ÌýÒôÀÖ</option>
- <option value="item51">¶¶Òô¼«ËÙÎ÷¹ÏÆûË®</option>
- <option value="item52">ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«ËÙ</option>
- </select>
- </div>
- </div>
- <!-- ÔËÐа´Å¥ -->
- <button class="run-button" onclick="handleRunButton(this)"><span>µã»÷ÔËÐÐ</span></button>
- </div>
- <!-- µÚËÄÒ³ÄÚÈÝ£¨±¸Óã© -->
- <div id="page4" class="page">
- <!-- ·µ»Ø°´Å¥ -->
- <button class="back-button" onclick="handleBackButton()">·µ»Ø</button>
- <!-- ÏÂÀÑ¡Ôñ¿ò -->
- <div class="select-list">
- <div class="select-item">
- <select id="page4-select" onchange="handleSelectChange(this)">
- <option value="">ÇëÑ¡ÔñÒªÖ´ÐеÄÈÎÎñ</option>
- <option value="item61">±¸ÓÃÈÎÎñ1</option>
- <option value="item62">±¸ÓÃÈÎÎñ2</option>
- <option value="item63">±¸ÓÃÈÎÎñ3</option>
- <option value="item64">±¸ÓÃÈÎÎñ4</option>
- <option value="item65">±¸ÓÃÈÎÎñ5</option>
- <option value="item66">±¸ÓÃÈÎÎñ6</option>
- <option value="item67">±¸ÓÃÈÎÎñ7</option>
- <option value="item68">±¸ÓÃÈÎÎñ8</option>
- <option value="item69">±¸ÓÃÈÎÎñ9</option>
- <option value="item70">±¸ÓÃÈÎÎñ10</option>
- </select>
- </div>
- </div>
- <!-- ÔËÐа´Å¥ -->
- <button class="run-button" onclick="handleRunButton(this)"><span>µã»÷ÔËÐÐ</span></button>
- </div>
- </div>
- </div>
- <script>
- // Ïȶ¨ÒåshowResultº¯Êý£¬È·±£ÔÚwindow.at¶ÔÏó³õʼ»¯Ê±¿ÉÓÃ
- function showResult(result) {
- try {
- var resultContent = document.getElementById('resultContent');
- if (resultContent) {
- var timestamp = new Date().toLocaleTimeString();
- var newResult = '<div style="margin-bottom: 5px; padding-bottom: 5px; border-bottom: 1px dashed #ddd;"><strong>[' + timestamp + ']</strong> ' + result + '</div>';
- resultContent.innerHTML = newResult + resultContent.innerHTML;
-
- // ÏÞÖÆ½á¹ûÏÔʾÊýÁ¿
- var resultItems = resultContent.querySelectorAll('div');
- if (resultItems.length > 10) {
- for (var i = 10; i < resultItems.length; i++) {
- resultItems[i].remove();
- }
- }
- } else {
- console.log('½á¹ûÏÔÊ¾ÇøÓò²»¿ÉÓã¬Ê¹ÓÃconsole.logÊä³ö:', result);
- }
- } catch (e) {
- console.error('µ÷ÓÃshowResultʧ°Ü:', e.message);
- console.log('showResult´íÎóÈÕÖ¾:', result);
- }
- }
-
- // ¶¨Òå¿ÕµÄwebjsº¯Êý£¬±ÜÃâAIWROKÄÚ²¿µ÷ÓÃʱ³öÏÖ"is not a function"´íÎó
- function webjs() {
- console.log('webjsº¯Êý±»µ÷ÓÃ');
- }
-
- // ¶¨ÒåÁÙʱµÄprintlº¯Êý£¬±ÜÃâÒ³Ãæ¼ÓÔØÊ±³öÏÖ"is not defined"´íÎó
- // Ö÷½Å±¾.js¼ÓÔØºó»á×Ô¶¯¸²¸ÇÕâ¸ö¶¨Òå
- function printl(message) {
- try {
- console.log('printlÁÙʱº¯Êý:', message);
- showResult(message);
- } catch (e) {
- console.error('printlÁÙʱº¯Êýµ÷ÓÃʧ°Ü:', e.message);
- }
- }
-
- // AIWROKÔÉú»·¾³½»»¥¶ÔÏó - Ö÷ͨÐŽӿÚ
- window.at = window.at || {};
-
- // ³õʼ»¯window.at¶ÔÏóµÄ¸÷ÖÖ·½·¨£¬È·±£ÓëÔÉúÓ¦ÓõĽ»»¥ÄÜÁ¦
- if (typeof window.at.callFunction === 'undefined') {
- window.at.callFunction = function(functionName, params, callback) {
- console.log('µ÷ÓÃÔÉúº¯Êý:', functionName, params);
- showResult('µ÷ÓÃÔÉúº¯Êý: ' + functionName + '£¬²ÎÊý: ' + JSON.stringify(params));
- if (typeof callback === 'function') {
- callback(JSON.stringify({result: 'Ä£Äâ·µ»Ø½á¹û', functionName: functionName}));
- }
- };
- }
-
- if (typeof window.at.runJs === 'undefined') {
- window.at.runJs = function(jsCode, callback) {
- console.log('ÔËÐÐÔÉúJS´úÂë:', jsCode);
- showResult('ÔËÐÐÔÉúJS´úÂë: ' + jsCode.substring(0, 50) + (jsCode.length > 50 ? '...' : ''));
- if (typeof callback === 'function') {
- callback(JSON.stringify({result: 'JS´úÂëÖ´Ðгɹ¦', jsCode: jsCode}));
- }
- };
- }
-
- if (typeof window.at.setConfig === 'undefined') {
- window.at.setConfig = function(key, value) {
- console.log('ÉèÖÃÅäÖÃ:', key, '=', value);
- showResult('ÉèÖÃÅäÖÃ: ' + key + ' = ' + value);
- try {
- localStorage.setItem(key, value);
- showToast('ÅäÖÃÒÑÉèÖÃ');
- } catch (e) {
- console.warn('localStorage²»¿ÉÓÃ:', e.message);
- if (!window._memoryStorage) {
- window._memoryStorage = {};
- }
- window._memoryStorage[key] = value;
- showToast('ÅäÖÃÒѼǼ');
- }
- };
- }
-
- if (typeof window.at.getConfig === 'undefined') {
- window.at.getConfig = function(key, callback) {
- var value = 'δÉèÖÃ';
- try {
- value = localStorage.getItem(key) || 'δÉèÖÃ';
- } catch (e) {
- console.warn('localStorage²»¿ÉÓÃ:', e.message);
- if (window._memoryStorage && window._memoryStorage[key] !== undefined) {
- value = window._memoryStorage[key];
- }
- }
-
- showResult('»ñÈ¡ÅäÖÃ: ' + key + ' = ' + value);
- if (typeof callback === 'function') {
- callback(value);
- }
- };
- }
-
- if (typeof window.at.publicSet === 'undefined') {
- window.at.publicSet = function(key, value) {
- console.log('ÉèÖù«¹²±äÁ¿:', key, '=', value);
- showResult('ÉèÖù«¹²±äÁ¿: ' + key + ' = ' + value);
- window._publicData = window._publicData || {};
- window._publicData[key] = value;
- showToast('¹«¹²±äÁ¿ÒÑÉèÖÃ');
- };
- }
-
- if (typeof window.at.publicGet === 'undefined') {
- window.at.publicGet = function(key, callback) {
- var value = 'δÉèÖÃ';
- window._publicData = window._publicData || {};
- if (window._publicData[key] !== undefined) {
- value = window._publicData[key];
- }
-
- showResult('»ñÈ¡¹«¹²±äÁ¿: ' + key + ' = ' + value);
- if (typeof callback === 'function') {
- callback(value);
- }
- };
- }
-
- if (typeof window.at.getRootPath === 'undefined') {
- window.at.getRootPath = function(callback) {
- var path = 'Ä£Äâ¸ù·¾¶: /sdcard/AIWROK/';
- showResult('»ñÈ¡¸ù·¾¶: ' + path);
- if (typeof callback === 'function') {
- callback(path);
- }
- };
- }
-
- if (typeof window.at.getResourcesPath === 'undefined') {
- window.at.getResourcesPath = function(callback) {
- var path = 'Ä£Äâ×ÊԴ·¾¶: /sdcard/AIWROK/resources/';
- showResult('»ñÈ¡×ÊԴ·¾¶: ' + path);
- if (typeof callback === 'function') {
- callback(path);
- }
- };
- }
-
- // Ìí¼ÓJsWebViewÀ֧࣬³Önew JsWebView().close()·½Ê½¹Ø±Õ½çÃæ
- if (typeof JsWebView === 'undefined') {
- function JsWebView() {
- // JsWebView¹¹Ô캯Êý
- }
-
- JsWebView.prototype.close = function() {
- console.log('ʹÓÃJsWebView.close()¹Ø±Õ½çÃæ');
- showToast('¹Ø±Õ½çÃæ');
-
- try {
- // µ÷ÓÃÔÉúµÄdismiss·½·¨
- if (window.at && typeof window.at.callFunction === 'function') {
- window.at.callFunction('dismiss', {}, function(result) {
- console.log('¹Ø±Õ½çÃæ½á¹û:', result);
- });
- }
-
- // Ä£Äâ¹Ø±Õ½çÃæµÄÊÓ¾õЧ¹û
- var mobileContainer = document.querySelector('.mobile-container');
- if (mobileContainer) {
- mobileContainer.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
- mobileContainer.style.opacity = '0';
- mobileContainer.style.transform = 'translateY(20px)';
-
- // ¶¯»½áÊøºóÒþ²ØÔªËØ
- setTimeout(function() {
- mobileContainer.style.display = 'none';
- }, 500);
- }
- } catch (e) {
- console.error('µ÷ÓÃJsWebView.close()ʧ°Ü:', e.message);
- }
- };
- }
-
- // Ä£ÄâAIWROKÔÉú»·¾³µÄ½»»¥·½·¨£¨¼æÈݾɴúÂ룩
- // ÔÚʵ¼Ê»·¾³ÖУ¬ÕâЩ·½·¨ÓÉÔÉúÓ¦ÓÃÌṩ
- if (typeof setConfig === 'undefined') {
- function setConfig(key, value) {
- try {
- if (window.at && typeof window.at.setConfig === 'function') {
- // Ïȱ£´æµ½±¾µØ´æ´¢×÷Ϊ±¸·Ý
- try {
- localStorage.setItem(key, value);
- } catch (localStorageError) {
- console.warn('localStorage²»¿ÉÓÃ:', localStorageError.message);
- }
-
- // µ÷ÓÃÔÉú·½·¨²¢´¦Àí¿ÉÄܵÄÒì³£
- try {
- window.at.setConfig(key, value);
- showToast('ÅäÖÃÉèÖóɹ¦');
- } catch (nativeError) {
- console.error('ÔÉúsetConfig·½·¨Ö´ÐÐʧ°Ü:', nativeError.message);
- showToast('ÅäÖÃÒѱ£´æµ½±¾µØ');
- }
- } else {
- console.error('window.at.setConfig ·½·¨²»¿ÉÓã¬Ê¹Óñ¾µØ´æ´¢');
- showToast('ÉèÖÃÅäÖÃ: ' + key + ' = ' + value);
- showResult('ÉèÖÃÅäÖÃ: ' + key + ' = ' + value);
- // ³¢ÊÔʹÓñ¾µØ´æ´¢×÷Ϊ±¸Ñ¡
- try {
- localStorage.setItem(key, value);
- } catch (e) {
- console.warn('localStorage²»¿ÉÓÃ:', e.message);
- }
- }
- } catch (e) {
- console.error('µ÷ÓÃsetConfigʧ°Ü:', e.message);
- showToast('ÅäÖñ£´æ³É¹¦');
- }
- }
- }
-
- if (typeof getConfig === 'undefined') {
- function getConfig(key, callback) {
- try {
- if (window.at && typeof window.at.getConfig === 'function') {
- window.at.getConfig(key, callback);
- } else {
- console.error('window.at.getConfig ·½·¨²»¿ÉÓã¬Ê¹Óñ¾µØ´æ´¢');
- var value = 'δÉèÖÃ';
- // ³¢ÊÔ´Ó±¾µØ´æ´¢»ñÈ¡
- try {
- value = localStorage.getItem(key) || 'δÉèÖÃ';
- } catch (e) {
- console.warn('localStorage²»¿ÉÓÃ:', e.message);
- }
- showResult('»ñÈ¡ÅäÖÃ: ' + key + ' = ' + value);
- if (typeof callback === 'function') {
- callback(value);
- }
- }
- } catch (e) {
- console.error('µ÷ÓÃgetConfigʧ°Ü:', e.message);
- if (typeof callback === 'function') {
- callback('»ñȡʧ°Ü');
- }
- }
- }
- }
- // ÍêÈ«ÒÆ³ýtoastÄ£Ä⣬±ÜÃâÓëÔÉútoast¶ÔÏó³åÍ»
- // ͳһʹÓÃshowToastº¯Êý½øÐÐÌáʾ
-
- if (typeof printl === 'undefined') {
- function printl(message) {
- try {
- console.log('ÔÉúÈÕÖ¾:', message);
- // ³¢ÊÔµ÷ÓÃÔÉúprintlº¯Êý
- if (window.at && typeof window.at.callFunction === 'function') {
- window.at.callFunction('printl', {message: message});
- } else {
- console.error('window.at.callFunction ·½·¨²»¿ÉÓã¬ÎÞ·¨µ÷ÓÃÔÉúprintl');
- }
- // ÔÚH5Ò³ÃæÉÏÏÔʾÈÕÖ¾
- if (typeof showResult === 'function') {
- showResult(message);
- }
- } catch (e) {
- console.error('µ÷ÓÃprintlʧ°Ü:', e.message);
- // È·±£ÈÕÖ¾ÖÁÉÙÔÚ¿ØÖÆÌ¨Êä³ö
- console.log('printl´íÎóÈÕÖ¾:', message);
- }
- }
- }
-
- if (typeof dismiss === 'undefined') {
- function dismiss() {
- console.log('¹Ø±Õ½çÃæ');
- showToast('¹Ø±Õ½çÃæ²Ù×÷');
- window.at.callFunction('dismiss', {}, function(result) {
- console.log('¹Ø±Õ½çÃæ½á¹û:', result);
- });
-
- // Ä£Äâ¹Ø±Õ½çÃæµÄÊÓ¾õЧ¹û
- var mobileContainer = document.querySelector('.mobile-container');
- if (mobileContainer) {
- mobileContainer.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
- mobileContainer.style.opacity = '0';
- mobileContainer.style.transform = 'translateY(20px)';
-
- // ¶¯»½áÊøºóÒþ²ØÔªËØ
- setTimeout(function() {
- mobileContainer.style.display = 'none';
- }, 500);
- }
- }
- }
-
- // Ìí¼ÓrunJSº¯Êý£¬ÓÃÓÚÔËÐÐÔÉúJS´úÂë
- if (typeof runJS === 'undefined') {
- function runJS(func) {
- try {
- // »ñÈ¡ÍêÕûµÄº¯Êý´úÂë×Ö·û´®
- var jsCode = func.toString();
-
- // ÏÔʾִÐÐ״̬
- showToast('ÕýÔÚÖ´Ðнű¾...');
- console.log('Ö´ÐÐJS´úÂë:', jsCode);
-
- if (window.at && typeof window.at.runJs === 'function') {
- // µ÷ÓÃÔÉú·½·¨£¬Óëh5Demo.html±£³ÖÒ»ÖÂ
- window.at.runJs(jsCode);
- showToast('½Å±¾Ö´Ðгɹ¦');
- showResult('ÒÑÖ´ÐÐAPP JS´úÂë');
- } else {
- console.error('window.at.runJs ·½·¨²»¿ÉÓ㬳¢ÊÔÖ±½ÓÖ´ÐÐ');
- // Ö±½ÓÔÚ±¾µØÖ´Ðк¯Êý
- func();
- showToast('½Å±¾±¾µØÖ´Ðгɹ¦');
- showResult('½Å±¾±¾µØÖ´Ðгɹ¦');
- }
- } catch (e) {
- console.error('µ÷ÓÃrunJSʧ°Ü:', e.message);
- console.error('´íÎó¶ÑÕ»:', e.stack);
- showToast('½Å±¾Ö´ÐÐʧ°Ü');
- showResult('½Å±¾Ö´ÐÐʧ°Ü: ' + e.message);
- }
- }
- }
-
- // Ìí¼ÓrunJSFileº¯Êý£¬ÓÃÓÚÔËÐÐÔÉúJSÎļþ
- if (typeof runJSFile === 'undefined') {
- function runJSFile(filePath) {
- try {
- if (window.at && typeof window.at.runJsFile === 'function') {
- window.at.runJsFile(filePath);
- showToast('ÔËÐÐJSÎļþ³É¹¦');
- showResult('ÒÑÖ´ÐÐAPP JSÎļþ: ' + filePath);
- } else {
- console.error('window.at.runJsFile ·½·¨²»¿ÉÓã¬ÎÞ·¨ÔËÐÐJSÎļþ');
- showToast('ÔËÐÐJSÎļþʧ°Ü: ' + filePath);
- showResult('ÔËÐÐJSÎļþʧ°Ü: ' + filePath);
- }
- } catch (e) {
- console.error('µ÷ÓÃrunJSFileʧ°Ü:', e.message);
- showToast('ÔËÐÐJSÎļþʧ°Ü');
- showResult('ÔËÐÐJSÎļþʧ°Ü: ' + e.message);
- }
- }
- }
-
- // Ìí¼ÓcallAppMainº¯Êý£¬ÓÃÓÚµ÷ÓÃÔÉúÓ¦ÓÃÖ÷º¯Êý
- if (typeof callAppMain === 'undefined') {
- function callAppMain(funcName, params, callback) {
- try {
- if (window.at && typeof window.at.callFunction === 'function') {
- // µ÷ÓÃÔÉú·½·¨²¢´¦Àí¿ÉÄܵÄÒì³£
- try {
- window.at.callFunction(funcName, params, callback);
- showToast('µ÷Óóɹ¦');
- } catch (nativeError) {
- console.error('ÔÉúcallFunction·½·¨Ö´ÐÐʧ°Ü:', nativeError.message);
- showToast('¹¦ÄÜÒÑÖ´ÐÐ');
- }
- } else {
- console.error('window.at.callFunction ·½·¨²»¿ÉÓ㬳¢ÊÔ±¾µØ´¦Àí');
- showToast('¹¦ÄÜÒÑÖ´ÐÐ');
- showResult('¹¦ÄÜÒÑÔÚ±¾µØ»·¾³´¦Àí');
- if (typeof callback === 'function') {
- callback(JSON.stringify({result: '¹¦ÄÜÒÑ´¦Àí', message: '±¾µØ»·¾³Ö´ÐÐ'}));
- }
- }
- } catch (e) {
- console.error('µ÷ÓÃcallAppMainʧ°Ü:', e.message);
- showToast('¹¦ÄÜÒÑÖ´ÐÐ');
- if (typeof callback === 'function') {
- callback(JSON.stringify({result: '¹¦ÄÜÒÑ´¦Àí', message: 'ÒѺöÂÔ¼æÈÝÐÔ¾¯¸æ'}));
- }
- }
- }
- }
-
- // Ìí¼ÓrunAppJsº¯Êý£¬ÓÃÓÚÔËÐÐÔÉúJS´úÂë
- if (typeof runAppJs === 'undefined') {
- function runAppJs() {
- try {
- window.at.runJs(function() {
- printl("H5´¥·¢APPÖ´ÐÐJS´úÂë");
- // ÕâÀï¿ÉÒÔÖ´ÐÐÈκÎAPP¶ËµÄJS´úÂë
- }.toString());
- showResult("ÒÑÖ´ÐÐAPP JS´úÂë");
- } catch (e) {
- showResult("Ö´ÐÐAPP JS´úÂëʧ°Ü: " + e);
- }
- }
- }
- // ×Ô¶¨ÒåToastÌáʾ
- function showToast(message) {
- var toast = document.getElementById('custom-toast');
- if (!toast) {
- toast = document.createElement('div');
- toast.id = 'custom-toast';
- toast.style.cssText =
- 'position: fixed;' +
- 'top: 50%;' +
- 'left: 50%;' +
- 'transform: translate(-50%, -50%);' +
- 'background: rgba(0, 0, 0, 0.7);' +
- 'color: white;' +
- 'padding: 12px 24px;' +
- 'border-radius: 8px;' +
- 'font-size: 14px;' +
- 'z-index: 9999;' +
- 'opacity: 0;' +
- 'transition: opacity 0.3s ease, transform 0.3s ease;' +
- 'transform: translate(-50%, -50%) scale(0.9);';
- document.body.appendChild(toast);
- }
-
- if (toast.timer) {
- clearTimeout(toast.timer);
- }
-
- toast.textContent = message;
- toast.style.opacity = '1';
- toast.style.transform = 'translate(-50%, -50%) scale(1)';
-
- toast.timer = setTimeout(function() {
- toast.style.opacity = '0';
- toast.style.transform = 'translate(-50%, -50%) scale(0.9)';
- }, 2000);
- }
-
- // ÏÔʾ½»»¥½á¹ûµÄº¯ÊýÒÑÔÚÒ³Ãæ¶¥²¿¶¨Òå
-
- // ±£´æÓû§²Ù×÷µ½ÅäÖÃ
- function saveUserAction(action, value) {
- var timestamp = new Date().toISOString();
- printl('±£´æÓû§²Ù×÷:' + action + ' ʱ¼ä´Á:' + timestamp);
- setConfig('last_' + action, timestamp);
- if (value) {
- setConfig(action, value);
- }
- }
-
- // Ìí¼Ó°´Å¥µã»÷·´À¡
- function addButtonFeedback() {
- var buttons = document.querySelectorAll('.back-button, .run-button');
- for (var i = 0; i < buttons.length; i++) {
- (function(button) {
- button.addEventListener('mousedown', function() {
- this.style.transform = 'scale(0.95)';
- });
-
- button.addEventListener('mouseup', function() {
- this.style.transform = 'scale(1)';
- });
-
- button.addEventListener('mouseleave', function() {
- this.style.transform = 'scale(1)';
- });
- })(buttons[i]);
- }
- }
- // AIWROK±ê×¼µÄ·µ»Ø°´Å¥µã»÷´¦Àí
- function handleBackButton() {
- printl('·µ»Ø°´Å¥±»µã»÷');
- saveUserAction('back_button_click');
-
-
- // Èç¹ûµ±Ç°ÊǵÚÒ»Ò³£¬¹Ø±Õ½çÃæ
- if (currentPageId === 1) {
- showToast('¹Ø±Õ½çÃæ');
- dismiss();
- } else {
- // ´ÓÀúÊ·¼Ç¼ÖÐÒÆ³ýµ±Ç°Ò³Ãæ
- pageHistory.pop();
- // »ñÈ¡ÉÏÒ»Ò³µÄID
- var previousPageId = pageHistory[pageHistory.length - 1];
-
- // Òþ²ØËùÓÐÒ³Ãæ
- var pages = document.querySelectorAll('.page');
- for (var i = 0; i < pages.length; i++) {
- pages[i].classList.remove('active');
- }
-
- // ÏÔʾÉÏÒ»Ò³
- var previousPage = document.getElementById('page' + previousPageId);
- if (previousPage) {
- previousPage.classList.add('active');
- }
-
- // ¸üе¼º½À¸×´Ì¬
- var navItems = document.querySelectorAll('.top-nav-item');
- for (var j = 0; j < navItems.length; j++) {
- navItems[j].classList.remove('active');
- }
- navItems[previousPageId - 1].classList.add('active');
-
- // ¸üе±Ç°Ò³ÃæID
- currentPageId = previousPageId;
-
- showToast('·µ»ØÉÏÒ»Ò³');
- printl('·µ»Øµ½Ò³Ãæ: ' + previousPageId);
- }
- }
- // AIWROK±ê×¼µÄÔËÐа´Å¥µã»÷´¦Àí
- function handleRunButton(button) {
- // Èç¹û°´Å¥ÒѾ´¦ÓÚ¼ÓÔØ×´Ì¬£¬²»Ö´ÐÐÈκβÙ×÷
- if (button.classList.contains('loading')) {
- return;
- }
-
- printl('ÔËÐа´Å¥±»µã»÷');
- saveUserAction('run_button_click');
-
- // Ìí¼Ó¼ÓÔØ×´Ì¬
- button.classList.add('loading');
- button.disabled = true;
-
- showToast('¿ªÊ¼Ö´ÐÐÈÎÎñ');
-
-
- // ¸ù¾Ýµ±Ç°Ò³ÃæÖ´ÐжÔÓ¦µÄ½Å±¾
- var selectedItems = [];
-
- // »ñÈ¡µ±Ç°Ò³ÃæµÄÏÂÀÑ¡Ôñ¿ò
- var currentPage = document.getElementById('page' + currentPageId);
- var selectBox = currentPage.querySelector('select');
-
- // ¼ì²éÊÇ·ñÓÐÑ¡ÖеÄÖµ
- if (selectBox && selectBox.value) {
- var itemId = selectBox.value;
- var label = selectBox.options[selectBox.selectedIndex].text;
-
- printl('Ö´Ðнű¾: ' + label);
- selectedItems.push(label);
-
- // ¸ù¾Ý²»Í¬Ò³ÃæºÍÑ¡ÔñÏîÖ´Ðв»Í¬µÄº¯Êý
- if (currentPageId === 1) {
- // µÚÒ»Ò³½Å±¾
- switch (itemId) {
- case 'item1': runJS(function() { ¶¶Òô¼«ËÙ(); }); break;
- case 'item2': runJS(function() { ¿ìÊÖ¼«ËÙ(); }); break;
- case 'item3': runJS(function() { ÆûË®ÒôÀÖ(); }); break;
- case 'item4': runJS(function() { ·¬Çѳ©ÌýÒôÀÖ(); }); break;
- case 'item5': runJS(function() { Î÷¹ÏÊÓÆµ(); }); break;
- case 'item6': runJS(function() { ·¬Çѳ©Ìý(); }); break;
- case 'item7': runJS(function() { ·¬ÇÑС˵(); }); break;
- case 'item8': runJS(function() { Îò¿Õä¯ÀÀÆ÷(); }); break;
- case 'item9': runJS(function() { ºì¹û¶Ì¾ç(); }); break;
- case 'item10': runJS(function() { Í·Ìõ¹ã¸æµ¥°æ(); }); break;
- case 'item11': runJS(function() { Í·Ìõ¼«ËÙ¹ã¸æµ¥°æ(); }); break;
- case 'item12': runJS(function() { ϲ·¬¶Ì¾ç(); }); break;
- case 'item13': runJS(function() { ¿ìÊÖÕýʽ(); }); break;
- case 'item14': runJS(function() { Æ»¹ûɾ³ýAPP(); }); break;
- case 'item15': runJS(function() { ²âÊÔº¯Êý2(); printl('²âÊÔ2½Å±¾ÒÑÆô¶¯'); }); break;
- }
- } else if (currentPageId === 2) {
- // µÚ¶þÒ³½Å±¾
- switch (itemId) {
- case 'item21': runJS(function() { ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«ËÙ(); printl('ϲ·¬¼«ËÙ¿ìÊÖÕýʽ¿ìÊÖ»ìÅܽű¾ÒÑÆô¶¯'); }); break;
- case 'item22': runJS(function() { ¶¶Òô¼«ËÙÎ÷¹ÏÆûË®(); printl('¼«ËÙ¶¶Òô»ìÅܽű¾ÒÑÆô¶¯'); }); break;
- case 'item23': runJS(function() { ºì¹ûÎò¿Õ·¬Çѳ©ÌýÒôÀÖ(); printl('ºì¹û»ìÅܽű¾ÒÑÆô¶¯'); }); break;
- case 'item24': runJS(function() { ·¬ÇÑС˵·¬Çѳ©Ìý(); printl('·¬ÇÑС˵»ìÅܽű¾ÒÑÆô¶¯'); }); break;
- case 'item25': runJS(function() { ¶¶Òô¼«ËÙÎ÷¹ÏÆûË®ÐÂÊÖ(); printl('Î÷¹ÏÊÓÆµ½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item26': runJS(function() { ºì¹ûÎò¿Õ·¬Çѳ©ÌýÒôÀÖÐÂÊÖ(); printl('·¬Çѳ©Ìý½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item27': runJS(function() { ·¬ÇÑС˵·¬Çѳ©ÌýÐÂÊÖ(); printl('·¬ÇÑС˵½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item28': runJS(function() { ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«ËÙÐÂÊÖģʽ(); printl('ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«ËÙÐÂÊÖģʽÒÑÆô¶¯'); }); break;
- case 'item29': runJS(function() { ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«ËÙÖÜÆÚ(); }); break;
- case 'item30': runJS(function() { ¶¶ÒôϵÖÜÆÚ×öÈÎÎñ(); }); break;
- case 'item31': runJS(function() { ¶¶ÒôϵÖÜÆÚÑøºÅ(); }); break;
- }
- } else if (currentPageId === 3) {
- // µÚÈýÒ³½Å±¾
- switch (itemId) {
- case 'item41': runJS(function() { ¶¶ÒôϵÖÜÆÚÑøºÅ(); printl('¶¶ÒôϵÖÜÆÚÑøºÅ½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item42': runJS(function() { ¶¶ÒôϵÖÜÆÚ×öÈÎÎñ(); printl('¶¶ÒôϵÖÜÆÚÈÎÎñ½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item43': runJS(function() { ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«ËÙÖÜÆÚ(); printl('ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«ËÙÖÜÆÚ½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item44': runJS(function() { ¶¶ÒôϵÐÂÊÖģʽ(); printl('¶¶ÒôϵÐÂÊÖģʽ½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item45': runJS(function() { ¿ìÊÖϵÐÂÊÖģʽ(); printl('¿ìÊÖϵÐÂÊÖģʽ½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item46': runJS(function() { ·¬ÇÑС˵·¬Çѳ©ÌýÐÂÊÖ(); printl('·¬ÇÑС˵·¬Çѳ©ÌýÐÂÊÖģʽ½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item47': runJS(function() { ºì¹ûÎò¿Õ·¬Çѳ©ÌýÒôÀÖÐÂÊÖ(); printl('ºì¹ûÎò¿Õ·¬Çѳ©ÌýÒôÀÖÐÂÊÖģʽ½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item48': runJS(function() { ¶¶Òô¼«ËÙÎ÷¹ÏÆûË®ÐÂÊÖ(); printl('¶¶Òô¼«ËÙÎ÷¹ÏÆûË®ÐÂÊÖģʽ½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item49': runJS(function() { ¿ìÊÖϵÐÂÊÖģʽ(); printl('¿ìÊÖϵÐÂÊÖģʽ½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item50': runJS(function() { ·¬ÇÑС˵·¬Çѳ©Ìý(); printl('·¬ÇÑС˵·¬Çѳ©ÌýÒôÀֽű¾ÒÑÆô¶¯'); }); break;
- case 'item51': runJS(function() { ¶¶Òô¼«ËÙÎ÷¹ÏÆûË®(); printl('¶¶Òô¼«ËÙÎ÷¹ÏÆûË®½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item52': runJS(function() { ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«ËÙ(); printl('ϲ·¬¿ìÊÖÕýʽ¿ìÊÖ¼«Ëٽű¾ÒÑÆô¶¯'); }); break;
- }
- } else if (currentPageId === 4) {
- // µÚËÄÒ³±¸Óýű¾
- switch (itemId) {
- case 'item61': runJS(function() { ±¸ÓÃÈÎÎñ1(); printl('±¸ÓÃÈÎÎñ1½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item62': runJS(function() { ±¸ÓÃÈÎÎñ2(); printl('±¸ÓÃÈÎÎñ2½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item63': runJS(function() { ±¸ÓÃÈÎÎñ3(); printl('±¸ÓÃÈÎÎñ3½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item64': runJS(function() { ±¸ÓÃÈÎÎñ4(); printl('±¸ÓÃÈÎÎñ4½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item65': runJS(function() { ±¸ÓÃÈÎÎñ5(); printl('±¸ÓÃÈÎÎñ5½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item66': runJS(function() { ±¸ÓÃÈÎÎñ6(); printl('±¸ÓÃÈÎÎñ6½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item67': runJS(function() { ±¸ÓÃÈÎÎñ7(); printl('±¸ÓÃÈÎÎñ7½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item68': runJS(function() { ±¸ÓÃÈÎÎñ8(); printl('±¸ÓÃÈÎÎñ8½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item69': runJS(function() { ±¸ÓÃÈÎÎñ9(); printl('±¸ÓÃÈÎÎñ9½Å±¾ÒÑÆô¶¯'); }); break;
- case 'item70': runJS(function() { ±¸ÓÃÈÎÎñ10(); printl('±¸ÓÃÈÎÎñ10½Å±¾ÒÑÆô¶¯'); }); break;
- }
- }
- }
-
- // Èç¹ûûÓÐÑ¡ÖÐÈκÎÈÎÎñ
- if (selectedItems.length === 0) {
- showToast('ÇëÏÈÑ¡ÔñÒªÖ´ÐеÄÈÎÎñ');
- }
-
- // Ä£ÄâÈÎÎñÖ´Ðйý³Ì
- setTimeout(function() {
- // ÒÆ³ý¼ÓÔØ×´Ì¬
- button.classList.remove('loading');
- button.disabled = false;
-
- // ÏÔʾִÐÐÍê³ÉÌáʾ
- if (selectedItems.length > 0) {
- showToast('ÈÎÎñÖ´ÐÐÍê³É');
-
- // Ìí¼Ó·µ»Ø×ÀÃæ¹¦ÄÜ£¬µ«±£³ÖH5½çÃæ´ò¿ªÒÔ¼ÌÐøÔËÐнű¾
- try {
- window.at.runJs(function() {
- printl("H5´¥·¢APP·µ»Ø×ÀÃæ");
- auto.home(); // ·µ»Ø×ÀÃæ
- }.toString());
- showResult("ÒÑ´¥·¢APP·µ»Ø×ÀÃæ");
- } catch (e) {
- showResult("·µ»Ø×ÀÃæÊ§°Ü: " + e);
- }
- }
- }, 2000);
- }
- // Ò³ÃæÀúÊ·¼Ç¼£¬ÓÃÓÚʵÏÖ·µ»Ø¹¦ÄÜ
- var pageHistory = [1]; // ³õÊ¼Ò³ÃæÊǵÚÒ»Ò³
- var currentPageId = 1;
- // AIWROK±ê×¼µÄÑ¡Ôñ¿ò±ä»¯´¦Àí
- function handleSelectChange(select) {
- var selectedValue = select.value;
- var selectedText = select.options[select.selectedIndex].text;
-
- if (selectedValue) {
- printl('Ñ¡ÖÐ: ' + selectedText);
- saveUserAction('select_' + select.id, selectedValue);
- } else {
- printl('δѡÔñÈκÎÈÎÎñ');
- saveUserAction('select_' + select.id, '');
- }
- }
- // ±£³Ö¼æÈݾɵĸ´Ñ¡¿ò±ä»¯´¦Àíº¯Êý
- function handleCheckboxChange(checkbox) {
- try {
- var label = checkbox.nextElementSibling;
- if (checkbox.checked) {
- label.style.color = '#d32f2f';
- label.style.fontWeight = '600';
- printl('Ñ¡ÖÐ: ' + label.textContent);
- saveUserAction('checkbox_' + checkbox.id, 'checked');
- } else {
- label.style.color = '#333';
- label.style.fontWeight = 'normal';
- printl('È¡ÏûÑ¡ÖÐ: ' + label.textContent);
- saveUserAction('checkbox_' + checkbox.id, 'unchecked');
- }
- } catch (e) {
- console.error('handleCheckboxChange´íÎó:', e.message);
- }
- }
- // Ò³ÃæÇл»º¯Êý
- function switchPage(pageId) {
- // Èç¹ûÊǵ±Ç°Ò³Ã棬²»½øÐÐÇл»
- if (currentPageId === pageId) {
- return;
- }
- // Òþ²ØËùÓÐÒ³Ãæ
- var pages = document.querySelectorAll('.page');
- for (var i = 0; i < pages.length; i++) {
- pages[i].classList.remove('active');
- }
- // ÏÔʾѡÖеÄÒ³Ãæ
- var selectedPage = document.getElementById('page' + pageId);
- if (selectedPage) {
- selectedPage.classList.add('active');
- }
- // ¸üе¼º½À¸×´Ì¬
- var navItems = document.querySelectorAll('.top-nav-item');
- for (var j = 0; j < navItems.length; j++) {
- navItems[j].classList.remove('active');
- }
- navItems[pageId - 1].classList.add('active');
- // ¼ÇÂ¼Ò³ÃæÀúÊ·
- pageHistory.push(pageId);
- currentPageId = pageId;
- printl('Çл»µ½Ò³Ãæ: ' + pageId);
- }
- // Ò³Ãæ¼ÓÔØÍê³Éºó³õʼ»¯
- window.onload = function() {
- printl('Ò³Ãæ¼ÓÔØÍê³É');
-
- // Ö´ÐÐAPP JSÎļþ£¬Óëh5Demo.html±£³ÖÒ»ÖÂ
- if (window.at && typeof window.at.runJsFile === 'function') {
- window.at.runJsFile("Ö÷½Å±¾.js");
- printl('ÒÑÖ´ÐÐAPP JSÎļþ: Ö÷½Å±¾.js');
- } else {
- printl('runJsFile·½·¨²»¿ÉÓ㬳¢ÊÔʹÓÃscript±êÇ©¼ÓÔØ');
- // ʹÓÃscript±êÇ©¼ÓÔØÖ÷½Å±¾
- var scriptTag = document.createElement('script');
- scriptTag.src = 'Ö÷½Å±¾.js';
- scriptTag.onload = function() {
- printl('Ö÷½Å±¾.jsÒÑͨ¹ýscript±êÇ©¼ÓÔØÍê³É');
- };
- scriptTag.onerror = function() {
- printl('Ö÷½Å±¾.js¼ÓÔØÊ§°Ü');
- };
- document.body.appendChild(scriptTag);
- }
-
- // Ϊµ¼º½À¸Ìí¼Óµã»÷ʼþ
- var navItems = document.querySelectorAll('.top-nav-item');
- for (var i = 0; i < navItems.length; i++) {
- (function(index) {
- navItems[index].addEventListener('click', function(e) {
- e.preventDefault();
- switchPage(index + 1);
- });
- })(i);
- }
-
- // Ìí¼Ó°´Å¥µã»÷·´À¡
- addButtonFeedback();
-
- printl('³õʼ»¯Íê³É£¬ËùÓн»»¥¹¦ÄÜÒѾÍÐ÷');
- };
- </script>
- </body>
- </html>
-
¸´ÖÆ´úÂë
|
|