index.vue 35 KB

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