review-chapter.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Hello MUI</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
  7. <meta name="apple-mobile-web-app-capable" content="yes">
  8. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  9. <link rel="stylesheet" href="../css/mui.min.css">
  10. <script src="../js/mui.min.js"></script>
  11. <script src="../js/app.js"></script>
  12. <script src="../js/service.js"></script>
  13. <style>
  14. html,
  15. body {
  16. background-color: #efeff4;
  17. }
  18. .mui-ellipsis {
  19. font-size: 18px;
  20. font-weight: 1000 !important;
  21. }
  22. </style>
  23. <script>
  24. //右上角菜单点击事件(收藏本、错题本)
  25. function sectionATapEvent() {
  26. mui('#list').on('tap', 'a', function() {
  27. var chapterId = this.getAttribute('data-chapter-id');
  28. var href = this.getAttribute('data-href');
  29. var type = this.getAttribute("data-type");
  30. mui.openWindow({
  31. id: 'bar-' + chapterId,
  32. url: href,
  33. waiting: {
  34. autoShow: false
  35. },
  36. extras: {
  37. chapterId: chapterId,
  38. type: type,
  39. barTitle:window.barTitle
  40. }
  41. })
  42. });
  43. }
  44. function updateTitle() {
  45. var self = plus.webview.currentWebview();
  46. window.barTitle = self.barTitle;
  47. if (window.barTitle) {
  48. var titleDom = document.getElementById('title');
  49. titleDom.innerHTML = window.barTitle;
  50. }
  51. }
  52. function initDom() {
  53. var courseId = window.courseId;
  54. var type = window.type;
  55. var scriptCourse = document.getElementById('template-chapter-id');
  56. var template = scriptCourse.innerHTML;
  57. var ct = document.getElementById('list');
  58. ct.innerHTML = '<li class="mui-table-view-cell mui-media">'+
  59. '<div class="mui-media-body" style="text-align: center;">'+
  60. '<p class="mui-ellipsis" style="">没有数据</p>'+
  61. '</div>'+
  62. '</li>';
  63. queryCourseCount(courseId, type, function(rows) {
  64. var htmlStr = '';
  65. if (rows.length < 1) return;
  66. ct.innerHTML = '';
  67. for (var i = 0; i < rows.length; i++) {
  68. var row = rows[i];
  69. row.chapterId = row.code;
  70. row.type = type;
  71. htmlStr += render(template, row);
  72. }
  73. ct.innerHTML = htmlStr;
  74. });
  75. }
  76. mui.init();
  77. mui.plusReady(function() {
  78. updateTitle();
  79. var self = plus.webview.currentWebview();
  80. window.courseId = self.courseId;
  81. window.type = self.type;
  82. initDom();
  83. sectionATapEvent();
  84. });
  85. </script>
  86. </head>
  87. <body>
  88. <header class="mui-bar mui-bar-nav">
  89. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  90. <h1 id="title" class="mui-title">错题本</h1>
  91. </header>
  92. <div class="mui-content">
  93. <br />
  94. <p style="text-align: center;display: none;" class="mui-content" id="tishu"></p>
  95. <br />
  96. <div class="mui-card">
  97. <ul class="mui-table-view" id="list">
  98. <li class="mui-table-view-cell mui-media">
  99. <div class="mui-media-body" style="text-align: center;">
  100. <p class='mui-ellipsis' style="">没有数据</p>
  101. </div>
  102. </li>
  103. </ul>
  104. </div>
  105. </div>
  106. <script type="text/html" id="template-chapter-id">
  107. <li class="mui-table-view-cell mui-media">
  108. <a data-href="review-section.html" data-chapter-id="{chapterId}" data-type="{type}" style="height: 60px;padding-top: 20px;">
  109. <span class="mui-pull-right"><span style="color: gray;font-size: 14px;">{count}道</span><span class="mui-icon mui-icon-forward "></span></span>
  110. <div class="mui-media-body">
  111. <p class='mui-ellipsis' style="">{name}</p>
  112. </div>
  113. </a>
  114. </li>
  115. </script>
  116. </body>
  117. </html>