smart-online.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <template>
  2. <div>
  3. <el-card class="mb10">
  4. <mx-condition ref="condition" :query-params="queryParams" :require-fields="requireFields"
  5. @query="handleQuery" @invalid="handleInvalidQuery"></mx-condition>
  6. </el-card>
  7. <el-container>
  8. <el-aside width="284px" style="padding-bottom: 104px">
  9. <div class="aside_header">
  10. <span>CONTACT</span>
  11. <span>章节目录</span>
  12. </div>
  13. <div class="aside_content">
  14. <el-tree
  15. v-show="tabActive == 0"
  16. :data="treeList"
  17. :props="defaultProps"
  18. node-key="$treeNodeId"
  19. @node-click="clickChapterNode"
  20. highlight-current
  21. ref="treeChapter"
  22. :expand-on-click-node="false"
  23. >
  24. <template #default="{node}">
  25. <span class="width100 text-ellipsis" :title="node.label">{{ node.label }}</span>
  26. </template>
  27. </el-tree>
  28. <el-tree
  29. v-show="tabActive == 1"
  30. :data="knowTreeList"
  31. :props="knowDefaultProps"
  32. node-key="knowledgeId"
  33. @node-click="clickKnowNode"
  34. :expand-on-click-node="false"
  35. highlight-current
  36. ref="tree"
  37. >
  38. <template #default="{node}">
  39. <span class="width100 text-ellipsis" :title="node.label">{{ node.label }}</span>
  40. </template>
  41. </el-tree>
  42. </div>
  43. </el-aside>
  44. <el-main style="padding: 0; background: #fff">
  45. <div class="main_tit">
  46. <div class="tit_left" v-show="tabActive == 0">{{ chapterTitle }}</div>
  47. <div class="tit_left" v-show="tabActive == 1">{{ konwTitle }}</div>
  48. <div class="tit_right">
  49. <div>
  50. <input type="checkbox"/>
  51. <span>过滤已做题</span>
  52. </div>
  53. <div class="btn" style="cursor: pointer" @click="httpDiagnosticRecords(1)">
  54. 诊断记录
  55. </div>
  56. </div>
  57. </div>
  58. <!-- 主题内容 -->
  59. <div class="main_con" v-show="tabActive == 0">
  60. <template v-if="chapterList.length">
  61. <div class="con_item" v-for="item in chapterList" :key="item.id">
  62. <img src="@/assets/images/img_bg_tongbulianxi.png" alt=""/>
  63. <div class="con_info">
  64. <div class="tit">
  65. {{ item.chapterName }}
  66. </div>
  67. <div class="count">共{{ item.num }}题</div>
  68. <div class="btn" @click="toChapterQue(item)">马上做题</div>
  69. </div>
  70. </div>
  71. </template>
  72. <template v-else>
  73. <evaluation-empty class="width100"></evaluation-empty>
  74. </template>
  75. </div>
  76. <!-- 主题内容 -->
  77. <div class="main_con" v-show="tabActive == 1">
  78. <template v-if="knowList.length">
  79. <div class="con_item" v-for="item in knowList" :key="item.knowledgeId">
  80. <img src="@/assets/images/img_bg_tongbulianxi.png" alt=""/>
  81. <div class="con_info">
  82. <p class="tit">{{ item.knowledgeName }}</p>
  83. <p class="count">共{{ item.num }}题</p>
  84. <p class="btn" @click="toKnowQue(item)">马上做题</p>
  85. </div>
  86. </div>
  87. </template>
  88. <template v-else>
  89. <evaluation-empty class="width100"></evaluation-empty>
  90. </template>
  91. </div>
  92. </el-main>
  93. </el-container>
  94. <!-- 诊断的弹窗 -->
  95. <el-dialog
  96. title="同步在线诊断记录"
  97. :visible.sync="dialogVisible"
  98. width="50%"
  99. >
  100. <div class="tables">
  101. <el-table :data="tableData.rows" stripe style="width: 100%">
  102. <el-table-column type="index" width="50" label="序号">
  103. </el-table-column>
  104. <el-table-column prop="coursename" label="科目"></el-table-column>
  105. <el-table-column prop="day" label="日期"></el-table-column>
  106. <el-table-column label="用时">
  107. <template slot-scope="scope">
  108. <span>{{ scope.row.seconds + '秒' }}</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="正确率">
  112. <template slot-scope="scope">
  113. <span>{{ scope.row.rate + '%' }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="操作">
  117. <template slot-scope="scope">
  118. <span
  119. style="color: #47c6a2; cursor: pointer"
  120. @click="toDetails(scope.row)"
  121. >
  122. <i class="el-icon-search" style="margin-right: 4px"></i
  123. >操作</span
  124. >
  125. </template>
  126. </el-table-column>
  127. </el-table>
  128. <div class="block">
  129. <el-pagination
  130. :page-sizes="[tablePageSize]"
  131. layout="prev, pager, next"
  132. :page-count="tableData.pageNum"
  133. style="backgrond: #47c6a2"
  134. @current-change="httpDiagnosticRecords"
  135. >
  136. </el-pagination>
  137. <div class="count">
  138. 共{{ tableData.pageNum }}页 {{ tableData.total }}条
  139. </div>
  140. </div>
  141. </div>
  142. </el-dialog>
  143. </div>
  144. </template>
  145. <script>
  146. import MxCondition from '@/components/MxCondition/mx-condition'
  147. import {
  148. diagnosticRecords,
  149. getQuestionsNumByChapter,
  150. getQuestionsNumByKnowledge,
  151. knowledgeTree,
  152. chapterTree
  153. } from '@/api/webApi/webQue.js'
  154. let flag = 1
  155. export default {
  156. components: {
  157. MxCondition
  158. },
  159. props: {
  160. requireFields: {
  161. type: Array,
  162. default: []
  163. },
  164. queryParams: {
  165. type: Object,
  166. default: []
  167. },
  168. tabActive: 0
  169. },
  170. data() {
  171. return {
  172. form: {
  173. chapterId: 0,
  174. knowledgeId: 0
  175. },
  176. tablePageSize: 5,
  177. chapterTitle: '',
  178. konwTitle: '',
  179. dialogVisible: false,
  180. tableData: [],
  181. defaultProps: {
  182. children: 'children',
  183. label: 'name'
  184. },
  185. knowDefaultProps: {
  186. children: 'children',
  187. label: 'name'
  188. },
  189. treeList: [],
  190. knowTreeList: [],
  191. knowList: [],
  192. chapterList: []
  193. }
  194. },
  195. methods: {
  196. handleInvalidQuery() {
  197. // this.getTree()
  198. },
  199. handleQuery() {
  200. this.cleanBeforeQuery()
  201. if (this.tabActive == 0) {
  202. this.getTree()
  203. } else {
  204. this.getTreeByKnowledge()
  205. }
  206. },
  207. cleanBeforeQuery() {
  208. this.chapterTitle = ''
  209. this.konwTitle = ''
  210. this.knowList = []
  211. this.chapterList = []
  212. this.form.chapterId = ''
  213. this.form.knowledgeId = ''
  214. },
  215. httpDiagnosticRecords(pageNum) {
  216. diagnosticRecords({
  217. pageNum: pageNum,
  218. pageSize: this.tablePageSize,
  219. type: 1
  220. }).then((res) => {
  221. this.dialogVisible = true
  222. this.tableData = res
  223. this.tableData['pageNum'] = Math.ceil(res.total / this.tablePageSize)
  224. console.log(res)
  225. })
  226. },
  227. // 获取章节树
  228. getTree() {
  229. chapterTree({
  230. subjectId: this.queryParams.exeSubject,
  231. editionId: this.queryParams.exeOrder,
  232. gradeId: this.queryParams.exeGrade,
  233. chapterId: this.form.chapterId
  234. }).then((res) => {
  235. console.log('gettree', res)
  236. this.treeList = res.data
  237. this.$nextTick(() => {
  238. if (res.data.length > 0) {
  239. this.chapterTitle = res.data[0].name
  240. this.$refs.treeChapter.setCurrentKey(res.data[0].$treeNodeId)
  241. this.form.chapterId = res.data[0].id
  242. this.getQueByChapter()
  243. }
  244. })
  245. })
  246. },
  247. // 获取知识点树
  248. getTreeByKnowledge() {
  249. knowledgeTree({ pharseId: 3, subjectId: this.queryParams.exeSubject }).then(
  250. (res) => {
  251. this.knowTreeList = res.data
  252. this.$nextTick(() => {
  253. if (res.data.length > 0) {
  254. this.konwTitle = res.data[0].name
  255. this.form.knowledgeId = res.data[0].id
  256. this.getQueByKnowledge()
  257. }
  258. })
  259. }
  260. )
  261. },
  262. toDetails(item) {
  263. this.dialogVisible = false
  264. this.$router.push({
  265. path: '/question-center/smartExercise/answerDetailas',
  266. query: {
  267. batchno: item.batchno,
  268. info: encodeURIComponent(JSON.stringify(item))
  269. }
  270. })
  271. },
  272. // 根据章节来获取题目
  273. getQueByChapter() {
  274. if (!this.form.chapterId) return
  275. getQuestionsNumByChapter({
  276. chapterId: this.form.chapterId,
  277. subjectId: this.queryParams.exeSubject,
  278. editionId: this.queryParams.exeOrder,
  279. gradeId: this.queryParams.exeGrade
  280. }).then((res) => {
  281. this.chapterList = res.data
  282. })
  283. },
  284. // 根据知识点来获取题目
  285. getQueByKnowledge() {
  286. if (!this.form.knowledgeId) return
  287. getQuestionsNumByKnowledge({
  288. knowledgeId: this.form.knowledgeId,
  289. subjectId: this.form.subjectId
  290. }).then((res) => {
  291. this.knowList = res.data
  292. console.log(res)
  293. })
  294. },
  295. clickChapterNode(item) {
  296. this.chapterTitle = item.name
  297. this.form.chapterId = item.id
  298. this.getQueByChapter()
  299. },
  300. clickKnowNode(item) {
  301. this.form.knowledgeId = item.id
  302. this.konwTitle = item.name
  303. this.getQueByKnowledge()
  304. },
  305. // 做章节题目
  306. toChapterQue(item) {
  307. this.$router.push({
  308. path: '/question-center/smartExercise/practice',
  309. query: {
  310. chapterId: item.chapterId,
  311. title: item.chapterName,
  312. subjectId: this.queryParams.exeSubject
  313. }
  314. })
  315. },
  316. // 做知识点题目
  317. toKnowQue(item) {
  318. this.$router.push({
  319. path: '/question-center/smartExercise/practice',
  320. query: {
  321. knowledgeId: item.knowledgeId,
  322. title: item.knowledgeName,
  323. subjectId: this.queryParams.exeSubject
  324. }
  325. })
  326. }
  327. }
  328. }
  329. </script>
  330. <style scoped>
  331. .radio_contianer span {
  332. font-size: 14px;
  333. font-family: PingFangSC-Regular, PingFang SC;
  334. font-weight: 400;
  335. color: #232323;
  336. line-height: 20px;
  337. height: 20px;
  338. margin-right: 16px;
  339. }
  340. .radio_contianer .el-radio-button {
  341. margin-right: 8px;
  342. }
  343. .aside_header {
  344. background: white;
  345. display: flex;
  346. flex-direction: column;
  347. justify-content: flex-end;
  348. padding: 24px 16px 0 16px;
  349. margin-bottom: 16px;
  350. }
  351. .el-aside {
  352. background: white;
  353. padding: 0;
  354. margin-bottom: 0;
  355. margin-right: 16px;
  356. }
  357. .aside_header span {
  358. margin-top: 5px;
  359. width: 84px;
  360. height: 22px;
  361. font-size: 16px;
  362. font-family: PingFangSC-Medium, PingFang SC;
  363. font-weight: 500;
  364. color: #343434;
  365. line-height: 22px;
  366. }
  367. .aside_header span:first-child {
  368. width: 173px;
  369. height: 27px;
  370. background: linear-gradient(180deg, #ffffff 0%, #47c6a2 100%);
  371. opacity: 0.5;
  372. }
  373. .main_tit {
  374. display: flex;
  375. justify-content: space-between;
  376. padding-top: 52px;
  377. padding-bottom: 19px;
  378. border-bottom: 1px solid #eee;
  379. padding-left: 19px;
  380. margin-bottom: 23px;
  381. }
  382. .main_tit .tit_right {
  383. display: flex;
  384. justify-content: space-between;
  385. align-items: center;
  386. }
  387. .main_tit .tit_right .btn {
  388. background: #47c6a2;
  389. border-radius: 16px;
  390. padding: 6px 19px;
  391. font-size: 14px;
  392. font-family: PingFangSC-Regular, PingFang SC;
  393. font-weight: 400;
  394. color: #ffffff;
  395. margin-left: 32px;
  396. margin-right: 57px;
  397. }
  398. .tit_right input {
  399. background: #d8d8d8;
  400. margin: 0;
  401. }
  402. .tit_right span {
  403. margin-left: 8px;
  404. font-size: 14px;
  405. font-family: PingFangSC-Regular, PingFang SC;
  406. font-weight: 400;
  407. color: #47c6a2;
  408. }
  409. .main_con {
  410. display: flex;
  411. flex-wrap: wrap;
  412. padding: 0 21px 0 16px;
  413. }
  414. .main_con .con_item {
  415. position: absolute;
  416. top: 0;
  417. left: 0;
  418. width: 100%;
  419. flex: 0 0 33%;
  420. padding-right: 15px;
  421. position: relative;
  422. margin-bottom: 20px;
  423. }
  424. .main_con .con_item img {
  425. width: 100%;
  426. height: 100%;
  427. }
  428. .main_con .con_item .con_info {
  429. position: absolute;
  430. top: 24px;
  431. left: 24px;
  432. }
  433. .main_con .con_item .con_info p {
  434. margin: 0;
  435. }
  436. .main_con .con_item .con_info .tit {
  437. height: 22px;
  438. font-size: 16px;
  439. font-family: PingFangSC-Medium, PingFang SC;
  440. font-weight: 500;
  441. color: #343434;
  442. line-height: 22px;
  443. padding-right: 30px;
  444. }
  445. .main_con .con_item .con_info .count {
  446. height: 16px;
  447. font-size: 12px;
  448. font-family: PingFangSC-Regular, PingFang SC;
  449. font-weight: 400;
  450. color: #717171;
  451. line-height: 17px;
  452. margin-top: 40px;
  453. }
  454. .main_con .con_item .con_info .btn {
  455. cursor: pointer;
  456. display: inline-block;
  457. font-size: 12px;
  458. font-family: PingFangSC-Regular, PingFang SC;
  459. font-weight: 400;
  460. color: #ffffff;
  461. line-height: 17px;
  462. padding: 4px 12px;
  463. background: #47c6a2;
  464. margin-top: 10px;
  465. text-align: center;
  466. }
  467. .block {
  468. text-align: center;
  469. margin-top: 20px;
  470. position: relative;
  471. display: flex;
  472. justify-content: center;
  473. }
  474. .block > .count {
  475. top: 10px;
  476. left: 0;
  477. position: absolute;
  478. }
  479. </style>