index.vue 70 KB

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