index.vue 37 KB

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