index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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. uni.navigateTo({
  210. url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&isOther=1`
  211. })
  212. return;
  213. } else {
  214. uni.showModal({
  215. showCancel: false,
  216. content: '您的学习账号未开通,请稍后再尝试,有疑问,请联系020-87085982!'
  217. });
  218. return;
  219. }
  220. return;
  221. }
  222. if (item.serviceStartTime && (this.sysTime <= item.serviceStartTime || this.sysTime >= item.serviceEndTime)) {
  223. uni.showToast({
  224. icon: 'none',
  225. title: '不在学习服务期,不能进入学习'
  226. })
  227. return;
  228. }
  229. if ((item.classStartTime && this.sysTime <= item.classStartTime) || (item.classEndTime && this
  230. .sysTime >= item.classEndTime)) {
  231. uni.showToast({
  232. icon: 'none',
  233. title: '不在班级有效期,不能进入学习'
  234. })
  235. return
  236. }
  237. if (item.learningStatus == 2) {
  238. uni.showToast({
  239. icon: 'none',
  240. title: '开放学习时间待定,不能进入学习'
  241. })
  242. return
  243. }
  244. if (item.classStatus == 0) {
  245. uni.showToast({
  246. icon: 'none',
  247. title: '尚未开班,不能进入学习'
  248. })
  249. return
  250. }
  251. console.log(this.sysTime, item.learningTimeStart)
  252. console.log(this.sysTime < item.learningTimeStart)
  253. if (item.learningStatus == 3 && (this.sysTime < item.learningTimeStart)) {
  254. uni.showToast({
  255. icon: 'none',
  256. title: '不在开放学习时间,不能进入学习'
  257. })
  258. return;
  259. }
  260. // /course/goodsRebuildStatus查询用户商品重修状态
  261. let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId, item.gradeId)
  262. if (rebuildStatus == 0) {
  263. this.$navTo.togo('/pages2/learn/details', {
  264. gradeId: item.gradeId,
  265. goodsId: item.goodsId,
  266. orderGoodsId: item.orderGoodsId,
  267. });
  268. return;
  269. }
  270. // /lock/lockStatus
  271. this.$api.lockLockStatus({
  272. action: 'jxjy',
  273. uuid:this.$method.getUuid()
  274. }).then(res => {
  275. if (res.data.code == 200) { //有其他端在操作,不能学习
  276. uni.showToast({
  277. icon: 'none',
  278. title: res.data.msg,
  279. mask: true,
  280. duration: 3000
  281. })
  282. } else if (res.data.code == 500) { //可以学习
  283. if (item.courseNum == 1) { // 课程数量
  284. // /course/courseList查询商品下的课程列表
  285. this.$api.courseCourseList({
  286. pageNum: 1,
  287. pageSize: 1,
  288. goodsId: item.goodsId,
  289. gradeId: item.gradeId,
  290. orderGoodsId: item.orderGoodsId,
  291. }).then(res => {
  292. if (res.data.code == 200) {
  293. uni.navigateTo({
  294. url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}`
  295. })
  296. }
  297. });
  298. return;
  299. }
  300. this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  301. }
  302. })
  303. },
  304. /**
  305. * @param {Object} goodsId 商品id
  306. * 查询商品重修状态
  307. */
  308. courseGoodsRebuildStatus(goodsId, gradeId) {
  309. return new Promise(resolve => {
  310. this.$api.courseGoodsRebuildStatus({
  311. goodsId: goodsId,
  312. gradeId: gradeId
  313. }).then(res => {
  314. resolve(res.data.data)
  315. })
  316. })
  317. },
  318. userConfirmInfoDetail(){
  319. return new Promise(resolve => {
  320. this.$api.userConfirmInfoDetail({
  321. orderGoodsId:this.activeItem.orderGoodsId,
  322. }).then(res => {
  323. if(!res.data.data) {
  324. clearInterval(this.confirmTimer);
  325. this.confirmCount = 10;
  326. this.showUserConfirmInfo = true;
  327. this.confirmTimer = setInterval(() => {
  328. if(this.confirmCount > 0) {
  329. this.confirmCount--
  330. } else {
  331. clearInterval(this.confirmTimer);
  332. }
  333. },1000)
  334. } else {
  335. if(res.data.data.pushInfo) {
  336. resolve(true)
  337. } else {
  338. uni.showModal({
  339. showCancel:false,
  340. title:'提示',
  341. content:'开通信息推送不成功,无法进入学习,请联系020-87085982!'
  342. })
  343. resolve(false)
  344. }
  345. }
  346. })
  347. })
  348. },
  349. selectClass(item, index) {
  350. console.log(item)
  351. this.itemIndex = index;
  352. this.selectItem = item;
  353. this.selectClassModal = true;
  354. this.goodsGradeList(item.goodsId);
  355. },
  356. goodsGradeList(id) {
  357. this.$api.goodsGradeList({
  358. goodsId: id
  359. }).then(res => {
  360. if (res.data.code == 200) {
  361. this.gradeList = res.data.rows
  362. if (this.gradeList.length == 0) {
  363. let item = {
  364. className: '系统分班',
  365. gradeId: 0
  366. }
  367. this.gradeList.push(item)
  368. } else {
  369. let isGradeFull = this.gradeList.every(item => (item.studentNum > 0 && item
  370. .studentNum == item.studentUpper))
  371. //所有班级都满了
  372. if (isGradeFull) {
  373. let item = {
  374. className: '系统分班',
  375. gradeId: 0
  376. }
  377. this.gradeList.unshift(item)
  378. }
  379. }
  380. }
  381. });
  382. },
  383. // 进入刷题
  384. studyques(item,index){
  385. console.log(item)
  386. this.queitemIndex = index;
  387. let sysTime = this.$method.timest()
  388. if (item.serviceStartTime && item.serviceEndTime && (sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime)) {
  389. uni.showToast({
  390. icon: 'none',
  391. title: '不在学习服务期,不能进入学习'
  392. })
  393. return;
  394. }
  395. uni.navigateTo({
  396. url:'/pages2/bank/question_detail?id='+item.goodsId+'&orderGoodsId='+item.orderGoodsId
  397. })
  398. },
  399. }
  400. }
  401. </script>
  402. <style>
  403. page {
  404. background: #eaeef1;
  405. }
  406. </style>
  407. <style lang="scss" scoped>
  408. @import './index.scss';
  409. </style>