index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. if (!this.$method.isLogin()) {
  128. return;
  129. }
  130. this.allLoading = true
  131. this.$api.listUserFreeUnionBuyGoodsList(this.param).then((res) => {
  132. if (res.data.code == 200) {
  133. this.questionLists.push(...(res.data.rows || [] ))
  134. console.log('this.courseList', this.questionLists)
  135. this.total = res.data.total
  136. }
  137. this.allLoading = false
  138. }).catch((err) => {
  139. this.allLoading = false
  140. })
  141. },
  142. toChoose() {
  143. uni.switchTab({
  144. url:'/pages/course/index'
  145. })
  146. },
  147. toDailyPractice(item, child) {
  148. this.$api.lockLockStatus({
  149. action:'bank',
  150. uuid: this.$method.getUuid()
  151. }).then(res => {
  152. if(res.data.code == 200) { //有其他端在操作,不能学习
  153. uni.showToast({
  154. icon: 'none',
  155. title: res.data.msg,
  156. duration: 3000,
  157. })
  158. } else if(res.data.code == 500) { //可以学习
  159. if (child.paperName == '每日一练') {
  160. uni.navigateTo({
  161. url: '/pages2/dailyPractice/index?goodsId=' + item.goodsId + '&orderGoodsId=' + item.orderGoodsId
  162. })
  163. } else if (child.paperName == '随机练习') {
  164. uni.navigateTo({
  165. url: '/pages2/randomPractice/index?goodsId=' + item.goodsId + '&orderGoodsId=' + item.orderGoodsId
  166. })
  167. } else {
  168. this.studyques(item, child)
  169. }
  170. }
  171. })
  172. },
  173. // 进入练习
  174. studyques(item, child){
  175. let sysTime = this.$method.timest()
  176. if (item.serviceStartTime && item.serviceEndTime && (sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime)) {
  177. uni.showToast({
  178. icon: 'none',
  179. title: '不在学习服务期,不能进入学习'
  180. })
  181. return;
  182. }
  183. let paperId = child && child.paperId || ''
  184. uni.navigateTo({
  185. url:'/pages2/bank/question_detail?id='+item.goodsId+'&orderGoodsId='+item.orderGoodsId + '&paperId=' + paperId
  186. })
  187. },
  188. },
  189. }
  190. </script>
  191. <style>
  192. page {
  193. background: #eaeef1;
  194. }
  195. </style>
  196. <style lang="scss" scoped>
  197. @import './index.scss';
  198. </style>