index.vue 69 KB

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