index.vue 10 KB

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