index.vue 41 KB

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