index.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090
  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) && (item.classEndTime && (item.classEndTime < sysTime)) && (item.periodStatus == 0 || item.periodStatus == -1) && item.studyCount > 0">
  214. <view class="enter_into" @click.stop="selectClass(item,index)">
  215. 选班重学
  216. </view>
  217. </template>
  218. <view v-else class="learn_progress">
  219. <view class="progress_up">
  220. <!-- <image src="/static/icon/wk_icon3.png" class="wk_icon"></image> -->
  221. <!-- 学习进度 (已做试卷+已做节)/(试卷数+节数) -->
  222. <view>
  223. 学习进度:{{ item.stuAllNum+item.recordNum }}/{{ item.secAllNum+item.examNum }}
  224. </view>
  225. <view class="progress_bar" style="width: 100%;">
  226. <u-line-progress :showText="false" height="22" active-color="#ff9900" :show-percent="false"
  227. :percent="((item.stuAllNum+item.recordNum) / (item.secAllNum+item.examNum)) * 100"></u-line-progress>
  228. </view>
  229. </view>
  230. <!-- <view class="progress_down">
  231. <view class="enter_into" @click.stop="studyIn(item.goodsId,item.gradeId,item,index)">进入学习</view>
  232. </view> -->
  233. </view>
  234. </view>
  235. </view>
  236. <!-- 按钮 -->
  237. <view class="study_btns">
  238. <template
  239. 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">
  240. </template>
  241. <view v-else class="exam_btns">
  242. <!-- examApplyGoodsList.length -是判断是否关联指定学员 -->
  243. <view class="box_appoint" v-if="item.applyStatus === 1 && !( sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime
  244. || (item.classStartTime && sysTime <= item.classStartTime) || (item.classEndTime && sysTime >= item.classEndTime) ||
  245. item.learningStatus == 2 || item.classStatus == 0 || (item.learningStatus == 3 && sysTime < item.learningTimeStart) ||
  246. !item.examApplyGoodsList.length)"
  247. @click="appointment(item,appoint)">
  248. <view class="exam_word ones">预约考试</view>
  249. </view>
  250. <view class="box_appoint" v-if="item.beforeStatus === 1 && !( sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime
  251. || (item.classStartTime && sysTime <= item.classStartTime) || (item.classEndTime && sysTime >= item.classEndTime) ||
  252. item.learningStatus == 2 || item.classStatus == 0 || (item.learningStatus == 3 && sysTime < item.learningTimeStart))"
  253. @click="appBeforeAddress(item.goodsId,item)">
  254. <view class="exam_word ones">进入刷题</view>
  255. </view>
  256. </view>
  257. <view class="box_appoint" @click="studyIn(item.goodsId,item.gradeId,item,index)">
  258. <view class="exam_word intos">进入学习</view>
  259. </view>
  260. </view>
  261. </view>
  262. </view>
  263. <!-- 我的题库 -->
  264. <view class="my_courses">
  265. <text class="titles">我的题库</text>
  266. <view class="bottoms">
  267. <navigator hover-class="none" url="/pages2/subject/collect">
  268. <view class="item collect">
  269. <view class="text">收藏集<u-icon name="arrow-right"></u-icon></view>
  270. <image class="img" src="/static/questionBank_collect.png"></image>
  271. </view>
  272. </navigator>
  273. <view class="item list">
  274. <navigator hover-class="none" url="/pages2/bank/question_record">
  275. <view class="list-in">
  276. <image class="img" src="/static/questionBank_record.png" ></image>
  277. <view class="text">
  278. 做题记录 <u-icon name="arrow-right"></u-icon>
  279. </view>
  280. </view>
  281. </navigator>
  282. <navigator hover-class="none" url="/pages2/subject/wrong">
  283. <view class="list-in">
  284. <image class="img" src="/static/questionBank_wrong.png"></image>
  285. <view class="text">
  286. 错题集 <u-icon name="arrow-right"></u-icon>
  287. </view>
  288. </view>
  289. </navigator>
  290. </view>
  291. </view>
  292. <template v-if="questionLists.length">
  293. <view v-for="(item, indexq) in questionLists" :key="indexq" class="course_item">
  294. <view>
  295. <view class="cou_titles">{{ item.goodsName }}</view>
  296. <view v-if="item.serviceStartTime && item.serviceEndTime" class="learn_ranges">
  297. <image class="l_range" src="/static/learn/learn_range.png"></image>
  298. 学习周期:
  299. <text class="l_time">{{ item.serviceStartTime | formate('yyyy.mm.dd') }} - {{ item.serviceEndTime | formate('yyyy.mm.dd') }}</text>
  300. </view>
  301. </view>
  302. <view class="c_downs">
  303. <view class="lefts">
  304. <image class="lefet_img" :src="$method.splitImgHost(item.coverUrl, true)" mode=""></image>
  305. </view>
  306. <view class="rights">
  307. <view class="learn_progress">
  308. <view class="progress_up">
  309. <!-- <image src="/static/icon/wk_icon3.png" class="wk_icon"></image>
  310. 学习进度:{{item.doNum}}/{{item.totalNum}} -->
  311. <view>
  312. 学习进度:{{item.doNum}}/{{item.totalNum}}
  313. </view>
  314. <view class="progress_bar" style="width: 100%;">
  315. <u-line-progress :show-percent="false" height="22" active-color="#ff9900" :percent="(item.doNum/item.totalNum)*100"></u-line-progress>
  316. </view>
  317. </view>
  318. <view class="progress_down">
  319. <view class="enter_into" @click="studyques(item,index)">进入练习</view>
  320. </view>
  321. </view>
  322. </view>
  323. </view>
  324. </view>
  325. </template>
  326. </view>
  327. </view>
  328. <!-- 没有学习的课程 -->
  329. <view v-if="!allLoading && !allCourse" class="no_datas">
  330. <image class="courses" src="/static/learn/no_course.png" mode=""></image>
  331. <view class="no_learns">您目前没有可学习的课程</view>
  332. <view class="choose" @click="toChoose()">立即去选购</view>
  333. </view>
  334. </view>
  335. <!-- 弹窗 -->
  336. <u-popup v-model="selectClassModal" @close="gradeValue = -1" mode="bottom" border-radius="40">
  337. <view class="popup_box">
  338. <view style="margin-bottom: 20rpx;">
  339. <view class="line1"></view>
  340. <view class="grade">选择班级</view>
  341. </view>
  342. <u-line color="#D6D6DB" />
  343. <view>
  344. <scroll-view scroll-y="true" style="height: 500rpx;">
  345. <view>
  346. <u-radio-group v-model="gradeValue" @change="radioGroupChange">
  347. <view v-for="(item, index) in gradeList" :key="index">
  348. <view style="display: flex;align-items: center;padding: 20rpx;">
  349. <view>
  350. <u-radio shape="circle" :name="index"
  351. :disabled="item.studentNum > 0 && item.studentNum == item.studentUpper">
  352. <view :class="item.checked?'white-box blue-box':'white-box'">
  353. <view>
  354. <view class="blackTxt">{{item.className}}</view>
  355. <view class="redTxt" v-if="item.classEndTime">
  356. 有效期至:{{$method.timestampToTime(item.classEndTime,true,true)}}
  357. </view>
  358. <view class="redTxt" v-if="item.classEndTime">
  359. 本班还剩{{$method.GetRTime(item.classEndTime)}}天将结束学习</view>
  360. </view>
  361. </view>
  362. </u-radio>
  363. </view>
  364. </view>
  365. </view>
  366. </u-radio-group>
  367. </view>
  368. </scroll-view>
  369. </view>
  370. <view class="confrim-btn">
  371. <view class="okBtn" @click="okPopup()">确定</view>
  372. </view>
  373. </view>
  374. </u-popup>
  375. <!-- <select-class :selectClassModal.sync="selectClassModal" :gradeList="gradeList" @okPopup="okPopup()" @closeModal="closeModal()"></select-class> -->
  376. <u-modal v-model="showUserConfirmInfo" @confirm="confirmUserConfirm" ref="uModal" :async-close="true"
  377. @cancel="cancelUserConfirm" :confirm-text="'确认' + (confirmCount > 0 ? '('+confirmCount+')' : '')"
  378. :confirm-color="confirmCount > 0 ? '#999' : '#2979ff'" class="confirm-modal" title="实名验证确认"
  379. cancel="取消" :show-cancel-button="true">
  380. <view class="slot-content">
  381. <view class="content">
  382. 为避免个人信息不正确导致您的学习时长无效,请认真核对以下信息是否正确,如信息有误请取消当前操作,立刻联系020-38946666
  383. <view class="msg-list">
  384. <view class="item">
  385. <text class="item__left">姓名:</text>
  386. <text class="item__right">{{userInfo.realname}}</text>
  387. </view>
  388. <view class="item">
  389. <text class="item__left">手机号:</text>
  390. <text class="item__right">{{userInfo.telphone}}</text>
  391. </view>
  392. <view class="item">
  393. <text class="item__left">身份号:</text>
  394. <text class="item__right">{{userInfo.idCard}}</text>
  395. </view>
  396. <view class="item">
  397. <u-checkbox v-model="confirmChecked" :label-disabled="false">确认个人信息无误</u-checkbox>
  398. </view>
  399. </view>
  400. </view>
  401. </view>
  402. </u-modal>
  403. <!-- 多个预约考试时的弹窗 -->
  404. <u-popup v-model="appointTestShow" mode="bottom" border-radius="40">
  405. <view class="popuptest_box">
  406. <view class="check_head">
  407. <view class="headers">
  408. <view class="grade">切换课程</view>
  409. <u-icon name="close" color="#9C9C9C" size="40" @click="closePop()"></u-icon>
  410. </view>
  411. </view>
  412. <view class="check_con">
  413. <scroll-view scroll-y="true" style="height: 700rpx;">
  414. <view class="course_items" v-for="(appoint, index) in appointTestList" :key="index">
  415. <view class="course_lefts">
  416. <view class="course_title">{{ appoint.applyName }}</view>
  417. </view>
  418. <view class="course_rights" @click="jumpTest(appointItemIndex, appoint)">
  419. <view class="intoStudy">预约</view>
  420. </view>
  421. </view>
  422. </scroll-view>
  423. </view>
  424. </view>
  425. </u-popup>
  426. <!-- <tab-bar v-model="current" :list="tabbarlist" :mid-button="true" :mid-button-size="50" class="tab_items"></tab-bar> -->
  427. </view>
  428. </template>
  429. <script>
  430. var curTime = new Date().getTime() // 当前时间的时间戳
  431. import {mapGetters,mapActions} from 'vuex'
  432. import { WEBVIEW_URL } from '@/common/request.js'
  433. // import TabBar from '@/components/u-tabbar/u-tabbar.vue';
  434. export default {
  435. // components: { TabBar },
  436. data() {
  437. return {
  438. leftDays: 0,
  439. paramC: {
  440. pageNum: 1,
  441. pageSize: 50
  442. },
  443. activeItem: {},
  444. itemIndex: '',
  445. confirmTimer:null,
  446. confirmCount:10,
  447. confirmChecked:false,
  448. showUserConfirmInfo:false,
  449. selectItem: {},
  450. selectClassModal: false,
  451. gradeList: [],
  452. gradeValue: -1,
  453. sysTime: 0,
  454. courseLists: [], // 课程列表
  455. questionLists: [], // 题库列表
  456. paramQ: {
  457. pageNum: 1,
  458. pageSize: 50
  459. },
  460. queitemIndex:'',
  461. livingLists: [], // 直播列表
  462. allLoading: false, // 加载样式
  463. current: 2,
  464. appointTestShow: false, //预约考试弹窗
  465. appointTestList: [],
  466. appointItemIndex: {}, // 点击了哪项课程
  467. }
  468. },
  469. filters: {
  470. liveStatus(liveTime, watchStatus) {
  471. let value = liveTime * 1000
  472. if (curTime < value) { // 判断当前时间和直播开始时间
  473. return ' 未开播'
  474. } else {
  475. return watchStatus == 'live' ? '正在直播中' : '即将开播'
  476. }
  477. }
  478. },
  479. computed: {
  480. ...mapGetters(['userInfo']),
  481. allCourse() {
  482. return this.courseLists.length || this.questionLists.length || this.livingLists.length ? true : false
  483. }
  484. },
  485. onLoad() {
  486. // 1668873600 ,2022.11.20的时间戳
  487. this.leftDays = 1668873600 - parseInt(curTime/1000)
  488. // this.getCourseLiveQues()
  489. },
  490. async onShow() {
  491. this.getCourseLiveQues()
  492. await this.commonSystemTime()
  493. this.sysTime = +this.$method.timest()
  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. let arrs = [
  542. this.$api.listUserVideoLive(this.paramC), // 查询用户拥有视频+直播商品 /goods/listUserVideoLive
  543. this.$api.listUserFreeUnionBuyGoodsList(this.paramQ), // 查询用户拥有免费+自购题库商品 /bank/question/listUserFreeUnionBuyGoodsList
  544. this.$api.getgoodsLiveList({
  545. pageNum: 1,
  546. pageSize: 3 // 默认3条
  547. })
  548. ]
  549. Promise.all(arrs).then((res) => {
  550. // if (res.data.code == 200) {
  551. const [{ data: res1}, { data: res2}, {data: res3}] = res
  552. if (res1.code == 200) {
  553. this.courseLists = res1.rows || []
  554. }
  555. if (res2.code == 200) {
  556. this.questionLists = res2.rows || []
  557. }
  558. if (res3.code == 200) {
  559. this.livingLists = res3.rows || []
  560. } else {
  561. this.$u.toast(res3.msg)
  562. }
  563. this.allLoading = false
  564. // }
  565. wx.stopPullDownRefresh()
  566. }).catch(err => {
  567. this.allLoading = false
  568. wx.stopPullDownRefresh()
  569. // this.$u.toast('请重新刷新请求')
  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. // 进入练习
  853. studyques(item,index){
  854. this.queitemIndex = index;
  855. let sysTime = this.$method.timest()
  856. if (item.serviceStartTime && item.serviceEndTime && (sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime)) {
  857. uni.showToast({
  858. icon: 'none',
  859. title: '不在学习服务期,不能进入学习'
  860. })
  861. return;
  862. }
  863. uni.navigateTo({
  864. url:'/pages2/bank/question_detail?id='+item.goodsId+'&orderGoodsId='+item.orderGoodsId
  865. })
  866. },
  867. radioGroupChange(e) {
  868. // console.log(e)
  869. },
  870. okPopup() {
  871. if (this.gradeValue == -1) {
  872. uni.showToast({
  873. icon: 'none',
  874. title: '请选择班级'
  875. })
  876. return;
  877. }
  878. this.$api.changeGrade({
  879. goodsId: this.selectItem.goodsId,
  880. gradeId: this.gradeValue,
  881. oldGradeId: this.selectItem.gradeId,
  882. orderGoodsId: this.selectItem.orderGoodsId,
  883. userId: this.selectItem.userId
  884. }).then(res => {
  885. if (res.data.code == 200) {
  886. if (this.itemIndex !== '') {
  887. this.refreshByIndex();
  888. }
  889. this.selectClassModal = false;
  890. uni.showToast({
  891. title: '选班成功'
  892. })
  893. } else {
  894. uni.showToast({
  895. icon: 'none',
  896. title: res.data.msg
  897. })
  898. }
  899. })
  900. },
  901. /**
  902. * 返回刷新之前进入的课程数据
  903. */
  904. refreshByIndex() {
  905. this.$api.listUserVideoLive({
  906. pageNum: this.itemIndex + 1,
  907. pageSize: 1
  908. }).then(res => {
  909. if (res.data.code == 200) {
  910. this.$set(this.courseLists, this.itemIndex, res.data.rows[0])
  911. }
  912. });
  913. },
  914. confirmUserConfirm() {
  915. this.$refs.uModal.clearLoading();
  916. if(this.confirmCount <= 0) {
  917. if(this.confirmChecked) {
  918. let infoJson = {
  919. realname:this.userInfo.realname,
  920. idCard:this.userInfo.idCard,
  921. telphone:this.userInfo.telphone
  922. }
  923. this.$api.userConfirminfo({
  924. orderGoodsId:this.activeItem.orderGoodsId,
  925. infoJson:JSON.stringify(infoJson)
  926. }).then(res => {
  927. if(res.data.data.pushInfo) {
  928. uni.showToast({
  929. icon:'none',
  930. title:'提交成功'
  931. })
  932. } else {
  933. uni.showModal({
  934. showCancel:false,
  935. title:'提示',
  936. content:'开通信息推送不成功,无法进入学习,请联系020-87085982!'
  937. })
  938. }
  939. this.showUserConfirmInfo = false;
  940. })
  941. } else {
  942. uni.showToast({
  943. icon:'none',
  944. title:'请勾选确认个人信息无误'
  945. })
  946. }
  947. } else {
  948. return;
  949. }
  950. },
  951. cancelUserConfirm() {
  952. clearInterval(this.confirmTimer)
  953. },
  954. call() {
  955. uni.makePhoneCall({
  956. phoneNumber: '020-87085982' //仅为示例
  957. })
  958. },
  959. closePop() {
  960. this.appointTestShow = false
  961. },
  962. jumpTest(item, appoint) {
  963. this.appoint_an(item, appoint)
  964. this.appointTestShow = false
  965. },
  966. appointment(item, appoint) {
  967. console.log('====', item.examApplyGoodsList, this.userInfo)
  968. this.appointItemIndex = item
  969. if (item.examApplyGoodsList.length > 1) { // 多个考试预约
  970. this.appointTestList = item.examApplyGoodsList
  971. this.appointTestShow = true
  972. return
  973. }
  974. let appoint_item = item.examApplyGoodsList[0]
  975. this.appoint_an(item, appoint_item)
  976. },
  977. appoint_an(item, appoint) {
  978. // console.log('==appoint=', appoint)
  979. var data = {
  980. goodsId: item.goodsId,
  981. gradeId: item.gradeId,
  982. applyId:appoint.applyId,
  983. orderGoodsId:item.orderGoodsId
  984. };
  985. this.$api.getApplysubscribe(data).then(res => {
  986. if (res.data.code === 500) {
  987. uni.showModal({
  988. showCancel: false,
  989. content: res.data.msg
  990. });
  991. }
  992. if (res.data.code === 200) {
  993. this.$navTo.togo('/pages2/appointment/index', {
  994. goodsId: item.goodsId,
  995. gradeId: item.gradeId,
  996. orderGoodsId: item.orderGoodsId,
  997. applyId:appoint.applyId
  998. });
  999. }
  1000. });
  1001. },
  1002. // 进入刷题,调整小程序
  1003. appBeforeAddress(goodsId,item) {
  1004. this.$api.appBeforeAddress({
  1005. orderGoodsId:item.orderGoodsId
  1006. }).then(res => {
  1007. if (res.data.code == 200) {
  1008. uni.navigateToMiniProgram({
  1009. appId: res.data.data.url,
  1010. success(res) {
  1011. // 打开成功
  1012. }
  1013. })
  1014. } else {
  1015. uni.showModal({
  1016. title:'提示',
  1017. content:res.data.msg,
  1018. showCancel:false,
  1019. })
  1020. }
  1021. })
  1022. },
  1023. }
  1024. }
  1025. </script>
  1026. <style>
  1027. page {
  1028. background: #eaeef1;
  1029. }
  1030. </style>
  1031. <style lang="scss" scoped>
  1032. @import './index.scss';
  1033. </style>