index.vue 35 KB

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