index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998
  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" v-if="userInfo">
  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. if (!this.$method.isLogin()) {
  475. return;
  476. }
  477. this.allLoading = true
  478. let arrs = [
  479. this.$api.listUserVideoLive(this.paramC), // 查询用户拥有视频+直播商品 /goods/listUserVideoLive
  480. this.$api.getgoodsLiveList({
  481. pageNum: 1,
  482. pageSize: 3 // 默认3条
  483. })
  484. ]
  485. wx.stopPullDownRefresh()
  486. Promise.all(arrs).then((res) => {
  487. // if (res.data.code == 200) {
  488. const [{ data: res1}, { data: res2}] = res
  489. if (res1.code == 200) {
  490. this.courseLists = res1.rows || []
  491. }
  492. // if (res2.code == 200) {
  493. // this.questionLists = res2.rows || []
  494. // }
  495. if (res2.code == 200) {
  496. this.livingLists = res2.rows || []
  497. } else {
  498. this.$u.toast(res2.msg)
  499. }
  500. this.allLoading = false
  501. this.sysTime = +this.$method.timest()
  502. // }
  503. uni.hideLoading()
  504. }).catch(err => {
  505. uni.hideLoading()
  506. this.allLoading = false
  507. })
  508. },
  509. // commonSystemTime() {
  510. // return new Promise(resolve => {
  511. // this.$api.commonSystemTime().then(res => {
  512. // this.sysTime = res.data.data;
  513. // })
  514. // })
  515. // },
  516. // 看直播
  517. toLiveLook(item) {
  518. let moduleId = item.moduleId || 0
  519. let chapterId = item.chapterId || 0
  520. let sectionId = item.sectionId || item.menuId
  521. let uuid = new Date().valueOf() + ""
  522. // buyCourse 是否购买课程:1是 0否
  523. let encode = encodeURIComponent(WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='
  524. +item.liveUrl+'&gradeId='+0+'&courseId='+item.courseId+'&goodsId='+item.goodsId+'&orderGoodsId='+item.orderGoodsId+'&sectionId='+sectionId+'&chapterId='
  525. +chapterId+'&moduleId='+moduleId+'&buyCourse=1'+'&ident='+uuid+'&sectionType=2')
  526. uni.navigateTo({
  527. url:`../../pages/webview/index?url=`+encode
  528. })
  529. },
  530. toLive(item) {
  531. this.$api.courseCourseList({
  532. pageNum: 1,
  533. pageSize: 1,
  534. goodsId: item.goodsId,
  535. gradeId: 0,
  536. orderGoodsId: item.orderGoodsId,
  537. }).then(res => {
  538. if (res.data.code == 200) {
  539. if(res.data.total > 1) {
  540. // uni.navigateTo({
  541. // url:'/pages5/liveDetail/course?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0'
  542. // })
  543. uni.navigateTo({
  544. url:'/pages3/live/detail?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId=""'
  545. })
  546. } else if(res.data.total == 1) {
  547. uni.navigateTo({
  548. url:'/pages3/live/detail?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId='+ res.data.rows[0].courseId
  549. })
  550. } else {
  551. uni.showToast({
  552. icon:'none',
  553. title:'暂无可观看的直播课程'
  554. })
  555. }
  556. }
  557. })
  558. },
  559. async studyIn(v, i, item, index) {
  560. if (item.goodsType == 6) { // 进入直播课
  561. this.toLive(item)
  562. return
  563. }
  564. // 进入视频课
  565. this.activeItem = item
  566. if (item.interfaceAccountId > 0) { //学习账号已开通
  567. if (item.learnStatus == 1) { //跳转第三方h5
  568. uni.navigateTo({
  569. url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&isOther=1`
  570. })
  571. return;
  572. } else {
  573. uni.showModal({
  574. showCancel: false,
  575. content: '您的学习账号未开通,请稍后再尝试,有疑问,请联系020-87085982!'
  576. });
  577. return;
  578. }
  579. return;
  580. }
  581. if (item.serviceStartTime && (this.sysTime <= item.serviceStartTime || this.sysTime >= item.serviceEndTime)) {
  582. uni.showToast({
  583. icon: 'none',
  584. title: '不在学习服务期,不能进入学习'
  585. })
  586. return;
  587. }
  588. if ((item.classStartTime && this.sysTime <= item.classStartTime) || (item.classEndTime && this
  589. .sysTime >= item.classEndTime)) {
  590. uni.showToast({
  591. icon: 'none',
  592. title: '不在班级有效期,不能进入学习'
  593. })
  594. return
  595. }
  596. // learningStatus: 1即刻,2待定,3不在日期内
  597. if (item.learningStatus == 2) {
  598. uni.showToast({
  599. icon: 'none',
  600. title: '开放学习时间待定,不能进入学习'
  601. })
  602. return
  603. }
  604. if (item.classStatus == 0) {
  605. uni.showToast({
  606. icon: 'none',
  607. title: '尚未开班,不能进入学习'
  608. })
  609. return
  610. }
  611. if (item.learningStatus == 3 && (this.sysTime < item.learningTimeStart)) {
  612. uni.showToast({
  613. icon: 'none',
  614. title: '不在开放学习时间,不能进入学习'
  615. })
  616. return;
  617. }
  618. uni.showLoading({
  619. title: '拼命加载中...',
  620. mask:true,
  621. })
  622. var confirmDetail = true;
  623. if (item.educationName == '继续教育') {
  624. if(item.officialName && item.businessName == '二级' && item.projectName == '建造师') {
  625. confirmDetail = await this.userConfirmInfoDetail()
  626. }
  627. }
  628. if(!confirmDetail) {
  629. return;
  630. }
  631. this.itemIndex = index
  632. if (item.gradeStatus == 1 && item.status == 1 && (item.serviceEndTime > this.sysTime) && (item
  633. .classEndTime && (item.classEndTime < this.sysTime)) && (item.periodStatus == 0 || item
  634. .periodStatus == -1) && item.studyCount > 0) {
  635. this.selectClass(item, index, 'loading')
  636. return
  637. }
  638. // /course/goodsRebuildStatus查询用户商品重修状态
  639. let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId, item.gradeId)
  640. if (rebuildStatus == 0) {
  641. uni.hideLoading()
  642. this.$navTo.togo('/pages2/learn/details', {
  643. gradeId: item.gradeId,
  644. goodsId: item.goodsId,
  645. orderGoodsId: item.orderGoodsId,
  646. });
  647. return;
  648. }
  649. // /lock/lockStatus
  650. this.$api.lockLockStatus({
  651. action: 'jxjy',
  652. uuid:this.$method.getUuid()
  653. }).then(res => {
  654. if (res.data.code == 200) { //有其他端在操作,不能学习
  655. uni.showToast({
  656. icon: 'none',
  657. title: res.data.msg,
  658. mask: true,
  659. duration: 3000
  660. })
  661. } else if (res.data.code == 500) { //可以学习
  662. this.$http({
  663. url: '/course/courseList',
  664. method: 'get',
  665. data: {
  666. pageNum: 1,
  667. pageSize: 100,
  668. goodsId: item.goodsId,
  669. gradeId: item.gradeId,
  670. orderGoodsId: item.orderGoodsId,
  671. },
  672. noLoading: true
  673. })
  674. .then(res => {
  675. if (res.data.code == 200) {
  676. if(res.data.total > 1) {
  677. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  678. uni.navigateTo({
  679. url: `/pages3/polyv/detail?id=''&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}`
  680. })
  681. } else if(res.data.total == 1) {
  682. uni.navigateTo({
  683. url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}`
  684. })
  685. } else {
  686. uni.showToast({
  687. icon:'none',
  688. title:'暂无可观看的视频课程'
  689. })
  690. }
  691. }
  692. });
  693. return;
  694. }
  695. })
  696. },
  697. /**
  698. * @param {Object} goodsId 商品id
  699. * 查询商品重修状态
  700. */
  701. courseGoodsRebuildStatus(goodsId, gradeId) {
  702. return new Promise(resolve => {
  703. this.$http({
  704. url: '/course/goodsRebuildStatus',
  705. method: 'get',
  706. data: {
  707. goodsId: goodsId,
  708. gradeId: gradeId
  709. },
  710. noLoading: true,
  711. compleLoading: true, // 请求成功是否还要继续显示加载中
  712. })
  713. .then(res => {
  714. resolve(res.data.data)
  715. })
  716. })
  717. },
  718. userConfirmInfoDetail(){
  719. return new Promise(resolve => {
  720. this.$http({
  721. url: '/user/confirm/info/detail',
  722. method: 'get',
  723. data: { orderGoodsId:this.activeItem.orderGoodsId },
  724. noLoading:true,
  725. })
  726. .then(res => {
  727. if(!res.data.data) {
  728. clearInterval(this.confirmTimer);
  729. this.confirmCount = 10;
  730. this.showUserConfirmInfo = true;
  731. this.confirmTimer = setInterval(() => {
  732. if(this.confirmCount > 0) {
  733. this.confirmCount--
  734. } else {
  735. clearInterval(this.confirmTimer);
  736. }
  737. },1000)
  738. } else {
  739. if(res.data.data.pushInfo) {
  740. resolve(true)
  741. } else {
  742. uni.showModal({
  743. showCancel:false,
  744. title:'提示',
  745. content:'开通信息推送不成功,无法进入学习,请联系020-87085982!'
  746. })
  747. resolve(false)
  748. }
  749. }
  750. })
  751. })
  752. },
  753. selectClass(item, index, load) {
  754. this.itemIndex = index;
  755. this.selectItem = item;
  756. this.selectClassModal = true;
  757. this.goodsGradeList(item.goodsId, load);
  758. },
  759. goodsGradeList(id, load) {
  760. this.$http({
  761. url: '/grade/grade/list',
  762. method: 'get',
  763. data: { goodsId: id },
  764. noLoading: load ? true : false,
  765. })
  766. .then(res => {
  767. if (res.data.code == 200) {
  768. this.gradeList = res.data.rows
  769. if (this.gradeList.length == 0) {
  770. let item = {
  771. className: '系统分班',
  772. gradeId: 0
  773. }
  774. this.gradeList.push(item)
  775. } else {
  776. let isGradeFull = this.gradeList.every(item => (item.studentNum > 0 && item
  777. .studentNum == item.studentUpper))
  778. //所有班级都满了
  779. if (isGradeFull) {
  780. let item = {
  781. className: '系统分班',
  782. gradeId: 0
  783. }
  784. this.gradeList.unshift(item)
  785. }
  786. }
  787. }
  788. });
  789. },
  790. radioGroupChange(e) {
  791. // console.log(e)
  792. },
  793. okPopup() {
  794. if (this.gradeValue == -1) {
  795. uni.showToast({
  796. icon: 'none',
  797. title: '请选择班级'
  798. })
  799. return;
  800. }
  801. this.$api.changeGrade({
  802. goodsId: this.selectItem.goodsId,
  803. gradeId: this.gradeValue,
  804. oldGradeId: this.selectItem.gradeId,
  805. orderGoodsId: this.selectItem.orderGoodsId,
  806. userId: this.selectItem.userId
  807. }).then(res => {
  808. if (res.data.code == 200) {
  809. if (this.itemIndex !== '') {
  810. this.refreshByIndex();
  811. }
  812. this.selectClassModal = false;
  813. uni.showToast({
  814. title: '选班成功'
  815. })
  816. } else {
  817. uni.showToast({
  818. icon: 'none',
  819. title: res.data.msg
  820. })
  821. }
  822. })
  823. },
  824. /**
  825. * 返回刷新之前进入的课程数据
  826. */
  827. refreshByIndex() {
  828. this.$api.listUserVideoLive({
  829. pageNum: this.itemIndex + 1,
  830. pageSize: 1
  831. }).then(res => {
  832. if (res.data.code == 200) {
  833. this.$set(this.courseLists, this.itemIndex, res.data.rows[0])
  834. }
  835. });
  836. },
  837. confirmUserConfirm() {
  838. this.$refs.uModal.clearLoading();
  839. if(this.confirmCount <= 0) {
  840. if(this.confirmChecked) {
  841. let infoJson = {
  842. realname:this.userInfo.realname,
  843. idCard:this.userInfo.idCard,
  844. telphone:this.userInfo.telphone
  845. }
  846. this.$api.userConfirminfo({
  847. orderGoodsId:this.activeItem.orderGoodsId,
  848. infoJson:JSON.stringify(infoJson)
  849. }).then(res => {
  850. if(res.data.data.pushInfo) {
  851. uni.showToast({
  852. icon:'none',
  853. title:'提交成功'
  854. })
  855. } else {
  856. uni.showModal({
  857. showCancel:false,
  858. title:'提示',
  859. content:'开通信息推送不成功,无法进入学习,请联系020-87085982!'
  860. })
  861. }
  862. this.showUserConfirmInfo = false;
  863. })
  864. } else {
  865. uni.showToast({
  866. icon:'none',
  867. title:'请勾选确认个人信息无误'
  868. })
  869. }
  870. } else {
  871. return;
  872. }
  873. },
  874. cancelUserConfirm() {
  875. clearInterval(this.confirmTimer)
  876. },
  877. call() {
  878. uni.makePhoneCall({
  879. phoneNumber: '020-87085982' //仅为示例
  880. })
  881. },
  882. closePop() {
  883. this.appointTestShow = false
  884. },
  885. jumpTest(item, appoint) {
  886. this.appoint_an(item, appoint)
  887. this.appointTestShow = false
  888. },
  889. appointment(item, appoint) {
  890. this.appointItemIndex = item
  891. if (item.examApplyGoodsList.length > 1) { // 多个考试预约
  892. this.appointTestList = item.examApplyGoodsList
  893. this.appointTestShow = true
  894. return
  895. }
  896. let appoint_item = item.examApplyGoodsList[0]
  897. this.appoint_an(item, appoint_item)
  898. },
  899. appoint_an(item, appoint) {
  900. var data = {
  901. goodsId: item.goodsId,
  902. gradeId: item.gradeId,
  903. applyId:appoint.applyId,
  904. orderGoodsId:item.orderGoodsId
  905. };
  906. this.$api.getApplysubscribe(data).then(res => {
  907. if (res.data.code === 500) {
  908. uni.showModal({
  909. showCancel: false,
  910. content: res.data.msg
  911. });
  912. }
  913. if (res.data.code === 200) {
  914. this.$navTo.togo('/pages2/appointment/index', {
  915. goodsId: item.goodsId,
  916. gradeId: item.gradeId,
  917. orderGoodsId: item.orderGoodsId,
  918. applyId:appoint.applyId
  919. });
  920. }
  921. });
  922. },
  923. // 进入刷题,调整小程序
  924. appBeforeAddress(goodsId,item) {
  925. this.$api.appBeforeAddress({
  926. orderGoodsId:item.orderGoodsId
  927. }).then(res => {
  928. if (res.data.code == 200) {
  929. uni.navigateToMiniProgram({
  930. appId: res.data.data.url,
  931. success(res) {
  932. // 打开成功
  933. }
  934. })
  935. } else {
  936. uni.showModal({
  937. title:'提示',
  938. content:res.data.msg,
  939. showCancel:false,
  940. })
  941. }
  942. })
  943. },
  944. }
  945. }
  946. </script>
  947. <style>
  948. page {
  949. background: #eaeef1;
  950. }
  951. </style>
  952. <style lang="scss" scoped>
  953. @import './index.scss';
  954. </style>