index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. <template>
  2. <view class="learnings">
  3. <u-navbar :is-back="false" title="学习中心" :border-bottom="false" title-color="#333333" back-icon-color="#ffffff">
  4. <view class="slot-wrap">
  5. <image src="/static/logo2.png" style="width: 178rpx;height: 31rpx;margin-left: 30rpx;"></image>
  6. </view>
  7. </u-navbar>
  8. <u-line color="#D6D6DB" />
  9. <view class="contents">
  10. <view class="diatance">
  11. <image class="clock" src="/static/learn/clock.png" mode=""></image>
  12. <text>一级建造师,距离考试还有123天</text>
  13. </view>
  14. <!-- 有学习的课程 -->
  15. <view class="had_courses">
  16. <!-- 直播 -->
  17. <view class="lives">
  18. </view>
  19. <!-- 我的课程 -->
  20. <view class="my_courses">
  21. <text class="titles">我的课程</text>
  22. <view v-for="(item, index) in courseLists" :key="index" class="course_item">
  23. <view class="lefts">
  24. <image class="lefet_img" :src="$method.splitImgHost(item.coverUrl, true)" mode=""></image>
  25. <view class="live_icon">直播</view>
  26. </view>
  27. <view class="rights">
  28. <view>
  29. <view class="cou_titles">{{ item.goodsName }}</view>
  30. <view v-if="item.serviceStartTime && item.serviceEndTime" class="learn_ranges">
  31. <image class="l_range" src="/static/learn/learn_range.png"></image>
  32. 学习周期:
  33. <text class="l_time">{{ item.serviceStartTime | formate('yyyy.mm.dd') }} - {{ item.serviceEndTime | formate('yyyy.mm.dd') }}</text>
  34. <!-- <text class="l_time">{{ $method.formate(item.studyStartTime,'yyyy.mm.dd') }} - {{ $method.formate(item.studyStartTime,'yyyy.mm.dd') }}</text> -->
  35. </view>
  36. </view>
  37. <view class="learn_progress">
  38. <view class="progress_up">
  39. <image src="/static/icon/wk_icon3.png" class="wk_icon"></image>
  40. 学习进度:{{ item.stuAllNum+item.recordNum }}/{{ item.secAllNum+item.examNum }}
  41. </view>
  42. <view class="progress_down">
  43. <view class="progress_bar" style="width: 50%;">
  44. <u-line-progress :showText="false" height="32" active-color="#ff9900" :show-percent="false"
  45. :percent="((item.stuAllNum+item.recordNum) / (item.secAllNum+item.examNum)) * 100"></u-line-progress>
  46. </view>
  47. <view class="enter_into" @click.stop="studyIn(item.goodsId,item.gradeId,item,index)">进入学习</view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 我的题库 -->
  54. <view class="my_courses">
  55. <text class="titles">我的题库</text>
  56. <view class="bottoms">
  57. <navigator hover-class="none" url="/pages2/subject/collect">
  58. <view class="item collect">
  59. <view class="text">收藏集<u-icon name="arrow-right"></u-icon></view>
  60. <image class="img" src="/static/questionBank_collect.png"></image>
  61. </view>
  62. </navigator>
  63. <view class="item list">
  64. <navigator hover-class="none" url="/pages2/bank/question_record">
  65. <view class="list-in">
  66. <image class="img" src="/static/questionBank_record.png" ></image>
  67. <view class="text">
  68. 做题记录 <u-icon name="arrow-right"></u-icon>
  69. </view>
  70. </view>
  71. </navigator>
  72. <navigator hover-class="none" url="/pages2/subject/wrong">
  73. <view class="list-in">
  74. <image class="img" src="/static/questionBank_wrong.png"></image>
  75. <view class="text">
  76. 错题集 <u-icon name="arrow-right"></u-icon>
  77. </view>
  78. </view>
  79. </navigator>
  80. </view>
  81. </view>
  82. <view v-for="(item, indexq) in questionLists" :key="indexq" class="course_item">
  83. <view class="lefts">
  84. <image class="lefet_img" :src="$method.splitImgHost(item.coverUrl, true)" mode=""></image>
  85. <!-- <view class="live_icon">直播</view> -->
  86. </view>
  87. <view class="rights">
  88. <view>
  89. <view class="cou_titles">{{ item.goodsName }}</view>
  90. <view v-if="item.serviceStartTime && item.serviceEndTime" class="learn_ranges">
  91. <image class="l_range" src="/static/learn/learn_range.png"></image>
  92. 学习周期:
  93. <text class="l_time">{{ item.serviceStartTime | formate('yyyy.mm.dd') }} - {{ item.serviceEndTime | formate('yyyy.mm.dd') }}</text>
  94. </view>
  95. </view>
  96. <view class="learn_progress">
  97. <view class="progress_up">
  98. <image src="/static/icon/wk_icon3.png" class="wk_icon"></image>
  99. 学习进度:{{item.doNum}}/{{item.totalNum}}
  100. </view>
  101. <view class="progress_down">
  102. <view class="progress_bar" style="width: 50%;">
  103. <u-line-progress :show-percent="false" height="32" active-color="#007AFF" :percent="(item.doNum/item.totalNum)*100"></u-line-progress>
  104. </view>
  105. <view class="enter_into" @click="studyques(item,index)">进入练习</view>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <!-- 没有学习的课程 -->
  113. <view v-if="false" class="no_datas">
  114. <image class="courses" src="/static/learn/no_course.png" mode=""></image>
  115. <view class="no_learns">您目前没有可学习的课程</view>
  116. <view class="choose" @click="toChoose()">立即去选购</view>
  117. </view>
  118. </view>
  119. </view>
  120. </template>
  121. <script>
  122. export default {
  123. data() {
  124. return {
  125. paramC: {
  126. pageNum: 1,
  127. pageSize: 50
  128. },
  129. activeItem: {},
  130. itemIndex: '',
  131. confirmTimer:null,
  132. confirmCount:10,
  133. confirmChecked:false,
  134. showUserConfirmInfo:false,
  135. selectItem: {},
  136. selectClassModal: false,
  137. gradeList: [],
  138. gradeValue: -1,
  139. sysTime: 0,
  140. // totalC: 0,
  141. courseLists: [],
  142. questionLists: [], // 题库
  143. paramQ: {
  144. pageNum: 1,
  145. pageSize: 50
  146. },
  147. queitemIndex:'',
  148. }
  149. },
  150. onLoad(option) {
  151. this.getcourseList()
  152. this.getlistQuestion()
  153. },
  154. async onShow() {
  155. await this.commonSystemTime()
  156. this.sysTime = +this.$method.timest()
  157. console.log('this.sysTime', this.sysTime)
  158. },
  159. methods: {
  160. toChoose() {
  161. uni.switchTab({
  162. url:'/pages/course/index'
  163. })
  164. },
  165. // 商品/课程列表
  166. getcourseList() {
  167. this.$api.courseGoodsList(this.paramC).then(res => {
  168. if (res.data.code == 200) {
  169. this.courseLists = res.data.rows || []
  170. }
  171. })
  172. },
  173. // 题库列表
  174. getlistQuestion() {
  175. this.$api.listGoodsUserQuestion(this.paramQ).then(res => {
  176. if (res.data.code == 200) {
  177. this.questionLists = res.data.rows || []
  178. }
  179. })
  180. },
  181. commonSystemTime() {
  182. return new Promise(resolve => {
  183. this.$api.commonSystemTime().then(res => {
  184. this.sysTime = res.data.data;
  185. })
  186. })
  187. },
  188. async studyIn(v, i, item, index) {
  189. this.activeItem = item
  190. if (item.interfaceAccountId > 0) { //学习账号已开通
  191. if (item.learnStatus == 1) { //跳转第三方h5
  192. // this.showMark = true;
  193. uni.navigateTo({
  194. url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&isOther=1`
  195. })
  196. return;
  197. // uni.navigateTo({
  198. // url:'/pages/webview/index?url='+item.officialLearningUrl
  199. // })
  200. // return;
  201. } else {
  202. uni.showModal({
  203. showCancel: false,
  204. content: '您的学习账号未开通,请稍后再尝试,有疑问,请联系020-87085982!'
  205. });
  206. return;
  207. }
  208. return;
  209. }
  210. if (item.serviceStartTime && (this.sysTime <= item.serviceStartTime || this.sysTime >= item.serviceEndTime)) {
  211. uni.showToast({
  212. icon: 'none',
  213. title: '不在学习服务期,不能进入学习'
  214. })
  215. return;
  216. }
  217. if ((item.classStartTime && this.sysTime <= item.classStartTime) || (item.classEndTime && this
  218. .sysTime >= item.classEndTime)) {
  219. uni.showToast({
  220. icon: 'none',
  221. title: '不在班级有效期,不能进入学习'
  222. })
  223. return
  224. }
  225. if (item.learningStatus == 2) {
  226. uni.showToast({
  227. icon: 'none',
  228. title: '开放学习时间待定,不能进入学习'
  229. })
  230. return
  231. }
  232. if (item.classStatus == 0) {
  233. uni.showToast({
  234. icon: 'none',
  235. title: '尚未开班,不能进入学习'
  236. })
  237. return
  238. }
  239. console.log(this.sysTime, item.learningTimeStart)
  240. console.log(this.sysTime < item.learningTimeStart)
  241. if (item.learningStatus == 3 && (this.sysTime < item.learningTimeStart)) {
  242. uni.showToast({
  243. icon: 'none',
  244. title: '不在开放学习时间,不能进入学习'
  245. })
  246. return;
  247. }
  248. var confirmDetail = true
  249. if (item.educationName == '继续教育') {
  250. if(item.officialName && item.businessName == '二级' && item.projectName == '建造师') {
  251. confirmDetail = await this.userConfirmInfoDetail()
  252. }
  253. }
  254. if(!confirmDetail) {
  255. return;
  256. }
  257. // //内部系统
  258. // if (item.interfacePushId > 0 && item.officialStatus != 1) {
  259. // uni.showModal({
  260. // showCancel: false,
  261. // content: '机构正在为您报名中,请耐心等待,有疑问请联系020-87085982!'
  262. // });
  263. // return;
  264. // }
  265. this.itemIndex = index;
  266. if (item.gradeStatus == 1 && item.status == 1 && (item.serviceEndTime > this.sysTime) && (item
  267. .classEndTime && (item.classEndTime < this.sysTime)) && (item.periodStatus == 0 || item
  268. .periodStatus == -1) && item.studyCount > 0) {
  269. this.selectClass(item, index);
  270. return;
  271. }
  272. let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId, item.gradeId)
  273. if (rebuildStatus == 0) {
  274. this.$navTo.togo('/pages2/learn/details', {
  275. gradeId: item.gradeId,
  276. goodsId: item.goodsId,
  277. orderGoodsId: item.orderGoodsId,
  278. });
  279. return;
  280. }
  281. // if (item.educationName == '继续教育') {
  282. // /lock/lockStatus
  283. this.$api.lockLockStatus({
  284. action: 'jxjy',
  285. uuid:this.$method.getUuid()
  286. }).then(res => {
  287. if (res.data.code == 200) { //有其他端在操作,不能学习
  288. uni.showToast({
  289. icon: 'none',
  290. title: res.data.msg,
  291. mask: true,
  292. duration: 3000
  293. })
  294. } else if (res.data.code == 500) { //可以学习
  295. if (item.courseNum == 1) {
  296. this.$api.courseCourseList({
  297. pageNum: 1,
  298. pageSize: 1,
  299. goodsId: item.goodsId,
  300. gradeId: item.gradeId,
  301. orderGoodsId: item.orderGoodsId,
  302. }).then(res => {
  303. if (res.data.code == 200) {
  304. // if(item.officialName && item.businessName == '二级' && item.projectName == '建造师') {
  305. // this.userConfirmInfoDetail().then(() => {
  306. // uni.navigateTo({
  307. // url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}`
  308. // })
  309. // })
  310. // } else {
  311. uni.navigateTo({
  312. url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}`
  313. })
  314. // }
  315. }
  316. });
  317. return;
  318. }
  319. // if(item.officialName && item.businessName == '二级' && item.projectName == '建造师') {
  320. // // this.userConfirmInfoDetail().then(() => {
  321. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  322. // // })
  323. // } else {
  324. this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  325. // }
  326. }
  327. })
  328. },
  329. /**
  330. * @param {Object} goodsId 商品id
  331. * 查询商品重修状态
  332. */
  333. courseGoodsRebuildStatus(goodsId, gradeId) {
  334. return new Promise(resolve => {
  335. this.$api.courseGoodsRebuildStatus({
  336. goodsId: goodsId,
  337. gradeId: gradeId
  338. }).then(res => {
  339. resolve(res.data.data)
  340. })
  341. })
  342. },
  343. userConfirmInfoDetail(){
  344. return new Promise(resolve => {
  345. this.$api.userConfirmInfoDetail({
  346. orderGoodsId:this.activeItem.orderGoodsId,
  347. }).then(res => {
  348. if(!res.data.data) {
  349. clearInterval(this.confirmTimer);
  350. this.confirmCount = 10;
  351. this.showUserConfirmInfo = true;
  352. this.confirmTimer = setInterval(() => {
  353. if(this.confirmCount > 0) {
  354. this.confirmCount--
  355. } else {
  356. clearInterval(this.confirmTimer);
  357. }
  358. },1000)
  359. } else {
  360. if(res.data.data.pushInfo) {
  361. resolve(true)
  362. } else {
  363. uni.showModal({
  364. showCancel:false,
  365. title:'提示',
  366. content:'开通信息推送不成功,无法进入学习,请联系020-87085982!'
  367. })
  368. resolve(false)
  369. }
  370. }
  371. })
  372. })
  373. },
  374. selectClass(item, index) {
  375. console.log(item)
  376. this.itemIndex = index;
  377. this.selectItem = item;
  378. this.selectClassModal = true;
  379. this.goodsGradeList(item.goodsId);
  380. },
  381. goodsGradeList(id) {
  382. this.$api.goodsGradeList({
  383. goodsId: id
  384. }).then(res => {
  385. if (res.data.code == 200) {
  386. this.gradeList = res.data.rows
  387. if (this.gradeList.length == 0) {
  388. let item = {
  389. className: '系统分班',
  390. gradeId: 0
  391. }
  392. this.gradeList.push(item)
  393. } else {
  394. let isGradeFull = this.gradeList.every(item => (item.studentNum > 0 && item
  395. .studentNum == item.studentUpper))
  396. //所有班级都满了
  397. if (isGradeFull) {
  398. let item = {
  399. className: '系统分班',
  400. gradeId: 0
  401. }
  402. this.gradeList.unshift(item)
  403. }
  404. }
  405. }
  406. });
  407. },
  408. // 进入刷题
  409. studyques(item,index){
  410. console.log(item)
  411. this.queitemIndex = index;
  412. let sysTime = this.$method.timest()
  413. if (item.serviceStartTime && item.serviceEndTime && (sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime)) {
  414. uni.showToast({
  415. icon: 'none',
  416. title: '不在学习服务期,不能进入学习'
  417. })
  418. return;
  419. }
  420. uni.navigateTo({
  421. url:'/pages2/bank/question_detail?id='+item.goodsId+'&orderGoodsId='+item.orderGoodsId
  422. })
  423. },
  424. }
  425. }
  426. </script>
  427. <style>
  428. page {
  429. background: #eaeef1;
  430. }
  431. </style>
  432. <style lang="scss" scoped>
  433. .contents {
  434. width: 100%;
  435. .diatance {
  436. width: 100%;
  437. height: 85rpx;
  438. background-color: #007AFF;
  439. display: flex;
  440. align-items: center;
  441. margin-top: 8rpx;
  442. .clock {
  443. width: 44rpx;
  444. height: 41rpx;
  445. margin: 0rpx 22rpx 0rpx 65rpx;
  446. }
  447. >text {
  448. color: #fff;
  449. font-size: 28rpx;
  450. }
  451. }
  452. }
  453. .had_courses{
  454. width: 100%;
  455. padding: 39rpx 24rpx 31rpx;
  456. .lives {
  457. widows: 100%;
  458. height: 150rpx;
  459. }
  460. }
  461. .my_courses {
  462. .titles {
  463. font-size: 32rpx;
  464. color: #333333;
  465. margin: 44rpx 0rpx 24rpx 43rpx;
  466. font-weight: bold;
  467. display: block;
  468. }
  469. .course_item {
  470. width: 100%;
  471. height: 278rpx;
  472. background: #FFFFFF;
  473. box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(1,99,235,0.1000);
  474. border-radius: 24rpx;
  475. padding: 29rpx 29rpx 20rpx 24rpx;
  476. display: flex;
  477. align-items: center;
  478. margin-bottom: 20rpx;
  479. }
  480. .lefts {
  481. width: 202rpx;
  482. height: 223rpx;
  483. border-radius: 12rpx;
  484. margin-right: 35rpx;
  485. position: relative;
  486. top: 0;
  487. left: 0;
  488. border: 1rpx solid #ddd;
  489. .lefet_img {
  490. width: 100%;
  491. height: 100%;
  492. display: block;
  493. }
  494. .live_icon {
  495. width: 65rpx;
  496. height: 35rpx;
  497. line-height: 35rpx;
  498. border-radius: 22rpx 0rpx 22rpx 0rpx;
  499. background-color: #FFB102;
  500. color: #fff;
  501. font-size: 20rpx;
  502. text-align: center;
  503. position: absolute;
  504. top: 0;
  505. left: 0;
  506. }
  507. }
  508. .rights {
  509. width: 400rpx;
  510. height: 223rpx;
  511. display: flex;
  512. flex-direction: column;
  513. justify-content: space-between;;
  514. .cou_titles {
  515. margin-top: 14rpx;
  516. color: #333333;
  517. font-size: 28rpx;
  518. font-weight: bold;
  519. width: 100%;
  520. overflow: hidden;
  521. text-overflow: ellipsis;
  522. white-space: nowrap;
  523. }
  524. .learn_ranges {
  525. color: #999;
  526. font-size: 24rpx;
  527. margin-top: 24rpx;
  528. .l_range {
  529. width: 20rpx;
  530. height: 24rpx;
  531. margin-right: 9rpx;
  532. }
  533. .l_time {
  534. color: #333;
  535. }
  536. }
  537. .learn_progress {
  538. width: 100%;
  539. }
  540. .progress_up {
  541. font-size: 24rpx;
  542. // font-weight: 400;
  543. color: #999999;
  544. display: flex;
  545. align-items: center;
  546. .wk_icon {
  547. width: 24rpx;
  548. height: 24rpx;
  549. margin-right: 8rpx;
  550. }
  551. }
  552. .progress_down {
  553. width: 100%;
  554. display: flex;
  555. justify-content: space-between;
  556. align-items: center;
  557. }
  558. .enter_into {
  559. width: 165rpx;
  560. height: 48rpx;
  561. line-height: 48rpx;
  562. background: #FFB102;
  563. border-radius: 0rpx 16rpx 16rpx 16rpx;
  564. font-size: 24rpx;
  565. font-weight: 400;
  566. color: #FFFFFF;
  567. text-align: center;
  568. }
  569. }
  570. // 收藏集,做题记录
  571. .bottoms {
  572. display: flex;
  573. justify-content: space-between;
  574. margin-bottom: 32rpx;
  575. .item {
  576. width: 335rpx;
  577. &.collect {
  578. position: relative;
  579. font-size: 32rpx;
  580. color: #FFFFFF;
  581. height: 240rpx;
  582. border-radius: 24rpx;
  583. padding:32rpx;
  584. .text {
  585. position:relative;
  586. z-index: 10;
  587. font-size: 32rpx;
  588. font-weight: bold;
  589. color: #FFFFFF;
  590. }
  591. .img {
  592. position:absolute;
  593. left:0;
  594. top:0;
  595. width:100%;
  596. height:100%;
  597. }
  598. }
  599. &.list {
  600. .list-in {
  601. position:relative;
  602. width: 335rpx;
  603. height: 112rpx;
  604. background: #007AFF;
  605. border-radius: 24rpx;
  606. display: flex;
  607. align-items: center;
  608. font-size: 32rpx;
  609. color: #fff;
  610. &:first-of-type {
  611. margin-bottom:16rpx;
  612. }
  613. .text {
  614. padding-left:91rpx;
  615. position:relative;
  616. z-index: 10;
  617. font-size: 32rpx;
  618. font-weight: bold;
  619. color: #FFFFFF;
  620. }
  621. .img {
  622. position:absolute;
  623. left:0;
  624. top:0;
  625. width:100%;
  626. height:100%;
  627. }
  628. }
  629. }
  630. }
  631. }
  632. }
  633. .no_datas {
  634. margin-top: 70rpx;
  635. display: flex;
  636. flex-direction: column;
  637. align-items: center;
  638. .courses {
  639. width: 360rpx;
  640. height: 349rpx;
  641. }
  642. .no_learns {
  643. font-size: 32rpx;
  644. color: #999;
  645. margin: 46rpx 0rpx 56rpx;
  646. }
  647. .choose {
  648. width: 280rpx;
  649. height: 64rpx;
  650. line-height: 64rpx;
  651. border-radius: 32rpx;
  652. background-color: #007AFF;
  653. color: #fff;
  654. font-size: 30rpx;
  655. text-align: center;
  656. }
  657. }
  658. </style>