index.vue 44 KB

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