index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="questionBank">
  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. <!-- 有学习的课程 -->
  10. <view v-if="questionLists.length" class="had_courses">
  11. <!-- 我的题库 -->
  12. <view class="my_courses">
  13. <text class="titles">我的题库</text>
  14. <view class="bottoms">
  15. <navigator hover-class="none" url="/pages2/subject/collect">
  16. <view class="item collect">
  17. <view class="text">收藏集<u-icon name="arrow-right"></u-icon></view>
  18. <image class="img" src="/static/questionBank_collect.png"></image>
  19. </view>
  20. </navigator>
  21. <view class="item list">
  22. <navigator hover-class="none" url="/pages2/bank/question_record">
  23. <view class="list-in">
  24. <image class="img" src="/static/questionBank_record.png" ></image>
  25. <view class="text">
  26. 做题记录 <u-icon name="arrow-right"></u-icon>
  27. </view>
  28. </view>
  29. </navigator>
  30. <navigator hover-class="none" url="/pages2/subject/wrong">
  31. <view class="list-in">
  32. <image class="img" src="/static/questionBank_wrong.png"></image>
  33. <view class="text">
  34. 错题集 <u-icon name="arrow-right"></u-icon>
  35. </view>
  36. </view>
  37. </navigator>
  38. </view>
  39. </view>
  40. <template v-if="questionLists.length">
  41. <!-- @click="studyques(item)" -->
  42. <view v-for="(item, index) in questionLists" :key="index" class="course_item">
  43. <view>
  44. <view class="cou_titles">{{ item.goodsName }}</view>
  45. <view v-if="item.serviceStartTime && item.serviceEndTime" class="learn_ranges">
  46. <image class="l_range" src="/static/learn/learn_range.png"></image>
  47. 学习周期:
  48. <text class="l_time">{{ item.serviceStartTime | formate('yyyy.mm.dd') }} - {{ item.serviceEndTime | formate('yyyy.mm.dd') }}</text>
  49. </view>
  50. </view>
  51. <view class="c_downs">
  52. <view class="lefts">
  53. <image class="lefet_img" :src="$method.splitImgHost(item.coverUrl, true)" mode=""></image>
  54. </view>
  55. <view class="rights">
  56. <view class="learn_progress">
  57. <view class="progress_up">
  58. <view>
  59. 学习进度:{{item.doNum}}/{{item.totalNum}}
  60. </view>
  61. <view class="progress_bar" style="width: 100%;">
  62. <u-line-progress :show-percent="false" height="22" active-color="#ff9900" :percent="(item.doNum/item.totalNum)*100"></u-line-progress>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <!-- 按钮 -->
  69. <view class="study_btns">
  70. <view v-for="(child, c_index) in item.paperVos" :key="c_index" class="exam_word intos"
  71. @click.stop="toDailyPractice(item, child)">{{ child.paperName }}</view>
  72. <!-- <view class="exam_word intos" @click="studyques(item)">章节练习</view> -->
  73. </view>
  74. </view>
  75. </template>
  76. </view>
  77. </view>
  78. <!-- 没有学习的课程 -->
  79. <view v-if="!allLoading && !questionLists.length" class="no_datas">
  80. <!-- <image class="courses" src="/static/learn/no_course.png" mode=""></image>
  81. <view class="no_learns">您目前没有可学习的题库</view> -->
  82. <image src="/static/learn/empty_status.png" class="empty_status"></image>
  83. <text class="word_tip">暂无题库</text>
  84. <view class="choose" @click="toChoose()">立即去选购</view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. import { mapGetters } from 'vuex'
  90. import { tenantId } from '@/common/request.js';
  91. export default {
  92. data() {
  93. return {
  94. tenantId: tenantId,
  95. allLoading: false, // 加载样式
  96. questionLists: [], // 题库列表
  97. param: {
  98. pageNum: 1,
  99. pageSize: 10
  100. },
  101. total: 0,
  102. }
  103. },
  104. computed: {
  105. ...mapGetters(['userInfo']),
  106. },
  107. onLoad() {},
  108. onShow() {
  109. this.param.pageNum = 1
  110. this.questionLists = []
  111. this.getBankList()
  112. },
  113. onPullDownRefresh() {
  114. this.param.pageNum = 1
  115. this.questionLists = []
  116. this.getBankList()
  117. },
  118. onReachBottom() {
  119. if (this.questionLists.length < this.total) {
  120. this.param.pageNum++
  121. this.getBankList()
  122. }
  123. },
  124. methods: {
  125. // 查询用户拥有免费+自购题库商品 /bank/question/listUserFreeUnionBuyGoodsList
  126. getBankList() {
  127. this.allLoading = true
  128. this.$api.listUserFreeUnionBuyGoodsList(this.param).then((res) => {
  129. if (res.data.code == 200) {
  130. this.questionLists.push(...(res.data.rows || [] ))
  131. console.log('this.courseList', this.questionLists)
  132. this.total = res.data.total
  133. }
  134. this.allLoading = false
  135. }).catch((err) => {
  136. this.allLoading = false
  137. })
  138. },
  139. toChoose() {
  140. uni.switchTab({
  141. url:'/pages/course/index'
  142. })
  143. },
  144. toDailyPractice(item, child) {
  145. this.$api.lockLockStatus({
  146. action:'bank',
  147. uuid: this.$method.getUuid()
  148. }).then(res => {
  149. if(res.data.code == 200) { //有其他端在操作,不能学习
  150. uni.showToast({
  151. icon: 'none',
  152. title: res.data.msg,
  153. duration: 3000,
  154. })
  155. } else if(res.data.code == 500) { //可以学习
  156. if (child.paperName == '每日一练') {
  157. uni.navigateTo({
  158. url: '/pages2/dailyPractice/index?goodsId=' + item.goodsId + '&orderGoodsId=' + item.orderGoodsId
  159. })
  160. } else if (child.paperName == '随机练习') {
  161. uni.navigateTo({
  162. url: '/pages2/randomPractice/index?goodsId=' + item.goodsId + '&orderGoodsId=' + item.orderGoodsId
  163. })
  164. } else {
  165. this.studyques(item, child)
  166. }
  167. }
  168. })
  169. },
  170. // 进入练习
  171. studyques(item, child){
  172. let sysTime = this.$method.timest()
  173. if (item.serviceStartTime && item.serviceEndTime && (sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime)) {
  174. uni.showToast({
  175. icon: 'none',
  176. title: '不在学习服务期,不能进入学习'
  177. })
  178. return;
  179. }
  180. let paperId = child && child.paperId || ''
  181. uni.navigateTo({
  182. url:'/pages2/bank/question_detail?id='+item.goodsId+'&orderGoodsId='+item.orderGoodsId + '&paperId=' + paperId
  183. })
  184. },
  185. },
  186. }
  187. </script>
  188. <style>
  189. page {
  190. background: #eaeef1;
  191. }
  192. </style>
  193. <style lang="scss" scoped>
  194. @import './index.scss';
  195. </style>