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. ></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">{{ item.goodsName }}</view>
  159. <view class="classHour">
  160. <text
  161. >{{
  162. item.courseNum || item.courseNum == 0
  163. ? item.courseNum
  164. : "-"
  165. }}课程/</text
  166. >
  167. <text
  168. >{{
  169. item.classHours || item.classHours == 0
  170. ? item.classHours
  171. : "-"
  172. }}学时/</text
  173. >
  174. <text>{{ item.secAllNum + item.examNum || "-" }}节</text>
  175. </view>
  176. </view>
  177. </view>
  178. </view>
  179. </view>
  180. <view class="course_item_info" v-if="item.goodsType !== 6">
  181. <view>
  182. <text>学习状态:</text>
  183. <view
  184. style="display: inline-block; font-size: 24rpx"
  185. v-html="backLearStatusText(item)"
  186. ></view>
  187. </view>
  188. <view>
  189. <text>学习进度:</text>
  190. <text>
  191. {{ item.stuAllNum + item.recordNum }}/{{
  192. item.secAllNum + item.examNum
  193. }}
  194. </text>
  195. </view>
  196. <view>
  197. <text>学习服务:</text>
  198. <text>
  199. {{
  200. $method.formDate(item.serviceStartTime, "yyyy/mm/dd")
  201. }}至{{
  202. $method.formDate(item.serviceEndTime, "yyyy/mm/dd")
  203. }}</text
  204. >
  205. </view>
  206. <view>
  207. <text>班级状态:</text>
  208. <text>
  209. {{ classStatusCompt(item) }}
  210. </text>
  211. </view>
  212. <view>
  213. <text>班级有效:</text>
  214. <template v-if="item.classEndTime">
  215. <text>
  216. {{ $method.formDate(item.classEndTime, "yyyy/mm/dd") }}
  217. </text>
  218. <text class="eb"
  219. >(剩余{{
  220. $method.GetRTime(item.classEndTime) > 0
  221. ? $method.GetRTime(item.classEndTime)
  222. : 0
  223. }}天)</text
  224. >
  225. </template>
  226. <text v-else>——</text>
  227. </view>
  228. <view
  229. class="class-warm"
  230. v-if="item.subscribeId != null && item.periodStatus == 1"
  231. >
  232. <view class="class-warm__text">
  233. <view class="date">
  234. <view v-if="item.subExamStatus === null">待预约考试</view>
  235. <view
  236. v-else-if="
  237. item.subExamStatus === 0 &&
  238. sysTime <
  239. $method.TimeTotimestamp(
  240. $method.timestampToTime(
  241. item.subApplySiteExamTime,
  242. true
  243. ) +
  244. ' ' +
  245. item.subApplySiteStartTime
  246. )
  247. "
  248. >
  249. 待考试,考试时间:
  250. {{
  251. $method.timestampToTime(
  252. item.subApplySiteExamTime,
  253. true
  254. ) +
  255. " " +
  256. item.subApplySiteStartTime
  257. }}
  258. -
  259. {{
  260. $method.timestampToTime(
  261. item.subApplySiteExamTime,
  262. true
  263. ) +
  264. " " +
  265. item.subApplySiteEndTime
  266. }}
  267. </view>
  268. <view v-else-if="item.subExamStatus === 0"
  269. >待出考试结果</view
  270. >
  271. <view v-else-if="item.subExamStatus === 1">
  272. <text v-if="item.subResult === null">待出考试结果</text>
  273. <text v-if="item.subResult === 0"
  274. >考试结果:不通过,需补考</text
  275. >
  276. <text v-else-if="item.subResult === 1"
  277. >考试结果:通过,考试成绩为{{
  278. item.subPerformance
  279. }}</text
  280. >
  281. </view>
  282. <view v-else-if="item.subExamStatus === 2"
  283. >缺考,无成绩,需补考</view
  284. >
  285. <view v-else-if="item.subExamStatus === 3"
  286. >作弊,无成绩,需补考</view
  287. >
  288. <view v-else-if="item.subExamStatus === 4"
  289. >替考,无成绩,需补考</view
  290. >
  291. </view>
  292. </view>
  293. </view>
  294. </view>
  295. <view class="study_tips">
  296. <div
  297. v-if="
  298. item.erJianErZao && !item.classEndTime && !item.classStartTime
  299. "
  300. >
  301. 温馨提示:当前班级正在申请中,正式开班后方可进行学习,请耐心等待
  302. </div>
  303. <div
  304. v-if="
  305. $method.GetRTime(item.serviceEndTime) <= 20 &&
  306. $method.GetRTime(item.serviceEndTime) >= 0 &&
  307. (item.periodStatus == 0 || item.periodStatus == -1)
  308. "
  309. >
  310. 温馨提示:当前学习服务期至{{
  311. $method.timestampToTime(item.serviceEndTime)
  312. }},超期学时无效,为防审核异常请于{{
  313. $method.timestampToTime(item.serviceEndTime - 864000, false)
  314. }}
  315. 前完成学习,当前剩余有效学习时间为{{
  316. $method.GetRTime(item.serviceEndTime) < 0
  317. ? 0
  318. : $method.GetRTime(item.serviceEndTime)
  319. }}天。
  320. </div>
  321. <div
  322. v-if="
  323. item.gradeStatus == 1 &&
  324. item.status == 1 &&
  325. item.serviceEndTime > sysTime &&
  326. item.serviceStartTime < sysTime &&
  327. item.classEndTime &&
  328. item.classEndTime < sysTime &&
  329. (item.periodStatus == 0 || item.periodStatus == -1)
  330. "
  331. >
  332. <span v-if="item.studyCount > 0"
  333. >温馨提示:班级已过期,如需重新学习,请点击右侧“选班重学”按钮。</span
  334. >
  335. <span v-else
  336. >温馨提示:班级已过期,您的重学次数已用完,如有疑问请联系{{
  337. $store.state.userInfo.eduPhone
  338. }}</span
  339. >
  340. </div>
  341. <div v-if="item.serviceEndTime && item.serviceEndTime < sysTime">
  342. 温馨提示:学习服务期已截至,如有疑问请联系:{{
  343. $store.state.userInfo.eduPhone
  344. }}
  345. </div>
  346. <div v-if="item.periodStatus === 2">
  347. 温馨提示:您已完成本课程所有学时学习,我校将对学时进行审核,审核及推送时长预估15个工作日,如有疑问请联系:{{
  348. $store.state.userInfo.eduPhone
  349. }},学时查询网址:http://gdzczx.gdcic.net
  350. </div>
  351. <div v-if="item.periodStatus === 1">
  352. 温馨提示:您的班级学习初审已通过,待广东省建设信息中心归集学时,归集完成即为完成本次继续教育学习。归集学时需约10-15个工作日,具体以广东省建设执业资格注册服务平台的“继续教育学时查询”公布学时记录为准,学时查询网址:http://gdzczx.gdcic.net
  353. </div>
  354. </view>
  355. <!-- 按钮 -->
  356. <view class="study_btns">
  357. <template
  358. v-if="
  359. item.gradeStatus == 1 &&
  360. item.status == 1 &&
  361. item.serviceEndTime > sysTime &&
  362. item.serviceStartTime < sysTime &&
  363. item.classEndTime &&
  364. item.classEndTime < sysTime &&
  365. (item.periodStatus == 0 || item.periodStatus == -1) &&
  366. item.userStudyCount > 0
  367. "
  368. >
  369. <view
  370. class="exam_word ones"
  371. @click.stop="selectClass(item, index)"
  372. >
  373. 选班重学
  374. </view>
  375. </template>
  376. <!-- examApplyGoodsList.length -是判断是否关联指定学员 -->
  377. <view v-else class="exam_btns">
  378. <view
  379. class="box_appoint"
  380. v-if="
  381. item.applyStatus === 1 &&
  382. !(
  383. sysTime <= item.serviceStartTime ||
  384. sysTime >= item.serviceEndTime ||
  385. (item.classStartTime && sysTime <= item.classStartTime) ||
  386. (item.classEndTime && sysTime >= item.classEndTime) ||
  387. item.learningStatus == 2 ||
  388. item.classStatus == 0 ||
  389. (item.learningStatus == 3 &&
  390. sysTime < item.learningTimeStart) ||
  391. !item.examApplyGoodsList.length
  392. )
  393. "
  394. @click="appointment(item, appoint)"
  395. >
  396. <view class="exam_word ones">预约考试</view>
  397. </view>
  398. <view
  399. class="box_appoint"
  400. v-if="
  401. item.beforeStatus === 1 &&
  402. !(
  403. sysTime <= item.serviceStartTime ||
  404. sysTime >= item.serviceEndTime ||
  405. (item.classStartTime && sysTime <= item.classStartTime) ||
  406. (item.classEndTime && sysTime >= item.classEndTime) ||
  407. item.learningStatus == 2 ||
  408. item.classStatus == 0 ||
  409. (item.learningStatus == 3 &&
  410. sysTime < item.learningTimeStart)
  411. )
  412. "
  413. @click="appBeforeAddress(item.goodsId, item)"
  414. >
  415. <view class="exam_word ones">进入刷题</view>
  416. </view>
  417. </view>
  418. <view
  419. class="box_appoint"
  420. @click="studyIn(item.goodsId, item.gradeId, item, index)"
  421. >
  422. <view class="exam_word intos">进入学习</view>
  423. </view>
  424. </view>
  425. </view>
  426. </view>
  427. </view>
  428. <!-- 没有学习的课程 -->
  429. <view v-if="!allLoading && !allCourse" class="no_datas">
  430. <image
  431. class="courses"
  432. src="/static/learn/no_course.png"
  433. mode=""
  434. ></image>
  435. <view class="no_learns">您目前没有可学习的课程</view>
  436. <view class="choose" @click="toChoose()">立即去选购</view>
  437. </view>
  438. </view>
  439. <!-- 弹窗 -->
  440. <u-popup
  441. v-model="selectClassModal"
  442. @close="gradeValue = -1"
  443. mode="bottom"
  444. border-radius="40"
  445. >
  446. <view class="popup_box">
  447. <view style="margin-bottom: 20rpx">
  448. <view class="line1"></view>
  449. <view class="grade">选择班级</view>
  450. </view>
  451. <u-line color="#D6D6DB" />
  452. <view>
  453. <scroll-view scroll-y="true" style="height: 500rpx">
  454. <view>
  455. <u-radio-group v-model="gradeValue" @change="radioGroupChange">
  456. <view v-for="(item, index) in gradeList" :key="index">
  457. <view
  458. style="display: flex; align-items: center; padding: 20rpx"
  459. >
  460. <view>
  461. <u-radio
  462. shape="circle"
  463. :name="index"
  464. :disabled="
  465. item.studentNum > 0 &&
  466. item.studentNum == item.studentUpper
  467. "
  468. >
  469. <view
  470. :class="
  471. item.checked ? 'white-box blue-box' : 'white-box'
  472. "
  473. >
  474. <view>
  475. <view class="blackTxt">{{ item.className }}</view>
  476. <view class="redTxt" v-if="item.classEndTime">
  477. 有效期至:{{
  478. $method.timestampToTime(
  479. item.classEndTime,
  480. true,
  481. true
  482. )
  483. }}
  484. </view>
  485. <view class="redTxt" v-if="item.classEndTime">
  486. 本班还剩{{
  487. $method.GetRTime(item.classEndTime)
  488. }}天将结束学习</view
  489. >
  490. </view>
  491. </view>
  492. </u-radio>
  493. </view>
  494. </view>
  495. </view>
  496. </u-radio-group>
  497. </view>
  498. </scroll-view>
  499. </view>
  500. <view class="confrim-btn">
  501. <view class="okBtn" @click="okPopup()">确定</view>
  502. </view>
  503. </view>
  504. </u-popup>
  505. <u-modal
  506. v-model="showUserConfirmInfo"
  507. @confirm="confirmUserConfirm"
  508. ref="uModal"
  509. :async-close="true"
  510. @cancel="cancelUserConfirm"
  511. :confirm-text="
  512. '确认' + (confirmCount > 0 ? '(' + confirmCount + ')' : '')
  513. "
  514. :confirm-color="confirmCount > 0 ? '#999' : '#2979ff'"
  515. class="confirm-modal"
  516. title="实名验证确认"
  517. cancel="取消"
  518. :show-cancel-button="true"
  519. >
  520. <view class="slot-content">
  521. <view class="content">
  522. <!-- ,立刻联系020-38946666 -->
  523. 为避免个人信息不正确导致您的学习时长无效,请认真核对以下信息是否正确,如信息有误请取消当前操作。
  524. <view class="msg-list" v-if="userInfo">
  525. <view class="item">
  526. <text class="item__left">姓名:</text>
  527. <text class="item__right">{{ userInfo.realname }}</text>
  528. </view>
  529. <view class="item">
  530. <text class="item__left">手机号:</text>
  531. <text class="item__right">{{ userInfo.telphone }}</text>
  532. </view>
  533. <view class="item">
  534. <text class="item__left">身份号:</text>
  535. <text class="item__right">{{ userInfo.idCard }}</text>
  536. </view>
  537. <view class="item">
  538. <u-checkbox v-model="confirmChecked" :label-disabled="false"
  539. >确认个人信息无误</u-checkbox
  540. >
  541. </view>
  542. </view>
  543. </view>
  544. </view>
  545. </u-modal>
  546. <!-- 多个预约考试时的弹窗 -->
  547. <u-popup v-model="appointTestShow" mode="bottom" border-radius="40">
  548. <view class="popuptest_box">
  549. <view class="check_head">
  550. <view class="headers">
  551. <view class="grade">切换课程</view>
  552. <u-icon
  553. name="close"
  554. color="#9C9C9C"
  555. size="40"
  556. @click="closePop()"
  557. ></u-icon>
  558. </view>
  559. </view>
  560. <view class="check_con">
  561. <scroll-view scroll-y="true" style="height: 700rpx">
  562. <view
  563. class="course_items"
  564. v-for="(appoint, index) in appointTestList"
  565. :key="index"
  566. >
  567. <view class="course_lefts">
  568. <view class="course_title">{{ appoint.applyName }}</view>
  569. </view>
  570. <view
  571. class="course_rights"
  572. @click="jumpTest(appointItemIndex, appoint)"
  573. >
  574. <view class="intoStudy">预约</view>
  575. </view>
  576. </view>
  577. </scroll-view>
  578. </view>
  579. </view>
  580. </u-popup>
  581. </view>
  582. </template>
  583. <script>
  584. var curTime = new Date().getTime(); // 当前时间的时间戳
  585. import { mapGetters, mapActions } from "vuex";
  586. export default {
  587. data() {
  588. return {
  589. leftDays: 0,
  590. paramC: {
  591. pageNum: 1,
  592. pageSize: 10,
  593. },
  594. activeItem: {},
  595. itemIndex: "",
  596. confirmTimer: null,
  597. confirmCount: 10,
  598. confirmChecked: false,
  599. showUserConfirmInfo: false,
  600. selectItem: {},
  601. selectClassModal: false,
  602. gradeList: [],
  603. gradeValue: -1,
  604. sysTime: 0,
  605. courseLists: [], // 课程列表
  606. total: 0,
  607. livingLists: [], // 直播列表
  608. allLoading: false, // 加载样式
  609. current: 2,
  610. appointTestShow: false, //预约考试弹窗
  611. appointTestList: [],
  612. appointItemIndex: {}, // 点击了哪项课程
  613. imgwidth: 0,
  614. imgheight: 0,
  615. };
  616. },
  617. filters: {
  618. liveStatus(liveTime, watchStatus) {
  619. let value = liveTime * 1000;
  620. if (curTime < value) {
  621. // 判断当前时间和直播开始时间
  622. return " 未开播";
  623. } else {
  624. return watchStatus == "live" ? "正在直播中" : "即将开播";
  625. }
  626. },
  627. },
  628. computed: {
  629. ...mapGetters(["userInfo", "config"]),
  630. allCourse() {
  631. return this.courseLists.length || this.livingLists.length ? true : false;
  632. },
  633. eduPhone() {
  634. return this.userInfo.eduPhone;
  635. },
  636. backLearStatusText() {
  637. return ({
  638. periodStatus,
  639. stuAllNum,
  640. recordNum,
  641. secAllNum,
  642. examNum,
  643. periodPlush,
  644. }) => {
  645. let text = "";
  646. let color = "";
  647. if (periodStatus === -1) {
  648. const stuAll = stuAllNum + recordNum;
  649. const secAll = secAllNum + examNum;
  650. let index = 0;
  651. if (stuAll == 0) {
  652. index == 0;
  653. } else if (stuAll > 0 && stuAll < secAll) {
  654. index == 1;
  655. } else if (stuAll >= secAll) {
  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. // 1668873600 ,2022.11.20的时间戳
  698. this.leftDays = 1668873600 - parseInt(curTime / 1000);
  699. this.sysTime = +this.$method.timest();
  700. if (this.$method.isLogin()) {
  701. !this.userInfo && this.$api.refreshUserInfo();
  702. }
  703. },
  704. async onShow() {
  705. uni.pageScrollTo({
  706. duration: 0,
  707. scrollTop: 0, // number number number!
  708. });
  709. this.getCourseLiveQues();
  710. // await this.commonSystemTime()
  711. },
  712. onPullDownRefresh() {
  713. this.getCourseLiveQues();
  714. },
  715. onReachBottom() {
  716. if (this.courseLists.length < this.total) {
  717. this.paramC.pageNum++;
  718. this.getCourseList();
  719. }
  720. },
  721. methods: {
  722. ...mapActions(["getUserInfo"]),
  723. bgShow(liveTime, watchStatus) {
  724. let value = liveTime * 1000;
  725. if (curTime > value) {
  726. // 判断当前时间和直播开始时间
  727. return watchStatus == "live" ? true : false;
  728. }
  729. },
  730. lookTimeStatus(liveTime, watchStatus) {
  731. if (liveTime) {
  732. let value = new Date(liveTime * 1000);
  733. var Y = value.getFullYear();
  734. var M =
  735. value.getMonth() + 1 < 10
  736. ? "0" + (value.getMonth() + 1)
  737. : value.getMonth() + 1;
  738. var D = value.getDate() < 10 ? "0" + value.getDate() : value.getDate();
  739. var valZ = Y + "/" + M + "/" + D;
  740. let curZeroTime = new Date(valZ).getTime(); // 获取开始直播时间当天的零点时间戳
  741. if (curTime > value) {
  742. // 判断当前时间和直播开始时间
  743. if (watchStatus == "live") {
  744. //
  745. return 1;
  746. } else {
  747. return 2;
  748. }
  749. } else {
  750. if (curZeroTime <= curTime && curTime <= value) {
  751. //当天
  752. return 3;
  753. } else {
  754. return 4;
  755. }
  756. }
  757. }
  758. },
  759. curTimeTamp(liveTime) {
  760. let min = liveTime - parseInt(curTime / 1000);
  761. return min;
  762. },
  763. toChoose() {
  764. uni.switchTab({
  765. url: "/pages/course/index",
  766. });
  767. },
  768. // 查询直播课
  769. getCourseLiveQues() {
  770. if (!this.$method.isLogin()) {
  771. return;
  772. }
  773. this.allLoading = true;
  774. this.paramC.pageNum = 1;
  775. let arrs = [
  776. this.$api.listUserVideoLive(this.paramC), // 查询用户拥有视频+直播商品 /goods/listUserVideoLive
  777. this.$api.getgoodsLiveList({
  778. pageNum: 1,
  779. pageSize: 3, // 默认3条
  780. }),
  781. ];
  782. wx.stopPullDownRefresh();
  783. Promise.all(arrs)
  784. .then((res) => {
  785. // if (res.data.code == 200) {
  786. const [{ data: res1 }, { data: res2 }] = res;
  787. if (res1.code == 200) {
  788. this.total = res1.total;
  789. this.courseLists = res1.rows || [];
  790. }
  791. // if (res2.code == 200) {
  792. // this.questionLists = res2.rows || []
  793. // }
  794. if (res2.code == 200) {
  795. this.livingLists = res2.rows || [];
  796. } else {
  797. this.$u.toast(res2.msg);
  798. }
  799. this.allLoading = false;
  800. this.sysTime = +this.$method.timest();
  801. // }
  802. uni.hideLoading();
  803. })
  804. .catch((err) => {
  805. uni.hideLoading();
  806. this.allLoading = false;
  807. });
  808. },
  809. getCourseList() {
  810. this.$api
  811. .listUserVideoLive(this.paramC)
  812. .then((res) => {
  813. this.courseLists.push(...res.data.rows);
  814. })
  815. .finally((e) => {
  816. uni.hideLoading();
  817. });
  818. },
  819. // 看直播
  820. toLiveLook(item) {
  821. let moduleId = item.moduleId || 0;
  822. let chapterId = item.chapterId || 0;
  823. let sectionId = item.sectionId || item.menuId;
  824. let uuid = new Date().valueOf() + "";
  825. // buyCourse 是否购买课程:1是 0否
  826. let encode = encodeURIComponent(
  827. this.config.hostLive +
  828. "/pages/live/index?token=" +
  829. uni.getStorageSync("token") +
  830. "&userInfo=" +
  831. (JSON.stringify(this.userInfo) || "") +
  832. "&channelId=" +
  833. item.liveUrl +
  834. "&gradeId=" +
  835. 0 +
  836. "&courseId=" +
  837. item.courseId +
  838. "&goodsId=" +
  839. item.goodsId +
  840. "&orderGoodsId=" +
  841. item.orderGoodsId +
  842. "&sectionId=" +
  843. sectionId +
  844. "&chapterId=" +
  845. chapterId +
  846. "&moduleId=" +
  847. moduleId +
  848. "&buyCourse=1" +
  849. "&ident=" +
  850. uuid +
  851. "&sectionType=2"
  852. );
  853. uni.navigateTo({
  854. url: `../../pages/webview/index?url=` + encode,
  855. });
  856. },
  857. toLive(item) {
  858. this.$api
  859. .courseCourseList({
  860. pageNum: 1,
  861. pageSize: 1,
  862. goodsId: item.goodsId,
  863. gradeId: 0,
  864. orderGoodsId: item.orderGoodsId,
  865. })
  866. .then((res) => {
  867. if (res.data.code == 200) {
  868. if (res.data.total > 1) {
  869. // uni.navigateTo({
  870. // url:'/pages5/liveDetail/course?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0'
  871. // })
  872. uni.navigateTo({
  873. url:
  874. "/pages3/live/detail?orderGoodsId=" +
  875. item.orderGoodsId +
  876. "&goodsId=" +
  877. item.goodsId +
  878. '&gradeId=0&courseId=""',
  879. });
  880. } else if (res.data.total == 1) {
  881. uni.navigateTo({
  882. url:
  883. "/pages3/live/detail?orderGoodsId=" +
  884. item.orderGoodsId +
  885. "&goodsId=" +
  886. item.goodsId +
  887. "&gradeId=0&courseId=" +
  888. res.data.rows[0].courseId,
  889. });
  890. } else {
  891. uni.showToast({
  892. icon: "none",
  893. title: "暂无可观看的直播课程",
  894. });
  895. }
  896. }
  897. });
  898. },
  899. async studyIn(v, i, item, index) {
  900. if (item.externalLinkStatus) {
  901. this.$method.toLink(item.externalLink);
  902. return;
  903. }
  904. if (item.goodsType == 6) {
  905. // 进入直播课
  906. this.toLive(item);
  907. return;
  908. }
  909. // 进入视频课
  910. this.activeItem = item;
  911. if (item.interfaceAccountId > 0) {
  912. //学习账号已开通
  913. if (item.learnStatus > 0) {
  914. //跳转第三方h5
  915. uni.navigateTo({
  916. url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}&isOther=1`,
  917. });
  918. return;
  919. } else {
  920. const text = this.eduPhone ? ",有疑问,请联系" + this.eduPhone : "";
  921. uni.showModal({
  922. showCancel: false,
  923. content: "您的学习账号未开通,请稍后再尝试" + text,
  924. });
  925. return;
  926. }
  927. return;
  928. }
  929. if (
  930. item.serviceStartTime &&
  931. (this.sysTime <= item.serviceStartTime ||
  932. this.sysTime >= item.serviceEndTime)
  933. ) {
  934. uni.showToast({
  935. icon: "none",
  936. title: "不在学习服务期,不能进入学习",
  937. });
  938. return;
  939. }
  940. if (
  941. (item.classStartTime && this.sysTime <= item.classStartTime) ||
  942. (item.classEndTime && this.sysTime >= item.classEndTime)
  943. ) {
  944. uni.showToast({
  945. icon: "none",
  946. title: "不在班级有效期,不能进入学习",
  947. });
  948. return;
  949. }
  950. // learningStatus: 1即刻,2待定,3不在日期内
  951. if (item.learningStatus == 2) {
  952. uni.showToast({
  953. icon: "none",
  954. title: "开放学习时间待定,不能进入学习",
  955. });
  956. return;
  957. }
  958. if (item.classStatus == 0) {
  959. uni.showToast({
  960. icon: "none",
  961. title: "尚未开班,不能进入学习",
  962. });
  963. return;
  964. }
  965. if (item.learningStatus == 3 && this.sysTime < item.learningTimeStart) {
  966. uni.showToast({
  967. icon: "none",
  968. title: "不在开放学习时间,不能进入学习",
  969. });
  970. return;
  971. }
  972. uni.showLoading({
  973. title: "拼命加载中...",
  974. mask: true,
  975. });
  976. // var confirmDetail = true;
  977. // if (item.educationName == "继续教育") {
  978. // if (
  979. // item.officialName &&
  980. // item.businessName == "二级" &&
  981. // item.projectName == "建造师"
  982. // ) {
  983. // confirmDetail = await this.userConfirmInfoDetail();
  984. // }
  985. // }
  986. // if (!confirmDetail) {
  987. // return;
  988. // }
  989. this.itemIndex = index;
  990. if (
  991. item.gradeStatus == 1 &&
  992. item.status == 1 &&
  993. item.serviceEndTime > this.sysTime &&
  994. item.classEndTime &&
  995. item.classEndTime < this.sysTime &&
  996. (item.periodStatus == 0 || item.periodStatus == -1) &&
  997. item.studyCount > 0
  998. ) {
  999. this.selectClass(item, index, "loading");
  1000. return;
  1001. }
  1002. // /course/goodsRebuildStatus查询用户商品重修状态
  1003. let rebuildStatus = await this.courseGoodsRebuildStatus(
  1004. item.goodsId,
  1005. item.gradeId
  1006. );
  1007. if (rebuildStatus == 0) {
  1008. uni.hideLoading();
  1009. this.$navTo.togo("/pages2/learn/details", {
  1010. gradeId: item.gradeId,
  1011. goodsId: item.goodsId,
  1012. orderGoodsId: item.orderGoodsId,
  1013. });
  1014. return;
  1015. }
  1016. this.$method.checkLock().then(() => {
  1017. this.$http({
  1018. url: "/course/courseList",
  1019. method: "get",
  1020. data: {
  1021. pageNum: 1,
  1022. pageSize: 100,
  1023. goodsId: item.goodsId,
  1024. gradeId: item.gradeId,
  1025. orderGoodsId: item.orderGoodsId,
  1026. },
  1027. noLoading: true,
  1028. }).then((res) => {
  1029. if (res.data.code == 200) {
  1030. if (res.data.total > 1) {
  1031. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  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>