index.vue 41 KB

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