index.vue 71 KB

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