index.vue 33 KB

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