LearnHelper.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398
  1. /* 学习助手 */
  2. <template>
  3. <div class="learn_container">
  4. <el-card class="header" style="padding-bottom: 0">
  5. <div class="tab">
  6. <div
  7. class="tab_item"
  8. :class="tabActive == 0 ? 'tab_active' : ''"
  9. @click="switchTab(0)"
  10. >
  11. 收藏夹
  12. </div>
  13. <div
  14. class="tab_item"
  15. :class="tabActive == 1 ? 'tab_active' : ''"
  16. @click="switchTab(1)"
  17. >
  18. 错题本
  19. </div>
  20. <div
  21. class="tab_item"
  22. :class="tabActive == 2 ? 'tab_active' : ''"
  23. @click="switchTab(2)"
  24. >
  25. 学习记录
  26. </div>
  27. </div>
  28. <div class="radio_contianer" v-show="tabActive == 0">
  29. <div style="margin-bottom: 16px">
  30. <span>类型</span>
  31. <el-radio-group v-model="form.type" size="mini" @change="toggleType">
  32. <el-radio-button
  33. :label="item.type"
  34. v-for="item in types"
  35. :key="item.type"
  36. >{{ item.name }}</el-radio-button
  37. >
  38. </el-radio-group>
  39. </div>
  40. <div style="margin-bottom: 16px">
  41. <span>学科</span>
  42. <el-radio-group
  43. v-model="form.subjectName"
  44. size="mini"
  45. @change="toggleSub"
  46. >
  47. <el-radio-button
  48. :label="item"
  49. v-for="(item, index) in subjects"
  50. :key="index"
  51. >{{ item }}</el-radio-button
  52. >
  53. </el-radio-group>
  54. </div>
  55. <div style="margin-bottom: 16px" v-if="form.type == 'question'">
  56. <span>题型</span>
  57. <el-radio-group
  58. v-model="form.qtype"
  59. size="mini"
  60. @change="toggleQueType"
  61. >
  62. <el-radio-button
  63. :label="item"
  64. v-for="(item, index) in queTypes"
  65. :key="index"
  66. >{{ item }}</el-radio-button
  67. >
  68. </el-radio-group>
  69. </div>
  70. </div>
  71. <div class="radio_contianer" v-show="tabActive == 1">
  72. <div style="margin-bottom: 16px">
  73. <span>科目</span>
  74. <el-radio-group
  75. v-model="form.worngSubjectName"
  76. size="mini"
  77. @change="toggleWrongSub"
  78. >
  79. <el-radio-button
  80. :label="item"
  81. v-for="(item, index) in wrongSubject"
  82. :key="index"
  83. >{{ item }}</el-radio-button
  84. >
  85. </el-radio-group>
  86. </div>
  87. <div style="margin-bottom: 16px">
  88. <span>题型</span>
  89. <el-radio-group
  90. v-model="form.wrongType"
  91. size="mini"
  92. @change="toggleWrongType"
  93. >
  94. <el-radio-button
  95. :label="item"
  96. v-for="(item, index) in wrongTypes"
  97. :key="index"
  98. >{{ item }}</el-radio-button
  99. >
  100. </el-radio-group>
  101. </div>
  102. </div>
  103. </el-card>
  104. <!-- 收藏夹 -->
  105. <div class="shoucan_content" v-show="tabActive == 0">
  106. <!-- 试题收藏 -->
  107. <div class="topic" v-show="form.type == 'question'">
  108. <!-- 题目 -->
  109. <div class="paper_questions" id="collect-question">
  110. <div
  111. class="que_item"
  112. v-for="(item, index) in collectQue"
  113. :key="item.id"
  114. >
  115. <div class="que_content" style="display: flex">
  116. <div>{{ index + 1 }}.</div>
  117. <div v-html="item.title"></div>
  118. </div>
  119. <div class="option" v-if="item.optionA">
  120. <div style="margin-right: 5px">A:</div>
  121. <div v-html="item.optionA"></div>
  122. </div>
  123. <div class="option" v-if="item.optionB">
  124. <div style="margin-right: 5px">B:</div>
  125. <div v-html="item.optionB"></div>
  126. </div>
  127. <div class="option" v-if="item.optionC">
  128. C:
  129. <div v-html="item.optionC"></div>
  130. </div>
  131. <div class="option" v-if="item.optionD">
  132. <div style="margin-right: 5px">D:</div>
  133. <div v-html="item.optionD"></div>
  134. </div>
  135. <div class="que_footer">
  136. <div class="spans">
  137. <span class="id">ID: {{ item.id }}</span>
  138. <span>题型: {{ item.qtpye }}</span>
  139. <span>难度: 一般</span>
  140. </div>
  141. <div class="operation">
  142. <div class="shoucan">
  143. <div
  144. v-show="item.collect"
  145. @click="toCancelCollectQue(item)"
  146. style="display: flex; align-items: center"
  147. >
  148. <img
  149. src="@/assets/images/icon_shoucang_s.png"
  150. style="margin-right: 8px"
  151. />
  152. <span>已收藏</span>
  153. </div>
  154. <div
  155. v-show="!item.collect"
  156. @click="toCollectQue(item)"
  157. style="display: flex; align-items: center"
  158. >
  159. <img
  160. src="@/assets/images/icon_shoucang_n.png"
  161. style="margin-right: 8px"
  162. />
  163. <span>收藏</span>
  164. </div>
  165. </div>
  166. <div class="detail" @click="viewDetail(index)">
  167. <img src="@/assets/images/icon_chakan.png" alt="" />
  168. <span>查看解析>></span>
  169. </div>
  170. <div class="addQue">
  171. <i
  172. class="el-icon-shopping-cart-2"
  173. style="margin-right: 5px"
  174. ></i>
  175. <span>加入选题</span>
  176. </div>
  177. </div>
  178. </div>
  179. <div
  180. class="parse"
  181. v-show="item.createTime"
  182. v-html="item.parse"
  183. ></div>
  184. </div>
  185. </div>
  186. </div>
  187. <!-- 试卷收藏 -->
  188. <div class="exam" v-show="form.type == 'paper'">
  189. <div class="paper_container">
  190. <div class="paper_item" v-for="item in collectPaper" :key="item.id">
  191. <div class="tit">
  192. <div>{{ item.papername }}</div>
  193. <div class="viewCount">
  194. <img src="@/assets/images/icon_eye.png" alt="" />
  195. <span>{{item.readNum}}人已预览</span>
  196. </div>
  197. </div>
  198. <div class="opera">
  199. <div class="view" @click="toPreView(item.id, item.papername)">
  200. <img
  201. style="margin-right: 8px"
  202. src="@/assets/images/icon_view.png"
  203. alt=""
  204. />
  205. <span>预览</span>
  206. </div>
  207. <div class="download">下载</div>
  208. <div>
  209. <img
  210. src="@/assets/images/icon_shoucang_s.png"
  211. alt=""
  212. style="margin-right: 8px"
  213. />
  214. <span>已收藏</span>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. </div>
  220. <!-- 分页 -->
  221. <div style="display: flex; justify-content: center; margin-top: 92px">
  222. <el-pagination
  223. layout="prev, pager, next"
  224. :total="total"
  225. :current-page="pageNum"
  226. :page-size="pageSize"
  227. @prev-click="prev"
  228. @next-click="next"
  229. >
  230. </el-pagination>
  231. </div>
  232. </div>
  233. <!-- 错题本 -->
  234. <div class="mis_content" v-show="tabActive == 1">
  235. <div class="topic">
  236. <!-- 题目 -->
  237. <div class="paper_questions" id="wrong-question">
  238. <div
  239. class="que_item"
  240. v-for="(item, index) in wrongQues"
  241. :key="item.id"
  242. >
  243. <div class="que_content" style="display: flex">
  244. <div>{{ index + 1 }}.</div>
  245. <div v-html="item.title"></div>
  246. </div>
  247. <div class="option" v-if="item.optionA">
  248. <div style="margin-right: 5px">A:</div>
  249. <div v-html="item.optionA"></div>
  250. </div>
  251. <div class="option" v-if="item.optionB">
  252. <div style="margin-right: 5px">B:</div>
  253. <div v-html="item.optionB"></div>
  254. </div>
  255. <div class="option" v-if="item.optionC">
  256. C:
  257. <div v-html="item.optionC"></div>
  258. </div>
  259. <div class="option" v-if="item.optionD">
  260. <div style="margin-right: 5px">D:</div>
  261. <div v-html="item.optionD"></div>
  262. </div>
  263. <div class="que_footer">
  264. <div class="spans">
  265. <span>题型: {{ item.qtpye }}</span>
  266. <span>难度: 一般</span>
  267. </div>
  268. <div class="operation">
  269. <div class="delete" style="display: flex; align-items: center">
  270. <div
  271. style="margin-right: 24px; cursor: pointer display: flex;align-items: center;"
  272. @click="toDeleteWrongQue(item.id, index)"
  273. >
  274. <img
  275. src="@/assets/images/icon_wrong.png"
  276. style="margin-right: 8px"
  277. />
  278. <span>删除错题</span>
  279. </div>
  280. </div>
  281. <div class="detail" @click="viewWrongDetail(index)">
  282. <img src="@/assets/images/icon_chakan.png" alt="" />
  283. <span>查看解析>></span>
  284. </div>
  285. </div>
  286. </div>
  287. <div
  288. class="parse"
  289. v-show="item.createTime"
  290. v-html="item.parse"
  291. ></div>
  292. </div>
  293. </div>
  294. </div>
  295. <!-- 错题分页 -->
  296. <div style="display: flex; justify-content: center; margin-top: 92px">
  297. <el-pagination
  298. layout="prev, pager, next"
  299. :total="wrongForm.total"
  300. :current-page="wrongForm.pageNum"
  301. :page-size="wrongForm.pageSize"
  302. @prev-click="wrongPrev"
  303. @next-click="wrongNext"
  304. >
  305. </el-pagination>
  306. </div>
  307. </div>
  308. <!-- 学习记录 -->
  309. <div class="record_content" v-show="tabActive == 2">
  310. <div class="record_contian">
  311. <div class="tit">数据统计(总)</div>
  312. <div style="display: flex; justify-content: space-between">
  313. <div class="count_item">
  314. <img src="" alt="" />
  315. <div class="count_intro">
  316. <p style="color: #ff974d">{{ learnInfo.videoCount }}</p>
  317. <p class="gary">共看完视频(节)</p>
  318. </div>
  319. </div>
  320. <div class="count_item">
  321. <img src="" alt="" />
  322. <div class="count_intro">
  323. <p style="color: #89928a">{{ learnInfo.videoMinutes }}</p>
  324. <p class="gary">共看完视频时长(分钟)</p>
  325. </div>
  326. </div>
  327. <div class="count_item">
  328. <img src="" alt="" />
  329. <div class="count_intro">
  330. <p style="color: #86dcf2">{{ learnInfo.questionCount }}</p>
  331. <p class="gary">共完成习题</p>
  332. </div>
  333. </div>
  334. <div class="count_item">
  335. <img src="" alt="" />
  336. <div class="count_intro">
  337. <p style="color: #ee625c">
  338. {{
  339. learnInfo.correctPercent == "" ? 0 : learnInfo.correctPercent
  340. }}
  341. </p>
  342. <p class="gary">正确率</p>
  343. </div>
  344. </div>
  345. </div>
  346. </div>
  347. <div class="record_contian">
  348. <div class="tit">数据统计(周)</div>
  349. <el-form
  350. :inline="true"
  351. :model="dateForm"
  352. :rules="dateRule"
  353. ref="ruleForm"
  354. class="demo-form-inline"
  355. >
  356. <div class="date_contain">
  357. <el-form-item label="日期" prop="year">
  358. <el-select
  359. v-model="dateForm.year"
  360. placeholder="年份"
  361. size="small"
  362. >
  363. <el-option
  364. v-for="(item, index) in dateYears"
  365. :key="index"
  366. :value="item"
  367. :label="item + '年'"
  368. >
  369. </el-option>
  370. </el-select>
  371. </el-form-item>
  372. <el-form-item label="" prop="month">
  373. <el-select
  374. v-model="dateForm.month"
  375. placeholder="月份"
  376. size="small"
  377. >
  378. <el-option
  379. v-for="(item, index) in dateMonth"
  380. :key="index"
  381. :value="item"
  382. :label="item + '月'"
  383. >
  384. </el-option>
  385. </el-select>
  386. </el-form-item>
  387. <el-form-item label="周" prop="week">
  388. <el-select
  389. v-model="dateForm.week"
  390. placeholder="第几周"
  391. size="small"
  392. >
  393. <el-option
  394. v-for="(item, index) in dateWeek"
  395. :key="index"
  396. :value="item"
  397. :label="'第' + item + '周'"
  398. >
  399. </el-option>
  400. </el-select>
  401. </el-form-item>
  402. <el-button
  403. style="margin-left: 24px; width: 100px; height: 40px"
  404. type="primary"
  405. icon="el-icon-search"
  406. @click="searchData"
  407. ></el-button>
  408. </div>
  409. </el-form>
  410. <div style="display: flex; justify-content: space-around">
  411. <div style="width: 300px; height: 269px" id="echarts_quecount"></div>
  412. <div style="width: 320px; height: 269px" id="echarts_queBySub"></div>
  413. <div
  414. style="width: 300px; height: 269px"
  415. id="echarts_videocount"
  416. ></div>
  417. <div style="width: 320px; height: 269px" id="echarts_vidBysub"></div>
  418. </div>
  419. </div>
  420. <div class="record_contian">
  421. <div class="tit">学习记录</div>
  422. <div class="video_contian" v-if="videoRecord.length > 0">
  423. <div class="video_item" v-for="item in videoRecord" :key="item.id">
  424. <img :src="item.pict" alt="" />
  425. <p>{{ item.title }}</p>
  426. <p>
  427. {{ item.percent > 90 ? "已看完" : "观看" + item.percent + "%" }}
  428. </p>
  429. </div>
  430. </div>
  431. <div class="empty" v-else>
  432. <img src="@/assets/images/icon_data.png" />
  433. <span>没有信息</span>
  434. </div>
  435. </div>
  436. <div class="record_contian">
  437. <div class="tit">知识点诊断记录</div>
  438. <div>
  439. <el-table :data="knowRecord" style="width: 100%">
  440. <el-table-column prop="day" label="日期"> </el-table-column>
  441. <el-table-column prop="coursename" label="科目"> </el-table-column>
  442. <el-table-column prop="knowledgeName" label="知识点" width="500">
  443. </el-table-column>
  444. <el-table-column label="用时">
  445. <template slot-scope="scope">
  446. {{
  447. scope.row.seconds != "null"
  448. ? Math.ceil(scope.row.seconds / 60) + "分钟"
  449. : scope.row.seconds
  450. }}
  451. </template>
  452. </el-table-column>
  453. <el-table-column prop="wrongs" label="正确率">
  454. <template slot-scope="scope">
  455. {{ (scope.row.rights / 10) * 100 }}%
  456. </template>
  457. </el-table-column>
  458. <template slot="empty">
  459. <div class="empty">
  460. <img src="@/assets/images/icon_data.png" />
  461. <span>没有信息</span>
  462. </div>
  463. </template>
  464. </el-table>
  465. </div>
  466. </div>
  467. </div>
  468. </div>
  469. </template>
  470. <script>
  471. import {
  472. favSubjects,
  473. favQueTypes,
  474. favQuestions,
  475. favPapers,
  476. wrongSubjects,
  477. wrongTypes,
  478. wrongQuestions,
  479. deleteWrongQuestion,
  480. summary,
  481. questionStatsByDay,
  482. videoStatsBySubject,
  483. videoStatsByDay,
  484. questionStatsBySubject,
  485. videoWatchRecords,
  486. knowRecords,
  487. queCancelCollect,
  488. queCollect,
  489. } from "@/api/webApi/webQue.js";
  490. const echarts = require("echarts/lib/echarts");
  491. require("echarts/lib/component/title");
  492. require("echarts/lib/component/tooltip");
  493. require("echarts/lib/component/grid");
  494. require("echarts/lib/component/legend");
  495. require("echarts/lib/chart/line");
  496. require("echarts/lib/chart/pie");
  497. var date = new Date();
  498. var myChart1;
  499. var myChart2;
  500. var myChart3;
  501. var myChart4;
  502. var flag = 1;
  503. export default {
  504. data() {
  505. return {
  506. tabActive: 0,
  507. dateYears: [2021, 2020],
  508. dateMonth: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
  509. dateWeek: [1, 2, 3, 4, 5],
  510. form: {
  511. type: "",
  512. subjectName: "",
  513. qtype: "",
  514. worngSubjectName: "",
  515. wrongType: "",
  516. },
  517. types: [
  518. { type: "question", name: "试题收藏" },
  519. { type: "paper", name: "试卷收藏" },
  520. ],
  521. subjects: [],
  522. queTypes: [],
  523. collectQue: [],
  524. collectPaper: [],
  525. wrongSubject: [],
  526. wrongTypes: [],
  527. pageSize: 10,
  528. pageNum: 1,
  529. total: 0,
  530. wrongQues: [],
  531. wrongForm: {
  532. total: 0,
  533. pageSize: 10,
  534. pageNum: 1,
  535. },
  536. learnInfo: {},
  537. dateForm: {
  538. year: date.getFullYear(),
  539. month: date.getMonth() + 1,
  540. week: date.getDay / 7 > 0 ? date.getDay / 7 : 5,
  541. },
  542. dateRule: {
  543. year: [{ required: true, message: "请选择年份", trigger: "change" }],
  544. month: [{ required: true, message: "请选择月份", trigger: "change" }],
  545. week: [{ required: true, message: "请选择周数", trigger: "change" }],
  546. },
  547. knowRecord: [],
  548. videoRecord: [],
  549. // 数据统计-做题数量
  550. queCountOption: {
  551. title: {
  552. text: "做题数目(道数)",
  553. textStyle: {
  554. color: "#676767",
  555. fontWeight: "400",
  556. fontSize: 16,
  557. },
  558. },
  559. tooltip: {
  560. trigger: "axis",
  561. },
  562. xAxis: {
  563. type: "category",
  564. data: ["周一", "周二", "周三", "周四", "周五", "周六", "周七"],
  565. axisTick: {
  566. show: false,
  567. },
  568. },
  569. yAxis: {
  570. type: "value",
  571. axisTick: {
  572. show: false,
  573. },
  574. axisLine: { show: false },
  575. },
  576. series: [
  577. {
  578. data: [0, 0, 0, 0, 0, 0, 0],
  579. type: "line",
  580. name: "做题数",
  581. lineStyle: {
  582. color: "#47c6a2",
  583. width: 2,
  584. },
  585. itemStyle: {
  586. normal: {
  587. color: "#47c6a2",
  588. borderColor: "#47c6a2", //拐点边框颜色
  589. },
  590. },
  591. },
  592. ],
  593. },
  594. // 数据统计-视频时长
  595. videoCountOption: {
  596. title: {
  597. text: "看视频时长(分钟)",
  598. textStyle: {
  599. color: "#676767",
  600. fontWeight: "400",
  601. fontSize: 16,
  602. },
  603. },
  604. tooltip: {
  605. trigger: "axis",
  606. },
  607. xAxis: {
  608. type: "category",
  609. data: ["周一", "周二", "周三", "周四", "周五", "周六", "周七"],
  610. axisTick: {
  611. show: false,
  612. },
  613. },
  614. yAxis: {
  615. type: "value",
  616. axisTick: {
  617. show: false,
  618. },
  619. axisLine: { show: false },
  620. },
  621. series: [
  622. {
  623. data: [0, 0, 0, 0, 0, 0, 0],
  624. type: "line",
  625. name: "观看时长",
  626. lineStyle: {
  627. color: "#2EC7C9",
  628. width: 2,
  629. },
  630. itemStyle: {
  631. normal: {
  632. color: "#2EC7C9",
  633. borderColor: "#2EC7C9", //拐点边框颜色
  634. },
  635. },
  636. },
  637. ],
  638. },
  639. // 数据统计-做题数量 根据科目
  640. queSubCount: {
  641. title: {
  642. text: "学科分类数据(道数)",
  643. textStyle: {
  644. color: "#676767",
  645. fontWeight: "400",
  646. fontSize: 16,
  647. },
  648. },
  649. tooltip: {
  650. trigger: "item",
  651. },
  652. color: [
  653. "#5B8FF9",
  654. "#5AD8A6",
  655. "#DEEAFF",
  656. "#FFE18B",
  657. "#FEB3A2",
  658. "#BAEF83",
  659. "#DBC7FA",
  660. "#FFE6D2",
  661. "#76DDDC",
  662. ],
  663. legend: {
  664. orient: "vertical",
  665. left: "right",
  666. align: "left",
  667. icon: "circle",
  668. top: "20",
  669. },
  670. series: [
  671. {
  672. name: "做题数",
  673. type: "pie",
  674. radius: "70%",
  675. data: [
  676. { value: 0, name: "语文" },
  677. { value: 0, name: "数学" },
  678. { value: 0, name: "英语" },
  679. { value: 0, name: "物理" },
  680. { value: 0, name: "化学" },
  681. { value: 0, name: "生物" },
  682. { value: 0, name: "历史" },
  683. { value: 0, name: "地理" },
  684. { value: 0, name: "政治" },
  685. ],
  686. left: "-80",
  687. label: {
  688. position: "inside",
  689. formatter: "{c}",
  690. color: "#000000",
  691. },
  692. labelLine: {
  693. show: false,
  694. },
  695. },
  696. ],
  697. },
  698. // 数据统计-视频时长 根据科目
  699. vidSubCount: {
  700. title: {
  701. text: "学科分类数据(分钟)",
  702. textStyle: {
  703. color: "#676767",
  704. fontWeight: "400",
  705. fontSize: 16,
  706. },
  707. },
  708. tooltip: {
  709. trigger: "item",
  710. },
  711. color: [
  712. "#5B8FF9",
  713. "#5AD8A6",
  714. "#DEEAFF",
  715. "#FFE18B",
  716. "#FEB3A2",
  717. "#BAEF83",
  718. "#DBC7FA",
  719. "#FFE6D2",
  720. "#76DDDC",
  721. ],
  722. legend: {
  723. orient: "vertical",
  724. left: "right",
  725. align: "left",
  726. icon: "circle",
  727. top: "20",
  728. },
  729. series: [
  730. {
  731. name: "做题时长",
  732. type: "pie",
  733. radius: "70%",
  734. data: [
  735. { value: 0, name: "语文" },
  736. { value: 0, name: "数学" },
  737. { value: 0, name: "英语" },
  738. { value: 0, name: "物理" },
  739. { value: 0, name: "化学" },
  740. { value: 0, name: "生物" },
  741. { value: 0, name: "历史" },
  742. { value: 0, name: "地理" },
  743. { value: 0, name: "政治" },
  744. ],
  745. label: {
  746. position: "inside",
  747. formatter: "{c}",
  748. color: "#000000",
  749. },
  750. left: "-80",
  751. labelLine: {
  752. show: false,
  753. },
  754. },
  755. ],
  756. },
  757. };
  758. },
  759. created() {
  760. // 设置默认高亮
  761. this.tabActive = this.$route.query.tabActive
  762. ? this.$route.query.tabActive
  763. : 0;
  764. if (this.tabActive == 1) {
  765. this.switchTab(1);
  766. } else if (this.tabActive == 2) {
  767. this.switchTab(2);
  768. } else {
  769. this.toggleType("question");
  770. }
  771. },
  772. methods: {
  773. switchTab(index) {
  774. this.tabActive = index;
  775. if (this.tabActive == 1) {
  776. this.getWrongSubject();
  777. } else if (this.tabActive == 2 && flag == 1) {
  778. let queCountChart = document.getElementById("echarts_quecount");
  779. myChart1 = echarts.init(queCountChart);
  780. myChart1.setOption(this.queCountOption);
  781. let videoCountChart = document.getElementById("echarts_videocount");
  782. myChart2 = echarts.init(videoCountChart);
  783. myChart2.setOption(this.videoCountOption);
  784. let queBySubChart = document.getElementById("echarts_queBySub");
  785. myChart3 = echarts.init(queBySubChart);
  786. myChart3.setOption(this.queSubCount);
  787. let vidBySubChart = document.getElementById("echarts_vidBysub");
  788. myChart4 = echarts.init(vidBySubChart);
  789. myChart4.setOption(this.vidSubCount);
  790. flag++;
  791. }
  792. if (index == 2) {
  793. this.getSummary();
  794. this.searchData();
  795. }
  796. },
  797. toggleType(e) {
  798. this.form.type = e;
  799. this.getSubjects();
  800. },
  801. // 收藏涉及的学科
  802. getSubjects() {
  803. favSubjects({ type: this.form.type }).then((res) => {
  804. console.log(res);
  805. this.form.subjectName = res.data[0];
  806. this.subjects = res.data;
  807. if (this.form.type == "question") {
  808. this.getFavQue();
  809. } else if (this.form.type == "paper") {
  810. this.getFavPapers();
  811. }
  812. });
  813. },
  814. // 收藏涉及的题型
  815. getFavQue() {
  816. favQueTypes({ subjectName: this.form.subjectName }).then((res) => {
  817. this.form.qtype = res.data[0];
  818. this.queTypes = res.data;
  819. this.getFavQuestions();
  820. });
  821. },
  822. // 错题涉及的题型
  823. getWrongTypes() {
  824. wrongTypes({ subjectName: this.form.worngSubjectName }).then((res) => {
  825. if (res.data.length > 0) {
  826. this.form.wrongType = res.data[0];
  827. }
  828. this.wrongTypes = res.data;
  829. this.wrongForm.pageNum;
  830. this.getWrongQuestions();
  831. });
  832. },
  833. // 错题涉及的科目
  834. getWrongSubject() {
  835. wrongSubjects().then((res) => {
  836. if (res.data.length > 0) {
  837. this.form.worngSubjectName = res.data[0];
  838. }
  839. this.wrongSubject = res.data;
  840. this.getWrongTypes();
  841. });
  842. },
  843. // 错题列表
  844. getWrongQuestions() {
  845. wrongQuestions({
  846. subjectName: this.form.worngSubjectName,
  847. qtype: this.form.wrongType,
  848. pageSize: this.wrongForm.pageSize,
  849. pageNum: this.wrongForm.pageNum,
  850. }).then((res) => {
  851. this.wrongQues = res.rows;
  852. this.wrongForm.total = res.total;
  853. this.$nextTick(_=>this.mxGlobal.MathQueue('wrong-question'))
  854. console.log(res);
  855. });
  856. },
  857. // 收藏的问题列表
  858. getFavQuestions() {
  859. favQuestions({
  860. subjectName: this.form.subjectName,
  861. qtype: this.form.qtype,
  862. pageNum: this.pageNum,
  863. pageSize: this.pageSize,
  864. }).then((res) => {
  865. this.total = res.total;
  866. this.collectQue = res.rows;
  867. this.$nextTick(_=>this.mxGlobal.MathQueue('collect-question'))
  868. console.log(res);
  869. });
  870. },
  871. getFavPapers() {
  872. favPapers({
  873. subjectName: this.form.subjectName,
  874. pageNum: this.pageNum,
  875. pageSize: this.pageSize,
  876. }).then((res) => {
  877. console.log(res);
  878. this.total = res.total;
  879. this.collectPaper = res.rows;
  880. });
  881. },
  882. toggleSub() {
  883. this.pageNum == 1;
  884. if (this.form.type == "paper") {
  885. this.getFavPapers();
  886. } else {
  887. this.getFavQue();
  888. }
  889. },
  890. toggleQueType() {
  891. this.pageNum == 1;
  892. this.getFavQuestions();
  893. },
  894. viewDetail(index) {
  895. if (this.collectQue[index].createTime) {
  896. this.collectQue[index].createTime = false;
  897. } else {
  898. this.collectQue[index].createTime = true;
  899. }
  900. },
  901. viewWrongDetail(index) {
  902. if (this.wrongQues[index].createTime) {
  903. this.wrongQues[index].createTime = false;
  904. } else {
  905. this.wrongQues[index].createTime = true;
  906. }
  907. },
  908. // 跳转到预览页面
  909. toPreView(paperId, paperName) {
  910. this.$router.push({
  911. path: "/question-center/bestPaper/preview",
  912. query: { paperId, paperName },
  913. });
  914. },
  915. prev() {
  916. this.pageNum = this.pageNum - 1;
  917. if (this.form.type == "question") {
  918. this.getFavQuestions();
  919. } else {
  920. }
  921. },
  922. next() {
  923. this.pageNum = this.pageNum + 1;
  924. if (this.form.type == "question") {
  925. this.getFavQuestions();
  926. } else {
  927. this.getFavPapers();
  928. }
  929. },
  930. toDeleteWrongQue(id, index) {
  931. this.wrongQues.splice(index, 1);
  932. deleteWrongQuestion({ questionId: id }).then((res) => {
  933. this.msgSuccess("删除成功");
  934. console.log(res);
  935. });
  936. },
  937. toggleWrongType() {
  938. this.wrongForm.pageNum = 1;
  939. this.getWrongQuestions();
  940. },
  941. toggleWrongSub() {
  942. this.getWrongTypes();
  943. },
  944. wrongNext() {
  945. this.wrongForm.pageNum++;
  946. this.getWrongQuestions();
  947. },
  948. wrongPrev() {
  949. this.wrongForm.pageNum--;
  950. this.getWrongQuestions();
  951. },
  952. getSummary() {
  953. summary().then((res) => {
  954. this.learnInfo = res.data;
  955. console.log(res);
  956. });
  957. },
  958. // 数据统计-做题数量-按天
  959. getQuestionStatsByDay() {
  960. questionStatsByDay({
  961. year: this.dateForm.year,
  962. month: this.dateForm.month,
  963. week: this.dateForm.week,
  964. }).then((res) => {
  965. let arr = [];
  966. const kesArr = Object.keys(res.data).sort();
  967. for (const key of kesArr) {
  968. arr.push(res.data[key]);
  969. }
  970. this.queCountOption.series[0].data = arr;
  971. myChart1.setOption(this.queCountOption);
  972. });
  973. },
  974. // 数据统计-视频观看时长 - 按天
  975. getVideoStatsByDay() {
  976. videoStatsByDay({
  977. year: this.dateForm.year,
  978. month: this.dateForm.month,
  979. week: this.dateForm.week,
  980. }).then((res) => {
  981. let arr = [];
  982. const kesArr = Object.keys(res.data).sort();
  983. for (const key of kesArr) {
  984. arr.push(res.data[key]);
  985. }
  986. this.videoCountOption.series[0].data = arr;
  987. myChart2.setOption(this.videoCountOption);
  988. });
  989. },
  990. // 数据统计-视频观看时长 - 按学科
  991. getVideoStatsBySubject() {
  992. videoStatsBySubject({
  993. year: this.dateForm.year,
  994. month: this.dateForm.month,
  995. week: this.dateForm.week,
  996. }).then((res) => {
  997. console.log(res);
  998. if (Object.keys(res.data).length > 0) {
  999. console.log(res);
  1000. let objArr = [];
  1001. for (const key in res.data) {
  1002. objArr.push({ name: key, value: res.data[key] });
  1003. }
  1004. console.log(objArr);
  1005. this.vidSubCount.series[0].data = objArr;
  1006. myChart4.setOption(this.vidSubCount);
  1007. } else {
  1008. this.vidSubCount.series[0].data = [
  1009. { value: 0, name: "语文" },
  1010. { value: 0, name: "数学" },
  1011. { value: 0, name: "英语" },
  1012. { value: 0, name: "物理" },
  1013. { value: 0, name: "化学" },
  1014. { value: 0, name: "生物" },
  1015. { value: 0, name: "历史" },
  1016. { value: 0, name: "地理" },
  1017. { value: 0, name: "政治" },
  1018. ];
  1019. myChart4.setOption(this.vidSubCount);
  1020. }
  1021. });
  1022. },
  1023. // 数据统计-做题数量 - 按学科
  1024. getQuestionStatsBySubject() {
  1025. questionStatsBySubject({
  1026. year: this.dateForm.year,
  1027. month: this.dateForm.month,
  1028. week: this.dateForm.week,
  1029. }).then((res) => {
  1030. if (Object.keys(res.data).length > 0) {
  1031. console.log(res);
  1032. let objArr = [];
  1033. for (const key in res.data) {
  1034. objArr.push({ name: key, value: res.data[key] });
  1035. }
  1036. console.log(objArr);
  1037. this.queSubCount.series[0].data = objArr;
  1038. myChart3.setOption(this.queSubCount);
  1039. } else {
  1040. this.queSubCount.series[0].data = [
  1041. { value: 0, name: "语文" },
  1042. { value: 0, name: "数学" },
  1043. { value: 0, name: "英语" },
  1044. { value: 0, name: "物理" },
  1045. { value: 0, name: "化学" },
  1046. { value: 0, name: "生物" },
  1047. { value: 0, name: "历史" },
  1048. { value: 0, name: "地理" },
  1049. { value: 0, name: "政治" },
  1050. ];
  1051. myChart3.setOption(this.queSubCount);
  1052. }
  1053. });
  1054. },
  1055. // 视频学习记录
  1056. getVideoRecord() {
  1057. videoWatchRecords({
  1058. year: this.dateForm.year,
  1059. month: this.dateForm.month,
  1060. week: this.dateForm.week,
  1061. }).then((res) => {
  1062. this.videoRecord = res.data;
  1063. console.log(res);
  1064. });
  1065. },
  1066. // 知识点诊断记录
  1067. getKnowRecords() {
  1068. knowRecords({
  1069. year: this.dateForm.year,
  1070. month: this.dateForm.month,
  1071. week: this.dateForm.week,
  1072. }).then((res) => {
  1073. this.knowRecord = res.data;
  1074. console.log(this.knowRecord);
  1075. });
  1076. },
  1077. searchData() {
  1078. console.log(this.dateForm);
  1079. this.$refs.ruleForm.validate((valid) => {
  1080. if (valid) {
  1081. this.getQuestionStatsByDay();
  1082. this.getVideoStatsByDay();
  1083. this.getQuestionStatsBySubject();
  1084. this.getVideoStatsBySubject();
  1085. this.getVideoRecord();
  1086. this.getKnowRecords();
  1087. /* this.getVideoStatsByDay();
  1088. this.getQuestionStatsBySubject(); */
  1089. } else {
  1090. console.log("error submit!!");
  1091. return false;
  1092. }
  1093. });
  1094. },
  1095. toCollectQue(item) {
  1096. queCollect({ questionId: item.id }).then((res) => {
  1097. item.collect = !item.collect;
  1098. this.msgSuccess("收藏成功");
  1099. console.log(res);
  1100. });
  1101. },
  1102. toCancelCollectQue(item) {
  1103. queCancelCollect({ questionId: item.id }).then((res) => {
  1104. item.collect = !item.collect;
  1105. this.msgSuccess("取消收藏成功");
  1106. console.log(res);
  1107. });
  1108. },
  1109. },
  1110. };
  1111. </script>
  1112. <style scoped>
  1113. .empty {
  1114. display: flex;
  1115. justify-content: center;
  1116. flex-direction: column;
  1117. align-items: center;
  1118. font-size: 14px;
  1119. color: #909399;
  1120. }
  1121. .option {
  1122. padding-left: 33px;
  1123. display: flex;
  1124. margin-bottom: 10px;
  1125. }
  1126. .learn_container {
  1127. padding: 20px;
  1128. background: #f7f7f7;
  1129. min-height: 100vh;
  1130. }
  1131. .header {
  1132. margin-bottom: 16px;
  1133. }
  1134. .mis_content,
  1135. .shoucan_content {
  1136. background: #fff;
  1137. padding: 32px 28px;
  1138. }
  1139. .record_content {
  1140. padding: 32px 28px;
  1141. }
  1142. .record_content .record_contian {
  1143. border-radius: 8px;
  1144. margin-bottom: 20px;
  1145. background: #fff;
  1146. padding: 32px 28px;
  1147. }
  1148. .record_content .record_contian .tit {
  1149. color: #47c6a2;
  1150. margin-bottom: 36px;
  1151. }
  1152. .record_content .record_contian .count_item img {
  1153. margin-right: 16px;
  1154. }
  1155. .tab {
  1156. display: flex;
  1157. margin-bottom: 14px;
  1158. border-bottom: 1px solid #dedede;
  1159. }
  1160. .delete > div:first-child > span {
  1161. color: #f44949;
  1162. }
  1163. .tab .tab_item {
  1164. flex: 1;
  1165. text-align: center;
  1166. font-size: 16px;
  1167. font-family: PingFangSC-Medium, PingFang SC;
  1168. font-weight: 500;
  1169. line-height: 22px;
  1170. padding-bottom: 28px;
  1171. position: relative;
  1172. }
  1173. .tab .tab_active {
  1174. color: #47c6a2;
  1175. }
  1176. .tab .tab_active::after {
  1177. content: "";
  1178. height: 4px;
  1179. width: 100%;
  1180. background: #47c6a2;
  1181. position: absolute;
  1182. transform: translateY(50%);
  1183. left: 0;
  1184. bottom: 0;
  1185. }
  1186. .tab .tab_item:hover {
  1187. color: #47c6a2;
  1188. }
  1189. .tab .tab_item:hover::after {
  1190. content: "";
  1191. width: 100%;
  1192. height: 4px;
  1193. position: absolute;
  1194. background: #47c6a2;
  1195. left: 0;
  1196. transform: translateY(50%);
  1197. bottom: 0;
  1198. }
  1199. .que_item {
  1200. border-radius: 1px;
  1201. border: 1px solid #dedede;
  1202. margin-bottom: 8px;
  1203. }
  1204. .que_content {
  1205. padding: 12px 24px 0 33px;
  1206. font-size: 14px;
  1207. font-family: PingFangSC-Medium, PingFang SC;
  1208. font-weight: 500;
  1209. color: #4c4c4c;
  1210. line-height: 27px;
  1211. margin-bottom: 40px;
  1212. }
  1213. .que_footer {
  1214. border-top: 1px solid #dedede;
  1215. padding-left: 33px;
  1216. overflow: hidden;
  1217. padding-bottom: 23px;
  1218. padding-top: 21px;
  1219. }
  1220. .que_footer .spans {
  1221. float: left;
  1222. font-size: 12px;
  1223. font-family: PingFangSC-Regular, PingFang SC;
  1224. font-weight: 400;
  1225. color: #979797;
  1226. line-height: 20px;
  1227. }
  1228. .que_footer .spans > span {
  1229. margin-right: 20px;
  1230. }
  1231. .operation {
  1232. display: flex;
  1233. align-items: center;
  1234. font-size: 14px;
  1235. font-family: PingFangSC-Regular, PingFang SC;
  1236. font-weight: 400;
  1237. color: #47c6a2;
  1238. line-height: 20px;
  1239. justify-content: flex-end;
  1240. }
  1241. .operation > div {
  1242. display: flex;
  1243. align-items: center;
  1244. cursor: pointer;
  1245. }
  1246. .operation .shoucan {
  1247. margin-right: 46px;
  1248. }
  1249. .operation .detail span {
  1250. border-radius: 1px;
  1251. border-bottom: 1px solid #47c6a2;
  1252. }
  1253. .operation .detail {
  1254. margin-right: 32px;
  1255. }
  1256. .operation > div > img {
  1257. margin-right: 10px;
  1258. }
  1259. .operation .addQue {
  1260. padding: 7px;
  1261. border-radius: 4px;
  1262. border: 1px solid #979797;
  1263. margin-right: 24px;
  1264. }
  1265. .info {
  1266. padding: 12px 40px;
  1267. }
  1268. .radio_contianer > div {
  1269. margin-bottom: 16px;
  1270. display: flex;
  1271. justify-content: flex-start;
  1272. align-items: center;
  1273. }
  1274. .radio_contianer > div > span {
  1275. flex-shrink: 0;
  1276. font-size: 14px;
  1277. font-family: PingFangSC-Regular, PingFang SC;
  1278. font-weight: 400;
  1279. color: #232323;
  1280. line-height: 20px;
  1281. height: 20px;
  1282. width: 50px;
  1283. }
  1284. .paper_item {
  1285. display: flex;
  1286. align-items: center;
  1287. justify-content: space-between;
  1288. padding-right: 30px;
  1289. margin-bottom: 40px;
  1290. }
  1291. .paper_item .tit {
  1292. font-size: 16px;
  1293. font-family: PingFangSC-Medium, PingFang SC;
  1294. font-weight: 500;
  1295. color: #343434;
  1296. line-height: 22px;
  1297. }
  1298. .paper_item .viewCount {
  1299. margin-top: 16px;
  1300. color: #9f9f9f;
  1301. font-size: 14px;
  1302. display: flex;
  1303. align-items: center;
  1304. }
  1305. .paper_item .viewCount img {
  1306. margin-right: 9px;
  1307. }
  1308. .paper_item .opera {
  1309. display: flex;
  1310. justify-content: space-between;
  1311. }
  1312. .paper_item .opera > div {
  1313. cursor: pointer;
  1314. display: flex;
  1315. flex-direction: row;
  1316. align-items: center;
  1317. }
  1318. .paper_item .opera .view {
  1319. color: #47c6a2;
  1320. border-radius: 4px;
  1321. border: 1px solid #47c6a2;
  1322. padding: 6px 12px;
  1323. }
  1324. .paper_item .opera .download {
  1325. border-radius: 4px;
  1326. border: 1px solid #47c6a2;
  1327. padding: 6px 22px;
  1328. background: #47c6a2;
  1329. color: white;
  1330. margin: 0 24px;
  1331. }
  1332. .paper_item .opera > div:last-child {
  1333. color: #47c6a2;
  1334. }
  1335. .parse {
  1336. padding: 0 30px;
  1337. }
  1338. .gary {
  1339. margin-top: 8px;
  1340. font-size: 16px;
  1341. font-family: PingFangSC-Regular, PingFang SC;
  1342. font-weight: 400;
  1343. color: #7a7a7a;
  1344. line-height: 22px;
  1345. }
  1346. .date_contain > span {
  1347. display: inline-block;
  1348. border-radius: 1px;
  1349. margin-right: 16px;
  1350. font-size: 16px;
  1351. }
  1352. .el-card__body {
  1353. padding-bottom: 0;
  1354. }
  1355. .video_contian {
  1356. display: flex;
  1357. }
  1358. .video_contian img {
  1359. width: 200px;
  1360. }
  1361. .video_contian .video_item {
  1362. margin-right: 80px;
  1363. }
  1364. .video_contian .video_item > p:first-child {
  1365. color: #4a4a4a;
  1366. font-size: 14px;
  1367. margin-top: 7px;
  1368. margin-bottom: 4px;
  1369. }
  1370. .video_contian .video_item > p:last-child {
  1371. font-size: 12px;
  1372. color: #bdbdbd;
  1373. }
  1374. </style>
  1375. <style >
  1376. .el-dialog__header .el-dialog__title {
  1377. color: #47c6a2;
  1378. }
  1379. .radio_contianer .el-radio-button__inner {
  1380. border-left: 1px solid #dcdfe6;
  1381. }
  1382. .radio_contianer .el-radio-button .el-radio-button__inner {
  1383. border-radius: 16px;
  1384. margin-bottom: 5px;
  1385. }
  1386. .radio_contianer .el-radio-button:first-child:last-child .el-radio-button__inner {
  1387. border-radius: 16px;
  1388. }
  1389. .radio_contianer .el-radio-button {
  1390. margin-right: 8px;
  1391. }
  1392. </style>