index.vue 63 KB

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