index.vue 67 KB

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