index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <div class="body1" v-loading="isLoading">
  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="info_box">
  11. <div class="info blueBG">
  12. <span>学生总数</span>
  13. <span>{{ count }}</span>
  14. </div>
  15. <div class="info greenBG">
  16. <span>周使用频次</span>
  17. <span>{{weekCount}}</span>
  18. </div>
  19. <div class="info blueBG">
  20. <span>登录频次</span>
  21. <span>{{ loginCount }}</span>
  22. </div>
  23. <div class="info greenBG">
  24. <span>人均使用频次</span>
  25. <span>{{ (loginCount / count).toFixed(0) }}</span>
  26. </div>
  27. </div>
  28. <loginCount :monthArray="loginCountMonthArray" style="height: calc(100% - 140px)"></loginCount>
  29. </div>
  30. </div>
  31. <div class="bottom">
  32. <div class="titleBox">
  33. <div class="title">学生行为数据</div>
  34. </div>
  35. <div class="dataBox">
  36. <stuAct style="height: calc(100% - 20px)"></stuAct>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="center">
  41. <div class="top">
  42. <div class="titleBox">
  43. <div class="title">学生综合评价</div>
  44. </div>
  45. <div class="dataBox">
  46. <div class="info_box" style="width: 95%; justify-content: flex-start">
  47. <div class="info2 blueBG">
  48. <span>学生总数</span>
  49. <span>{{ count }}</span>
  50. </div>
  51. <div class="info2 greenBG">
  52. <span>班级总数</span>
  53. <span>15620</span>
  54. </div>
  55. <div class="info2 blueBG">
  56. <span>平均得分</span>
  57. <span>15620</span>
  58. </div>
  59. </div>
  60. <studentInfo style="height: calc(100% - 70px)"></studentInfo>
  61. </div>
  62. </div>
  63. <div class="bottom">
  64. <div class="titleBox">
  65. <div class="title">平台使用深度</div>
  66. </div>
  67. <div class="dataBox">
  68. <div class="depth_box">
  69. <div class="depth">
  70. <span>参与课程</span>
  71. <div>
  72. <el-progress
  73. :width="90"
  74. type="circle"
  75. :percentage="36"
  76. :stroke-width="15"
  77. :format="format"
  78. color="#106BFF"
  79. ></el-progress>
  80. </div>
  81. </div>
  82. <div class="depth">
  83. <span>参与项目</span>
  84. <div>
  85. <el-progress
  86. :width="90"
  87. type="circle"
  88. :percentage="76"
  89. :stroke-width="15"
  90. :format="format"
  91. color="#106BFF"
  92. ></el-progress>
  93. </div>
  94. </div>
  95. <div class="depth">
  96. <span>使用工具</span>
  97. <div>
  98. <el-progress
  99. :width="90"
  100. type="circle"
  101. :percentage="76"
  102. :stroke-width="15"
  103. :format="format"
  104. color="#106BFF"
  105. ></el-progress>
  106. </div>
  107. </div>
  108. <div class="depth">
  109. <span>协同合作</span>
  110. <div>
  111. <el-progress
  112. :width="90"
  113. type="circle"
  114. :percentage="76"
  115. :stroke-width="15"
  116. :format="format"
  117. color="#106BFF"
  118. ></el-progress>
  119. </div>
  120. </div>
  121. <div class="depth">
  122. <span>互动交流</span>
  123. <div>
  124. <el-progress
  125. :width="90"
  126. type="circle"
  127. :percentage="76"
  128. :stroke-width="15"
  129. :format="format"
  130. color="#106BFF"
  131. ></el-progress>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="right">
  139. <div class="top">
  140. <div class="titleBox">
  141. <div class="title">学生综合评价</div>
  142. </div>
  143. <div class="dataBox">
  144. <studentInfo2></studentInfo2>
  145. </div>
  146. </div>
  147. <div class="bottom">
  148. <div class="titleBox">
  149. <div class="title">在线时长</div>
  150. </div>
  151. <div class="dataBox">
  152. <div class="info_box">
  153. <div class="info blueBG">
  154. <span>累计在线时长</span>
  155. <span>{{ loginTime.toFixed(0) }}小时</span>
  156. </div>
  157. <div class="info greenBG">
  158. <span>学生在线平均时长</span>
  159. <span>{{ (loginTime / count).toFixed(0) }}小时</span>
  160. </div>
  161. </div>
  162. <loginTime style="height: calc(100% - 70px)"></loginTime>
  163. </div>
  164. </div>
  165. </div>
  166. </div>
  167. </template>
  168. <script>
  169. import loginCount from "./loginCount";
  170. import studentInfo from "./studentInfo";
  171. import studentInfo2 from "./studentInfo2";
  172. import loginTime from "./loginTime";
  173. import stuAct from "./stuAct";
  174. export default {
  175. props: {
  176. oid: {
  177. type: String,
  178. },
  179. },
  180. components: {
  181. loginCount,
  182. studentInfo,
  183. studentInfo2,
  184. loginTime,
  185. stuAct,
  186. },
  187. data() {
  188. return {
  189. isLoading: false,
  190. count: 0,
  191. loginCount: 0,
  192. loginTime: 0,
  193. loginCountMonthArray:[],
  194. weekCount:0
  195. };
  196. },
  197. mounted() {
  198. this.getData();
  199. },
  200. methods: {
  201. getData() {
  202. this.isLoading = true;
  203. let params = [
  204. {
  205. oid: this.oid,
  206. },
  207. ];
  208. this.ajax
  209. .post(this.$store.state.api + "selectDataBoardStudent", params)
  210. .then((res) => {
  211. this.isLoading = false;
  212. this.count = res.data[0][0].count;
  213. this.loginCount = res.data[1][0].loginCount;
  214. this.loginTime = parseInt(res.data[2][0].time) / 60 / 60;
  215. let loginCountMonthArray = []
  216. const date = new Date()
  217. var Month = date.getMonth() + 1
  218. var Year = date.getFullYear()
  219. for (var i = Month; i > Month - 6; i--) {
  220. if (i <= 0) {
  221. loginCountMonthArray.push({
  222. Year: Year - 1,
  223. Month: 12 + i,
  224. student: 0,
  225. })
  226. } else {
  227. loginCountMonthArray.push({
  228. Month: i,
  229. Year: Year,
  230. student: 0,
  231. })
  232. }
  233. }
  234. loginCountMonthArray = loginCountMonthArray.reverse()
  235. let studentLoginCountYear = res.data[3] // 学生半年登录次数统计
  236. for (var i = 0; i < studentLoginCountYear.length; i++) {
  237. let _date = new Date(studentLoginCountYear[i].create_at)
  238. var _month = _date.getMonth() + 1
  239. var _year = _date.getFullYear()
  240. for (var j = 0; j < loginCountMonthArray.length; j++) {
  241. if (_month == loginCountMonthArray[j].Month && _year == loginCountMonthArray[j].Year) {
  242. loginCountMonthArray[j].student++
  243. break;
  244. }
  245. }
  246. }
  247. this.loginCountMonthArray = loginCountMonthArray;
  248. console.log(loginCountMonthArray);
  249. this.weekCount = res.data[4][0].count
  250. })
  251. .catch((err) => {
  252. this.isLoading = false;
  253. console.error(err);
  254. });
  255. },
  256. format(percentage) {
  257. return percentage;
  258. },
  259. },
  260. };
  261. </script>
  262. <style scoped>
  263. .body1 {
  264. width: 100%;
  265. height: 100%;
  266. display: flex;
  267. padding: 20px;
  268. box-sizing: border-box;
  269. overflow: hidden;
  270. }
  271. .left {
  272. width: calc(100% / 4 * 1);
  273. height: 100%;
  274. }
  275. .left > .top {
  276. width: 100%;
  277. height: calc(100% / 2 - 10px);
  278. background: #fff;
  279. border-radius: 5px;
  280. margin: 0 0 20px 0;
  281. }
  282. .left > .bottom {
  283. width: 100%;
  284. height: calc(100% / 2 - 10px);
  285. background: #fff;
  286. border-radius: 5px;
  287. }
  288. .center {
  289. width: calc(100% / 4 * 2 - 40px);
  290. height: 100%;
  291. margin: 0 20px;
  292. }
  293. .center > .top {
  294. width: 100%;
  295. height: calc(100% / 5 * 3 - 10px);
  296. background: #fff;
  297. border-radius: 5px;
  298. margin: 0 0 20px 0;
  299. }
  300. .center > .bottom {
  301. width: 100%;
  302. height: calc(100% / 5 * 2 - 10px);
  303. background: #fff;
  304. border-radius: 5px;
  305. }
  306. .right {
  307. width: calc(100% / 4 * 1);
  308. height: 100%;
  309. }
  310. .right > .top {
  311. width: 100%;
  312. height: calc(100% / 2 - 10px);
  313. background: #fff;
  314. border-radius: 5px;
  315. margin: 0 0 20px 0;
  316. }
  317. .right > .bottom {
  318. width: 100%;
  319. height: calc(100% / 2 - 10px);
  320. background: #fff;
  321. border-radius: 5px;
  322. }
  323. .titleBox {
  324. height: 40px;
  325. display: flex;
  326. align-items: center;
  327. padding: 0 15px;
  328. width: 100%;
  329. }
  330. .dataBox {
  331. height: calc(100% - 40px);
  332. width: 100%;
  333. }
  334. .titleBox {
  335. height: 40px;
  336. display: flex;
  337. align-items: center;
  338. padding: 0 15px;
  339. width: 100%;
  340. }
  341. .titleBox > .title {
  342. font-weight: 700;
  343. }
  344. .dataBox {
  345. height: calc(100% - 40px);
  346. width: 100%;
  347. }
  348. .info_box {
  349. display: flex;
  350. flex-wrap: wrap;
  351. align-items: center;
  352. justify-content: space-between;
  353. width: 90%;
  354. margin: 0 auto;
  355. }
  356. .info_box > .info2,
  357. .info_box > .info3,
  358. .info_box > .info {
  359. width: calc(50% - 10px);
  360. display: flex;
  361. flex-direction: column;
  362. height: 60px;
  363. justify-content: center;
  364. padding: 0 10px;
  365. box-sizing: border-box;
  366. margin-bottom: 10px;
  367. border-radius: 5px;
  368. }
  369. .info_box > .info2 {
  370. width: calc(100% / 4 - 10px);
  371. align-items: flex-end;
  372. margin-right: 10px;
  373. }
  374. .info_box > .info3 {
  375. width: 100%;
  376. margin-bottom: 5px;
  377. }
  378. .info_box > .info2 > span:nth-child(1),
  379. .info_box > .info3 > span:nth-child(1),
  380. .info_box > .info > span:nth-child(1) {
  381. font-size: 12px;
  382. /* margin: 0 0 5px 0; */
  383. color: #565e6a;
  384. }
  385. .info_box > .info2 > span:nth-child(2),
  386. .info_box > .info3 > span:nth-child(2),
  387. .info_box > .info > span:nth-child(2) {
  388. font-size: 22px;
  389. font-weight: 700;
  390. }
  391. .blueBG {
  392. background: linear-gradient(
  393. 180deg,
  394. rgba(224, 234, 251, 0.2) 0%,
  395. rgba(54, 130, 252, 0.3) 100%
  396. );
  397. }
  398. .greenBG {
  399. background: linear-gradient(
  400. 180deg,
  401. rgb(211, 246, 228, 0.2) 0%,
  402. rgb(23, 196, 105, 0.3) 100%
  403. );
  404. }
  405. .depth_box {
  406. display: flex;
  407. flex-wrap: wrap;
  408. height: 100%;
  409. width: 95%;
  410. margin: 0 auto;
  411. overflow: hidden;
  412. justify-content: space-between;
  413. }
  414. .depth {
  415. width: calc(100% / 5 - 10px);
  416. display: flex;
  417. flex-direction: column;
  418. align-items: center;
  419. justify-content: center;
  420. }
  421. .depth > span:nth-child(1) {
  422. font-size: 14px;
  423. font-weight: 700;
  424. margin: 0 0 10px;
  425. }
  426. .depth > div:nth-child(1) {
  427. }
  428. </style>