index.vue 33 KB

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