index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <template>
  2. <div class="body1">
  3. <!-- 课程数据 -->
  4. <div class="left">
  5. <div class="top">
  6. <div class="titleBox">
  7. <div class="title">授课频次</div>
  8. </div>
  9. <div class="dataBox">
  10. <div class="teafre">
  11. <div class="teaLeft">
  12. <div>累计授课次数</div>
  13. <div>{{ wCount }}</div>
  14. </div>
  15. <div class="teaLeft teaRigth">
  16. <div>相对增幅百分比</div>
  17. <div>{{ reInc }}%</div>
  18. </div>
  19. </div>
  20. <TeaFre
  21. style="height: calc(100% - 62px)"
  22. :monthArray="groupedArrayByMonth"
  23. ></TeaFre>
  24. </div>
  25. </div>
  26. <div class="bottom">
  27. <div class="titleBox">
  28. <div class="title">工具使用</div>
  29. </div>
  30. <div class="dataBox">
  31. <ToolUse
  32. style="height: calc(100% - 40px)"
  33. :toolArray="toolList"
  34. ></ToolUse>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="center">
  39. <div class="top">
  40. <div class="titleBox">
  41. <div class="title">课程数量</div>
  42. </div>
  43. <div class="dataBox middleBox">
  44. <div class="halfBox">
  45. <div class="teafre">
  46. <div class="teaMiddle cNum">
  47. <div>课程总数</div>
  48. <div>{{ cCount }}</div>
  49. </div>
  50. <div class="teaMiddle tNum">
  51. <div>类别总数</div>
  52. <div>8412</div>
  53. </div>
  54. <div class="teaMiddle tSum">
  55. <div>类别平均</div>
  56. <div>3021</div>
  57. </div>
  58. </div>
  59. <CateRank
  60. style="
  61. height: calc(100% - 72px);
  62. margin-top: 10px;
  63. overflow: auto;
  64. "
  65. ></CateRank>
  66. </div>
  67. <div class="halfBox middleBox" style="align-items: flex-start">
  68. <WorkNum style="height: calc(100% - 40px)"></WorkNum>
  69. </div>
  70. </div>
  71. </div>
  72. <div class="bottom">
  73. <div class="titleBox">
  74. <div class="title">课程时间分布</div>
  75. </div>
  76. <div class="dataBox">
  77. <CourseTime style="height: calc(100% - 40px)"></CourseTime>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="right">
  82. <div class="top">
  83. <div class="titleBox">
  84. <div class="title">课程分析</div>
  85. </div>
  86. <div class="dataBox">
  87. <CourseAna style="height: calc(100% - 40px)"></CourseAna>
  88. </div>
  89. </div>
  90. <div class="bottom">
  91. <div class="titleBox">
  92. <div class="title">授课时长</div>
  93. </div>
  94. <div class="dataBox">
  95. <div class="teafre">
  96. <div class="teaLeft">
  97. <div>累计时长</div>
  98. <div>15624小时</div>
  99. </div>
  100. <div class="teaLeft teaRigth">
  101. <div>学生在线平均时长</div>
  102. <div>268小时</div>
  103. </div>
  104. </div>
  105. <WorkTime style="height: calc(100% - 62px)"></WorkTime>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </template>
  111. <script>
  112. import TeaFre from "./chartList/teaFre.vue";
  113. import ToolUse from "./chartList/toolUse.vue";
  114. import CateRank from "./chartList/cateRank.vue";
  115. import WorkNum from "./chartList/workNum.vue";
  116. import CourseTime from "./chartList/courseTime.vue";
  117. import CourseAna from "./chartList/courseAna.vue";
  118. import WorkTime from "./chartList/workTime.vue";
  119. export default {
  120. components: {
  121. TeaFre,
  122. ToolUse,
  123. CateRank,
  124. WorkNum,
  125. CourseTime,
  126. CourseAna,
  127. WorkTime,
  128. },
  129. props: {
  130. oid: {
  131. type: String,
  132. },
  133. },
  134. data() {
  135. return {
  136. isLoading: false,
  137. wCount: 0,
  138. cCount: 0,
  139. groupedArrayByMonth: [],
  140. toolList: [],
  141. reInc: 0,
  142. };
  143. },
  144. mounted() {
  145. this.getData();
  146. },
  147. methods: {
  148. getData() {
  149. this.isLoading = true;
  150. let params = [
  151. {
  152. oid: this.oid,
  153. },
  154. ];
  155. this.ajax
  156. .post(this.$store.state.api + "selectDataBoardCourse", params)
  157. .then((res) => {
  158. this.isLoading = false;
  159. this.wCount = res.data[0].length;
  160. this.cCount = res.data[1].length;
  161. var workArray = res.data[0];
  162. var courseList = res.data[1];
  163. var cList = [];
  164. //将数据根据time里面的月份分成多个数组
  165. var groupedArrayByMonth = [];
  166. const date = new Date();
  167. var Month = date.getMonth() + 1;
  168. var Year = date.getFullYear();
  169. for (var i = Month; i > Month - 6; i--) {
  170. if (i <= 0) {
  171. groupedArrayByMonth.push({
  172. Year: Year - 1,
  173. Month: 12 + i,
  174. course: 0,
  175. });
  176. } else {
  177. groupedArrayByMonth.push({
  178. Month: i,
  179. Year: Year,
  180. course: 0,
  181. });
  182. }
  183. }
  184. groupedArrayByMonth = groupedArrayByMonth.reverse();
  185. for (var i = 0; i < workArray.length; i++) {
  186. let _date = new Date(workArray[i].time);
  187. var _month = _date.getMonth() + 1;
  188. var _year = _date.getFullYear();
  189. for (var j = 0; j < groupedArrayByMonth.length; j++) {
  190. if (
  191. _month == groupedArrayByMonth[j].Month &&
  192. _year == groupedArrayByMonth[j].Year
  193. ) {
  194. groupedArrayByMonth[j].course++;
  195. break;
  196. }
  197. }
  198. }
  199. if (
  200. groupedArrayByMonth[groupedArrayByMonth.length - 1].course == 0 ||
  201. groupedArrayByMonth[groupedArrayByMonth.length - 2].course == 0
  202. ) {
  203. this.reInc = 0;
  204. } else {
  205. this.reInc = (
  206. (groupedArrayByMonth[groupedArrayByMonth.length - 1].course /
  207. groupedArrayByMonth[groupedArrayByMonth.length - 2].course) *
  208. 100
  209. ).toFixed(1);
  210. }
  211. this.groupedArrayByMonth = groupedArrayByMonth;
  212. for (var i = 0; i < courseList.length; i++) {
  213. cList.push(JSON.parse(courseList[i].chapters));
  214. }
  215. var toolList = [
  216. [10, 65], //互动类
  217. [7, 1, 52, 3, 48], //思维类
  218. [49], //协作类
  219. [4, 45, 15, 16, 50, 41, 47], //测评类
  220. [40], //评价类
  221. [18, 21, 22, 23, 24, 32, 57, 63], //编程类
  222. [28, 31, 39, 66, 67, 68], //学科类
  223. ];
  224. var toolAllArray = [
  225. { name: "互动类", value: 0 },
  226. { name: "思维类", value: 0 },
  227. { name: "协作类", value: 0 },
  228. { name: "测评类", value: 0 },
  229. { name: "评价类", value: 0 },
  230. { name: "编程类", value: 0 },
  231. { name: "学科类", value: 0 },
  232. ];
  233. for (var p = 0; p < toolList.length; p++) {
  234. for (var i = 0; i < cList.length; i++) {
  235. for (var j = 0; j < cList[i].length; j++) {
  236. for (
  237. var k = 0;
  238. k < cList[i][j].chapterInfo[0].taskJson.length;
  239. k++
  240. ) {
  241. for (
  242. var q = 0;
  243. q <
  244. cList[i][j].chapterInfo[0].taskJson[k].toolChoose.length;
  245. q++
  246. ) {
  247. if (
  248. toolList[p].indexOf(
  249. cList[i][j].chapterInfo[0].taskJson[k].toolChoose[q]
  250. .tool[0]
  251. ) != -1
  252. ) {
  253. toolAllArray[p].value++;
  254. }
  255. }
  256. }
  257. }
  258. }
  259. }
  260. this.toolList = toolAllArray;
  261. })
  262. .catch((err) => {
  263. this.isLoading = false;
  264. console.error(err);
  265. });
  266. },
  267. format(percentage) {
  268. return percentage;
  269. },
  270. },
  271. };
  272. </script>
  273. <style scoped>
  274. .body1 {
  275. width: 100%;
  276. height: 100%;
  277. display: flex;
  278. padding: 20px;
  279. box-sizing: border-box;
  280. overflow: hidden;
  281. }
  282. .left {
  283. width: calc(100% / 4 * 1);
  284. height: 100%;
  285. }
  286. .left > .top {
  287. width: 100%;
  288. height: calc(100% / 2 - 10px);
  289. background: #fff;
  290. border-radius: 5px;
  291. margin: 0 0 20px 0;
  292. }
  293. .left > .bottom {
  294. width: 100%;
  295. height: calc(100% / 2 - 10px);
  296. background: #fff;
  297. border-radius: 5px;
  298. }
  299. .center {
  300. width: calc(100% / 4 * 2 - 40px);
  301. height: 100%;
  302. margin: 0 20px;
  303. }
  304. .center > .top {
  305. width: 100%;
  306. height: calc(100% / 5 * 3 - 10px);
  307. background: #fff;
  308. border-radius: 5px;
  309. margin: 0 0 20px 0;
  310. }
  311. .center > .bottom {
  312. width: 100%;
  313. height: calc(100% / 5 * 2 - 10px);
  314. background: #fff;
  315. border-radius: 5px;
  316. }
  317. .right {
  318. width: calc(100% / 4 * 1);
  319. height: 100%;
  320. }
  321. .right > .top {
  322. width: 100%;
  323. height: calc(100% / 2 - 10px);
  324. background: #fff;
  325. border-radius: 16px;
  326. margin: 0 0 20px 0;
  327. }
  328. .right > .bottom {
  329. width: 100%;
  330. height: calc(100% / 2 - 10px);
  331. background: #fff;
  332. border-radius: 5px;
  333. }
  334. .titleBox {
  335. height: 40px;
  336. display: flex;
  337. align-items: center;
  338. padding: 0 15px;
  339. width: 100%;
  340. }
  341. .dataBox {
  342. height: calc(100% - 40px);
  343. width: 100%;
  344. }
  345. .middleBox {
  346. display: flex;
  347. flex-direction: row;
  348. flex-wrap: nowrap;
  349. align-items: flex-start;
  350. }
  351. .title {
  352. font-weight: bold;
  353. color: #060e17;
  354. font-size: 18px;
  355. }
  356. .teafre {
  357. display: flex;
  358. flex-direction: row;
  359. flex-wrap: nowrap;
  360. align-items: center;
  361. width: 100%;
  362. justify-content: space-evenly;
  363. }
  364. .teaLeft,
  365. .teaMiddle {
  366. width: calc(100% / 2 - 10px);
  367. height: 60px;
  368. border-radius: 8px;
  369. /* border: 1px solid #e0eafb; */
  370. display: flex;
  371. flex-direction: column;
  372. align-items: flex-start;
  373. justify-content: center;
  374. padding: 0 10px;
  375. margin: 0 10px;
  376. }
  377. .teaMiddle {
  378. width: calc(100% / 3 - 10px);
  379. }
  380. .teaLeft {
  381. width: 95%;
  382. background: linear-gradient(
  383. 180deg,
  384. rgba(224, 234, 251, 0.2) 0%,
  385. rgba(54, 130, 252, 0.3) 100%
  386. );
  387. }
  388. .teaRigth {
  389. background: linear-gradient(
  390. 180deg,
  391. rgb(211, 246, 228, 0.2) 0%,
  392. rgb(23, 196, 105, 0.3) 100%
  393. ) !important;
  394. }
  395. .cNum {
  396. background: linear-gradient(
  397. 180deg,
  398. rgb(125, 227, 174, 0.2) 0%,
  399. rgb(23, 196, 105, 0.3) 100%
  400. ) !important;
  401. }
  402. .tNum {
  403. background: linear-gradient(
  404. 180deg,
  405. rgb(174, 204, 254, 0.2) 0%,
  406. rgb(54, 129, 252, 0.3) 100%
  407. ) !important;
  408. }
  409. .tSum {
  410. background: linear-gradient(
  411. 180deg,
  412. rgb(125, 227, 174, 0.2) 0%,
  413. rgb(23, 196, 105, 0.3) 100%
  414. ) !important;
  415. }
  416. .teaLeft > div:first-child,
  417. .teaMiddle > div:first-child {
  418. font-size: 12px;
  419. font-weight: 400;
  420. color: #565e6a;
  421. }
  422. .teaLeft > div:last-child,
  423. .teaMiddle > div:last-child {
  424. font-size: 22px;
  425. font-weight: bold;
  426. color: #060e17;
  427. }
  428. .halfBox {
  429. width: 50%;
  430. height: 100%;
  431. }
  432. </style>