index.vue 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395
  1. <template>
  2. <view class="learnings">
  3. <nav-logo title="学习中心"></nav-logo>
  4. <u-line color="#D6D6DB" />
  5. <view class="contents">
  6. <!-- <view class="diatance">
  7. <image class="clock" src="/static/learn/clock.png" mode=""></image>
  8. <text>
  9. 一级建造师,距离考试还有
  10. </text>
  11. <u-count-down :timestamp="leftDays" :show-days="true" separator="zh"
  12. :show-hours="false" :show-minutes="false" :show-seconds="false" font-size="28"
  13. bg-color="#007AFF" separator-color="#fff" color="#fff" separator-size="28">
  14. </u-count-down>
  15. </view> -->
  16. <!-- 有学习的课程 -->
  17. <view v-if="allCourse" class="had_courses">
  18. <!-- 直播 -->
  19. <view v-if="livingLists.length" class="lives">
  20. <view
  21. v-for="(live, l_index) in livingLists"
  22. :key="l_index"
  23. class="live_item"
  24. @click="toLiveLook(live)"
  25. >
  26. <view class="live_con">
  27. <view class="live_status">
  28. <image
  29. v-if="bgShow(live.liveStartTime, live.watchStatus)"
  30. src="/static/learn/living.png"
  31. class="liv_icon"
  32. ></image>
  33. <image
  34. v-else
  35. src="/static/learn/wlive.png"
  36. class="liv_icon"
  37. ></image>
  38. <text class="status_s">{{
  39. live.liveStartTime | liveStatus(live.watchStatus)
  40. }}</text>
  41. <view
  42. class="look_bt"
  43. :class="{
  44. living:
  45. lookTimeStatus(live.liveStartTime, live.watchStatus) == 1,
  46. futuring:
  47. lookTimeStatus(live.liveStartTime, live.watchStatus) == 4,
  48. curring: [2, 3].includes(
  49. lookTimeStatus(live.liveStartTime, live.watchStatus)
  50. ),
  51. }"
  52. >
  53. <text
  54. v-if="
  55. lookTimeStatus(live.liveStartTime, live.watchStatus) == 1
  56. "
  57. >点击观看</text
  58. >
  59. <text
  60. v-if="
  61. lookTimeStatus(live.liveStartTime, live.watchStatus) == 2
  62. "
  63. >即将开播</text
  64. >
  65. <template
  66. v-if="
  67. lookTimeStatus(live.liveStartTime, live.watchStatus) == 3
  68. "
  69. >
  70. 剩余:
  71. <u-count-down
  72. :timestamp="curTimeTamp(live.liveStartTime)"
  73. :show-days="false"
  74. color="#fff"
  75. separator-color="#fff"
  76. font-size="24"
  77. separator-size="24"
  78. bg-color="#FFB102"
  79. >
  80. </u-count-down>
  81. </template>
  82. <template
  83. v-if="
  84. lookTimeStatus(live.liveStartTime, live.watchStatus) == 4
  85. "
  86. >
  87. 剩余:
  88. <u-count-down
  89. :timestamp="curTimeTamp(live.liveStartTime)"
  90. :show-days="true"
  91. separator="zh"
  92. color="#fff"
  93. separator-color="#fff"
  94. bg-color="#007AFF"
  95. :show-hours="false"
  96. :show-minutes="false"
  97. :show-seconds="false"
  98. font-size="24"
  99. separator-size="24"
  100. >
  101. </u-count-down>
  102. <u-count-down
  103. :timestamp="curTimeTamp(live.liveStartTime)"
  104. :show-days="false"
  105. color="#fff"
  106. separator-color="#fff"
  107. bg-color="#007AFF"
  108. font-size="24"
  109. separator-size="24"
  110. >
  111. </u-count-down>
  112. </template>
  113. </view>
  114. </view>
  115. <view class="liv_time">
  116. <text class="timeR">{{
  117. live.liveStartTime | formate("mm月dd日")
  118. }}</text>
  119. <text>{{ live.liveStartTime | formate("hh:mm") }}</text>
  120. </view>
  121. <view class="liv_title">{{ live.name }}</view>
  122. </view>
  123. <image
  124. v-if="bgShow(live.liveStartTime, live.watchStatus)"
  125. src="/static/learn/living_bg.png"
  126. class="my_bg"
  127. ></image>
  128. <image
  129. v-else
  130. src="/static/learn/wlive_bg.png"
  131. class="my_bg"
  132. ></image>
  133. </view>
  134. </view>
  135. <!-- 我的课程 -->
  136. <view v-if="courseLists.length" class="my_courses">
  137. <text class="titles">我的课程</text>
  138. <view
  139. v-for="(item, index) in courseLists"
  140. :key="index"
  141. class="course_item"
  142. >
  143. <view
  144. class="c_downs"
  145. @click="studyIn(item.goodsId, item.gradeId, item, index)"
  146. >
  147. <view class="lefts">
  148. <image
  149. class="lefet_img"
  150. :src="$method.splitImgHost(item.coverUrl, true)"
  151. mode=""
  152. ></image>
  153. <view v-if="item.goodsType == 6" class="live_icon">直播</view>
  154. </view>
  155. <view class="rights">
  156. <view class="learn_progress">
  157. <view class="progress_up">
  158. <view class="cou_titles line2"
  159. >{{ item.goodsName }}</view
  160. >
  161. <view class="classHour">
  162. <text
  163. >{{
  164. item.courseNum || item.courseNum == 0
  165. ? item.courseNum
  166. : "-"
  167. }}课程/</text
  168. >
  169. <text
  170. >{{
  171. item.classHours || item.classHours == 0
  172. ? item.classHours
  173. : "-"
  174. }}学时/</text
  175. >
  176. <text>{{ item.secAllNum + item.examNum || "-" }}节</text>
  177. </view>
  178. </view>
  179. </view>
  180. </view>
  181. </view>
  182. <view class="course_item_info" v-if="item.goodsType !== 6">
  183. <view>
  184. <text>学习状态:</text>
  185. <view
  186. style="display: inline-block; font-size: 24rpx"
  187. v-html="backLearStatusText(item)"
  188. ></view>
  189. </view>
  190. <view>
  191. <text>学习进度:</text>
  192. <text>
  193. {{ item.stuAllNum + item.recordNum }}/{{
  194. item.secAllNum + item.examNum
  195. }}
  196. </text>
  197. </view>
  198. <view>
  199. <text>学习服务:</text>
  200. <text>
  201. {{
  202. $method.formDate(item.serviceStartTime, "yyyy/mm/dd")
  203. }}至{{
  204. $method.formDate(item.serviceEndTime, "yyyy/mm/dd")
  205. }}</text
  206. >
  207. </view>
  208. <view>
  209. <text>班级状态:</text>
  210. <text>
  211. {{ classStatusCompt(item) }}
  212. </text>
  213. </view>
  214. <view>
  215. <text>班级有效:</text>
  216. <template v-if="item.classEndTime">
  217. <text>
  218. {{ $method.formDate(item.classEndTime, "yyyy/mm/dd") }}
  219. </text>
  220. <text class="eb"
  221. >(剩余{{
  222. $method.GetRTime(item.classEndTime) > 0
  223. ? $method.GetRTime(item.classEndTime)
  224. : 0
  225. }}天)</text
  226. >
  227. </template>
  228. <text v-else>——</text>
  229. </view>
  230. <view
  231. class="class-warm"
  232. v-if="item.subscribeId != null && item.periodStatus == 1"
  233. >
  234. <view class="class-warm__text">
  235. <view class="date">
  236. <view v-if="item.subExamStatus === null">待预约考试</view>
  237. <view
  238. v-else-if="
  239. item.subExamStatus === 0 &&
  240. sysTime <
  241. $method.TimeTotimestamp(
  242. $method.timestampToTime(
  243. item.subApplySiteExamTime,
  244. true
  245. ) +
  246. ' ' +
  247. item.subApplySiteStartTime
  248. )
  249. "
  250. >
  251. 待考试,考试时间:
  252. {{
  253. $method.timestampToTime(
  254. item.subApplySiteExamTime,
  255. true
  256. ) +
  257. " " +
  258. item.subApplySiteStartTime
  259. }}
  260. -
  261. {{
  262. $method.timestampToTime(
  263. item.subApplySiteExamTime,
  264. true
  265. ) +
  266. " " +
  267. item.subApplySiteEndTime
  268. }}
  269. </view>
  270. <view v-else-if="item.subExamStatus === 0"
  271. >待出考试结果</view
  272. >
  273. <view v-else-if="item.subExamStatus === 1">
  274. <text v-if="item.subResult === null">待出考试结果</text>
  275. <text v-if="item.subResult === 0"
  276. >考试结果:不通过,需补考</text
  277. >
  278. <text v-else-if="item.subResult === 1"
  279. >考试结果:通过,考试成绩为{{
  280. item.subPerformance
  281. }}</text
  282. >
  283. </view>
  284. <view v-else-if="item.subExamStatus === 2"
  285. >缺考,无成绩,需补考</view
  286. >
  287. <view v-else-if="item.subExamStatus === 3"
  288. >作弊,无成绩,需补考</view
  289. >
  290. <view v-else-if="item.subExamStatus === 4"
  291. >替考,无成绩,需补考</view
  292. >
  293. </view>
  294. </view>
  295. </view>
  296. </view>
  297. <view class="study_tips">
  298. <div
  299. v-if="
  300. $method.GetRTime(item.serviceEndTime) <= 20 &&
  301. $method.GetRTime(item.serviceEndTime) >= 0 &&
  302. (item.periodStatus == 0 || item.periodStatus == -1)
  303. "
  304. >
  305. 温馨提示:当前学习服务期至{{
  306. $method.timestampToTime(item.serviceEndTime)
  307. }},超期学时无效,为防审核异常请于{{
  308. $method.timestampToTime(item.serviceEndTime - 864000, false)
  309. }}
  310. 前完成学习,当前剩余有效学习时间为{{
  311. $method.GetRTime(item.serviceEndTime) < 0
  312. ? 0
  313. : $method.GetRTime(item.serviceEndTime)
  314. }}天。
  315. </div>
  316. <div
  317. v-if="
  318. item.gradeStatus == 1 &&
  319. item.status == 1 &&
  320. item.serviceEndTime > sysTime &&
  321. item.serviceStartTime < sysTime &&
  322. item.classEndTime &&
  323. item.classEndTime < sysTime &&
  324. (item.periodStatus == 0 || item.periodStatus == -1)
  325. "
  326. >
  327. <span v-if="item.studyCount > 0"
  328. >温馨提示:班级已过期,如需重新学习,请点击右侧“选班重学”按钮。</span
  329. >
  330. <span v-else
  331. >温馨提示:班级已过期,您的重学次数已用完,如有疑问请联系{{
  332. $store.state.userInfo.eduPhone
  333. }}</span
  334. >
  335. </div>
  336. <div v-if="item.serviceEndTime && item.serviceEndTime < sysTime">
  337. 温馨提示:学习服务期已截至,如有疑问请联系:{{
  338. $store.state.userInfo.eduPhone
  339. }}
  340. </div>
  341. <div v-if="item.periodStatus === 2">
  342. 温馨提示:您已完成本课程所有学时学习,我校将对学时进行审核,审核及推送时长预估15个工作日,如有疑问请联系:{{
  343. $store.state.userInfo.eduPhone
  344. }},学时查询网址:http://gdzczx.gdcic.net
  345. </div>
  346. <div v-if="item.periodStatus === 1">
  347. 温馨提示:您的班级学习初审已通过,待广东省建设信息中心归集学时,归集完成即为完成本次继续教育学习。归集学时需约10-15个工作日,具体以广东省建设执业资格注册服务平台的“继续教育学时查询”公布学时记录为准,学时查询网址:http://gdzczx.gdcic.net
  348. </div>
  349. </view>
  350. <!-- 按钮 -->
  351. <view class="study_btns">
  352. <template
  353. v-if="
  354. item.gradeStatus == 1 &&
  355. item.status == 1 &&
  356. item.serviceEndTime > sysTime &&
  357. item.serviceStartTime < sysTime &&
  358. item.classEndTime &&
  359. item.classEndTime < sysTime &&
  360. (item.periodStatus == 0 || item.periodStatus == -1) &&
  361. item.userStudyCount > 0
  362. "
  363. >
  364. <view
  365. class="exam_word ones"
  366. @click.stop="selectClass(item, index)"
  367. >
  368. 选班重学
  369. </view>
  370. </template>
  371. <!-- examApplyGoodsList.length -是判断是否关联指定学员 -->
  372. <view v-else class="exam_btns">
  373. <view
  374. class="box_appoint"
  375. v-if="
  376. item.applyStatus === 1 &&
  377. !(
  378. sysTime <= item.serviceStartTime ||
  379. sysTime >= item.serviceEndTime ||
  380. (item.classStartTime && sysTime <= item.classStartTime) ||
  381. (item.classEndTime && sysTime >= item.classEndTime) ||
  382. item.learningStatus == 2 ||
  383. item.classStatus == 0 ||
  384. (item.learningStatus == 3 &&
  385. sysTime < item.learningTimeStart) ||
  386. !item.examApplyGoodsList.length
  387. )
  388. "
  389. @click="appointment(item, appoint)"
  390. >
  391. <view class="exam_word ones">预约考试</view>
  392. </view>
  393. <view
  394. class="box_appoint"
  395. v-if="
  396. item.beforeStatus === 1 &&
  397. !(
  398. sysTime <= item.serviceStartTime ||
  399. sysTime >= item.serviceEndTime ||
  400. (item.classStartTime && sysTime <= item.classStartTime) ||
  401. (item.classEndTime && sysTime >= item.classEndTime) ||
  402. item.learningStatus == 2 ||
  403. item.classStatus == 0 ||
  404. (item.learningStatus == 3 &&
  405. sysTime < item.learningTimeStart)
  406. )
  407. "
  408. @click="appBeforeAddress(item.goodsId, item)"
  409. >
  410. <view class="exam_word ones">进入刷题</view>
  411. </view>
  412. </view>
  413. <view
  414. class="box_appoint"
  415. @click="studyIn(item.goodsId, item.gradeId, item, index)"
  416. >
  417. <view class="exam_word intos">进入学习</view>
  418. </view>
  419. </view>
  420. </view>
  421. </view>
  422. </view>
  423. <!-- 没有学习的课程 -->
  424. <view v-if="!allLoading && !allCourse" class="no_datas">
  425. <image
  426. class="courses"
  427. src="/static/learn/no_course.png"
  428. mode=""
  429. ></image>
  430. <view class="no_learns">您目前没有可学习的课程</view>
  431. <view class="choose" @click="toChoose()">立即去选购</view>
  432. </view>
  433. </view>
  434. <!-- 弹窗 -->
  435. <u-popup
  436. v-model="selectClassModal"
  437. @close="gradeValue = -1"
  438. mode="bottom"
  439. border-radius="40"
  440. >
  441. <view class="popup_box">
  442. <view style="margin-bottom: 20rpx">
  443. <view class="line1"></view>
  444. <view class="grade">选择班级</view>
  445. </view>
  446. <u-line color="#D6D6DB" />
  447. <view>
  448. <scroll-view scroll-y="true" style="height: 500rpx">
  449. <view>
  450. <u-radio-group v-model="gradeValue" @change="radioGroupChange">
  451. <view v-for="(item, index) in gradeList" :key="index">
  452. <view
  453. style="display: flex; align-items: center; padding: 20rpx"
  454. >
  455. <view>
  456. <u-radio
  457. shape="circle"
  458. :name="index"
  459. :disabled="
  460. item.studentNum > 0 &&
  461. item.studentNum == item.studentUpper
  462. "
  463. >
  464. <view
  465. :class="
  466. item.checked ? 'white-box blue-box' : 'white-box'
  467. "
  468. >
  469. <view>
  470. <view class="blackTxt">{{ item.className }}</view>
  471. <view class="redTxt" v-if="item.classEndTime">
  472. 有效期至:{{
  473. $method.timestampToTime(
  474. item.classEndTime,
  475. true,
  476. true
  477. )
  478. }}
  479. </view>
  480. <view class="redTxt" v-if="item.classEndTime">
  481. 本班还剩{{
  482. $method.GetRTime(item.classEndTime)
  483. }}天将结束学习</view
  484. >
  485. </view>
  486. </view>
  487. </u-radio>
  488. </view>
  489. </view>
  490. </view>
  491. </u-radio-group>
  492. </view>
  493. </scroll-view>
  494. </view>
  495. <view class="confrim-btn">
  496. <view class="okBtn" @click="okPopup()">确定</view>
  497. </view>
  498. </view>
  499. </u-popup>
  500. <u-modal
  501. v-model="showUserConfirmInfo"
  502. @confirm="confirmUserConfirm"
  503. ref="uModal"
  504. :async-close="true"
  505. @cancel="cancelUserConfirm"
  506. :confirm-text="
  507. '确认' + (confirmCount > 0 ? '(' + confirmCount + ')' : '')
  508. "
  509. :confirm-color="confirmCount > 0 ? '#999' : '#2979ff'"
  510. class="confirm-modal"
  511. title="实名验证确认"
  512. cancel="取消"
  513. :show-cancel-button="true"
  514. >
  515. <view class="slot-content">
  516. <view class="content">
  517. <!-- ,立刻联系020-38946666 -->
  518. 为避免个人信息不正确导致您的学习时长无效,请认真核对以下信息是否正确,如信息有误请取消当前操作。
  519. <view class="msg-list" v-if="userInfo">
  520. <view class="item">
  521. <text class="item__left">姓名:</text>
  522. <text class="item__right">{{ userInfo.realname }}</text>
  523. </view>
  524. <view class="item">
  525. <text class="item__left">手机号:</text>
  526. <text class="item__right">{{ userInfo.telphone }}</text>
  527. </view>
  528. <view class="item">
  529. <text class="item__left">身份号:</text>
  530. <text class="item__right">{{ userInfo.idCard }}</text>
  531. </view>
  532. <view class="item">
  533. <u-checkbox v-model="confirmChecked" :label-disabled="false"
  534. >确认个人信息无误</u-checkbox
  535. >
  536. </view>
  537. </view>
  538. </view>
  539. </view>
  540. </u-modal>
  541. <!-- 多个预约考试时的弹窗 -->
  542. <u-popup v-model="appointTestShow" mode="bottom" border-radius="40">
  543. <view class="popuptest_box">
  544. <view class="check_head">
  545. <view class="headers">
  546. <view class="grade">切换课程</view>
  547. <u-icon
  548. name="close"
  549. color="#9C9C9C"
  550. size="40"
  551. @click="closePop()"
  552. ></u-icon>
  553. </view>
  554. </view>
  555. <view class="check_con">
  556. <scroll-view scroll-y="true" style="height: 700rpx">
  557. <view
  558. class="course_items"
  559. v-for="(appoint, index) in appointTestList"
  560. :key="index"
  561. >
  562. <view class="course_lefts">
  563. <view class="course_title">{{ appoint.applyName }}</view>
  564. </view>
  565. <view
  566. class="course_rights"
  567. @click="jumpTest(appointItemIndex, appoint)"
  568. >
  569. <view class="intoStudy">预约</view>
  570. </view>
  571. </view>
  572. </scroll-view>
  573. </view>
  574. </view>
  575. </u-popup>
  576. </view>
  577. </template>
  578. <script>
  579. var curTime = new Date().getTime(); // 当前时间的时间戳
  580. import { mapGetters, mapActions } from "vuex";
  581. export default {
  582. data() {
  583. return {
  584. leftDays: 0,
  585. paramC: {
  586. pageNum: 1,
  587. pageSize: 10,
  588. },
  589. activeItem: {},
  590. itemIndex: "",
  591. confirmTimer: null,
  592. confirmCount: 10,
  593. confirmChecked: false,
  594. showUserConfirmInfo: false,
  595. selectItem: {},
  596. selectClassModal: false,
  597. gradeList: [],
  598. gradeValue: -1,
  599. sysTime: 0,
  600. courseLists: [], // 课程列表
  601. total: 0,
  602. livingLists: [], // 直播列表
  603. allLoading: false, // 加载样式
  604. current: 2,
  605. appointTestShow: false, //预约考试弹窗
  606. appointTestList: [],
  607. appointItemIndex: {}, // 点击了哪项课程
  608. imgwidth: 0,
  609. imgheight: 0,
  610. };
  611. },
  612. filters: {
  613. liveStatus(liveTime, watchStatus) {
  614. let value = liveTime * 1000;
  615. if (curTime < value) {
  616. // 判断当前时间和直播开始时间
  617. return " 未开播";
  618. } else {
  619. return watchStatus == "live" ? "正在直播中" : "即将开播";
  620. }
  621. },
  622. },
  623. computed: {
  624. ...mapGetters(["userInfo", "config"]),
  625. allCourse() {
  626. return this.courseLists.length || this.livingLists.length ? true : false;
  627. },
  628. eduPhone() {
  629. return this.userInfo.eduPhone;
  630. },
  631. backLearStatusText() {
  632. return ({
  633. periodStatus,
  634. stuAllNum,
  635. recordNum,
  636. secAllNum,
  637. examNum,
  638. periodPlush,
  639. }) => {
  640. let text = "";
  641. let color = "";
  642. switch (periodStatus) {
  643. case -1:
  644. const stuAll = stuAllNum + recordNum;
  645. const secAll = secAllNum + examNum;
  646. let index = 0;
  647. if (stuAll == 0) {
  648. index == 0;
  649. } else if (stuAll > 0 && stuAll < secAll) {
  650. index == 1;
  651. } else if (stuAll >= secAll) {
  652. index == 2;
  653. }
  654. text = ["未开始", "学习中", "已学完"][index];
  655. color = ["#EB5757", "#498AFE", "#498AFE"][index];
  656. break;
  657. case 0:
  658. case 2:
  659. case 3:
  660. text = ["审核不通过", "", "待审核", "初审完成"][periodStatus];
  661. color = ["#EB5757", "", "#F67205", "#F67205"][periodStatus];
  662. case 1:
  663. text = periodPlush > 0 ? "学时已上报信息中心" : "学时审核通过";
  664. color = "#F67205";
  665. default:
  666. break;
  667. }
  668. return `<span style='color: ${color}'>${text}</span>`;
  669. };
  670. },
  671. classStatusCompt: function () {
  672. return function (item, sysTime) {
  673. var str = "未开班";
  674. if (item.classEndTime && item.classEndTime < sysTime) {
  675. str = "已过期";
  676. } else if (item.classStartTime && item.classStartTime > sysTime) {
  677. str = "未开始";
  678. } else if (
  679. item.gradeId &&
  680. item.gradeStatus == 1 &&
  681. item.classStatus === 1
  682. ) {
  683. str = "已开班";
  684. } else if (
  685. item.gradeId &&
  686. item.gradeStatus == 1 &&
  687. item.classStatus === 0
  688. ) {
  689. str = "未开班";
  690. }
  691. return str;
  692. };
  693. },
  694. },
  695. onLoad() {
  696. // 1668873600 ,2022.11.20的时间戳
  697. this.leftDays = 1668873600 - parseInt(curTime / 1000);
  698. this.sysTime = +this.$method.timest();
  699. if (this.$method.isLogin()) {
  700. !this.userInfo && this.$api.refreshUserInfo();
  701. }
  702. },
  703. async onShow() {
  704. uni.pageScrollTo({
  705. duration: 0,
  706. scrollTop: 0, // number number number!
  707. });
  708. this.getCourseLiveQues();
  709. // await this.commonSystemTime()
  710. },
  711. onPullDownRefresh() {
  712. this.getCourseLiveQues();
  713. },
  714. onReachBottom() {
  715. if (this.courseLists.length <= this.total) {
  716. this.paramC.pageNum++;
  717. this.getCourseList();
  718. }
  719. },
  720. methods: {
  721. ...mapActions(["getUserInfo"]),
  722. bgShow(liveTime, watchStatus) {
  723. let value = liveTime * 1000;
  724. if (curTime > value) {
  725. // 判断当前时间和直播开始时间
  726. return watchStatus == "live" ? true : false;
  727. }
  728. },
  729. lookTimeStatus(liveTime, watchStatus) {
  730. if (liveTime) {
  731. let value = new Date(liveTime * 1000);
  732. var Y = value.getFullYear();
  733. var M =
  734. value.getMonth() + 1 < 10
  735. ? "0" + (value.getMonth() + 1)
  736. : value.getMonth() + 1;
  737. var D = value.getDate() < 10 ? "0" + value.getDate() : value.getDate();
  738. var valZ = Y + "/" + M + "/" + D;
  739. let curZeroTime = new Date(valZ).getTime(); // 获取开始直播时间当天的零点时间戳
  740. if (curTime > value) {
  741. // 判断当前时间和直播开始时间
  742. if (watchStatus == "live") {
  743. //
  744. return 1;
  745. } else {
  746. return 2;
  747. }
  748. } else {
  749. if (curZeroTime <= curTime && curTime <= value) {
  750. //当天
  751. return 3;
  752. } else {
  753. return 4;
  754. }
  755. }
  756. }
  757. },
  758. curTimeTamp(liveTime) {
  759. let min = liveTime - parseInt(curTime / 1000);
  760. return min;
  761. },
  762. toChoose() {
  763. uni.switchTab({
  764. url: "/pages/course/index",
  765. });
  766. },
  767. // 查询直播课
  768. getCourseLiveQues() {
  769. if (!this.$method.isLogin()) {
  770. return;
  771. }
  772. this.allLoading = true;
  773. this.paramC.pageNum = 1;
  774. let arrs = [
  775. this.$api.listUserVideoLive(this.paramC), // 查询用户拥有视频+直播商品 /goods/listUserVideoLive
  776. this.$api.getgoodsLiveList({
  777. pageNum: 1,
  778. pageSize: 3, // 默认3条
  779. }),
  780. ];
  781. wx.stopPullDownRefresh();
  782. Promise.all(arrs)
  783. .then((res) => {
  784. // if (res.data.code == 200) {
  785. const [{ data: res1 }, { data: res2 }] = res;
  786. if (res1.code == 200) {
  787. this.total = res1.total;
  788. this.courseLists = res1.rows || [];
  789. }
  790. // if (res2.code == 200) {
  791. // this.questionLists = res2.rows || []
  792. // }
  793. if (res2.code == 200) {
  794. this.livingLists = res2.rows || [];
  795. } else {
  796. this.$u.toast(res2.msg);
  797. }
  798. this.allLoading = false;
  799. this.sysTime = +this.$method.timest();
  800. // }
  801. uni.hideLoading();
  802. })
  803. .catch((err) => {
  804. uni.hideLoading();
  805. this.allLoading = false;
  806. });
  807. },
  808. getCourseList() {
  809. this.$api
  810. .listUserVideoLive(this.paramC)
  811. .then((res) => {
  812. this.courseLists.push(...res.data.rows);
  813. })
  814. .finally((e) => {
  815. uni.hideLoading();
  816. });
  817. },
  818. // 看直播
  819. toLiveLook(item) {
  820. let moduleId = item.moduleId || 0;
  821. let chapterId = item.chapterId || 0;
  822. let sectionId = item.sectionId || item.menuId;
  823. let uuid = new Date().valueOf() + "";
  824. // buyCourse 是否购买课程:1是 0否
  825. let encode = encodeURIComponent(
  826. this.config.hostLive +
  827. "/pages/live/index?token=" +
  828. uni.getStorageSync("token") +
  829. "&userInfo=" +
  830. (JSON.stringify(this.userInfo) || "") +
  831. "&channelId=" +
  832. item.liveUrl +
  833. "&gradeId=" +
  834. 0 +
  835. "&courseId=" +
  836. item.courseId +
  837. "&goodsId=" +
  838. item.goodsId +
  839. "&orderGoodsId=" +
  840. item.orderGoodsId +
  841. "&sectionId=" +
  842. sectionId +
  843. "&chapterId=" +
  844. chapterId +
  845. "&moduleId=" +
  846. moduleId +
  847. "&buyCourse=1" +
  848. "&ident=" +
  849. uuid +
  850. "&sectionType=2"
  851. );
  852. uni.navigateTo({
  853. url: `../../pages/webview/index?url=` + encode,
  854. });
  855. },
  856. toLive(item) {
  857. this.$api
  858. .courseCourseList({
  859. pageNum: 1,
  860. pageSize: 1,
  861. goodsId: item.goodsId,
  862. gradeId: 0,
  863. orderGoodsId: item.orderGoodsId,
  864. })
  865. .then((res) => {
  866. if (res.data.code == 200) {
  867. if (res.data.total > 1) {
  868. // uni.navigateTo({
  869. // url:'/pages5/liveDetail/course?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0'
  870. // })
  871. uni.navigateTo({
  872. url:
  873. "/pages3/live/detail?orderGoodsId=" +
  874. item.orderGoodsId +
  875. "&goodsId=" +
  876. item.goodsId +
  877. '&gradeId=0&courseId=""',
  878. });
  879. } else if (res.data.total == 1) {
  880. uni.navigateTo({
  881. url:
  882. "/pages3/live/detail?orderGoodsId=" +
  883. item.orderGoodsId +
  884. "&goodsId=" +
  885. item.goodsId +
  886. "&gradeId=0&courseId=" +
  887. res.data.rows[0].courseId,
  888. });
  889. } else {
  890. uni.showToast({
  891. icon: "none",
  892. title: "暂无可观看的直播课程",
  893. });
  894. }
  895. }
  896. });
  897. },
  898. async studyIn(v, i, item, index) {
  899. if (item.externalLinkStatus) {
  900. this.$method.toLink(item.externalLink);
  901. return;
  902. }
  903. if (item.goodsType == 6) {
  904. // 进入直播课
  905. this.toLive(item);
  906. return;
  907. }
  908. // 进入视频课
  909. this.activeItem = item;
  910. if (item.interfaceAccountId > 0) {
  911. //学习账号已开通
  912. if (item.learnStatus > 0) {
  913. //跳转第三方h5
  914. uni.navigateTo({
  915. url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}&isOther=1`,
  916. });
  917. return;
  918. } else {
  919. const text = this.eduPhone ? ",有疑问,请联系" + this.eduPhone : "";
  920. uni.showModal({
  921. showCancel: false,
  922. content: "您的学习账号未开通,请稍后再尝试" + text,
  923. });
  924. return;
  925. }
  926. return;
  927. }
  928. if (
  929. item.serviceStartTime &&
  930. (this.sysTime <= item.serviceStartTime ||
  931. this.sysTime >= item.serviceEndTime)
  932. ) {
  933. uni.showToast({
  934. icon: "none",
  935. title: "不在学习服务期,不能进入学习",
  936. });
  937. return;
  938. }
  939. if (
  940. (item.classStartTime && this.sysTime <= item.classStartTime) ||
  941. (item.classEndTime && this.sysTime >= item.classEndTime)
  942. ) {
  943. uni.showToast({
  944. icon: "none",
  945. title: "不在班级有效期,不能进入学习",
  946. });
  947. return;
  948. }
  949. // learningStatus: 1即刻,2待定,3不在日期内
  950. if (item.learningStatus == 2) {
  951. uni.showToast({
  952. icon: "none",
  953. title: "开放学习时间待定,不能进入学习",
  954. });
  955. return;
  956. }
  957. if (item.classStatus == 0) {
  958. uni.showToast({
  959. icon: "none",
  960. title: "尚未开班,不能进入学习",
  961. });
  962. return;
  963. }
  964. if (item.learningStatus == 3 && this.sysTime < item.learningTimeStart) {
  965. uni.showToast({
  966. icon: "none",
  967. title: "不在开放学习时间,不能进入学习",
  968. });
  969. return;
  970. }
  971. uni.showLoading({
  972. title: "拼命加载中...",
  973. mask: true,
  974. });
  975. // var confirmDetail = true;
  976. // if (item.educationName == "继续教育") {
  977. // if (
  978. // item.officialName &&
  979. // item.businessName == "二级" &&
  980. // item.projectName == "建造师"
  981. // ) {
  982. // confirmDetail = await this.userConfirmInfoDetail();
  983. // }
  984. // }
  985. // if (!confirmDetail) {
  986. // return;
  987. // }
  988. this.itemIndex = index;
  989. if (
  990. item.gradeStatus == 1 &&
  991. item.status == 1 &&
  992. item.serviceEndTime > this.sysTime &&
  993. item.classEndTime &&
  994. item.classEndTime < this.sysTime &&
  995. (item.periodStatus == 0 || item.periodStatus == -1) &&
  996. item.studyCount > 0
  997. ) {
  998. this.selectClass(item, index, "loading");
  999. return;
  1000. }
  1001. // /course/goodsRebuildStatus查询用户商品重修状态
  1002. let rebuildStatus = await this.courseGoodsRebuildStatus(
  1003. item.goodsId,
  1004. item.gradeId
  1005. );
  1006. if (rebuildStatus == 0) {
  1007. uni.hideLoading();
  1008. this.$navTo.togo("/pages2/learn/details", {
  1009. gradeId: item.gradeId,
  1010. goodsId: item.goodsId,
  1011. orderGoodsId: item.orderGoodsId,
  1012. });
  1013. return;
  1014. }
  1015. this.$method.checkLock().then(() => {
  1016. this.$http({
  1017. url: "/course/courseList",
  1018. method: "get",
  1019. data: {
  1020. pageNum: 1,
  1021. pageSize: 100,
  1022. goodsId: item.goodsId,
  1023. gradeId: item.gradeId,
  1024. orderGoodsId: item.orderGoodsId,
  1025. },
  1026. noLoading: true,
  1027. }).then((res) => {
  1028. if (res.data.code == 200) {
  1029. if (res.data.total > 1) {
  1030. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  1031. uni.navigateTo({
  1032. url: `/pages3/polyv/detail?id=''&goodsId=${
  1033. item.goodsId
  1034. }&orderGoodsId=${item.orderGoodsId}&gradeId=${
  1035. item.gradeId
  1036. }&periodWaitTime=${item.periodWaitTime ? 1 : ""}`,
  1037. });
  1038. } else if (res.data.total == 1) {
  1039. uni.navigateTo({
  1040. url: `/pages3/polyv/detail?id=${
  1041. res.data.rows[0].courseId
  1042. }&goodsId=${item.goodsId}&orderGoodsId=${
  1043. item.orderGoodsId
  1044. }&gradeId=${item.gradeId}&periodWaitTime=${
  1045. item.periodWaitTime ? "" : 1
  1046. }`,
  1047. });
  1048. } else {
  1049. uni.showToast({
  1050. icon: "none",
  1051. title: "暂无可观看的视频课程",
  1052. });
  1053. }
  1054. }
  1055. });
  1056. });
  1057. },
  1058. toDetail() {
  1059. this.$http({
  1060. url: "/course/courseList",
  1061. method: "get",
  1062. data: {
  1063. pageNum: 1,
  1064. pageSize: 100,
  1065. goodsId: item.goodsId,
  1066. gradeId: item.gradeId,
  1067. orderGoodsId: item.orderGoodsId,
  1068. },
  1069. noLoading: true,
  1070. }).then((res) => {
  1071. if (res.data.code == 200) {
  1072. if (res.data.total > 1) {
  1073. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  1074. uni.navigateTo({
  1075. url: `/pages3/polyv/detail?id=''&goodsId=${
  1076. item.goodsId
  1077. }&orderGoodsId=${item.orderGoodsId}&gradeId=${
  1078. item.gradeId
  1079. }&periodWaitTime=${item.periodWaitTime ? 1 : ""}`,
  1080. });
  1081. } else if (res.data.total == 1) {
  1082. uni.navigateTo({
  1083. url: `/pages3/polyv/detail?id=${
  1084. res.data.rows[0].courseId
  1085. }&goodsId=${item.goodsId}&orderGoodsId=${
  1086. item.orderGoodsId
  1087. }&gradeId=${item.gradeId}&periodWaitTime=${
  1088. item.periodWaitTime ? "" : 1
  1089. }`,
  1090. });
  1091. } else {
  1092. uni.showToast({
  1093. icon: "none",
  1094. title: "暂无可观看的视频课程",
  1095. });
  1096. }
  1097. }
  1098. });
  1099. },
  1100. /**
  1101. * @param {Object} goodsId 商品id
  1102. * 查询商品重修状态
  1103. */
  1104. courseGoodsRebuildStatus(goodsId, gradeId) {
  1105. return new Promise((resolve) => {
  1106. this.$http({
  1107. url: "/course/goodsRebuildStatus",
  1108. method: "get",
  1109. data: {
  1110. goodsId: goodsId,
  1111. gradeId: gradeId,
  1112. },
  1113. noLoading: true,
  1114. compleLoading: true, // 请求成功是否还要继续显示加载中
  1115. }).then((res) => {
  1116. resolve(res.data.data);
  1117. });
  1118. });
  1119. },
  1120. userConfirmInfoDetail() {
  1121. return new Promise((resolve) => {
  1122. this.$http({
  1123. url: "/user/confirm/info/detail",
  1124. method: "get",
  1125. data: { orderGoodsId: this.activeItem.orderGoodsId },
  1126. noLoading: true,
  1127. }).then((res) => {
  1128. if (!res.data.data) {
  1129. clearInterval(this.confirmTimer);
  1130. this.confirmCount = 10;
  1131. this.showUserConfirmInfo = true;
  1132. this.confirmTimer = setInterval(() => {
  1133. if (this.confirmCount > 0) {
  1134. this.confirmCount--;
  1135. } else {
  1136. clearInterval(this.confirmTimer);
  1137. }
  1138. }, 1000);
  1139. } else {
  1140. if (res.data.data.pushInfo) {
  1141. resolve(true);
  1142. } else {
  1143. const text = this.eduPhone
  1144. ? ",有疑问,请联系" + this.eduPhone
  1145. : "";
  1146. uni.showModal({
  1147. showCancel: false,
  1148. title: "提示",
  1149. content: "开通信息推送不成功,无法进入学习" + text,
  1150. });
  1151. resolve(false);
  1152. }
  1153. }
  1154. });
  1155. });
  1156. },
  1157. selectClass(item, index, load) {
  1158. this.itemIndex = index;
  1159. this.selectItem = item;
  1160. this.selectClassModal = true;
  1161. this.goodsGradeList(item.goodsId, load);
  1162. },
  1163. goodsGradeList(id, load) {
  1164. this.$http({
  1165. url: "/grade/grade/list",
  1166. method: "get",
  1167. data: { goodsId: id },
  1168. noLoading: load ? true : false,
  1169. }).then((res) => {
  1170. if (res.data.code == 200) {
  1171. this.gradeList = res.data.rows;
  1172. if (this.gradeList.length == 0) {
  1173. let item = {
  1174. className: "系统分班",
  1175. gradeId: 0,
  1176. };
  1177. this.gradeList.push(item);
  1178. } else {
  1179. let isGradeFull = this.gradeList.every(
  1180. (item) =>
  1181. item.studentNum > 0 && item.studentNum == item.studentUpper
  1182. );
  1183. //所有班级都满了
  1184. if (isGradeFull) {
  1185. let item = {
  1186. className: "系统分班",
  1187. gradeId: 0,
  1188. };
  1189. this.gradeList.unshift(item);
  1190. }
  1191. }
  1192. }
  1193. });
  1194. },
  1195. radioGroupChange(e) {
  1196. // console.log(e)
  1197. },
  1198. okPopup() {
  1199. if (this.gradeValue == -1) {
  1200. uni.showToast({
  1201. icon: "none",
  1202. title: "请选择班级",
  1203. });
  1204. return;
  1205. }
  1206. this.$api
  1207. .changeGrade({
  1208. goodsId: this.selectItem.goodsId,
  1209. gradeId: this.gradeValue,
  1210. oldGradeId: this.selectItem.gradeId,
  1211. orderGoodsId: this.selectItem.orderGoodsId,
  1212. userId: this.selectItem.userId,
  1213. })
  1214. .then((res) => {
  1215. if (res.data.code == 200) {
  1216. if (this.itemIndex !== "") {
  1217. this.refreshByIndex();
  1218. }
  1219. this.selectClassModal = false;
  1220. uni.showToast({
  1221. title: "选班成功",
  1222. });
  1223. } else {
  1224. uni.showToast({
  1225. icon: "none",
  1226. title: res.data.msg,
  1227. });
  1228. }
  1229. });
  1230. },
  1231. /**
  1232. * 返回刷新之前进入的课程数据
  1233. */
  1234. refreshByIndex() {
  1235. this.$api
  1236. .listUserVideoLive({
  1237. pageNum: this.itemIndex + 1,
  1238. pageSize: 1,
  1239. })
  1240. .then((res) => {
  1241. if (res.data.code == 200) {
  1242. this.$set(this.courseLists, this.itemIndex, res.data.rows[0]);
  1243. }
  1244. });
  1245. },
  1246. confirmUserConfirm() {
  1247. this.$refs.uModal.clearLoading();
  1248. if (this.confirmCount <= 0) {
  1249. if (this.confirmChecked) {
  1250. let infoJson = {
  1251. realname: this.userInfo.realname,
  1252. idCard: this.userInfo.idCard,
  1253. telphone: this.userInfo.telphone,
  1254. };
  1255. this.$api
  1256. .userConfirminfo({
  1257. orderGoodsId: this.activeItem.orderGoodsId,
  1258. infoJson: JSON.stringify(infoJson),
  1259. })
  1260. .then((res) => {
  1261. if (res.data.code != 200) {
  1262. this.showUserConfirmInfo = false;
  1263. uni.showToast({
  1264. icon: "none",
  1265. title: res.data.msg,
  1266. });
  1267. return;
  1268. }
  1269. if (res.data.data.pushInfo) {
  1270. uni.showToast({
  1271. icon: "none",
  1272. title: "提交成功",
  1273. });
  1274. } else {
  1275. const text = this.eduPhone
  1276. ? ",有疑问,请联系" + this.eduPhone
  1277. : "";
  1278. uni.showModal({
  1279. showCancel: false,
  1280. title: "提示",
  1281. content: "开通信息推送不成功,无法进入学!" + text,
  1282. });
  1283. }
  1284. this.showUserConfirmInfo = false;
  1285. });
  1286. } else {
  1287. uni.showToast({
  1288. icon: "none",
  1289. title: "请勾选确认个人信息无误",
  1290. });
  1291. }
  1292. } else {
  1293. return;
  1294. }
  1295. },
  1296. cancelUserConfirm() {
  1297. clearInterval(this.confirmTimer);
  1298. },
  1299. call() {
  1300. // #ifdef MP-WEIXIN
  1301. uni.makePhoneCall({
  1302. phoneNumber: "020-87085982", //仅为示例
  1303. });
  1304. // #endif
  1305. },
  1306. closePop() {
  1307. this.appointTestShow = false;
  1308. },
  1309. jumpTest(item, appoint) {
  1310. this.appoint_an(item, appoint);
  1311. this.appointTestShow = false;
  1312. },
  1313. appointment(item, appoint) {
  1314. this.appointItemIndex = item;
  1315. if (item.examApplyGoodsList.length > 1) {
  1316. // 多个考试预约
  1317. this.appointTestList = item.examApplyGoodsList;
  1318. this.appointTestShow = true;
  1319. return;
  1320. }
  1321. let appoint_item = item.examApplyGoodsList[0];
  1322. this.appoint_an(item, appoint_item);
  1323. },
  1324. appoint_an(item, appoint) {
  1325. var data = {
  1326. goodsId: item.goodsId,
  1327. gradeId: item.gradeId,
  1328. applyId: appoint.applyId,
  1329. orderGoodsId: item.orderGoodsId,
  1330. };
  1331. this.$api.getApplysubscribe(data).then((res) => {
  1332. if (res.data.code === 500) {
  1333. uni.showModal({
  1334. showCancel: false,
  1335. content: res.data.msg,
  1336. });
  1337. }
  1338. if (res.data.code === 200) {
  1339. this.$navTo.togo("/pages2/appointment/index", {
  1340. goodsId: item.goodsId,
  1341. gradeId: item.gradeId,
  1342. orderGoodsId: item.orderGoodsId,
  1343. applyId: appoint.applyId,
  1344. });
  1345. }
  1346. });
  1347. },
  1348. // 进入刷题,调整小程序
  1349. appBeforeAddress(goodsId, item) {
  1350. this.$api
  1351. .appBeforeAddress({
  1352. orderGoodsId: item.orderGoodsId,
  1353. })
  1354. .then((res) => {
  1355. if (res.data.code == 200) {
  1356. uni.navigateToMiniProgram({
  1357. appId: res.data.data.url,
  1358. success(res) {
  1359. // 打开成功
  1360. },
  1361. });
  1362. } else {
  1363. uni.showModal({
  1364. title: "提示",
  1365. content: res.data.msg,
  1366. showCancel: false,
  1367. });
  1368. }
  1369. });
  1370. },
  1371. },
  1372. };
  1373. </script>
  1374. <style>
  1375. page {
  1376. background: #eaeef1;
  1377. }
  1378. </style>
  1379. <style lang="scss" scoped>
  1380. @import "./index.scss";
  1381. </style>