index.vue 36 KB

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