Test.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5. <title>主体课文</title>
  6. <meta charset="utf-8" />
  7. <script src="Scripts/jquery.js"></script>
  8. <link href="Common/mtm_passage.css" rel="stylesheet" type="text/css" />
  9. <link href="Common/tasklib_book.css" rel="stylesheet" type="text/css" />
  10. <script src="Common/mtm_temp.js"></script>
  11. <script src="Common/tasklib_book.js"></script>
  12. </head>
  13. <body>
  14. <div class="scroll-view">
  15. <button id="load-text">加载听说课文</button>
  16. <button id="showhide-answer" data-status="1">隐藏习题答案</button>
  17. <button id="handle-answer" data-status="1">处理作答区域</button>
  18. <button id="submit-answer">提交习题答案</button>
  19. <button id="backup-answer">回显习题答案</button>
  20. <button id="update-answer">修改习题答案</button>
  21. <button id="backup-review">回填评阅数据</button>
  22. <button id="scroll-review">定位滚动数据</button>
  23. <button id="test-ui">测试UI效果</button>
  24. <button id="wordStyleID">单词</button>
  25. <button id="phraseStyleID">短语</button>
  26. <button id="sentenceStyleID">句型</button>
  27. <button id="ShowID">全显示</button>
  28. <button id="HiddenID">隐藏</button>
  29. </div>
  30. <!--<input type="text" style="border:0px; border-bottom:solid #fbfbfb 1px; border-radius: 3px;padding-left:5px; color:#6ab7ff;" value="测试的" />-->
  31. <!--<div class="btn-play"><img src="play.png" /><span>作答音频(20s)</span></div>-->
  32. <!--<div class="btn-play"><img src="play.png" /><span>作答音频(20s)</span></div>
  33. <p class="test-p">1、</p>
  34. <p class="test-p1">2、</p>-->
  35. <!--<u style="">ss</u>-->
  36. <!--<button class="answertext btn-bgimg">点击作答</button>-->
  37. <div id="data"></div>
  38. <script type="text/javascript">
  39. var answerjson = "";//作答信息
  40. var reviewjson = "";//评阅信息
  41. //加载数据
  42. window.onload = function () {
  43. //加载听说课文
  44. answerjson = $.ajax({ url: "AnsText/GCZD.json", async: false }).responseText;
  45. reviewjson = $.ajax({ url: "AnsText/anstext.txt", async: false }).responseText;
  46. hightcodejson = JSON.parse($.ajax({ url: "HightCode/data202116P.json", async: false }).responseText);
  47. for (var i = 0; i < JSON.parse($.ajax({ url: "HightCode/data202116S.json", async: false }).responseText).length; i++) {
  48. hightcodejson.push(JSON.parse($.ajax({ url: "HightCode/data202116S.json", async: false }).responseText)[i]);
  49. }
  50. for (var i = 0; i < JSON.parse($.ajax({ url: "HightCode/data202116W.json", async: false }).responseText).length; i++) {
  51. hightcodejson.push(JSON.parse($.ajax({ url: "HightCode/data202116W.json", async: false }).responseText)[i]);
  52. }
  53. }
  54. //加载听说课文
  55. $("#load-text").on("click", function () {
  56. var data = $.ajax({ url: "lghp/data202116.lghp", async: false }).responseText;
  57. //var data = $.ajax({ url: "lghp/jieduan.lghp", async: false }).responseText;
  58. $("#data").html(data);
  59. console.log(hightcodejson);
  60. Fill(hightcodejson);
  61. bindEventYS();
  62. //Fill(JSON.parse(hightcodejson));
  63. //bindCoursewareEvent();
  64. var ResInfo = {
  65. answerPointImgUrl: "Images/update-answer.png",
  66. yaoshiShowImgUrl: "Images/yaoshi-show.png",
  67. yaoshiHideImgUrl: "Images/yaoshi-hide.png",
  68. KouYuTagImgUrl: "Images/KY.png",
  69. recordPlayImgUrl: "Images/play.png",
  70. recordPauseImgUrl: "Images/pause.png",
  71. audioPlayImgUrl: "Images/dynaiselaba.gif",
  72. audioPauseImgUrl: "Images/dynaiselaba.png"
  73. }
  74. //调用查看图标
  75. $.each($(".yaoshi"), function (index, item) {
  76. $(item).attr("src", ResInfo.yaoshiShowImgUrl);//移动端要根据本地 喇叭 路径替换
  77. });
  78. $.each($(".audioImg"), function (index, item) {
  79. $(item).attr("src", ResInfo.audioPauseImgUrl);//移动端要根据本地 喇叭 路径替换
  80. });
  81. $.each($(".oralLanguageImg"), function (index, item) {
  82. $(item).attr("src", ResInfo.KouYuTagImgUrl);//移动端要根据本地 喇叭 路径替换
  83. });
  84. });
  85. //显示/隐藏习题答案
  86. $("#showhide-answer").on("click", function () {
  87. if ($(this).data("status") == "0") {
  88. this.innerText = "隐藏习题答案";
  89. $(this).data("status", "1");
  90. //showHideAnswer(true);
  91. showHideAnswerEx(true, true);
  92. //$(".underlineContent").show();
  93. }
  94. else {
  95. this.innerText = "显示习题答案";
  96. $(this).data("status", "0");
  97. //showHideAnswer(false);
  98. showHideAnswerEx(true, false);
  99. //$(".underlineContent").hide();
  100. }
  101. });
  102. //处理作答区域
  103. $("#handle-answer").on("click", function () {
  104. handleAnswerRange();
  105. });
  106. //提交习题答案
  107. $("#submit-answer").on("click", function () {
  108. getAllAnswer();
  109. });
  110. //回显习题答案
  111. $("#backup-answer").on("click", function () {
  112. backupAllAnswer(answerjson, 2);
  113. //var answerJson = "{\"AudioLength\":3,\"AudioUrl\":\"http://172.16.41.241:10103/http_TBookEditor51/exerciseAnswerAudio/2020-11-06_09-31-19.wav\",\"Id\":\"18\",\"Text\":\"\",\"Type\":3}";
  114. //reviewAnswer(answerJson);
  115. });
  116. //修改习题答案
  117. $("#update-answer").on("click", function () {
  118. //backupAllAnswer(answerjson, false);
  119. //var answerJson = "{\"AudioLength\":0,\"AudioUrl\":\"\",\"Id\":\"1\",\"Text\":\"sdasd\",\"Type\":1}";
  120. //var answerJson = "{\"AudioLength\":5,\"AudioUrl\":\"http://172.16.41.241:10103/Web_AITeachCloudV10/Files/UpLoad/zxstu155/2020/11/25/8a5d785d626748bbaa027895568d1bc3.wav\",\"Comment\":\"\",\"Id\":\"10\",\"PicUrl\":\"\",\"Score\":\"\",\"Text\":\"Good .\",\"Type\":3}";
  121. //测试数据
  122. //answerJson = "{\"AudioLength\":0,\"Id\":\"0\",\"Text\":\"i am how i know\",\"Type\":1}";
  123. answerJson = "{\"AudioLength\":3,\"AudioUrl\":\"http://172.16.41.241:10103/http_TBookEditor51/exerciseAnswerAudio/2020-11-06_09-31-19.wav\",\"Id\":\"4\",\"Text\":\"i know how i know \",\"Type\":3}";
  124. //var answerJson = "{\"AudioLength\":5,\"AudioUrl\":\"http://172.16.41.241:10103/Web_AITeachCloudV10/Files/UpLoad/zxstu155/2020/11/25/8a5d785d626748bbaa027895568d1bc3.wav\",\"Comment\":\"\",\"Id\":\"10\",\"PicUrl\":\"\",\"Score\":\"\",\"Text\":\"Good .\",\"Type\":3}";
  125. reviewAnswer(answerJson);
  126. });
  127. //回填评阅数据
  128. $("#backup-review").on("click", function () {
  129. backupAllReview(reviewjson);
  130. });
  131. //定位滚动数据
  132. $("#scroll-review").on("click", function () {
  133. scrollAnswer(randomNum(0,answerData.length-1));
  134. //scrollAnswer(91);
  135. });
  136. //测试UI效果
  137. $("#test-ui").on("click", function () {
  138. var clonediv = $(".btn-play").prop("outerHTML");
  139. $(".test-p").html($(".test-p").html() + clonediv);
  140. });
  141. var wordStyleFlag = true;
  142. var phraseStyleFlag = true;
  143. var sentenceStyleFlag = true;
  144. $("#wordStyleID").on("click", function () {
  145. wordStyleFlag = !wordStyleFlag;
  146. hightcodejson = null;
  147. hightcodejson = [];
  148. if (phraseStyleFlag) {
  149. for (var i = 0; i < JSON.parse($.ajax({ url: "HightCode/data202116P.json", async: false }).responseText).length; i++) {
  150. hightcodejson.push(JSON.parse($.ajax({ url: "HightCode/data202116P.json", async: false }).responseText)[i]);
  151. }
  152. }
  153. if (wordStyleFlag) {
  154. for (var i = 0; i < JSON.parse($.ajax({ url: "HightCode/data202116W.json", async: false }).responseText).length; i++) {
  155. hightcodejson.push(JSON.parse($.ajax({ url: "HightCode/data202116W.json", async: false }).responseText)[i]);
  156. }
  157. }
  158. if (sentenceStyleFlag) {
  159. for (var i = 0; i < JSON.parse($.ajax({ url: "HightCode/data202116S.json", async: false }).responseText).length; i++) {
  160. hightcodejson.push(JSON.parse($.ajax({ url: "HightCode/data202116S.json", async: false }).responseText)[i]);
  161. }
  162. }
  163. console.log(hightcodejson);
  164. Fill(hightcodejson);
  165. showGLWorld(wordStyleFlag, phraseStyleFlag, sentenceStyleFlag);
  166. });
  167. $("#phraseStyleID").on("click", function () {
  168. phraseStyleFlag = !phraseStyleFlag;
  169. hightcodejson = null;
  170. hightcodejson = [];
  171. if (phraseStyleFlag) {
  172. for (var i = 0; i < JSON.parse($.ajax({ url: "HightCode/data202116P.json", async: false }).responseText).length; i++) {
  173. hightcodejson.push(JSON.parse($.ajax({ url: "HightCode/data202116P.json", async: false }).responseText)[i]);
  174. }
  175. }
  176. if (wordStyleFlag) {
  177. for (var i = 0; i < JSON.parse($.ajax({ url: "HightCode/data202116W.json", async: false }).responseText).length; i++) {
  178. hightcodejson.push(JSON.parse($.ajax({ url: "HightCode/data202116W.json", async: false }).responseText)[i]);
  179. }
  180. }
  181. if (sentenceStyleFlag) {
  182. for (var i = 0; i < JSON.parse($.ajax({ url: "HightCode/data202116S.json", async: false }).responseText).length; i++) {
  183. hightcodejson.push(JSON.parse($.ajax({ url: "HightCode/data202116S.json", async: false }).responseText)[i]);
  184. }
  185. }
  186. console.log(hightcodejson);
  187. Fill(hightcodejson);
  188. showGLWorld(wordStyleFlag, phraseStyleFlag, sentenceStyleFlag);
  189. });
  190. $("#sentenceStyleID").on("click", function () {
  191. sentenceStyleFlag = !sentenceStyleFlag;
  192. hightcodejson = null;
  193. hightcodejson = [];
  194. if (phraseStyleFlag) {
  195. for (var i = 0; i < JSON.parse($.ajax({ url: "HightCode/data202116P.json", async: false }).responseText).length; i++) {
  196. hightcodejson.push(JSON.parse($.ajax({ url: "HightCode/data202116P.json", async: false }).responseText)[i]);
  197. }
  198. }
  199. if (wordStyleFlag) {
  200. for (var i = 0; i < JSON.parse($.ajax({ url: "HightCode/data202116W.json", async: false }).responseText).length; i++) {
  201. hightcodejson.push(JSON.parse($.ajax({ url: "HightCode/data202116W.json", async: false }).responseText)[i]);
  202. }
  203. }
  204. if (sentenceStyleFlag) {
  205. for (var i = 0; i < JSON.parse($.ajax({ url: "HightCode/data202116S.json", async: false }).responseText).length; i++) {
  206. hightcodejson.push(JSON.parse($.ajax({ url: "HightCode/data202116S.json", async: false }).responseText)[i]);
  207. }
  208. }
  209. console.log(hightcodejson);
  210. Fill(hightcodejson);
  211. showGLWorld(wordStyleFlag, phraseStyleFlag, sentenceStyleFlag);
  212. });
  213. $("#ShowID").on("click", function () {
  214. showGLWorld(true, true, true);
  215. });
  216. $("#HiddenID").on("click", function () {
  217. showGLWorld(false, false, false);
  218. });
  219. //生成从minNum到maxNum的随机数
  220. function randomNum(minNum, maxNum) {
  221. switch (arguments.length) {
  222. case 1:
  223. return parseInt(Math.random() * minNum + 1, 10);
  224. break;
  225. case 2:
  226. return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
  227. break;
  228. default:
  229. return 0;
  230. break;
  231. }
  232. }
  233. </script>
  234. </body>
  235. </html>