index.vue 45 KB

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