index.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327
  1. <template>
  2. <div class="my-course">
  3. <div>
  4. <h4 class="headerTitle">
  5. <span v-if="goodsData.subjectNames" style="font-size: 20px"
  6. >【{{ goodsData.subjectNames }}】</span
  7. >{{ goodsData.goodsName
  8. }}<el-button
  9. size="mini"
  10. type="primary"
  11. plain
  12. icon="el-icon-sort"
  13. style="margin-left: 14px"
  14. @click="changeCourse"
  15. >切换科目</el-button
  16. >
  17. <el-button
  18. v-if="
  19. goodsData.applyStatus === 1 &&
  20. !(
  21. sysTime <= goodsData.serviceStartTime ||
  22. sysTime >= goodsData.serviceEndTime ||
  23. (goodsData.classStartTime &&
  24. sysTime <= goodsData.classStartTime) ||
  25. (goodsData.classEndTime && sysTime >= goodsData.classEndTime) ||
  26. goodsData.learningStatus == 2 ||
  27. goodsData.classStatus == 0 ||
  28. (goodsData.learningStatus == 3 &&
  29. sysTime < goodsData.learningTimeStart) ||
  30. !goodsData.examApplyGoodsList.length
  31. )
  32. "
  33. size="mini"
  34. type="warning"
  35. plain
  36. style="margin-left: 14px"
  37. @click="changeTest()"
  38. >预约考试
  39. </el-button>
  40. </h4>
  41. <div style="margin: 14px 0px">
  42. <el-button
  43. size="small"
  44. v-for="(item, index) in subjectList"
  45. :type="newActiveSubjectId === item.id ? 'primary' : ''"
  46. :key="index"
  47. @click="newActiveSubjectId = item.id"
  48. >{{ item.name }}</el-button
  49. >
  50. </div>
  51. <div v-for="(item, index) in filterList(courseList)" :key="index">
  52. <p class="firstTop hoverStyle" @click="changeStatus(item)">
  53. <span class="iconStyle">课</span
  54. ><span class="titles">{{ item.courseName }}</span
  55. ><span class="showHide"
  56. ><span v-if="item.showStatus">收起∧</span
  57. ><span v-else>展开∨</span></span
  58. >
  59. </p>
  60. <div
  61. v-if="item.children && item.children.length > 0 && item.showStatus"
  62. >
  63. <template v-for="(items, indexs) in item.children">
  64. <div v-if="items.type === 1" :key="indexs">
  65. <p
  66. class="moduleStyle hoverStyle"
  67. @click="changeModuleStatus(items, index, indexs)"
  68. >
  69. {{ items.menuName }}
  70. <span class="showHide"
  71. ><i v-if="items.showStatus" class="el-icon-arrow-up"></i>
  72. <i v-else class="el-icon-arrow-down"></i
  73. ></span>
  74. </p>
  75. <template
  76. v-if="
  77. items.showStatus &&
  78. items.children &&
  79. items.children.length > 0
  80. "
  81. >
  82. <div
  83. v-for="(i, k) in items.children"
  84. :key="k"
  85. style="padding-left: 20px"
  86. >
  87. <div
  88. class="chapterStyle hoverStyle"
  89. @click="changeChapterStatus(2, i, index, indexs, k)"
  90. >
  91. <!-- <span class="iconStyle">章</span> -->
  92. {{ i.name }}
  93. <span class="showHide"
  94. ><i v-if="i.showStatus" class="el-icon-arrow-up"></i>
  95. <i v-else class="el-icon-arrow-down"></i
  96. ></span>
  97. </div>
  98. <template v-if="i.showStatus && i.children.length > 0">
  99. <div
  100. v-for="(is, ks) in i.children"
  101. class="sectionStyle hoverStyleSection"
  102. :key="ks"
  103. style="padding-left: 20px"
  104. >
  105. <el-row style="display: flex; align-items: center">
  106. <el-col :span="12">
  107. <span class="iconStyles">•</span>
  108. <span class="upStudyStyle sizeStyle">{{
  109. is.sectionType === 1
  110. ? "录播"
  111. : is.sectionType === 2
  112. ? "直播"
  113. : is.sectionType === 3
  114. ? "回放"
  115. : "练习"
  116. }}</span>
  117. <span class="span_style">{{ is.name }}</span>
  118. <span v-if="is.recordStatus" class="upStudyStyle"
  119. >上次学到</span
  120. >
  121. </el-col>
  122. <el-col :span="4">
  123. <span v-show="is.teacherName"
  124. >已选讲师:{{ is.teacherName }}</span
  125. >
  126. </el-col>
  127. <el-col :span="3">
  128. <el-progress
  129. v-if="is.studyDuration && is.durationTime"
  130. :show-text="false"
  131. :percentage="
  132. (is.studyDuration / is.durationTime) * 100 > 100
  133. ? 100
  134. : (is.studyDuration / is.durationTime) * 100
  135. "
  136. ></el-progress>
  137. </el-col>
  138. <el-col :span="2">
  139. <span v-show="is.studyDuration">
  140. {{
  141. $tools.secondToDate(is.studyDuration) +
  142. "/" +
  143. $tools.secondToDate(is.durationTime)
  144. }}
  145. </span>
  146. </el-col>
  147. <el-col
  148. :span="2"
  149. :offset="1"
  150. v-if="is.sectionType != 2"
  151. >
  152. <el-button
  153. size="mini"
  154. type="text"
  155. style="width: 90px !important"
  156. v-if="
  157. is.studyDuration > 0 &&
  158. is.durationTime > 0 &&
  159. is.studyDuration == is.durationTime
  160. "
  161. @click="studyFunc(item, is)"
  162. >再次学习</el-button
  163. >
  164. <el-button
  165. type="primary"
  166. size="mini"
  167. style="width: 90px !important"
  168. v-else-if="
  169. is.studyDuration > 0 &&
  170. is.durationTime > 0 &&
  171. is.studyDuration != is.durationTime
  172. "
  173. @click="studyFunc(item, is)"
  174. >继续学习</el-button
  175. >
  176. <el-button
  177. size="mini"
  178. type="primary"
  179. style="width: 90px !important"
  180. plain
  181. v-else-if="
  182. is.studyDuration == 0 && is.durationTime > 0
  183. "
  184. @click="studyFunc(item, is)"
  185. >未开始</el-button
  186. > </el-col
  187. ><el-col :span="2" :offset="1" v-else>
  188. <el-button
  189. size="mini"
  190. plain
  191. disabled
  192. type="success"
  193. style="width: 90px !important"
  194. v-if="is.liveStartTime > sysTime"
  195. @click="studyFunc(item, is)"
  196. >未开播</el-button
  197. >
  198. <el-button
  199. size="mini"
  200. plain
  201. disabled
  202. type="danger"
  203. style="width: 90px !important"
  204. v-else-if="is.liveEndTime < sysTime"
  205. @click="studyFunc(item, is)"
  206. >已结束</el-button
  207. >
  208. <el-button
  209. size="mini"
  210. plain
  211. type="primary"
  212. style="width: 90px !important; text-align: center"
  213. v-else-if="
  214. is.liveEndTime > sysTime &&
  215. is.liveStartTime < sysTime
  216. "
  217. @click="studyFunc(item, is)"
  218. >进入直播间</el-button
  219. >
  220. </el-col>
  221. </el-row>
  222. </div>
  223. </template>
  224. </div>
  225. </template>
  226. </div>
  227. <div v-if="items.type === 2" :key="indexs">
  228. <div
  229. class="chapterStyle hoverStyle"
  230. @click="changeChapterStatus(1, items, index, indexs)"
  231. >
  232. <!-- <span class="iconStyle">章</span> -->
  233. {{ items.menuName }}
  234. <span class="showHide"
  235. ><i v-if="items.showStatus" class="el-icon-arrow-up"></i>
  236. <i v-else class="el-icon-arrow-down"></i
  237. ></span>
  238. </div>
  239. <template v-if="items.showStatus && items.children.length > 0">
  240. <div
  241. v-for="(i, k) in items.children"
  242. class="sectionStyle hoverStyleSection"
  243. :key="k"
  244. style="padding-left: 20px"
  245. >
  246. <el-row style="display: flex; align-items: center">
  247. <el-col :span="12">
  248. <span class="iconStyles">•</span>
  249. <span class="upStudyStyle sizeStyle">{{
  250. i.sectionType === 1
  251. ? "录播"
  252. : i.sectionType === 2
  253. ? "直播"
  254. : i.sectionType === 3
  255. ? "回放"
  256. : "练习"
  257. }}</span>
  258. <span class="span_style">
  259. {{ i.name }}
  260. </span>
  261. <span v-if="i.recordStatus" class="upStudyStyle"
  262. >上次学到</span
  263. >
  264. </el-col>
  265. <el-col :span="4">
  266. <span v-show="i.teacherName"
  267. >已选讲师:{{ i.teacherName }}</span
  268. >
  269. </el-col>
  270. <el-col :span="3">
  271. <el-progress
  272. v-if="i.studyDuration && i.durationTime"
  273. :show-text="false"
  274. :percentage="
  275. (i.studyDuration / i.durationTime) * 100 > 100
  276. ? 100
  277. : (i.studyDuration / i.durationTime) * 100
  278. "
  279. ></el-progress>
  280. </el-col>
  281. <el-col :span="2">
  282. <span v-show="i.studyDuration">
  283. {{
  284. $tools.secondToDate(i.studyDuration) +
  285. "/" +
  286. $tools.secondToDate(i.durationTime)
  287. }}
  288. </span>
  289. </el-col>
  290. <el-col :span="2" :offset="1" v-if="i.sectionType != 2">
  291. <el-button
  292. size="mini"
  293. type="text"
  294. style="width: 90px !important"
  295. v-if="
  296. i.studyDuration > 0 &&
  297. i.durationTime > 0 &&
  298. i.studyDuration == i.durationTime
  299. "
  300. @click="studyFunc(item, i)"
  301. >再次学习</el-button
  302. >
  303. <el-button
  304. type="primary"
  305. size="mini"
  306. style="width: 90px !important"
  307. v-else-if="
  308. i.studyDuration > 0 &&
  309. i.durationTime > 0 &&
  310. i.studyDuration != i.durationTime
  311. "
  312. @click="studyFunc(item, i)"
  313. >继续学习</el-button
  314. >
  315. <el-button
  316. size="mini"
  317. plain
  318. type="primary"
  319. style="width: 90px !important"
  320. v-else-if="i.studyDuration == 0 && i.durationTime > 0"
  321. @click="studyFunc(item, i)"
  322. >未开始</el-button
  323. >
  324. </el-col>
  325. <el-col :span="2" :offset="1" v-else>
  326. <el-button
  327. size="mini"
  328. style="width: 90px !important"
  329. plain
  330. disabled
  331. type="success"
  332. v-if="i.liveStartTime > sysTime"
  333. @click="studyFunc(item, i)"
  334. >未开播</el-button
  335. >
  336. <el-button
  337. size="mini"
  338. style="width: 90px !important"
  339. plain
  340. disabled
  341. type="danger"
  342. v-else-if="i.liveEndTime < sysTime"
  343. @click="studyFunc(item, i)"
  344. >已结束</el-button
  345. >
  346. <el-button
  347. size="mini"
  348. style="width: 90px !important; text-align: center"
  349. plain
  350. type="primary"
  351. v-else-if="
  352. i.liveEndTime > sysTime && i.liveStartTime < sysTime
  353. "
  354. @click="studyFunc(item, i)"
  355. >进入直播间</el-button
  356. >
  357. </el-col>
  358. </el-row>
  359. </div>
  360. </template>
  361. </div>
  362. <div
  363. v-if="items.type === 3"
  364. :key="indexs"
  365. class="sectionStyle hoverStyle"
  366. >
  367. <el-row style="display: flex; align-items: center">
  368. <el-col :span="12">
  369. <span class="iconStyles">•</span>
  370. <span class="upStudyStyle sizeStyle">{{
  371. items.sectionType === 1
  372. ? "录播"
  373. : items.sectionType === 2
  374. ? "直播"
  375. : items.sectionType === 3
  376. ? "回放"
  377. : "练习"
  378. }}</span>
  379. <span class="span_style">
  380. {{ items.menuName }}
  381. </span>
  382. <span v-if="items.recordStatus" class="upStudyStyle"
  383. >上次学到</span
  384. >
  385. </el-col>
  386. <el-col :span="4">
  387. <span v-show="items.teacherName"
  388. >已选讲师:{{ items.teacherName }}</span
  389. >
  390. </el-col>
  391. <el-col :span="3">
  392. <el-progress
  393. v-if="items.studyDuration && items.durationTime"
  394. :show-text="false"
  395. :percentage="
  396. (items.studyDuration / items.durationTime) * 100 > 100
  397. ? 100
  398. : (items.studyDuration / items.durationTime) * 100
  399. "
  400. ></el-progress>
  401. </el-col>
  402. <el-col :span="2">
  403. <span v-show="items.studyDuration">
  404. {{
  405. $tools.secondToDate(items.studyDuration) +
  406. "/" +
  407. $tools.secondToDate(items.durationTime)
  408. }}
  409. </span>
  410. </el-col>
  411. <el-col :span="2" :offset="1" v-if="items.sectionType != 2">
  412. <el-button
  413. size="mini"
  414. style="width: 90px !important"
  415. type="text"
  416. v-if="
  417. items.studyDuration > 0 &&
  418. items.durationTime > 0 &&
  419. items.studyDuration == items.durationTime
  420. "
  421. @click="studyFunc(item, items)"
  422. >再次学习</el-button
  423. >
  424. <el-button
  425. type="primary"
  426. style="width: 90px !important"
  427. size="mini"
  428. v-else-if="
  429. items.studyDuration > 0 &&
  430. items.durationTime > 0 &&
  431. items.studyDuration != items.durationTime
  432. "
  433. @click="studyFunc(item, items)"
  434. >继续学习</el-button
  435. >
  436. <el-button
  437. style="width: 90px !important"
  438. plain
  439. size="mini"
  440. type="primary"
  441. v-else-if="
  442. items.studyDuration == 0 && items.durationTime > 0
  443. "
  444. @click="studyFunc(item, items)"
  445. >未开始</el-button
  446. >
  447. </el-col>
  448. <el-col :span="2" :offset="1" v-else>
  449. <el-button
  450. size="mini"
  451. style="width: 90px !important"
  452. plain
  453. disabled
  454. type="success"
  455. v-if="items.liveStartTime > sysTime"
  456. @click="studyFunc(item, items)"
  457. >未开播</el-button
  458. >
  459. <el-button
  460. size="mini"
  461. style="width: 90px !important"
  462. plain
  463. disabled
  464. type="danger"
  465. v-else-if="items.liveEndTime < sysTime"
  466. @click="studyFunc(item, items)"
  467. >已结束</el-button
  468. >
  469. <el-button
  470. size="mini"
  471. style="width: 90px !important; text-align: center"
  472. plain
  473. type="primary"
  474. v-else-if="
  475. items.liveEndTime > sysTime &&
  476. items.liveStartTime < sysTime
  477. "
  478. @click="studyFunc(item, items)"
  479. >进入直播间</el-button
  480. >
  481. </el-col>
  482. </el-row>
  483. </div>
  484. </template>
  485. </div>
  486. </div>
  487. </div>
  488. <courseData ref="courseData" @backData="backData" />
  489. <el-dialog
  490. title="实名验证确认"
  491. :visible.sync="showConfirm"
  492. width="600px"
  493. class="showconfirm"
  494. :close-on-click-modal="false"
  495. :close-on-press-escape="false"
  496. :show-close="false"
  497. >
  498. <div class="showconfirm__content">
  499. <div class="text">
  500. 为避免个人信息不正确导致您的学习时长无效,请认真核对以下信息是否正确,如信息有误请取消当前操作,立刻联系020-38946666
  501. </div>
  502. <el-descriptions :column="1">
  503. <el-descriptions-item label="姓名">{{
  504. userInfo && userInfo.realname
  505. }}</el-descriptions-item>
  506. <el-descriptions-item label="手机号">{{
  507. userInfo && userInfo.telphone
  508. }}</el-descriptions-item>
  509. <el-descriptions-item label="身份证号">{{
  510. userInfo && userInfo.idCard
  511. }}</el-descriptions-item>
  512. </el-descriptions>
  513. <div class="">
  514. <el-checkbox v-model="confirmChecked">确认个人信息无误</el-checkbox>
  515. </div>
  516. </div>
  517. <span slot="footer" class="dialog-footer">
  518. <el-button @click="showConfirm = false">取 消</el-button>
  519. <el-button
  520. type="primary"
  521. @click="confirmUser"
  522. :disabled="confirmCount > 0"
  523. :loading="confirmLoading"
  524. >{{
  525. confirmCount > 0 ? "确 定(" + confirmCount + ")" : "确 定"
  526. }}</el-button
  527. >
  528. </span>
  529. </el-dialog>
  530. <RebuildModal
  531. ref="rebuildModal"
  532. @rebuildSubmit="rebuildSubmit($event)"
  533. ></RebuildModal>
  534. <!-- 预约考试弹窗 -->
  535. <appoint-test
  536. :appointModal.sync="appointModal"
  537. :appointItem="goodsData"
  538. ></appoint-test>
  539. </div>
  540. </template>
  541. <script>
  542. import { mapGetters, mapActions } from "vuex";
  543. import courseData from "./courseData.vue";
  544. import RebuildModal from "@/components/rebuildModal";
  545. import AppointTest from "./components/AppointTest.vue";
  546. export default {
  547. name: "MyCourse",
  548. components: { courseData, RebuildModal, AppointTest },
  549. data() {
  550. return {
  551. goodsData: {},
  552. courseList: [],
  553. sysTime: 0,
  554. showConfirm: false,
  555. confirmCount: 10,
  556. confirmChecked: false,
  557. confirmTimer: null,
  558. confirmLoading: false,
  559. appointModal: false, // 预约考试弹窗
  560. subjectList: [], //当前商品课程科目汇总
  561. newActiveSubjectId: "", //当前选中ID
  562. };
  563. },
  564. computed: {
  565. ...mapGetters(["userInfo"]),
  566. filterList:function(){
  567. return function(item){
  568. console.log(this.newActiveSubjectId)
  569. let array = []
  570. if(this.newActiveSubjectId){
  571. array = item.filter(items => {
  572. return items.subjectId === this.newActiveSubjectId
  573. })
  574. }else{
  575. return item
  576. }
  577. return array
  578. }
  579. }
  580. },
  581. mounted() {
  582. this.getRecord();
  583. this.sysTime = this.$tools.timest();
  584. },
  585. methods: {
  586. comeStyle(courseItem, item) {
  587. console.log(item, "itemitem");
  588. this.$router.push({
  589. path: `/my-course-detail/${this.goodsData.goodsId}`,
  590. query: {
  591. gradeId: courseItem.gradeId,
  592. orderGoodsId: this.goodsData.orderGoodsId,
  593. courseId: courseItem.courseId,
  594. chapterId: item.chapterId,
  595. moduleId: item.moduleId,
  596. sectionId: item.sectionId || item.menuId,
  597. recordingUrl: item.recordingUrl,
  598. liveUrl: item.liveUrl,
  599. sectionType: item.sectionType,
  600. liveStartTime: item.liveStartTime,
  601. liveEndTime: item.liveEndTime,
  602. },
  603. });
  604. },
  605. changeCourse() {
  606. console.log("this.goodsData", this.goodsData);
  607. this.$refs.courseData.openBoxs(this.goodsData);
  608. },
  609. changeTest() {
  610. this.appointModal = true;
  611. },
  612. backData(item) {
  613. this.goodsData = item;
  614. this.getGoodsCourseList(item);
  615. },
  616. //数组对象去重
  617. uniqueFunc(arr, uniId) {
  618. const res = new Map();
  619. return arr.filter(
  620. (item) => !res.has(item[uniId]) && res.set(item[uniId], 1)
  621. );
  622. },
  623. /**
  624. * 获取课程列表
  625. */
  626. getGoodsCourseList(item) {
  627. return new Promise((resolve, reject) => {
  628. this.$request
  629. .courseCourseList({
  630. goodsId: item.goodsId,
  631. gradeId: item.gradeId,
  632. })
  633. .then((res) => {
  634. var array = [];
  635. res.rows.forEach((element) => {
  636. element.showStatus = false;
  637. element.children = [];
  638. array.push({
  639. id: element.subjectId,
  640. name: element.subjectName,
  641. });
  642. });
  643. this.courseList = res.rows;
  644. array = this.uniqueFunc(array, "id");
  645. array.unshift({
  646. id: "",
  647. name: "全部",
  648. });
  649. this.subjectList = array;
  650. this.newActiveSubjectId = "";
  651. resolve();
  652. // if (res.rows && res.rows.length > 0) {
  653. // this.getRecord(res.rows[0]);
  654. // }
  655. });
  656. });
  657. },
  658. getGoodsData(res) {
  659. return new Promise((resolve, reject) => {
  660. this.$request
  661. .courseGoodsList({ orderGoodsId: res.data.orderGoodsId })
  662. .then(async (result) => {
  663. if (result.rows.length == 0) {
  664. this.resultCourseGoodsList();
  665. } else {
  666. let array = result.rows[0];
  667. array.orderGoodsId = res.data.orderGoodsId;
  668. this.goodsData = array;
  669. await this.getGoodsCourseList(array);
  670. resolve();
  671. }
  672. });
  673. });
  674. },
  675. /**
  676. * 获取学习记录
  677. */
  678. getRecord(item) {
  679. this.$request.studyrecordgetUserWatchLast().then(async (res) => {
  680. if (res.data && res.data.sectionId) {
  681. await this.getGoodsData(res);
  682. var stop = false;
  683. for (let i = 0; i < this.courseList.length; i++) {
  684. if (stop) {
  685. break;
  686. }
  687. if (this.courseList[i].courseId == res.data.courseId) {
  688. await this.changeStatus(this.courseList[i]);
  689. for (let k = 0; k < this.courseList[i].children.length; k++) {
  690. if (res.data.moduleId) {
  691. console.log(1);
  692. if (
  693. this.courseList[i].children[k].menuId == res.data.moduleId
  694. ) {
  695. await this.changeModuleStatus(
  696. this.courseList[i].children[k],
  697. i,
  698. k
  699. );
  700. for (
  701. let j = 0;
  702. j < this.courseList[i].children[k].children.length;
  703. j++
  704. ) {
  705. if (
  706. this.courseList[i].children[k].children[j].chapterId ==
  707. res.data.chapterId
  708. ) {
  709. await this.changeChapterStatus(
  710. 2,
  711. this.courseList[i].children[k].children[j],
  712. i,
  713. k,
  714. j
  715. );
  716. for (
  717. let m = 0;
  718. m <
  719. this.courseList[i].children[k].children[j].children
  720. .length;
  721. m++
  722. ) {
  723. if (
  724. this.courseList[i].children[k].children[j].children[
  725. m
  726. ].sectionId == res.data.sectionId
  727. ) {
  728. this.$set(
  729. this.courseList[i].children[k].children[j]
  730. .children[m],
  731. "recordStatus",
  732. true
  733. );
  734. stop = true;
  735. break;
  736. }
  737. }
  738. }
  739. }
  740. }
  741. } else if (res.data.chapterId) {
  742. console.log(2);
  743. if (
  744. this.courseList[i].children[k].menuId == res.data.chapterId
  745. ) {
  746. await this.changeChapterStatus(
  747. 1,
  748. this.courseList[i].children[k],
  749. i,
  750. k
  751. );
  752. for (
  753. let j = 0;
  754. j < this.courseList[i].children[k].children.length;
  755. j++
  756. ) {
  757. if (
  758. this.courseList[i].children[k].children[j].sectionId ==
  759. res.data.sectionId
  760. ) {
  761. this.$set(
  762. this.courseList[i].children[k].children[j],
  763. "recordStatus",
  764. true
  765. );
  766. stop = true;
  767. break;
  768. }
  769. }
  770. }
  771. } else {
  772. console.log(3);
  773. if (
  774. this.courseList[i].children[k].menuId == res.data.sectionId
  775. ) {
  776. this.$set(
  777. this.courseList[i].children[k],
  778. "recordStatus",
  779. true
  780. );
  781. stop = true;
  782. break;
  783. }
  784. }
  785. }
  786. }
  787. }
  788. } else {
  789. this.resultCourseGoodsList();
  790. }
  791. });
  792. },
  793. resultCourseGoodsList() {
  794. this.$request.courseGoodsList({ pageNum: 1, pageSize: 1 }).then((res) => {
  795. if (res.rows && res.rows.length > 0) {
  796. this.backData(res.rows[0]);
  797. }
  798. });
  799. },
  800. /**
  801. * 展开获取课程详情列表
  802. */
  803. changeStatus(item) {
  804. return new Promise((resolve, reject) => {
  805. console.log(item);
  806. if (item.children.length > 0) {
  807. item.showStatus = !item.showStatus;
  808. return;
  809. }
  810. this.$request
  811. .reMenuList({
  812. courseId: item.courseId,
  813. gradeId: item.gradeId,
  814. orderGoodsId: this.goodsData.orderGoodsId,
  815. })
  816. .then((res) => {
  817. res.rows.forEach((items) => {
  818. if (items.type != 3) {
  819. items.showStatus = false;
  820. items.children = [];
  821. }
  822. });
  823. for (let i = 0; i < this.courseList.length; i++) {
  824. if (this.courseList[i].courseId == item.courseId) {
  825. this.$set(this.courseList[i], "children", res.rows);
  826. this.$set(
  827. this.courseList[i],
  828. "showStatus",
  829. !this.courseList[i].showStatus
  830. );
  831. break;
  832. }
  833. }
  834. resolve();
  835. });
  836. });
  837. },
  838. /**
  839. * 模块详情列表
  840. */
  841. changeModuleStatus(item, index, indexs) {
  842. return new Promise((resolve, reject) => {
  843. if (item.children && item.children.length > 0) {
  844. item.showStatus = !item.showStatus;
  845. return;
  846. }
  847. this.$request
  848. .reChapterList({
  849. moduleId: item.menuId,
  850. gradeId: item.gradeId,
  851. courseId: item.courseId,
  852. })
  853. .then((res) => {
  854. res.data.forEach((items) => {
  855. items.children = [];
  856. items.showStatus = false;
  857. });
  858. this.$set(
  859. this.courseList[index].children[indexs],
  860. "children",
  861. res.data
  862. );
  863. item.showStatus = !item.showStatus;
  864. resolve();
  865. });
  866. });
  867. },
  868. /**
  869. * 章详情列表 type = 1 父级章 type = 2 父级模块
  870. */
  871. changeChapterStatus(type, item, courseIndex, index, indexs) {
  872. return new Promise((resolve, reject) => {
  873. console.log(item,'定位')
  874. if (item.children && item.children.length > 0) {
  875. item.showStatus = !item.showStatus;
  876. return;
  877. }
  878. this.$request
  879. .reSectionList({
  880. chapterId: type === 1 ? item.menuId : item.chapterId,
  881. gradeId: item.gradeId,
  882. courseId: item.courseId,
  883. moduleId: item.moduleId || 0,
  884. orderGoodsId: this.goodsData.orderGoodsId,
  885. })
  886. .then((res) => {
  887. if (type === 1) {
  888. this.$set(
  889. this.courseList[courseIndex].children[index],
  890. "children",
  891. res.data
  892. );
  893. }
  894. if (type === 2) {
  895. this.$set(
  896. this.courseList[courseIndex].children[index].children[indexs],
  897. "children",
  898. res.data
  899. );
  900. }
  901. item.showStatus = !item.showStatus;
  902. resolve();
  903. });
  904. });
  905. },
  906. async studyFunc(courseItem, items) {
  907. this.sysTime = this.$tools.timest();
  908. let item = this.goodsData;
  909. console.log(item, "学习服务期");
  910. if (item.interfaceAccountId > 0) {
  911. //学习账号已开通
  912. if (item.learnStatus == 1) {
  913. //跳转第三方h5
  914. this.$router.push({
  915. path: `/my-course-detail/${item.goodsId}`,
  916. query: {
  917. gradeId: item.gradeId,
  918. orderGoodsId: item.orderGoodsId,
  919. isOther: 1,
  920. },
  921. });
  922. return;
  923. } else {
  924. this.$message({
  925. type: "warning",
  926. message:
  927. "您的学习账号未开通,请稍后再尝试,有疑问,请联系020-87085982!",
  928. });
  929. return;
  930. }
  931. }
  932. if (
  933. (item.serviceStartTime && this.sysTime <= item.serviceStartTime) ||
  934. (item.serviceEndTime && this.sysTime >= item.serviceEndTime)
  935. ) {
  936. this.$message({
  937. type: "warning",
  938. message: "不在学习服务期,不能进入学习",
  939. });
  940. return;
  941. }
  942. if (
  943. (item.classStartTime && this.sysTime <= item.classStartTime) ||
  944. (item.classEndTime && this.sysTime >= item.classEndTime)
  945. ) {
  946. this.$message({
  947. type: "warning",
  948. message: "不在班级有效期,不能进入学习",
  949. });
  950. return;
  951. }
  952. if (item.learningStatus == 2) {
  953. this.$message({
  954. type: "warning",
  955. message: "开放学习时间待定,不能进入学习",
  956. });
  957. return;
  958. }
  959. if (item.classStatus == 0) {
  960. this.$message({
  961. type: "warning",
  962. message: "尚未开班,不能进入学习",
  963. });
  964. return;
  965. }
  966. if (item.learningStatus == 3 && this.sysTime < item.learningTimeStart) {
  967. this.$message({
  968. type: "warning",
  969. message: "不在开放学习时间,不能进入学习",
  970. });
  971. return;
  972. }
  973. var confirmDetail = true;
  974. if (item.educationName == "继续教育") {
  975. if (
  976. item.officialName &&
  977. item.businessName == "二级" &&
  978. item.projectName == "建造师"
  979. ) {
  980. confirmDetail = await this.userConfirmInfoDetail();
  981. }
  982. }
  983. // //内部系统
  984. // if (item.interfacePushId > 0 && item.officialStatus != 1) {
  985. // this.$message({
  986. // type: "warning",
  987. // message: "机构正在为您报名中,请耐心等待,有疑问请联系020-87085982!",
  988. // });
  989. // return;
  990. // }
  991. if (!confirmDetail) {
  992. return;
  993. }
  994. let rebuildStatus = await this.courseGoodsRebuildStatus(
  995. item.goodsId,
  996. item.gradeId
  997. );
  998. if (rebuildStatus == 0) {
  999. this.$refs.rebuildModal.showModal(item);
  1000. return;
  1001. }
  1002. // if (item.educationName == "继续教育") {
  1003. this.$request
  1004. .lockLockStatus({
  1005. action: "jxjy",
  1006. uuid: sessionStorage.getItem("uuid"),
  1007. })
  1008. .then((res) => {
  1009. //有其他端在操作,不能学习
  1010. this.$message({
  1011. type: "warning",
  1012. message: res.msg,
  1013. });
  1014. })
  1015. .catch((err) => {
  1016. //可以学习
  1017. this.$request
  1018. .courseCourseList({
  1019. pageNum: 1,
  1020. pageSize: 1,
  1021. goodsId: item.goodsId,
  1022. gradeId: item.gradeId,
  1023. })
  1024. .then(async (res) => {
  1025. //学习次数是否上限---start
  1026. let learnNum = await this.goodsTodayStudySectionNum(courseItem);
  1027. let hasLearn = await this.gradeCheckGoodsStudy(courseItem, items);
  1028. console.log(learnNum, hasLearn);
  1029. if (this.goodsData.sectionMaxNum > 0) {
  1030. if (learnNum >= this.goodsData.sectionMaxNum && !hasLearn) {
  1031. this.clickLock = false;
  1032. this.$message({
  1033. type: "warning",
  1034. message: `每天最多学习${this.goodsData.sectionMaxNum}节`,
  1035. });
  1036. return;
  1037. }
  1038. }
  1039. //学习次数是否上限---end
  1040. if (res.rows.length) {
  1041. // this.$emit("backData", item);
  1042. // this.dialogVisible = false;
  1043. this.comeStyle(courseItem, items);
  1044. // this.$router.push({
  1045. // path: `/my-course-detail/${item.goodsId}`,
  1046. // query: {
  1047. // gradeId: item.gradeId,
  1048. // orderGoodsId: item.orderGoodsId,
  1049. // courseId: res.rows[0].courseId || "",
  1050. // },
  1051. // });
  1052. // }
  1053. } else {
  1054. this.$message({
  1055. type: "warning",
  1056. message: "课程内暂无可以学习的科目",
  1057. });
  1058. }
  1059. });
  1060. });
  1061. },
  1062. gradeCheckGoodsStudy(courseItem, option) {
  1063. return new Promise((resolve) => {
  1064. this.$request
  1065. .gradeCheckGoodsStudy({
  1066. goodsId: this.goodsData.goodsId,
  1067. gradeId: courseItem.gradeId,
  1068. moduleId: option.moduleId || 0,
  1069. chapterId: option.chapterId || 0,
  1070. sectionId: option.sectionId || option.menuId,
  1071. })
  1072. .then((res) => {
  1073. resolve(res.data);
  1074. });
  1075. });
  1076. },
  1077. goodsTodayStudySectionNum(option) {
  1078. return new Promise((resolve) => {
  1079. this.$request
  1080. .goodsTodayStudySectionNum({
  1081. goodsId: this.goodsData.goodsId,
  1082. gradeId: option.gradeId,
  1083. })
  1084. .then((res) => {
  1085. resolve(res.data);
  1086. });
  1087. });
  1088. },
  1089. userConfirmInfoDetail() {
  1090. return new Promise((resolve) => {
  1091. this.$request
  1092. .userConfirmInfoDetail({
  1093. orderGoodsId: this.goodsData.orderGoodsId,
  1094. })
  1095. .then((res) => {
  1096. if (!res.data) {
  1097. clearInterval(this.confirmTimer);
  1098. this.confirmCount = 10;
  1099. this.showConfirm = true;
  1100. this.confirmTimer = setInterval(() => {
  1101. if (this.confirmCount > 0) {
  1102. this.confirmCount--;
  1103. } else {
  1104. clearInterval(this.confirmTimer);
  1105. }
  1106. }, 1000);
  1107. } else {
  1108. if (res.data.pushInfo) {
  1109. resolve(true);
  1110. } else {
  1111. this.$confirm(
  1112. "开通信息推送不成功,无法进入学习,请联系020-87085982!",
  1113. "提示",
  1114. {
  1115. confirmButtonText: "确定",
  1116. closeOnClickModal: false,
  1117. closeOnPressEscape: false,
  1118. distinguishCancelAndClose: false,
  1119. showClose: false,
  1120. showCancelButton: false,
  1121. }
  1122. )
  1123. .then((_) => {})
  1124. .catch((_) => {});
  1125. resolve(false);
  1126. }
  1127. }
  1128. });
  1129. });
  1130. },
  1131. confirmUser() {
  1132. if (!this.confirmChecked) {
  1133. this.$message.warning("请勾选确认个人信息无误");
  1134. return;
  1135. }
  1136. this.confirmLoading = true;
  1137. let infoJson = {
  1138. realname: this.userInfo.realname,
  1139. idCard: this.userInfo.idCard,
  1140. telphone: this.userInfo.telphone,
  1141. };
  1142. this.$request
  1143. .userConfirminfo({
  1144. infoJson: JSON.stringify(infoJson),
  1145. orderGoodsId: this.goodsData.orderGoodsId,
  1146. })
  1147. .then((res) => {
  1148. if (res.data.pushInfo) {
  1149. this.$message.success("提交成功");
  1150. } else {
  1151. this.$confirm(
  1152. "开通信息推送不成功,无法进入学习,请联系020-87085982!",
  1153. "提示",
  1154. {
  1155. confirmButtonText: "确定",
  1156. closeOnClickModal: false,
  1157. closeOnPressEscape: false,
  1158. distinguishCancelAndClose: false,
  1159. showClose: false,
  1160. showCancelButton: false,
  1161. }
  1162. )
  1163. .then((_) => {})
  1164. .catch((_) => {});
  1165. }
  1166. this.showConfirm = false;
  1167. this.confirmLoading = false;
  1168. });
  1169. },
  1170. /**
  1171. * @param {Object} goodsId 商品id
  1172. * 查询商品重修状态
  1173. */
  1174. courseGoodsRebuildStatus(goodsId, gradeId) {
  1175. return new Promise((resolve) => {
  1176. this.$request
  1177. .courseGoodsRebuildStatus({
  1178. goodsId: goodsId,
  1179. gradeId: gradeId,
  1180. })
  1181. .then((res) => {
  1182. resolve(res.data);
  1183. });
  1184. });
  1185. },
  1186. rebuildSubmit(item) {
  1187. this.$router.push({
  1188. path: `/my-course-detail/${item.goodsId}`,
  1189. query: {
  1190. gradeId: item.gradeId,
  1191. orderGoodsId: item.orderGoodsId,
  1192. rebuild: 1,
  1193. },
  1194. });
  1195. },
  1196. },
  1197. };
  1198. </script>
  1199. <!-- Add "scoped" attribute to limit CSS to this component only -->
  1200. <style scoped lang="scss">
  1201. .headerTitle {
  1202. color: #222;
  1203. font-weight: bold;
  1204. font-size: 24px;
  1205. padding: 28px 0px;
  1206. border-bottom: 1px solid #eee;
  1207. }
  1208. .firstTop {
  1209. padding: 24px 0px;
  1210. // margin: 24px 0px;
  1211. .iconStyle {
  1212. background-color: #3f8dfd;
  1213. color: #fff;
  1214. margin-right: 8px;
  1215. padding: 0px 4px;
  1216. border-radius: 4px;
  1217. font-size: 12px;
  1218. vertical-align: text-top;
  1219. }
  1220. .titles {
  1221. font-weight: bold;
  1222. color: #333;
  1223. font-size: 18px;
  1224. }
  1225. .showHide {
  1226. cursor: pointer;
  1227. user-select: none;
  1228. float: right;
  1229. color: #99a0a7;
  1230. }
  1231. }
  1232. .moduleStyle {
  1233. padding: 17px;
  1234. background-color: #f8f8f9;
  1235. font-weight: bold;
  1236. color: #222;
  1237. margin-bottom: 16px;
  1238. .showHide {
  1239. cursor: pointer;
  1240. user-select: none;
  1241. float: right;
  1242. color: #99a0a7;
  1243. }
  1244. }
  1245. .chapterStyle {
  1246. font-weight: 400;
  1247. .iconStyle {
  1248. background-color: #fff;
  1249. color: #3f8dfd;
  1250. margin-right: 8px;
  1251. padding: 0px 2px;
  1252. border-radius: 2px;
  1253. border: 1px solid #3f8dfd;
  1254. font-size: 10px;
  1255. vertical-align: text-top;
  1256. }
  1257. .showHide {
  1258. cursor: pointer;
  1259. user-select: none;
  1260. float: right;
  1261. color: #99a0a7;
  1262. }
  1263. margin-bottom: 16px;
  1264. padding: 17px;
  1265. border-bottom: 1px solid #eee;
  1266. }
  1267. .sectionStyle {
  1268. color: #99a0a7;
  1269. padding: 10px;
  1270. .iconStyles {
  1271. color: #99a0a7;
  1272. margin-right: 8px;
  1273. padding: 0px 2px;
  1274. }
  1275. }
  1276. .upStudyStyle {
  1277. background-color: #f2f7ff;
  1278. border: 1px solid #3f8dfd;
  1279. color: #3f8dfd;
  1280. padding: 3px 4px;
  1281. border-radius: 4px;
  1282. }
  1283. .sizeStyle {
  1284. background-color: #fff !important;
  1285. border-color: #979ea5 !important;
  1286. color: #979ea5 !important;
  1287. padding: 2px 3px !important;
  1288. }
  1289. .hoverStyle {
  1290. cursor: pointer;
  1291. transition: all 0.2s;
  1292. &:hover {
  1293. background-color: #eaf3ff;
  1294. }
  1295. }
  1296. .hoverStyleSection {
  1297. transition: all 0.2s;
  1298. &:hover {
  1299. background-color: #eaf3ff;
  1300. }
  1301. }
  1302. .span_style {
  1303. max-width: 400px;
  1304. display: inline-block;
  1305. vertical-align: middle;
  1306. }
  1307. </style>