index.vue 45 KB

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