index.vue 33 KB

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