index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. options:{}
  103. }
  104. },
  105. computed: {
  106. ...mapGetters(['userInfo']),
  107. },
  108. onLoad(options) {
  109. this.options = option
  110. },
  111. async onShow() {
  112. if (this.option.skipPort) {
  113. await this.$method.skipLogin(this.option.skipPort)
  114. }
  115. this.param.pageNum = 1
  116. this.questionLists = []
  117. this.getBankList()
  118. },
  119. onPullDownRefresh() {
  120. this.param.pageNum = 1
  121. this.questionLists = []
  122. this.getBankList()
  123. },
  124. onReachBottom() {
  125. if (this.questionLists.length < this.total) {
  126. this.param.pageNum++
  127. this.getBankList()
  128. }
  129. },
  130. methods: {
  131. // 查询用户拥有免费+自购题库商品 /bank/question/listUserFreeUnionBuyGoodsList
  132. getBankList() {
  133. if (!this.$method.isLogin()) {
  134. return;
  135. }
  136. this.allLoading = true
  137. this.$api.listUserFreeUnionBuyGoodsList(this.param).then((res) => {
  138. if (res.data.code == 200) {
  139. this.questionLists.push(...(res.data.rows || [] ))
  140. console.log('this.courseList', this.questionLists)
  141. this.total = res.data.total
  142. }
  143. this.allLoading = false
  144. }).catch((err) => {
  145. this.allLoading = false
  146. })
  147. },
  148. toChoose() {
  149. uni.switchTab({
  150. url:'/pages/course/index'
  151. })
  152. },
  153. toDailyPractice(item, child) {
  154. this.$api.lockLockStatus({
  155. action:'bank',
  156. uuid: this.$method.getUuid()
  157. }).then(res => {
  158. if(res.data.code == 200) { //有其他端在操作,不能学习
  159. uni.showToast({
  160. icon: 'none',
  161. title: res.data.msg,
  162. duration: 3000,
  163. })
  164. } else if(res.data.code == 500) { //可以学习
  165. if (child.paperName == '每日一练') {
  166. uni.navigateTo({
  167. url: '/pages2/dailyPractice/index?goodsId=' + item.goodsId + '&orderGoodsId=' + item.orderGoodsId
  168. })
  169. } else if (child.paperName == '随机练习') {
  170. uni.navigateTo({
  171. url: '/pages2/randomPractice/index?goodsId=' + item.goodsId + '&orderGoodsId=' + item.orderGoodsId
  172. })
  173. } else {
  174. this.studyques(item, child)
  175. }
  176. }
  177. })
  178. },
  179. // 进入练习
  180. studyques(item, child){
  181. let sysTime = this.$method.timest()
  182. if (item.serviceStartTime && item.serviceEndTime && (sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime)) {
  183. uni.showToast({
  184. icon: 'none',
  185. title: '不在学习服务期,不能进入学习'
  186. })
  187. return;
  188. }
  189. let paperId = child && child.paperId || ''
  190. uni.navigateTo({
  191. url:'/pages2/bank/question_detail?id='+item.goodsId+'&orderGoodsId='+item.orderGoodsId + '&paperId=' + paperId
  192. })
  193. },
  194. },
  195. }
  196. </script>
  197. <style>
  198. page {
  199. background: #eaeef1;
  200. }
  201. </style>
  202. <style lang="scss" scoped>
  203. @import './index.scss';
  204. </style>