index.vue 67 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930
  1. <template>
  2. <div class="my-course">
  3. <div>
  4. <h4 class="headerTitle">
  5. <span v-if="goodsData.subjectNames" style="font-size: 20px"
  6. >【{{ goodsData.subjectNames }}】</span
  7. >{{ goodsData.goodsName
  8. }}<el-button
  9. size="mini"
  10. type="primary"
  11. plain
  12. icon="el-icon-sort"
  13. style="margin-left: 14px"
  14. @click="changeCourse"
  15. >切换科目</el-button
  16. >
  17. <el-button
  18. v-if="
  19. goodsData.applyStatus === 1 &&
  20. !(
  21. sysTime <= goodsData.serviceStartTime ||
  22. sysTime >= goodsData.serviceEndTime ||
  23. (goodsData.classStartTime &&
  24. sysTime <= goodsData.classStartTime) ||
  25. (goodsData.classEndTime && sysTime >= goodsData.classEndTime) ||
  26. goodsData.learningStatus == 2 ||
  27. goodsData.classStatus == 0 ||
  28. (goodsData.learningStatus == 3 &&
  29. sysTime < goodsData.learningTimeStart) ||
  30. !goodsData.examApplyGoodsList.length
  31. )
  32. "
  33. size="mini"
  34. type="warning"
  35. plain
  36. style="margin-left: 14px"
  37. @click="changeTest()"
  38. >预约考试
  39. </el-button>
  40. </h4>
  41. <div style="margin: 14px 0px">
  42. <el-button
  43. size="small"
  44. v-for="(item, index) in subjectList"
  45. :type="newActiveSubjectId === item.id ? 'primary' : ''"
  46. :key="index"
  47. @click="newActiveSubjectId = item.id"
  48. >{{ item.name }}</el-button
  49. >
  50. </div>
  51. <div
  52. v-for="(courseItem, teacherIndex) in goodsTeacher"
  53. :key="teacherIndex"
  54. >
  55. <div
  56. v-for="(item, index) in courseItem.courseList"
  57. :key="index + 'two'"
  58. v-show="item.subjectId === newActiveSubjectId || !newActiveSubjectId"
  59. >
  60. <div v-if="item.show == 1">
  61. <div class="firstTop hoverStyle">
  62. <div class="doubles">
  63. <span class="iconStyle">课</span>
  64. <span class="titles">{{ item.courseName }}</span>
  65. <div
  66. v-if="courseItem.teaList && courseItem.teaList.length > 0"
  67. class="teacher_names"
  68. >
  69. <div
  70. v-for="(tea, lindex) in courseItem.teaList"
  71. :key="lindex + 'three'"
  72. class="names"
  73. :class="{ nactive: States[teacherIndex] == lindex }"
  74. @click="switchTeacher(tea, lindex, teacherIndex)"
  75. >
  76. {{ tea.aliasName }}
  77. </div>
  78. </div>
  79. </div>
  80. <span class="showHide" @click="changeStatus(item)">
  81. <span v-if="item.showStatus">收起∧</span>
  82. <span v-else>展开∨</span>
  83. </span>
  84. </div>
  85. <div
  86. v-if="
  87. item.children && item.children.length > 0 && item.showStatus
  88. "
  89. >
  90. <template v-for="(items, indexs) in item.children">
  91. <div v-if="items.type === 1" :key="indexs">
  92. <p
  93. class="moduleStyle hoverStyle"
  94. @click="
  95. changeModuleStatus(items, index, indexs, teacherIndex)
  96. "
  97. >
  98. {{ items.menuName }}
  99. <span class="showHide"
  100. ><i v-if="items.showStatus" class="el-icon-arrow-up"></i>
  101. <i v-else class="el-icon-arrow-down"></i
  102. ></span>
  103. </p>
  104. <template
  105. v-if="
  106. items.showStatus &&
  107. items.children &&
  108. items.children.length > 0
  109. "
  110. >
  111. <div
  112. v-for="(i, k) in items.children"
  113. :key="k"
  114. style="padding-left: 20px"
  115. >
  116. <div
  117. v-if="i.type == 2"
  118. class="sectionStyle hoverStyleSection"
  119. style="padding-left: 20px"
  120. >
  121. <!-- 模考试卷 -->
  122. <el-row style="display: flex; align-items: center">
  123. <el-col :span="12">
  124. <span class="iconStyles">•</span>
  125. <span class="upStudyStyle sizeStyle">{{
  126. i.doType == 1
  127. ? "练习"
  128. : i.doType != 1
  129. ? "考试"
  130. : ""
  131. }}</span>
  132. <span class="span_style">{{ i.name }}</span>
  133. </el-col>
  134. <el-col
  135. :span="11"
  136. :offset="1"
  137. style="
  138. display: flex;
  139. justify-content: end;
  140. align-items: center;
  141. "
  142. >
  143. <el-button
  144. size="mini"
  145. style="width: 90px !important"
  146. type="text"
  147. v-if="i.doType == 1"
  148. @click="getResource(item, i, 3)"
  149. >进入学习</el-button
  150. ><el-button
  151. size="mini"
  152. style="width: 90px !important"
  153. type="text"
  154. v-else
  155. @click="getResource(item, i, 3)"
  156. >进入考试</el-button
  157. >
  158. </el-col>
  159. </el-row>
  160. </div>
  161. <div
  162. v-else
  163. class="chapterStyle hoverStyle"
  164. @click="
  165. changeChapterStatus(
  166. teacherIndex,
  167. 2,
  168. i,
  169. index,
  170. indexs,
  171. k
  172. )
  173. "
  174. >
  175. <!-- <span class="iconStyle">章</span> -->
  176. {{ i.name }}
  177. <span class="showHide"
  178. ><i v-if="i.showStatus" class="el-icon-arrow-up"></i>
  179. <i v-else class="el-icon-arrow-down"></i
  180. ></span>
  181. </div>
  182. <template v-if="i.showStatus && i.children.length > 0">
  183. <div
  184. v-for="(is, ks) in i.children"
  185. class="sectionStyle hoverStyleSection"
  186. :key="ks"
  187. style="padding-left: 20px"
  188. >
  189. <el-row style="display: flex; align-items: center">
  190. <el-col :span="12">
  191. <span class="iconStyles">•</span>
  192. <span class="upStudyStyle sizeStyle">{{
  193. is.sectionType === 1
  194. ? "录播"
  195. : is.sectionType === 2
  196. ? "直播"
  197. : is.sectionType === 3
  198. ? "回放"
  199. : is.doType == 1
  200. ? "练习"
  201. : is.doType != 1
  202. ? "考试"
  203. : ""
  204. }}</span>
  205. <span class="span_style">{{ is.name }}</span>
  206. <span v-if="is.recordStatus" class="upStudyStyle"
  207. >上次学到</span
  208. >
  209. </el-col>
  210. <el-col :span="4">
  211. <span v-show="is.teacherName"
  212. >已选讲师:{{ is.teacherName }}</span
  213. >
  214. </el-col>
  215. <el-col :span="3">
  216. <el-progress
  217. v-if="is.studyDuration && is.durationTime"
  218. :show-text="false"
  219. :percentage="
  220. (is.studyDuration / is.durationTime) * 100 >
  221. 100
  222. ? 100
  223. : (is.studyDuration / is.durationTime) * 100
  224. "
  225. ></el-progress>
  226. </el-col>
  227. <el-col :span="2">
  228. <span v-show="is.studyDuration">
  229. {{
  230. $tools.secondToDate(is.studyDuration) +
  231. "/" +
  232. $tools.secondToDate(is.durationTime)
  233. }}
  234. </span>
  235. </el-col>
  236. <el-col
  237. :span="2"
  238. :offset="1"
  239. v-if="checkSection(is.sectionId, 'sectionExam')"
  240. >
  241. <el-button
  242. size="mini"
  243. type="text"
  244. style="width: 90px !important"
  245. @click="
  246. handelPracticeOrRxam(is, 2, item.courseId)
  247. "
  248. >习题</el-button
  249. >
  250. </el-col>
  251. <el-col
  252. :span="2"
  253. :offset="1"
  254. v-if="!is.sectionType"
  255. >
  256. <el-button
  257. size="mini"
  258. style="width: 90px !important"
  259. type="text"
  260. v-if="is.doType == 1"
  261. @click="getResource(item, is, 1)"
  262. >进入学习</el-button
  263. ><el-button
  264. size="mini"
  265. style="width: 90px !important"
  266. type="text"
  267. v-else
  268. @click="getResource(item, is, 1)"
  269. >进入考试</el-button
  270. >
  271. </el-col>
  272. <el-col
  273. :span="2"
  274. :offset="1"
  275. v-else-if="is.sectionType != 2"
  276. >
  277. <el-button
  278. size="mini"
  279. type="text"
  280. style="width: 90px !important"
  281. v-if="
  282. is.studyDuration > 0 &&
  283. is.durationTime > 0 &&
  284. is.studyDuration == is.durationTime
  285. "
  286. @click="studyFunc(item, is)"
  287. >再次学习</el-button
  288. >
  289. <el-button
  290. type="primary"
  291. size="mini"
  292. style="width: 90px !important"
  293. v-else-if="
  294. is.studyDuration > 0 &&
  295. is.durationTime > 0 &&
  296. is.studyDuration != is.durationTime
  297. "
  298. @click="studyFunc(item, is)"
  299. >继续学习</el-button
  300. >
  301. <el-button
  302. size="mini"
  303. type="primary"
  304. style="width: 90px !important"
  305. plain
  306. v-else-if="
  307. is.studyDuration == 0 && is.durationTime > 0
  308. "
  309. @click="studyFunc(item, is)"
  310. >未开始</el-button
  311. > </el-col
  312. ><el-col :span="2" :offset="1" v-else>
  313. <el-button
  314. size="mini"
  315. plain
  316. disabled
  317. type="success"
  318. style="width: 90px !important"
  319. v-if="is.liveStartTime > sysTime"
  320. @click="studyFunc(item, is)"
  321. >未开播</el-button
  322. >
  323. <el-button
  324. size="mini"
  325. plain
  326. disabled
  327. type="danger"
  328. style="width: 90px !important"
  329. v-else-if="is.liveEndTime < sysTime"
  330. @click="studyFunc(item, is)"
  331. >已结束</el-button
  332. >
  333. <el-button
  334. size="mini"
  335. plain
  336. type="primary"
  337. style="
  338. width: 90px !important;
  339. text-align: center;
  340. "
  341. v-else-if="
  342. is.liveEndTime > sysTime &&
  343. is.liveStartTime < sysTime
  344. "
  345. @click="studyFunc(item, is)"
  346. >进入直播间</el-button
  347. >
  348. </el-col>
  349. </el-row>
  350. </div>
  351. </template>
  352. </div>
  353. </template>
  354. </div>
  355. <div v-if="items.type === 2" :key="indexs">
  356. <div
  357. class="chapterStyle hoverStyle"
  358. @click="
  359. changeChapterStatus(teacherIndex, 1, items, index, indexs)
  360. "
  361. >
  362. <!-- <span class="iconStyle">章</span> -->
  363. {{ items.menuName }}
  364. <span class="showHide"
  365. ><i v-if="items.showStatus" class="el-icon-arrow-up"></i>
  366. <i v-else class="el-icon-arrow-down"></i
  367. ></span>
  368. </div>
  369. <template
  370. v-if="items.showStatus && items.children.length > 0"
  371. >
  372. <div
  373. v-for="(i, k) in items.children"
  374. class="sectionStyle hoverStyleSection"
  375. :key="k"
  376. style="padding-left: 20px"
  377. >
  378. <el-row style="display: flex; align-items: center">
  379. <el-col :span="12">
  380. <span class="iconStyles">•</span>
  381. <span class="upStudyStyle sizeStyle">{{
  382. i.sectionType === 1
  383. ? "录播"
  384. : i.sectionType === 2
  385. ? "直播"
  386. : i.sectionType === 3
  387. ? "回放"
  388. : i.doType == 1
  389. ? "练习"
  390. : i.doType != 1
  391. ? "考试"
  392. : ""
  393. }}</span>
  394. <span class="span_style">
  395. {{ i.name }}
  396. </span>
  397. <span v-if="i.recordStatus" class="upStudyStyle"
  398. >上次学到</span
  399. >
  400. </el-col>
  401. <el-col :span="4">
  402. <span v-show="i.teacherName"
  403. >已选讲师:{{ i.teacherName }}</span
  404. >
  405. </el-col>
  406. <el-col :span="3">
  407. <el-progress
  408. v-if="i.studyDuration && i.durationTime"
  409. :show-text="false"
  410. :percentage="
  411. (i.studyDuration / i.durationTime) * 100 > 100
  412. ? 100
  413. : (i.studyDuration / i.durationTime) * 100
  414. "
  415. ></el-progress>
  416. </el-col>
  417. <el-col :span="2">
  418. <span v-show="i.studyDuration">
  419. {{
  420. $tools.secondToDate(i.studyDuration) +
  421. "/" +
  422. $tools.secondToDate(i.durationTime)
  423. }}
  424. </span>
  425. </el-col>
  426. <el-col
  427. :span="2"
  428. :offset="1"
  429. v-if="checkSection(i.sectionId, 'sectionExam')"
  430. >
  431. <el-button
  432. size="mini"
  433. type="text"
  434. style="width: 90px !important"
  435. @click="handelPracticeOrRxam(i, 2, item.courseId)"
  436. >习题</el-button
  437. >
  438. </el-col>
  439. <el-col :span="2" :offset="1" v-if="!i.sectionType">
  440. <el-button
  441. size="mini"
  442. style="width: 90px !important"
  443. type="text"
  444. v-if="i.doType == 1"
  445. @click="getResource(item, i, 1)"
  446. >进入学习</el-button
  447. ><el-button
  448. size="mini"
  449. style="width: 90px !important"
  450. type="text"
  451. v-else
  452. @click="getResource(item, i, 1)"
  453. >进入考试</el-button
  454. >
  455. </el-col>
  456. <el-col
  457. :span="2"
  458. :offset="1"
  459. v-else-if="i.sectionType != 2"
  460. >
  461. <el-button
  462. size="mini"
  463. type="text"
  464. style="width: 90px !important"
  465. v-if="
  466. i.studyDuration > 0 &&
  467. i.durationTime > 0 &&
  468. i.studyDuration == i.durationTime
  469. "
  470. @click="studyFunc(item, i)"
  471. >再次学习</el-button
  472. >
  473. <el-button
  474. type="primary"
  475. size="mini"
  476. style="width: 90px !important"
  477. v-else-if="
  478. i.studyDuration > 0 &&
  479. i.durationTime > 0 &&
  480. i.studyDuration != i.durationTime
  481. "
  482. @click="studyFunc(item, i)"
  483. >继续学习</el-button
  484. >
  485. <el-button
  486. size="mini"
  487. plain
  488. type="primary"
  489. style="width: 90px !important"
  490. v-else-if="
  491. i.studyDuration == 0 && i.durationTime > 0
  492. "
  493. @click="studyFunc(item, i)"
  494. >未开始</el-button
  495. >
  496. </el-col>
  497. <el-col :span="2" :offset="1" v-else>
  498. <el-button
  499. size="mini"
  500. style="width: 90px !important"
  501. plain
  502. disabled
  503. type="success"
  504. v-if="i.liveStartTime > sysTime"
  505. @click="studyFunc(item, i)"
  506. >未开播</el-button
  507. >
  508. <el-button
  509. size="mini"
  510. style="width: 90px !important"
  511. plain
  512. disabled
  513. type="danger"
  514. v-else-if="i.liveEndTime < sysTime"
  515. @click="studyFunc(item, i)"
  516. >已结束</el-button
  517. >
  518. <el-button
  519. size="mini"
  520. style="width: 90px !important; text-align: center"
  521. plain
  522. type="primary"
  523. v-else-if="
  524. i.liveEndTime > sysTime &&
  525. i.liveStartTime < sysTime
  526. "
  527. @click="studyFunc(item, i)"
  528. >进入直播间</el-button
  529. >
  530. </el-col>
  531. </el-row>
  532. </div>
  533. </template>
  534. </div>
  535. <div
  536. v-if="items.type === 3"
  537. :key="indexs"
  538. class="sectionStyle hoverStyle"
  539. >
  540. <el-row style="display: flex; align-items: center">
  541. <el-col :span="12">
  542. <span class="iconStyles">•</span>
  543. <span class="upStudyStyle sizeStyle">{{
  544. items.sectionType === 1
  545. ? "录播"
  546. : items.sectionType === 2
  547. ? "直播"
  548. : items.sectionType === 3
  549. ? "回放"
  550. : items.doType == 1
  551. ? "练习"
  552. : items.doType != 1
  553. ? "考试"
  554. : ""
  555. }}</span>
  556. <span class="span_style">
  557. {{ items.menuName }}
  558. </span>
  559. <span v-if="items.recordStatus" class="upStudyStyle"
  560. >上次学到</span
  561. >
  562. </el-col>
  563. <el-col :span="4">
  564. <span v-show="items.teacherName"
  565. >已选讲师:{{ items.teacherName }}</span
  566. >
  567. </el-col>
  568. <el-col :span="3">
  569. <el-progress
  570. v-if="items.studyDuration && items.durationTime"
  571. :show-text="false"
  572. :percentage="
  573. (items.studyDuration / items.durationTime) * 100 > 100
  574. ? 100
  575. : (items.studyDuration / items.durationTime) * 100
  576. "
  577. ></el-progress>
  578. </el-col>
  579. <el-col :span="2">
  580. <span v-show="items.studyDuration">
  581. {{
  582. $tools.secondToDate(items.studyDuration) +
  583. "/" +
  584. $tools.secondToDate(items.durationTime)
  585. }}
  586. </span>
  587. </el-col>
  588. <el-col
  589. :span="2"
  590. :offset="1"
  591. v-if="checkSection(items.menuId, 'sectionExamList')"
  592. >
  593. <el-button
  594. size="mini"
  595. type="text"
  596. style="width: 90px !important"
  597. @click="handelPracticeOrRxam(items, 2, item.courseId)"
  598. >习题</el-button
  599. >
  600. </el-col>
  601. <el-col :span="2" :offset="1" v-if="!items.sectionType">
  602. <el-button
  603. size="mini"
  604. style="width: 90px !important"
  605. type="text"
  606. v-if="items.doType == 1"
  607. @click="getResource(item, items, 2)"
  608. >进入学习</el-button
  609. ><el-button
  610. size="mini"
  611. style="width: 90px !important"
  612. type="text"
  613. v-else
  614. @click="getResource(item, items, 2)"
  615. >进入考试</el-button
  616. >
  617. </el-col>
  618. <el-col
  619. :span="2"
  620. :offset="1"
  621. v-else-if="items.sectionType != 2"
  622. >
  623. <el-button
  624. size="mini"
  625. style="width: 90px !important"
  626. type="text"
  627. v-if="
  628. items.studyDuration > 0 &&
  629. items.durationTime > 0 &&
  630. items.studyDuration == items.durationTime
  631. "
  632. @click="studyFunc(item, items)"
  633. >再次学习</el-button
  634. >
  635. <el-button
  636. type="primary"
  637. style="width: 90px !important"
  638. size="mini"
  639. v-else-if="
  640. items.studyDuration > 0 &&
  641. items.durationTime > 0 &&
  642. items.studyDuration != items.durationTime
  643. "
  644. @click="studyFunc(item, items)"
  645. >继续学习</el-button
  646. >
  647. <el-button
  648. style="width: 90px !important"
  649. plain
  650. size="mini"
  651. type="primary"
  652. v-else-if="
  653. items.studyDuration == 0 && items.durationTime > 0
  654. "
  655. @click="studyFunc(item, items)"
  656. >未开始</el-button
  657. >
  658. </el-col>
  659. <el-col :span="2" :offset="1" v-else>
  660. <el-button
  661. size="mini"
  662. style="width: 90px !important"
  663. plain
  664. disabled
  665. type="success"
  666. v-if="items.liveStartTime > sysTime"
  667. @click="studyFunc(item, items)"
  668. >未开播</el-button
  669. >
  670. <el-button
  671. size="mini"
  672. style="width: 90px !important"
  673. plain
  674. disabled
  675. type="danger"
  676. v-else-if="items.liveEndTime < sysTime"
  677. @click="studyFunc(item, items)"
  678. >已结束</el-button
  679. >
  680. <el-button
  681. size="mini"
  682. style="width: 90px !important; text-align: center"
  683. plain
  684. type="primary"
  685. v-else-if="
  686. items.liveEndTime > sysTime &&
  687. items.liveStartTime < sysTime
  688. "
  689. @click="studyFunc(item, items)"
  690. >进入直播间</el-button
  691. >
  692. </el-col>
  693. </el-row>
  694. </div>
  695. </template>
  696. </div>
  697. </div>
  698. </div>
  699. </div>
  700. </div>
  701. <courseData ref="courseData" @backData="backData" />
  702. <el-dialog
  703. title="实名验证确认"
  704. :visible.sync="showConfirm"
  705. width="600px"
  706. class="showconfirm"
  707. :close-on-click-modal="false"
  708. :close-on-press-escape="false"
  709. :show-close="false"
  710. >
  711. <div class="showconfirm__content">
  712. <div class="text">
  713. 为避免个人信息不正确导致您的学习时长无效,请认真核对以下信息是否正确,如信息有误请取消当前操作,立刻联系020-38946666
  714. </div>
  715. <el-descriptions :column="1">
  716. <el-descriptions-item label="姓名">{{
  717. userInfo && userInfo.realname
  718. }}</el-descriptions-item>
  719. <el-descriptions-item label="手机号">{{
  720. userInfo && userInfo.telphone
  721. }}</el-descriptions-item>
  722. <el-descriptions-item label="身份证号">{{
  723. userInfo && userInfo.idCard
  724. }}</el-descriptions-item>
  725. </el-descriptions>
  726. <div class="">
  727. <el-checkbox v-model="confirmChecked">确认个人信息无误</el-checkbox>
  728. </div>
  729. </div>
  730. <span slot="footer" class="dialog-footer">
  731. <el-button @click="showConfirm = false">取 消</el-button>
  732. <el-button
  733. type="primary"
  734. @click="confirmUser"
  735. :disabled="confirmCount > 0"
  736. :loading="confirmLoading"
  737. >{{
  738. confirmCount > 0 ? "确 定(" + confirmCount + ")" : "确 定"
  739. }}</el-button
  740. >
  741. </span>
  742. </el-dialog>
  743. <RebuildModal
  744. ref="rebuildModal"
  745. @rebuildSubmit="rebuildSubmit($event)"
  746. ></RebuildModal>
  747. <!-- 预约考试弹窗 -->
  748. <appoint-test
  749. :appointModal.sync="appointModal"
  750. :appointItem="goodsData"
  751. ></appoint-test>
  752. </div>
  753. </template>
  754. <script>
  755. import { mapGetters, mapActions } from "vuex";
  756. import courseData from "./courseData.vue";
  757. import RebuildModal from "@/components/rebuildModal";
  758. import AppointTest from "./components/AppointTest.vue";
  759. export default {
  760. name: "MyCourse",
  761. components: { courseData, RebuildModal, AppointTest },
  762. data() {
  763. return {
  764. goodsData: {},
  765. goodsTeacher: [],
  766. courseList: [],
  767. sysTime: 0,
  768. showConfirm: false,
  769. confirmCount: 10,
  770. confirmChecked: false,
  771. confirmTimer: null,
  772. confirmLoading: false,
  773. appointModal: false, // 预约考试弹窗
  774. subjectList: [], //当前商品课程科目汇总
  775. newActiveSubjectId: "", //当前选中ID
  776. businessData: {},
  777. teaIndex: 0,
  778. States: { 0: 0 },
  779. sectionExamList: [], //节试卷集合
  780. sectionExam: [], //节试卷集合
  781. };
  782. },
  783. computed: {
  784. ...mapGetters(["userInfo"]),
  785. },
  786. mounted() {
  787. this.getRecord();
  788. this.sysTime = this.$tools.timest();
  789. },
  790. methods: {
  791. comeStyle(courseItem, item) {
  792. this.$router.push({
  793. path: `/my-course-detail/${this.goodsData.goodsId}`,
  794. query: {
  795. gradeId: courseItem.gradeId,
  796. orderGoodsId: this.goodsData.orderGoodsId,
  797. courseId: courseItem.courseId,
  798. chapterId: item.chapterId,
  799. moduleId: item.moduleId,
  800. sectionId: item.sectionId || item.menuId,
  801. recordingUrl: item.recordingUrl,
  802. liveUrl: item.liveUrl,
  803. sectionType: item.sectionType,
  804. liveStartTime: item.liveStartTime,
  805. liveEndTime: item.liveEndTime,
  806. },
  807. });
  808. },
  809. changeCourse() {
  810. this.$refs.courseData.openBoxs(this.goodsData);
  811. },
  812. changeTest() {
  813. this.appointModal = true;
  814. },
  815. backData(item) {
  816. this.goodsData = item;
  817. this.goodsTeacher = [];
  818. this.courseBusiness();
  819. this.getGoodsCourseList(item);
  820. },
  821. //数组对象去重
  822. uniqueFunc(arr, uniId) {
  823. const res = new Map();
  824. return arr.filter(
  825. (item) => !res.has(item[uniId]) && res.set(item[uniId], 1)
  826. );
  827. },
  828. /**
  829. * 获取课程列表
  830. */
  831. getGoodsCourseList(item) {
  832. return new Promise((resolve, reject) => {
  833. this.$request
  834. .courseCourseList({
  835. goodsId: item.goodsId,
  836. gradeId: item.gradeId,
  837. })
  838. .then((res) => {
  839. console.log(res, "res");
  840. var array = [];
  841. res.rows.forEach((element) => {
  842. element.showStatus = false;
  843. element.children = [];
  844. array.push({
  845. id: element.subjectId,
  846. name: element.subjectName,
  847. });
  848. });
  849. //获取商品双师资模板
  850. this.$request
  851. .courseTeacherList({
  852. goodsId: item.goodsId,
  853. })
  854. .then((res1) => {
  855. // console.log(res1,'res1');
  856. if (res1.data && res1.data.length > 0) {
  857. //课程老师模板
  858. let teacherTel = res1.data;
  859. //商品课程
  860. let courses = res.rows;
  861. teacherTel.forEach((tea) => {
  862. let dataList = [];
  863. let teacherList = [];
  864. courses.forEach((item) => {
  865. let courseData = tea.courseList.filter(
  866. (x) => x.courseId == item.courseId
  867. );
  868. if (courseData && courseData.length > 0) {
  869. dataList.push(item);
  870. teacherList = tea.courseList;
  871. }
  872. });
  873. let result = {
  874. teaList: teacherList,
  875. courseList: dataList,
  876. };
  877. this.goodsTeacher.push(result);
  878. });
  879. if (this.goodsTeacher && this.goodsTeacher.length > 0) {
  880. let courseIds = [];
  881. this.goodsTeacher.forEach((item) => {
  882. item.courseList.forEach((course) => {
  883. courseIds.push(course.courseId);
  884. });
  885. });
  886. if (courseIds.length > 0) {
  887. courses.forEach((item) => {
  888. if (!courseIds.includes(item.courseId)) {
  889. let data = {
  890. teaList: [],
  891. courseList: [],
  892. };
  893. data.courseList.push(item);
  894. this.goodsTeacher.push(data);
  895. }
  896. });
  897. }
  898. }
  899. this.goodsTeacher.forEach((item) => {
  900. if (item.courseList && item.courseList.length > 0) {
  901. item.courseList[0].show = 1;
  902. }
  903. });
  904. } else {
  905. //没有双师资模板
  906. res.rows.forEach((item) => {
  907. item.show = 1;
  908. let data = {
  909. teaList: [],
  910. courseList: [],
  911. };
  912. data.courseList.push(item);
  913. this.goodsTeacher.push(data);
  914. });
  915. }
  916. console.log(this.goodsTeacher, "this.goodsTeacher");
  917. });
  918. this.courseList = res.rows;
  919. array = this.uniqueFunc(array, "id");
  920. array.unshift({
  921. id: "",
  922. name: "全部",
  923. });
  924. // this.subjectList = array;
  925. this.subjectList = array.filter((item) => item.name);
  926. this.newActiveSubjectId = "";
  927. resolve();
  928. // if (res.rows && res.rows.length > 0) {
  929. // this.getRecord(res.rows[0]);
  930. // }
  931. });
  932. });
  933. },
  934. //切换老师
  935. switchTeacher(data, index, teacherIndex) {
  936. console.log(data, "data", index, teacherIndex);
  937. console.log(this.subjectList, "this.subjectList");
  938. this.States[teacherIndex] = index;
  939. this.teaIndex = index;
  940. this.goodsTeacher.forEach((item, index) => {
  941. if (item.teaList && item.teaList.length > 0) {
  942. let list = item.teaList.filter((x) => x.courseId == data.courseId);
  943. if (list && list.length > 0) {
  944. item.courseList.forEach((course, courseIndex) => {
  945. if (course.courseId == data.courseId) {
  946. // console.log(index,'index');
  947. // console.log(courseIndex,'courseIndex');
  948. this.$set(
  949. this.goodsTeacher[index].courseList[courseIndex],
  950. "show",
  951. 1
  952. );
  953. } else {
  954. this.$set(
  955. this.goodsTeacher[index].courseList[courseIndex],
  956. "show",
  957. 0
  958. );
  959. }
  960. });
  961. }
  962. }
  963. });
  964. console.log(this.goodsTeacher, "this.goodsTeacher");
  965. },
  966. getGoodsData(res) {
  967. return new Promise((resolve, reject) => {
  968. this.$request
  969. .courseGoodsList({ orderGoodsId: res.data.orderGoodsId })
  970. .then(async (result) => {
  971. if (result.rows.length == 0) {
  972. this.resultCourseGoodsList();
  973. } else {
  974. let array = result.rows[0];
  975. array.orderGoodsId = res.data.orderGoodsId;
  976. this.goodsData = array;
  977. this.courseBusiness();
  978. await this.getGoodsCourseList(array);
  979. resolve();
  980. }
  981. });
  982. });
  983. },
  984. /**
  985. * 获取学习记录
  986. */
  987. getRecord(item) {
  988. this.$request.studyrecordgetUserStudyLast().then(async (res) => {
  989. // if (res.data && res.data.sectionId) {
  990. await this.getGoodsData(res);
  991. var stop = false;
  992. for (let y = 0; y < this.goodsTeacher.length; y++) {
  993. for (let i = 0; i < this.goodsTeacher[y].courseList.length; i++) {
  994. if (stop) {
  995. break;
  996. }
  997. if (
  998. this.goodsTeacher[y].courseList[i].courseId == res.data.courseId
  999. ) {
  1000. await this.changeStatus(this.goodsTeacher[y].courseList[i]);
  1001. for (
  1002. let k = 0;
  1003. k < this.goodsTeacher[y].courseList[i].children.length;
  1004. k++
  1005. ) {
  1006. if (res.data.moduleId) {
  1007. console.log(1);
  1008. if (
  1009. this.goodsTeacher[y].courseList[i].children[k].menuId ==
  1010. res.data.moduleId
  1011. ) {
  1012. await this.changeModuleStatus(
  1013. this.goodsTeacher[y].courseList[i].children[k],
  1014. i,
  1015. k,
  1016. y
  1017. );
  1018. for (
  1019. let j = 0;
  1020. j <
  1021. this.goodsTeacher[y].courseList[i].children[k].children
  1022. .length;
  1023. j++
  1024. ) {
  1025. if (
  1026. this.goodsTeacher[y].courseList[i].children[k].children[
  1027. j
  1028. ].chapterId == res.data.chapterId
  1029. ) {
  1030. await this.changeChapterStatus(
  1031. y,
  1032. 2,
  1033. this.goodsTeacher[y].courseList[i].children[k]
  1034. .children[j],
  1035. i,
  1036. k,
  1037. j
  1038. );
  1039. for (
  1040. let m = 0;
  1041. m <
  1042. this.goodsTeacher[y].courseList[i].children[k]
  1043. .children[j].children.length;
  1044. m++
  1045. ) {
  1046. if (
  1047. this.goodsTeacher[y].courseList[i].children[k]
  1048. .children[j].children[m].sectionId ==
  1049. res.data.sectionId
  1050. ) {
  1051. this.$set(
  1052. this.goodsTeacher[y].courseList[i].children[k]
  1053. .children[j].children[m],
  1054. "recordStatus",
  1055. true
  1056. );
  1057. stop = true;
  1058. break;
  1059. }
  1060. }
  1061. }
  1062. }
  1063. }
  1064. } else if (res.data.chapterId) {
  1065. console.log(2);
  1066. if (
  1067. this.goodsTeacher[y].courseList[i].children[k].menuId ==
  1068. res.data.chapterId
  1069. ) {
  1070. await this.changeChapterStatus(
  1071. y,
  1072. 1,
  1073. this.goodsTeacher[y].courseList[i].children[k],
  1074. i,
  1075. k
  1076. );
  1077. for (
  1078. let j = 0;
  1079. j <
  1080. this.goodsTeacher[y].courseList[i].children[k].children
  1081. .length;
  1082. j++
  1083. ) {
  1084. if (
  1085. this.goodsTeacher[y].courseList[i].children[k].children[
  1086. j
  1087. ].sectionId == res.data.sectionId
  1088. ) {
  1089. this.$set(
  1090. this.goodsTeacher[y].courseList[i].children[k]
  1091. .children[j],
  1092. "recordStatus",
  1093. true
  1094. );
  1095. stop = true;
  1096. break;
  1097. }
  1098. }
  1099. }
  1100. } else {
  1101. console.log(3);
  1102. if (
  1103. this.goodsTeacher[y].courseList[i].children[k].menuId ==
  1104. res.data.sectionId
  1105. ) {
  1106. this.$set(
  1107. this.goodsTeacher[y].courseList[i].children[k],
  1108. "recordStatus",
  1109. true
  1110. );
  1111. stop = true;
  1112. break;
  1113. }
  1114. }
  1115. }
  1116. }
  1117. }
  1118. }
  1119. // } else {
  1120. // this.resultCourseGoodsList();
  1121. // }
  1122. });
  1123. },
  1124. resultCourseGoodsList() {
  1125. this.$request.courseGoodsList({ pageNum: 1, pageSize: 1 }).then((res) => {
  1126. if (res.rows && res.rows.length > 0) {
  1127. this.backData(res.rows[0]);
  1128. }
  1129. });
  1130. },
  1131. /**
  1132. * 展开获取课程详情列表
  1133. */
  1134. changeStatus(item) {
  1135. return new Promise((resolve, reject) => {
  1136. console.log(item);
  1137. if (item.children.length > 0) {
  1138. item.showStatus = !item.showStatus;
  1139. return;
  1140. }
  1141. //获取节试卷列表
  1142. this.$request
  1143. .reSectionExamList({
  1144. chapterId: 0,
  1145. courseId: item.courseId,
  1146. gradeId: item.gradeId,
  1147. })
  1148. .then((res) => {
  1149. this.sectionExamList = res.data;
  1150. });
  1151. this.$request
  1152. .reMenuList({
  1153. courseId: item.courseId,
  1154. gradeId: item.gradeId,
  1155. orderGoodsId: this.goodsData.orderGoodsId,
  1156. })
  1157. .then((res) => {
  1158. res.rows.forEach((items) => {
  1159. if (items.type != 3) {
  1160. items.showStatus = false;
  1161. items.children = [];
  1162. }
  1163. });
  1164. for (let i = 0; i < this.courseList.length; i++) {
  1165. if (this.courseList[i].courseId == item.courseId) {
  1166. this.$set(this.courseList[i], "children", res.rows);
  1167. this.$set(
  1168. this.courseList[i],
  1169. "showStatus",
  1170. !this.courseList[i].showStatus
  1171. );
  1172. break;
  1173. }
  1174. }
  1175. resolve();
  1176. });
  1177. });
  1178. },
  1179. /**
  1180. * 模块详情列表
  1181. */
  1182. changeModuleStatus(item, index, indexs, teacherIndex) {
  1183. return new Promise((resolve, reject) => {
  1184. console.log(item, "item");
  1185. if (item.children && item.children.length > 0) {
  1186. item.showStatus = !item.showStatus;
  1187. return;
  1188. }
  1189. this.$request
  1190. .reChapterList({
  1191. moduleId: item.menuId,
  1192. gradeId: item.gradeId,
  1193. courseId: item.courseId,
  1194. })
  1195. .then((res) => {
  1196. res.data.forEach((items) => {
  1197. items.children = [];
  1198. items.showStatus = false;
  1199. });
  1200. console.log(teacherIndex, "teacherIndex");
  1201. this.$set(
  1202. this.goodsTeacher[teacherIndex].courseList[index].children[
  1203. indexs
  1204. ],
  1205. "children",
  1206. res.data
  1207. );
  1208. item.showStatus = !item.showStatus;
  1209. resolve();
  1210. });
  1211. });
  1212. },
  1213. /**
  1214. * 章详情列表 type = 1 父级章 type = 2 父级模块
  1215. */
  1216. changeChapterStatus(teacherIndex, type, item, courseIndex, index, indexs) {
  1217. return new Promise((resolve, reject) => {
  1218. console.log(item, "定位");
  1219. console.log(type, item, courseIndex, index, indexs, teacherIndex);
  1220. if (item.children && item.children.length > 0) {
  1221. item.showStatus = !item.showStatus;
  1222. return;
  1223. }
  1224. //获取节试卷列表
  1225. this.$request
  1226. .reSectionExamList({
  1227. chapterId: type === 1 ? item.menuId : item.chapterId,
  1228. courseId: item.courseId,
  1229. gradeId: item.gradeId,
  1230. })
  1231. .then((res) => {
  1232. this.sectionExam = res.data;
  1233. });
  1234. this.$request
  1235. .reSectionList({
  1236. chapterId: type === 1 ? item.menuId : item.chapterId,
  1237. gradeId: item.gradeId,
  1238. courseId: item.courseId,
  1239. moduleId: item.moduleId || 0,
  1240. orderGoodsId: this.goodsData.orderGoodsId,
  1241. })
  1242. .then((res) => {
  1243. // let newArr = res.data.filter((item) => {
  1244. // return item.type != 2;
  1245. // });
  1246. // let canLearn = newArr.every((item) => {
  1247. // if (item.learning == 1) {
  1248. // return true;
  1249. // } else {
  1250. // return false;
  1251. // }
  1252. // });
  1253. // res.data.forEach((section) => {
  1254. // section.canLearn = canLearn;
  1255. // });
  1256. if (type === 1) {
  1257. this.$set(
  1258. this.goodsTeacher[teacherIndex].courseList[courseIndex]
  1259. .children[index],
  1260. "children",
  1261. res.data
  1262. );
  1263. }
  1264. if (type === 2) {
  1265. this.$set(
  1266. this.goodsTeacher[teacherIndex].courseList[courseIndex]
  1267. .children[index].children[indexs],
  1268. "children",
  1269. res.data
  1270. );
  1271. }
  1272. item.showStatus = !item.showStatus;
  1273. resolve();
  1274. });
  1275. });
  1276. },
  1277. checkCanLearn() {
  1278. let time = this.$tools.timest();
  1279. let {
  1280. interfaceAccountId,
  1281. learnStatus,
  1282. serviceStartTime,
  1283. serviceEndTime,
  1284. classStartTime,
  1285. classEndTime,
  1286. classStatus,
  1287. learningStatus,
  1288. learningTimeStart,
  1289. } = this.goodsData;
  1290. if (interfaceAccountId > 0) {
  1291. learnStatus == 1
  1292. ? this.rebuildSubmit(this.goodsData)
  1293. : this.$message({
  1294. type: "warning",
  1295. message:
  1296. "您的学习账号未开通,请稍后再尝试,有疑问,请联系020-87085982!",
  1297. });
  1298. return false;
  1299. }
  1300. let index = [
  1301. time <= serviceStartTime || time >= serviceEndTime,
  1302. (classStartTime && time <= classStartTime) ||
  1303. (classEndTime && time >= classEndTime),
  1304. learningStatus == 2,
  1305. classStatus == 0,
  1306. learningStatus == 3 && time < learningTimeStart,
  1307. ].findIndex((e) => e);
  1308. if (index !== -1) {
  1309. this.$message({
  1310. type: "warning",
  1311. message:
  1312. [
  1313. "不在学习服务期",
  1314. "不在班级有效期",
  1315. "开放学习时间待定",
  1316. "尚未开班",
  1317. "不在开放学习时间,",
  1318. ][index] + ",不能进入学习",
  1319. });
  1320. }
  1321. return index === -1;
  1322. },
  1323. async studyFunc(courseItem, items) {
  1324. console.log(items);
  1325. if (!this.checkCanLearn()) {
  1326. return false;
  1327. }
  1328. if (!(await this.orderTopTobottom(courseItem, items, 99))) {
  1329. this.$message({
  1330. type: "warning",
  1331. message: "请按顺序学习视频课程",
  1332. });
  1333. return false;
  1334. }
  1335. let item = this.goodsData;
  1336. var confirmDetail = true;
  1337. if (item.educationName == "继续教育") {
  1338. if (
  1339. item.officialName &&
  1340. item.businessName == "二级" &&
  1341. item.projectName == "建造师"
  1342. ) {
  1343. confirmDetail = await this.userConfirmInfoDetail();
  1344. }
  1345. }
  1346. // //内部系统
  1347. // if (item.interfacePushId > 0 && item.officialStatus != 1) {
  1348. // this.$message({
  1349. // type: "warning",
  1350. // message: "机构正在为您报名中,请耐心等待,有疑问请联系020-87085982!",
  1351. // });
  1352. // return;
  1353. // }
  1354. if (!confirmDetail) {
  1355. return;
  1356. }
  1357. let rebuildStatus = await this.courseGoodsRebuildStatus(
  1358. item.goodsId,
  1359. item.gradeId
  1360. );
  1361. if (rebuildStatus == 0) {
  1362. this.$refs.rebuildModal.showModal(item);
  1363. return;
  1364. }
  1365. // if (item.educationName == "继续教育") {
  1366. this.$request
  1367. .lockLockStatus({
  1368. action: "jxjy",
  1369. uuid: sessionStorage.getItem("uuid"),
  1370. })
  1371. .then((res) => {
  1372. //有其他端在操作,不能学习
  1373. this.$message({
  1374. type: "warning",
  1375. message: res.msg,
  1376. });
  1377. })
  1378. .catch((err) => {
  1379. //可以学习
  1380. this.$request
  1381. .courseCourseList({
  1382. pageNum: 1,
  1383. pageSize: 1,
  1384. goodsId: item.goodsId,
  1385. gradeId: item.gradeId,
  1386. })
  1387. .then(async (res) => {
  1388. //学习次数是否上限---start
  1389. let learnNum = await this.goodsTodayStudySectionNum(courseItem);
  1390. let hasLearn = await this.gradeCheckGoodsStudy(courseItem, items);
  1391. console.log(learnNum, hasLearn);
  1392. if (this.goodsData.sectionMaxNum > 0) {
  1393. if (learnNum >= this.goodsData.sectionMaxNum && !hasLearn) {
  1394. this.clickLock = false;
  1395. this.$message({
  1396. type: "warning",
  1397. message: `每天最多学习${this.goodsData.sectionMaxNum}节`,
  1398. });
  1399. return;
  1400. }
  1401. }
  1402. //学习次数是否上限---end
  1403. if (res.rows.length) {
  1404. // this.$emit("backData", item);
  1405. // this.dialogVisible = false;
  1406. this.comeStyle(courseItem, items);
  1407. // this.$router.push({
  1408. // path: `/my-course-detail/${item.goodsId}`,
  1409. // query: {
  1410. // gradeId: item.gradeId,
  1411. // orderGoodsId: item.orderGoodsId,
  1412. // courseId: res.rows[0].courseId || "",
  1413. // },
  1414. // });
  1415. // }
  1416. } else {
  1417. this.$message({
  1418. type: "warning",
  1419. message: "课程内暂无可以学习的科目",
  1420. });
  1421. }
  1422. });
  1423. });
  1424. },
  1425. handelPracticeOrRxam(section, type, courseId) {
  1426. if (type == 3) {
  1427. //节卷
  1428. let data = this.sectionExamList.filter(
  1429. (x) => x.sectionId == section.menuId
  1430. );
  1431. if (data && data.length > 0) {
  1432. section = data[0];
  1433. }
  1434. } else if (type == 2) {
  1435. //节卷
  1436. let data = this.sectionExam.filter(
  1437. (x) => x.sectionId == section.sectionId
  1438. );
  1439. if (data && data.length > 0) {
  1440. section = data[0];
  1441. }
  1442. }
  1443. this.$router.push({
  1444. path: "/course-exam/" + this.goodsData.goodsId,
  1445. query: {
  1446. courseId: courseId,
  1447. gradeId: this.goodsData.gradeId,
  1448. moduleId: section.moduleId || 0,
  1449. sectionId: section.sectionId || 0,
  1450. examId: section.typeId,
  1451. learning: section.learning,
  1452. type: type,
  1453. chapterId: section.chapterId || 0,
  1454. orderGoodsId: this.goodsData.orderGoodsId,
  1455. },
  1456. });
  1457. },
  1458. async orderTopTobottom(courseLists, section, type) {
  1459. let { rebuild, moduleId, chapterId } = section;
  1460. if (this.goodsData.goodsLearningOrder != 2 || rebuild) {
  1461. return true;
  1462. }
  1463. // 课程顺序
  1464. if (this.courseList.length > 1) {
  1465. let index = this.courseList.findIndex(
  1466. (e) => e.courseId == courseLists.courseId
  1467. );
  1468. if (index) {
  1469. let prevItem = this.courseList[index - 1]; //上一课
  1470. if (prevItem.stuAllNum != prevItem.secAllNum) {
  1471. return false;
  1472. }
  1473. }
  1474. }
  1475. let list = await this.studyRecordMenuAllList(courseLists);
  1476. if (type == 99) {
  1477. let index = list.findIndex(
  1478. (e) =>
  1479. e.moduleId == moduleId &&
  1480. e.chapterId == chapterId &&
  1481. e.id == section.sectionId
  1482. );
  1483. list = list.slice(0, index);
  1484. } else if (type != 3) {
  1485. list = list.filter(
  1486. (e) => e.moduleId == moduleId && e.chapterId == chapterId
  1487. );
  1488. }
  1489. return list.every((item) => item.studyStatus == 1);
  1490. },
  1491. async exceedLearnNum(courseLists, section) {
  1492. let learnNum = await this.goodsTodayStudySectionNum(section);
  1493. let hasLearn = await this.gradeCheckGoodsStudy(courseLists, section);
  1494. if (this.goodsData.sectionMaxNum > 0) {
  1495. if (learnNum >= this.goodsData.sectionMaxNum && !hasLearn) {
  1496. this.$message({
  1497. type: "warning",
  1498. message: `每天最多学习${this.goodsData.sectionMaxNum}节`,
  1499. });
  1500. return false;
  1501. }
  1502. }
  1503. return true;
  1504. },
  1505. async getResource(courseLists, section, type) {
  1506. //type:1章卷,2节卷,3模考卷,4习题
  1507. if (!this.checkCanLearn()) {
  1508. return false;
  1509. }
  1510. // 学习次数
  1511. if (!(await this.exceedLearnNum(courseLists, section))) {
  1512. return false;
  1513. }
  1514. // 学习顺序
  1515. if (!(await this.orderTopTobottom(courseLists, section, type))) {
  1516. this.$message({
  1517. type: "warning",
  1518. message: "请学完视频课程再进行练习和测试",
  1519. });
  1520. return false;
  1521. }
  1522. //有次数限制
  1523. let num = await this.bankRecordDoNum(courseLists, section);
  1524. // section.doNum
  1525. if (section.answerNum - num > 0 && section.answerNum > 0) {
  1526. this.$router.push({
  1527. path: "/course-exam/" + this.goodsData.goodsId,
  1528. query: {
  1529. courseId: courseLists.courseId,
  1530. gradeId: this.goodsData.gradeId,
  1531. moduleId: section.moduleId || 0,
  1532. sectionId: section.sectionId || 0,
  1533. examId: section.typeId,
  1534. learning: section.learning,
  1535. type: type,
  1536. chapterId: section.chapterId || 0,
  1537. orderGoodsId: this.goodsData.orderGoodsId,
  1538. },
  1539. });
  1540. //没有答题次数限制
  1541. } else if (section.answerNum == 0) {
  1542. this.$router.push({
  1543. path: "/course-exam/" + this.goodsData.goodsId,
  1544. query: {
  1545. courseId: courseLists.courseId,
  1546. gradeId: this.goodsData.gradeId,
  1547. moduleId: section.moduleId || 0,
  1548. sectionId: section.sectionId || 0,
  1549. examId: section.typeId,
  1550. learning: section.learning,
  1551. type: type,
  1552. chapterId: section.chapterId || 0,
  1553. orderGoodsId: this.goodsData.orderGoodsId,
  1554. },
  1555. });
  1556. } else {
  1557. this.$message({
  1558. type: "warning",
  1559. message: "该试卷只能答题" + section.answerNum + "次",
  1560. });
  1561. return;
  1562. }
  1563. this.studyLog(
  1564. (section.moduleId = 0),
  1565. (section.chapterId = 0),
  1566. section.typeId,
  1567. courseLists
  1568. );
  1569. },
  1570. //校验节是否有试卷
  1571. checkSection(sectionId, key) {
  1572. let _data = this[key];
  1573. if (_data.length == 0) {
  1574. return false;
  1575. }
  1576. return _data.some((section) => section.sectionId == sectionId);
  1577. },
  1578. // 新增用户视频学习日志
  1579. studyLog(moduleId, chapterId, sectionId, courseLists) {
  1580. this.$axios({
  1581. url: "/user/study/log",
  1582. method: "post",
  1583. data: {
  1584. goodsId: this.goodsData.goodsId,
  1585. courseId: courseLists.courseId,
  1586. moduleId: moduleId || 0,
  1587. chapterId: chapterId || 0,
  1588. sectionId: sectionId || 0,
  1589. fromPlat: 2, //来源平台 1小程序 2PC网站
  1590. goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
  1591. orderGoodsId: this.goodsData.orderGoodsId,
  1592. },
  1593. }).then((res) => {
  1594. console.log("直播的用户学习日志:", res);
  1595. });
  1596. },
  1597. /**
  1598. * 获取培训项目详情
  1599. */
  1600. courseBusiness() {
  1601. this.$request.courseBusiness(this.goodsData.businessId).then((res) => {
  1602. this.businessData = res.data;
  1603. });
  1604. },
  1605. bankRecordDoNum(courseLists, section) {
  1606. return new Promise((resolve) => {
  1607. this.$request
  1608. .bankRecordDoNum({
  1609. goodsId: this.goodsData.goodsId,
  1610. gradeId: this.goodsData.gradeId,
  1611. chapterId: section.chapterId,
  1612. courseId: courseLists.courseId,
  1613. moduleId: 0,
  1614. examId: section.typeId,
  1615. })
  1616. .then((res) => {
  1617. resolve(res.data);
  1618. });
  1619. });
  1620. },
  1621. studyRecordMenuAllList(courseLists) {
  1622. return new Promise((resolve) => {
  1623. this.$request
  1624. .studyRecordMenuAllList({
  1625. courseId: courseLists.courseId,
  1626. gradeId: this.goodsData.gradeId,
  1627. goodsId: this.goodsData.goodsId,
  1628. })
  1629. .then((res) => {
  1630. res.data = res.data.filter((e) => e.sectionType != 2);
  1631. resolve(res.data);
  1632. });
  1633. });
  1634. },
  1635. gradeCheckGoodsStudy(courseItem, option) {
  1636. return new Promise((resolve) => {
  1637. this.$request
  1638. .gradeCheckGoodsStudy({
  1639. goodsId: this.goodsData.goodsId,
  1640. gradeId: courseItem.gradeId,
  1641. moduleId: option.moduleId || 0,
  1642. chapterId: option.chapterId || 0,
  1643. sectionId: option.sectionId || option.menuId,
  1644. })
  1645. .then((res) => {
  1646. resolve(res.data);
  1647. });
  1648. });
  1649. },
  1650. goodsTodayStudySectionNum(option) {
  1651. return new Promise((resolve) => {
  1652. this.$request
  1653. .goodsTodayStudySectionNum({
  1654. goodsId: this.goodsData.goodsId,
  1655. gradeId: option.gradeId,
  1656. })
  1657. .then((res) => {
  1658. resolve(res.data);
  1659. });
  1660. });
  1661. },
  1662. userConfirmInfoDetail() {
  1663. return new Promise((resolve) => {
  1664. this.$request
  1665. .userConfirmInfoDetail({
  1666. orderGoodsId: this.goodsData.orderGoodsId,
  1667. })
  1668. .then((res) => {
  1669. if (!res.data) {
  1670. clearInterval(this.confirmTimer);
  1671. this.confirmCount = 10;
  1672. this.showConfirm = true;
  1673. this.confirmTimer = setInterval(() => {
  1674. if (this.confirmCount > 0) {
  1675. this.confirmCount--;
  1676. } else {
  1677. clearInterval(this.confirmTimer);
  1678. }
  1679. }, 1000);
  1680. } else {
  1681. if (res.data.pushInfo) {
  1682. resolve(true);
  1683. } else {
  1684. this.$confirm(
  1685. "开通信息推送不成功,无法进入学习,请联系020-87085982!",
  1686. "提示",
  1687. {
  1688. confirmButtonText: "确定",
  1689. closeOnClickModal: false,
  1690. closeOnPressEscape: false,
  1691. distinguishCancelAndClose: false,
  1692. showClose: false,
  1693. showCancelButton: false,
  1694. }
  1695. )
  1696. .then((_) => {})
  1697. .catch((_) => {});
  1698. resolve(false);
  1699. }
  1700. }
  1701. });
  1702. });
  1703. },
  1704. confirmUser() {
  1705. if (!this.confirmChecked) {
  1706. this.$message.warning("请勾选确认个人信息无误");
  1707. return;
  1708. }
  1709. this.confirmLoading = true;
  1710. let infoJson = {
  1711. realname: this.userInfo.realname,
  1712. idCard: this.userInfo.idCard,
  1713. telphone: this.userInfo.telphone,
  1714. };
  1715. this.$request
  1716. .userConfirminfo({
  1717. infoJson: JSON.stringify(infoJson),
  1718. orderGoodsId: this.goodsData.orderGoodsId,
  1719. })
  1720. .then((res) => {
  1721. if (res.data.pushInfo) {
  1722. this.$message.success("提交成功");
  1723. } else {
  1724. this.$confirm(
  1725. "开通信息推送不成功,无法进入学习,请联系020-87085982!",
  1726. "提示",
  1727. {
  1728. confirmButtonText: "确定",
  1729. closeOnClickModal: false,
  1730. closeOnPressEscape: false,
  1731. distinguishCancelAndClose: false,
  1732. showClose: false,
  1733. showCancelButton: false,
  1734. }
  1735. )
  1736. .then((_) => {})
  1737. .catch((_) => {});
  1738. }
  1739. this.showConfirm = false;
  1740. this.confirmLoading = false;
  1741. });
  1742. },
  1743. /**
  1744. * @param {Object} goodsId 商品id
  1745. * 查询商品重修状态
  1746. */
  1747. courseGoodsRebuildStatus(goodsId, gradeId) {
  1748. return new Promise((resolve) => {
  1749. this.$request
  1750. .courseGoodsRebuildStatus({
  1751. goodsId: goodsId,
  1752. gradeId: gradeId,
  1753. })
  1754. .then((res) => {
  1755. resolve(res.data);
  1756. });
  1757. });
  1758. },
  1759. rebuildSubmit(item) {
  1760. this.$router.push({
  1761. path: `/my-course-detail/${item.goodsId}`,
  1762. query: {
  1763. gradeId: item.gradeId,
  1764. orderGoodsId: item.orderGoodsId,
  1765. rebuild: 1,
  1766. },
  1767. });
  1768. },
  1769. },
  1770. };
  1771. </script>
  1772. <!-- Add "scoped" attribute to limit CSS to this component only -->
  1773. <style scoped lang="scss">
  1774. .headerTitle {
  1775. color: #222;
  1776. font-weight: bold;
  1777. font-size: 24px;
  1778. padding: 28px 0px;
  1779. border-bottom: 1px solid #eee;
  1780. }
  1781. .firstTop {
  1782. padding: 24px 0px;
  1783. // margin: 24px 0px;
  1784. display: flex;
  1785. align-items: center;
  1786. justify-content: space-between;
  1787. .doubles {
  1788. display: flex;
  1789. align-items: center;
  1790. }
  1791. .iconStyle {
  1792. background-color: #3f8dfd;
  1793. color: #fff;
  1794. margin-right: 8px;
  1795. padding: 0px 4px;
  1796. border-radius: 4px;
  1797. font-size: 12px;
  1798. vertical-align: text-top;
  1799. }
  1800. .titles {
  1801. font-weight: bold;
  1802. color: #333;
  1803. font-size: 18px;
  1804. }
  1805. .showHide {
  1806. cursor: pointer;
  1807. user-select: none;
  1808. float: right;
  1809. color: #99a0a7;
  1810. }
  1811. }
  1812. .moduleStyle {
  1813. padding: 17px;
  1814. background-color: #f8f8f9;
  1815. font-weight: bold;
  1816. color: #222;
  1817. margin-bottom: 16px;
  1818. .showHide {
  1819. cursor: pointer;
  1820. user-select: none;
  1821. float: right;
  1822. color: #99a0a7;
  1823. }
  1824. }
  1825. .chapterStyle {
  1826. font-weight: 400;
  1827. .iconStyle {
  1828. background-color: #fff;
  1829. color: #3f8dfd;
  1830. margin-right: 8px;
  1831. padding: 0px 2px;
  1832. border-radius: 2px;
  1833. border: 1px solid #3f8dfd;
  1834. font-size: 10px;
  1835. vertical-align: text-top;
  1836. }
  1837. .showHide {
  1838. cursor: pointer;
  1839. user-select: none;
  1840. float: right;
  1841. color: #99a0a7;
  1842. }
  1843. margin-bottom: 16px;
  1844. padding: 17px;
  1845. border-bottom: 1px solid #eee;
  1846. }
  1847. .sectionStyle {
  1848. color: #99a0a7;
  1849. padding: 10px;
  1850. .iconStyles {
  1851. color: #99a0a7;
  1852. margin-right: 8px;
  1853. padding: 0px 2px;
  1854. }
  1855. }
  1856. .upStudyStyle {
  1857. background-color: #f2f7ff;
  1858. border: 1px solid #3f8dfd;
  1859. color: #3f8dfd;
  1860. padding: 3px 4px;
  1861. border-radius: 4px;
  1862. }
  1863. .sizeStyle {
  1864. font-size: 12px;
  1865. background-color: #fff !important;
  1866. border-color: #979ea5 !important;
  1867. color: #979ea5 !important;
  1868. padding: 2px 3px !important;
  1869. }
  1870. .hoverStyle {
  1871. cursor: pointer;
  1872. transition: all 0.2s;
  1873. &:hover {
  1874. background-color: #eaf3ff;
  1875. }
  1876. }
  1877. .hoverStyleSection {
  1878. transition: all 0.2s;
  1879. &:hover {
  1880. background-color: #eaf3ff;
  1881. }
  1882. }
  1883. .span_style {
  1884. max-width: 400px;
  1885. display: inline-block;
  1886. vertical-align: middle;
  1887. }
  1888. // 老师名字样式
  1889. .teacher_names {
  1890. display: flex;
  1891. margin-left: 20px;
  1892. .names {
  1893. font-size: 13px;
  1894. color: #666666;
  1895. margin-right: 12px;
  1896. cursor: pointer;
  1897. background: #f8f8f8;
  1898. border-radius: 4px;
  1899. padding: 3px 6px;
  1900. &.nactive {
  1901. color: #3f8dfd;
  1902. background: #f2f7ff;
  1903. }
  1904. }
  1905. }
  1906. </style>