index.vue 42 KB

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