index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  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 class="live_item">
  19. <view class="live_con">
  20. <view class="live_status">
  21. <image src="/static/learn/living.png" class="liv_icon"></image>
  22. <!-- <image src="/static/learn/wlive.png" class="my_bg"></image> -->
  23. <text class="status_s">正在直播中...</text>
  24. <view class="look_bt">点击观看</view>
  25. </view>
  26. <view class="liv_time">
  27. 7月19日 15:00
  28. </view>
  29. <view class="liv_title">一级建造师《水利实务》拔高训练直播</view>
  30. </view>
  31. <!-- <image src="/static/learn/wlive_bg.png" class="my_bg"></image> -->
  32. <image src="/static/learn/living_bg.png" class="my_bg"></image>
  33. </view>
  34. </view>
  35. <!-- 我的课程 -->
  36. <view class="my_courses">
  37. <text class="titles">我的课程</text>
  38. <view v-for="(item, index) in courseLists" :key="index" class="course_item">
  39. <view class="lefts">
  40. <image class="lefet_img" :src="$method.splitImgHost(item.coverUrl, true)" mode=""></image>
  41. <view class="live_icon">直播</view>
  42. </view>
  43. <view class="rights">
  44. <view>
  45. <view class="cou_titles">{{ item.goodsName }}</view>
  46. <view v-if="item.serviceStartTime && item.serviceEndTime" class="learn_ranges">
  47. <image class="l_range" src="/static/learn/learn_range.png"></image>
  48. 学习周期:
  49. <text class="l_time">{{ item.serviceStartTime | formate('yyyy.mm.dd') }} - {{ item.serviceEndTime | formate('yyyy.mm.dd') }}</text>
  50. <!-- <text class="l_time">{{ $method.formate(item.studyStartTime,'yyyy.mm.dd') }} - {{ $method.formate(item.studyStartTime,'yyyy.mm.dd') }}</text> -->
  51. </view>
  52. </view>
  53. <view class="learn_progress">
  54. <view class="progress_up">
  55. <image src="/static/icon/wk_icon3.png" class="wk_icon"></image>
  56. 学习进度:{{ item.stuAllNum+item.recordNum }}/{{ item.secAllNum+item.examNum }}
  57. </view>
  58. <view class="progress_down">
  59. <view class="progress_bar" style="width: 50%;">
  60. <u-line-progress :showText="false" height="32" active-color="#ff9900" :show-percent="false"
  61. :percent="((item.stuAllNum+item.recordNum) / (item.secAllNum+item.examNum)) * 100"></u-line-progress>
  62. </view>
  63. <view class="enter_into" @click.stop="studyIn(item.goodsId,item.gradeId,item,index)">进入学习</view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <!-- 我的题库 -->
  70. <view class="my_courses">
  71. <text class="titles">我的题库</text>
  72. <view class="bottoms">
  73. <navigator hover-class="none" url="/pages2/subject/collect">
  74. <view class="item collect">
  75. <view class="text">收藏集<u-icon name="arrow-right"></u-icon></view>
  76. <image class="img" src="/static/questionBank_collect.png"></image>
  77. </view>
  78. </navigator>
  79. <view class="item list">
  80. <navigator hover-class="none" url="/pages2/bank/question_record">
  81. <view class="list-in">
  82. <image class="img" src="/static/questionBank_record.png" ></image>
  83. <view class="text">
  84. 做题记录 <u-icon name="arrow-right"></u-icon>
  85. </view>
  86. </view>
  87. </navigator>
  88. <navigator hover-class="none" url="/pages2/subject/wrong">
  89. <view class="list-in">
  90. <image class="img" src="/static/questionBank_wrong.png"></image>
  91. <view class="text">
  92. 错题集 <u-icon name="arrow-right"></u-icon>
  93. </view>
  94. </view>
  95. </navigator>
  96. </view>
  97. </view>
  98. <view v-for="(item, indexq) in questionLists" :key="indexq" class="course_item">
  99. <view class="lefts">
  100. <image class="lefet_img" :src="$method.splitImgHost(item.coverUrl, true)" mode=""></image>
  101. <!-- <view class="live_icon">直播</view> -->
  102. </view>
  103. <view class="rights">
  104. <view>
  105. <view class="cou_titles">{{ item.goodsName }}</view>
  106. <view v-if="item.serviceStartTime && item.serviceEndTime" class="learn_ranges">
  107. <image class="l_range" src="/static/learn/learn_range.png"></image>
  108. 学习周期:
  109. <text class="l_time">{{ item.serviceStartTime | formate('yyyy.mm.dd') }} - {{ item.serviceEndTime | formate('yyyy.mm.dd') }}</text>
  110. </view>
  111. </view>
  112. <view class="learn_progress">
  113. <view class="progress_up">
  114. <image src="/static/icon/wk_icon3.png" class="wk_icon"></image>
  115. 学习进度:{{item.doNum}}/{{item.totalNum}}
  116. </view>
  117. <view class="progress_down">
  118. <view class="progress_bar" style="width: 50%;">
  119. <u-line-progress :show-percent="false" height="32" active-color="#007AFF" :percent="(item.doNum/item.totalNum)*100"></u-line-progress>
  120. </view>
  121. <view class="enter_into" @click="studyques(item,index)">进入练习</view>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. <!-- 没有学习的课程 -->
  129. <view v-if="false" class="no_datas">
  130. <image class="courses" src="/static/learn/no_course.png" mode=""></image>
  131. <view class="no_learns">您目前没有可学习的课程</view>
  132. <view class="choose" @click="toChoose()">立即去选购</view>
  133. </view>
  134. </view>
  135. </view>
  136. </template>
  137. <script>
  138. export default {
  139. data() {
  140. return {
  141. paramC: {
  142. pageNum: 1,
  143. pageSize: 50
  144. },
  145. activeItem: {},
  146. itemIndex: '',
  147. confirmTimer:null,
  148. confirmCount:10,
  149. confirmChecked:false,
  150. showUserConfirmInfo:false,
  151. selectItem: {},
  152. selectClassModal: false,
  153. gradeList: [],
  154. gradeValue: -1,
  155. sysTime: 0,
  156. // totalC: 0,
  157. courseLists: [],
  158. questionLists: [], // 题库
  159. paramQ: {
  160. pageNum: 1,
  161. pageSize: 50
  162. },
  163. queitemIndex:'',
  164. }
  165. },
  166. onLoad(option) {
  167. this.getcourseList()
  168. this.getlistQuestion()
  169. },
  170. async onShow() {
  171. await this.commonSystemTime()
  172. this.sysTime = +this.$method.timest()
  173. console.log('this.sysTime', this.sysTime)
  174. },
  175. methods: {
  176. toChoose() {
  177. uni.switchTab({
  178. url:'/pages/course/index'
  179. })
  180. },
  181. // 查询用户拥有的商品/课程列表/course/goodsList
  182. getcourseList() {
  183. this.$api.courseGoodsList(this.paramC).then(res => {
  184. if (res.data.code == 200) {
  185. this.courseLists = res.data.rows || []
  186. }
  187. })
  188. },
  189. // 题库列表
  190. getlistQuestion() {
  191. this.$api.listGoodsUserQuestion(this.paramQ).then(res => {
  192. if (res.data.code == 200) {
  193. this.questionLists = res.data.rows || []
  194. }
  195. })
  196. },
  197. commonSystemTime() {
  198. return new Promise(resolve => {
  199. this.$api.commonSystemTime().then(res => {
  200. this.sysTime = res.data.data;
  201. })
  202. })
  203. },
  204. async studyIn(v, i, item, index) {
  205. console.log('item', item)
  206. this.activeItem = item
  207. if (item.interfaceAccountId > 0) { //学习账号已开通
  208. if (item.learnStatus == 1) { //跳转第三方h5
  209. // this.showMark = true;
  210. console.log('dshfisdgfo')
  211. uni.navigateTo({
  212. url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&isOther=1`
  213. })
  214. return;
  215. // uni.navigateTo({
  216. // url:'/pages/webview/index?url='+item.officialLearningUrl
  217. // })
  218. // return;
  219. } else {
  220. uni.showModal({
  221. showCancel: false,
  222. content: '您的学习账号未开通,请稍后再尝试,有疑问,请联系020-87085982!'
  223. });
  224. return;
  225. }
  226. return;
  227. }
  228. if (item.serviceStartTime && (this.sysTime <= item.serviceStartTime || this.sysTime >= item.serviceEndTime)) {
  229. uni.showToast({
  230. icon: 'none',
  231. title: '不在学习服务期,不能进入学习'
  232. })
  233. return;
  234. }
  235. if ((item.classStartTime && this.sysTime <= item.classStartTime) || (item.classEndTime && this
  236. .sysTime >= item.classEndTime)) {
  237. uni.showToast({
  238. icon: 'none',
  239. title: '不在班级有效期,不能进入学习'
  240. })
  241. return
  242. }
  243. if (item.learningStatus == 2) {
  244. uni.showToast({
  245. icon: 'none',
  246. title: '开放学习时间待定,不能进入学习'
  247. })
  248. return
  249. }
  250. if (item.classStatus == 0) {
  251. uni.showToast({
  252. icon: 'none',
  253. title: '尚未开班,不能进入学习'
  254. })
  255. return
  256. }
  257. console.log(this.sysTime, item.learningTimeStart)
  258. console.log(this.sysTime < item.learningTimeStart)
  259. if (item.learningStatus == 3 && (this.sysTime < item.learningTimeStart)) {
  260. uni.showToast({
  261. icon: 'none',
  262. title: '不在开放学习时间,不能进入学习'
  263. })
  264. return;
  265. }
  266. // 这里的一建先不用
  267. // var confirmDetail = true
  268. // if (item.educationName == '继续教育') {
  269. // if(item.officialName && item.businessName == '二级' && item.projectName == '建造师') {
  270. // confirmDetail = await this.userConfirmInfoDetail()
  271. // }
  272. // }
  273. // if(!confirmDetail) {
  274. // return;
  275. // }
  276. // //内部系统
  277. // if (item.interfacePushId > 0 && item.officialStatus != 1) {
  278. // uni.showModal({
  279. // showCancel: false,
  280. // content: '机构正在为您报名中,请耐心等待,有疑问请联系020-87085982!'
  281. // });
  282. // return;
  283. // }
  284. // 这里的一建先不用
  285. // this.itemIndex = index;
  286. // if (item.gradeStatus == 1 && item.status == 1 && (item.serviceEndTime > this.sysTime) && (item
  287. // .classEndTime && (item.classEndTime < this.sysTime)) && (item.periodStatus == 0 || item
  288. // .periodStatus == -1) && item.studyCount > 0) {
  289. // this.selectClass(item, index);
  290. // return;
  291. // }
  292. // /course/goodsRebuildStatus查询用户商品重修状态
  293. let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId, item.gradeId)
  294. if (rebuildStatus == 0) {
  295. this.$navTo.togo('/pages2/learn/details', {
  296. gradeId: item.gradeId,
  297. goodsId: item.goodsId,
  298. orderGoodsId: item.orderGoodsId,
  299. });
  300. return;
  301. }
  302. // if (item.educationName == '继续教育') {
  303. // /lock/lockStatus
  304. this.$api.lockLockStatus({
  305. action: 'jxjy',
  306. uuid:this.$method.getUuid()
  307. }).then(res => {
  308. if (res.data.code == 200) { //有其他端在操作,不能学习
  309. uni.showToast({
  310. icon: 'none',
  311. title: res.data.msg,
  312. mask: true,
  313. duration: 3000
  314. })
  315. } else if (res.data.code == 500) { //可以学习
  316. if (item.courseNum == 1) { // 课程数量
  317. // /course/courseList查询商品下的课程列表
  318. this.$api.courseCourseList({
  319. pageNum: 1,
  320. pageSize: 1,
  321. goodsId: item.goodsId,
  322. gradeId: item.gradeId,
  323. orderGoodsId: item.orderGoodsId,
  324. }).then(res => {
  325. if (res.data.code == 200) {
  326. // if(item.officialName && item.businessName == '二级' && item.projectName == '建造师') {
  327. // this.userConfirmInfoDetail().then(() => {
  328. // uni.navigateTo({
  329. // url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}`
  330. // })
  331. // })
  332. // } else {
  333. uni.navigateTo({
  334. url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}`
  335. })
  336. // }
  337. }
  338. });
  339. return;
  340. }
  341. // if(item.officialName && item.businessName == '二级' && item.projectName == '建造师') {
  342. // // this.userConfirmInfoDetail().then(() => {
  343. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  344. // // })
  345. // } else {
  346. this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  347. // }
  348. }
  349. })
  350. },
  351. /**
  352. * @param {Object} goodsId 商品id
  353. * 查询商品重修状态
  354. */
  355. courseGoodsRebuildStatus(goodsId, gradeId) {
  356. return new Promise(resolve => {
  357. this.$api.courseGoodsRebuildStatus({
  358. goodsId: goodsId,
  359. gradeId: gradeId
  360. }).then(res => {
  361. resolve(res.data.data)
  362. })
  363. })
  364. },
  365. userConfirmInfoDetail(){
  366. return new Promise(resolve => {
  367. this.$api.userConfirmInfoDetail({
  368. orderGoodsId:this.activeItem.orderGoodsId,
  369. }).then(res => {
  370. if(!res.data.data) {
  371. clearInterval(this.confirmTimer);
  372. this.confirmCount = 10;
  373. this.showUserConfirmInfo = true;
  374. this.confirmTimer = setInterval(() => {
  375. if(this.confirmCount > 0) {
  376. this.confirmCount--
  377. } else {
  378. clearInterval(this.confirmTimer);
  379. }
  380. },1000)
  381. } else {
  382. if(res.data.data.pushInfo) {
  383. resolve(true)
  384. } else {
  385. uni.showModal({
  386. showCancel:false,
  387. title:'提示',
  388. content:'开通信息推送不成功,无法进入学习,请联系020-87085982!'
  389. })
  390. resolve(false)
  391. }
  392. }
  393. })
  394. })
  395. },
  396. selectClass(item, index) {
  397. console.log(item)
  398. this.itemIndex = index;
  399. this.selectItem = item;
  400. this.selectClassModal = true;
  401. this.goodsGradeList(item.goodsId);
  402. },
  403. goodsGradeList(id) {
  404. this.$api.goodsGradeList({
  405. goodsId: id
  406. }).then(res => {
  407. if (res.data.code == 200) {
  408. this.gradeList = res.data.rows
  409. if (this.gradeList.length == 0) {
  410. let item = {
  411. className: '系统分班',
  412. gradeId: 0
  413. }
  414. this.gradeList.push(item)
  415. } else {
  416. let isGradeFull = this.gradeList.every(item => (item.studentNum > 0 && item
  417. .studentNum == item.studentUpper))
  418. //所有班级都满了
  419. if (isGradeFull) {
  420. let item = {
  421. className: '系统分班',
  422. gradeId: 0
  423. }
  424. this.gradeList.unshift(item)
  425. }
  426. }
  427. }
  428. });
  429. },
  430. // 进入刷题
  431. studyques(item,index){
  432. console.log(item)
  433. this.queitemIndex = index;
  434. let sysTime = this.$method.timest()
  435. if (item.serviceStartTime && item.serviceEndTime && (sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime)) {
  436. uni.showToast({
  437. icon: 'none',
  438. title: '不在学习服务期,不能进入学习'
  439. })
  440. return;
  441. }
  442. uni.navigateTo({
  443. url:'/pages2/bank/question_detail?id='+item.goodsId+'&orderGoodsId='+item.orderGoodsId
  444. })
  445. },
  446. }
  447. }
  448. </script>
  449. <style>
  450. page {
  451. background: #eaeef1;
  452. }
  453. </style>
  454. <style lang="scss" scoped>
  455. @import './index.scss';
  456. </style>