index.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400
  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. switch (periodStatus) {
  648. case -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. break;
  662. case 0:
  663. case 2:
  664. case 3:
  665. text = ["审核不通过", "", "待审核", "初审完成"][periodStatus];
  666. color = ["#EB5757", "", "#F67205", "#F67205"][periodStatus];
  667. case 1:
  668. text = periodPlush > 0 ? "学时已上报信息中心" : "学时审核通过";
  669. color = "#F67205";
  670. default:
  671. break;
  672. }
  673. return `<span style='color: ${color}'>${text}</span>`;
  674. };
  675. },
  676. classStatusCompt: function () {
  677. return function (item, sysTime) {
  678. var str = "未开班";
  679. if (item.classEndTime && item.classEndTime < sysTime) {
  680. str = "已过期";
  681. } else if (item.classStartTime && item.classStartTime > sysTime) {
  682. str = "未开始";
  683. } else if (
  684. item.gradeId &&
  685. item.gradeStatus == 1 &&
  686. item.classStatus === 1
  687. ) {
  688. str = "已开班";
  689. } else if (
  690. item.gradeId &&
  691. item.gradeStatus == 1 &&
  692. item.classStatus === 0
  693. ) {
  694. str = "未开班";
  695. }
  696. return str;
  697. };
  698. },
  699. },
  700. onLoad() {
  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 : ""}`,
  1042. });
  1043. } else if (res.data.total == 1) {
  1044. uni.navigateTo({
  1045. url: `/pages3/polyv/detail?id=${
  1046. res.data.rows[0].courseId
  1047. }&goodsId=${item.goodsId}&orderGoodsId=${
  1048. item.orderGoodsId
  1049. }&gradeId=${item.gradeId}&periodWaitTime=${
  1050. item.periodWaitTime ? "" : 1
  1051. }`,
  1052. });
  1053. } else {
  1054. uni.showToast({
  1055. icon: "none",
  1056. title: "暂无可观看的视频课程",
  1057. });
  1058. }
  1059. }
  1060. });
  1061. });
  1062. },
  1063. toDetail() {
  1064. this.$http({
  1065. url: "/course/courseList",
  1066. method: "get",
  1067. data: {
  1068. pageNum: 1,
  1069. pageSize: 100,
  1070. goodsId: item.goodsId,
  1071. gradeId: item.gradeId,
  1072. orderGoodsId: item.orderGoodsId,
  1073. },
  1074. noLoading: true,
  1075. }).then((res) => {
  1076. if (res.data.code == 200) {
  1077. if (res.data.total > 1) {
  1078. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  1079. uni.navigateTo({
  1080. url: `/pages3/polyv/detail?id=''&goodsId=${
  1081. item.goodsId
  1082. }&orderGoodsId=${item.orderGoodsId}&gradeId=${
  1083. item.gradeId
  1084. }&periodWaitTime=${item.periodWaitTime ? 1 : ""}`,
  1085. });
  1086. } else if (res.data.total == 1) {
  1087. uni.navigateTo({
  1088. url: `/pages3/polyv/detail?id=${
  1089. res.data.rows[0].courseId
  1090. }&goodsId=${item.goodsId}&orderGoodsId=${
  1091. item.orderGoodsId
  1092. }&gradeId=${item.gradeId}&periodWaitTime=${
  1093. item.periodWaitTime ? "" : 1
  1094. }`,
  1095. });
  1096. } else {
  1097. uni.showToast({
  1098. icon: "none",
  1099. title: "暂无可观看的视频课程",
  1100. });
  1101. }
  1102. }
  1103. });
  1104. },
  1105. /**
  1106. * @param {Object} goodsId 商品id
  1107. * 查询商品重修状态
  1108. */
  1109. courseGoodsRebuildStatus(goodsId, gradeId) {
  1110. return new Promise((resolve) => {
  1111. this.$http({
  1112. url: "/course/goodsRebuildStatus",
  1113. method: "get",
  1114. data: {
  1115. goodsId: goodsId,
  1116. gradeId: gradeId,
  1117. },
  1118. noLoading: true,
  1119. compleLoading: true, // 请求成功是否还要继续显示加载中
  1120. }).then((res) => {
  1121. resolve(res.data.data);
  1122. });
  1123. });
  1124. },
  1125. userConfirmInfoDetail() {
  1126. return new Promise((resolve) => {
  1127. this.$http({
  1128. url: "/user/confirm/info/detail",
  1129. method: "get",
  1130. data: { orderGoodsId: this.activeItem.orderGoodsId },
  1131. noLoading: true,
  1132. }).then((res) => {
  1133. if (!res.data.data) {
  1134. clearInterval(this.confirmTimer);
  1135. this.confirmCount = 10;
  1136. this.showUserConfirmInfo = true;
  1137. this.confirmTimer = setInterval(() => {
  1138. if (this.confirmCount > 0) {
  1139. this.confirmCount--;
  1140. } else {
  1141. clearInterval(this.confirmTimer);
  1142. }
  1143. }, 1000);
  1144. } else {
  1145. if (res.data.data.pushInfo) {
  1146. resolve(true);
  1147. } else {
  1148. const text = this.eduPhone
  1149. ? ",有疑问,请联系" + this.eduPhone
  1150. : "";
  1151. uni.showModal({
  1152. showCancel: false,
  1153. title: "提示",
  1154. content: "开通信息推送不成功,无法进入学习" + text,
  1155. });
  1156. resolve(false);
  1157. }
  1158. }
  1159. });
  1160. });
  1161. },
  1162. selectClass(item, index, load) {
  1163. this.itemIndex = index;
  1164. this.selectItem = item;
  1165. this.selectClassModal = true;
  1166. this.goodsGradeList(item.goodsId, load);
  1167. },
  1168. goodsGradeList(id, load) {
  1169. this.$http({
  1170. url: "/grade/grade/list",
  1171. method: "get",
  1172. data: { goodsId: id },
  1173. noLoading: load ? true : false,
  1174. }).then((res) => {
  1175. if (res.data.code == 200) {
  1176. this.gradeList = res.data.rows;
  1177. if (this.gradeList.length == 0) {
  1178. let item = {
  1179. className: "系统分班",
  1180. gradeId: 0,
  1181. };
  1182. this.gradeList.push(item);
  1183. } else {
  1184. let isGradeFull = this.gradeList.every(
  1185. (item) =>
  1186. item.studentNum > 0 && item.studentNum == item.studentUpper
  1187. );
  1188. //所有班级都满了
  1189. if (isGradeFull) {
  1190. let item = {
  1191. className: "系统分班",
  1192. gradeId: 0,
  1193. };
  1194. this.gradeList.unshift(item);
  1195. }
  1196. }
  1197. }
  1198. });
  1199. },
  1200. radioGroupChange(e) {
  1201. // console.log(e)
  1202. },
  1203. okPopup() {
  1204. if (this.gradeValue == -1) {
  1205. uni.showToast({
  1206. icon: "none",
  1207. title: "请选择班级",
  1208. });
  1209. return;
  1210. }
  1211. this.$api
  1212. .changeGrade({
  1213. goodsId: this.selectItem.goodsId,
  1214. gradeId: this.gradeValue,
  1215. oldGradeId: this.selectItem.gradeId,
  1216. orderGoodsId: this.selectItem.orderGoodsId,
  1217. userId: this.selectItem.userId,
  1218. })
  1219. .then((res) => {
  1220. if (res.data.code == 200) {
  1221. if (this.itemIndex !== "") {
  1222. this.refreshByIndex();
  1223. }
  1224. this.selectClassModal = false;
  1225. uni.showToast({
  1226. title: "选班成功",
  1227. });
  1228. } else {
  1229. uni.showToast({
  1230. icon: "none",
  1231. title: res.data.msg,
  1232. });
  1233. }
  1234. });
  1235. },
  1236. /**
  1237. * 返回刷新之前进入的课程数据
  1238. */
  1239. refreshByIndex() {
  1240. this.$api
  1241. .listUserVideoLive({
  1242. pageNum: this.itemIndex + 1,
  1243. pageSize: 1,
  1244. })
  1245. .then((res) => {
  1246. if (res.data.code == 200) {
  1247. this.$set(this.courseLists, this.itemIndex, res.data.rows[0]);
  1248. }
  1249. });
  1250. },
  1251. confirmUserConfirm() {
  1252. this.$refs.uModal.clearLoading();
  1253. if (this.confirmCount <= 0) {
  1254. if (this.confirmChecked) {
  1255. let infoJson = {
  1256. realname: this.userInfo.realname,
  1257. idCard: this.userInfo.idCard,
  1258. telphone: this.userInfo.telphone,
  1259. };
  1260. this.$api
  1261. .userConfirminfo({
  1262. orderGoodsId: this.activeItem.orderGoodsId,
  1263. infoJson: JSON.stringify(infoJson),
  1264. })
  1265. .then((res) => {
  1266. if (res.data.code != 200) {
  1267. this.showUserConfirmInfo = false;
  1268. uni.showToast({
  1269. icon: "none",
  1270. title: res.data.msg,
  1271. });
  1272. return;
  1273. }
  1274. if (res.data.data.pushInfo) {
  1275. uni.showToast({
  1276. icon: "none",
  1277. title: "提交成功",
  1278. });
  1279. } else {
  1280. const text = this.eduPhone
  1281. ? ",有疑问,请联系" + this.eduPhone
  1282. : "";
  1283. uni.showModal({
  1284. showCancel: false,
  1285. title: "提示",
  1286. content: "开通信息推送不成功,无法进入学!" + text,
  1287. });
  1288. }
  1289. this.showUserConfirmInfo = false;
  1290. });
  1291. } else {
  1292. uni.showToast({
  1293. icon: "none",
  1294. title: "请勾选确认个人信息无误",
  1295. });
  1296. }
  1297. } else {
  1298. return;
  1299. }
  1300. },
  1301. cancelUserConfirm() {
  1302. clearInterval(this.confirmTimer);
  1303. },
  1304. call() {
  1305. // #ifdef MP-WEIXIN
  1306. uni.makePhoneCall({
  1307. phoneNumber: "020-87085982", //仅为示例
  1308. });
  1309. // #endif
  1310. },
  1311. closePop() {
  1312. this.appointTestShow = false;
  1313. },
  1314. jumpTest(item, appoint) {
  1315. this.appoint_an(item, appoint);
  1316. this.appointTestShow = false;
  1317. },
  1318. appointment(item, appoint) {
  1319. this.appointItemIndex = item;
  1320. if (item.examApplyGoodsList.length > 1) {
  1321. // 多个考试预约
  1322. this.appointTestList = item.examApplyGoodsList;
  1323. this.appointTestShow = true;
  1324. return;
  1325. }
  1326. let appoint_item = item.examApplyGoodsList[0];
  1327. this.appoint_an(item, appoint_item);
  1328. },
  1329. appoint_an(item, appoint) {
  1330. var data = {
  1331. goodsId: item.goodsId,
  1332. gradeId: item.gradeId,
  1333. applyId: appoint.applyId,
  1334. orderGoodsId: item.orderGoodsId,
  1335. };
  1336. this.$api.getApplysubscribe(data).then((res) => {
  1337. if (res.data.code === 500) {
  1338. uni.showModal({
  1339. showCancel: false,
  1340. content: res.data.msg,
  1341. });
  1342. }
  1343. if (res.data.code === 200) {
  1344. this.$navTo.togo("/pages2/appointment/index", {
  1345. goodsId: item.goodsId,
  1346. gradeId: item.gradeId,
  1347. orderGoodsId: item.orderGoodsId,
  1348. applyId: appoint.applyId,
  1349. });
  1350. }
  1351. });
  1352. },
  1353. // 进入刷题,调整小程序
  1354. appBeforeAddress(goodsId, item) {
  1355. this.$api
  1356. .appBeforeAddress({
  1357. orderGoodsId: item.orderGoodsId,
  1358. })
  1359. .then((res) => {
  1360. if (res.data.code == 200) {
  1361. uni.navigateToMiniProgram({
  1362. appId: res.data.data.url,
  1363. success(res) {
  1364. // 打开成功
  1365. },
  1366. });
  1367. } else {
  1368. uni.showModal({
  1369. title: "提示",
  1370. content: res.data.msg,
  1371. showCancel: false,
  1372. });
  1373. }
  1374. });
  1375. },
  1376. },
  1377. };
  1378. </script>
  1379. <style>
  1380. page {
  1381. background: #eaeef1;
  1382. }
  1383. </style>
  1384. <style lang="scss" scoped>
  1385. @import "./index.scss";
  1386. </style>