index.vue 45 KB

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