index.vue 41 KB

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