record.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>学习记录</title>
  8. <style>
  9. body {
  10. margin: 10px;
  11. background: #F1F1F1;
  12. }
  13. .record-chart {
  14. width: 100%;
  15. height: 300px;
  16. background:rgba(255,255,255,1);
  17. border-radius:20px;
  18. }
  19. .record-list {
  20. margin-top: 10px;
  21. width: 100%;
  22. height: 100%;
  23. padding-bottom: 10px;
  24. background:rgba(255,255,255,1);
  25. border-radius:20px;
  26. }
  27. .record-title {
  28. display: inline-block;
  29. width: 124px;
  30. height: 31px;
  31. line-height: 31px;
  32. font-size: 18px;
  33. font-family:PingFang SC;
  34. font-weight: bold;
  35. color:rgba(51,51,51,1);
  36. padding: 5px 20px;
  37. }
  38. .record-list-data {
  39. margin: 10px 25px;
  40. padding: 0 10px 10px;
  41. border-left: 1px solid #DEDEDE;
  42. }
  43. .record-date {
  44. font-size:14px;
  45. font-weight:500;
  46. color:rgba(153,153,153,1);
  47. }
  48. .record-data {
  49. display: flex;
  50. margin: 5px 0;
  51. justify-content: space-between;
  52. align-items: center;
  53. }
  54. .record-data .doc-title {
  55. color: #666666;
  56. }
  57. .record-data .read-time {
  58. color: #2DC2DC;
  59. }
  60. .record-data .doc-title,.record-data .read-time{
  61. font-size: 16px;
  62. }
  63. .dian {
  64. width: 10px;
  65. height: 10px;
  66. background: #DEDEDE;
  67. display: block;
  68. border-radius: 5px;
  69. margin-left: -15px;
  70. }
  71. .no-data {
  72. display: flex;
  73. flex-direction: column;
  74. justify-content: center;
  75. align-items: center;
  76. }
  77. .no-data img {
  78. margin-top: 20px;
  79. }
  80. .no-data-text {
  81. font-size:16px;
  82. font-family:PingFang SC;
  83. font-weight:500;
  84. color:rgba(153,153,153,1);
  85. }
  86. </style>
  87. </head>
  88. <body>
  89. <div class="record-chart">
  90. <div id="record-chart" style="height: 100%"></div>
  91. </div>
  92. <div id="record-data" class="record-list">
  93. <!-- <div class="no-data">-->
  94. <!-- <img src="/public/img/no_data.png" alt="" width="187" height="144">-->
  95. <!-- <p class="no-data-text">啊哦!您今天还未开始学习哦!</p>-->
  96. <!-- </div>-->
  97. <!-- <span class="record-title">学习记录</span>-->
  98. <!-- <div class="record-list-data">-->
  99. <!-- <b class="dian"></b>-->
  100. <!-- <span id="record-date" class="record-date"></span>-->
  101. <!-- <div >-->
  102. <!-- <div class="doc-title">《公司考勤制度》</div>-->
  103. <!-- <div class="read-time">10分钟</div>-->
  104. <!-- </div>-->
  105. <!-- </div>-->
  106. </div>
  107. <script src="/static/jquery-1.11.3.min.js"></script>
  108. <script type="text/javascript" src="/static/data/js/echarts.js"></script>
  109. <script>
  110. var days2;
  111. function recordChart() {
  112. $.get('/h5/RecordData/recordChart',{token:'{$token}'},function (data) {
  113. if(data.code == 0){
  114. days2 = data.data.days2;
  115. if(data.data.days.length > 0){
  116. let dom = document.getElementById("record-chart");
  117. let myChart = echarts.init(dom);
  118. let option = {
  119. tooltip: {
  120. trigger: 'axis',
  121. axisPointer: {
  122. type: 'shadow'
  123. },
  124. formatter: "{b}: {c}'"
  125. },
  126. grid: {
  127. left: '-2%',
  128. right: '4%',
  129. bottom: '5%',
  130. top:'15%',
  131. containLabel: true
  132. },
  133. xAxis: {
  134. type: 'category',
  135. data: data.data.days,
  136. axisLine: {
  137. lineStyle: {
  138. color: '#999999'
  139. }
  140. },
  141. axisLabel: {},
  142. },
  143. yAxis: {
  144. axisLine: {
  145. show: false,
  146. lineStyle: {
  147. color: 'white'
  148. }
  149. },
  150. axisLabel: {}
  151. },
  152. "dataZoom": [{
  153. "show": false,
  154. "height": 12,
  155. "xAxisIndex": [
  156. 0
  157. ],
  158. bottom:'8%',
  159. "start": 80,
  160. "end": 100,
  161. handleStyle:{
  162. color:"#d3dee5",
  163. },
  164. textStyle:{
  165. color:"#999999"
  166. },
  167. borderColor:"#90979c"
  168. }, {
  169. "type": "inside",
  170. "show": false,
  171. "height": 15,
  172. "start": 1,
  173. "end": 35
  174. }],
  175. series: [{
  176. name: '学习时长',
  177. type: 'bar',
  178. barMaxWidth: '30',
  179. itemStyle: {
  180. normal: {
  181. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  182. offset: 0,
  183. color: '#3595A5'
  184. }, {
  185. offset: 1,
  186. color: '#3595A5'
  187. }]),
  188. },
  189. },
  190. label: {
  191. normal: {
  192. show: true,
  193. position: 'top',
  194. color: '#999999',
  195. formatter: "{c}'"
  196. }
  197. },
  198. data: data.data.times
  199. }]
  200. };
  201. if (option && typeof option === "object") {
  202. myChart.setOption(option, true);
  203. }
  204. myChart.on('click', function (params) {
  205. recordList(days2[params.name]);
  206. });
  207. }
  208. }
  209. });
  210. }
  211. function recordList(day) {
  212. $.get('/h5/RecordData/recordList',{ day:day,token:'{$token}' },function (res) {
  213. if(res.code == 0) {
  214. let list = res.data;
  215. if (list.length > 0) {
  216. var str = '<span class="record-title">'+ '学习记录' + '</span>';
  217. str += '<div class="record-list-data">';
  218. str += '<b class="dian">' + '</b>';
  219. str += '<span id="record-date" class="record-date">'+'</span>';
  220. for (var i in list){
  221. str += '<div class="record-data">';
  222. str += '<div class="doc-title">' + list[i]['title'] + '</div>';
  223. str += '<div class="read-time">' + list[i]['time']+ ' 分钟' + '</div>';
  224. str += '</div>';
  225. }
  226. str += '</div>';
  227. $('#record-data').html(str);
  228. $('#record-date').html(list[0]['create_time']);
  229. } else {
  230. var data = '<div class="no-data">';
  231. data += '<img src="/static/no_data.png" alt="" width="187" height="144">';
  232. data += '<p class="no-data-text">' + '啊哦!您今天还未开始学习哦!' + '</p>';
  233. data += '</div>';
  234. $('#record-data').html(data);
  235. }
  236. }
  237. })
  238. }
  239. recordChart();
  240. recordList();
  241. </script>
  242. </body>
  243. </html>