index.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397
  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. $store.state.userInfo.eduPhone
  339. }}</span
  340. >
  341. </div>
  342. <div v-if="item.serviceEndTime && item.serviceEndTime < sysTime">
  343. 温馨提示:学习服务期已截至,如有疑问请联系:{{
  344. $store.state.userInfo.eduPhone
  345. }}
  346. </div>
  347. <div v-if="item.periodStatus === 2">
  348. 温馨提示:您已完成本课程所有学时学习,我校将对学时进行审核,审核及推送时长预估15个工作日,如有疑问请联系:{{
  349. $store.state.userInfo.eduPhone
  350. }},学时查询网址:http://gdzczx.gdcic.net
  351. </div>
  352. <div v-if="item.periodStatus === 1">
  353. 温馨提示:您的班级学习初审已通过,待广东省建设信息中心归集学时,归集完成即为完成本次继续教育学习。归集学时需约10-15个工作日,具体以广东省建设执业资格注册服务平台的“继续教育学时查询”公布学时记录为准,学时查询网址:http://gdzczx.gdcic.net
  354. </div>
  355. </view>
  356. <!-- 按钮 -->
  357. <view class="study_btns">
  358. <template
  359. v-if="
  360. item.gradeStatus == 1 &&
  361. item.status == 1 &&
  362. item.serviceEndTime > sysTime &&
  363. item.serviceStartTime < sysTime &&
  364. item.classEndTime &&
  365. item.classEndTime < sysTime &&
  366. (item.periodStatus == 0 || item.periodStatus == -1) &&
  367. item.userStudyCount > 0
  368. "
  369. >
  370. <view
  371. class="exam_word ones"
  372. @click.stop="selectClass(item, index)"
  373. >
  374. 选班重学
  375. </view>
  376. </template>
  377. <!-- examApplyGoodsList.length -是判断是否关联指定学员 -->
  378. <view v-else class="exam_btns">
  379. <view
  380. class="box_appoint"
  381. v-if="
  382. item.applyStatus === 1 &&
  383. !(
  384. sysTime <= item.serviceStartTime ||
  385. sysTime >= item.serviceEndTime ||
  386. (item.classStartTime && sysTime <= item.classStartTime) ||
  387. (item.classEndTime && sysTime >= item.classEndTime) ||
  388. item.learningStatus == 2 ||
  389. item.classStatus == 0 ||
  390. (item.learningStatus == 3 &&
  391. sysTime < item.learningTimeStart) ||
  392. !item.examApplyGoodsList.length
  393. )
  394. "
  395. @click="appointment(item, appoint)"
  396. >
  397. <view class="exam_word ones">预约考试</view>
  398. </view>
  399. <view
  400. class="box_appoint"
  401. v-if="
  402. item.beforeStatus === 1 &&
  403. !(
  404. sysTime <= item.serviceStartTime ||
  405. sysTime >= item.serviceEndTime ||
  406. (item.classStartTime && sysTime <= item.classStartTime) ||
  407. (item.classEndTime && sysTime >= item.classEndTime) ||
  408. item.learningStatus == 2 ||
  409. item.classStatus == 0 ||
  410. (item.learningStatus == 3 &&
  411. sysTime < item.learningTimeStart)
  412. )
  413. "
  414. @click="appBeforeAddress(item.goodsId, item)"
  415. >
  416. <view class="exam_word ones">进入刷题</view>
  417. </view>
  418. </view>
  419. <view
  420. class="box_appoint"
  421. @click="studyIn(item.goodsId, item.gradeId, item, index)"
  422. >
  423. <view class="exam_word intos">进入学习</view>
  424. </view>
  425. </view>
  426. </view>
  427. </view>
  428. </view>
  429. <!-- 没有学习的课程 -->
  430. <view v-if="!allLoading && !allCourse" class="no_datas">
  431. <image
  432. class="courses"
  433. src="/static/learn/no_course.png"
  434. mode=""
  435. ></image>
  436. <view class="no_learns">您目前没有可学习的课程</view>
  437. <view class="choose" @click="toChoose()">立即去选购</view>
  438. </view>
  439. </view>
  440. <!-- 弹窗 -->
  441. <u-popup
  442. v-model="selectClassModal"
  443. @close="gradeValue = -1"
  444. mode="bottom"
  445. border-radius="40"
  446. >
  447. <view class="popup_box">
  448. <view style="margin-bottom: 20rpx">
  449. <view class="line1"></view>
  450. <view class="grade">选择班级</view>
  451. </view>
  452. <u-line color="#D6D6DB" />
  453. <view>
  454. <scroll-view scroll-y="true" style="height: 500rpx">
  455. <view>
  456. <u-radio-group v-model="gradeValue" @change="radioGroupChange">
  457. <view v-for="(item, index) in gradeList" :key="index">
  458. <view
  459. style="display: flex; align-items: center; padding: 20rpx"
  460. >
  461. <view>
  462. <u-radio
  463. shape="circle"
  464. :name="index"
  465. :disabled="
  466. item.studentNum > 0 &&
  467. item.studentNum == item.studentUpper
  468. "
  469. >
  470. <view
  471. :class="
  472. item.checked ? 'white-box blue-box' : 'white-box'
  473. "
  474. >
  475. <view>
  476. <view class="blackTxt">{{ item.className }}</view>
  477. <view class="redTxt" v-if="item.classEndTime">
  478. 有效期至:{{
  479. $method.timestampToTime(
  480. item.classEndTime,
  481. true,
  482. true
  483. )
  484. }}
  485. </view>
  486. <view class="redTxt" v-if="item.classEndTime">
  487. 本班还剩{{
  488. $method.GetRTime(item.classEndTime)
  489. }}天将结束学习</view
  490. >
  491. </view>
  492. </view>
  493. </u-radio>
  494. </view>
  495. </view>
  496. </view>
  497. </u-radio-group>
  498. </view>
  499. </scroll-view>
  500. </view>
  501. <view class="confrim-btn">
  502. <view class="okBtn" @click="okPopup()">确定</view>
  503. </view>
  504. </view>
  505. </u-popup>
  506. <u-modal
  507. v-model="showUserConfirmInfo"
  508. @confirm="confirmUserConfirm"
  509. ref="uModal"
  510. :async-close="true"
  511. @cancel="cancelUserConfirm"
  512. :confirm-text="
  513. '确认' + (confirmCount > 0 ? '(' + confirmCount + ')' : '')
  514. "
  515. :confirm-color="confirmCount > 0 ? '#999' : '#2979ff'"
  516. class="confirm-modal"
  517. title="实名验证确认"
  518. cancel="取消"
  519. :show-cancel-button="true"
  520. >
  521. <view class="slot-content">
  522. <view class="content">
  523. <!-- ,立刻联系020-38946666 -->
  524. 为避免个人信息不正确导致您的学习时长无效,请认真核对以下信息是否正确,如信息有误请取消当前操作。
  525. <view class="msg-list" v-if="userInfo">
  526. <view class="item">
  527. <text class="item__left">姓名:</text>
  528. <text class="item__right">{{ userInfo.realname }}</text>
  529. </view>
  530. <view class="item">
  531. <text class="item__left">手机号:</text>
  532. <text class="item__right">{{ userInfo.telphone }}</text>
  533. </view>
  534. <view class="item">
  535. <text class="item__left">身份号:</text>
  536. <text class="item__right">{{ userInfo.idCard }}</text>
  537. </view>
  538. <view class="item">
  539. <u-checkbox v-model="confirmChecked" :label-disabled="false"
  540. >确认个人信息无误</u-checkbox
  541. >
  542. </view>
  543. </view>
  544. </view>
  545. </view>
  546. </u-modal>
  547. <!-- 多个预约考试时的弹窗 -->
  548. <u-popup v-model="appointTestShow" mode="bottom" border-radius="40">
  549. <view class="popuptest_box">
  550. <view class="check_head">
  551. <view class="headers">
  552. <view class="grade">切换课程</view>
  553. <u-icon
  554. name="close"
  555. color="#9C9C9C"
  556. size="40"
  557. @click="closePop()"
  558. ></u-icon>
  559. </view>
  560. </view>
  561. <view class="check_con">
  562. <scroll-view scroll-y="true" style="height: 700rpx">
  563. <view
  564. class="course_items"
  565. v-for="(appoint, index) in appointTestList"
  566. :key="index"
  567. >
  568. <view class="course_lefts">
  569. <view class="course_title">{{ appoint.applyName }}</view>
  570. </view>
  571. <view
  572. class="course_rights"
  573. @click="jumpTest(appointItemIndex, appoint)"
  574. >
  575. <view class="intoStudy">预约</view>
  576. </view>
  577. </view>
  578. </scroll-view>
  579. </view>
  580. </view>
  581. </u-popup>
  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. }) => {
  646. let text = "";
  647. let color = "";
  648. if (periodStatus === -1) {
  649. const stuAll = stuAllNum + recordNum;
  650. const secAll = secAllNum + examNum;
  651. let index = 0;
  652. if (stuAll == 0) {
  653. index = 0;
  654. } else if (stuAll > 0 && stuAll < secAll) {
  655. index = 1;
  656. } else if (stuAll >= secAll) {
  657. index = 2;
  658. }
  659. text = ["未开始", "学习中", "已学完"][index];
  660. color = ["#EB5757", "#498AFE", "#498AFE"][index];
  661. } else {
  662. text = [
  663. "审核不通过",
  664. periodPlush > 0 ? "学时已上报信息中心" : "学时审核通过",
  665. "待审核",
  666. "初审完成",
  667. ][periodStatus];
  668. color = ["#EB5757", "#F67205", "#F67205", "#F67205"][periodStatus];
  669. }
  670. return `<span style='color: ${color}'>${text}</span>`;
  671. };
  672. },
  673. classStatusCompt: function () {
  674. return function (item, sysTime) {
  675. var str = "未开班";
  676. if (item.classEndTime && item.classEndTime < sysTime) {
  677. str = "已过期";
  678. } else if (item.classStartTime && item.classStartTime > sysTime) {
  679. str = "未开始";
  680. } else if (
  681. item.gradeId &&
  682. item.gradeStatus == 1 &&
  683. item.classStatus === 1
  684. ) {
  685. str = "已开班";
  686. } else if (
  687. item.gradeId &&
  688. item.gradeStatus == 1 &&
  689. item.classStatus === 0
  690. ) {
  691. str = "未开班";
  692. }
  693. return str;
  694. };
  695. },
  696. },
  697. onLoad() {
  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. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  1033. uni.navigateTo({
  1034. url: `/pages3/polyv/detail?id=''&goodsId=${
  1035. item.goodsId
  1036. }&orderGoodsId=${item.orderGoodsId}&gradeId=${
  1037. item.gradeId
  1038. }&periodWaitTime=${item.periodWaitTime ? 1 : ""}`,
  1039. });
  1040. } else if (res.data.total == 1) {
  1041. uni.navigateTo({
  1042. url: `/pages3/polyv/detail?id=${
  1043. res.data.rows[0].courseId
  1044. }&goodsId=${item.goodsId}&orderGoodsId=${
  1045. item.orderGoodsId
  1046. }&gradeId=${item.gradeId}&periodWaitTime=${
  1047. item.periodWaitTime ? "" : 1
  1048. }`,
  1049. });
  1050. } else {
  1051. uni.showToast({
  1052. icon: "none",
  1053. title: "暂无可观看的视频课程",
  1054. });
  1055. }
  1056. }
  1057. });
  1058. });
  1059. },
  1060. toDetail() {
  1061. this.$http({
  1062. url: "/course/courseList",
  1063. method: "get",
  1064. data: {
  1065. pageNum: 1,
  1066. pageSize: 100,
  1067. goodsId: item.goodsId,
  1068. gradeId: item.gradeId,
  1069. orderGoodsId: item.orderGoodsId,
  1070. },
  1071. noLoading: true,
  1072. }).then((res) => {
  1073. if (res.data.code == 200) {
  1074. if (res.data.total > 1) {
  1075. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  1076. uni.navigateTo({
  1077. url: `/pages3/polyv/detail?id=''&goodsId=${
  1078. item.goodsId
  1079. }&orderGoodsId=${item.orderGoodsId}&gradeId=${
  1080. item.gradeId
  1081. }&periodWaitTime=${item.periodWaitTime ? 1 : ""}`,
  1082. });
  1083. } else if (res.data.total == 1) {
  1084. uni.navigateTo({
  1085. url: `/pages3/polyv/detail?id=${
  1086. res.data.rows[0].courseId
  1087. }&goodsId=${item.goodsId}&orderGoodsId=${
  1088. item.orderGoodsId
  1089. }&gradeId=${item.gradeId}&periodWaitTime=${
  1090. item.periodWaitTime ? "" : 1
  1091. }`,
  1092. });
  1093. } else {
  1094. uni.showToast({
  1095. icon: "none",
  1096. title: "暂无可观看的视频课程",
  1097. });
  1098. }
  1099. }
  1100. });
  1101. },
  1102. /**
  1103. * @param {Object} goodsId 商品id
  1104. * 查询商品重修状态
  1105. */
  1106. courseGoodsRebuildStatus(goodsId, gradeId) {
  1107. return new Promise((resolve) => {
  1108. this.$http({
  1109. url: "/course/goodsRebuildStatus",
  1110. method: "get",
  1111. data: {
  1112. goodsId: goodsId,
  1113. gradeId: gradeId,
  1114. },
  1115. noLoading: true,
  1116. compleLoading: true, // 请求成功是否还要继续显示加载中
  1117. }).then((res) => {
  1118. resolve(res.data.data);
  1119. });
  1120. });
  1121. },
  1122. userConfirmInfoDetail() {
  1123. return new Promise((resolve) => {
  1124. this.$http({
  1125. url: "/user/confirm/info/detail",
  1126. method: "get",
  1127. data: { orderGoodsId: this.activeItem.orderGoodsId },
  1128. noLoading: true,
  1129. }).then((res) => {
  1130. if (!res.data.data) {
  1131. clearInterval(this.confirmTimer);
  1132. this.confirmCount = 10;
  1133. this.showUserConfirmInfo = true;
  1134. this.confirmTimer = setInterval(() => {
  1135. if (this.confirmCount > 0) {
  1136. this.confirmCount--;
  1137. } else {
  1138. clearInterval(this.confirmTimer);
  1139. }
  1140. }, 1000);
  1141. } else {
  1142. if (res.data.data.pushInfo) {
  1143. resolve(true);
  1144. } else {
  1145. const text = this.eduPhone
  1146. ? ",有疑问,请联系" + this.eduPhone
  1147. : "";
  1148. uni.showModal({
  1149. showCancel: false,
  1150. title: "提示",
  1151. content: "开通信息推送不成功,无法进入学习" + text,
  1152. });
  1153. resolve(false);
  1154. }
  1155. }
  1156. });
  1157. });
  1158. },
  1159. selectClass(item, index, load) {
  1160. this.itemIndex = index;
  1161. this.selectItem = item;
  1162. this.selectClassModal = true;
  1163. this.goodsGradeList(item.goodsId, load);
  1164. },
  1165. goodsGradeList(id, load) {
  1166. this.$http({
  1167. url: "/grade/grade/list",
  1168. method: "get",
  1169. data: { goodsId: id },
  1170. noLoading: load ? true : false,
  1171. }).then((res) => {
  1172. if (res.data.code == 200) {
  1173. this.gradeList = res.data.rows;
  1174. if (this.gradeList.length == 0) {
  1175. let item = {
  1176. className: "系统分班",
  1177. gradeId: 0,
  1178. };
  1179. this.gradeList.push(item);
  1180. } else {
  1181. let isGradeFull = this.gradeList.every(
  1182. (item) =>
  1183. item.studentNum > 0 && item.studentNum == item.studentUpper
  1184. );
  1185. //所有班级都满了
  1186. if (isGradeFull) {
  1187. let item = {
  1188. className: "系统分班",
  1189. gradeId: 0,
  1190. };
  1191. this.gradeList.unshift(item);
  1192. }
  1193. }
  1194. }
  1195. });
  1196. },
  1197. radioGroupChange(e) {
  1198. // console.log(e)
  1199. },
  1200. okPopup() {
  1201. if (this.gradeValue == -1) {
  1202. uni.showToast({
  1203. icon: "none",
  1204. title: "请选择班级",
  1205. });
  1206. return;
  1207. }
  1208. this.$api
  1209. .changeGrade({
  1210. goodsId: this.selectItem.goodsId,
  1211. gradeId: this.gradeValue,
  1212. oldGradeId: this.selectItem.gradeId,
  1213. orderGoodsId: this.selectItem.orderGoodsId,
  1214. userId: this.selectItem.userId,
  1215. })
  1216. .then((res) => {
  1217. if (res.data.code == 200) {
  1218. if (this.itemIndex !== "") {
  1219. this.refreshByIndex();
  1220. }
  1221. this.selectClassModal = false;
  1222. uni.showToast({
  1223. title: "选班成功",
  1224. });
  1225. } else {
  1226. uni.showToast({
  1227. icon: "none",
  1228. title: res.data.msg,
  1229. });
  1230. }
  1231. });
  1232. },
  1233. /**
  1234. * 返回刷新之前进入的课程数据
  1235. */
  1236. refreshByIndex() {
  1237. this.$api
  1238. .listUserVideoLive({
  1239. pageNum: this.itemIndex + 1,
  1240. pageSize: 1,
  1241. })
  1242. .then((res) => {
  1243. if (res.data.code == 200) {
  1244. this.$set(this.courseLists, this.itemIndex, res.data.rows[0]);
  1245. }
  1246. });
  1247. },
  1248. confirmUserConfirm() {
  1249. this.$refs.uModal.clearLoading();
  1250. if (this.confirmCount <= 0) {
  1251. if (this.confirmChecked) {
  1252. let infoJson = {
  1253. realname: this.userInfo.realname,
  1254. idCard: this.userInfo.idCard,
  1255. telphone: this.userInfo.telphone,
  1256. };
  1257. this.$api
  1258. .userConfirminfo({
  1259. orderGoodsId: this.activeItem.orderGoodsId,
  1260. infoJson: JSON.stringify(infoJson),
  1261. })
  1262. .then((res) => {
  1263. if (res.data.code != 200) {
  1264. this.showUserConfirmInfo = false;
  1265. uni.showToast({
  1266. icon: "none",
  1267. title: res.data.msg,
  1268. });
  1269. return;
  1270. }
  1271. if (res.data.data.pushInfo) {
  1272. uni.showToast({
  1273. icon: "none",
  1274. title: "提交成功",
  1275. });
  1276. } else {
  1277. const text = this.eduPhone
  1278. ? ",有疑问,请联系" + this.eduPhone
  1279. : "";
  1280. uni.showModal({
  1281. showCancel: false,
  1282. title: "提示",
  1283. content: "开通信息推送不成功,无法进入学!" + text,
  1284. });
  1285. }
  1286. this.showUserConfirmInfo = false;
  1287. });
  1288. } else {
  1289. uni.showToast({
  1290. icon: "none",
  1291. title: "请勾选确认个人信息无误",
  1292. });
  1293. }
  1294. } else {
  1295. return;
  1296. }
  1297. },
  1298. cancelUserConfirm() {
  1299. clearInterval(this.confirmTimer);
  1300. },
  1301. call() {
  1302. // #ifdef MP-WEIXIN
  1303. uni.makePhoneCall({
  1304. phoneNumber: "020-87085982", //仅为示例
  1305. });
  1306. // #endif
  1307. },
  1308. closePop() {
  1309. this.appointTestShow = false;
  1310. },
  1311. jumpTest(item, appoint) {
  1312. this.appoint_an(item, appoint);
  1313. this.appointTestShow = false;
  1314. },
  1315. appointment(item, appoint) {
  1316. this.appointItemIndex = item;
  1317. if (item.examApplyGoodsList.length > 1) {
  1318. // 多个考试预约
  1319. this.appointTestList = item.examApplyGoodsList;
  1320. this.appointTestShow = true;
  1321. return;
  1322. }
  1323. let appoint_item = item.examApplyGoodsList[0];
  1324. this.appoint_an(item, appoint_item);
  1325. },
  1326. appoint_an(item, appoint) {
  1327. var data = {
  1328. goodsId: item.goodsId,
  1329. gradeId: item.gradeId,
  1330. applyId: appoint.applyId,
  1331. orderGoodsId: item.orderGoodsId,
  1332. };
  1333. this.$api.getApplysubscribe(data).then((res) => {
  1334. if (res.data.code === 500) {
  1335. uni.showModal({
  1336. showCancel: false,
  1337. content: res.data.msg,
  1338. });
  1339. }
  1340. if (res.data.code === 200) {
  1341. this.$navTo.togo("/pages2/appointment/index", {
  1342. goodsId: item.goodsId,
  1343. gradeId: item.gradeId,
  1344. orderGoodsId: item.orderGoodsId,
  1345. applyId: appoint.applyId,
  1346. });
  1347. }
  1348. });
  1349. },
  1350. // 进入刷题,调整小程序
  1351. appBeforeAddress(goodsId, item) {
  1352. this.$api
  1353. .appBeforeAddress({
  1354. orderGoodsId: item.orderGoodsId,
  1355. })
  1356. .then((res) => {
  1357. if (res.data.code == 200) {
  1358. uni.navigateToMiniProgram({
  1359. appId: res.data.data.url,
  1360. success(res) {
  1361. // 打开成功
  1362. },
  1363. });
  1364. } else {
  1365. uni.showModal({
  1366. title: "提示",
  1367. content: res.data.msg,
  1368. showCancel: false,
  1369. });
  1370. }
  1371. });
  1372. },
  1373. },
  1374. };
  1375. </script>
  1376. <style>
  1377. page {
  1378. background: #eaeef1;
  1379. }
  1380. </style>
  1381. <style lang="scss" scoped>
  1382. @import "./index.scss";
  1383. </style>