index.vue 67 KB

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