index.vue 36 KB

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