原生webview的h5如何跟aiwork交互
<span style="color: rgb(52, 58, 64); font-family: "Microsoft Yahei", 微软雅黑, Tahoma, Arial, Helvetica, STHeiti; font-size: 24px; font-weight: 700; text-align: center;">原生webview的h5如何跟aiwork交互</span><div><div style="text-align: center;"><div class="blockcode" style="overflow: hidden; padding-right: 0px; padding-bottom: 5px; padding-left: 10px; background-image: linear-gradient(90deg, rgb(237, 237, 237), rgb(237, 237, 237)); background-size: 43px; color: rgb(102, 102, 102); zoom: 1;"><blockquote><!DOCTYPE html><br><html lang="en"><br><br><head><br><meta charset="UTF-8"><br><title>合并页面</title><br><meta name="viewport" content="width=device-width, initial-scale=1.0"><br><style><br>body {<br>background-color: #fff; /* 改为白色 */<br>color: #333; /* 调整文字颜色以匹配白色背景 */<br>font-family: Arial, sans-serif;<br>padding: 20px;<br>}<br><br>.navbar {<br>background-color: #f0f0f0; /* 改为浅色以与白色背景区分 */<br>padding: 10px;<br>display: flex;<br>justify-content: space-around;<br>color: #000;<br>}<br><br>.navbar a {<br>text-decoration: none;<br>color: inherit;<br>font-weight: bold;<br>}<br><br>.section, .submenu {<br>background-color: #fff; /* 改为白色 */<br>color: #333; /* 调整文字颜色 */<br>padding: 20px;<br>margin-bottom: 20px;<br>border-radius: 10px;<br>box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);<br>}<br><br>.section input,<br>.submenu input,<br>input,<br>input,<br>select,<br>button {<br>color: #333; /* 调整文字颜色 */<br>background-color: #ddd; /* 改为浅色 */<br>border: none;<br>border-radius: 5px;<br>padding: 10px;<br>margin-right: 10px;<br>box-sizing: border-box;<br>}<br><br>button {<br>background-color: #4CAF50;<br>width: 60%;<br>font-size: 20px;<br>cursor: pointer;<br>margin-top: 20px;<br>color: #fff; /* 按钮文字颜色 */<br>}<br><br>h1 {<br>color: #e91e63;<br>}<br></style><br></head><br><br><body><br><div class="navbar"><br><a href="#">首页</a><br><a href="#">话术</a><br><a href="#">选择平台</a><br><a href="#">配置</a><br><a href="#">其他</a><br></div><br><br><h1>合并页面</h1><br><br><div class="section"><br><h2>超级延迟</h2><br><input type="checkbox" id="charDelay" name="charDelay"><br><label for="charDelay">按打字数量延迟</label><br><!-- 省略其他选项... --><br></div><br><br><div class="submenu"><br><h2>招呼设置</h2><br><input type="checkbox" id="fixed-greeting" name="fixed-greeting"><br><label for="fixed-greeting">钉定招呼语---勾选生效</label><br><input type="text" placeholder="请输入招呼1"><br><input type="text" placeholder="请输入招呼2"><br><input type="text" placeholder="请输入招呼3"><br></div><br><br><!-- 省略其他部分... --><br><br><form><br><div class="section"><br><h2>定时</h2><br><input type="checkbox" id="enableTiming" name="enableTiming"><br><label for="enableTiming">开启定时</label><br><br><!-- 省略其他选项... --><br></div><br><br><button type="button" onClick="callHelloAI();">调用原生方法</button><br><button type="button" onClick="runJS();">执行脚本代码</button><br><button type="button" onClick="runJsFile();">执行脚本文件</button><br><button type="button" onClick="sendText();">传递控件值</button><br></form><br><br><script language="JavaScript"><br>function callHelloAI() {<br>window.at.callFun('main', 'hello');<br>}<br><br>function runJS() {<br>window.at.runJs(function () {<br>printl("你好");<br>auto.recents();<br>}.toString());<br>}<br><br>function runJsFile() {<br>window.at.runJsFile('主脚本.js');<br>}<br><br>function sendText() {<br>var inputValue = document.getElementById('input1').value;<br>window.at.runJsFile('测试传值.js');<br>}<br></script><br><br></body><br><br></html><br></blockquote></div><br></div><div><div style="text-align: center;"><font color="#343a40" face="Microsoft Yahei, 微软雅黑, Tahoma, Arial, Helvetica, STHeiti"><span style="font-size: 24px;"><b><br></b></span></font></div><div style="text-align: center;"><font color="#343a40" face="Microsoft Yahei, 微软雅黑, Tahoma, Arial, Helvetica, STHeiti"><span style="font-size: 24px;"><b><br></b></span></font></div><p></p><div><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><br></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><ignore_js_op></ignore_js_op></p><p></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><ignore_js_op></ignore_js_op></p><br><p></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><br></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><br></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><a href="http://doc.aiwork24.com:91/server/index.php?s=/api/attachment/visitFile/sign/2d81618b702515969f00d51a5f341f49" title="[原生activity和h5交互案例.zip" style="color: rgb(65, 131, 196); text-decoration-line: none; transition: color 0.08s ease-out 0s; box-sizing: border-box; background: 0px 0px;">原生activity和h5交互案例.zip</a></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><br></p><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><br style="box-sizing: border-box;"><span style="box-sizing: border-box; font-weight: 700;">void runJs(function code)h5执行app JS脚本</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.runJs(<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">function</span> (<span class="hljs-params" style="box-sizing: border-box;"></span>)</span>{<span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//这里写ATjs代码</span>
printl(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"你好"</span>);
auto.home();
}.toString());
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">void runJsFile(String file) H5运行APP JS文件</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.runJsFile(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'主脚本.js'</span>);
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">void callFunction(String funname,String arg) H5执行脚本方法</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.callFun(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'main'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"hello"</span>);
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">String getRootPath() 获取项目根目录</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.getRootPath();
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">String getResourcesPath() 获取项目资源目录</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.getResourcesPath();
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">void setConfig(String path,String arg,String value) 存储数据</span><br style="box-sizing: border-box;">path:存储路径,例如/sdcard/1.txt;<br style="box-sizing: border-box;">arg:参数<br style="box-sizing: border-box;">value:存储值</p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.setConfig(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'/sdcard/1.txt'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1'</span>);
<span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//例如存储到资源目录</span>
<span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">let</span> res=<span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.getResourcesPath();
<span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.setConfig(res+<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1.txt'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1'</span>);
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">String getConfig(String path,String arg,String value) 读取数据</span><br style="box-sizing: border-box;">path:存储路径,例如/sdcard/1.txt;<br style="box-sizing: border-box;">arg:参数<br style="box-sizing: border-box;">value:默认值,没有数据的情况下默认返回</p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.getConfig(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'/sdcard/1.txt'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1'</span>);
<span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//从资源目录取数据</span>
<span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">let</span> res=<span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.getResourcesPath();
<span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.getConfig(res+<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1.txt'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1'</span>);
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">publicSet(String key,String value) 公共变量传参</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.publicSet(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1'</span>);
<span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//对应aiwork取值就是</span>
publicData.get(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>)
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">publicGet(String key) 公共变量读参</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.publicGet(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>);
<span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//对应aiwork写值就是</span>
publicData.set(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'a'</span>,<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'1'</span>)
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;">完整HTML案例</p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-html hljs xml" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-meta" style="box-sizing: border-box; color: rgb(97, 174, 238);"><!DOCTYPE <span class="hljs-meta-keyword" style="box-sizing: border-box;">html</span>></span>
<span class="hljs-tag" style="box-sizing: border-box;"><<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">html</span> <span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">lang</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"en"</span>></span>
<span class="hljs-tag" style="box-sizing: border-box;"><<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">head</span>></span>
<span class="hljs-tag" style="box-sizing: border-box;"><<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">meta</span> <span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">charset</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"UTF-8"</span>></span>
<span class="hljs-tag" style="box-sizing: border-box;"><<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">title</span>></span>方式一<span class="hljs-tag" style="box-sizing: border-box;"></<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">title</span>></span>
<span class="hljs-tag" style="box-sizing: border-box;"><<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">script</span> <span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">language</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"JavaScript"</span>></span><span class="javascript" style="box-sizing: border-box;">
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">function</span> <span class="hljs-title" style="box-sizing: border-box; color: rgb(97, 174, 238);">test</span>(<span class="hljs-params" style="box-sizing: border-box;"></span>) </span>{
<span class="hljs-built_in" style="box-sizing: border-box; color: rgb(230, 192, 123);">window</span>.at.runJs(<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">function</span> (<span class="hljs-params" style="box-sizing: border-box;"></span>)</span>{
<span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//这里写js代码</span>
printl(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"你好"</span>);
}.toString());
<span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">/*
window.at.close();
window.at.runJsFile('主脚本.js');
*/</span>
}
</span><span class="hljs-tag" style="box-sizing: border-box;"></<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">script</span>></span>
<span class="hljs-tag" style="box-sizing: border-box;"></<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">head</span>></span>
<span class="hljs-tag" style="box-sizing: border-box;"><<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">body</span>></span>
<span class="hljs-tag" style="box-sizing: border-box;"><<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">input</span> <span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">type</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"Button"</span> <span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">width</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"300"</span> <span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">value</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"启动脚本"</span><span class="hljs-attr" style="box-sizing: border-box; color: rgb(209, 154, 102);">onClick</span>=<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">"test()"</span>/></span>
<span class="hljs-tag" style="box-sizing: border-box;"></<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">body</span>></span>
<span class="hljs-tag" style="box-sizing: border-box;"></<span class="hljs-name" style="box-sizing: border-box; color: rgb(224, 108, 117);">html</span>></span>
</code></pre><h1 id="h1--strong-app-h5-strong-" style="margin-top: 1em; margin-bottom: 1.5em; padding-bottom: 0.3em; box-sizing: border-box; border-bottom: 1px solid rgb(238, 238, 238); position: relative; line-height: 1.75; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif; font-size: 1.8em !important;"><a name="<strong>APP调用H5</strong>:" class="reference-link" style="color: rgb(65, 131, 196); transition: color 0.08s ease-out 0s; font-weight: 400; box-sizing: border-box; background: 0px 0px;"></a><span style="box-sizing: border-box;">APP调用H5</span>:</h1><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">首先获取web控件,例如web控件的自定义ID是web</span></p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//初始化一个activity页面</span>
<span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">var</span> ac = <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">new</span> activity();
ac.loadXML(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">`
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="H5演示"
android:textSize="18sp"
android:textStyle="bold"
android:gravity="center"
android:paddingBottom="8dp" />
<WebView
android:id="@+id/web"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
`</span>)
sleep.millisecond(毫秒 = <span class="hljs-number" style="box-sizing: border-box; color: rgb(209, 154, 102);">400</span>);
<span class="hljs-keyword" style="box-sizing: border-box; color: rgb(198, 120, 221);">var</span> web1 = ac.findWebViewById(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'web'</span>);
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;"><span style="box-sizing: border-box; font-weight: 700;">加载网址</span>loadUrl(url)</p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; margin-bottom: 1.5em; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><span class="btn-pre-copy" style="box-sizing: border-box; display: block; user-select: none; position: absolute; top: 10px; right: 12px; font-size: 11px; line-height: 1; cursor: pointer; color: rgb(153, 153, 153); transition: color 0.1s ease 0s;">复制</span><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;">web1.url(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">'/代码/h5.html'</span>);
</code></pre><p style="margin-bottom: 1.5em; box-sizing: border-box; color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Monaco, monospace, Tahoma, STXihei, 华文细黑, STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, 宋体, Heiti, 黑体, sans-serif;">执行h5的js方法,注意代码事字符串http://bbs.aiwork24.com/thread-124-1-1.html<br style="box-sizing: border-box;">String runWebJs(String jscode)<br style="box-sizing: border-box;">返回值:类似js中eval执行js代码的返回值,一般是返回最后一个变量的值http://www.postbbs.com/thread-2894-1-1.html</p><pre style="overflow-wrap: normal; box-sizing: border-box; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-stretch: normal; font-size: 12px; line-height: 1.6; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; padding: 1em; overflow: auto; background: rgb(56, 69, 72); border-radius: 4px; border: 1px solid rgb(221, 221, 221); position: relative; color: rgb(209, 210, 210);"><code class="lang-javascript hljs" style="overflow-wrap: normal; box-sizing: border-box; background: 0px 0px transparent; font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; border-radius: 3px; border: 0px; word-break: normal; display: block; max-width: none; overflow-x: auto; overflow-y: initial; line-height: inherit;"><span class="hljs-comment" style="box-sizing: border-box; color: rgb(170, 170, 170); font-style: italic;">//让浏览器运行js代码</span>
web1.runWebJs(<span class="hljs-string" style="box-sizing: border-box; color: rgb(152, 195, 121);">`alert("123")`</span>);</code></pre></div></div></div><p></p>
页:
[1]