index.vue 45 KB

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