index.vue 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398
  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. <template
  357. v-if="
  358. item.gradeStatus == 1 &&
  359. item.status == 1 &&
  360. item.serviceEndTime > sysTime &&
  361. item.serviceStartTime < sysTime &&
  362. item.classEndTime &&
  363. item.classEndTime < sysTime &&
  364. (item.periodStatus == 0 || item.periodStatus == -1) &&
  365. item.userStudyCount > 0
  366. "
  367. >
  368. <view
  369. class="exam_word ones"
  370. @click.stop="selectClass(item, index)"
  371. >
  372. 选班重学
  373. </view>
  374. </template>
  375. <!-- examApplyGoodsList.length -是判断是否关联指定学员 -->
  376. <view v-else class="exam_btns">
  377. <view
  378. class="box_appoint"
  379. v-if="
  380. item.applyStatus === 1 &&
  381. !(
  382. sysTime <= item.serviceStartTime ||
  383. sysTime >= item.serviceEndTime ||
  384. (item.classStartTime && sysTime <= item.classStartTime) ||
  385. (item.classEndTime && sysTime >= item.classEndTime) ||
  386. item.learningStatus == 2 ||
  387. item.classStatus == 0 ||
  388. (item.learningStatus == 3 &&
  389. sysTime < item.learningTimeStart) ||
  390. !item.examApplyGoodsList.length
  391. )
  392. "
  393. @click="appointment(item, appoint)"
  394. >
  395. <view class="exam_word ones">预约考试</view>
  396. </view>
  397. <view
  398. class="box_appoint"
  399. v-if="
  400. item.beforeStatus === 1 &&
  401. !(
  402. sysTime <= item.serviceStartTime ||
  403. sysTime >= item.serviceEndTime ||
  404. (item.classStartTime && sysTime <= item.classStartTime) ||
  405. (item.classEndTime && sysTime >= item.classEndTime) ||
  406. item.learningStatus == 2 ||
  407. item.classStatus == 0 ||
  408. (item.learningStatus == 3 &&
  409. sysTime < item.learningTimeStart)
  410. )
  411. "
  412. @click="appBeforeAddress(item.goodsId, item)"
  413. >
  414. <view class="exam_word ones">进入刷题</view>
  415. </view>
  416. </view>
  417. <view
  418. class="box_appoint"
  419. @click="studyIn(item.goodsId, item.gradeId, item, index)"
  420. >
  421. <view class="exam_word intos">进入学习</view>
  422. </view>
  423. </view>
  424. </view>
  425. </view>
  426. </view>
  427. <!-- 没有学习的课程 -->
  428. <view v-if="!allLoading && !allCourse" class="no_datas">
  429. <image
  430. class="courses"
  431. src="/static/learn/no_course.png"
  432. mode=""
  433. ></image>
  434. <view class="no_learns">您目前没有可学习的课程</view>
  435. <view class="choose" @click="toChoose()">立即去选购</view>
  436. </view>
  437. </view>
  438. <!-- 弹窗 -->
  439. <u-popup
  440. v-model="selectClassModal"
  441. @close="gradeValue = -1"
  442. mode="bottom"
  443. border-radius="40"
  444. >
  445. <view class="popup_box">
  446. <view style="margin-bottom: 20rpx">
  447. <view class="line1"></view>
  448. <view class="grade">选择班级</view>
  449. </view>
  450. <u-line color="#D6D6DB" />
  451. <view>
  452. <scroll-view scroll-y="true" style="height: 500rpx">
  453. <view>
  454. <u-radio-group v-model="gradeValue" @change="radioGroupChange">
  455. <view v-for="(item, index) in gradeList" :key="index">
  456. <view
  457. style="display: flex; align-items: center; padding: 20rpx"
  458. >
  459. <view>
  460. <u-radio
  461. shape="circle"
  462. :name="index"
  463. :disabled="
  464. item.studentNum > 0 &&
  465. item.studentNum == item.studentUpper
  466. "
  467. >
  468. <view
  469. :class="
  470. item.checked ? 'white-box blue-box' : 'white-box'
  471. "
  472. >
  473. <view>
  474. <view class="blackTxt">{{ item.className }}</view>
  475. <view class="redTxt" v-if="item.classEndTime">
  476. 有效期至:{{
  477. $method.timestampToTime(
  478. item.classEndTime,
  479. true,
  480. true
  481. )
  482. }}
  483. </view>
  484. <view class="redTxt" v-if="item.classEndTime">
  485. 本班还剩{{
  486. $method.GetRTime(item.classEndTime)
  487. }}天将结束学习</view
  488. >
  489. </view>
  490. </view>
  491. </u-radio>
  492. </view>
  493. </view>
  494. </view>
  495. </u-radio-group>
  496. </view>
  497. </scroll-view>
  498. </view>
  499. <view class="confrim-btn">
  500. <view class="okBtn" @click="okPopup()">确定</view>
  501. </view>
  502. </view>
  503. </u-popup>
  504. <u-modal
  505. v-model="showUserConfirmInfo"
  506. @confirm="confirmUserConfirm"
  507. ref="uModal"
  508. :async-close="true"
  509. @cancel="cancelUserConfirm"
  510. :confirm-text="
  511. '确认' + (confirmCount > 0 ? '(' + confirmCount + ')' : '')
  512. "
  513. :confirm-color="confirmCount > 0 ? '#999' : '#2979ff'"
  514. class="confirm-modal"
  515. title="实名验证确认"
  516. cancel="取消"
  517. :show-cancel-button="true"
  518. >
  519. <view class="slot-content">
  520. <view class="content">
  521. <!-- ,立刻联系020-38946666 -->
  522. 为避免个人信息不正确导致您的学习时长无效,请认真核对以下信息是否正确,如信息有误请取消当前操作。
  523. <view class="msg-list" v-if="userInfo">
  524. <view class="item">
  525. <text class="item__left">姓名:</text>
  526. <text class="item__right">{{ userInfo.realname }}</text>
  527. </view>
  528. <view class="item">
  529. <text class="item__left">手机号:</text>
  530. <text class="item__right">{{ userInfo.telphone }}</text>
  531. </view>
  532. <view class="item">
  533. <text class="item__left">身份号:</text>
  534. <text class="item__right">{{ userInfo.idCard }}</text>
  535. </view>
  536. <view class="item">
  537. <u-checkbox v-model="confirmChecked" :label-disabled="false"
  538. >确认个人信息无误</u-checkbox
  539. >
  540. </view>
  541. </view>
  542. </view>
  543. </view>
  544. </u-modal>
  545. <!-- 多个预约考试时的弹窗 -->
  546. <u-popup v-model="appointTestShow" mode="bottom" border-radius="40">
  547. <view class="popuptest_box">
  548. <view class="check_head">
  549. <view class="headers">
  550. <view class="grade">预约课程</view>
  551. <u-icon
  552. name="close"
  553. color="#9C9C9C"
  554. size="40"
  555. @click="closePop()"
  556. ></u-icon>
  557. </view>
  558. </view>
  559. <view class="check_con">
  560. <scroll-view scroll-y="true" style="height: 700rpx">
  561. <view
  562. class="course_items"
  563. v-for="(appoint, index) in appointTestList"
  564. :key="index"
  565. >
  566. <view class="course_lefts">
  567. <view class="course_title">{{ appoint.applyName }}</view>
  568. </view>
  569. <view
  570. class="course_rights"
  571. @click="jumpTest(appointItemIndex, appoint)"
  572. >
  573. <view class="intoStudy">预约</view>
  574. </view>
  575. </view>
  576. </scroll-view>
  577. </view>
  578. </view>
  579. </u-popup>
  580. <!-- tabbar -->
  581. <myTabbar></myTabbar>
  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. uni.hideTabBar()
  699. // 1668873600 ,2022.11.20的时间戳
  700. this.leftDays = 1668873600 - parseInt(curTime / 1000);
  701. this.sysTime = +this.$method.timest();
  702. if (this.$method.isLogin()) {
  703. !this.userInfo && this.$api.refreshUserInfo();
  704. }
  705. },
  706. async onShow() {
  707. uni.pageScrollTo({
  708. duration: 0,
  709. scrollTop: 0, // number number number!
  710. });
  711. this.getCourseLiveQues();
  712. // await this.commonSystemTime()
  713. },
  714. onPullDownRefresh() {
  715. this.getCourseLiveQues();
  716. },
  717. onReachBottom() {
  718. if (this.courseLists.length < this.total) {
  719. this.paramC.pageNum++;
  720. this.getCourseList();
  721. }
  722. },
  723. methods: {
  724. ...mapActions(["getUserInfo"]),
  725. bgShow(liveTime, watchStatus) {
  726. let value = liveTime * 1000;
  727. if (curTime > value) {
  728. // 判断当前时间和直播开始时间
  729. return watchStatus == "live" ? true : false;
  730. }
  731. },
  732. lookTimeStatus(liveTime, watchStatus) {
  733. if (liveTime) {
  734. let value = new Date(liveTime * 1000);
  735. var Y = value.getFullYear();
  736. var M =
  737. value.getMonth() + 1 < 10
  738. ? "0" + (value.getMonth() + 1)
  739. : value.getMonth() + 1;
  740. var D = value.getDate() < 10 ? "0" + value.getDate() : value.getDate();
  741. var valZ = Y + "/" + M + "/" + D;
  742. let curZeroTime = new Date(valZ).getTime(); // 获取开始直播时间当天的零点时间戳
  743. if (curTime > value) {
  744. // 判断当前时间和直播开始时间
  745. if (watchStatus == "live") {
  746. //
  747. return 1;
  748. } else {
  749. return 2;
  750. }
  751. } else {
  752. if (curZeroTime <= curTime && curTime <= value) {
  753. //当天
  754. return 3;
  755. } else {
  756. return 4;
  757. }
  758. }
  759. }
  760. },
  761. curTimeTamp(liveTime) {
  762. let min = liveTime - parseInt(curTime / 1000);
  763. return min;
  764. },
  765. toChoose() {
  766. uni.switchTab({
  767. url: "/pages/course/index",
  768. });
  769. },
  770. // 查询直播课
  771. getCourseLiveQues() {
  772. if (!this.$method.isLogin()) {
  773. return;
  774. }
  775. this.allLoading = true;
  776. this.paramC.pageNum = 1;
  777. let arrs = [
  778. this.$api.listUserVideoLive(this.paramC), // 查询用户拥有视频+直播商品 /goods/listUserVideoLive
  779. this.$api.getgoodsLiveList({
  780. pageNum: 1,
  781. pageSize: 3, // 默认3条
  782. }),
  783. ];
  784. wx.stopPullDownRefresh();
  785. Promise.all(arrs)
  786. .then((res) => {
  787. // if (res.data.code == 200) {
  788. const [{ data: res1 }, { data: res2 }] = res;
  789. if (res1.code == 200) {
  790. this.total = res1.total;
  791. this.courseLists = res1.rows || [];
  792. }
  793. // if (res2.code == 200) {
  794. // this.questionLists = res2.rows || []
  795. // }
  796. if (res2.code == 200) {
  797. this.livingLists = res2.rows || [];
  798. } else {
  799. this.$u.toast(res2.msg);
  800. }
  801. this.allLoading = false;
  802. this.sysTime = +this.$method.timest();
  803. // }
  804. uni.hideLoading();
  805. })
  806. .catch((err) => {
  807. uni.hideLoading();
  808. this.allLoading = false;
  809. });
  810. },
  811. getCourseList() {
  812. this.$api
  813. .listUserVideoLive(this.paramC)
  814. .then((res) => {
  815. this.courseLists.push(...res.data.rows);
  816. })
  817. .finally((e) => {
  818. uni.hideLoading();
  819. });
  820. },
  821. // 看直播
  822. toLiveLook(item) {
  823. let moduleId = item.moduleId || 0;
  824. let chapterId = item.chapterId || 0;
  825. let sectionId = item.sectionId || item.menuId;
  826. let uuid = new Date().valueOf() + "";
  827. // buyCourse 是否购买课程:1是 0否
  828. let encode = encodeURIComponent(
  829. this.config.hostLive +
  830. "/pages/live/index?token=" +
  831. uni.getStorageSync("token") +
  832. "&userInfo=" +
  833. (JSON.stringify(this.userInfo) || "") +
  834. "&channelId=" +
  835. item.liveUrl +
  836. "&gradeId=" +
  837. 0 +
  838. "&courseId=" +
  839. item.courseId +
  840. "&goodsId=" +
  841. item.goodsId +
  842. "&orderGoodsId=" +
  843. item.orderGoodsId +
  844. "&sectionId=" +
  845. sectionId +
  846. "&chapterId=" +
  847. chapterId +
  848. "&moduleId=" +
  849. moduleId +
  850. "&buyCourse=1" +
  851. "&ident=" +
  852. uuid +
  853. "&sectionType=2"
  854. );
  855. uni.navigateTo({
  856. url: `../../pages/webview/index?url=` + encode,
  857. });
  858. },
  859. toLive(item) {
  860. this.$api
  861. .courseCourseList({
  862. pageNum: 1,
  863. pageSize: 1,
  864. goodsId: item.goodsId,
  865. gradeId: 0,
  866. orderGoodsId: item.orderGoodsId,
  867. })
  868. .then((res) => {
  869. if (res.data.code == 200) {
  870. if (res.data.total > 1) {
  871. // uni.navigateTo({
  872. // url:'/pages5/liveDetail/course?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0'
  873. // })
  874. uni.navigateTo({
  875. url:
  876. "/pages3/live/detail?orderGoodsId=" +
  877. item.orderGoodsId +
  878. "&goodsId=" +
  879. item.goodsId +
  880. '&gradeId=0&courseId=""',
  881. });
  882. } else if (res.data.total == 1) {
  883. uni.navigateTo({
  884. url:
  885. "/pages3/live/detail?orderGoodsId=" +
  886. item.orderGoodsId +
  887. "&goodsId=" +
  888. item.goodsId +
  889. "&gradeId=0&courseId=" +
  890. res.data.rows[0].courseId,
  891. });
  892. } else {
  893. uni.showToast({
  894. icon: "none",
  895. title: "暂无可观看的直播课程",
  896. });
  897. }
  898. }
  899. });
  900. },
  901. async studyIn(v, i, item, index) {
  902. if (item.externalLinkStatus) {
  903. this.$method.toLink(item.externalLink);
  904. return;
  905. }
  906. if (item.goodsType == 6) {
  907. // 进入直播课
  908. this.toLive(item);
  909. return;
  910. }
  911. // 进入视频课
  912. this.activeItem = item;
  913. if (item.interfaceAccountId > 0) {
  914. //学习账号已开通
  915. if (item.learnStatus > 0) {
  916. //跳转第三方h5
  917. uni.navigateTo({
  918. url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}&isOther=1`,
  919. });
  920. return;
  921. } else {
  922. const text = this.eduPhone ? ",有疑问,请联系" + this.eduPhone : "";
  923. uni.showModal({
  924. showCancel: false,
  925. content: "您的学习账号未开通,请稍后再尝试" + text,
  926. });
  927. return;
  928. }
  929. return;
  930. }
  931. if (
  932. item.serviceStartTime &&
  933. (this.sysTime <= item.serviceStartTime ||
  934. this.sysTime >= item.serviceEndTime)
  935. ) {
  936. uni.showToast({
  937. icon: "none",
  938. title: "不在学习服务期,不能进入学习",
  939. });
  940. return;
  941. }
  942. if (
  943. (item.classStartTime && this.sysTime <= item.classStartTime) ||
  944. (item.classEndTime && this.sysTime >= item.classEndTime)
  945. ) {
  946. uni.showToast({
  947. icon: "none",
  948. title: "不在班级有效期,不能进入学习",
  949. });
  950. return;
  951. }
  952. // learningStatus: 1即刻,2待定,3不在日期内
  953. if (item.learningStatus == 2) {
  954. uni.showToast({
  955. icon: "none",
  956. title: "开放学习时间待定,不能进入学习",
  957. });
  958. return;
  959. }
  960. if (item.classStatus == 0) {
  961. uni.showToast({
  962. icon: "none",
  963. title: "尚未开班,不能进入学习",
  964. });
  965. return;
  966. }
  967. if (item.learningStatus == 3 && this.sysTime < item.learningTimeStart) {
  968. uni.showToast({
  969. icon: "none",
  970. title: "不在开放学习时间,不能进入学习",
  971. });
  972. return;
  973. }
  974. uni.showLoading({
  975. title: "拼命加载中...",
  976. mask: true,
  977. });
  978. // var confirmDetail = true;
  979. // if (item.educationName == "继续教育") {
  980. // if (
  981. // item.officialName &&
  982. // item.businessName == "二级" &&
  983. // item.projectName == "建造师"
  984. // ) {
  985. // confirmDetail = await this.userConfirmInfoDetail();
  986. // }
  987. // }
  988. // if (!confirmDetail) {
  989. // return;
  990. // }
  991. this.itemIndex = index;
  992. if (
  993. item.gradeStatus == 1 &&
  994. item.status == 1 &&
  995. item.serviceEndTime > this.sysTime &&
  996. item.classEndTime &&
  997. item.classEndTime < this.sysTime &&
  998. (item.periodStatus == 0 || item.periodStatus == -1) &&
  999. item.studyCount > 0
  1000. ) {
  1001. this.selectClass(item, index, "loading");
  1002. return;
  1003. }
  1004. // /course/goodsRebuildStatus查询用户商品重修状态
  1005. let rebuildStatus = await this.courseGoodsRebuildStatus(
  1006. item.goodsId,
  1007. item.gradeId
  1008. );
  1009. if (rebuildStatus == 0) {
  1010. uni.hideLoading();
  1011. this.$navTo.togo("/pages2/learn/details", {
  1012. gradeId: item.gradeId,
  1013. goodsId: item.goodsId,
  1014. orderGoodsId: item.orderGoodsId,
  1015. });
  1016. return;
  1017. }
  1018. this.$method.checkLock().then(() => {
  1019. this.$http({
  1020. url: "/course/courseList",
  1021. method: "get",
  1022. data: {
  1023. pageNum: 1,
  1024. pageSize: 100,
  1025. goodsId: item.goodsId,
  1026. gradeId: item.gradeId,
  1027. orderGoodsId: item.orderGoodsId,
  1028. },
  1029. noLoading: true,
  1030. }).then((res) => {
  1031. if (res.data.code == 200) {
  1032. if (res.data.total > 1) {
  1033. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  1034. uni.navigateTo({
  1035. url: `/pages3/polyv/detail?id=''&goodsId=${
  1036. item.goodsId
  1037. }&orderGoodsId=${item.orderGoodsId}&gradeId=${
  1038. item.gradeId
  1039. }&periodWaitTime=${item.periodWaitTime ? 1 : ""}`,
  1040. });
  1041. } else if (res.data.total == 1) {
  1042. uni.navigateTo({
  1043. url: `/pages3/polyv/detail?id=${
  1044. res.data.rows[0].courseId
  1045. }&goodsId=${item.goodsId}&orderGoodsId=${
  1046. item.orderGoodsId
  1047. }&gradeId=${item.gradeId}&periodWaitTime=${
  1048. item.periodWaitTime ? "" : 1
  1049. }`,
  1050. });
  1051. } else {
  1052. uni.showToast({
  1053. icon: "none",
  1054. title: "暂无可观看的视频课程",
  1055. });
  1056. }
  1057. }
  1058. });
  1059. });
  1060. },
  1061. toDetail() {
  1062. this.$http({
  1063. url: "/course/courseList",
  1064. method: "get",
  1065. data: {
  1066. pageNum: 1,
  1067. pageSize: 100,
  1068. goodsId: item.goodsId,
  1069. gradeId: item.gradeId,
  1070. orderGoodsId: item.orderGoodsId,
  1071. },
  1072. noLoading: true,
  1073. }).then((res) => {
  1074. if (res.data.code == 200) {
  1075. if (res.data.total > 1) {
  1076. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  1077. uni.navigateTo({
  1078. url: `/pages3/polyv/detail?id=''&goodsId=${
  1079. item.goodsId
  1080. }&orderGoodsId=${item.orderGoodsId}&gradeId=${
  1081. item.gradeId
  1082. }&periodWaitTime=${item.periodWaitTime ? 1 : ""}`,
  1083. });
  1084. } else if (res.data.total == 1) {
  1085. uni.navigateTo({
  1086. url: `/pages3/polyv/detail?id=${
  1087. res.data.rows[0].courseId
  1088. }&goodsId=${item.goodsId}&orderGoodsId=${
  1089. item.orderGoodsId
  1090. }&gradeId=${item.gradeId}&periodWaitTime=${
  1091. item.periodWaitTime ? "" : 1
  1092. }`,
  1093. });
  1094. } else {
  1095. uni.showToast({
  1096. icon: "none",
  1097. title: "暂无可观看的视频课程",
  1098. });
  1099. }
  1100. }
  1101. });
  1102. },
  1103. /**
  1104. * @param {Object} goodsId 商品id
  1105. * 查询商品重修状态
  1106. */
  1107. courseGoodsRebuildStatus(goodsId, gradeId) {
  1108. return new Promise((resolve) => {
  1109. this.$http({
  1110. url: "/course/goodsRebuildStatus",
  1111. method: "get",
  1112. data: {
  1113. goodsId: goodsId,
  1114. gradeId: gradeId,
  1115. },
  1116. noLoading: true,
  1117. compleLoading: true, // 请求成功是否还要继续显示加载中
  1118. }).then((res) => {
  1119. resolve(res.data.data);
  1120. });
  1121. });
  1122. },
  1123. userConfirmInfoDetail() {
  1124. return new Promise((resolve) => {
  1125. this.$http({
  1126. url: "/user/confirm/info/detail",
  1127. method: "get",
  1128. data: { orderGoodsId: this.activeItem.orderGoodsId },
  1129. noLoading: true,
  1130. }).then((res) => {
  1131. if (!res.data.data) {
  1132. clearInterval(this.confirmTimer);
  1133. this.confirmCount = 10;
  1134. this.showUserConfirmInfo = true;
  1135. this.confirmTimer = setInterval(() => {
  1136. if (this.confirmCount > 0) {
  1137. this.confirmCount--;
  1138. } else {
  1139. clearInterval(this.confirmTimer);
  1140. }
  1141. }, 1000);
  1142. } else {
  1143. if (res.data.data.pushInfo) {
  1144. resolve(true);
  1145. } else {
  1146. const text = this.eduPhone
  1147. ? ",有疑问,请联系" + this.eduPhone
  1148. : "";
  1149. uni.showModal({
  1150. showCancel: false,
  1151. title: "提示",
  1152. content: "开通信息推送不成功,无法进入学习" + text,
  1153. });
  1154. resolve(false);
  1155. }
  1156. }
  1157. });
  1158. });
  1159. },
  1160. selectClass(item, index, load) {
  1161. this.itemIndex = index;
  1162. this.selectItem = item;
  1163. this.selectClassModal = true;
  1164. this.goodsGradeList(item.goodsId, load);
  1165. },
  1166. goodsGradeList(id, load) {
  1167. this.$http({
  1168. url: "/grade/grade/list",
  1169. method: "get",
  1170. data: { goodsId: id },
  1171. noLoading: load ? true : false,
  1172. }).then((res) => {
  1173. if (res.data.code == 200) {
  1174. this.gradeList = res.data.rows;
  1175. if (this.gradeList.length == 0) {
  1176. let item = {
  1177. className: "系统分班",
  1178. gradeId: 0,
  1179. };
  1180. this.gradeList.push(item);
  1181. } else {
  1182. let isGradeFull = this.gradeList.every(
  1183. (item) =>
  1184. item.studentNum > 0 && item.studentNum == item.studentUpper
  1185. );
  1186. //所有班级都满了
  1187. if (isGradeFull) {
  1188. let item = {
  1189. className: "系统分班",
  1190. gradeId: 0,
  1191. };
  1192. this.gradeList.unshift(item);
  1193. }
  1194. }
  1195. }
  1196. });
  1197. },
  1198. radioGroupChange(e) {
  1199. // console.log(e)
  1200. },
  1201. okPopup() {
  1202. if (this.gradeValue == -1) {
  1203. uni.showToast({
  1204. icon: "none",
  1205. title: "请选择班级",
  1206. });
  1207. return;
  1208. }
  1209. this.$api
  1210. .changeGrade({
  1211. goodsId: this.selectItem.goodsId,
  1212. gradeId: this.gradeValue,
  1213. oldGradeId: this.selectItem.gradeId,
  1214. orderGoodsId: this.selectItem.orderGoodsId,
  1215. userId: this.selectItem.userId,
  1216. })
  1217. .then((res) => {
  1218. if (res.data.code == 200) {
  1219. if (this.itemIndex !== "") {
  1220. this.refreshByIndex();
  1221. }
  1222. this.selectClassModal = false;
  1223. uni.showToast({
  1224. title: "选班成功",
  1225. });
  1226. } else {
  1227. uni.showToast({
  1228. icon: "none",
  1229. title: res.data.msg,
  1230. });
  1231. }
  1232. });
  1233. },
  1234. /**
  1235. * 返回刷新之前进入的课程数据
  1236. */
  1237. refreshByIndex() {
  1238. this.$api
  1239. .listUserVideoLive({
  1240. pageNum: this.itemIndex + 1,
  1241. pageSize: 1,
  1242. })
  1243. .then((res) => {
  1244. if (res.data.code == 200) {
  1245. this.$set(this.courseLists, this.itemIndex, res.data.rows[0]);
  1246. }
  1247. });
  1248. },
  1249. confirmUserConfirm() {
  1250. this.$refs.uModal.clearLoading();
  1251. if (this.confirmCount <= 0) {
  1252. if (this.confirmChecked) {
  1253. let infoJson = {
  1254. realname: this.userInfo.realname,
  1255. idCard: this.userInfo.idCard,
  1256. telphone: this.userInfo.telphone,
  1257. };
  1258. this.$api
  1259. .userConfirminfo({
  1260. orderGoodsId: this.activeItem.orderGoodsId,
  1261. infoJson: JSON.stringify(infoJson),
  1262. })
  1263. .then((res) => {
  1264. if (res.data.code != 200) {
  1265. this.showUserConfirmInfo = false;
  1266. uni.showToast({
  1267. icon: "none",
  1268. title: res.data.msg,
  1269. });
  1270. return;
  1271. }
  1272. if (res.data.data.pushInfo) {
  1273. uni.showToast({
  1274. icon: "none",
  1275. title: "提交成功",
  1276. });
  1277. } else {
  1278. const text = this.eduPhone
  1279. ? ",有疑问,请联系" + this.eduPhone
  1280. : "";
  1281. uni.showModal({
  1282. showCancel: false,
  1283. title: "提示",
  1284. content: "开通信息推送不成功,无法进入学!" + text,
  1285. });
  1286. }
  1287. this.showUserConfirmInfo = false;
  1288. });
  1289. } else {
  1290. uni.showToast({
  1291. icon: "none",
  1292. title: "请勾选确认个人信息无误",
  1293. });
  1294. }
  1295. } else {
  1296. return;
  1297. }
  1298. },
  1299. cancelUserConfirm() {
  1300. clearInterval(this.confirmTimer);
  1301. },
  1302. call() {
  1303. // #ifdef MP-WEIXIN
  1304. uni.makePhoneCall({
  1305. phoneNumber: "020-87085982", //仅为示例
  1306. });
  1307. // #endif
  1308. },
  1309. closePop() {
  1310. this.appointTestShow = false;
  1311. },
  1312. jumpTest(item, appoint) {
  1313. this.appoint_an(item, appoint);
  1314. this.appointTestShow = false;
  1315. },
  1316. appointment(item, appoint) {
  1317. this.appointItemIndex = item;
  1318. if (item.examApplyGoodsList.length > 1) {
  1319. // 多个考试预约
  1320. this.appointTestList = item.examApplyGoodsList;
  1321. this.appointTestShow = true;
  1322. return;
  1323. }
  1324. let appoint_item = item.examApplyGoodsList[0];
  1325. this.appoint_an(item, appoint_item);
  1326. },
  1327. appoint_an(item, appoint) {
  1328. var data = {
  1329. goodsId: item.goodsId,
  1330. gradeId: item.gradeId,
  1331. applyId: appoint.applyId,
  1332. orderGoodsId: item.orderGoodsId,
  1333. };
  1334. this.$api.getApplysubscribe(data).then((res) => {
  1335. if (res.data.code === 500) {
  1336. uni.showModal({
  1337. showCancel: false,
  1338. content: res.data.msg,
  1339. });
  1340. }
  1341. if (res.data.code === 200) {
  1342. this.$navTo.togo("/pages2/appointment/index", {
  1343. goodsId: item.goodsId,
  1344. gradeId: item.gradeId,
  1345. orderGoodsId: item.orderGoodsId,
  1346. applyId: appoint.applyId,
  1347. });
  1348. }
  1349. });
  1350. },
  1351. // 进入刷题,调整小程序
  1352. appBeforeAddress(goodsId, item) {
  1353. this.$api
  1354. .appBeforeAddress({
  1355. orderGoodsId: item.orderGoodsId,
  1356. })
  1357. .then((res) => {
  1358. if (res.data.code == 200) {
  1359. uni.navigateToMiniProgram({
  1360. appId: res.data.data.url,
  1361. success(res) {
  1362. // 打开成功
  1363. },
  1364. });
  1365. } else {
  1366. uni.showModal({
  1367. title: "提示",
  1368. content: res.data.msg,
  1369. showCancel: false,
  1370. });
  1371. }
  1372. });
  1373. },
  1374. },
  1375. };
  1376. </script>
  1377. <style>
  1378. page {
  1379. background: #eaeef1;
  1380. }
  1381. </style>
  1382. <style lang="scss" scoped>
  1383. @import "./index.scss";
  1384. </style>